function countSubItems($id)
 {
     $n = Node::by_id($id, 'ub_tree_societies');
     if ($n) {
         $c = $n->countSubItems() - 1;
         return $c;
     } else {
         return 0;
     }
 }
Beispiel #2
0
 public function EditArticleAction()
 {
     $request = Project::getRequest();
     $id = (int) $request->getKeyByNumber(0);
     if (!$request->submit) {
         $data = array();
         $data['action'] = "EditArticle";
         $this->BaseSiteData();
         $data['tab_list'] = TabController::getMainArticleTabs(false, false, false, false, false, true, null, $article_model->title);
         $article_model = new ArticleModel();
         $article_vote_model = new ArticleVoteModel();
         $article_page_model = new ArticlePageModel();
         $article_tree_model = new ArticleTreeModel();
         if (count($article_vote_model->loadByArticleId($id)) > 0) {
             //TODO: it's todo
             $data['message'] = "Вы не можете редактировать эту статью, голосование по ней уже началось";
         } else {
             $article = $article_model->load($id);
             if ($article['user_id'] == Project::getUser()->getDbUser()->id) {
                 $data['article'] = $article;
                 $data['pages'] = $article_page_model->loadByArticleId($id);
                 $key = Node::by_id($article_model->articles_tree_id, 'articles_tree')->key;
                 while ($key != "") {
                     $sect[] = $key;
                     $key = $key->getParent();
                 }
                 $sect = array_reverse($sect);
                 $n = Node::by_key('', 'articles_tree');
                 $branches = $n->getBranch();
                 $fill_sections = array();
                 foreach ($branches as $section) {
                     $data['fill_sections'][$section['level']][] = $section;
                 }
                 $data['sect'] = $sect;
             }
         }
         $this->_view->AddArticle($data);
         $this->_view->parse();
     }
 }
 function change_parent($vars)
 {
     $n = Node::by_id($vars['id'], 'sitemap');
     $parent = Node::by_id($vars['parent_id'], 'sitemap');
     $n->changeParent($parent);
     $this->go_page();
 }
 public function DownSectionAction()
 {
     $request = Project::getRequest();
     $id = $request->getKeyByNumber(0);
     $node = Node::by_id($id, 'articles_tree');
     $node->moveDown();
     $data = array();
     $this->_makeSectionList($data);
     $this->_view->AjaxSectionList($data);
     $this->_view->ajax();
 }