| @@ 180-191 (lines=12) @@ | ||
| 177 | /** |
|
| 178 | * Gets the number of question of category id=in_id |
|
| 179 | */ |
|
| 180 | public function getCategoryQuestionsNumber() |
|
| 181 | { |
|
| 182 | $table = Database::get_course_table(TABLE_QUIZ_QUESTION_REL_CATEGORY); |
|
| 183 | $id = intval($this->id); |
|
| 184 | $sql = "SELECT count(*) AS nb |
|
| 185 | FROM $table |
|
| 186 | WHERE category_id = $id AND c_id=".api_get_course_int_id(); |
|
| 187 | $res = Database::query($sql); |
|
| 188 | $row = Database::fetch_array($res); |
|
| 189 | ||
| 190 | return $row['nb']; |
|
| 191 | } |
|
| 192 | ||
| 193 | /** |
|
| 194 | * Return an array of all Category objects in the database |
|
| @@ 66-74 (lines=9) @@ | ||
| 63 | /** |
|
| 64 | * @return array |
|
| 65 | */ |
|
| 66 | public static function get_groups($courseId = null) |
|
| 67 | { |
|
| 68 | $table_group = Database::get_course_table(TABLE_GROUP); |
|
| 69 | $courseId = !empty($courseId) ? (int) $courseId : api_get_course_int_id(); |
|
| 70 | ||
| 71 | $sql = "SELECT * FROM $table_group WHERE c_id = $courseId "; |
|
| 72 | $result = Database::query($sql); |
|
| 73 | return Database::store_result($result, 'ASSOC'); |
|
| 74 | } |
|
| 75 | ||
| 76 | /** |
|
| 77 | * Get list of groups for current course. |
|
| @@ 643-654 (lines=12) @@ | ||
| 640 | * Get the total number of groups for the current course. |
|
| 641 | * @return int The number of groups for the current course. |
|
| 642 | */ |
|
| 643 | public static function get_number_of_groups() |
|
| 644 | { |
|
| 645 | $course_id = api_get_course_int_id(); |
|
| 646 | $table_group = Database::get_course_table(TABLE_GROUP); |
|
| 647 | $sql = "SELECT COUNT(id) AS number_of_groups |
|
| 648 | FROM $table_group |
|
| 649 | WHERE c_id = $course_id "; |
|
| 650 | $res = Database::query($sql); |
|
| 651 | $obj = Database::fetch_object($res); |
|
| 652 | ||
| 653 | return $obj->number_of_groups; |
|
| 654 | } |
|
| 655 | ||
| 656 | /** |
|
| 657 | * Get all categories |
|
| @@ 2132-2141 (lines=10) @@ | ||
| 2129 | * Get the document id of the directory certificate |
|
| 2130 | * @return int The document id of the directory certificate |
|
| 2131 | */ |
|
| 2132 | public static function get_document_id_of_directory_certificate() |
|
| 2133 | { |
|
| 2134 | $tbl_document = Database::get_course_table(TABLE_DOCUMENT); |
|
| 2135 | $course_id = api_get_course_int_id(); |
|
| 2136 | $sql = "SELECT id FROM $tbl_document |
|
| 2137 | WHERE c_id = $course_id AND path='/certificates' "; |
|
| 2138 | $rs = Database::query($sql); |
|
| 2139 | $row = Database::fetch_array($rs); |
|
| 2140 | return $row['id']; |
|
| 2141 | } |
|
| 2142 | ||
| 2143 | /** |
|
| 2144 | * Check if a directory given is for certificate |
|
| @@ 6057-6065 (lines=9) @@ | ||
| 6054 | * @param int $sessionId |
|
| 6055 | * @param int $courseId |
|
| 6056 | */ |
|
| 6057 | public static function removeCourseIntroduction($sessionId, $courseId) |
|
| 6058 | { |
|
| 6059 | $sessionId = intval($sessionId); |
|
| 6060 | $courseId = intval($courseId); |
|
| 6061 | $TBL_INTRODUCTION = Database::get_course_table(TABLE_TOOL_INTRO); |
|
| 6062 | $sql = "DELETE FROM $TBL_INTRODUCTION |
|
| 6063 | WHERE c_id = $courseId AND session_id = $sessionId"; |
|
| 6064 | Database::query($sql); |
|
| 6065 | } |
|
| 6066 | ||
| 6067 | /** |
|
| 6068 | * @param int $sessionId |
|
| @@ 1582-1591 (lines=10) @@ | ||
| 1579 | * @author Patrick Cool <[email protected]>, Ghent University |
|
| 1580 | * @version January 2007,december 2008 |
|
| 1581 | */ |
|
| 1582 | public static function delete_all_survey_answers($survey_id) |
|
| 1583 | { |
|
| 1584 | $course_id = api_get_course_int_id(); |
|
| 1585 | $table_survey_answer = Database::get_course_table(TABLE_SURVEY_ANSWER); |
|
| 1586 | $survey_id = intval($survey_id); |
|
| 1587 | $sql = "DELETE FROM $table_survey_answer |
|
| 1588 | WHERE c_id = $course_id AND survey_id=$survey_id"; |
|
| 1589 | Database::query($sql); |
|
| 1590 | return true; |
|
| 1591 | } |
|
| 1592 | ||
| 1593 | /** |
|
| 1594 | * @param int $user_id |
|