| @@ 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 | return true; |
|
| 1520 | } |
|
| 1521 | ||
| 1522 | /** |
|
| 1523 | * This function deletes the options of a given question |
|
| @@ 1535-1554 (lines=20) @@ | ||
| 1532 | * @author Julio Montoya |
|
| 1533 | * @version March 2007 |
|
| 1534 | */ |
|
| 1535 | public static function delete_survey_question_option($survey_id, $question_id, $shared = false) |
|
| 1536 | { |
|
| 1537 | $course_id = api_get_course_int_id(); |
|
| 1538 | $course_condition = " c_id = $course_id AND "; |
|
| 1539 | ||
| 1540 | // Table definitions |
|
| 1541 | $table_survey_question_option = Database :: get_course_table(TABLE_SURVEY_QUESTION_OPTION); |
|
| 1542 | if ($shared) { |
|
| 1543 | $course_condition = ""; |
|
| 1544 | $table_survey_question_option = Database :: get_main_table(TABLE_MAIN_SHARED_SURVEY_QUESTION_OPTION); |
|
| 1545 | } |
|
| 1546 | ||
| 1547 | // Deleting the options of the survey questions |
|
| 1548 | $sql = "DELETE from $table_survey_question_option |
|
| 1549 | WHERE |
|
| 1550 | $course_condition survey_id='".intval($survey_id)."' AND |
|
| 1551 | question_id='".intval($question_id)."'"; |
|
| 1552 | Database::query($sql); |
|
| 1553 | return true; |
|
| 1554 | } |
|
| 1555 | ||
| 1556 | /** |
|
| 1557 | * 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 |
|