Beispiel #1
0
 public static function getProjectTeamAssigned($projectId)
 {
     $db = Zend_Db_Table::getDefaultAdapter();
     $sql = null;
     $data = null;
     if (ProNav_Auth::isEmployee()) {
         $sql = "select u.user_id, u.firstname, u.lastname, c.name AS corporation_name, c.corporation_id\n            FROM users u\n            INNER JOIN corporations c ON c.corporation_id = u.corporation_id\n            INNER JOIN project_users pu ON pu.user_id = u.user_id\n            WHERE pu.project_id = ?;";
         $data = $db->fetchAll($sql, $projectId);
     } else {
         /* Only get users from the projects done_for_workgroup (department) */
         $sql = "SELECT u.user_id, u.firstname, u.lastname, c.name AS corporation_name, c.corporation_id \n            FROM users u\n            INNER JOIN corporations c ON u.corporation_id = c.corporation_id \n            WHERE user_id IN (\n            SELECT wu.user_id FROM workgroup_users wu\n            INNER JOIN projects p ON p.done_for_workgroup = wu.workgroup_id\n            INNER JOIN (select * from project_users where project_id = ?) pu ON pu.user_id = wu.user_id\n            WHERE p.project_id = ?)";
         $data = $db->fetchAll($sql, array($projectId, $projectId));
     }
     $users = array();
     if (!$data) {
         return $users;
     }
     foreach ($data as $row) {
         $user = new Application_Model_User();
         foreach ($row as $key => $value) {
             $user->{$key} = $value;
         }
         $corp = new Application_Model_Corporation();
         $corp->name = $user->corporation_name;
         $corp->corporation_id = $user->corporation_id;
         $user->Corporation = $corp;
         $users[] = $user;
     }
     return $users;
 }
 private function getUsersForCorp($corporation_id)
 {
     $users = Application_Model_Corporations::GetUsers($corporation_id);
     return ProNav_Utils::getSelectOptions($users, 'user_id', 'LFMI', ProNav_Auth::isEmployee() ? null : ProNav_Auth::getUserID());
 }