Exemplo n.º 1
0
Arquivo: Tag.php Projeto: kstep/pnut
 public function remove()
 {
     $id = $this->getId();
     if ($id) {
         parent::remove();
         $this->_db->delete('tag_relations', array('tag_id' => $id));
     }
 }
Exemplo n.º 2
0
 public function action_showcontent()
 {
     $data = array();
     $id = $this->request->param('id');
     $material = new Model_Material();
     $data = $material->showMaterialById($id);
     if (!$data) {
         throw new HTTP_Exception_404('Запрашиваемая статья не найдена');
         return;
     }
     $this->template->content = View::factory('contentview', $data);
     //Категории для сайдбара
     $tree = new Model_Tree();
     $data_cat = array();
     $data_cat = $tree->getCategoryUrl();
     if (!$data_cat) {
         throw new HTTP_Exception_404('Запрашиваемая категория не найдена');
         return;
     }
     $this->template->categorys = $data_cat;
 }
Exemplo n.º 3
0
 public function action_index()
 {
     // basic
     $url = $this->request->param('id');
     $data = array();
     $tree = new Model_Tree();
     $data['categorys'] = $tree->getCategoryUrl();
     if (!$data['categorys']) {
         throw new HTTP_Exception_404('Запрашиваемая категория не найдена');
         return;
     }
     $this->template = View::factory('basic', $data);
     //home
     $data_content = array();
     $material = new Model_Material();
     $data_content = $material->getBooksID();
     if (!$data_content) {
         throw new HTTP_Exception_404('Запрашиваемая категория не найдена');
         return;
     }
     $this->template->contentpost = $data_content;
 }
Exemplo n.º 4
0
 public function action_showcat()
 {
     // Посты самой категории
     $url = $this->request->param('id');
     $data = array();
     $tree = new Model_Tree();
     $data['category'] = $tree->categoryInfoByUrl($url);
     if (!$data['category']) {
         throw new HTTP_Exception_404('Запрашиваемая категория не найдена');
         return;
     }
     $data['materials'] = $tree->contentCategoryById($data['category']['id']);
     $this->template->content = View::factory('catview', $data);
     //Категории для сайдбара
     $data_cat = array();
     $data_cat = $tree->getCategoryUrl();
     if (!$data_cat) {
         throw new HTTP_Exception_404('Запрашиваемая категория не найдена');
         return;
     }
     $this->template->categorys = $data_cat;
 }
Exemplo n.º 5
0
 public function save()
 {
     // @todo avoid regenerate if possible
     // if (creating) { add_space_for_new_node; calculate_sides_for_new_node; }
     // elseif (parent_changed) { do_some_magic_to_rearrange_nodes_sides; }
     parent::save();
     $this->regenerate();
 }
Exemplo n.º 6
0
Arquivo: Tree.php Projeto: kstep/pnut
 public function isAncestorOf(Model_Tree $model)
 {
     return $model->isDescendantOf($this);
 }