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(); } }
/** * @return string * @throws class_exception * @permissions right1 */ protected function actionAddFavorite() { $objTags = class_objectfactory::getInstance()->getObject($this->getSystemid()); class_response_object::getInstance()->setStrResponseType(class_http_responsetypes::STR_TYPE_XML); $strError = "<message>" . $this->getLang("favorite_save_error") . "</message>"; $strSuccess = "<message>" . $this->getLang("favorite_save_success") . ": " . $objTags->getStrDisplayName() . "</message>"; $strExisting = "<message>" . $this->getLang("favorite_save_remove") . ": " . $objTags->getStrDisplayName() . "</message>"; //already added before? if (count(class_module_tags_favorite::getAllFavoritesForUserAndTag($this->objSession->getUserID(), $this->getSystemid())) > 0) { $arrFavorites = class_module_tags_favorite::getAllFavoritesForUserAndTag($this->objSession->getUserID(), $this->getSystemid()); foreach ($arrFavorites as $objOneFavorite) { $objOneFavorite->deleteObjectFromDatabase(); } return $strExisting; } $objFavorite = new class_module_tags_favorite(); $objFavorite->setStrUserId($this->objSession->getUserID()); $objFavorite->setStrTagId($objTags->getSystemid()); if (!$objFavorite->updateObjectToDb()) { return $strError; } else { return $strSuccess; } }
/** * Renders a single tag (including the options to remove the tag again) * * @param class_module_tags_tag $objTag * @param string $strTargetid * @param string $strAttribute * * @return string */ public function getTagEntry(class_module_tags_tag $objTag, $strTargetid, $strAttribute) { if (class_carrier::getInstance()->getParam("delete") != "false") { $strTemplateID = $this->objTemplate->readTemplate("/elements.tpl", "tags_tag_delete"); } else { $strTemplateID = $this->objTemplate->readTemplate("/elements.tpl", "tags_tag"); } $strFavorite = ""; if ($objTag->rightRight1()) { $strJs = "<script type='text/javascript'>KAJONA.admin.loader.loadFile('" . class_resourceloader::getInstance()->getCorePathForModule("module_tags") . "/module_tags/admin/scripts/tags.js', function() {\r\n KAJONA.admin.tags.createFavoriteEnabledIcon = '" . addslashes(class_adminskin_helper::getAdminImage("icon_favorite", class_carrier::getInstance()->getObjLang()->getLang("tag_favorite_remove", "tags"))) . "';\r\n KAJONA.admin.tags.createFavoriteDisabledIcon = '" . addslashes(class_adminskin_helper::getAdminImage("icon_favoriteDisabled", class_carrier::getInstance()->getObjLang()->getLang("tag_favorite_add", "tags"))) . "';\r\n });</script>"; $strImage = class_module_tags_favorite::getAllFavoritesForUserAndTag(class_carrier::getInstance()->getObjSession()->getUserID(), $objTag->getSystemid()) != null ? class_adminskin_helper::getAdminImage("icon_favorite", class_carrier::getInstance()->getObjLang()->getLang("tag_favorite_remove", "tags")) : class_adminskin_helper::getAdminImage("icon_favoriteDisabled", class_carrier::getInstance()->getObjLang()->getLang("tag_favorite_add", "tags")); $strFavorite = $strJs . "<a href=\"#\" onclick=\"KAJONA.admin.tags.createFavorite('" . $objTag->getSystemid() . "', this); return false;\">" . $strImage . "</a>"; } $arrTemplate = array(); $arrTemplate["tagname"] = $objTag->getStrDisplayName(); $arrTemplate["strTagId"] = $objTag->getSystemid(); $arrTemplate["strTargetSystemid"] = $strTargetid; $arrTemplate["strAttribute"] = $strAttribute; $arrTemplate["strFavorite"] = $strFavorite; $arrTemplate["strDelete"] = class_adminskin_helper::getAdminImage("icon_delete", class_carrier::getInstance()->getObjLang()->getLang("commons_delete", "tags")); return $this->objTemplate->fillTemplate($arrTemplate, $strTemplateID); }