public function execute()
 {
     $this->plugin_id = 'category';
     parent::execute();
     if ($data = waRequest::post($this->plugin_id)) {
         $order = 0;
         $model = new blogCategoryModel();
         foreach ($data as $id => &$row) {
             $id = intval($id);
             if (!empty($row['name'])) {
                 $row['sort'] = $order++;
                 if ($id > 0) {
                     if (!empty($row['delete'])) {
                         $model->deleteById($id);
                     } else {
                         $model->updateById($id, $row);
                         $row['id'] = $id;
                     }
                 } elseif ($id < 0) {
                     $row['id'] = $model->insert($row);
                 }
             }
         }
         unset($row);
     }
     $categories = blogCategory::getAll();
     $icons = $this->getConfig()->getIcons();
     if (!$categories) {
         $categories[0] = array('url' => '', 'name' => '', 'icon' => current($icons), 'id' => 0, 'qty' => 0, 'sort' => 0);
     }
     $this->view->assign('categories', $categories);
     $this->view->assign('icons', $icons);
 }
    public function frontendSidebar($params)
    {
        $output = array();
        $category_id = isset($params['category']) ? $params['category'] : false;
        if ($categories = blogCategory::getAll()) {
            $output['sidebar'] = '<ul class="menu-v categories">';
            $wa = wa();
            foreach ($categories as $category) {
                blogHelper::extendIcon($category);
                $category['link'] = $wa->getRouteUrl('blog/frontend', array('category' => urlencode($category['url'])), true);
                $category['name'] = htmlentities($category['name'], ENT_QUOTES, 'utf-8');
                $selected = $category_id && $category_id == $category['url'] ? ' class="selected"' : '';
                $output['sidebar'] .= <<<HTML
<li{$selected}>
<a href="{$category['link']}" title="{$category['name']}">{$category['name']}</a>
</li>
HTML;
            }
            $output['sidebar'] .= '</ul>';
        }
        return $output;
    }
 public function execute()
 {
     $category_model = new blogCategoryModel();
     $this->view->assign('categories', $category_model->getByPost($this->params['post_id']));
     $this->view->assign('categories_all', blogCategory::getAll());
 }
 public function execute()
 {
     $this->view->assign('categories', blogCategory::getAll());
     $this->view->assign('category_url', waRequest::get('category'));
 }