Exemple #1
0
 /**
  * На основе _POST данных обновляет имя скрипта и часть URI скрипта 
  */
 protected static function updateNameAndUrlkey($sitemapId)
 {
     if (!empty($_POST['sitemap_name']) && isset($_POST['sitemap_url_key'])) {
         $name = htmlspecialchars($_POST['sitemap_name']);
         $urlKey = htmlspecialchars($_POST['sitemap_url_key']);
         Sitemap::updateScript(self::$sitemap['id'], $name, self::$sitemap['script'], $urlKey, self::$sitemap['parent'], self::$sitemap['script_admin_url'], self::$sitemap['script_manual_order']);
     }
 }
Exemple #2
0
 protected function updateScript($to, $name, $url_key)
 {
     $to = intval($to);
     try {
         $aDocument = Sitemap_Sample::get($this->aSitemap['id'], $to);
         if (!empty($aDocument['document_name'])) {
             throw new Exception('Requested id isn`t script');
         }
         // Обновляем скрипт
         Sitemap::updateScript($this->aSitemap['id'], $name, $this->aSitemap['script'], $url_key, $to >= 0 && $to != $this->aSitemap['id'] ? $to : $this->aSitemap['parent'], $this->aSitemap['script_admin_url'], $this->aSitemap['script_manual_order']);
         // Обновляем количество детей у старого и нового предка
         Sitemap::updateParentCount($this->aSitemap['id']);
         Sitemap::updateParentCount($to);
     } catch (Exception $e) {
         $this->addError('Ошибка при перемещении документа. ', $e->getMessage());
     }
 }