Beispiel #1
0
 public function action_index()
 {
     $parentId = $this->request->param('id');
     $tree = new Model_Widgets_Menu('tree');
     //смотрим шаблон для виджета
     $widget = new Model_Widget();
     $template = $widget->getTempalte('menu', $parentId);
     if ($template) {
         $this->template = View::factory('widgets/' . $template);
     }
     //Получаем список меню
     $items = $tree->menuItems($parentId);
     if (isset($_GET['del_mid'])) {
         if (Cookie::get('userId')) {
             $userId = Cookie::get('userId');
             $cart = new Model_Widgets_Cart();
             $cart->delFromCart($userId, $_GET['del_mid']);
         }
     }
     if (Cookie::get('userId')) {
         $userId = Cookie::get('userId');
         $cart = new Model_Widgets_Cart();
         $cartCount = $cart->getCartCount($userId);
         $cartPrice = $cart->getCartPrice($userId);
         $cartData = "<h5>В корзине: <font> " . $cartCount . " </font> товаров</h5>\n            <h5>на сумму:&nbsp;&nbsp; <font> " . $cartPrice . " </font> рублей</h5>";
     } else {
         $cartData = '<h5>Ваша корзина пуста</h5>';
     }
     $this->template->cartData = $cartData;
     $this->template->menu = $items;
 }
Beispiel #2
0
 public function action_index()
 {
     echo "fsfsff";
     $parentId = $this->request->param('id');
     $tree = new Model_Widgets_Menu('tree');
     //смотрим шаблон для виджета
     $widget = new Model_Widget();
     $template = $widget->getTempalte('menu2', $parentId);
     if ($template) {
         $this->template = View::factory('widgets/' . $template);
     }
     //Получаем список меню
     $items = $tree->menuItems($parentId);
     $this->template->menu = $items;
 }
Beispiel #3
0
 public function action_sidebar()
 {
     $this->setopt(array("name" => "parent_id", "description" => "Ид каталога", "default" => 6));
     $parent_id = $this->getopt("parent_id");
     $uri = Request::detect_uri();
     $page_uri = explode('/', $uri);
     $GLOBALS['uri'] = $page_uri;
     $uri = isset($page_uri[1]) ? $page_uri[1] : '';
     $uri2 = isset($page_uri[2]) ? $page_uri[2] : '';
     $model_tree = new Model_Widgets_Menu('tree');
     $items = $model_tree->menuItems($parent_id, 3);
     $model = array("items" => array());
     foreach ($items as $item) {
         $item_model = array("href" => "/" . Arr::get($item, "parent") . "/" . $item["url"], "name" => $item["name"]);
         if ($item["url"] == $uri2) {
             $item_model["active"] = " class='active'";
         }
         $model["items"][] = $item_model;
     }
     $this->set_template("widgets/menu/sidebar.php", "twig")->render($model)->body();
 }