public function setName($vb068931cc450442b63f5b3d276ea4297) { $vb068931cc450442b63f5b3d276ea4297 = umiHierarchy::convertAltName($vb068931cc450442b63f5b3d276ea4297, "_"); $this->name = umiObjectProperty::filterInputString($vb068931cc450442b63f5b3d276ea4297); if (!strlen($this->name)) { $this->name = '_'; } $this->setIsUpdated(); }
public function setAltName($vd84ff935144e00c3e1d395c2379aca47, $v5c42c04954c401e189bb85786bde8adb = true) { if (!$vd84ff935144e00c3e1d395c2379aca47) { $vd84ff935144e00c3e1d395c2379aca47 = $this->getName(); } if ($v5c42c04954c401e189bb85786bde8adb) { $vd84ff935144e00c3e1d395c2379aca47 = umiHierarchy::convertAltName($vd84ff935144e00c3e1d395c2379aca47); if (!$vd84ff935144e00c3e1d395c2379aca47) { $vd84ff935144e00c3e1d395c2379aca47 = "_"; } } $vd295b8117d72bf06e54a27bcbfc782cf = $this->alt_name; $this->alt_name = $this->getRightAltName(umiObjectProperty::filterInputString($vd84ff935144e00c3e1d395c2379aca47)); if (!$this->alt_name) { $this->alt_name = $vd84ff935144e00c3e1d395c2379aca47; } $v1988c61c48f30d2b39eed4edcf1e3c8b = $this->alt_name; if ($v1988c61c48f30d2b39eed4edcf1e3c8b !== $vd295b8117d72bf06e54a27bcbfc782cf) { $this->setIsUpdated(); } }
public function copy_to_lang_old() { $langId = (int) getRequest('lang-id'); $domainId = (int) getRequest('domain-id'); $alias_new = (array) getRequest('alias'); $move_old = (array) getRequest('move'); $force = (int) getRequest('force'); $mode = (string) getRequest('mode'); $elements = getRequest('element'); if (!is_array($elements)) { $elements = array($elements); } foreach ($alias_new as $k => $v) { $alias_new[$k] = umiHierarchy::convertAltName($v); } if (!is_null($langId)) { $hierarchy = umiHierarchy::getInstance(); if (!$force) { $aliases_old = array(); foreach ($elements as $elementId) { if (!empty($move_old[$elementId])) { continue; } $element = $this->expectElement($elementId, false, true); $alt_name = $element->getAltName(); if (!empty($alias_new[$element->getId()])) { $alt_name = $alias_new[$element->getId()]; } $errors = array(); $element_dst = umiHierarchy::getInstance()->getIdByPath($alt_name, false, $errors, $domainId, $langId); $element_dst = $this->expectElement($element_dst, false, true); if ($element_dst && $element_dst->getAltName() == $alt_name) { $alt_name_normal = $hierarchy->getRightAltName($alt_name, $element_dst, false, true); $aliases_old[$element->getId()] = array($alt_name, $alt_name_normal); } } if (count($aliases_old)) { $this->setDataType("list"); $this->setActionType("view"); $data = array('error' => array()); //$this->prepareData(array(), "pages"); $data['error']['nodes:item'] = array(); $data['error']['type'] = '__alias__'; $path = "http://" . domainsCollection::getInstance()->getDomain($domainId)->getHost() . "/"; if (!langsCollection::getInstance()->getLang($langId)->getIsDefault()) { $path .= langsCollection::getInstance()->getLang($langId)->getPrefix() . '/'; } foreach ($aliases_old as $k => $v) { $data['error']['nodes:item'][] = array('attribute:id' => $k, 'attribute:path' => $path, 'attribute:alias' => $v[0], 'attribute:alt_name_normal' => $v[1]); } $this->setData($data); return $this->doData(); } } $templatesCollection = templatescollection::getInstance(); $templates = $templatesCollection->getTemplatesList($domainId, $langId); $template_error = false; if (empty($templates)) { $template_error = true; } if ($template_error) { $this->setDataType("list"); $this->setActionType("view"); $data = $this->prepareData(array(), "pages"); $dstLang = langsCollection::getInstance()->getLang($langId); $lang = ''; if (!$dstLang->getIsDefault()) { $lang .= $dstLang->getPrefix() . '/'; } $data['error'] = array(); $data['error']['type'] = "__template_not_exists__"; $data['error']['text'] = sprintf(getLabel('error-no-template-in-domain'), $lang); $this->setData($data); return $this->doData(); } $template_def = $templatesCollection->getDefaultTemplate($domainId, $langId); foreach ($elements as $elementId) { $element = $this->expectElement($elementId, false, true); $element_template = $templatesCollection->getTemplate($element->getTplId()); $template_has = false; foreach ($templates as $v) { if ($v->getFilename() == $element_template->getFilename()) { $template_has = $v; } } if (!$template_has) { $template_has = $template_def; } if (!$template_has) { $template_has = reset($templates); } //if($element->getLangId() != $langId || true) { if ($mode == 'move') { $copyElement = $element; $copyElementId = $element->getId(); } else { $copyChilds = (bool) getRequest('copy_all'); $copyElementId = $hierarchy->cloneElement($element->getId(), 0, true, false); $copyElement = $hierarchy->getElement($copyElementId); } if ($copyElement instanceof umiHierarchyElement) { $alt_name = $element->getAltName(); if (!empty($alias_new[$element->getId()])) { $alt_name = $alias_new[$element->getId()]; } if (!empty($move_old[$element->getId()])) { $element_dst = umiHierarchy::getInstance()->getIdByPath($alt_name, false, $errors, $domainId, $langId); $element_dst = $this->expectElement($element_dst, false, true); if ($element_dst && $element_dst->getAltName() == $alt_name) { $hierarchy->delElement($element_dst->getId()); } } $copyElement->setLangId($langId); if ($domainId) { $copyElement->setDomainId($domainId); } $copyElement->setAltName($alt_name); if ($template_has) { $copyElement->setTplId($template_has->getId()); } $copyElement->commit(); $childs = $hierarchy->getChilds($copyElementId); self::changeChildsLang($childs, $langId, $domainId); } } } $this->setDataType("list"); $this->setActionType("view"); $data = $this->prepareData(array(), "pages"); $this->setData($data); return $this->doData(); }
protected static function translateName($vb068931cc450442b63f5b3d276ea4297) { $vb068931cc450442b63f5b3d276ea4297 = umiHierarchy::convertAltName($vb068931cc450442b63f5b3d276ea4297, "_"); $vb068931cc450442b63f5b3d276ea4297 = umiObjectProperty::filterInputString($vb068931cc450442b63f5b3d276ea4297); if (!strlen($vb068931cc450442b63f5b3d276ea4297)) { $vb068931cc450442b63f5b3d276ea4297 = '_'; } $vb068931cc450442b63f5b3d276ea4297 = substr($vb068931cc450442b63f5b3d276ea4297, 0, 64); return $vb068931cc450442b63f5b3d276ea4297; }