public function index()
 {
     if ($match = Uri::match('\\/jsonCategory')) {
         $keyword = String::encode(Request::get('keyword', ''));
         $loadData = Categories::get(array('where' => "where title LIKE '%{$keyword}%'", 'orderby' => 'order by title asc'));
         $total = count($loadData);
         $li = '';
         for ($i = 0; $i < $total; $i++) {
             $li .= '<li><span data-method="category" data-id="' . $loadData[$i]['catid'] . '" >' . $loadData[$i]['title'] . '</span></li>';
         }
         echo $li;
         die;
     }
     $post = array('alert' => '');
     Model::load('admincp/categories');
     $curPage = 0;
     if ($match = Uri::match('\\/page\\/(\\d+)')) {
         $curPage = $match[1];
     }
     if (Request::has('btnAction')) {
         actionProcess();
     }
     if (Request::has('btnAdd')) {
         try {
             insertProcess();
             $post['alert'] = '<div class="alert alert-success">Add new category success.</div>';
         } catch (Exception $e) {
             $post['alert'] = '<div class="alert alert-warning">' . $e->getMessage() . '</div>';
         }
     }
     if (Request::has('btnSave')) {
         $match = Uri::match('\\/edit\\/(\\d+)');
         try {
             updateProcess($match[1]);
             $post['alert'] = '<div class="alert alert-success">Update category success.</div>';
         } catch (Exception $e) {
             $post['alert'] = '<div class="alert alert-warning">' . $e->getMessage() . '</div>';
         }
     }
     if (Request::has('btnSearch')) {
         filterProcess();
     } else {
         $post['pages'] = Misc::genSmallPage('admincp/categories', $curPage);
         $post['theList'] = Categories::get(array('limitShow' => 20, 'limitPage' => $curPage, 'orderby' => 'order by catid desc', 'cache' => 'no'));
     }
     if ($match = Uri::match('\\/edit\\/(\\d+)')) {
         $loadData = Categories::get(array('where' => "where catid='" . $match[1] . "'", 'cache' => 'no'));
         $post['edit'] = $loadData[0];
     }
     System::setTitle('Categories list - ' . ADMINCP_TITLE);
     View::make('admincp/head');
     self::makeContents('categoriesList', $post);
     View::make('admincp/footer');
 }
Ejemplo n.º 2
0
 public function index()
 {
     $post = array('alert' => '');
     Model::load('admincp/taxrate');
     $curPage = 0;
     if ($match = Uri::match('\\/page\\/(\\d+)')) {
         $curPage = $match[1];
     }
     if (Request::has('btnAction')) {
         actionProcess();
     }
     if (Request::has('btnAdd')) {
         try {
             insertProcess();
             $post['alert'] = '<div class="alert alert-success">Add new category success.</div>';
         } catch (Exception $e) {
             $post['alert'] = '<div class="alert alert-warning">' . $e->getMessage() . '</div>';
         }
     }
     if (Request::has('btnSave')) {
         $match = Uri::match('\\/edit\\/(\\d+)');
         try {
             updateProcess($match[1]);
             $post['alert'] = '<div class="alert alert-success">Update category success.</div>';
         } catch (Exception $e) {
             $post['alert'] = '<div class="alert alert-warning">' . $e->getMessage() . '</div>';
         }
     }
     if (Request::has('btnSearch')) {
         filterProcess();
     } else {
         $post['pages'] = Misc::genPage('admincp/taxrate', $curPage);
         $post['theList'] = Taxrates::get(array('limitShow' => 20, 'limitPage' => $curPage, 'orderby' => 'order by taxid desc', 'cacheTime' => 1));
     }
     if ($match = Uri::match('\\/edit\\/(\\d+)')) {
         $loadData = Taxrates::get(array('where' => "where taxid='" . $match[1] . "'"));
         $post['edit'] = $loadData[0];
         if (strlen($loadData[0]['country_short']) > 0) {
             $post['edit']['countries'] = explode(',', $loadData[0]['country_short']);
         }
         // print_r($post['countries']);die();
     }
     $post['listCountries'] = Country::get();
     System::setTitle('Taxrate list - ' . ADMINCP_TITLE);
     View::make('admincp/head');
     self::makeContents('taxrateList', $post);
     View::make('admincp/footer');
 }
Ejemplo n.º 3
0
 public function addnew()
 {
     $post = array('alert' => '');
     if (Request::has('btnAdd')) {
         try {
             insertProcess();
             $post['alert'] = '<div class="alert alert-success">Add new page success.</div>';
         } catch (Exception $e) {
             $post['alert'] = '<div class="alert alert-warning">' . $e->getMessage() . '</div>';
         }
     }
     System::setTitle('Add new page - ' . ADMINCP_TITLE);
     View::make('admincp/head');
     self::makeContents('pagesAdd', $post);
     View::make('admincp/footer');
 }
Ejemplo n.º 4
0
 public function addnew()
 {
     $post = array('alert' => '');
     if (Request::has('btnAdd')) {
         try {
             insertProcess();
             $post['alert'] = '<div class="alert alert-success">Add new user success.</div>';
         } catch (Exception $e) {
             $post['alert'] = '<div class="alert alert-warning">' . $e->getMessage() . '</div>';
         }
     }
     $post['listGroups'] = UserGroups::get(array('orderby' => 'order by group_title asc'));
     System::setTitle('Add new User - ' . ADMINCP_TITLE);
     View::make('admincp/head');
     self::makeContents('userAdd', $post);
     View::make('admincp/footer');
 }
Ejemplo n.º 5
0
 public function index()
 {
     $post = array('alert' => '');
     Model::load('admincp/links');
     $curPage = 0;
     if ($match = Uri::match('\\/page\\/(\\d+)')) {
         $curPage = $match[1];
     }
     if (Request::has('btnAction')) {
         actionProcess();
     }
     if (Request::has('btnAdd')) {
         try {
             insertProcess();
             $post['alert'] = '<div class="alert alert-success">Add new link success.</div>';
         } catch (Exception $e) {
             $post['alert'] = '<div class="alert alert-warning">' . $e->getMessage() . '</div>';
         }
     }
     if (Request::has('btnSave')) {
         $match = Uri::match('\\/edit\\/(\\d+)');
         try {
             updateProcess($match[1]);
             $post['alert'] = '<div class="alert alert-success">Update link success.</div>';
         } catch (Exception $e) {
             $post['alert'] = '<div class="alert alert-warning">' . $e->getMessage() . '</div>';
         }
     }
     if (Request::has('btnSearch')) {
         filterProcess();
     } else {
         $post['pages'] = Misc::genSmallPage('admincp/links', $curPage);
         $post['theList'] = Links::get(array('limitShow' => 20, 'limitPage' => $curPage, 'orderby' => 'order by sort_order asc', 'cache' => 'no'));
     }
     if ($match = Uri::match('\\/edit\\/(\\d+)')) {
         $loadData = Links::get(array('where' => "where id='" . $match[1] . "'", 'cache' => 'no'));
         $post['edit'] = $loadData[0];
     }
     $post['listLinks'] = Links::get(array('orderby' => 'order by sort_order asc', 'cache' => 'no'));
     System::setTitle('Links list - ' . ADMINCP_TITLE);
     View::make('admincp/head');
     self::makeContents('linksList', $post);
     View::make('admincp/footer');
 }