| @@ 494-514 (lines=21) @@ | ||
| 491 | * @param string Course id value |
|
| 492 | * @return array Returns an array with elements of the form ('course_desc_id' => 1, 'course_desc_title' => 'Title', 'course_desc_content' => 'Content') |
|
| 493 | */ |
|
| 494 | public function GetCourseDescriptions($secret_key, $course_id_field_name, $course_id_value) { |
|
| 495 | $verifKey = $this->verifyKey($secret_key); |
|
| 496 | if ($verifKey instanceof WSError) { |
|
| 497 | $this->handleError($verifKey); |
|
| 498 | } else { |
|
| 499 | $course_id = $this->getCourseId($course_id_field_name, $course_id_value); |
|
| 500 | if ($course_id instanceof WSError) { |
|
| 501 | return $course_id; |
|
| 502 | } else { |
|
| 503 | // Course exists, get its descriptions |
|
| 504 | $descriptions = CourseDescription::get_descriptions($course_id); |
|
| 505 | $results = array(); |
|
| 506 | foreach ($descriptions as $description) { |
|
| 507 | $results[] = array('course_desc_id' => $description->get_description_type(), |
|
| 508 | 'course_desc_title' => $description->get_title(), |
|
| 509 | 'course_desc_content' => $description->get_content()); |
|
| 510 | } |
|
| 511 | return $results; |
|
| 512 | } |
|
| 513 | } |
|
| 514 | } |
|
| 515 | ||
| 516 | ||
| 517 | /** |
|
| @@ 630-650 (lines=21) @@ | ||
| 627 | * @param string Course id value |
|
| 628 | * @return array Returns an array with elements of the form ('course_desc_id' => 1, 'course_desc_title' => 'Title', 'course_desc_content' => 'Content') |
|
| 629 | */ |
|
| 630 | public function GetCourseDescriptions( |
|
| 631 | $secret_key, |
|
| 632 | $course_id_field_name, |
|
| 633 | $course_id_value |
|
| 634 | ) { |
|
| 635 | $verifKey = $this->verifyKey($secret_key); |
|
| 636 | if ($verifKey instanceof WSError) { |
|
| 637 | $this->handleError($verifKey); |
|
| 638 | } else { |
|
| 639 | $course_id = $this->getCourseId( |
|
| 640 | $course_id_field_name, |
|
| 641 | $course_id_value |
|
| 642 | ); |
|
| 643 | if ($course_id instanceof WSError) { |
|
| 644 | return $course_id; |
|
| 645 | } else { |
|
| 646 | // Course exists, get its descriptions |
|
| 647 | $descriptions = CourseDescription::get_descriptions($course_id); |
|
| 648 | $results = array(); |
|
| 649 | foreach ($descriptions as $description) { |
|
| 650 | $results[] = array( |
|
| 651 | 'course_desc_id' => $description->get_description_type( |
|
| 652 | ), |
|
| 653 | 'course_desc_title' => $description->get_title(), |
|