| @@ 2067-2082 (lines=16) @@ | ||
| 2064 | * @author Patrick Cool <[email protected]>, Ghent University |
|
| 2065 | * @version february 2006, dokeos 1.8 |
|
| 2066 | */ |
|
| 2067 | function get_post_information($post_id) |
|
| 2068 | { |
|
| 2069 | $table_posts = Database::get_course_table(TABLE_FORUM_POST); |
|
| 2070 | $table_users = Database::get_main_table(TABLE_MAIN_USER); |
|
| 2071 | $course_id = api_get_course_int_id(); |
|
| 2072 | ||
| 2073 | $sql = "SELECT posts.*, email FROM ".$table_posts." posts, ".$table_users." users |
|
| 2074 | WHERE |
|
| 2075 | c_id = $course_id AND |
|
| 2076 | posts.poster_id=users.user_id AND |
|
| 2077 | posts.post_id = ".intval($post_id); |
|
| 2078 | $result = Database::query($sql); |
|
| 2079 | $row = Database::fetch_array($result, 'ASSOC'); |
|
| 2080 | ||
| 2081 | return $row; |
|
| 2082 | } |
|
| 2083 | ||
| 2084 | /** |
|
| 2085 | * This function retrieves all the information of a thread |
|
| @@ 1499-1516 (lines=18) @@ | ||
| 1496 | * @author Patrick Cool <[email protected]>, Ghent University |
|
| 1497 | * @version January 2007 |
|
| 1498 | */ |
|
| 1499 | public static function delete_all_survey_questions_options($survey_id, $shared = false) |
|
| 1500 | { |
|
| 1501 | // Table definitions |
|
| 1502 | $table_survey_question_option = Database::get_course_table(TABLE_SURVEY_QUESTION_OPTION); |
|
| 1503 | $course_id = api_get_course_int_id(); |
|
| 1504 | $course_condition = " c_id = $course_id AND "; |
|
| 1505 | if ($shared) { |
|
| 1506 | $course_condition = ""; |
|
| 1507 | $table_survey_question_option = Database::get_main_table(TABLE_MAIN_SHARED_SURVEY_QUESTION_OPTION); |
|
| 1508 | } |
|
| 1509 | ||
| 1510 | $sql = "DELETE FROM $table_survey_question_option |
|
| 1511 | WHERE $course_condition survey_id='".intval($survey_id)."'"; |
|
| 1512 | ||
| 1513 | // Deleting the options of the survey questions |
|
| 1514 | Database::query($sql); |
|
| 1515 | ||
| 1516 | return true; |
|
| 1517 | } |
|
| 1518 | ||
| 1519 | /** |
|
| @@ 1532-1551 (lines=20) @@ | ||
| 1529 | * @author Julio Montoya |
|
| 1530 | * @version March 2007 |
|
| 1531 | */ |
|
| 1532 | public static function delete_survey_question_option($survey_id, $question_id, $shared = false) |
|
| 1533 | { |
|
| 1534 | $course_id = api_get_course_int_id(); |
|
| 1535 | $course_condition = " c_id = $course_id AND "; |
|
| 1536 | ||
| 1537 | // Table definitions |
|
| 1538 | $table_survey_question_option = Database::get_course_table(TABLE_SURVEY_QUESTION_OPTION); |
|
| 1539 | if ($shared) { |
|
| 1540 | $course_condition = ""; |
|
| 1541 | $table_survey_question_option = Database::get_main_table(TABLE_MAIN_SHARED_SURVEY_QUESTION_OPTION); |
|
| 1542 | } |
|
| 1543 | ||
| 1544 | // Deleting the options of the survey questions |
|
| 1545 | $sql = "DELETE from $table_survey_question_option |
|
| 1546 | WHERE |
|
| 1547 | $course_condition survey_id='".intval($survey_id)."' AND |
|
| 1548 | question_id='".intval($question_id)."'"; |
|
| 1549 | Database::query($sql); |
|
| 1550 | return true; |
|
| 1551 | } |
|
| 1552 | ||
| 1553 | /** |
|
| 1554 | * SURVEY ANSWERS FUNCTIONS |
|
| @@ 2559-2573 (lines=15) @@ | ||
| 2556 | * @param int $courseId |
|
| 2557 | * @return bool Returns TRUE if the session and the course are related, FALSE otherwise. |
|
| 2558 | * */ |
|
| 2559 | public static function relation_session_course_exist($session_id, $courseId) |
|
| 2560 | { |
|
| 2561 | $tbl_session_course = Database::get_main_table(TABLE_MAIN_SESSION_COURSE); |
|
| 2562 | $return_value = false; |
|
| 2563 | $sql = "SELECT c_id FROM $tbl_session_course |
|
| 2564 | WHERE |
|
| 2565 | session_id = " . intval($session_id) . " AND |
|
| 2566 | c_id = " . intval($courseId); |
|
| 2567 | $result = Database::query($sql); |
|
| 2568 | $num = Database::num_rows($result); |
|
| 2569 | if ($num > 0) { |
|
| 2570 | $return_value = true; |
|
| 2571 | } |
|
| 2572 | return $return_value; |
|
| 2573 | } |
|
| 2574 | ||
| 2575 | /** |
|
| 2576 | * Get the session information by name |
|