示例#1
0
 public function convertSingleToArray($user)
 {
     $array = array();
     $array['userName'] = $user->getUserName();
     $array['id'] = $user->getId();
     $array['password'] = $user->getPassword();
     $array['fullName'] = $user->getFullName();
     $array['type'] = Utility::getUserRole($user->getType());
     return $array;
 }
示例#2
0
 public function indexAction()
 {
     //config table
     /////column for table
     $menuTableColumn = $columns = array(array('title' => 'Id', 'db' => 'id', 'dt' => 0, 'search' => true, 'type' => 'number'), array('title' => 'Name', 'db' => 'userName', 'dt' => 1, 'search' => true, 'type' => 'text'), array('title' => 'Full name', 'db' => 'fullName', 'dt' => 2, 'search' => true, 'type' => 'number'), array('title' => 'User Type', 'db' => 'type', 'dt' => 3, 'search' => true, 'type' => 'number', 'dataSelect' => Utility::getUserRole()), array('title' => 'Action', 'db' => 'id', 'dt' => 4, 'search' => false, 'type' => 'number', 'formatter' => function ($d, $row) {
         $actionUrl = '/admin/users';
         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($menuTableColumn, 'admin/users');
     $table->setTablePrefix('u');
     $table->setExtendSQl(array(array('AND', 'u.isdelete', '=', '0')));
     $table->setAjaxCall('/admin/users');
     $table->setActionLink('admin/users');
     $table->setActionDeleteAll('deleteall');
     $this->tableAjaxRequest($table, $columns, $this->modelUsers);
     //end config table
     return new ViewModel(array('table' => $table, 'title' => $this->translator->translate('Users Manage')));
 }