Пример #1
0
 /**
  * Returns a list of all the active users.
  *
  * Returns a list of all the users with:
  * <pre>
  *  - id      => id of user.
  *  - display => Display for the user.
  * </pre>
  *
  * The return is in JSON format.
  *
  * @return void
  */
 public function jsonGetUsersAction()
 {
     IndexController::setCurrentProjectId();
     $db = Phprojekt::getInstance()->getDb();
     $where = sprintf('status = %s', $db->quote('A'));
     $user = new Phprojekt_User_User();
     $records = $user->fetchAll($where);
     $data = array();
     foreach ($records as $node) {
         $data['data'][] = array('id' => $node->id, 'display' => $node->displayName);
     }
     Phprojekt_Converter_Json::echoConvert($data, Phprojekt_ModelInformation_Default::ORDERING_LIST);
 }
Пример #2
0
 /**
  * Returns a list of all the active users.
  *
  * Returns a list of all the users with:
  * <pre>
  *  - id      => id of user.
  *  - display => Display for the user.
  *  - current => True or false if is the current user.
  * </pre>
  *
  * The return is in JSON format.
  *
  * @return void
  */
 public function jsonGetUsersAction()
 {
     IndexController::setCurrentProjectId();
     $db = Phprojekt::getInstance()->getDb();
     $user = Phprojekt_Loader::getLibraryClass('Phprojekt_User_User');
     $records = $user->getAllowedUsers();
     $current = Phprojekt_Auth::getUserId();
     $data = array();
     foreach ($records as $record) {
         $data['data'][] = array('id' => (int) $record['id'], 'display' => $record['name'], 'current' => $current == $record['id']);
     }
     Phprojekt_Converter_Json::echoConvert($data, Phprojekt_ModelInformation_Default::ORDERING_LIST);
 }