| @@ 77-97 (lines=21) @@ | ||
| 74 | * @return array Array with elements like array('course_id_value' => 'value', 'result' => array('code' => 0, 'message' => 'Operation was successful')). Note that if the result array contains a code different |
|
| 75 | * than 0, an error occured |
|
| 76 | */ |
|
| 77 | public function DeleteCourses($secret_key, $courses) |
|
| 78 | { |
|
| 79 | $verifKey = $this->verifyKey($secret_key); |
|
| 80 | if ($verifKey instanceof WSError) { |
|
| 81 | $this->handleError($verifKey); |
|
| 82 | } else { |
|
| 83 | $results = array(); |
|
| 84 | foreach ($courses as $course) { |
|
| 85 | $result_tmp = array(); |
|
| 86 | $result_op = $this->deleteCourseHelper($course['course_id_field_name'], $course['course_id_value']); |
|
| 87 | $result_tmp['course_id_value'] = $course['course_id_value']; |
|
| 88 | if ($result_op instanceof WSCMError) { |
|
| 89 | // Return the error in the results |
|
| 90 | $result_tmp['result'] = $result_op->toArray(); |
|
| 91 | } else { |
|
| 92 | $result_tmp['result'] = $this->getSuccessfulResult(); |
|
| 93 | } |
|
| 94 | $results[] = $result_tmp; |
|
| 95 | } |
|
| 96 | return $results; |
|
| 97 | } |
|
| 98 | } |
|
| 99 | ||
| 100 | /** |
|
| @@ 76-96 (lines=21) @@ | ||
| 73 | * @return array Array with elements like array('course_id_value' => 'value', 'result' => array('code' => 0, 'message' => 'Operation was successful')). Note that if the result array contains a code different |
|
| 74 | * than 0, an error occured |
|
| 75 | */ |
|
| 76 | public function DeleteCourses($secret_key, $courses) |
|
| 77 | { |
|
| 78 | $verifKey = $this->verifyKey($secret_key); |
|
| 79 | if ($verifKey instanceof WSError) { |
|
| 80 | $this->handleError($verifKey); |
|
| 81 | } else { |
|
| 82 | $results = array(); |
|
| 83 | foreach ($courses as $course) { |
|
| 84 | $result_tmp = array(); |
|
| 85 | $result_op = $this->deleteCourseHelper( |
|
| 86 | $course['course_id_field_name'], |
|
| 87 | $course['course_id_value'] |
|
| 88 | ); |
|
| 89 | $result_tmp['course_id_value'] = $course['course_id_value']; |
|
| 90 | if ($result_op instanceof WSError) { |
|
| 91 | // Return the error in the results |
|
| 92 | $result_tmp['result'] = $result_op->toArray(); |
|
| 93 | } else { |
|
| 94 | $result_tmp['result'] = $this->getSuccessfulResult(); |
|
| 95 | } |
|
| 96 | $results[] = $result_tmp; |
|
| 97 | } |
|
| 98 | ||
| 99 | return $results; |
|
| @@ 215-235 (lines=21) @@ | ||
| 212 | * @return array Array with elements like array('user_id_value' => 'value', 'result' => array('code' => 0, 'message' => 'Operation was successful')). Note that if the result array contains a code different |
|
| 213 | * than 0, an error occured |
|
| 214 | */ |
|
| 215 | public function DeleteUsers($secret_key, $users) |
|
| 216 | { |
|
| 217 | $verifKey = $this->verifyKey($secret_key); |
|
| 218 | if ($verifKey instanceof WSError) { |
|
| 219 | $this->handleError($verifKey); |
|
| 220 | } else { |
|
| 221 | $results = array(); |
|
| 222 | foreach ($users as $user) { |
|
| 223 | $result_tmp = array(); |
|
| 224 | $result_op = $this->deleteUserHelper( |
|
| 225 | $user['user_id_field_name'], |
|
| 226 | $user['user_id_value'] |
|
| 227 | ); |
|
| 228 | $result_tmp['user_id_value'] = $user['user_id_value']; |
|
| 229 | if ($result_op instanceof WSError) { |
|
| 230 | // Return the error in the results |
|
| 231 | $result_tmp['result'] = $result_op->toArray(); |
|
| 232 | } else { |
|
| 233 | $result_tmp['result'] = $this->getSuccessfulResult(); |
|
| 234 | } |
|
| 235 | $results[] = $result_tmp; |
|
| 236 | } |
|
| 237 | ||
| 238 | return $results; |
|