protected function renderAdditionalActions(class_model $objListEntry)
 {
     if ($objListEntry instanceof class_module_tags_tag) {
         $arrButtons = array();
         $arrButtons[] = $this->objToolkit->listButton(class_link::getLinkAdmin($this->getArrModule("modul"), "showAssignedRecords", "&systemid=" . $objListEntry->getSystemid(), $this->getLang("action_show_assigned_records"), $this->getLang("action_show_assigned_records"), "icon_folderActionOpen"));
         if ($objListEntry->rightRight1()) {
             $strJs = "<script type='text/javascript'>KAJONA.admin.loader.loadFile('" . class_resourceloader::getInstance()->getCorePathForModule("module_tags") . "/module_tags/admin/scripts/tags.js', function() {\n                    KAJONA.admin.tags.createFavoriteEnabledIcon = '" . addslashes(class_adminskin_helper::getAdminImage("icon_favorite", $this->getLang("tag_favorite_remove"))) . "';\n                    KAJONA.admin.tags.createFavoriteDisabledIcon = '" . addslashes(class_adminskin_helper::getAdminImage("icon_favoriteDisabled", $this->getLang("tag_favorite_add"))) . "';\n                });</script>";
             $strImage = class_module_tags_favorite::getAllFavoritesForUserAndTag($this->objSession->getUserID(), $objListEntry->getSystemid()) != null ? class_adminskin_helper::getAdminImage("icon_favorite", $this->getLang("tag_favorite_remove")) : class_adminskin_helper::getAdminImage("icon_favoriteDisabled", $this->getLang("tag_favorite_add"));
             $arrButtons[] = $strJs . $this->objToolkit->listButton("<a href=\"#\" onclick=\"KAJONA.admin.tags.createFavorite('" . $objListEntry->getSystemid() . "', this); return false;\">" . $strImage . "</a>");
         }
         return $arrButtons;
     } else {
         return array();
     }
 }
Beispiel #2
0
 /**
  * Validates a set of permissions for a single object.
  * The string of permissions is a comma-separated list, whereas the entries may be one of
  * view, edit, delete, right, right1, right2, right3, right4, right5
  * If at least a single permission is given, true is returned, otherwise false.
  *
  * @param string $strPermissions
  * @param class_model $objObject
  *
  * @return bool
  * @throws class_exception
  * @since 4.0
  */
 public function validatePermissionString($strPermissions, class_model $objObject)
 {
     if (!$objObject instanceof class_model) {
         throw new class_exception("automated permission-check only for instances of class_model", class_exception::$level_ERROR);
     }
     if (trim($strPermissions) == "") {
         return false;
     }
     $arrPermissions = explode(",", $strPermissions);
     foreach ($arrPermissions as $strOnePermissions) {
         $strOnePermissions = trim($strOnePermissions);
         switch (trim($strOnePermissions)) {
             case self::$STR_RIGHT_VIEW:
                 if ($objObject->rightView()) {
                     return true;
                 }
                 break;
             case self::$STR_RIGHT_EDIT:
                 if ($objObject->rightEdit()) {
                     return true;
                 }
                 break;
             case self::$STR_RIGHT_DELETE:
                 if ($objObject->rightDelete()) {
                     return true;
                 }
                 break;
             case self::$STR_RIGHT_RIGHT:
                 if ($objObject->rightRight()) {
                     return true;
                 }
                 break;
             case self::$STR_RIGHT_RIGHT1:
                 if ($objObject->rightRight1()) {
                     return true;
                 }
                 break;
             case self::$STR_RIGHT_RIGHT2:
                 if ($objObject->rightRight2()) {
                     return true;
                 }
                 break;
             case self::$STR_RIGHT_RIGHT3:
                 if ($objObject->rightRight3()) {
                     return true;
                 }
                 break;
             case self::$STR_RIGHT_RIGHT4:
                 if ($objObject->rightRight4()) {
                     return true;
                 }
                 break;
             case self::$STR_RIGHT_RIGHT5:
                 if ($objObject->rightRight5()) {
                     return true;
                 }
                 break;
             case self::$STR_RIGHT_CHANGELOG:
                 if ($objObject->rightChangelog()) {
                     return true;
                 }
                 break;
             default:
                 break;
         }
     }
     return false;
 }