| @@ 1215-1228 (lines=14) @@ | ||
| 1212 | * @param int $user_id |
|
| 1213 | * @return bool |
|
| 1214 | */ |
|
| 1215 | public function get_user_skill_ranking($user_id) |
|
| 1216 | { |
|
| 1217 | $user_id = intval($user_id); |
|
| 1218 | $sql = "SELECT count(skill_id) count FROM {$this->table} s |
|
| 1219 | INNER JOIN {$this->table_skill_rel_user} su |
|
| 1220 | ON (s.id = su.skill_id) |
|
| 1221 | WHERE user_id = $user_id"; |
|
| 1222 | $result = Database::query($sql); |
|
| 1223 | if (Database::num_rows($result)) { |
|
| 1224 | $result = Database::fetch_row($result); |
|
| 1225 | return $result[0]; |
|
| 1226 | } |
|
| 1227 | return false; |
|
| 1228 | } |
|
| 1229 | ||
| 1230 | /** |
|
| 1231 | * @param $start |
|
| @@ 6635-6649 (lines=15) @@ | ||
| 6632 | /** |
|
| 6633 | * Get total number of question that will be parsed when using the category/exercise |
|
| 6634 | */ |
|
| 6635 | public function getNumberQuestionExerciseCategory() |
|
| 6636 | { |
|
| 6637 | $table = Database::get_course_table(TABLE_QUIZ_REL_CATEGORY); |
|
| 6638 | if (!empty($this->id)) { |
|
| 6639 | $sql = "SELECT SUM(count_questions) count_questions |
|
| 6640 | FROM $table |
|
| 6641 | WHERE exercise_id = {$this->id} AND c_id = {$this->course_id}"; |
|
| 6642 | $result = Database::query($sql); |
|
| 6643 | if (Database::num_rows($result)) { |
|
| 6644 | $row = Database::fetch_array($result); |
|
| 6645 | return $row['count_questions']; |
|
| 6646 | } |
|
| 6647 | } |
|
| 6648 | return 0; |
|
| 6649 | } |
|
| 6650 | ||
| 6651 | /** |
|
| 6652 | * Save categories in the TABLE_QUIZ_REL_CATEGORY table |
|