Example #1
0
 function createLeftMenu(&$output = '', $arrConditions = array(), $isChild = false, $model = 'modules_model')
 {
     // get the CI object
     $CI =& get_instance();
     if (!isset($arrConditions['parent']) && !isset($arrConditions['id'])) {
         $arrConditions['parent'] = 0;
     }
     $arrParents = $CI->{$model}->search($arrConditions);
     foreach ($arrParents as $parent) {
         $url = '';
         // Set url
         if ($model == 'categories_model') {
             $url = base_url('frontend/categories/' . $parent['id']);
         } else {
             $url = base_url($parent['url']);
         }
         $arrConditions['parent'] = $parent['id'];
         $cnt = $CI->{$model}->search($arrConditions, MODE_CNT);
         if (!$isChild) {
             $output .= '<ul>';
         }
         if ($cnt > 0) {
             if ($parent['parent'] == 0) {
                 $output .= '<li class="first"><a class="be-head" href="' . $url . '" >' . $parent['name'] . '</a><ul>';
             } else {
                 $output .= '<li><a href="' . $url . '" >' . $parent['name'] . '</a><ul>';
             }
             createLeftMenu($output, array('parent' => $parent['id'], 'status' => 1), true, $model);
             $output .= '</ul></li>';
         } else {
             $output .= '<li><a href="' . $url . '" >' . $parent['name'] . '</a></li>';
         }
         if (!$isChild) {
             $output .= '</ul>';
         }
     }
 }
Example #2
0
 /**
  * setFrontEnd
  * Set data common cho phía Front-end
  */
 private function setFrontEnd()
 {
     // Get top-menu
     $arrWheres = array('delete_flg' => 0, 'status' => 1, 'start' => 0, 'end' => 100);
     $this->arrCommon['top_nav'] = $this->menus_model->search($arrWheres);
     // Get category
     $arrCategoryWheres = array('delete_flg' => 0, 'status' => 1);
     $htmlCategory = '';
     createLeftMenu($htmlCategory, $arrCategoryWheres, false, 'categories_model');
     $this->arrCommon['categories'] = $htmlCategory;
     // Get category
     $arrBrandsWheres = array('delete_flg' => 0, 'status' => 1, 'start' => 0, 'end' => 100);
     $this->arrCommon['brands'] = $this->brands_model->search($arrWheres);
     // Get settings
     $this->arrCommon['settings'] = $this->settings_model->getOne();
 }
Example #3
0
 /**
  * leftMenu
  */
 private function leftMenu()
 {
     $leftMenu = '';
     createLeftMenu($leftMenu);
     $this->arrCommon['left_menu'] = $leftMenu;
 }