Пример #1
0
 protected function action_edit()
 {
     if ($this->in_embedded_admin()) {
         CMS::$globals['is_embedded_admin'] = true;
         $this->use_layout('admin');
     }
     return parent::action_edit();
 }
Пример #2
0
 protected function load($id)
 {
     $item = parent::load($id);
     if ($item && ($type = $this->get_type($item))) {
         $type->deserialize($item);
     }
     return $item;
 }
Пример #3
0
 public function action_url($action, $p = false, $args = false, $extra = false)
 {
     $res = parent::action_url($action, $p, $args, $extra);
     if ($this->default_action($action, $args) !== 'tree') {
         return $res;
     }
     $res = preg_replace('!/list!', '', $res);
     if (preg_match('!/page-(\\d+)!', $res, $m)) {
         $page = $m[1];
         $res = str_replace('/page-' . $page, '', $res);
         $res .= (Core_Strings::contains($res, '?') ? '&' : '?') . "page={$page}";
     }
     return $res;
 }
Пример #4
0
 public function setup()
 {
     $url = $this->rep_query('tags.json');
     $this->tags = $this->get_query($url);
     return parent::setup()->render_defaults('connect_error', 'tags');
 }
Пример #5
0
 public function index($action, $args)
 {
     // Log::logger()->debug($action);
     $res = parent::index($action, $args);
     return $res;
 }
Пример #6
0
 protected function process_form($item)
 {
     $errors = parent::process_form($item);
     if (isset($this->form['_name']) && sizeof($errors) == 0) {
         $name = trim($this->form['_name']);
         if (Core_Regexps::match('{^[a-z0-9_-]+$}i', $name)) {
             return array();
         }
         if (Core_Regexps::match('{^[a-z0-9_-]+\\.[a-z0-9_-]+$}i', $name)) {
             return array();
         }
         return array('_name' => CMS::lang('%LANG{en}Invalid name!%LANG{ru}Некорректный мнемокод!'));
     }
     return $errors;
 }