Example #1
0
 /**
  * Method addSystem_user_group
  * Add a System_user_group to the System_user
  * @param $object Instance of System_group
  */
 public function addSystemUserGroup(SystemGroup $systemusergroup)
 {
     $object = new SystemUserGroup();
     $object->system_group_id = $systemusergroup->id;
     $object->system_user_id = $this->id;
     $object->store();
 }
Example #2
0
 public function __construct()
 {
     parent::__construct();
     $this->template = array();
     $this->templateFile = "usergroup.tpl";
     $this->basePath = realpath(dirname(__FILE__) . "/../") . "/";
     //add new view types
     $view = ViewManager::getInstance();
     $view->insert(self::VIEW_USER, 'Gebruikers');
 }
 /**
  * Store the object and its aggregates
  */
 public function store()
 {
     // store the object itself
     parent::store();
     // delete the related System_userSystem_user_group objects
     $criteria = new TCriteria();
     $criteria->add(new TFilter('system_user_id', '=', $this->id));
     $repository = new TRepository('SystemUserGroup');
     $repository->delete($criteria);
     // store the related System_userSystem_user_group objects
     if ($this->system_user_groups) {
         foreach ($this->system_user_groups as $system_user_group) {
             $system_user_system_user_group = new SystemUserGroup();
             $system_user_system_user_group->system_group_id = $system_user_group->id;
             $system_user_system_user_group->system_user_id = $this->id;
             $system_user_system_user_group->store();
         }
     }
     // delete the related System_userSystem_user_program objects
     $criteria = new TCriteria();
     $criteria->add(new TFilter('system_user_id', '=', $this->id));
     $repository = new TRepository('SystemUserProgram');
     $repository->delete($criteria);
     // store the related System_userSystem_user_program objects
     if ($this->system_user_programs) {
         foreach ($this->system_user_programs as $system_user_program) {
             $system_user_system_user_program = new SystemUserProgram();
             $system_user_system_user_program->system_program_id = $system_user_program->id;
             $system_user_system_user_program->system_user_id = $this->id;
             $system_user_system_user_program->store();
         }
     }
 }
Example #4
0
 private function handleEdit($template, $fields)
 {
     $view = ViewManager::getInstance();
     $request = Request::getInstance();
     $auth = Authentication::getInstance();
     if ($auth->isRole(SystemUser::ROLE_ADMIN)) {
         $group = new SystemUserGroup();
         $groupList = $group->getList();
         $template->setVariable('groupList', $groupList, false);
         $acl = new Acl();
         $template->setVariable('rightsList', $acl->getRightsList(), false);
     }
     if (array_key_exists('hide', $fields)) {
         $template->setVariable('cbo_hide', Utils::getHtmlCombo($this->getHideList(), $fields['hide'], '...'));
     }
     $url = new Url(true);
     $url->setParameter($view->getUrlId(), ViewManager::ADMIN_OVERVIEW);
     $url->setParameter('id', $view->getType() == ViewManager::ADMIN_NEW ? $request->getValue('parent') : $request->getValue('id'));
     $template->setVariable('href_back', $url->getUrl(true), false);
     $datefields = array();
     $datefields[] = array('dateField' => 'online', 'triggerElement' => 'online');
     $datefields[] = array('dateField' => 'offline', 'triggerElement' => 'offline');
     Utils::getDatePicker($this->director->theme, $datefields);
 }