Exemplo n.º 1
0
 function actionEditUser()
 {
     if (isset($_GET['userLogin'])) {
         // get the asked profile
         $userLogic = new UsersLogic();
         $user = $userLogic->retrieveUserByLogin($_GET['userLogin']);
         $groupsLogic = new GroupsLogic();
         $groups = $groupsLogic->listSelectGroups();
         if ($user != null) {
             // Create the addForum form
             $form = new YDForm('editForm');
             $form->addElement('textarea', 'userDescription', t('admin.desc'), array("cols" => 50, "rows" => 8));
             $form->addElement('select', 'userGroup', t('admin.usergroups'), array("width" => 60), $groups);
             $form->addElement('hidden', 'iduser', $user->id);
             $form->addElement('submit', 'cmdSubmit', t('admin.saveupdates'));
             // Process the form
             if ($form->validate()) {
                 // update
                 $user->description = $form->getValue('userDescription');
                 $user->groupid = $form->getValue('userGroup');
                 $user->update();
                 $this->forward('manageUsers');
                 return;
             }
             $form->setDefaults(array('userGroup' => $user->groupid));
             $form->setDefaults(array('userDescription' => $user->description));
             // Assign variables to the template
             $this->actionTpl->assign('form', $form->toArray());
             $this->actionTpl->assign('user', $user);
             $this->actionTpl->assign('userfound', true);
             $title = 'Profil de ' . $user->login;
         } else {
             $this->actionTpl->assign('userfound', false);
             $title = 'Utilisateur inconnu';
         }
         $content = new page($this->actionTpl->fetch('templates/admin.user.edit.tpl'), $title, $this->menusAdmin);
         // Display the action template into the master template
         $this->display($content);
     } else {
         $this->errorRequete();
         return;
     }
 }
Exemplo n.º 2
0
 function actionViewProfil()
 {
     if (isset($_GET['userLogin'])) {
         // load user's profile
         $userLogic = new UsersLogic();
         $user = $userLogic->retrieveUserByLogin($_GET['userLogin']);
         if ($user != null) {
             // Assign variables to the template
             $this->actionTpl->assign('user', $user);
             $this->actionTpl->assign('userfound', true);
             $title = 'Profil de ' . $user->login;
         } else {
             $this->actionTpl->assign('userfound', false);
             $title = 'Utilisateur inconnu';
         }
         $content = new page($this->actionTpl->fetch('templates/user.viewprofile.tpl'), $title);
         // Display the action template into the master template
         $this->display($content);
     } else {
         $this->errorRequete();
         return;
     }
 }