/** * @inheritDoc */ public function generateFieldsFromObject() { parent::generateFieldsFromObject(); $objNews = $this->getObjSourceobject(); if ($objNews->getSystemid() != class_module_system_module::getModuleByName("news")->getSystemid()) { //search the languages maintained $objLanguageManager = class_module_languages_languageset::getLanguagesetForSystemid($objNews->getSystemid()); if ($objLanguageManager != null) { $arrMaintained = $objLanguageManager->getArrLanguageSet(); $arrDD = array(); foreach ($arrMaintained as $strLanguageId => $strSystemid) { $objLanguage = new class_module_languages_language($strLanguageId); $arrDD[$strSystemid] = $this->getLang("lang_" . $objLanguage->getStrName(), "languages"); } class_module_languages_admin::enableLanguageSwitch(); class_module_languages_admin::setArrLanguageSwitchEntries($arrDD); class_module_languages_admin::setStrOnChangeHandler("window.location='" . class_link::getLinkAdminHref("news", "editNews") . (class_module_system_setting::getConfigValue("_system_mod_rewrite_") == "true" ? "?" : "&") . "systemid='+this.value+'&pe=" . class_carrier::getInstance()->getParam("pe") . "';"); class_module_languages_admin::setStrActiveKey($objNews->getSystemid()); } } $arrCats = class_module_news_category::getObjectList(); if (count($arrCats) > 0) { $arrKeyValues = array(); /** @var class_module_news_category $objOneCat */ foreach ($arrCats as $objOneCat) { $arrKeyValues[$objOneCat->getSystemid()] = $objOneCat->getStrDisplayName(); } $this->getField("cats")->setStrLabel($this->getLang("commons_categories"))->setArrKeyValues($arrKeyValues); } if (class_module_system_setting::getConfigValue("_news_news_datetime_") == "true") { $this->addField(new class_formentry_datetime($this->getStrFormname(), "objDateStart", $objNews), "datestart")->setBitMandatory(true)->setStrLabel($this->getLang("form_news_datestart")); $this->addField(new class_formentry_datetime($this->getStrFormname(), "objDateEnd", $objNews), "dateend")->setStrLabel($this->getLang("form_news_dateend")); $this->addField(new class_formentry_datetime($this->getStrFormname(), "objDateSpecial", $objNews), "datespecial")->setStrLabel($this->getLang("form_news_datespecial")); } }
protected function renderDeleteAction(interface_model $objListEntry) { if ($objListEntry instanceof class_module_faqs_category && $objListEntry->rightDelete()) { return $this->objToolkit->listDeleteButton($objListEntry->getStrDisplayName(), $this->getLang("commons_delete_category_question"), class_link::getLinkAdminHref($objListEntry->getArrModule("modul"), "delete", "&systemid=" . $objListEntry->getSystemid())); } return parent::renderDeleteAction($objListEntry); }
/** * Adds a menu-button to the second entry of the path-array. The menu renders the list of all modules installed, * including a quick-jump link. * * * @param array $arrPathEntries * @param string $strSourceModule * * @static * @internal param array $arrModuleActions * @return string */ public static function getAdminPathNavi($arrPathEntries, $strSourceModule = "") { //modify some of the entries $arrMenuEntries = array(); $arrModules = class_module_system_module::getModulesInNaviAsArray(); foreach ($arrModules as $arrOneModule) { $objModule = class_module_system_module::getModuleByName($arrOneModule["module_name"]); if (!$objModule->rightView()) { continue; } $arrCurMenuEntry = array("name" => class_carrier::getInstance()->getObjLang()->getLang("modul_titel", $arrOneModule["module_name"]), "onclick" => "location.href='" . class_link::getLinkAdminHref($arrOneModule["module_name"], "", "", false) . "'", "link" => "#"); //fetch the submenu entries if ($objModule != null) { $arrActionMenuEntries = array(); $arrModuleActions = self::getModuleActionNaviHelper($objModule); foreach ($arrModuleActions as $strOneAction) { if ($strOneAction != "") { $arrLink = splitUpLink($strOneAction); if ($arrLink["name"] != "" && $arrLink["href"] != "") { $arrActionMenuEntries[] = array("name" => $arrLink["name"], "onclick" => "location.href='" . $arrLink["href"] . "'", "link" => $arrLink["href"]); } } else { if ($strOneAction == "") { $arrActionMenuEntries[] = array("name" => ""); } } } $arrCurMenuEntry["submenu"] = $arrActionMenuEntries; } $arrMenuEntries[] = $arrCurMenuEntry; } $strModuleMenuId = generateSystemid(); $strModuleSwitcher = "\n <span class='dropdown moduleSwitch'><a href='#' data-toggle='dropdown' class='moduleSwitchLink' role='button'><i class='fa fa-home'></i></a>\n " . class_carrier::getInstance()->getObjToolkit("admin")->registerMenu($strModuleMenuId, $arrMenuEntries) . "</span>"; array_unshift($arrPathEntries, $strModuleSwitcher); return class_carrier::getInstance()->getObjToolkit("admin")->getPathNavigation($arrPathEntries); }
/** * @return string * @throws class_exception * @permissions edit */ protected function actionSwitchToUser() { $strReturn = ""; if (class_module_system_module::getModuleByName("system")->rightEdit() && class_carrier::getInstance()->getObjSession()->isSuperAdmin()) { //reset the aspect $strAddon = ""; $objDefaultAspect = class_module_system_aspect::getDefaultAspect(); if ($objDefaultAspect !== null) { $strAddon = "&aspect=" . $objDefaultAspect->getSystemid(); } $objNewUser = new class_module_user_user($this->getSystemid()); if ($this->objSession->switchSessionToUser($objNewUser)) { class_admin_helper::flushActionNavigationCache(); $this->adminReload(class_link::getLinkAdminHref("dashboard", "", $strAddon)); return ""; } else { throw new class_exception("session switch failed", class_exception::$level_ERROR); } } else { $strReturn .= $this->getLang("commons_error_permissions"); } return $strReturn; }
/** * saves a post in the database and returns the post as html. * In case of missing fields, the form is returned again * * @return string * @permissons right1 */ protected function actionSavePost() { $strXMLContent = ""; //validate needed fields if (!$this->validateForm()) { //Create form to reenter values $strTemplateID = $this->objTemplate->readTemplate("/module_postacomment/" . $this->getParam("comment_template"), "postacomment_form"); $arrForm = array(); $arrForm["formaction"] = class_link::getLinkPortalHref($this->getPagename(), "", "postComment", "", $this->getSystemid()); $arrForm["comment_name"] = $this->getParam("comment_name"); $arrForm["comment_subject"] = $this->getParam("comment_subject"); $arrForm["comment_message"] = $this->getParam("comment_message"); $arrForm["comment_template"] = $this->getParam("comment_template"); $arrForm["comment_systemid"] = $this->getParam("comment_systemid"); $arrForm["comment_page"] = $this->getParam("comment_page"); $arrForm["validation_errors"] = $this->strErrors; foreach ($arrForm as $strKey => $strValue) { if (uniStrpos($strKey, "comment_") !== false) { $arrForm[$strKey] = htmlspecialchars($strValue, ENT_QUOTES, "UTF-8", false); } } //texts $arrForm["postacomment_write_new"] = $this->getLang("postacomment_write_new"); $arrForm["form_name_label"] = $this->getLang("form_name_label"); $arrForm["form_subject_label"] = $this->getLang("form_subject_label"); $arrForm["form_message_label"] = $this->getLang("form_message_label"); $arrForm["form_captcha_label"] = $this->getLang("commons_captcha"); $arrForm["form_captcha_reload_label"] = $this->getLang("commons_captcha_reload"); $arrForm["form_submit_label"] = $this->getLang("form_submit_label"); $strXMLContent .= $this->fillTemplate($arrForm, $strTemplateID); } else { //save the post to the db //pageid or systemid to filter? $strSystemidfilter = $this->getParam("comment_systemid"); if (class_module_pages_page::getPageByName($this->getParam("comment_page")) !== null) { $strPagefilter = class_module_pages_page::getPageByName($this->getParam("comment_page"))->getSystemid(); } else { $strPagefilter = ""; } $objPost = new class_module_postacomment_post(); $objPost->setStrUsername($this->getParam("comment_name")); $objPost->setStrTitle($this->getParam("comment_subject")); $objPost->setStrComment($this->getParam("comment_message")); $objPost->setStrAssignedPage($strPagefilter); $objPost->setStrAssignedSystemid($strSystemidfilter); $objPost->setStrAssignedLanguage($this->getStrPortalLanguage()); $objPost->updateObjectToDb(); $this->flushPageFromPagesCache($this->getPagename()); $strMailtext = $this->getLang("new_comment_mail") . "\r\n\r\n" . $objPost->getStrComment() . "\r\n"; $strMailtext .= class_link::getLinkAdminHref("postacomment", "edit", "&systemid=" . $objPost->getSystemid(), false); $objMessageHandler = new class_module_messaging_messagehandler(); $arrGroups = array(); $allGroups = class_module_user_group::getObjectList(); foreach ($allGroups as $objOneGroup) { if (class_rights::getInstance()->checkPermissionForGroup($objOneGroup->getSystemid(), class_rights::$STR_RIGHT_EDIT, $this->getObjModule()->getSystemid())) { $arrGroups[] = $objOneGroup; } } $objMessageHandler->sendMessage($strMailtext, $arrGroups, new class_messageprovider_postacomment()); //reinit post -> encoded entities $objPost->initObject(); //load the post as a new post to add it at top of the list $arrOnePost = array(); $arrOnePost["postacomment_post_name"] = $objPost->getStrUsername(); $arrOnePost["postacomment_post_subject"] = $objPost->getStrTitle(); $arrOnePost["postacomment_post_message"] = $objPost->getStrComment(); $arrOnePost["postacomment_post_systemid"] = $objPost->getSystemid(); $arrOnePost["postacomment_post_date"] = timeToString($objPost->getIntDate(), true); $strTemplateID = $this->objTemplate->readTemplate("/module_postacomment/" . $this->getParam("comment_template"), "postacomment_post"); $strXMLContent .= $this->objTemplate->fillTemplate($arrOnePost, $strTemplateID); } class_response_object::getInstance()->setStrResponseType(class_http_responsetypes::STR_TYPE_JSON); return $strXMLContent; }
/** * Fetches all child-nodes of the passed node. * Used by the tree-view in module-navigation admin view. * * @return string * @since 3.3.0 * @xml * @permissions view */ protected function actionGetChildNodes() { $arrNavigations = class_module_navigation_point::getNaviLayer($this->getSystemid()); $arrReturn = array(); if (count($arrNavigations) > 0) { /** @var class_module_navigation_point $objSinglePoint */ foreach ($arrNavigations as $objSinglePoint) { if ($objSinglePoint->rightView()) { $arrReturn[] = array("data" => array("title" => class_adminskin_helper::getAdminImage($objSinglePoint->getStrIcon()) . " " . $objSinglePoint->getStrDisplayName()), "state" => count(class_module_navigation_point::getNaviLayer($objSinglePoint->getSystemid())) == 0 ? "" : "closed", "attr" => array("id" => $objSinglePoint->getSystemid(), "systemid" => $objSinglePoint->getSystemid(), "link" => class_link::getLinkAdminHref("navigation", "list", "&systemid=" . $objSinglePoint->getSystemid(), false))); } } } $objCurNode = class_objectfactory::getInstance()->getObject($this->getSystemid()); if ($objCurNode instanceof class_module_navigation_tree) { $arrReturn = array("data" => array("title" => class_adminskin_helper::getAdminImage($objCurNode->getStrIcon()) . " " . $objCurNode->getStrDisplayName()), "state" => "", "attr" => array("id" => $objCurNode->getSystemid(), "systemid" => $objCurNode->getSystemid(), "link" => ""), "children" => $arrReturn); } class_response_object::getInstance()->setStrResponseType(class_http_responsetypes::STR_TYPE_JSON); return json_encode($arrReturn); }
/** * Adds the portal-editor code to the current page-output - if all requirements are given * * @param class_module_pages_page $objPageData * @param bool $bitEditPermissionOnMasterPage * @param string $strPageContent * * @return string */ private function renderPortalEditorCode(class_module_pages_page $objPageData, $bitEditPermissionOnMasterPage, $strPageContent) { //add the portaleditor toolbar if (class_module_system_setting::getConfigValue("_pages_portaleditor_") == "false") { return $strPageContent; } if (!$this->objSession->isAdmin()) { return $strPageContent; } if (!$objPageData->rightEdit() && !$bitEditPermissionOnMasterPage) { return $strPageContent; } class_adminskin_helper::defineSkinWebpath(); //save back the current portal text language and set the admin-one $strPortalLanguage = class_carrier::getInstance()->getObjLang()->getStrTextLanguage(); class_carrier::getInstance()->getObjLang()->setStrTextLanguage($this->objSession->getAdminLanguage()); if ($this->objSession->getSession("pe_disable") != "true") { $strPeToolbar = ""; $arrPeContents = array(); $arrPeContents["pe_status_page_val"] = $objPageData->getStrName(); $arrPeContents["pe_status_status_val"] = $objPageData->getIntRecordStatus() == 1 ? "active" : "inactive"; $arrPeContents["pe_status_autor_val"] = $objPageData->getLastEditUser(); $arrPeContents["pe_status_time_val"] = timeToString($objPageData->getIntLmTime(), false); $arrPeContents["pe_dialog_close_warning"] = $this->getLang("pe_dialog_close_warning", "pages"); //Add an iconbar $arrPeContents["pe_iconbar"] = ""; $arrPeContents["pe_iconbar"] .= class_link::getLinkAdmin("pages_content", "list", "&systemid=" . $objPageData->getSystemid() . "&language=" . $strPortalLanguage, $this->getLang("pe_icon_edit"), $this->getLang("pe_icon_edit", "pages"), "icon_page"); $arrPeContents["pe_iconbar"] .= " "; $strEditUrl = class_link::getLinkAdminHref("pages", "editPage", "&systemid=" . $objPageData->getSystemid() . "&language=" . $strPortalLanguage . "&pe=1"); $arrPeContents["pe_iconbar"] .= "<a href=\"#\" onclick=\"KAJONA.admin.portaleditor.openDialog('" . $strEditUrl . "'); return false;\">" . class_adminskin_helper::getAdminImage("icon_edit", $this->getLang("pe_icon_page", "pages")) . "</a>"; $arrPeContents["pe_iconbar"] .= " "; $strEditUrl = class_link::getLinkAdminHref("pages", "newPage", "&systemid=" . $objPageData->getSystemid() . "&language=" . $strPortalLanguage . "&pe=1"); $arrPeContents["pe_iconbar"] .= "<a href=\"#\" onclick=\"KAJONA.admin.portaleditor.openDialog('" . $strEditUrl . "'); return false;\">" . class_adminskin_helper::getAdminImage("icon_new", $this->getLang("pe_icon_new", "pages")) . "</a>"; $arrPeContents["pe_disable"] = "<a href=\"#\" onclick=\"KAJONA.admin.portaleditor.switchEnabled(false); return false;\" title=\"\">" . class_adminskin_helper::getAdminImage("icon_enabled", $this->getLang("pe_disable", "pages")) . "</a>"; //Load portaleditor javascript (even if it's maybe already loaded in portal and init the ckeditor) $strTemplateInitID = $this->objTemplate->readTemplate("/elements.tpl", "wysiwyg_ckeditor_inits"); $strSkinInit = $this->objTemplate->fillTemplate(array(), $strTemplateInitID); $strConfigFile = "'config_kajona_standard.js'"; if (is_file(_realpath_ . "/project/admin/scripts/ckeditor/config_kajona_standard.js")) { $strConfigFile = "KAJONA_WEBPATH+'/project/admin/scripts/ckeditor/config_kajona_standard.js'"; } $strPeToolbar .= "<script type='text/javascript'>\n KAJONA.admin.lang.pe_rte_unsavedChanges = '" . $this->getLang("pe_rte_unsavedChanges", "pages") . "';\n\n if(\$) {\n KAJONA.portal.loader.loadFile([\n '/core/module_pages/admin/scripts/kajona_portaleditor.js',\n '/core/module_system/admin/scripts/jqueryui/jquery-ui.custom.min.js',\n '/core/module_system/admin/scripts/jqueryui/css/smoothness/jquery-ui.custom.css'\n ], function() {\n KAJONA.admin.portaleditor.RTE.config = {\n language : '" . (class_session::getInstance()->getAdminLanguage() != "" ? class_session::getInstance()->getAdminLanguage() : "en") . "',\n filebrowserBrowseUrl : '" . uniStrReplace("&", "&", class_link::getLinkAdminHref("folderview", "browserChooser", "&form_element=ckeditor")) . "',\n filebrowserImageBrowseUrl : '" . uniStrReplace("&", "&", class_link::getLinkAdminHref("mediamanager", "folderContentFolderviewMode", "systemid=" . class_module_system_setting::getConfigValue("_mediamanager_default_imagesrepoid_") . "&form_element=ckeditor&bit_link=1")) . "',\n customConfig : {$strConfigFile},\n " . $strSkinInit . "\n }\n \$(KAJONA.admin.portaleditor.initPortaleditor);\n });\n }\n else {\n KAJONA.portal.loader.loadFile([\n '/core/module_system/admin/scripts/jquery/jquery.min.js',\n '/core/module_system/admin/scripts/jqueryui/jquery-ui.custom.min.js',\n '/core/module_pages/admin/scripts/kajona_portaleditor.js',\n '/core/module_system/admin/scripts/jqueryui/css/smoothness/jquery-ui.custom.css'\n ], function() {\n KAJONA.admin.portaleditor.RTE.config = {\n language : '" . (class_session::getInstance()->getAdminLanguage() != "" ? class_session::getInstance()->getAdminLanguage() : "en") . "',\n filebrowserBrowseUrl : '" . uniStrReplace("&", "&", class_link::getLinkAdminHref("folderview", "browserChooser", "&form_element=ckeditor")) . "',\n filebrowserImageBrowseUrl : '" . uniStrReplace("&", "&", class_link::getLinkAdminHref("mediamanager", "folderContentFolderviewMode", "systemid=" . class_module_system_setting::getConfigValue("_mediamanager_default_imagesrepoid_") . "&form_element=ckeditor&bit_link=1")) . "',\n " . $strSkinInit . "\n }\n \$(KAJONA.admin.portaleditor.initPortaleditor);\n });\n }\n </script>"; //Load portaleditor styles $strPeToolbar .= $this->objToolkit->getPeBasicData(); $strPeToolbar .= $this->objToolkit->getPeToolbar($arrPeContents); $objScriptlets = new class_scriptlet_helper(); $strPeToolbar = $objScriptlets->processString($strPeToolbar, interface_scriptlet::BIT_CONTEXT_ADMIN); //The toolbar has to be added right after the body-tag - to generate correct html-code $strTemp = uniSubstr($strPageContent, uniStrpos($strPageContent, "<body")); //find closing bracket $intTemp = uniStrpos($strTemp, ">") + 1; //and insert the code $strPageContent = uniSubstr($strPageContent, 0, uniStrpos($strPageContent, "<body") + $intTemp) . $strPeToolbar . uniSubstr($strPageContent, uniStrpos($strPageContent, "<body") + $intTemp); } else { //Button to enable the toolbar & pe $strEnableButton = "<div id=\"peEnableButton\" style=\"z-index: 1000; position: fixed; top: 0px; right: 0px;\"><a href=\"#\" onclick=\"KAJONA.admin.portaleditor.switchEnabled(true); return false;\" title=\"\">" . getImageAdmin("icon_disabled", $this->getLang("pe_enable", "pages")) . "</a></div>"; //Load portaleditor javascript $strEnableButton .= "\n<script type=\"text/javascript\" src=\"" . _webpath_ . "/core/module_pages/admin/scripts/kajona_portaleditor.js?" . class_module_system_setting::getConfigValue("_system_browser_cachebuster_") . "\"></script>"; $strEnableButton .= $this->objToolkit->getPeBasicData(); //Load portaleditor styles //The toobar has to be added right after the body-tag - to generate correct html-code $strTemp = uniSubstr($strPageContent, uniStripos($strPageContent, "<body")); //find closing bracket $intTemp = uniStripos($strTemp, ">") + 1; //and insert the code $strPageContent = uniSubstr($strPageContent, 0, uniStrpos($strPageContent, "<body") + $intTemp) . $strEnableButton . uniSubstr($strPageContent, uniStrpos($strPageContent, "<body") + $intTemp); } //reset the portal texts language class_carrier::getInstance()->getObjLang()->setStrTextLanguage($strPortalLanguage); return $strPageContent; }
/** * Return an on-lick link for the passed object. * This link is used by the backend-search for the autocomplete-field * * @see getLinkAdminHref() * @return mixed */ public function getSearchAdminLinkForObject() { return class_link::getLinkAdminHref("pages", "list", "&systemid=" . $this->getSystemid()); }
/** * Generates a form to add tags to the passed systemid. * Since all functionality is performed using ajax, there's no page-reload when adding or removing tags. * Therefore the form-handling of existing forms can remain as is * * @param string $strTargetSystemid the systemid to tag * @param string $strAttribute additional info used to differ between tag-sets for a single systemid * * @return string * @permissions view */ public function getTagForm($strTargetSystemid, $strAttribute = null) { $strTagContent = ""; $strTagsWrapperId = generateSystemid(); $strTagContent .= $this->objToolkit->formHeader(class_link::getLinkAdminHref($this->getArrModule("modul"), "saveTags"), "", "", "KAJONA.admin.tags.saveTag(document.getElementById('tagname').value+'', '" . $strTargetSystemid . "', '" . $strAttribute . "');return false;"); $strTagContent .= $this->objToolkit->formTextRow($this->getLang("tag_name_hint")); $strTagContent .= $this->objToolkit->formInputTagSelector("tagname", $this->getLang("form_tags_name")); $strTagContent .= $this->objToolkit->formInputSubmit($this->getLang("button_add"), $this->getLang("button_add"), ""); $strTagContent .= $this->objToolkit->formClose(); $strTagContent .= $this->objToolkit->setBrowserFocus("tagname"); $strTagContent .= $this->objToolkit->getTaglistWrapper($strTagsWrapperId, $strTargetSystemid, $strAttribute); return $strTagContent; }
/** * Generates a link opening in a dialog in admin-area * * @param string $strModule * @param string $strAction * @param string $strParams * @param string $strText * @param string $strAlt * @param string $strImage * @param string $strTitle * @param bool $bitTooltip * @param bool $bitPortalEditor * @param bool|string $strOnClick * @param null|int $intWidth * @param null|int $intHeight * @return string */ public static function getLinkAdminDialog($strModule, $strAction, $strParams = "", $strText = "", $strAlt = "", $strImage = "", $strTitle = "", $bitTooltip = true, $bitPortalEditor = false, $strOnClick = "", $intWidth = null, $intHeight = null) { $strLink = ""; $strTitle = addslashes(uniStrReplace(array("\n", "\r"), array(), strip_tags(nl2br($strTitle)))); if ($bitPortalEditor) { $strParams .= "&pe=1"; } //urlencoding $strModule = urlencode($strModule); $strAction = urlencode($strAction); if ($strOnClick == "") { if ($intWidth !== null && $intHeight !== null) { $strOnClick = "KAJONA.admin.folderview.dialog.setContentIFrame('" . class_link::getLinkAdminHref($strModule, $strAction, $strParams) . "'); KAJONA.admin.folderview.dialog.setTitle('" . $strTitle . "'); " . "KAJONA.admin.folderview.dialog.init('" . $intWidth . "', '" . $intHeight . "'); return false;"; } else { $strOnClick = "KAJONA.admin.folderview.dialog.setContentIFrame('" . class_link::getLinkAdminHref($strModule, $strAction, $strParams) . "'); KAJONA.admin.folderview.dialog.setTitle('" . $strTitle . "'); " . "KAJONA.admin.folderview.dialog.init(); return false;"; } } if ($strImage != "") { if ($strAlt == "") { $strAlt = $strAction; } if (!$bitTooltip) { $strLink = "<a href=\"#\" onclick=\"" . $strOnClick . "\" title=\"" . $strAlt . "\">" . class_adminskin_helper::getAdminImage($strImage, $strAlt, true) . "</a>"; } else { $strLink = "<a href=\"#\" onclick=\"" . $strOnClick . "\" title=\"" . $strAlt . "\" rel=\"tooltip\">" . class_adminskin_helper::getAdminImage($strImage, $strAlt, true) . "</a>"; } } if ($strImage == "" && $strText != "") { if ($strAlt == "") { $strAlt = $strText; } $strLink = "<a href=\"#\" " . ($bitPortalEditor ? "class=\"pe_link\"" : "") . " " . ($bitTooltip ? "title=\"" . $strAlt . "\" rel=\"tooltip\" " : "") . " onclick=\"" . $strOnClick . "\">" . $strText . "</a>"; } return $strLink; }
/** * saves the submitted form-data as a new language, oder updates the corresponding language * * @throws class_exception * @return string, "" in case of success * @permissions edit */ protected function actionSaveLanguage() { $strOldLang = ""; if ($this->getParam("mode") == "new") { $objLanguage = new class_module_languages_language(); } else { $objLanguage = new class_module_languages_language($this->getSystemid()); $strOldLang = $objLanguage->getStrName(); if (!$objLanguage->rightEdit()) { return $this->getLang("commons_error_permissions"); } } $objForm = $this->getAdminForm($objLanguage); if (!$objForm->validateForm()) { return $this->actionNew($this->getParam("mode"), $objForm); } $objForm->updateSourceObject(); if ($this->getParam("mode") == "new") { //language already existing? if (class_module_languages_language::getLanguageByName($objLanguage->getStrName()) !== false) { return $this->getLang("language_existing"); } } elseif ($this->getParam("mode") == "edit") { $objTestLang = class_module_languages_language::getLanguageByName($objLanguage->getStrName()); if ($objTestLang !== false && $objTestLang->getSystemid() != $objLanguage->getSystemid()) { return $this->getLang("language_existing"); } } if (!$objLanguage->updateObjectToDb()) { throw new class_exception("Error creating new language", class_exception::$level_ERROR); } if ($this->getParam("mode") == "edit") { //move contents to a new language if ($strOldLang != $objLanguage->getStrName()) { if (!$objLanguage->moveContentsToCurrentLanguage($strOldLang)) { throw new class_exception("Error moving contents to new language", class_exception::$level_ERROR); } } } $this->adminReload(class_link::getLinkAdminHref($this->getArrModule("modul"))); }
private function loadPostLoginSite() { //any url to redirect? if ($this->objSession->getSession(self::SESSION_REFERER) != "" && $this->objSession->getSession(self::SESSION_REFERER) != "admin=1") { class_response_object::getInstance()->setStrRedirectUrl(_indexpath_ . "?" . $this->objSession->getSession(self::SESSION_REFERER)); $this->objSession->sessionUnset(self::SESSION_REFERER); $this->objSession->setSession(self::SESSION_LOAD_FROM_PARAMS, "true"); } else { //route to the default module $strModule = "dashboard"; if (class_session::getInstance()->isLoggedin()) { $objUser = new class_module_user_user(class_session::getInstance()->getUserID()); if ($objUser->getStrAdminModule() != "") { $strModule = $objUser->getStrAdminModule(); } } class_response_object::getInstance()->setStrRedirectUrl(class_link::getLinkAdminHref($strModule)); } }
/** * Return an on-lick link for the passed object. * This link is used by the backend-search for the autocomplete-field * * @see getLinkAdminHref() * @return mixed */ public function getSearchAdminLinkForObject() { return class_link::getLinkAdminHref("mediamanager", "edit", "&systemid=" . $this->getSystemid() . "&source=search"); }
/** * Generates the link to create an element at a placeholder not yet existing * * @param string $strSystemid * @param string $strPlaceholder * @param class_module_pages_element $objElement * * @return string * @static */ public static function getPortaleditorNewCode($strSystemid, $strPlaceholder, class_module_pages_element $objElement) { $strReturn = ""; if (class_carrier::getInstance()->getObjRights()->rightEdit($strSystemid) && class_carrier::getInstance()->getObjSession()->isAdmin()) { //switch the text-language temporary $strPortalLanguage = class_carrier::getInstance()->getObjLang()->getStrTextLanguage(); class_carrier::getInstance()->getObjLang()->setStrTextLanguage(class_carrier::getInstance()->getObjSession()->getAdminLanguage()); //fetch the language to set the correct admin-lang $objLanguages = new class_module_languages_language(); $strAdminLangParam = "&language=" . $objLanguages->getPortalLanguage(); $strElementHref = class_link::getLinkAdminHref("pages_content", "new", "&systemid=" . $strSystemid . $strAdminLangParam . "&placeholder=" . $strPlaceholder . "&element=" . $objElement->getStrName() . "&pe=1"); $strReturn = class_carrier::getInstance()->getObjToolkit("portal")->getPeNewButton($strPlaceholder, $objElement->getStrDisplayName(), $strElementHref); //reset the portal texts language class_carrier::getInstance()->getObjLang()->setStrTextLanguage($strPortalLanguage); } return $strReturn; }
/** * Creates a list of the recent messages for the current user. * The structure is returned in an json-format. * * @permissions view * @xml * @autoTestable * * @return string */ protected function actionGetRecentMessages() { class_carrier::getInstance()->getObjSession()->setBitBlockDbUpdate(true); class_session::getInstance()->sessionClose(); class_module_system_changelog::$bitChangelogEnabled = false; class_response_object::getInstance()->setStrResponseType(class_http_responsetypes::STR_TYPE_JSON); $intMaxAmount = $this->getParam("limit") != "" ? $this->getParam("limit") : 5; $arrMessages = class_module_messaging_message::getObjectList($this->objSession->getUserID(), 0, $intMaxAmount - 1); $arrReturn = array(); foreach ($arrMessages as $objOneMessage) { $arrReturn[] = array("systemid" => $objOneMessage->getSystemid(), "title" => $objOneMessage->getStrDisplayName(), "unread" => $objOneMessage->getBitRead(), "details" => class_link::getLinkAdminHref($objOneMessage->getArrModule("modul"), "edit", "&systemid=" . $objOneMessage->getSystemid(), false)); } $arrReturn = array("messages" => $arrReturn, "messageCount" => class_module_messaging_message::getNumberOfMessagesForUser($this->objSession->getUserID(), true)); return json_encode($arrReturn); }
/** * Updates the source-object based on the passed form-params * and synchronizes it with the database. * * @throws class_exception * @return string "" in case of success * @permissions edit */ protected function actionSave() { $strType = $this->getCurObjectClassName(); $strSystemId = ""; if (!is_null($strType)) { /** @var $objRecord interface_model|class_model */ $objRecord = null; if ($this->getParam("mode") == "new") { $objRecord = new $strType(); $strSystemId = $this->getSystemid(); } else { if ($this->getParam("mode") == "edit") { $objRecord = new $strType($this->getSystemid()); } } if ($objRecord != null) { $objForm = $this->getAdminForm($objRecord); if (!$objForm->validateForm()) { if ($this->getParam("mode") === "new") { return $this->actionNew(); } if ($this->getParam("mode") === "edit") { return $this->actionEdit(); } } $objForm->updateSourceObject(); $objRecord = $objForm->getObjSourceobject(); $objRecord->updateObjectToDb($strSystemId); $this->setSystemid($objRecord->getStrSystemid()); $this->adminReload(class_link::getLinkAdminHref($this->getArrModule("modul"), $this->getActionNameForClass("list", $objRecord), "&systemid=" . $objRecord->getStrPrevId() . ($this->getParam("pe") != "" ? "&peClose=1&blockAction=1" : ""))); return ""; } } else { throw new class_exception("error on saving current object type not known ", class_exception::$level_ERROR); } return $this->getLang("commons_error_permissions"); }
/** * Return an on-lick link for the passed object. * This link is used by the backend-search for the autocomplete-field * * @see getLinkAdminHref() * @return mixed */ public function getSearchAdminLinkForObject() { return class_link::getLinkAdminHref($this->getArrModule("modul"), "showAssignedRecords", "&systemid=" . $this->getSystemid()); }
/** * @permissions edit * @return string */ protected function actionCopyPack() { $objForm = $this->getPackAdminForm(); $strPackName = $this->getParam("pack_name"); $strPackName = createFilename($strPackName, true); if ($strPackName != "" && is_dir(_realpath_ . _templatepath_ . "/" . $strPackName)) { $objForm->addValidationError("name", $this->getLang("pack_folder_existing")); } if (!$objForm->validateForm()) { return $this->actionNew($objForm); } $objFilesystem = new class_filesystem(); $objFilesystem->folderCreate(_templatepath_ . "/" . $strPackName); $objFilesystem->folderCreate(_templatepath_ . "/" . $strPackName . "/tpl"); $objFilesystem->folderCreate(_templatepath_ . "/" . $strPackName . "/css"); $objFilesystem->folderCreate(_templatepath_ . "/" . $strPackName . "/js"); $arrModules = $this->getParam("pack_modules"); foreach ($arrModules as $strName => $strValue) { if ($strValue != "") { $objFilesystem->folderCopyRecursive(class_resourceloader::getInstance()->getCorePathForModule($strName) . "/" . $strName . "/templates/default", _templatepath_ . "/" . $strPackName); } } class_resourceloader::getInstance()->flushCache(); class_classloader::getInstance()->flushCache(); class_reflection::flushCache(); $this->adminReload(class_link::getLinkAdminHref($this->getArrModule("modul"), "listTemplates")); return ""; }
/** * @param string $strSearchterm * @param class_search_result[] $arrResults * * @return string */ private function createSearchXML($strSearchterm, $arrResults) { $strReturn = ""; $strReturn .= "<search>\n" . " <searchterm>" . xmlSafeString($strSearchterm) . "</searchterm>\n" . " <nrofresults>" . count($arrResults) . "</nrofresults>\n"; //And now all results $strReturn .= " <resultset>\n"; foreach ($arrResults as $objOneResult) { //create a correct link if ($objOneResult->getObjObject() == null || !$objOneResult->getObjObject()->rightView()) { continue; } $strIcon = ""; if ($objOneResult->getObjObject() instanceof interface_admin_listable) { $strIcon = $objOneResult->getObjObject()->getStrIcon(); if (is_array($strIcon)) { $strIcon = $strIcon[0]; } } $strLink = $objOneResult->getStrPagelink(); if ($strLink == "") { $strLink = class_link::getLinkAdminHref($objOneResult->getObjObject()->getArrModule("modul"), "edit", "&systemid=" . $objOneResult->getStrSystemid()); } $strReturn .= " <item>\n" . " <systemid>" . $objOneResult->getStrSystemid() . "</systemid>\n" . " <icon>" . xmlSafeString($strIcon) . "</icon>\n" . " <score>" . $objOneResult->getIntHits() . "</score>\n" . " <description>" . xmlSafeString(uniStrTrim($objOneResult->getObjObject()->getStrDisplayName(), 200)) . "</description>\n" . " <link>" . xmlSafeString($strLink) . "</link>\n" . " </item>\n"; } $strReturn .= " </resultset>\n"; $strReturn .= "</search>"; return $strReturn; }
/** * Shows a form or deltes a timeintervall from the logs * * @throws class_exception * @return string "" in case of success * @permissions edit * @autoTestable */ protected function actionLogbookFlush() { $strReturn = ""; if ($this->getParam("flush") == "") { $strReturn .= $this->objToolkit->formHeader(class_link::getLinkAdminHref($this->getArrModule("modul"), "logbookFlush", "flush=1")); $strReturn .= $this->objToolkit->formTextRow($this->getLang("logbook_hint_date")); $strReturn .= $this->objToolkit->formDateSingle("date", $this->getLang("commons_date"), new class_date()); $strReturn .= $this->objToolkit->formInputSubmit($this->getLang("commons_save")); $strReturn .= $this->objToolkit->formClose(); } elseif ($this->getParam("flush") == "1") { //Build the date $objDate = new class_date(); $objDate->generateDateFromParams("date", $this->getAllParams()); if (!class_module_mediamanager_logbook::deleteFromLogs($objDate->getTimeInOldStyle())) { throw new class_exception("Error deleting log-rows", class_exception::$level_ERROR); } $this->adminReload(class_link::getLinkAdminHref($this->getArrModule("modul"), "logbook")); } return $strReturn; }
/** * Saves a post to the databases * * @permissions right1 * @return string */ protected function actionPostComment() { if (!$this->validateForm()) { return $this->actionList(); } $strSystemidfilter = ""; if ($this->getSystemid() != "") { $strSystemidfilter = $this->getSystemid(); } if (class_module_pages_page::getPageByName($this->getPagename()) !== null) { $strPagefilter = class_module_pages_page::getPageByName($this->getPagename())->getSystemid(); } else { $strPagefilter = ""; } $objPost = new class_module_postacomment_post(); $objPost->setStrUsername($this->getParam("comment_name")); $objPost->setStrTitle($this->getParam("comment_subject")); $objPost->setStrComment($this->getParam("comment_message")); $objPost->setStrAssignedPage($strPagefilter); $objPost->setStrAssignedSystemid($strSystemidfilter); $objPost->setStrAssignedLanguage($this->getStrPortalLanguage()); $objPost->updateObjectToDb(); $this->flushPageFromPagesCache($this->getPagename()); $strMailtext = $this->getLang("new_comment_mail") . "\r\n\r\n" . $objPost->getStrComment() . "\r\n"; $strMailtext .= class_link::getLinkAdminHref("postacomment", "edit", "&systemid=" . $objPost->getSystemid(), false); $objMessageHandler = new class_module_messaging_messagehandler(); $arrGroups = array(); $allGroups = class_module_user_group::getObjectList(); foreach ($allGroups as $objOneGroup) { if (class_rights::getInstance()->checkPermissionForGroup($objOneGroup->getSystemid(), class_rights::$STR_RIGHT_EDIT, $this->getObjModule()->getSystemid())) { $arrGroups[] = $objOneGroup; } } $objMessage = new class_module_messaging_message(); $objMessage->setStrBody($strMailtext); $objMessage->setObjMessageProvider(new class_messageprovider_postacomment()); $objMessageHandler->sendMessageObject($objMessage, $arrGroups); $this->portalReload(_indexpath_ . "?" . $this->getHistory(1)); return ""; }
/** * Return an on-lick link for the passed object. * This link is used by the backend-search for the autocomplete-field * * @see getLinkAdminHref() * @return mixed */ public function getSearchAdminLinkForObject() { return class_link::getLinkAdminHref("news", "listNewsAndCategories", "&filterid=" . $this->getSystemid()); }
/** * Renders the permissions action button for the current record. * @param class_model|interface_model $objListEntry * @return string */ protected function renderCopyAction(class_model $objListEntry) { if ($objListEntry->getIntRecordDeleted() == 1) { return ""; } if ($objListEntry->rightEdit() && $this->strPeAddon == "") { $strHref = class_link::getLinkAdminHref($objListEntry->getArrModule("modul"), $this->getActionNameForClass("copyObject", $objListEntry), "&systemid=" . $objListEntry->getSystemid() . $this->strPeAddon); return $this->objToolkit->listButton(class_link::getLinkAdminManual(" onclick='jsDialog_3.init();' href='" . $strHref . "'", "", $this->getLang("commons_edit_copy"), "icon_copy")); } return ""; }
/** * Sorts the current element upwards * @return void */ protected function actionElementStatus() { //Create the object $objElement = new class_module_pages_pageelement($this->getSystemid()); $objElement->setIntRecordStatus($objElement->getIntRecordStatus() == 0 ? 1 : 0); $objElement->updateObjectToDb(); $this->adminReload(class_link::getLinkAdminHref("pages_content", "list", "systemid=" . $objElement->getPrevId() . ($this->getParam("pe") == "" ? "" : "&peClose=" . $this->getParam("pe")))); }
/** * Generates a link for the admin-area * * @deprecated * * @param string $strModule * @param string $strAction * @param string $strParams * @param bool $bitEncodedAmpersand * * @return string */ function getLinkAdminHref($strModule, $strAction = "", $strParams = "", $bitEncodedAmpersand = true) { return class_link::getLinkAdminHref($strModule, $strAction, $strParams, $bitEncodedAmpersand); }
/** * Calls the handler to process the values collected by the ui before. * * @throws class_exception * @return string * @permissions view */ protected function actionSaveUi() { $strReturn = ""; $objWorkflow = new class_module_workflows_workflow($this->getSystemid()); $arrIdsToCheck = array_merge(array($this->objSession->getUserID()), $this->objSession->getGroupIdsAsArray()); $arrIdsOfTask = explode(",", $objWorkflow->getStrResponsible()); //ui given? current user responsible? //magic: the difference of the tasks' ids and the users' ids should be less than the count of the task-ids - then at least one id matches if ($objWorkflow->getObjWorkflowHandler()->providesUserInterface() && ($objWorkflow->getStrResponsible() == "" || count(array_diff($arrIdsOfTask, $arrIdsToCheck)) < count($arrIdsOfTask))) { $objHandler = $objWorkflow->getObjWorkflowHandler(); $objHandler->processUserInput($this->getAllParams()); if ($objWorkflow->getBitSaved() == true) { throw new class_exception("Illegal state detected! Workflow was already saved before!", class_exception::$level_FATALERROR); } $objWorkflow->updateObjectToDb(); $this->adminReload(class_link::getLinkAdminHref($this->getArrModule("modul"), "myList")); } else { $strReturn .= $this->getLang("commons_error_permissions"); } return $strReturn; }
/** * Returns a form to modify the rights * * @return string * @permissions right */ protected function actionChange() { $strReturn = ""; $strSystemID = $this->getParam("systemid"); $objTargetRecord = null; if ($strSystemID == "") { $strSystemID = "0"; } //Determine the systemid if ($strSystemID != "") { $objTargetRecord = class_objectfactory::getInstance()->getObject($strSystemID); } //Edit a module? if ($this->getParam("changemodule") != "") { $objTargetRecord = class_module_system_module::getModuleByName($this->getParam("changemodule")); $strSystemID = $objTargetRecord->getSystemid(); } if ($objTargetRecord == null) { return $this->getLang("commons_error_permissions"); } $objRights = class_carrier::getInstance()->getObjRights(); if ($objTargetRecord->rightRight()) { //Get Rights $arrRights = $objRights->getArrayRights($objTargetRecord->getSystemid()); //Get groups $arrGroups = class_module_user_group::getObjectList(); //Determine name of the record if ($objTargetRecord instanceof class_module_system_module) { $strTitle = class_carrier::getInstance()->getObjLang()->getLang("modul_titel", $objTargetRecord->getStrName()) . " (" . $objTargetRecord->getStrDisplayName() . ")"; } else { if ($objTargetRecord->getStrDisplayName() == "") { $strTitle = $this->getLang("titel_leer"); } else { $strTitle = $objTargetRecord->getStrDisplayName() . " "; } } //Load the rights header-row if ($objTargetRecord->getIntModuleNr() == 0) { $strModule = "system"; } else { if ($objTargetRecord instanceof class_module_system_module) { $strModule = $objTargetRecord->getStrName(); } else { if (defined("_pages_folder_id_") && $objTargetRecord->getIntModuleNr() == _pages_folder_id_) { $strModule = "pages"; } else { $strModule = $objTargetRecord->getArrModule("modul"); } } } $arrHeaderRow = $this->getLang("permissions_header", $strModule); $arrDefaultHeader = $this->getLang("permissions_default_header", "system"); if ($arrHeaderRow == "!permissions_header!") { $arrHeaderRow = $arrDefaultHeader; } if ($strSystemID == "0") { $arrHeaderRow = $this->getLang("permissions_root_header", "system"); } $arrTitles = $arrHeaderRow; $arrTemplateTotal = array(); $arrTemplateTotal["title0"] = $arrTitles[0]; $arrTemplateTotal["title1"] = $arrTitles[1]; $arrTemplateTotal["title2"] = $arrTitles[2]; $arrTemplateTotal["title3"] = $arrTitles[3]; $arrTemplateTotal["title4"] = $arrTitles[4]; $arrTemplateTotal["title5"] = $arrTitles[5]; $arrTemplateTotal["title6"] = $arrTitles[6]; $arrTemplateTotal["title7"] = $arrTitles[7]; $arrTemplateTotal["title8"] = $arrTitles[8]; if (class_module_system_setting::getConfigValue("_system_changehistory_enabled_") == "true") { if (!isset($arrTitles[9])) { //fallback for pre 4.3.2 systems $arrTitles[9] = $arrDefaultHeader[9]; } $arrTemplateTotal["title9"] = $arrTitles[9]; } //Read the template $strTemplateRowID = $this->objTemplate->readTemplate("/elements.tpl", "rights_form_row"); $arrTemplateTotal["rows"] = ""; //Inserting Rows foreach ($arrGroups as $objSingleGroup) { $arrTemplateRow = array(); $arrSingleGroup = array(); $arrTemplateRow["group"] = $objSingleGroup->getStrName(); $arrSingleGroup["group_id"] = $objSingleGroup->getSystemid(); //hide the superglobal admin-row from non-members if ($objSingleGroup->getSystemid() == class_module_system_setting::getConfigValue("_admins_group_id_") && !in_array(class_module_system_setting::getConfigValue("_admins_group_id_"), $this->objSession->getGroupIdsAsArray())) { continue; } //Building Checkboxes $arrTemplateRow["box0"] = "<input title=\"" . $arrTitles[0] . "\" rel=\"tooltip\" type=\"checkbox\" name=\"1," . $arrSingleGroup["group_id"] . "\" id=\"1," . $arrSingleGroup["group_id"] . "\" value=\"1\" " . (in_array($arrSingleGroup["group_id"], $arrRights["view"]) ? " checked=\"checked\" " : "") . " />"; $arrTemplateRow["box1"] = "<input title=\"" . $arrTitles[1] . "\" rel=\"tooltip\" type=\"checkbox\" name=\"2," . $arrSingleGroup["group_id"] . "\" id=\"2," . $arrSingleGroup["group_id"] . "\" value=\"1\" " . (in_array($arrSingleGroup["group_id"], $arrRights["edit"]) ? " checked=\"checked\" " : "") . " />"; $arrTemplateRow["box2"] = "<input title=\"" . $arrTitles[2] . "\" rel=\"tooltip\" type=\"checkbox\" name=\"3," . $arrSingleGroup["group_id"] . "\" id=\"3," . $arrSingleGroup["group_id"] . "\" value=\"1\" " . (in_array($arrSingleGroup["group_id"], $arrRights["delete"]) ? " checked=\"checked\" " : "") . " />"; $arrTemplateRow["box3"] = "<input title=\"" . $arrTitles[3] . "\" rel=\"tooltip\" type=\"checkbox\" name=\"4," . $arrSingleGroup["group_id"] . "\" id=\"4," . $arrSingleGroup["group_id"] . "\" value=\"1\" " . (in_array($arrSingleGroup["group_id"], $arrRights["right"]) ? " checked=\"checked\" " : "") . " />"; //loop the module specific permissions for ($intI = 1; $intI <= 5; $intI++) { if ($arrTemplateTotal["title" . ($intI + 3)] != "") { $arrTemplateRow["box" . ($intI + 3)] = "<input title=\"" . $arrTitles[$intI + 3] . "\" rel=\"tooltip\" type=\"checkbox\" name=\"" . ($intI + 4) . "," . $arrSingleGroup["group_id"] . "\" id=\"" . ($intI + 4) . "," . $arrSingleGroup["group_id"] . "\" value=\"1\" " . (in_array($arrSingleGroup["group_id"], $arrRights["right" . $intI]) ? " checked=\"checked\" " : "") . " />"; } else { $arrTemplateRow["box" . ($intI + 3)] = "<input type=\"hidden\" name=\"" . ($intI + 4) . "," . $arrSingleGroup["group_id"] . "\" id=\"" . ($intI + 4) . "," . $arrSingleGroup["group_id"] . "\" value=\"1\" />"; } } if (class_module_system_setting::getConfigValue("_system_changehistory_enabled_") == "true") { $arrTemplateRow["box9"] = "<input title=\"" . $arrTitles[9] . "\" rel=\"tooltip\" type=\"checkbox\" name=\"10," . $arrSingleGroup["group_id"] . "\" id=\"10," . $arrSingleGroup["group_id"] . "\" value=\"1\" " . (in_array($arrSingleGroup["group_id"], $arrRights["changelog"]) ? " checked=\"checked\" " : "") . " />"; } //And Print it to template $arrTemplateTotal["rows"] .= $this->objTemplate->fillTemplate($arrTemplateRow, $strTemplateRowID); } //Build the inherit-box $strTemplateInheritID = $this->objTemplate->readTemplate("/elements.tpl", "rights_form_inherit"); $arrTemplateInherit = array(); $arrTemplateInherit["title"] = $this->getLang("titel_erben"); $arrTemplateInherit["name"] = "inherit"; if (isset($arrRights["inherit"]) && $arrRights["inherit"] == 1) { $arrTemplateInherit["checked"] = "checked=\"checked\""; } else { $arrTemplateInherit["checked"] = ""; } $arrTemplateTotal["inherit"] = $this->objTemplate->fillTemplate($arrTemplateInherit, $strTemplateInheritID); //Creating the output, starting with the header $strTemplateID = $this->objTemplate->readTemplate("/elements.tpl", "rights_form_header"); $arrTemplate = array(); $arrTemplate["record"] = $strTitle; //Backlink $strUrlHistory = $this->getHistory(0); //Buliding the right-matrix $arrHistory = explode("&", $strUrlHistory); if (isset($arrHistory[0]) && isset($arrHistory[1])) { $arrTemplate["backlink"] = class_link::getLinkAdminManual("href=\"" . $arrHistory[0] . "&" . $arrHistory[1] . "\"", $this->getLang("commons_back")); } $arrTemplate["desc"] = $this->getLang("desc"); $strReturn .= $this->objTemplate->fillTemplate($arrTemplate, $strTemplateID); //Followed by the form $strReturn .= $this->objToolkit->formHeader(class_link::getLinkAdminHref($this->getArrModule("modul"), "saverights"), "rightsForm", "", "KAJONA.admin.permissions.submitForm(); return false;"); $strTemplateID = $this->objTemplate->readTemplate("/elements.tpl", "rights_form_form"); $strReturn .= $this->objTemplate->fillTemplate($arrTemplateTotal, $strTemplateID); $strReturn .= $this->objToolkit->formInputHidden("systemid", $strSystemID); //place all inheritance-rights as hidden-fields to support the change-js script $strPrevId = $objTargetRecord->getPrevId(); $arrRightsInherited = $objRights->getArrayRights($strPrevId); foreach ($arrRightsInherited as $strRightName => $arrRightsPerAction) { if ($strRightName != "inherit") { $intRightCounter = 0; if ($strRightName == "view") { $intRightCounter = 1; } if ($strRightName == "edit") { $intRightCounter = 2; } if ($strRightName == "delete") { $intRightCounter = 3; } if ($strRightName == "right") { $intRightCounter = 4; } if ($strRightName == "right1") { $intRightCounter = 5; } if ($strRightName == "right2") { $intRightCounter = 6; } if ($strRightName == "right3") { $intRightCounter = 7; } if ($strRightName == "right4") { $intRightCounter = 8; } if ($strRightName == "right5") { $intRightCounter = 9; } if ($strRightName == "changelog") { $intRightCounter = 10; } foreach ($arrRightsPerAction as $strOneGroupId) { //place hidden field $strReturn .= $this->objToolkit->formInputHidden("inherit," . $intRightCounter . "," . $strOneGroupId, "1"); } } } //Close the form $strReturn .= $this->objToolkit->formInputSubmit($this->getLang("commons_save")); $strReturn .= $this->objToolkit->formClose(); $strReturn .= "<script type=\"text/javascript\">\n KAJONA.admin.permissions.checkRightMatrix();\n KAJONA.admin.permissions.toggleEmtpyRows('" . $this->getLang("permissions_toggle_visible") . "', '" . $this->getLang("permissions_toggle_hidden") . "', '#rightsForm tr');\n </script>"; } else { $strReturn .= $this->getLang("commons_error_permissions"); } return $strReturn; }
/** * @return bool */ protected function onInsertToDb() { //send a message to all registered editors $objEvent = new class_module_eventmanager_event($this->getStrPrevId()); $strMailtext = $this->getLang("new_participant_mail") . "\n\n"; $strMailtext .= $this->getLang("new_participant_participant") . " " . $this->getStrDisplayName() . "\n"; $strMailtext .= $this->getLang("new_participant_event") . " " . $objEvent->getStrDisplayName() . "\n"; $strMailtext .= $this->getLang("new_participant_details") . " " . class_link::getLinkAdminHref("eventmanager", "listParticipant", "&systemid=" . $this->getStrPrevId(), false); $objMessageHandler = new class_module_messaging_messagehandler(); $arrGroups = array(); $allGroups = class_module_user_group::getObjectList(); foreach ($allGroups as $objOneGroup) { if (class_rights::getInstance()->checkPermissionForGroup($objOneGroup->getSystemid(), class_rights::$STR_RIGHT_EDIT, $this->getSystemid())) { $arrGroups[] = $objOneGroup; } } $objMessage = new class_module_messaging_message(); $objMessage->setStrBody(strip_tags($strMailtext)); $objMessage->setObjMessageProvider(new class_messageprovider_eventmanager()); $objMessageHandler->sendMessageObject($objMessage, $arrGroups); return true; }
/** * Method invoking the hook-methods to generate a form. * * @param string $strTargetModule * @param string $strTargetAction * @param string|class_admin_formgenerator $objAdminForm * * @return string */ public final function generateAdminForm($strTargetModule = "system", $strTargetAction = "systemTasks", $objAdminForm = null) { $strReturn = ""; $objAdminForm = $objAdminForm == null ? $this->getAdminForm() : $objAdminForm; if ($objAdminForm instanceof class_admin_formgenerator) { $objAdminForm->addField(new class_formentry_hidden("", "execute"))->setStrValue("true"); $objAdminForm->addField(new class_formentry_button("", "systemtask_run"))->setStrLabel($this->objLang->getLang("systemtask_run", "system"))->setStrValue("submit"); if ($this->bitMultipartform) { $objAdminForm->setStrFormEncoding(class_admin_formgenerator::FORM_ENCTYPE_MULTIPART); } $strLink = class_link::getLinkAdminHref($strTargetModule, $strTargetAction, "task=" . $this->getStrInternalTaskName()); $strReturn = $objAdminForm->renderForm($strLink, 0); } else { if ($objAdminForm != "") { if ($this->bitMultipartform) { $strReturn .= $this->objToolkit->formHeader(class_link::getLinkAdminHref($strTargetModule, $strTargetAction, "task=" . $this->getStrInternalTaskName()), "taskParamForm", class_admin_formgenerator::FORM_ENCTYPE_MULTIPART); } else { $strReturn .= $this->objToolkit->formHeader(class_link::getLinkAdminHref($strTargetModule, $strTargetAction, "task=" . $this->getStrInternalTaskName()), "taskParamForm"); } $strReturn .= $objAdminForm; $strReturn .= $this->objToolkit->formInputHidden("execute", "true"); $strReturn .= $this->objToolkit->formInputSubmit($this->objLang->getLang("systemtask_run", "system")); $strReturn .= $this->objToolkit->formClose(); } } return $strReturn; }
/** * Sends a copy of the message to the user by mail * * @param class_module_messaging_message $objMessage * @param class_module_user_user $objUser * @return bool */ private function sendMessageByMail(class_module_messaging_message $objMessage, class_module_user_user $objUser) { $strOriginalLang = class_carrier::getInstance()->getObjLang()->getStrTextLanguage(); class_carrier::getInstance()->getObjLang()->setStrTextLanguage($objUser->getStrAdminlanguage()); $strSubject = $objMessage->getStrTitle() != "" ? $objMessage->getStrTitle() : class_carrier::getInstance()->getObjLang()->getLang("message_notification_subject", "messaging"); $strBody = class_carrier::getInstance()->getObjLang()->getLang("message_prolog", "messaging"); $strBody .= "\n\n" . class_link::getLinkAdminHref("messaging", "view", "&systemid=" . $objMessage->getSystemid(), false) . "\n\n"; $strBody .= $objMessage->getStrBody(); $objMail = new class_mail(); //try to get a matching sender and place it into the mail if (validateSystemid($objMessage->getStrSenderId())) { $objSenderUser = new class_module_user_user($objMessage->getStrSenderId()); $objValidator = new class_email_validator(); if ($objValidator->validate($objSenderUser->getStrEmail())) { $objMail->setSender($objSenderUser->getStrEmail()); } } $objMail->setSubject($strSubject); $objMail->setText($strBody); $objMail->addTo($objUser->getStrEmail()); class_carrier::getInstance()->getObjLang()->setStrTextLanguage($strOriginalLang); return $objMail->sendMail(); }