| @@ 29-52 (lines=24) @@ | ||
| 26 | * Generate an array of learnpaths that a teacher hasn't created a link for. |
|
| 27 | * @return array 2-dimensional array - every element contains 2 subelements (id, name) |
|
| 28 | */ |
|
| 29 | public function get_not_created_links() |
|
| 30 | { |
|
| 31 | return false; |
|
| 32 | if (empty($this->course_code)) |
|
| 33 | die('Error in get_not_created_links() : course code not set'); |
|
| 34 | ||
| 35 | $tbl_grade_links = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_LINK); |
|
| 36 | ||
| 37 | $sql = 'SELECT id, name from '.$this->get_learnpath_table().' lp |
|
| 38 | WHERE c_id = '.$this->course_id.' AND id NOT IN ' |
|
| 39 | .' (SELECT ref_id FROM '.$tbl_grade_links |
|
| 40 | .' WHERE type = '.LINK_LEARNPATH |
|
| 41 | ." AND c_id = '" . intval($this->course_id) . "'" |
|
| 42 | .') AND lp.session_id='.api_get_session_id().''; |
|
| 43 | ||
| 44 | $result = Database::query($sql); |
|
| 45 | ||
| 46 | $cats=array(); |
|
| 47 | while ($data=Database::fetch_array($result)) { |
|
| 48 | $cats[] = array ($data['id'], $data['name']); |
|
| 49 | } |
|
| 50 | ||
| 51 | return $cats; |
|
| 52 | } |
|
| 53 | ||
| 54 | /** |
|
| 55 | * Generate an array of all learnpaths available. |
|
| @@ 78-100 (lines=23) @@ | ||
| 75 | * Generate an array of exercises that a teacher hasn't created a link for. |
|
| 76 | * @return array 2-dimensional array - every element contains 2 subelements (id, name) |
|
| 77 | */ |
|
| 78 | public function get_not_created_links() |
|
| 79 | { |
|
| 80 | return false; |
|
| 81 | if (empty($this->course_code)) { |
|
| 82 | die('Error in get_not_created_links() : course code not set'); |
|
| 83 | } |
|
| 84 | $tbl_grade_links = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_LINK); |
|
| 85 | ||
| 86 | $sql = 'SELECT id, url from '.$this->get_studpub_table() |
|
| 87 | .' pup WHERE c_id = '.$this->course_id.' AND has_properties != '."''".' AND id NOT IN' |
|
| 88 | .' (SELECT ref_id FROM '.$tbl_grade_links |
|
| 89 | .' WHERE type = '.LINK_STUDENTPUBLICATION |
|
| 90 | ." AND c_id = '".intval($this->course_id)."'" |
|
| 91 | .') AND pub.session_id='.api_get_session_id().''; |
|
| 92 | ||
| 93 | $result = Database::query($sql); |
|
| 94 | ||
| 95 | $cats=array(); |
|
| 96 | while ($data = Database::fetch_array($result)) { |
|
| 97 | $cats[] = array($data['id'], $data['url']); |
|
| 98 | } |
|
| 99 | return $cats; |
|
| 100 | } |
|
| 101 | ||
| 102 | /** |
|
| 103 | * Generate an array of all exercises available. |
|