public function indexAction()
 {
     //config table
     /////column for table
     $columns = array(array('title' => 'Id', 'db' => 'id', 'dt' => 0, 'search' => false, 'type' => 'number'), array('title' => 'Name', 'db' => 'name', 'dt' => 1, 'search' => true, 'type' => 'text'), array('title' => 'Category', 'db' => 'catId', 'dt' => 2, 'search' => false, 'type' => 'number', 'dataSelect' => Utility::getCategoryForSelect()), array('title' => 'Cost', 'db' => 'cost', 'dt' => 3, 'search' => false, 'type' => 'number', 'formatter' => function ($d, $row) {
         return Utility::formatCost($d);
     }), array('title' => 'Take Away Cost', 'db' => 'taCost', 'dt' => 4, 'search' => false, 'type' => 'number', 'formatter' => function ($d, $row) {
         return Utility::formatCost($d);
     }), array('title' => 'Action', 'db' => 'id', 'dt' => 5, 'search' => false, 'type' => 'number', 'formatter' => function ($d, $row) {
         $actionUrl = '/admin/index';
         return '
                     <a class="btn-xs action action-detail btn btn-success btn-default" href="' . $actionUrl . '/add/' . $d . '"><i class="icon-edit"></i></a>
                     <a data-id="' . $d . '" id="' . $d . '" data-link="' . $actionUrl . '" class="btn-xs action action-detail btn btn-danger  btn-delete " href="javascript:void(0)"><i class="icon-remove"></i></a>
                 ';
     }));
     /////end column for table
     $table = new AjaxTable($columns, array(), 'admin/index');
     $table->setTablePrefix('m');
     $table->setExtendSQl(array(array('AND', 'm.isdelete', '=', '0')));
     $table->setAjaxCall('/admin/index');
     $table->setActionDeleteAll('deleteall');
     $this->tableAjaxRequest($table, $columns, $this->modelMenu);
     //end config table
     return new ViewModel(array('table' => $table, 'title' => $this->translator->translate('Manage Menu')));
 }
Example #2
0
 public function indexAction()
 {
     $columns = array(array('title' => 'Id', 'db' => 'id', 'dt' => 0, 'search' => false, 'type' => 'number'), array('title' => 'Name', 'db' => 'name', 'dt' => 1, 'search' => true, 'type' => 'text'), array('title' => 'Category', 'db' => 'catId', 'dt' => 2, 'search' => false, 'type' => 'number', 'dataSelect' => Utility::getCategoryForSelect()), array('title' => 'Cost', 'db' => 'cost', 'dt' => 3, 'search' => false, 'type' => 'number'), array('title' => 'Take Away cost', 'db' => 'taCost', 'dt' => 4, 'search' => false, 'type' => 'number'));
     /////end column for table
     $table = new AjaxTable($columns, array(), 'frontend/com');
     $table->setTablePrefix('m');
     $table->setExtendSQl(array(array('AND', 'm.isdelete', '=', '0'), array('AND', 'm.isCombo', '=', '1')));
     $table->setAjaxCall('/frontend/com');
     $table->setActionDeleteAll('deleteall');
     $this->tableAjaxRequest($table, $columns, $this->modelMenu);
     //end config table
     return new ViewModel(array('table' => $table, 'title' => array('title' => $this->translator->translate('Combo'))));
 }