diff --git a/module/fid/src/View/Helper/Root/Factory.php b/module/fid/src/View/Helper/Root/Factory.php index 044f0f58ea67c15ebf5c3fa731bc7d45b69e8bc7..748ade5758933010ab4916a8aef63275d1263da4 100644 --- a/module/fid/src/View/Helper/Root/Factory.php +++ b/module/fid/src/View/Helper/Root/Factory.php @@ -38,8 +38,6 @@ use Interop\Container\ContainerInterface; * @author Demian Katz <demian.katz@villanova.edu> * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License * @link https://vufind.org/wiki/development Wiki - * - * @codeCoverageIgnore */ class Factory { diff --git a/module/fid/src/View/Helper/Root/GetIt.php b/module/fid/src/View/Helper/Root/GetIt.php index af1f8c9e2be8c3ae10504eaba074ee1d071e01a1..53c88f13f93bd3003b5b1cf1ce4725ffdd777f15 100644 --- a/module/fid/src/View/Helper/Root/GetIt.php +++ b/module/fid/src/View/Helper/Root/GetIt.php @@ -46,19 +46,13 @@ class GetIt extends AbstractHelper { use TranslatorAwareTrait; - /** - * @var \Zend\Config\Config - */ + /* @var \Zend\Config\Config */ protected $config; - /** - * @var AbstractBase - */ + /* @var AbstractBase */ protected $driver; - /** - * @var array list of available source ID definitions from config - */ + /* @var array list of available source ID definitions from config */ protected $sids = [ 'source_idsV1', 'source_idsV3', @@ -165,7 +159,7 @@ class GetIt extends AbstractHelper protected $accordeonColorDefault; /** - * second color of the accordeon + * Second color of the accordeon * * @var */ @@ -179,7 +173,7 @@ class GetIt extends AbstractHelper protected $accordeonHeadlineDefault; /** - * second headline text of the get it box + * Second headline text of the get it box * * @var */ @@ -188,7 +182,9 @@ class GetIt extends AbstractHelper /** * GetIt constructor. * - * @param Config $getItConfig Get It box Configuration + * @param $getItConfig Config + * @param $fidClient FIDIS Client + * @param $permissionManager Permission Manager */ public function __construct($getItConfig, $fidClient, $permissionManager) { @@ -200,7 +196,9 @@ class GetIt extends AbstractHelper /** * Get Solr field data * - * @param $driver + * @param $driver Record Driver + * + * @return GetIt GetIt View Helper */ public function __invoke($driver) { @@ -224,6 +222,13 @@ class GetIt extends AbstractHelper return $this; } + /** + * Check if User is authorized + * + * @param $permission Permission + * + * @return bool + */ protected function hasPermission($permission) { return $this->permissionManager->isAuthorized($permission); @@ -232,7 +237,7 @@ class GetIt extends AbstractHelper /** * Retrieve SIDs from config (getit.ini) * - * @param $value + * @param $value sid * * @return array */ @@ -245,7 +250,7 @@ class GetIt extends AbstractHelper /** * Retrieve NonSIDs from config (getit.ini) * - * @param $value + * @param $value sid * * @return string */ @@ -259,7 +264,7 @@ class GetIt extends AbstractHelper * Read specific config of given record * Set default Values of getit box * - * @return array config of given record + * @return array config of given record */ public function getConfig() { @@ -340,6 +345,8 @@ class GetIt extends AbstractHelper * @param $hideNotice boolean hide notice * @param $isAiSidRecord boolean is given record an ai record * @param $noticeLinkType string type of link + * + * @return void */ public function get_config_source_idsV1( &$accordeonColor, @@ -379,6 +386,8 @@ class GetIt extends AbstractHelper * @param $hideNotice boolean hide notice * @param $isAiSidRecord boolean is given record an ai record * @param $noticeLinkType string type of link + * + * @return void */ public function get_config_source_idsV3( &$accordeonColor, @@ -397,7 +406,8 @@ class GetIt extends AbstractHelper ) { $accordeonColor = $this->accordeonColorAlternative; $accordeonHeadline = $this->accordeonHeadlineAlternative; - $boxHeadline = $this->fidClient->isLoggedOn() ? $this->translate('Get it') : $this->translate('getit_logged_not'); + $boxHeadline = $this->fidClient->isLoggedOn() ? + $this->translate('Get it') : $this->translate('getit_logged_not'); $notice = ''; $isAiSidRecord = true; $showArticleButton = $this->config->Permission->allowSubitoArticleCopy ?? true; @@ -421,6 +431,8 @@ class GetIt extends AbstractHelper * @param $hideNotice boolean hide notice * @param $isAiSidRecord boolean is given record an ai record * @param $noticeLinkType string type of link + * + * @return void */ public function get_config_source_idsV4( &$accordeonColor, @@ -437,7 +449,8 @@ class GetIt extends AbstractHelper &$isAiSidRecord, &$noticeLinkType ) { - $boxHeadline = $this->fidClient->isLoggedOn() ? $this->translate('Get it') : $this->translate('getit_logged_not'); + $boxHeadline = $this->fidClient->isLoggedOn() ? + $this->translate('Get it') : $this->translate('getit_logged_not'); if ($this->fidClient->isLoggedOn()) { $notice = $this->translate('getit_text_12'); } else { @@ -465,6 +478,8 @@ class GetIt extends AbstractHelper * @param $hideNotice boolean hide notice * @param $isAiSidRecord boolean is given record an ai record * @param $noticeLinkType string type of link + * + * @return void */ public function get_config_source_idsV5( &$accordeonColor, @@ -499,7 +514,8 @@ class GetIt extends AbstractHelper $notice = $this->translate('getit_text_3_1'); $noticeLinkType = "register"; } - $boxHeadline = $this->fidClient->isLoggedOn() ? $this->translate('Get it') : $this->translate('getit_logged_not'); + $boxHeadline = $this->fidClient->isLoggedOn() ? + $this->translate('Get it') : $this->translate('getit_logged_not'); $showLinks = $this->fidClient->isLoggedOn() && $hasEBookAccess; } @@ -521,6 +537,8 @@ class GetIt extends AbstractHelper * @param $hideNotice boolean hide notice * @param $isAiSidRecord boolean is given record an ai record * @param $noticeLinkType string type of link + * + * @return void */ public function get_config_source_idsV6( &$accordeonColor, @@ -558,6 +576,8 @@ class GetIt extends AbstractHelper * @param $hideNotice boolean hide notice * @param $isAiSidRecord boolean is given record an ai record * @param $noticeLinkType string type of link + * + * @return void */ public function get_config_source_idsV7( &$accordeonColor, @@ -597,6 +617,8 @@ class GetIt extends AbstractHelper * @param $hideNotice boolean hide notice * @param $isAiSidRecord boolean is given record an ai record * @param $noticeLinkType string type of link + * + * @return void */ public function get_config_source_idsV8( &$accordeonColor, @@ -785,6 +807,8 @@ class GetIt extends AbstractHelper * @param $hideNotice boolean hide notice * @param $isAiSidRecord boolean is given record an ai record * @param $noticeLinkType string type of link + * + * @return void */ public function get_config_source_idsV9( &$accordeonColor, @@ -854,6 +878,8 @@ class GetIt extends AbstractHelper * @param $hideNotice boolean hide notice * @param $isAiSidRecord boolean is given record an ai record * @param $noticeLinkType string type of link + * + * @return void */ public function get_config_source_idsV10( &$accordeonColor, @@ -893,6 +919,8 @@ class GetIt extends AbstractHelper * @param $hideNotice boolean hide notice * @param $isAiSidRecord boolean is given record an ai record * @param $noticeLinkType string type of link + * + * @return void */ public function get_config_source_idsV11( &$accordeonColor, diff --git a/module/fid/src/View/Helper/Root/RecordDataFormatterFactory.php b/module/fid/src/View/Helper/Root/RecordDataFormatterFactory.php index 218028f8808e40d378de592ebfaafa2d98b61d92..32dd7611e0953bc81d46a3829d3393979b305fde 100644 --- a/module/fid/src/View/Helper/Root/RecordDataFormatterFactory.php +++ b/module/fid/src/View/Helper/Root/RecordDataFormatterFactory.php @@ -19,18 +19,28 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * @category VuFind FID + * @category VuFind * @package View_Helpers * @author Alexander Purr <purr@ub.uni-leipzig.de> * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License + * @link https://vufind.org/wiki/development Wiki */ namespace fid\View\Helper\Root; -use finc\View\Helper\Root\RecordDataFormatterFactory as FincRecordDataFormatterFactory; +use finc\View\Helper\Root\RecordDataFormatterFactory as Base; use VuFind\View\Helper\Root\RecordDataFormatter; use VuFind\View\Helper\Root\RecordDataFormatter\SpecBuilder; -class RecordDataFormatterFactory extends FincRecordDataFormatterFactory +/** + * Record Data Formatter Factory for Record view + * + * @category VuFind + * @package View_Helpers + * @author Alexander Purr <purr@ub.uni-leipzig.de> + * @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License + * @link https://vufind.org/wiki/development Wiki + */ +class RecordDataFormatterFactory extends Base { /** * Create the helper. diff --git a/module/fid/src/View/Helper/Root/UserGroups.php b/module/fid/src/View/Helper/Root/UserGroups.php index e3fe6d2dfe83b6941a1a11189646f256671354f7..668d900052c6f4e65d35cbac5b12c2c206c5576b 100644 --- a/module/fid/src/View/Helper/Root/UserGroups.php +++ b/module/fid/src/View/Helper/Root/UserGroups.php @@ -49,11 +49,17 @@ class UserGroups extends AbstractHelper protected $displayOrder; - private $groups; - + private $_groups; + + /** + * UserGroups constructor. + * + * @param $fidConfig fid.ini + */ public function __construct($fidConfig) { - $this->displayRoles = $fidConfig->UserProfile['role_display']->toArray() ?? []; + $this->displayRoles = $fidConfig->UserProfile['role_display'] + ->toArray() ?? []; foreach ($fidConfig->UserProfile['role_display_priority'] ?? [] as $prios) { $roles = explode('>', $prios); while (count($roles) > 1) { @@ -63,22 +69,33 @@ class UserGroups extends AbstractHelper } } } - $this->displayOrder = explode('>', $fidConfig->UserProfile['role_display_order'] ?? ''); + $this->displayOrder = explode( + '>', + $fidConfig->UserProfile['role_display_order'] ?? '' + ); } - + + /** + * Invoke UserGroups + * + * @param $permissions Permissions + * + * @return $this + */ public function __invoke($permissions) { - $this->groups['requested'] = - $this->groups['granted'] = array_fill_keys($this->displayOrder, null); + $this->_groups['requested'] + = $this->_groups['granted'] + = array_fill_keys($this->displayOrder, null); foreach ($permissions as $permission => $status) { // $status is in ['granted','requested'] if (in_array($permission, $this->displayRoles)) { - $this->groups[$status][$permission] = - $this->translate('fid::label_access_level_' . $permission); + $this->_groups[$status][$permission] + = $this->translate('fid::label_access_level_' . $permission); } } foreach (['granted','requested'] as $status) { - $groups = array_filter($this->groups[$status]); + $groups = array_filter($this->_groups[$status]); foreach ((array)$this->rolePriority as $role => $prioritized) { if (isset($groups[$role])) { foreach ($prioritized as $prio) { @@ -89,18 +106,29 @@ class UserGroups extends AbstractHelper } } } - $this->groups[$status] = $groups; + $this->_groups[$status] = $groups; } return $this; } - + + /** + * Get granted user groups + * + * @return string|null + */ public function granted() { - return !empty($this->groups['granted']) ? implode("; ", $this->groups['granted']) : null; + return !empty($this->_groups['granted']) ? + implode("; ", $this->_groups['granted']) : null; } - + + /** + * Get user groups, which are requested for access + * + * @return string|null + */ public function requested() { - return !empty($this->groups['requested']) ? implode('; ', $this->groups['requested']) : null; + return !empty($this->_groups['requested']) ? implode('; ', $this->_groups['requested']) : null; } }