コード例 #1
0
/**
   Return the <a> html code for delete, add, clone, edit a question
   in_action = the code of the action triggered by the button
   from_exercice = the id of the current exercice from which we click on question pool
   in_questionid = the id of the current question
   in_questiontype = the code of the type of the current question
   in_questionname = the name of the question
   in_selected_course = the if of the course chosen in the FILTERING MENU
   in_courseCategoryId = the id of the category chosen in the FILTERING MENU
   in_exerciseLevel = the level of the exercice chosen in the FILTERING MENU
   in_answerType = the code of the type of the question chosen in the FILTERING MENU
   in_session_id = the id of the session_id chosen in the FILTERING MENU
   in_exercice_id = the id of the exercice chosen in the FILTERING MENU
*/
function get_action_icon_for_question($in_action, $from_exercice, $in_questionid, $in_questiontype, $in_questionname, $in_selected_course, $in_courseCategoryId, $in_exerciseLevel, $in_answerType, $in_session_id, $in_exercice_id)
{
    $res = "";
    $getParams = "&selected_course={$in_selected_course}&courseCategoryId={$in_courseCategoryId}&exerciseId={$in_exercice_id}&exerciseLevel={$in_exerciseLevel}&answerType={$in_answerType}&session_id={$in_session_id}";
    switch ($in_action) {
        case "delete":
            $res = "<a href='" . api_get_self() . "?" . api_get_cidreq() . $getParams . "&delete={$in_questionid}' onclick='return confirm_your_choice()'>";
            $res .= Display::return_icon("delete.png", get_lang('Delete'));
            $res .= "</a>";
            break;
        case "edit":
            $res = get_a_tag_for_question(1, $from_exercice, $in_questionid, $in_questiontype, Display::return_icon("edit.png", get_lang('Modify')), $in_session_id);
            break;
        case "add":
            // add if question is not already in test
            $myObjEx = new Exercise();
            $myObjEx->read($from_exercice);
            if (!$myObjEx->isInList($in_questionid)) {
                $res = "<a href='" . api_get_self() . "?" . api_get_cidreq() . $getParams . "&recup={$in_questionid}&fromExercise={$from_exercice}'>";
                $res .= Display::return_icon("view_more_stats.gif", get_lang('InsertALinkToThisQuestionInTheExercise'));
                $res .= "</a>";
            } else {
                $res = "-";
            }
            unset($myObjEx);
            break;
        case "clone":
            $url = api_get_self() . "?" . api_get_cidreq() . $getParams . "&amp;copy_question={$in_questionid}&amp;course_id={$in_selected_course}&amp;fromExercise={$from_exercice}";
            $res = Display::url(Display::return_icon('cd.gif', get_lang('ReUseACopyInCurrentTest')), $url);
            break;
        default:
            $res = $in_action;
            break;
    }
    return $res;
}
コード例 #2
0
 }
 if (isset($_GET['exportIMSQTI'])) {
     $result = Database::get()->queryArray($result_query, $result_query_vars);
     header('Content-type: text/xml');
     header('Content-Disposition: attachment; filename="exportQTI.xml"');
     exportIMSQTI($result);
     exit;
 } else {
     //END OF BUILDING QUERIES AND QUERY VARS
     $result = Database::get()->queryArray($result_query, $result_query_vars);
     $total_questions = Database::get()->querySingle($total_query, $total_query_vars)->total;
     $nbrQuestions = count($result);
     $tool_content .= "\n\t<tr>\n\t  <th>{$langQuesList}</th>\n          <th class='text-center'>" . icon('fa-gears') . "</th>\n        </tr>";
     foreach ($result as $row) {
         $exercise_ids = Database::get()->queryArray("SELECT exercise_id FROM `exercise_with_questions` WHERE question_id = ?d", $row->id);
         if (isset($fromExercise) || !is_object(@$objExercise) || !$objExercise->isInList($row->id)) {
             if ($row->type == 1) {
                 $answerType = $langUniqueSelect;
             } elseif ($row->type == 2) {
                 $answerType = $langMultipleSelect;
             } elseif ($row->type == 3) {
                 $answerType = $langFillBlanks;
             } elseif ($row->type == 4) {
                 $answerType = $langMatching;
             } elseif ($row->type == 5) {
                 $answerType = $langTrueFalse;
             } elseif ($row->type == 6) {
                 $answerType = $langFreeText;
             }
             $tool_content .= "<tr>";
             if (!isset($fromExercise)) {