/** * @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")); } }
/** * @inheritDoc */ public function generateFieldsFromObject() { parent::generateFieldsFromObject(); $this->getField("path")->setStrOpener(class_link::getLinkAdminDialog("mediamanager", "folderListFolderview", "&form_element=" . $this->getField("path")->getStrEntryName(), $this->getLang("commons_open_browser"), $this->getLang("commons_open_browser"), "icon_externalBrowser", $this->getLang("commons_open_browser")))->setStrHint($this->getLang("mediamanager_path_h")); $this->getField("uploadfilter")->setStrHint($this->getLang("mediamanager_upload_filter_h")); $this->getField("viewfilter")->setStrHint($this->getLang("mediamanager_view_filter_h")); }
/** * This method is called, when the widget should generate it's content. * Return the complete content using the methods provided by the base class. * Do NOT use the toolkit right here! * * @return string */ public function getWidgetOutput() { $strReturn = ""; if (!class_module_system_module::getModuleByName("packagemanager")->rightEdit()) { return $this->getLang("commons_error_permissions"); } $objManager = new class_module_packagemanager_manager(); $arrRemotePackages = $objManager->scanForUpdates(); $strSystemVersion = "n.a."; if (isset($arrRemotePackages["system"])) { $strSystemVersion = $arrRemotePackages["system"]; } $arrUpdates = array(); $arrLocalPackages = $objManager->getAvailablePackages(); foreach ($arrLocalPackages as $objOneMetadata) { if (isset($arrRemotePackages[$objOneMetadata->getStrTitle()])) { if ($arrRemotePackages[$objOneMetadata->getStrTitle()] != null && version_compare($arrRemotePackages[$objOneMetadata->getStrTitle()], $objOneMetadata->getStrVersion(), ">")) { $arrUpdates[$objOneMetadata->getStrTitle()] = $arrRemotePackages[$objOneMetadata->getStrTitle()]; } } } $strReturn .= $this->widgetText($this->getLang("sysinfo_kajona_version") . " " . class_module_system_module::getModuleByName("system")->getStrVersion()); $strReturn .= $this->widgetText($this->getLang("sysinfo_kajona_versionAvail") . " " . $strSystemVersion); $strReturn .= $this->widgetSeparator(); if (count($arrUpdates) > 0) { $strReturn .= $this->widgetText($this->getLang("updatecheck_versionAvail")); } foreach ($arrUpdates as $strPackage => $intVersion) { $strReturn .= $this->widgetText(class_link::getLinkAdmin("packagemanager", "list", "&packagelist_filter=" . $strPackage . "&doFilter=1", $strPackage . " (" . $intVersion . ")")); } return $strReturn; }
/** * @return string * @autoTestable * @permissions view */ protected function actionBrowserChooser() { $strReturn = ""; if ($this->getParam("CKEditorFuncNum") != "") { $strReturn .= "<script type=\"text/javascript\">window.opener.KAJONA.admin.folderview.selectCallbackCKEditorFuncNum = " . (int) $this->getParam("CKEditorFuncNum") . ";</script>"; } $intCounter = 1; $strReturn .= $this->objToolkit->listHeader(); if (class_module_system_module::getModuleByName("pages") !== null) { $strAction = $this->objToolkit->listButton(class_link::getLinkAdmin("pages", "pagesFolderBrowser", "&pages=1&form_element=" . $this->getParam("form_element") . "&bit_link=1", $this->getLang("wysiwygPagesBrowser"), $this->getLang("wysiwygPagesBrowser"), "icon_folderActionOpen")); $strReturn .= $this->objToolkit->genericAdminList(generateSystemid(), $this->getLang("wysiwygPagesBrowser"), "", $strAction, $intCounter++); } $strRepoId = class_module_system_setting::getConfigValue("_mediamanager_default_filesrepoid_"); if (validateSystemid($strRepoId) && class_module_system_module::getModuleByName("mediamanager") !== null && class_objectfactory::getInstance()->getObject($strRepoId) !== null) { $strAction = $this->objToolkit->listButton(class_link::getLinkAdmin("mediamanager", "folderContentFolderviewMode", "&systemid=" . $strRepoId . "&form_element=" . $this->getParam("form_element") . "&bit_link=1", $this->getLang("wysiwygFilesBrowser"), $this->getLang("wysiwygFilesBrowser"), "icon_folderActionOpen")); $strReturn .= $this->objToolkit->genericAdminList(generateSystemid(), $this->getLang("wysiwygFilesBrowser"), "", $strAction, $intCounter++); } $strRepoId = class_module_system_setting::getConfigValue("_mediamanager_default_imagesrepoid_"); if (validateSystemid($strRepoId) && class_module_system_module::getModuleByName("mediamanager") !== null && class_objectfactory::getInstance()->getObject($strRepoId) !== null) { $strAction = $this->objToolkit->listButton(class_link::getLinkAdmin("mediamanager", "folderContentFolderviewMode", "&systemid=" . $strRepoId . "&form_element=" . $this->getParam("form_element") . "&bit_link=1", $this->getLang("wysiwygImagesBrowser"), $this->getLang("wysiwygImagesBrowser"), "icon_folderActionOpen")); $strReturn .= $this->objToolkit->genericAdminList(generateSystemid(), $this->getLang("wysiwygImagesBrowser"), "", $strAction, $intCounter++); } if (class_module_system_module::getModuleByName("mediamanager") !== null) { $strAction = $this->objToolkit->listButton(class_link::getLinkAdmin("mediamanager", "folderContentFolderviewMode", "&form_element=" . $this->getParam("form_element") . "&bit_link=1", $this->getLang("wysiwygRepoBrowser"), $this->getLang("wysiwygRepoBrowser"), "icon_folderActionOpen")); $strReturn .= $this->objToolkit->genericAdminList(generateSystemid(), $this->getLang("wysiwygRepoBrowser"), "", $strAction, $intCounter++); } $strReturn .= $this->objToolkit->listFooter(); return $strReturn; }
/** * Sends the requested file to the browser * @return string */ public function actionDownload() { //Load filedetails if (validateSystemid($this->getSystemid())) { /** @var $objFile class_module_mediamanager_file */ $objFile = class_objectfactory::getInstance()->getObject($this->getSystemid()); //Succeeded? if ($objFile instanceof class_module_mediamanager_file && $objFile->getIntRecordStatus() == "1" && $objFile->getIntType() == class_module_mediamanager_file::$INT_TYPE_FILE) { //Check rights if ($objFile->rightRight2()) { //Log the download class_module_mediamanager_logbook::generateDlLog($objFile); //Send the data to the browser $strBrowser = getServer("HTTP_USER_AGENT"); //Check the current browsertype if (uniStrpos($strBrowser, "IE") !== false) { //Internet Explorer class_response_object::getInstance()->addHeader("Content-type: application/x-ms-download"); class_response_object::getInstance()->addHeader("Content-type: x-type/subtype\n"); class_response_object::getInstance()->addHeader("Content-type: application/force-download"); class_response_object::getInstance()->addHeader("Content-Disposition: attachment; filename=" . preg_replace('/\\./', '%2e', saveUrlEncode(trim(basename($objFile->getStrFilename()))), substr_count(basename($objFile->getStrFilename()), '.') - 1)); } else { //Good: another browser vendor class_response_object::getInstance()->addHeader("Content-Type: application/octet-stream"); class_response_object::getInstance()->addHeader("Content-Disposition: attachment; filename=" . saveUrlEncode(trim(basename($objFile->getStrFilename())))); } //Common headers class_response_object::getInstance()->addHeader("Expires: Mon, 01 Jan 1995 00:00:00 GMT"); class_response_object::getInstance()->addHeader("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); class_response_object::getInstance()->addHeader("Pragma: no-cache"); class_response_object::getInstance()->addHeader("Content-description: JustThum-Generated Data\n"); class_response_object::getInstance()->addHeader("Content-Length: " . filesize(_realpath_ . $objFile->getStrFilename())); //End Session $this->objSession->sessionClose(); class_response_object::getInstance()->sendHeaders(); //Loop the file $ptrFile = @fopen(_realpath_ . $objFile->getStrFilename(), 'rb'); fpassthru($ptrFile); @fclose($ptrFile); ob_flush(); flush(); return ""; } else { class_response_object::getInstance()->setStrStatusCode(class_http_statuscodes::SC_FORBIDDEN); } } else { class_response_object::getInstance()->setStrStatusCode(class_http_statuscodes::SC_NOT_FOUND); } } else { class_response_object::getInstance()->setStrStatusCode(class_http_statuscodes::SC_NOT_FOUND); } //if we reach up here, something gone wrong :/ class_response_object::getInstance()->setStrRedirectUrl(str_replace(array("_indexpath_", "&"), array(_indexpath_, "&"), class_link::getLinkPortalHref(class_module_system_setting::getConfigValue("_pages_errorpage_")))); class_response_object::getInstance()->sendHeaders(); class_response_object::getInstance()->sendContent(); return ""; }
/** * Renders the field itself. * In most cases, based on the current toolkit. * * @return string */ public function renderField() { $objToolkit = class_carrier::getInstance()->getObjToolkit("admin"); $strReturn = ""; if ($this->getStrHint() != null) { $strReturn .= $objToolkit->formTextRow($this->getStrHint()); } $strOpener = ""; if ($this->bitRenderReset) { $strOpener = " " . class_link::getLinkAdminManual("href=\"#\" onclick=\"\$('#" . $this->getStrEntryName() . "').val('');return false;\"", "", class_carrier::getInstance()->getObjLang()->getLang("commons_reset", "prozessverwaltung"), "icon_delete"); } $strReturn .= $objToolkit->formInputDropdown($this->getStrEntryName(), $this->arrKeyValues, $this->getStrLabel(), $this->getStrValue(), "", !$this->getBitReadonly(), $this->getStrAddons(), $this->getStrDataPlaceholder(), $strOpener); return $strReturn; }
/** * This method is called, when the widget should generate it's content. * Return the complete content using the methods provided by the base class. * Do NOT use the toolkit right here! * * @return string */ public function getWidgetOutput() { $strReturn = ""; if (!class_module_system_module::getModuleByName("pages")->rightView()) { return $this->getLang("commons_error_permissions"); } $intMax = $this->getFieldValue("nrofrows"); if ($intMax < 0) { $intMax = 1; } /** @var class_module_pages_page[] $arrRecords */ $arrRecords = class_module_system_common::getLastModifiedRecords($intMax, false, "class_module_pages_page"); foreach ($arrRecords as $objPage) { if ($objPage->rightEdit()) { $strReturn .= $this->widgetText(class_link::getLinkAdmin("pages_content", "list", "&systemid=" . $objPage->getSystemid(), $objPage->getStrDisplayName())); } else { $strReturn .= $this->widgetText($objPage->getStrDisplayName()); } $strReturn .= $this->widgetText(" " . timeToString($objPage->getIntLmTime()) . ""); } return $strReturn; }
/** * 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); }
/** * 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(); }
/** * @param class_model $objListEntry * * @return array */ protected function renderAdditionalActions(class_model $objListEntry) { if ($objListEntry instanceof class_module_workflows_handler) { return array($this->objToolkit->listButton(class_link::getLinkAdmin($this->getArrModule("modul"), "instantiateHandler", "&systemid=" . $objListEntry->getSystemid(), "", $this->getLang("action_instantiate_handler"), "icon_workflowTrigger"))); } if ($objListEntry instanceof class_module_workflows_workflow) { $arrReturn = array(); if ($objListEntry->getIntState() == class_module_workflows_workflow::$INT_STATE_SCHEDULED && $objListEntry->getObjWorkflowHandler()->providesUserInterface()) { $arrReturn[] = $this->objToolkit->listButton(class_link::getLinkAdmin($this->getArrModule("modul"), "showUI", "&systemid=" . $objListEntry->getSystemid(), "", $this->getLang("workflow_ui"), "icon_workflow_ui")); } if ($objListEntry->rightEdit()) { $arrReturn[] = $this->objToolkit->listButton(class_link::getLinkAdmin($this->getArrModule("modul"), "showDetails", "&systemid=" . $objListEntry->getSystemid(), "", $this->getLang("action_show_details"), "icon_lens")); } return $arrReturn; } return parent::renderAdditionalActions($objListEntry); }
/** * Return an on-lick link for the passed object. * This link is rendered by the portal search result generator, so * make sure the link is a valid portal page. * If you want to suppress the entry from the result, return an empty string instead. * If you want to add additional entries to the result set, clone the result and modify * the new instance to your needs. Pack them in an array and they'll be merged * into the result set afterwards. * Make sure to return the passed result-object in this array, too. * * @param class_search_result $objResult * * @see getLinkPortalHref() * @return mixed */ public function updateSearchResult(class_search_result $objResult) { $objORM = new class_orm_objectlist(); $strQuery = "SELECT page_name, guestbook_amount, page_id\n FROM " . _dbprefix_ . "element_guestbook,\n " . _dbprefix_ . "page_element,\n " . _dbprefix_ . "page,\n " . _dbprefix_ . "system\n WHERE guestbook_id = ?\n AND content_id = page_element_id\n AND content_id = system_id\n AND system_prev_id = page_id\n AND system_status = 1\n " . $objORM->getDeletedWhereRestriction() . "\n AND page_element_ph_language = ? "; $arrRows = $this->objDB->getPArray($strQuery, array($this->getPrevId(), $objResult->getObjSearch()->getStrPortalLangFilter())); $arrReturn = array(); foreach ($arrRows as $arrOnePage) { //check, if the post is available on a page using the current language if (!isset($arrOnePage["page_name"]) || $arrOnePage["page_name"] == "") { continue; } //search pv position $intAmount = $arrOnePage["guestbook_amount"]; $arrPostsInGB = class_module_guestbook_post::getPosts($this->getPrevId(), true); $intCounter = 0; foreach ($arrPostsInGB as $objOnePostInGb) { $intCounter++; if ($objOnePostInGb->getSystemid() == $this->getSystemid()) { break; } } //calculate pv $intPvPos = ceil($intCounter / $intAmount); $objNewResult = clone $objResult; $objNewResult->setStrPagelink(class_link::getLinkPortal($arrOnePage["page_name"], "", "_self", $arrOnePage["page_name"], "", "&highlight=" . urlencode(html_entity_decode($objResult->getObjSearch()->getStrQuery(), ENT_QUOTES, "UTF-8")) . "&pv=" . $intPvPos)); $objNewResult->setStrPagename($arrOnePage["page_name"]); $objNewResult->setStrDescription($this->getStrGuestbookPostText()); $arrReturn[] = $objNewResult; } return $arrReturn; }
/** * @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; }
/** * 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); }
/** * Generates a link opening in a popup in portal-area * * @deprecated * * @param string $strPageI * @param string $strPageE * @param string $strAction * @param string $strParams * @param string $strSystemid * @param string $strTitle * @param int|string $intWidth * @param int|string $intHeight * * @return string */ function getLinkPortalPopup($strPageI, $strPageE, $strAction = "", $strParams = "", $strSystemid = "", $strTitle = "", $intWidth = "500", $intHeight = "500") { return class_link::getLinkPortalPopup($strPageI, $strPageE, $strAction, $strParams, $strSystemid, $strTitle, $intWidth, $intHeight); }
/** * Renders the button to open the records' change history. In most cases, this is done in a overlay. * To open the change-history, the permission "right3" on the system-module is required. * * @param class_model|interface_model $objListEntry * * @return string */ protected function renderChangeHistoryAction(class_model $objListEntry) { if (class_module_system_setting::getConfigValue("_system_changehistory_enabled_") == "true" && $objListEntry instanceof interface_versionable && $objListEntry->rightChangelog()) { return $this->objToolkit->listButton(class_link::getLinkAdminDialog("system", "genericChangelog", "&systemid=" . $objListEntry->getSystemid() . "&folderview=1", $this->getLang("commons_edit_history"), $this->getLang("commons_edit_history"), "icon_history", $objListEntry->getStrDisplayName())); } return ""; }
/** * 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 ""; }
/** * Helper to fetch the portal language * @return null|string */ private static function getStrPortalLanguage() { if (self::$strPortalLanguage == null) { $objLang = new class_module_languages_language(); self::$strPortalLanguage = $objLang->getStrPortalLanguage(); } return self::$strPortalLanguage; }
/** * Creates a form to edit a users data * * @return string */ private function editUserData() { $arrErrors = array(); $bitForm = true; //what to do? if ($this->getParam("submitUserForm") != "") { if ($this->getParam("password") != "") { if ($this->getParam("password") != $this->getParam("password2")) { $arrErrors[] = $this->getLang("passwordsUnequal"); } } $objValidator = new class_email_validator(); if (!$objValidator->validate($this->getParam("email"))) { $arrErrors[] = $this->getLang("invalidEmailadress"); } if (count($arrErrors) == 0) { $bitForm = false; } } if ($bitForm) { if ($this->arrElementData["portallogin_editmode"] == 1) { $strTemplateID = $this->objTemplate->readTemplate("/element_portallogin/" . $this->arrElementData["portallogin_template"], "portallogin_userdataform_complete"); } else { $strTemplateID = $this->objTemplate->readTemplate("/element_portallogin/" . $this->arrElementData["portallogin_template"], "portallogin_userdataform_minimal"); } $arrTemplate = array(); $objUser = new class_module_user_user($this->objSession->getUserID()); if ($objUser->getObjSourceUser()->isEditable() && $objUser->getStrSubsystem() == "kajona" && $objUser->getObjSourceUser() instanceof class_usersources_user_kajona) { $arrTemplate["username"] = $objUser->getStrUsername(); $arrTemplate["email"] = $objUser->getObjSourceUser()->getStrEmail(); $arrTemplate["forename"] = $objUser->getObjSourceUser()->getStrForename(); $arrTemplate["name"] = $objUser->getObjSourceUser()->getStrName(); $arrTemplate["street"] = $objUser->getObjSourceUser()->getStrStreet(); $arrTemplate["postal"] = $objUser->getObjSourceUser()->getStrPostal(); $arrTemplate["city"] = $objUser->getObjSourceUser()->getStrCity(); $arrTemplate["phone"] = $objUser->getObjSourceUser()->getStrTel(); $arrTemplate["mobile"] = $objUser->getObjSourceUser()->getStrMobile(); $arrTemplate["portallogin_elsystemid"] = $this->arrElementData["content_id"]; $objDate = new class_date($objUser->getObjSourceUser()->getLongDate()); $arrTemplate["date_day"] = $objDate->getIntDay(); $arrTemplate["date_month"] = $objDate->getIntMonth(); $arrTemplate["date_year"] = $objDate->getIntYear(); $arrTemplate["formaction"] = class_link::getLinkPortalHref($this->getPagename(), "", "portalEditProfile"); $arrTemplate["formErrors"] = ""; if (count($arrErrors) > 0) { foreach ($arrErrors as $strOneError) { $strErrTemplate = $this->objTemplate->readTemplate("/element_portallogin/" . $this->arrElementData["portallogin_template"], "errorRow"); $arrTemplate["formErrors"] .= "" . $this->fillTemplate(array("error" => $strOneError), $strErrTemplate); } } return $this->fillTemplate($arrTemplate, $strTemplateID); } else { return "Login provider not supported."; } } else { $objUser = new class_module_user_user($this->objSession->getUserID()); if ($objUser->getObjSourceUser() instanceof class_usersources_user_kajona) { $objUser->getObjSourceUser()->setStrEmail($this->getParam("email")); $objUser->getObjSourceUser()->setStrForename($this->getParam("forename")); $objUser->getObjSourceUser()->setStrName($this->getParam("name")); $objUser->getObjSourceUser()->setStrPass($this->getParam("password")); if ($this->arrElementData["portallogin_editmode"] == 1) { $objUser->getObjSourceUser()->setStrStreet($this->getParam("street")); $objUser->getObjSourceUser()->setStrPostal($this->getParam("postal")); $objUser->getObjSourceUser()->setStrCity($this->getParam("city")); $objUser->getObjSourceUser()->setStrTel($this->getParam("phone")); $objUser->getObjSourceUser()->setStrMobile($this->getParam("mobile")); $objDate = new class_date(); $objDate->setIntDay($this->getParam("date_day")); $objDate->setIntMonth($this->getParam("date_month")); $objDate->setIntYear($this->getParam("date_year")); $objUser->getObjSourceUser()->setLongDate($objDate->getLongTimestamp()); } $objUser->getObjSourceUser()->updateObjectToDb(); } $this->portalReload(class_link::getLinkPortalHref($this->getPagename())); } return ""; }
/** * Return an on-lick link for the passed object. * This link is rendered by the portal search result generator, so * make sure the link is a valid portal page. * If you want to suppress the entry from the result, return an empty string instead. * * @param class_search_result $objResult * * @see getLinkPortalHref() * @return mixed */ public function updateSearchResult(class_search_result $objResult) { $objORM = new class_orm_objectlist(); //load the matching site of the current page-element $strQuery = "SELECT page_name, page_id, pageproperties_browsername\n\t\t\t\t\t\t FROM " . _dbprefix_ . "page_element,\n\t\t\t\t\t\t " . _dbprefix_ . "page_properties,\n\t\t\t\t\t\t " . _dbprefix_ . "page,\n\t\t\t\t\t\t " . _dbprefix_ . "system\n\t\t\t\t\t\t WHERE system_prev_id = page_id\n\t\t\t\t\t\t AND pageproperties_id = page_id\n\t\t\t\t\t\t AND system_id = page_element_id\n\t\t\t\t\t\t AND page_element_id = ?\n\t\t\t\t\t\t " . $objORM->getDeletedWhereRestriction() . "\n\t\t\t\t\t\t AND system_status = 1"; $arrPage = class_carrier::getInstance()->getObjDB()->getPRow($strQuery, array($this->getSystemid())); if (isset($arrPage["page_name"])) { $objResult->setStrPagelink(class_link::getLinkPortal($arrPage["page_name"], "", "_self", $arrPage["pageproperties_browsername"], "", "&highlight=" . urlencode(html_entity_decode($objResult->getObjSearch()->getStrQuery(), ENT_QUOTES, "UTF-8")))); $objResult->setStrPagename($arrPage["page_name"]); } }
/** * @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; }
/** * @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 ""; }
/** * 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; }
/** * 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()); }
public function getValueAsText() { $objSourceObject = $this->getObjSourceObject(); if ($objSourceObject == null) { return ""; } if (!empty($this->arrKeyValues)) { $strHtml = ""; foreach ($this->arrKeyValues as $objObject) { if ($objObject instanceof interface_model && $objObject->rightView()) { $strTitle = self::getDisplayName($objObject); //see, if the matching target-module provides a showSummary method $objModule = class_module_system_module::getModuleByName($objObject->getArrModule("modul")); if ($objModule != null) { $objAdmin = $objModule->getAdminInstanceOfConcreteModule($objObject->getSystemid()); if ($objAdmin !== null && method_exists($objAdmin, "actionShowSummary")) { $strTitle = class_link::getLinkAdmin($objObject->getArrModule("modul"), "showSummary", "&systemid=" . $objObject->getSystemid(), $strTitle); } } $strHtml .= $strTitle . "<br/>\n"; } else { throw new class_exception("Array must contain objects", class_exception::$level_ERROR); } } $strHtml .= ""; return $strHtml; } return "-"; }
protected function getOutputNaviEntry(interface_model $objInstance) { if ($objInstance instanceof class_module_tags_tag) { return class_link::getLinkAdmin($this->getArrModule("modul"), "showAssignedRecords", "&systemid=" . $objInstance->getSystemid(), $objInstance->getStrName()); } return null; }
/** * 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()); }
/** * 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 string * @permissions view,right1 */ protected function actionSaveRegisterForEvent() { $strReturn = ""; $objEvent = new class_module_eventmanager_event($this->getSystemid()); class_module_pages_portal::registerAdditionalTitle($objEvent->getStrTitle()); $bitIsLoggedin = false; $bitIsParticipant = false; if ($this->objSession->isLoggedin() && $this->objTemplate->containsSection($this->objTemplate->readTemplate("/module_eventmanager/" . $this->arrElementData["char1"]), "event_register_loggedin")) { $bitIsLoggedin = true; if ($objEvent->isParticipant($this->objSession->getUserID())) { $bitIsParticipant = true; } } $arrErrors = array(); //what to do? $objTextValidator = new class_text_validator(); $objMailValidator = new class_email_validator(); if (!$bitIsLoggedin && !$objTextValidator->validate($this->getParam("forename"), 3)) { $arrErrors[] = $this->getLang("noForename"); } if (!$bitIsLoggedin && !$objTextValidator->validate($this->getParam("lastname"), 3)) { $arrErrors[] = $this->getLang("noLastname"); } if (!$bitIsLoggedin && !$objMailValidator->validate($this->getParam("email"))) { $arrErrors[] = $this->getLang("invalidEmailadress"); } //Check captachcode if (!$bitIsLoggedin && ($this->getParam("form_captcha") == "" || $this->getParam("form_captcha") != $this->objSession->getCaptchaCode())) { $arrErrors[] = $this->getLang("commons_captcha"); } if (count($arrErrors) != 0) { return $this->actionRegisterForEvent($arrErrors); } if ($objEvent->getIntLimitGiven() == "1" && $objEvent->getIntParticipantsLimit() <= class_module_eventmanager_participant::getActiveParticipantsCount($this->getSystemid())) { $strMessage = $this->getLang("participantLimitReached"); $strWrapperID = $this->objTemplate->readTemplate("/module_eventmanager/" . $this->arrElementData["char1"], "event_register_message"); $strReturn = $this->objTemplate->fillTemplate(array("title" => $objEvent->getStrTitle(), "message" => $strMessage), $strWrapperID); return $strReturn; } if ($bitIsParticipant) { $objParticipant = class_module_eventmanager_participant::getParticipantByUserid($this->objSession->getUserID(), $objEvent->getSystemid()); } else { $objParticipant = new class_module_eventmanager_participant(); } //here we go, create the complete event registration $objParticipant->setStrComment($this->getParam("comment")); if ($bitIsLoggedin) { $objParticipant->setStrUserId($this->objSession->getUserID()); $objParticipant->setIntParticipationStatus($this->getParam("participant_status")); } else { $objParticipant->setStrForename($this->getParam("forename")); $objParticipant->setStrLastname($this->getParam("lastname")); $objParticipant->setStrPhone($this->getParam("phone")); $objParticipant->setStrEmail($this->getParam("email")); } $objParticipant->updateObjectToDb($this->getSystemid()); if ($bitIsParticipant) { $strMessage = $this->getLang("participantUpdateMessage"); $strWrapperID = $this->objTemplate->readTemplate("/module_eventmanager/" . $this->arrElementData["char1"], "event_register_message"); return $this->objTemplate->fillTemplate(array("title" => $objEvent->getStrTitle(), "message" => $strMessage), $strWrapperID); } $objParticipant->setIntRecordStatus(0); $objParticipant->updateObjectToDb(); $objMail = new class_mail(); $objMail->setSubject($this->getLang("registerMailSubject")); $strBody = $this->getLang("registerMailBodyIntro"); $strBody .= $objEvent->getStrTitle() . "<br />"; $strBody .= dateToString($objEvent->getObjStartDate(), true) . "<br />"; $strBody .= $objEvent->getStrLocation() . "<br />"; $strBody .= "\n"; $strTemp = class_link::getLinkPortalHref($this->getPagename(), "", "participantConfirmation", "&participantId=" . $objParticipant->getSystemid(), $this->getSystemid(), "", $objEvent->getStrTitle()); $strBody .= html_entity_decode("<a href=\"" . $strTemp . "\">" . $strTemp . "</a>"); $objScriptlet = new class_scriptlet_helper(); $strBody = $objScriptlet->processString($strBody); $objMail->setHtml($strBody); $objMail->addTo($objParticipant->getStrEmail()); $objMail->sendMail(); $strMessage = $this->getLang("participantSuccessMail"); $strWrapperID = $this->objTemplate->readTemplate("/module_eventmanager/" . $this->arrElementData["char1"], "event_register_message"); $strReturn .= $this->objTemplate->fillTemplate(array("title" => $objEvent->getStrTitle(), "message" => $strMessage), $strWrapperID); return $strReturn; }
/** * 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; }
/** * @param class_model $objListEntry * * @return array */ protected function renderAdditionalActions(class_model $objListEntry) { if ($objListEntry instanceof class_module_search_search) { return array($this->objToolkit->listButton(class_link::getLinkAdmin($this->getArrModule("modul"), "search", "&systemid=" . $objListEntry->getSystemid(), $this->getLang("action_execute_search"), $this->getLang("action_execute_search"), "icon_lens"))); } else { return array(); } }