| @@ 1512-1529 (lines=18) @@ | ||
| 1509 | * @author Patrick Cool <[email protected]>, Ghent University |
|
| 1510 | * @version January 2007 |
|
| 1511 | */ |
|
| 1512 | public static function delete_all_survey_questions_options($survey_id, $shared = false) |
|
| 1513 | { |
|
| 1514 | // Table definitions |
|
| 1515 | $table_survey_question_option = Database :: get_course_table(TABLE_SURVEY_QUESTION_OPTION); |
|
| 1516 | $course_id = api_get_course_int_id(); |
|
| 1517 | $course_condition = " c_id = $course_id AND "; |
|
| 1518 | if ($shared) { |
|
| 1519 | $course_condition = ""; |
|
| 1520 | $table_survey_question_option = Database :: get_main_table(TABLE_MAIN_SHARED_SURVEY_QUESTION_OPTION); |
|
| 1521 | } |
|
| 1522 | ||
| 1523 | $sql = "DELETE FROM $table_survey_question_option |
|
| 1524 | WHERE $course_condition survey_id='".intval($survey_id)."'"; |
|
| 1525 | ||
| 1526 | // Deleting the options of the survey questions |
|
| 1527 | Database::query($sql); |
|
| 1528 | return true; |
|
| 1529 | } |
|
| 1530 | ||
| 1531 | /** |
|
| 1532 | * This function deletes the options of a given question |
|
| @@ 1544-1563 (lines=20) @@ | ||
| 1541 | * @author Julio Montoya |
|
| 1542 | * @version March 2007 |
|
| 1543 | */ |
|
| 1544 | public static function delete_survey_question_option($survey_id, $question_id, $shared = false) |
|
| 1545 | { |
|
| 1546 | $course_id = api_get_course_int_id(); |
|
| 1547 | $course_condition = " c_id = $course_id AND "; |
|
| 1548 | ||
| 1549 | // Table definitions |
|
| 1550 | $table_survey_question_option = Database :: get_course_table(TABLE_SURVEY_QUESTION_OPTION); |
|
| 1551 | if ($shared) { |
|
| 1552 | $course_condition = ""; |
|
| 1553 | $table_survey_question_option = Database :: get_main_table(TABLE_MAIN_SHARED_SURVEY_QUESTION_OPTION); |
|
| 1554 | } |
|
| 1555 | ||
| 1556 | // Deleting the options of the survey questions |
|
| 1557 | $sql = "DELETE from $table_survey_question_option |
|
| 1558 | WHERE |
|
| 1559 | $course_condition survey_id='".intval($survey_id)."' AND |
|
| 1560 | question_id='".intval($question_id)."'"; |
|
| 1561 | Database::query($sql); |
|
| 1562 | return true; |
|
| 1563 | } |
|
| 1564 | ||
| 1565 | /** |
|
| 1566 | * SURVEY ANSWERS FUNCTIONS |
|
| @@ 2376-2390 (lines=15) @@ | ||
| 2373 | * @param int $courseId |
|
| 2374 | * @return bool Returns TRUE if the session and the course are related, FALSE otherwise. |
|
| 2375 | * */ |
|
| 2376 | public static function relation_session_course_exist($session_id, $courseId) |
|
| 2377 | { |
|
| 2378 | $tbl_session_course = Database::get_main_table(TABLE_MAIN_SESSION_COURSE); |
|
| 2379 | $return_value = false; |
|
| 2380 | $sql = "SELECT c_id FROM $tbl_session_course |
|
| 2381 | WHERE |
|
| 2382 | session_id = " . intval($session_id) . " AND |
|
| 2383 | c_id = " . intval($courseId) . ""; |
|
| 2384 | $result = Database::query($sql); |
|
| 2385 | $num = Database::num_rows($result); |
|
| 2386 | if ($num > 0) { |
|
| 2387 | $return_value = true; |
|
| 2388 | } |
|
| 2389 | return $return_value; |
|
| 2390 | } |
|
| 2391 | ||
| 2392 | /** |
|
| 2393 | * Get the session information by name |
|
| @@ 2049-2064 (lines=16) @@ | ||
| 2046 | * @author Patrick Cool <[email protected]>, Ghent University |
|
| 2047 | * @version february 2006, dokeos 1.8 |
|
| 2048 | */ |
|
| 2049 | function get_post_information($post_id) |
|
| 2050 | { |
|
| 2051 | $table_posts = Database :: get_course_table(TABLE_FORUM_POST); |
|
| 2052 | $table_users = Database :: get_main_table(TABLE_MAIN_USER); |
|
| 2053 | $course_id = api_get_course_int_id(); |
|
| 2054 | ||
| 2055 | $sql = "SELECT posts.*, email FROM ".$table_posts." posts, ".$table_users." users |
|
| 2056 | WHERE |
|
| 2057 | c_id = $course_id AND |
|
| 2058 | posts.poster_id=users.user_id AND |
|
| 2059 | posts.post_id = ".intval($post_id); |
|
| 2060 | $result = Database::query($sql); |
|
| 2061 | $row = Database::fetch_array($result, 'ASSOC'); |
|
| 2062 | ||
| 2063 | return $row; |
|
| 2064 | } |
|
| 2065 | ||
| 2066 | /** |
|
| 2067 | * This function retrieves all the information of a thread |
|