| @@ 1503-1520 (lines=18) @@ | ||
| 1500 | * @author Patrick Cool <[email protected]>, Ghent University |
|
| 1501 | * @version January 2007 |
|
| 1502 | */ |
|
| 1503 | public static function delete_all_survey_questions_options($survey_id, $shared = false) |
|
| 1504 | { |
|
| 1505 | // Table definitions |
|
| 1506 | $table_survey_question_option = Database :: get_course_table(TABLE_SURVEY_QUESTION_OPTION); |
|
| 1507 | $course_id = api_get_course_int_id(); |
|
| 1508 | $course_condition = " c_id = $course_id AND "; |
|
| 1509 | if ($shared) { |
|
| 1510 | $course_condition = ""; |
|
| 1511 | $table_survey_question_option = Database :: get_main_table(TABLE_MAIN_SHARED_SURVEY_QUESTION_OPTION); |
|
| 1512 | } |
|
| 1513 | ||
| 1514 | $sql = "DELETE FROM $table_survey_question_option |
|
| 1515 | WHERE $course_condition survey_id='".intval($survey_id)."'"; |
|
| 1516 | ||
| 1517 | // Deleting the options of the survey questions |
|
| 1518 | Database::query($sql); |
|
| 1519 | ||
| 1520 | return true; |
|
| 1521 | } |
|
| 1522 | ||
| 1523 | /** |
|
| @@ 1536-1555 (lines=20) @@ | ||
| 1533 | * @author Julio Montoya |
|
| 1534 | * @version March 2007 |
|
| 1535 | */ |
|
| 1536 | public static function delete_survey_question_option($survey_id, $question_id, $shared = false) |
|
| 1537 | { |
|
| 1538 | $course_id = api_get_course_int_id(); |
|
| 1539 | $course_condition = " c_id = $course_id AND "; |
|
| 1540 | ||
| 1541 | // Table definitions |
|
| 1542 | $table_survey_question_option = Database :: get_course_table(TABLE_SURVEY_QUESTION_OPTION); |
|
| 1543 | if ($shared) { |
|
| 1544 | $course_condition = ""; |
|
| 1545 | $table_survey_question_option = Database :: get_main_table(TABLE_MAIN_SHARED_SURVEY_QUESTION_OPTION); |
|
| 1546 | } |
|
| 1547 | ||
| 1548 | // Deleting the options of the survey questions |
|
| 1549 | $sql = "DELETE from $table_survey_question_option |
|
| 1550 | WHERE |
|
| 1551 | $course_condition survey_id='".intval($survey_id)."' AND |
|
| 1552 | question_id='".intval($question_id)."'"; |
|
| 1553 | Database::query($sql); |
|
| 1554 | return true; |
|
| 1555 | } |
|
| 1556 | ||
| 1557 | /** |
|
| 1558 | * SURVEY ANSWERS FUNCTIONS |
|
| @@ 2482-2496 (lines=15) @@ | ||
| 2479 | * @param int $courseId |
|
| 2480 | * @return bool Returns TRUE if the session and the course are related, FALSE otherwise. |
|
| 2481 | * */ |
|
| 2482 | public static function relation_session_course_exist($session_id, $courseId) |
|
| 2483 | { |
|
| 2484 | $tbl_session_course = Database::get_main_table(TABLE_MAIN_SESSION_COURSE); |
|
| 2485 | $return_value = false; |
|
| 2486 | $sql = "SELECT c_id FROM $tbl_session_course |
|
| 2487 | WHERE |
|
| 2488 | session_id = " . intval($session_id) . " AND |
|
| 2489 | c_id = " . intval($courseId); |
|
| 2490 | $result = Database::query($sql); |
|
| 2491 | $num = Database::num_rows($result); |
|
| 2492 | if ($num > 0) { |
|
| 2493 | $return_value = true; |
|
| 2494 | } |
|
| 2495 | return $return_value; |
|
| 2496 | } |
|
| 2497 | ||
| 2498 | /** |
|
| 2499 | * Get the session information by name |
|
| @@ 2043-2058 (lines=16) @@ | ||
| 2040 | * @author Patrick Cool <[email protected]>, Ghent University |
|
| 2041 | * @version february 2006, dokeos 1.8 |
|
| 2042 | */ |
|
| 2043 | function get_post_information($post_id) |
|
| 2044 | { |
|
| 2045 | $table_posts = Database :: get_course_table(TABLE_FORUM_POST); |
|
| 2046 | $table_users = Database :: get_main_table(TABLE_MAIN_USER); |
|
| 2047 | $course_id = api_get_course_int_id(); |
|
| 2048 | ||
| 2049 | $sql = "SELECT posts.*, email FROM ".$table_posts." posts, ".$table_users." users |
|
| 2050 | WHERE |
|
| 2051 | c_id = $course_id AND |
|
| 2052 | posts.poster_id=users.user_id AND |
|
| 2053 | posts.post_id = ".intval($post_id); |
|
| 2054 | $result = Database::query($sql); |
|
| 2055 | $row = Database::fetch_array($result, 'ASSOC'); |
|
| 2056 | ||
| 2057 | return $row; |
|
| 2058 | } |
|
| 2059 | ||
| 2060 | /** |
|
| 2061 | * This function retrieves all the information of a thread |
|