예제 #1
0
 public function initialize()
 {
     $this->add(new Text("firstname"));
     $lastname = new Text("lastname");
     $this->add($lastname);
     $username = new Text("username");
     $username->setFilters(array('striptags', 'string'));
     $username->addValidators(array(new PresenceOf()));
     $this->add($username);
     // password
     $password = new Password('password');
     $password->addValidator(new PresenceOf(array('message' => 'password')));
     $this->add($password);
     $this->add(new Text("avatar"));
     $email = new Text("email");
     $email->addValidators(array(new PresenceOf(), new Email()));
     $this->add($email);
     $this->add(new Select('gender', array('0' => 'Nữ', '1' => 'Nam')));
     $this->add(new Text("birthday"));
     $this->add(new Text("address"));
     $this->add(new Text("phone"));
     $this->add(new Select('gender', array('0' => 'Không', '1' => 'Có')));
     $this->add(new Select('status', array('0' => 'Không', '1' => 'Có'), array('class' => 'medium')));
     $department_id = new Select('department_id', \Modules\Backend\Models\Member_department::find(), array('using' => array('id', 'name'), 'class' => 'medium'));
     $this->add($department_id);
     $group_id = new Select('group_id', \Modules\Backend\Models\Permission_group::find(), array('using' => array('id', 'name'), 'class' => 'medium'));
     $this->add($group_id);
 }
예제 #2
0
 /**  
  * Hàm lấy thông tin nhóm nhóm quyềnh
  */
 private function getInfoPermission()
 {
     $auth = new Auth();
     $identity = $auth->getIdentity();
     if ($identity != null) {
         $conditions = "id = :id: AND status = 1";
         // lấy thông tin group
         $group = \Modules\Backend\Models\Permission_group::findFirst(array("conditions" => $conditions, "bind" => array("id" => $identity['group_id'])));
         if (!$group) {
             return false;
         }
         $conditions = "group_id = :group_id: AND status = 1";
         $group_privilege = \Modules\Backend\Models\Permission_group_privilege::find(array("conditions" => $conditions, "bind" => array("group_id" => $group->id)));
         if (count($group_privilege) <= 0) {
             return false;
         }
         return $group_privilege;
     }
     return false;
 }
 public function getDetailGroup($id)
 {
     return $group = \Modules\Backend\Models\Permission_group::findFirst(array("conditions" => "id = ?1", "bind" => array(1 => $id), "columns" => "id,name"));
 }