@@ 398-409 (lines=12) @@ | ||
395 | * @param int $id The id (an integer number) of the corresponding database record. |
|
396 | * @return string|bool Returns the requested data as an array or FALSE on failure. |
|
397 | */ |
|
398 | public static function get_course_request_info($id) |
|
399 | { |
|
400 | $id = (int)$id; |
|
401 | $sql = "SELECT * |
|
402 | FROM ".Database :: get_main_table(TABLE_MAIN_COURSE_REQUEST)." |
|
403 | WHERE id = ".$id; |
|
404 | $result = Database::query($sql); |
|
405 | if (Database::num_rows($result) > 0) { |
|
406 | return Database::fetch_array($result); |
|
407 | } |
|
408 | return false; |
|
409 | } |
|
410 | ||
411 | /** |
|
412 | * Gets the code of a given course request using its database id as an access key. |
@@ 2281-2294 (lines=14) @@ | ||
2278 | * Check availability of a survey code |
|
2279 | * @param string $survey_code |
|
2280 | */ |
|
2281 | public function is_survey_code_available($survey_code) |
|
2282 | { |
|
2283 | $table_sur = Database :: get_course_table(TABLE_SURVEY); |
|
2284 | $sql = "SELECT * FROM $table_sur |
|
2285 | WHERE |
|
2286 | c_id = ".$this->destination_course_id." AND |
|
2287 | code = '".self::DBUTF8escapestring($survey_code)."'"; |
|
2288 | $result = Database::query($sql); |
|
2289 | if (Database::num_rows($result) > 0) { |
|
2290 | return false; |
|
2291 | } else { |
|
2292 | return true; |
|
2293 | } |
|
2294 | } |
|
2295 | ||
2296 | /** |
|
2297 | * Restore survey-questions |
@@ 1153-1163 (lines=11) @@ | ||
1150 | * @assert ('') === false |
|
1151 | * @assert ('xyzxyzxyz') === true |
|
1152 | */ |
|
1153 | public static function is_username_available($username) |
|
1154 | { |
|
1155 | if (empty($username)) { |
|
1156 | return false; |
|
1157 | } |
|
1158 | $table_user = Database :: get_main_table(TABLE_MAIN_USER); |
|
1159 | $sql = "SELECT username FROM $table_user |
|
1160 | WHERE username = '".Database::escape_string($username)."'"; |
|
1161 | $res = Database::query($sql); |
|
1162 | ||
1163 | return Database::num_rows($res) == 0; |
|
1164 | } |
|
1165 | ||
1166 | /** |