public static function addById($intId, $intParentId = 0) { global $_CONF; $objDoc = Structure::getXmlDoc($intId); $arrUserIds = array(); $arrGroupIds = array(); $arrStorageIds = array(); $arrFeedIds = array(); $arrLanguageIds[0] = 0; $arrTemplateIds[0] = 0; $arrTemplateFieldIds[0] = 0; $arrLinkFieldIds = array(); $arrElementIds[0] = 0; $arrElementFieldIds = array(); $arrElementFieldIds["link"][0] = 0; $arrElementFieldIds["largeText"][0] = 0; $intTemplateParentId = 0; $intElementParentId = 0; //*** Get structure fields from selects. if (Structure::hasSelect($intId)) { $objSelects = Structure::getSelectsById($intId); foreach ($objSelects as $objSelect) { switch ($objSelect->getType()) { case "language": $intId = Request::get("frm_select_{$objSelect->getId()}"); $arrLanguageIds[$objSelect->getLogicId()] = $intId; break; case "element": $intId = Request::get("frm_select_{$objSelect->getId()}"); if ($objSelect->getLogicId() == "PARENT") { $intElementParentId = $intId; } else { $arrElementIds[$objSelect->getLogicId()] = $intId; } break; } } } foreach ($objDoc->childNodes as $rootNode) { if ($rootNode->nodeName == "structure") { //*** Valid structure XML. switch ($rootNode->getAttribute("type")) { case "template": $intTemplateParentId = $intParentId; break; case "element": $intElementParentId = $intParentId; break; } foreach ($rootNode->childNodes as $logicNode) { if ($logicNode->nodeName == "logic") { foreach ($logicNode->childNodes as $childNode) { switch ($childNode->nodeName) { case "languages": //*** Add languages to the account. foreach ($childNode->childNodes as $languageNode) { $objLanguage = new ContentLanguage(); $objLanguage->setAccountId($_CONF['app']['account']->getId()); $objLanguage->setName($languageNode->getAttribute("name")); $objLanguage->setAbbr($languageNode->getAttribute("abbr")); $objLanguage->default = $languageNode->getAttribute("default"); $objLanguage->setActive($languageNode->getAttribute("active")); $objLanguage->setSort($languageNode->getAttribute("sort")); $objLanguage->setUsername($languageNode->getAttribute("username")); $objLanguage->save(); $arrLanguageIds[$languageNode->getAttribute("id")] = $objLanguage->getId(); if ($languageNode->getAttribute("default") == 1) { $intDefaultLanguage = $objLanguage->getId(); } } break; case "templates": //*** Add templates to the account. ImpEx::importTemplates($childNode, $_CONF['app']['account']->getId(), $arrTemplateIds, $arrTemplateFieldIds, $arrLinkFieldIds, $intTemplateParentId); break; case "elements": //*** Add elements to the account. ImpEx::importElements($childNode, $_CONF['app']['account']->getId(), $arrTemplateIds, $arrTemplateFieldIds, $arrElementIds, $arrElementFieldIds, $arrLinkFieldIds, $arrLanguageIds, $arrUserIds, $arrGroupIds, $arrStorageIds, $arrFeedIds, $intElementParentId); break; case "aliases": //*** Add aliases to the account. foreach ($childNode->childNodes as $aliasNode) { $objAlias = new Alias(); $objAlias->setAccountId($_CONF['app']['account']->getId()); $objAlias->setAlias($aliasNode->getAttribute("alias")); if (array_key_exists($aliasNode->getAttribute("url"), $arrElementIds)) { $objAlias->setUrl($arrElementIds[$aliasNode->getAttribute("url")]); } else { $objAlias->setUrl(0); } if (array_key_exists($aliasNode->getAttribute("language"), $arrLanguageIds)) { $objAlias->setLanguageId($arrLanguageIds[$aliasNode->getAttribute("language")]); } else { $objAlias->setLanguageId(0); } $objAlias->setCascade($aliasNode->getAttribute("cascade")); $objAlias->setActive($aliasNode->getAttribute("active")); $objAlias->setSort($aliasNode->getAttribute("sort")); $objAlias->setCreated($aliasNode->getAttribute("created")); $objAlias->setModified($aliasNode->getAttribute("modified")); $objAlias->save(); } break; } //*** Adjust the links for deeplink fields. ImpEx::adjustDeeplinks($arrElementFieldIds["link"], $arrElementIds, $arrLanguageIds); //*** Adjust the links in large text fields. ImpEx::adjustTextlinks($arrElementFieldIds["largeText"], $arrElementIds, $arrLanguageIds, array(0)); } } } } } }
$form = new AdminForm('category'); $page = 'admin/form'; $form->add([['name' => 'category_name', 'label' => 'Name', 'type' => 'text'], ['name' => 'alias_url', 'label' => 'Alias', 'type' => 'text'], ['name' => 'category_parent_id', 'label' => 'Parent Category', 'type' => 'select', 'select_table' => 'categories', 'select_id_field' => 'category_id', 'select_label_field' => 'category_name']]); if (isset($_POST['category_id'])) { $category = new Category($db, $_POST['category_id']); $category->setData($form->processInput($_POST)); $category->data['category_parent_id'] = parseInt($category->val('category_parent_id')); $alias_url = $category->val('alias_url'); unset($category->data['alias_url']); $category->save(); $alias = new Alias($db, $category->ival('category_alias_id')); // save alias if new or changed if ($alias->val('alias_url') != $alias_url || !$alias->is_loaded) { $alias->data['alias_path'] = $category->getAliasPath(); if (isset($alias_url) && strlen(trim($alias_url)) > 0) { $alias->setUrl($alias_url); } else { $alias->setUrl($category->getAliasUrl()); } $alias->save(); } // update category alias if changed if ($alias->ival('alias_id') != $category->ival('category_alias_id')) { $category->data['category_alias_id'] = $alias->ival('alias_id'); $category->save(); } $category->alias = $alias; } elseif (isset($path[2]) && $path[2] == 'edit') { $category = new Category($db, $path[3]); $category->alias = new Alias($db, $category->val('category_alias_id')); $page_title = t('Editing Category');
foreach ($product->categories->category as $cat) { $category = $categories_tree->findInChildren($cat, 'category_ext_id'); if (!isset($zCategory) || isset($category) && $category->level > $zCategory->level) { $zCategory = $category; } } if (isset($zCategory)) { $zProduct->data['product_category_id'] = $zCategory->ival('category_id'); $zProduct->data['product_name'] = $product_name; $zProduct->data['product_price'] = $product_price; $zProduct->data['product_stock'] = $product_stock; $zProduct->save(); // update alias $a = new Alias($db, $zProduct->val('product_alias_id')); if (!$a->is_loaded) { $a->setUrl($zProduct->getAliasUrl()); $a->data['alias_path'] = $zProduct->getAliasPath(); $a->save(); $zProduct->data['product_alias_id'] = $a->ival('alias_id'); $zProduct->save(); } } else { echo sprintf('Cannot find category with ABX id %s for product "%s"<br/>', $cat, $product_name); } } } // if $save_product if (isset($zVariant) && $zProduct->val('product_id') != null) { $zVariant->data['product_variant_ext_id'] = $prod_id; $zVariant->data['product_variant_name'] = $variant_name; $zVariant->data['product_variant_product_id'] = $zProduct->ival('product_id');
public static function importIn($strXml, $intElementId, $intTemplateId, $intAccountId, $importTemplates = true, $importElements = true, $validate = true) { global $objLiveAdmin, $intDefaultLanguage, $_CONF; $objReturn = NULL; $objSettings = NULL; $blnZip = false; $validTemplateStructure = false; //*** Init DOM object. $objDoc = new DOMDocument("1.0", "UTF-8"); $objDoc->formatOutput = false; $objDoc->preserveWhiteSpace = true; if (is_file($strXml)) { $objZip = new dUnzip2($strXml); if (is_object($objZip)) { //*** Zip file. $strXml = $objZip->unzip('data.xml'); if ($strXml !== false) { //*** Fix a unicode bug. Replace forbidden characters (The first 8). for ($intCount = 1; $intCount < 9; $intCount++) { $strHex = str_pad(dechex($intCount), 4, "0", STR_PAD_LEFT); $strXml = preg_replace('/\\x{' . $strHex . '}/u', "", $strXml); } $strXml = preg_replace('/\\x{001f}/u', "", $strXml); $objDoc->loadXML($strXml); $blnZip = true; } } else { //*** XML file. $objDoc->load($strXml); } } else { $objDoc->loadXML($strXml); } $arrUserIds = array(); $arrGroupIds = array(); $arrStorageIds = array(); $arrFeedIds = array(); $arrLanguageIds[0] = 0; $arrTemplateIds[0] = 0; $arrTemplateFieldIds[0] = 0; $arrLinkFieldIds = array(); $arrElementIds[0] = 0; $arrElementFieldIds = array(); $arrElementFieldIds["link"][0] = 0; $arrElementFieldIds["largeText"][0] = 0; if ($validate) { //*** validate template structure foreach ($objDoc->childNodes as $rootNode) { foreach ($rootNode->childNodes as $logicNode) { if ($logicNode->nodeName == "logic") { foreach ($logicNode->childNodes as $childNode) { switch ($childNode->nodeName) { case "templates": $validTemplateStructure = ImpEx::validateImportTemplates($childNode, $intAccountId, $arrTemplateIds, $arrTemplateFieldIds, $arrLinkFieldIds, $intTemplateId); break; } } } } } } if ($validTemplateStructure || !$validate) { //*** Import elements foreach ($objDoc->childNodes as $rootNode) { foreach ($rootNode->childNodes as $logicNode) { if ($logicNode->nodeName == "logic") { foreach ($logicNode->childNodes as $childNode) { switch ($childNode->nodeName) { case "languages": // Get all languages $arrCurrentLangs = array(); $objContentLangs = ContentLanguage::select(); $objDefaultLang = NULL; foreach ($objContentLangs as $objContentLang) { $arrCurrentLangs[$objContentLang->getAbbr()] = $objContentLang->getId(); if ($objContentLang->default == 1) { $objDefaultLang = $objContentLang; } } $arrLanguageIds[0] = 0; // loop trough languages from export foreach ($childNode->childNodes as $languageNode) { // if abbreviations match, use that language ID if (array_key_exists($languageNode->getAttribute('abbr'), $arrCurrentLangs)) { $arrLanguageIds[$languageNode->getAttribute("id")] = $arrCurrentLangs[$languageNode->getAttribute('abbr')]; } else { // if no match, use default current language $arrLanguageIds[$languageNode->getAttribute("id")] = $arrCurrentLangs[$objDefaultLang->getAbbr()]; } } break; case "templates": if ($importTemplates) { //*** Add templates to the account. self::importTemplates($childNode, $_CONF['app']['account']->getId(), $arrTemplateIds, $arrTemplateFieldIds, $arrLinkFieldIds, $intTemplateId); } break; case "elements": if ($importElements) { if ($intElementId == NULL) { $strSql = sprintf("SELECT * FROM pcms_element WHERE templateId = '%s' AND accountId = '%s' ORDER BY sort LIMIT 1", $intTemplateId, $intAccountId); $objElements = Element::select($strSql); foreach ($objElements as $objElement) { self::importElements($childNode, $intAccountId, $arrTemplateIds, $arrTemplateFieldIds, $arrElementIds, $arrElementFieldIds, $arrLinkFieldIds, $arrLanguageIds, $arrUserIds, $arrGroupIds, $arrStorageIds, $arrFeedIds, $objElement->getId()); } } else { self::importElements($childNode, $intAccountId, $arrTemplateIds, $arrTemplateFieldIds, $arrElementIds, $arrElementFieldIds, $arrLinkFieldIds, $arrLanguageIds, $arrUserIds, $arrGroupIds, $arrStorageIds, $arrFeedIds, $intElementId); } } break; case "aliases": if ($importElements) { //*** Add aliases to the account. foreach ($childNode->childNodes as $aliasNode) { if (in_array($aliasNode->getAttribute("url"), $arrElementIds)) { $objAlias = new Alias(); $objAlias->setAccountId($_CONF['app']['account']->getId()); $objAlias->setAlias($aliasNode->getAttribute("alias")); $objAlias->setUrl($arrElementIds[$aliasNode->getAttribute("url")]); $objAlias->setLanguageId($arrLanguageIds[$aliasNode->getAttribute("language")]); // check for existence of alias $objTmpAliases = Alias::selectByAlias($aliasNode->getAttribute("alias")); $objTmpAlias = $objTmpAliases->current(); if (!is_object($objTmpAlias)) { $objAlias->setCascade($aliasNode->getAttribute("cascade")); $objAlias->setActive($aliasNode->getAttribute("active")); $objAlias->setSort($aliasNode->getAttribute("sort")); $objAlias->setCreated($aliasNode->getAttribute("created")); $objAlias->setModified($aliasNode->getAttribute("modified")); $objAlias->save(); } } } } break; } if ($importElements) { //*** Adjust the links for deeplink fields. self::adjustDeeplinks($arrElementFieldIds["link"], $arrElementIds, $arrLanguageIds); //*** Adjust the links in large text fields. self::adjustTextlinks($arrElementFieldIds["largeText"], $arrElementIds, $arrLanguageIds, array(0)); } } } } } //*** Import files $objAccount = Account::selectByPK($_CONF['app']['account']->getId()); if ($blnZip && is_object($objAccount) && $importElements) { self::importFiles($objZip, $objAccount); //*** Move files to remote server. self::moveImportedFiles($objAccount); } return true; } return false; }
public function getParentAlias() { if ($this->ival('category_parent_id') > 0) { $p = new Category($this->db, $this->ival('category_parent_id')); $pa = new Alias($this->db, $p->ival('category_alias_id')); if (!$pa->is_loaded) { $pa->setUrl($p->getAliasUrl()); $pa->data['alias_path'] = $p->getAliasPath(); $pa->save(); $p->data['category_alias_id'] = $pa->val('alias_id'); $p->save(); } return $pa; } }
function parseAlias($intAliasId, $strCommand) { global $_PATHS, $_CLEAN_POST, $_CONF, $objLang, $objLiveUser; $objTpl = new HTML_Template_IT($_PATHS['templates']); $objTpl->loadTemplatefile("alias.tpl.htm"); $blnError = false; switch ($strCommand) { case CMD_LIST: case CMD_ADD: case CMD_EDIT: //*** Post the profile form if submitted. if (count($_CLEAN_POST) > 0 && !empty($_CLEAN_POST['dispatch']) && $_CLEAN_POST['dispatch'] == "editAlias") { //*** The element form has been posted. //*** Check sanitized input. if (is_null($_CLEAN_POST["frm_active"])) { $blnError = true; } if (is_null($_CLEAN_POST["frm_alias"])) { $blnError = true; } if (is_null($_CLEAN_POST["frm_language"])) { $blnError = true; } if (is_null($_CLEAN_POST["frm_element"])) { $blnError = true; } if (is_null($_CLEAN_POST["dispatch"])) { $blnError = true; } if ($blnError === true) { //*** Display global error. $objTpl->setVariable("FORM_ACTIVE_VALUE", $_POST["frm_active"] == "on" ? "checked=\"checked\"" : ""); $objTpl->setVariable("FORM_ALIAS_VALUE", $_POST["frm_alias"]); $objTpl->setVariable("ERROR_ALIAS_MAIN", $objLang->get("main", "formerror")); } else { //*** Input is valid. Save the alias. if ($strCommand == CMD_EDIT) { $objAlias = Alias::selectByPK($intAliasId); } else { $objAlias = new Alias(); } $objAlias->setAccountId($_CONF['app']['account']->getId()); $objAlias->setActive($_POST["frm_active"] == "on" ? 1 : 0); $objAlias->setLanguageId(empty($_CLEAN_POST["frm_language"]) ? 0 : $_CLEAN_POST["frm_language"]); $objAlias->setAlias($_CLEAN_POST["frm_alias"]); $objAlias->setUrl($_CLEAN_POST["frm_element"]); $objAlias->save(); header("Location: " . Request::getURI() . "/?cid=" . NAV_PCMS_ALIASES); exit; } } //*** Initiate child element loop. $objAliases = Alias::selectSorted(); $totalCount = 0; $listCount = 0; $intPosition = request("pos"); $intPosition = !empty($intPosition) && is_numeric($intPosition) ? $intPosition : 0; $intPosition = floor($intPosition / $_SESSION["listCount"]) * $_SESSION["listCount"]; //*** Find total count. foreach ($objAliases as $objAlias) { $strAlias = $objAlias->getAlias(); if (!empty($strAlias)) { $totalCount++; } } $objAliases->seek($intPosition); $objLanguages = ContentLanguage::select(); foreach ($objAliases as $objAlias) { $strAlias = $objAlias->getAlias(); if (!empty($strAlias)) { $strUrl = $objAlias->getUrl(); if (is_numeric($strUrl)) { $objElement = Element::selectByPk($strUrl); if (is_object($objElement)) { $strUrlHref = "?eid={$strUrl}&cmd=" . CMD_EDIT . "&cid=" . NAV_PCMS_ELEMENTS; $strUrl = Element::recursivePath($strUrl); } else { $strUrlHref = "?cid=" . NAV_PCMS_ALIASES; $strUrl = "<b>" . $objLang->get("aliasUnavailable", "label") . "</b>"; } } $objTpl->setCurrentBlock("multiview-item"); $objTpl->setVariable("MULTIITEM_VALUE", $objAlias->getId()); $objTpl->setVariable("BUTTON_REMOVE_HREF", "javascript:Alias.remove({$objAlias->getId()});"); $objTpl->setVariable("BUTTON_REMOVE", $objLang->get("delete", "button")); $objTpl->setVariable("MULTIITEM_HREF", "?cid=" . NAV_PCMS_ALIASES . "&eid={$objAlias->getId()}&cmd=" . CMD_EDIT); $objTpl->setVariable("MULTIITEM_TYPE_CLASS", "alias"); $objTpl->setVariable("MULTIITEM_ALIAS", $objAlias->getAlias()); $objTpl->setVariable("MULTIITEM_POINTS_TO", $objLang->get("pointsTo", "label")); $objTpl->setVariable("MULTIITEM_URL", $strUrl); $objTpl->setVariable("MULTIITEM_URL_HREF", $strUrlHref); if ($objLanguages->count() > 1) { if ($objAlias->getLanguageId() > 0) { $strLanguage = ContentLanguage::selectByPK($objAlias->getLanguageId())->getName(); $objTpl->setVariable("MULTIITEM_LANGUAGE", sprintf($objLang->get("forLanguage", "label"), $strLanguage)); } else { $objTpl->setVariable("MULTIITEM_LANGUAGE", $objLang->get("forAllLanguages", "label")); } } else { $objTpl->setVariable("MULTIITEM_LANGUAGE", ""); } if (!$objAlias->getActive()) { $objTpl->setVariable("MULTIITEM_ACTIVE", " class=\"inactive\""); } $objTpl->parseCurrentBlock(); $listCount++; if ($listCount >= $_SESSION["listCount"]) { break; } } } //*** Render page navigation. $pageCount = ceil($totalCount / $_SESSION["listCount"]); if ($pageCount > 0) { $currentPage = ceil(($intPosition + 1) / $_SESSION["listCount"]); $previousPos = $intPosition - $_SESSION["listCount"] > 0 ? $intPosition - $_SESSION["listCount"] : 0; $nextPos = $intPosition + $_SESSION["listCount"] < $totalCount ? $intPosition + $_SESSION["listCount"] : $intPosition; $objTpl->setVariable("PAGENAV_PAGE", sprintf($objLang->get("pageNavigation", "label"), $currentPage, $pageCount)); $objTpl->setVariable("PAGENAV_PREVIOUS", $objLang->get("previous", "button")); $objTpl->setVariable("PAGENAV_PREVIOUS_HREF", "?cid=" . NAV_PCMS_ALIASES . "&pos={$previousPos}"); $objTpl->setVariable("PAGENAV_NEXT", $objLang->get("next", "button")); $objTpl->setVariable("PAGENAV_NEXT_HREF", "?cid=" . NAV_PCMS_ALIASES . "&pos={$nextPos}"); //*** Top page navigation. for ($intCount = 0; $intCount < $pageCount; $intCount++) { $objTpl->setCurrentBlock("multiview-pagenavitem-top"); $position = $intCount * $_SESSION["listCount"]; if ($intCount != $intPosition / $_SESSION["listCount"]) { $objTpl->setVariable("PAGENAV_HREF", "href=\"?cid=" . NAV_PCMS_ALIASES . "&pos={$position}\""); } $objTpl->setVariable("PAGENAV_VALUE", $intCount + 1); $objTpl->parseCurrentBlock(); } //*** Bottom page navigation. for ($intCount = 0; $intCount < $pageCount; $intCount++) { $objTpl->setCurrentBlock("multiview-pagenavitem-bottom"); $position = $intCount * $_SESSION["listCount"]; if ($intCount != $intPosition / $_SESSION["listCount"]) { $objTpl->setVariable("PAGENAV_HREF", "href=\"?cid=" . NAV_PCMS_ALIASES . "&pos={$position}\""); } $objTpl->setVariable("PAGENAV_VALUE", $intCount + 1); $objTpl->parseCurrentBlock(); } } //*** Render list action pulldown. $arrActions[$objLang->get("choose", "button")] = 0; $arrActions[$objLang->get("delete", "button")] = "delete"; foreach ($arrActions as $key => $value) { $objTpl->setCurrentBlock("multiview-listactionitem"); $objTpl->setVariable("LIST_ACTION_TEXT", $key); $objTpl->setVariable("LIST_ACTION_VALUE", $value); $objTpl->parseCurrentBlock(); } $objTpl->setCurrentBlock("multiview"); $objTpl->setVariable("ACTIONS_OPEN", $objLang->get("pcmsOpenActionsMenu", "menu")); $objTpl->setVariable("ACTIONS_CLOSE", $objLang->get("pcmsCloseActionsMenu", "menu")); $objTpl->setVariable("LIST_LENGTH_HREF_10", "href=\"?list=10&cid=" . NAV_PCMS_ALIASES . "\""); $objTpl->setVariable("LIST_LENGTH_HREF_25", "href=\"?list=25&cid=" . NAV_PCMS_ALIASES . "\""); $objTpl->setVariable("LIST_LENGTH_HREF_100", "href=\"?list=100&cid=" . NAV_PCMS_ALIASES . "\""); switch ($_SESSION["listCount"]) { case 10: $objTpl->setVariable("LIST_LENGTH_HREF_10", ""); break; case 25: $objTpl->setVariable("LIST_LENGTH_HREF_25", ""); break; case 100: $objTpl->setVariable("LIST_LENGTH_HREF_100", ""); break; } $objTpl->setVariable("LIST_LENGTH_HREF", "&cid=" . NAV_PCMS_ALIASES); $objTpl->setVariable("LIST_WITH_SELECTED", $objLang->get("withSelected", "label")); $objTpl->setVariable("LIST_ACTION_ONCHANGE", "Alias.multiDo(this, this[this.selectedIndex].value)"); $objTpl->setVariable("LIST_ITEMS_PER_PAGE", $objLang->get("itemsPerPage", "label")); $objTpl->setVariable("BUTTON_LIST_SELECT", $objLang->get("selectAll", "button")); $objTpl->setVariable("BUTTON_LIST_SELECT_HREF", "javascript:Alias.multiSelect()"); $objTpl->parseCurrentBlock(); //*** Form variables. $intActiveLanguage = 0; if ($strCommand == CMD_EDIT) { $objAlias = Alias::selectByPK($intAliasId); $intActiveLanguage = $objAlias->getLanguageId(); $objTpl->setVariable("FORM_ACTIVE_VALUE", $objAlias->getActive() ? "checked=\"checked\"" : ""); $objTpl->setVariable("FORM_ALIAS_VALUE", $objAlias->getAlias()); $objTpl->setVariable("FORM_URL_VALUE", $objAlias->getUrl()); $objTpl->setVariable("FRM_HEADER", $objLang->get("editAlias", "form")); $objTpl->setVariable("FRM_STYLE", ""); $objTpl->setVariable("CMD", CMD_EDIT); $objTpl->touchBlock("alias.edit"); } else { $objTpl->setVariable("FORM_ACTIVE_VALUE", "checked=\"checked\""); $objTpl->setVariable("FRM_HEADER", $objLang->get("addAlias", "form")); if (!$blnError) { $objTpl->setVariable("FRM_STYLE", " style=\"display:none\""); } $objTpl->setVariable("CMD", CMD_ADD); $objTpl->touchBlock("alias.add"); } //*** Languages. $objLanguages = ContentLanguage::select(); foreach ($objLanguages as $objLanguage) { $objTpl->setCurrentBlock("language.item"); $objTpl->setVariable("ID", $objLanguage->getId()); $objTpl->setVariable("LABEL", $objLanguage->getName()); $objTpl->setVariable("SELECTED", $intActiveLanguage == $objLanguage->getId() ? " selected=\"selected\"" : ""); $objTpl->parseCurrentBlock(); } $objTpl->setVariable("ALIASES", $objLang->get("aliases", "label")); $objTpl->setVariable("BUTTON_ADD", $objLang->get("aliasAdd", "button")); $objTpl->setVariable("FRM_LABEL_ACTIVE", $objLang->get("active", "form")); $objTpl->setVariable("FRM_LABEL_ALIAS", $objLang->get("alias", "form")); $objTpl->setVariable("FRM_DESCR_ALIAS", $objLang->get("alias", "tip")); $objTpl->setVariable("FRM_LABEL_LANGUAGE", $objLang->get("language", "form")); $objTpl->setVariable("FRM_DESCR_LANGUAGE", $objLang->get("language", "tip")); $objTpl->setVariable("FRM_LABEL_ALL_LANGUAGES", $objLang->get("allLanguages", "form")); $objTpl->setVariable("FRM_LABEL_URL", $objLang->get("element", "form")); $objTpl->setVariable("FRM_LABEL_SAVE", $objLang->get("save", "button")); $objTpl->setVariable("CID", NAV_PCMS_ALIASES); $objTpl->setVariable("EID", $intAliasId); $objTpl->parseCurrentBlock(); $strReturn = $objTpl->get(); break; case CMD_REMOVE: if (strpos($intAliasId, ',') !== false) { //*** Multiple elements submitted. $arrAliases = explode(',', $intAliasId); $objAliases = Alias::selectByPK($arrAliases); foreach ($objAliases as $objAlias) { $objAlias->delete(); } } else { //*** Single element submitted. $objAlias = Alias::selectByPK($intAliasId); $objAlias->delete(); } //*** Redirect the page. $strReturnTo = request('returnTo'); if (empty($strReturnTo)) { header("Location: " . Request::getUri() . "/?cid=" . request("cid") . "&cmd=" . CMD_LIST); exit; } else { header("Location: " . Request::getURI() . $strReturnTo); exit; } break; } return $strReturn; }