Example #1
0
 public function action_index($options = array("items_position_type" => "half"))
 {
     $model = array();
     Resources::add_scripts(array("js/classes/LexCookie.js", "js/modules/item_position/script.js"), get_class());
     Resources::add_styles(array("css/modules/item_position/default.less"), get_class());
     $this->setopt(array("name" => "items_position_type", "description" => "Способ отображения item'ов", "default" => $options["items_position_type"]));
     $model["items_position_type"] = Arr::get($_COOKIE, "items_position_type", $this->getopt("items_position_type"));
     $this->set_template("/widgets/w_item_position.php", "twig")->render($model)->body();
 }
Example #2
0
 public function action_index($options = array())
 {
     Resources::add_scripts(array("js/classes/LexComments.js", "js/modules/comments/comments.js"), get_class());
     Resources::add_styles(array("css/modules/comments/default.less"), get_class());
     $model = array();
     $model["captcha"] = Captcha::instance()->render();
     $model["comments"] = array();
     $model["comments"][] = array("name" => "lexa4ok", "comment" => "test1");
     $model["comments"][] = array("name" => "lexa4ok2", "comment" => "test2");
     $this->set_template("/widgets/comments/default.php", "twig")->render($model)->body();
 }
Example #3
0
 public function action_general_dropdown()
 {
     $this->setopt(array("name" => "parent_id", "description" => "Ид каталога", "default" => 4));
     $parent_id = $this->getopt("parent_id");
     $model = array("modules" => array(), "visible" => array(), "menu" => array());
     Resources::add_scripts(array("js/test.js"), get_class());
     Resources::add_styles(array("css/test.less"), get_class());
     $model["modules"]["cart_widget"] = Request::factory('widgets/cart/index')->execute();
     //$model["modules"]["cart"] = Request::factory('widgets/cart/index')->execute();
     $model["visible"]["auth_but"] = false;
     $model["visible"]["registration_but"] = false;
     $create_dropdown = true;
     // Создавать выпадающее меню?
     $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 = array();
     $items[] = array("id" => 0, "level" => 2, "name" => "Главная", "url" => "");
     //Получаем список меню
     $items = array_merge($items, $model_tree->menuItems($parent_id, 2));
     foreach ($items as $key => $mitem) {
         // Добавление пунктов основного меню
         if ($mitem['level'] == 2) {
             $mitem_data = array("href" => '/' . $mitem['url'], "id" => $mitem['id'], "name" => $mitem['name']);
             if ($mitem['url'] == $uri) {
                 $mitem_data["selected"] = " selected";
             }
             // Создавать выпадающее меню?
             if ($create_dropdown) {
                 // Есть дополнительные пункты
                 if (isset($mitem['left_key']) && isset($mitem['right_key'])) {
                     if ($mitem['left_key'] + 1 !== $mitem['right_key']) {
                         $dropdown_items = array();
                         $submenu = $model_tree->menuItems($mitem["id"], 3);
                         foreach ($submenu as $dropdown_item) {
                             $dropdown_items[] = array("href" => '/' . $dropdown_item['parent'] . '/' . $dropdown_item['url'], "name" => $dropdown_item['name'], "id" => $mitem["id"]);
                         }
                         if (count($submenu) !== 0) {
                             $mitem_data["dropdown"] = $dropdown_items;
                         }
                     }
                 }
             }
             $model["menu"][] = $mitem_data;
         }
     }
     $this->set_template("widgets/menu/general_dropdown.php", "twig")->render($model)->body();
 }
Example #4
0
 public function action_index()
 {
     $model = array();
     $counter = 0;
     if (isset($_COOKIE["order_id"])) {
         $orders = new Model_Orders();
         $order_data = $orders->getOrder($_COOKIE["order_id"]);
         if (isset($order_data['items'])) {
             foreach ($order_data['items'] as $item_id => $item) {
                 $counter += $item['cnt'];
             }
         }
         $model['items_count'] = $counter;
     } else {
         $model['items_count'] = 0;
     }
     Resources::add_scripts(array("js/classes/LexFormValidator.js", "js/classes/helpers.js", "js/classes/LexCookie.js", "js/classes/LexCart.js", "js/modules/cart/cart.js"), get_class());
     Resources::add_styles(array("css/modules/cart/default.less"), get_class());
     return $this->set_template('widgets/cart/button.php')->render($model)->body();
 }