Beispiel #1
0
 public function setMemberStatus($members, $status, $next_status, $direction)
 {
     $msgs = array();
     $query = 'UPDATE seminar_user SET status = ?, position = ? WHERE Seminar_id = ? AND user_id = ? AND status = ?';
     $pleasure_statement = DBManager::get()->prepare($query);
     foreach ($members as $user_id) {
         $temp_user = User::find($user_id);
         if ($next_status == 'tutor' && !$GLOBALS['perm']->have_perm('tutor', $user_id)) {
             $msgs['no_tutor'][$user_id] = $temp_user->getFullName();
         } else {
             if ($temp_user) {
                 // get the next position of the user
                 switch ($next_status) {
                     case 'user':
                         // get the current position of the user
                         $next_pos = $this->getPosition($user_id);
                         break;
                     case 'autor':
                         // get the current position of the user
                         $next_pos = $this->getPosition($user_id);
                         break;
                         // set the status to tutor
                     // set the status to tutor
                     case 'tutor':
                         // get the next position of the user
                         $next_pos = get_next_position($next_status, $this->course_id);
                         // resort the tutors
                         re_sort_tutoren($this->course_id, $this->getPosition($user_id));
                         break;
                 }
                 log_event('SEM_CHANGED_RIGHTS', $this->course_id, $user_id, $next_status, $this->getLogLevel($direction, $next_status));
                 if (is_null($next_pos)) {
                     $next_pos = 0;
                 }
                 $pleasure_statement->execute(array($next_status, $next_pos, $this->course_id, $user_id, $status));
                 if ($pleasure_statement->rowCount()) {
                     if ($next_status == 'autor') {
                         re_sort_tutoren($this->course_id, $next_pos);
                     }
                     $msgs['success'][$user_id] = $temp_user->getFullName();
                 }
             }
         }
     }
     if (!empty($msgs)) {
         return $msgs;
     } else {
         return false;
     }
 }
Beispiel #2
0
 function re_sort_position_in_seminar_user()
 {
     $query = "SELECT Seminar_id, position, status\n                  FROM seminar_user\n                  WHERE user_id = ? AND status IN ('tutor', 'dozent')";
     $statement = DBManager::get()->prepare($query);
     $statement->execute(array($this->user_data['auth_user_md5.user_id']));
     while ($row = $statement->fetch(PDO::FETCH_ASSOC)) {
         if ($row['status'] == 'tutor') {
             re_sort_tutoren($row['Seminar_id'], $row['position']);
         } else {
             if ($row['status'] == 'dozent') {
                 re_sort_dozenten($row['Seminar_id'], $row['position']);
             }
         }
     }
 }