Example #1
0
 public function GetWidgets()
 {
     $widget = new stdClass();
     //widgets
     $categories = new Category();
     //librerias con widgets
     $dropdown = array();
     // Dropdown
     $currency = new fpp_currency_Model();
     //ORM de las monedas
     $Translate = Translate::Instance();
     /****/
     $grp = "group_category";
     $array['category'] = $categories->metacategories;
     foreach ($array['category'] as $widgetname => $widgethtml) {
         $widget->category->{$widgetname} = $categories->GetListCategoriesByFilter($grp, $widgethtml);
     }
     foreach ($array['category'] as $widgetname => $widgethtml) {
         $widget->category->dropdown->{$widgetname} = $categories->GetDropdownCategoriesByFilter($grp, $widgethtml);
     }
     /* dropdown de monedas */
     $currency = $currency->db2cls();
     $currency_values = null;
     $currency_result = array();
     $c_result = $currency->select('id_currency', 'name_currency', 'value_currency', 'symbol_left_currency')->fetch_all();
     foreach ($c_result as $row) {
         $currency_result[$row->id_currency] = $row->name_currency;
     }
     foreach ($c_result as $row) {
         if ($row->value_currency != 1) {
             $vc = number_format(round($row->value_currency, 2), 2, '.', '');
             $_SESSION['conf']['dollar_value'] = $vc;
             $currency_values .= "<li>{$row->name_currency} : S/. {$vc}</li>";
         }
     }
     $widget->currency->dropdown = form::dropdown("currency", $currency_result, @$_SESSION['conf']['currency']);
     $widget->currency->values = $currency_values;
     /* Cart Widgets */
     $cart = new Cart();
     $widget->cart->item_quantity = $cart->getItemsQuantity();
     $widget->cart->href_of_cart = $cart->getHref();
     /* Client Widgets */
     $client = new Client();
     $widget->client->href_register = $client->GetHrefClientRegister();
     $widget->client->logout = $client->HtmlLogout();
     /*Searcher Form*/
     $widget->searcher->formurl = $Translate->getOriginal("search");
     return $widget;
 }