Example #1
0
 public function view()
 {
     $id = $this->_data['id'];
     global $smarty;
     $this->view->set('clickaction', 'viewuser');
     $collection = new HasRoleCollection($this->_templateobject);
     $sh = new SearchHandler($collection);
     $sh->extract();
     $sh->addConstraint(new Constraint('roleid', '=', $id));
     $collection->load($sh);
     $this->view->set(strtolower($collection->getModelName()) . 's', $collection);
     $this->view->set('num_pages', $collection->num_pages);
     $this->view->set('cur_page', $collection->cur_page);
 }
Example #2
0
 public function getRoles($role_ids = null)
 {
     $userroles = new HasRoleCollection();
     $sh = new SearchHandler($userroles, false, false);
     $sh->addConstraint(new Constraint('username', '=', $this->username));
     if (!empty($role_ids)) {
         if (!is_array($role_ids)) {
             $role_ids = array($role_ids);
         }
         $sh->addConstraint(new Constraint('roleid', 'in', '(' . implode(',', $role_ids) . ')'));
     }
     $userroles->load($sh);
     return $userroles;
 }