/**
  * User detail page: edit/delete functionality.
  *
  * Also will include permissions, packages, groups etc.
  *
  * It is the central place for a user object.
  */
 public function userDetailAction()
 {
     $userId = $this->_request->getParam('id');
     $user = new Object_User($userId);
     $userId = $user->getId();
     if (empty($userId)) {
         // No user defined, redirec to list users.
         $this->_redirect('/admin/client/user');
         return false;
     }
     $form = new Form_Admin_Client_User_Create(false, array('user' => $user));
     // Check for user update
     if ($this->_request->isPost()) {
         $params = $this->_request->getPost();
         if ($form->isValid($params)) {
             // Update user if necessary
             $form->updateUser($user);
             $form->setUser($user);
         } else {
             $form->populate($params);
         }
     }
     $emailSignatureId = Repo_UserEmailSignature::getInstance()->getIdByUserId($userId);
     $this->view->userEmailSignature = new Object_UserEmailSignature($emailSignatureId);
     $this->view->emailSignatureId = $emailSignatureId;
     $this->view->user = $user;
     $this->view->client = new Object_Client($user->client_id);
     $this->view->form = $form;
     $this->view->userPackages = Repo_UserPackage::getInstance()->getUserPackages($userId);
     $this->view->userTeams = Repo_TeamUser::getInstance()->getUserTeams($userId);
     $this->view->userApps = Repo_AppUser::getInstance()->getUserApps($userId);
     $this->view->userDeviceIds = Repo_UserDevice::getInstance()->getUserDeviceIds($userId);
 }
Esempio n. 2
0
 /**
  * Get all the titles a user is entitled, including package, team package, individual titles.
  *
  */
 public function getAllTitles()
 {
     $allPackages = array();
     $packages = Repo_UserPackage::getInstance()->getUserPackages($this->getId());
     foreach ($packages as $_package) {
         if (!isset($allPackages[$_package->id])) {
             $allPackages[$_package->id] = $_package;
         }
     }
     $teams = Repo_TeamUser::getInstance()->getUserTeams($this->getId());
     foreach ($teams as $_team) {
         $_teamId = $_team->id;
         $_packages = Repo_TeamPackage::getInstance()->getTeamPackages($_teamId);
         foreach ($_packages as $_package) {
             if (!isset($allPackages[$_package->id])) {
                 $allPackages[$_package->id] = $_package;
             }
         }
     }
     // OK get the titles for each package
     $allTitles = array();
     foreach ($allPackages as $_packageId => $_package) {
         $_titles = Repo_PackageTitle::getInstance()->getPackageTitles($_packageId);
         foreach ($_titles as $_title) {
             if (!isset($allTitles[$_title->id])) {
                 $allTitles[$_title->id] = $_title;
             }
         }
     }
     return $allTitles;
 }