Beispiel #1
0
 function edit($back_test)
 {
     $lang =& DoceboLanguage::createInstance('test');
     require_once _base_ . '/lib/lib.form.php';
     $url_encode = htmlentities(urlencode($back_test));
     if (isset($_POST['add_question'])) {
         if (!sql_query("\r\n\t\t\tUPDATE " . $GLOBALS['prefix_lms'] . "_testquest \r\n\t\t\tSET idCategory = '" . (int) $_POST['idCategory'] . "',\r\n\t\t\t\ttitle_quest = '" . $_POST['title_quest'] . "',\r\n\t\t\t\tdifficult = '" . (int) $_POST['difficult'] . "',\r\n\t\t\t\ttime_assigned = '" . (int) $_POST['time_assigned'] . "'\r\n\t\t\tWHERE idQuest = '" . $this->id . "'")) {
             $GLOBALS['page']->add(getErrorUi($lang->def('_ERR_INS_QUEST') . getBackUi('index.php?modname=question&op=edit&type_quest=' . $this->getQuestionType() . '&idQuest=' . $this->id . '&back_test=' . $url_encode, $lang->def('_BACK'))), 'content');
         }
         if (!sql_query("\r\n\t\t\tUPDATE " . $GLOBALS['prefix_lms'] . "_testquestanswer \r\n\t\t\tSET score_correct = '" . $this->_checkScore($_POST['max_score']) . "'\r\n\t\t\tWHERE idQuest = '" . $this->id . "'")) {
             $GLOBALS['page']->add(getErrorUi($lang->def('_ERR_INS_QUEST') . getBackUi('index.php?modname=question&op=edit&type_quest=' . $this->getQuestionType() . '&idQuest=' . $this->id . '&back_test=' . $url_encode, $lang->def('_BACK'))), 'content');
         }
         Util::jump_to('' . $back_test);
     }
     //finding categories
     require_once $GLOBALS['where_lms'] . '/lib/lib.questcategory.php';
     $categories = Questcategory::getCategory();
     //create array of difficult
     $arr_dufficult = array(5 => '5 - ' . $lang->def('_VERY_HARD'), 4 => '4 - ' . $lang->def('_HARD'), 3 => '3 - ' . $lang->def('_DIFFICULT_MEDIUM'), 2 => '2 - ' . $lang->def('_DIFFICULT_EASY'), 1 => '1 - ' . $lang->def('_DIFFICULT_VERYEASY'));
     list($title_quest, $cat_sel, $diff_sel, $sel_time) = sql_fetch_row(sql_query("\r\n\t\tSELECT title_quest, idCategory, difficult, time_assigned \r\n\t\tFROM " . $GLOBALS['prefix_lms'] . "_testquest \r\n\t\tWHERE idQuest = '" . $this->id . "'"));
     list($max_score) = sql_fetch_row(sql_query("\r\n\t\tSELECT score_correct\r\n\t\tFROM " . $GLOBALS['prefix_lms'] . "_testquestanswer \r\n\t\tWHERE idQuest = '" . $this->id . "'"));
     $GLOBALS['page']->add(getTitleArea($lang->def('_TEST_SECTION'), 'test') . '<div class="std_block">' . getBackUi(Util::str_replace_once('&', '&amp;', $back_test), $lang->def('_BACK')) . '<div class="title_big">' . $lang->def('_QUEST_ACRN_' . strtoupper($this->getQuestionType())) . ' - ' . $lang->def('_QUEST_' . strtoupper($this->getQuestionType())) . '</div><br />' . Form::openForm('form_mod_quest', 'index.php?modname=question&amp;op=edit') . Form::openElementSpace() . Form::getHidden('type_quest', 'type_quest', $this->getQuestionType()) . Form::getHidden('idQuest', 'idQuest', $this->id) . Form::getHidden('back_test', 'back_test', $url_encode) . Form::getTextarea($lang->def('_QUESTION'), 'title_quest', 'title_quest', $title_quest), 'content');
     if (count($categories) > 1) {
         $GLOBALS['page']->add(Form::getDropdown($lang->def('_TEST_QUEST_CATEGORY'), 'idCategory', 'idCategory', $categories), 'content', isset($_POST['idCategory']) ? $_POST['idCategory'] : $cat_sel);
     }
     $GLOBALS['page']->add(Form::getDropdown($lang->def('_DIFFICULTY'), 'difficult', 'difficult', $arr_dufficult, $diff_sel) . Form::getTextfield($lang->def('_TEST_QUEST_TIMEASS'), 'time_assigned', 'time_assigned', 5, isset($_POST['time_assigned']) ? $_POST['time_assigned'] : $sel_time, $lang->def('_TEST_QUEST_TIMEASS'), $lang->def('_SECONDS')) . Form::getBreakRow() . Form::getTextfield($lang->def('_MAX_SCORE'), 'max_score', 'max_score', 255, isset($_POST['max_score']) ? $_POST['max_score'] : $max_score, $lang->def('_MAX_SCORE')) . Form::getBreakRow() . Form::closeElementSpace() . Form::openButtonSpace() . Form::getButton('add_question', 'add_question', $lang->def('_SAVE')) . Form::closeButtonSpace() . Form::closeForm() . '</div>', 'content');
 }
 function edit($back_poll)
 {
     $lang =& DoceboLanguage::createInstance('poll');
     require_once _base_ . '/lib/lib.form.php';
     $url_encode = htmlentities(urlencode($back_poll));
     if (isset($_POST['add_question'])) {
         if (!sql_query("\r\n\t\t\tUPDATE " . $GLOBALS['prefix_lms'] . "_pollquest \r\n\t\t\tSET title_quest = '" . $_POST['title_quest'] . "' \r\n\t\t\tWHERE id_quest = '" . $this->id . "'")) {
             errorCommunication($lang->def('_ERR_INS_QUEST') . getBackUi('index.php?modname=question_poll&amp;op=edit&amp;type_quest=' . $this->getQuestionType() . '&amp;id_quest=' . $this->id . '&amp;back_poll=' . $url_encode, $lang->def('_BACK')));
         }
         Util::jump_to('' . $back_poll);
     }
     //finding categories
     require_once $GLOBALS['where_lms'] . '/lib/lib.questcategory.php';
     $categories = Questcategory::getCategory();
     //create array of difficult
     $arr_dufficult = array(5 => '5 - ' . $lang->def('_VERY_HARD'), 4 => '4 - ' . $lang->def('_HARD'), 3 => '3 - ' . $lang->def('_DIFFICULT_MEDIUM'), 2 => '2 - ' . $lang->def('_DIFFICULT_EASY'), 1 => '1 - ' . $lang->def('_DIFFICULT_VERYEASY'));
     list($title_quest) = sql_fetch_row(sql_query("\r\n\t\tSELECT title_quest  \r\n\t\tFROM " . $GLOBALS['prefix_lms'] . "_pollquest \r\n\t\tWHERE id_quest = '" . $this->id . "'"));
     $GLOBALS['page']->add(getTitleArea($lang->def('_POLL_SECTION'), 'poll') . '<div class="std_block">' . getBackUi(Util::str_replace_once('&', '&amp;', $back_poll), $lang->def('_BACK')) . '<div class="title_big">' . $lang->def('_QUEST_ACRN_' . strtoupper($this->getQuestionType())) . ' - ' . $lang->def('_QUEST_' . strtoupper($this->getQuestionType())) . '</div><br />' . Form::openForm('form_mod_quest', 'index.php?modname=question_poll&amp;op=edit') . Form::openElementSpace() . Form::getHidden('type_quest', 'type_quest', $this->getQuestionType()) . Form::getHidden('id_quest', 'id_quest', $this->id) . Form::getHidden('back_poll', 'back_poll', $url_encode) . Form::getTextarea($lang->def('_POLL_QUEST_TITLE'), 'title_quest', 'title_quest', $title_quest), 'content');
     $GLOBALS['page']->add('' . Form::closeElementSpace() . Form::openButtonSpace() . Form::getButton('add_question', 'add_question', $lang->def('_SAVE')) . Form::closeButtonSpace() . Form::closeForm() . '</div>', 'content');
 }
 /**
  * this function modify a question
  *
  * @param  string	$back_poll	indicates the return url
  * @return nothing
  *
  * @access public
  * @author Fabio Pirovano (fabio@docebo.com)
  */
 function edit($back_poll)
 {
     $lang =& DoceboLanguage::createInstance('poll');
     require_once _base_ . '/lib/lib.form.php';
     $url_encode = htmlentities(urlencode($back_poll));
     //manage number of answer
     if (isset($_POST['save_question'])) {
         //update question
         $ins_query = "\r\n\t\t\tUPDATE " . $GLOBALS['prefix_lms'] . "_pollquest\r\n\t\t\tSET id_category = '" . (int) $_POST['id_category'] . "',\r\n\t\t\t\ttype_quest = '" . $this->getQuestionType() . "',\r\n\t\t\t\ttitle_quest = '" . $_POST['title_quest'] . "'\r\n\t\t\tWHERE id_quest = '" . (int) $this->id . "'";
         if (!sql_query($ins_query)) {
             getErrorUi($lang->def('_POLL_ERR_INS_QUEST') . getBackUi('index.php?modname=question_poll&amp;op=edit&amp;type_quest=' . $this->getQuestionType() . '&amp;id_quest=' . $this->id . '&amp;back_poll=' . $url_encode, $lang->def('_BACK')));
         }
         //update answer
         if (!isset($_POST['is_correct'])) {
             $_POST['is_correct'] = -1;
         }
         $min_value = Get::req('min_value', DOTY_INT, 0);
         $max_value = Get::req('max_value', DOTY_INT, 0);
         $step_value = (double) str_replace(',', '.', $_POST['step_value']);
         if ($min_value >= $max_value || $step_value == 0) {
             $GLOBALS['page']->add(getErrorUi($lang->def('_POLL_ERR_INS_ANSWER') . getBackUi(str_replace('&', '&amp;', $back_poll), $lang->def('_BACK'))), 'content');
         } else {
             $del_answer_query = "DELETE FROM " . $GLOBALS['prefix_lms'] . "_pollquestanswer\r\n\t\t\t\t\t\t\t\t\tWHERE id_quest = '" . (int) $this->id . "'";
             if (!sql_query($del_answer_query)) {
                 getErrorUi($lang->def('_POLL_ERR_INS_ANSWER') . getBackUi(str_replace('&', '&amp;', $back_poll), $lang->def('_BACK')));
             } else {
                 $query = "INSERT INTO " . $GLOBALS['prefix_lms'] . "_pollquestanswer" . " (id_quest, answer, sequence)" . " VALUES ('" . $this->id . "', '" . $min_value . "', '0')," . " ('" . $this->id . "', '" . $max_value . "', '1')," . " ('" . $this->id . "', '" . $step_value . "', '2');";
                 if (!sql_query($query)) {
                     getErrorUi($lang->def('_POLL_ERR_INS_ANSWER') . getBackUi(str_replace('&', '&amp;', $back_poll), $lang->def('_BACK')));
                 } else {
                     Util::jump_to($back_poll);
                 }
             }
         }
     }
     //insert form
     require_once _lms_ . '/lib/lib.questcategory.php';
     $categories = Questcategory::getCategory();
     //writing difficult
     //load data
     list($sel_cat, $quest) = sql_fetch_row(sql_query("\r\n\t\tSELECT id_category, title_quest\r\n\t\tFROM " . $GLOBALS['prefix_lms'] . "_pollquest\r\n\t\tWHERE id_quest = '" . (int) $this->id . "'"));
     $re_answer = sql_query("\r\n\t\tSELECT id_answer, answer\r\n\t\tFROM " . $GLOBALS['prefix_lms'] . "_pollquestanswer\r\n\t\tWHERE id_quest = '" . (int) $this->id . "'\r\n\t\tORDER BY sequence");
     $array_answer = array();
     while (list($id_answer, $answer) = sql_fetch_row($re_answer)) {
         $array_answer[] = $answer;
     }
     if (!empty($array_answer)) {
         $min_value = $array_answer[0];
         $max_value = $array_answer[1];
         $step_value = $array_answer[2];
     } else {
         $min_value = '';
         $max_value = '';
         $step_value = '1';
     }
     $GLOBALS['page']->add(getTitleArea($lang->def('_POLL_SECTION'), 'poll') . '<div class="std_block">' . getBackUi(str_replace('&', '&amp;', $back_poll), $lang->def('_BACK')) . '<div class="title_big">' . $lang->def('_QUEST_ACRN_' . strtoupper($this->getQuestionType())) . ' - ' . $lang->def('_QUEST_' . strtoupper($this->getQuestionType())) . '</div><br />' . Form::openForm('form_add_quest', 'index.php?modname=question_poll&amp;op=edit') . Form::openElementSpace() . Form::getHidden('type_quest', 'type_quest', $this->getQuestionType()) . Form::getHidden('id_quest', 'id_quest', $this->id) . Form::getHidden('back_poll', 'back_poll', $url_encode) . Form::getTextarea($lang->def('_POLL_QUEST_TITLE'), 'title_quest', 'title_quest', isset($_POST['title_quest']) ? stripslashes($_POST['title_quest']) : $quest) . Form::getDropdown($lang->def('_CATEGORY'), 'id_category', 'id_category', $categories, isset($_POST['id_category']) ? $_POST['id_category'] : $sel_cat) . '<div class="no_float"></div><br />' . Form::getTextfield($lang->def('_MIN_VALUE'), 'min_value', 'min_value', 255, $min_value) . Form::getTextfield($lang->def('_MAX_VALUE'), 'max_value', 'max_value', 255, $max_value) . Form::getTextfield($lang->def('_STEP_VALUE'), 'step_value', 'step_value', 255, $step_value), 'content');
     $GLOBALS['page']->add(Form::closeElementSpace() . Form::openButtonSpace() . Form::getButton('save_question', 'save_question', $lang->def('_SAVE')) . Form::closeButtonSpace() . Form::closeForm() . '</div>', 'content');
 }
Beispiel #4
0
function user_report($idUser, $idTest, $id_param = false, $id_track = false, $mvc = false)
{
    if (!checkPerm('view', true, 'organization') && !checkPerm('view', true, 'storage')) {
        die("You can't access");
    }
    $lang =& DoceboLanguage::createInstance('test');
    if ($id_param !== false) {
        require_once _lms_ . '/lib/lib.param.php';
        $idReference = getLOParam($id_param, 'idReference');
        if (!Track_Test::isTrack($idUser, $idTest, $idReference)) {
            return;
        }
        //load existing info track
        $track_info = Track_Test::getTrackInfo($idUser, $idTest, $idReference);
        $idTrack = $track_info['idTrack'];
    } else {
        $idTrack = $id_track;
    }
    //test info---------------------------------------------------------
    list($title, $mod_doanswer, $point_type, $point_required, $question_random_number, $show_score, $show_score_cat, $show_doanswer, $show_solution, $order_type) = sql_fetch_row(sql_query("\r\n\tSELECT  title, mod_doanswer, point_type, point_required, question_random_number, \r\n\t\t\tshow_score, show_score_cat, show_doanswer, \r\n\t\t\tshow_solution, order_type\r\n\tFROM %lms_test\r\n\tWHERE idTest = '" . (int) $idTest . "'"));
    list($score, $bonus_score, $date_attempt, $date_attempt_mod) = sql_fetch_row(sql_query("\r\n\tSELECT score, bonus_score, date_attempt, date_attempt_mod \r\n\tFROM %lms_testtrack\r\n\tWHERE idTrack = '" . (int) $idTrack . "'"));
    $point_do = $bonus_score;
    $max_score = 0;
    $num_manual = 0;
    $manual_score = 0;
    $quest_sequence_number = 1;
    $report_test = '';
    $point_do_cat = array();
    /*
    	$reQuest = sql_query("
    	SELECT q.idQuest, q.type_quest, t.type_file, t.type_class, q.idCategory 
    	FROM ".$GLOBALS['prefix_lms']."_testquest AS q JOIN ".$GLOBALS['prefix_lms']."_quest_type AS t 
    	WHERE q.idTest = '".$idTest."' AND q.type_quest = t.type_quest 
    	ORDER BY q.sequence");*/
    if ($order_type >= 2) {
        $re_visu_quest = sql_query("SELECT idQuest \r\n\t\tFROM %lms_testtrack_quest\r\n\t\tWHERE idTrack = '" . (int) $idTrack . "' ");
        while (list($id_q) = sql_fetch_row($re_visu_quest)) {
            $quest_see[] = $id_q;
        }
        $query_question = "\r\n\t\tSELECT q.idQuest, q.type_quest, t.type_file, t.type_class, q.idCategory \r\n\t\tFROM %lms_testquest AS q JOIN %lms_quest_type AS t\r\n\t\tWHERE q.idTest = '" . $idTest . "' AND q.type_quest = t.type_quest AND  q.idQuest IN (" . implode($quest_see, ',') . ") \r\n\t\tORDER BY q.sequence";
    } else {
        $query_question = "\r\n\t\tSELECT q.idQuest, q.type_quest, t.type_file, t.type_class, q.idCategory \r\n\t\tFROM %lms_testquest AS q JOIN %lms_quest_type AS t\r\n\t\tWHERE q.idTest = '" . $idTest . "' AND q.type_quest = t.type_quest \r\n\t\tORDER BY q.sequence";
    }
    $reQuest = sql_query($query_question);
    while (list($id_quest, $type_quest, $type_file, $type_class, $id_cat) = sql_fetch_row($reQuest)) {
        require_once _lms_ . '/modules/question/' . $type_file;
        $quest_point_do = 0;
        $quest_obj = eval("return new {$type_class}( {$id_quest} );");
        $quest_point_do = $quest_obj->userScore($idTrack);
        $quest_max_score = $quest_obj->getMaxScore();
        if ($type_quest != 'title' && $type_quest != 'break_page') {
            $review = $quest_obj->displayUserResult($idTrack, $type_quest != 'title' ? $quest_sequence_number++ : $quest_sequence_number, $show_solution);
            $report_test .= '<div class="test_quest_review_container">' . $review['quest'];
            if ($review['score'] !== false) {
                $report_test .= '<div class="test_answer_comment">' . '<div class="test_score_note">' . $lang->def('_SCORE') . ' : ';
                if ($quest_obj->getScoreSetType() == 'manual' && !$review['manual_assigned']) {
                    $report_test .= $lang->def('_NOT_ASSIGNED');
                } else {
                    if ($review['score'] > 0) {
                        $report_test .= '<span class="test_score_positive">' . $review['score'] . '</span>';
                    } else {
                        $report_test .= '<span class="test_score_negative">' . $review['score'] . '</span>';
                    }
                }
                $report_test .= '</div>' . '</div>';
            }
            $report_test .= '</div>' . "\n";
        }
        if ($quest_obj->getScoreSetType() == 'manual') {
            ++$num_manual;
            $manual_score = round($manual_score + $quest_max_score, 2);
        }
        $point_do = round($point_do + $quest_point_do, 2);
        $max_score = round($max_score + $quest_max_score, 2);
        if (isset($point_do_cat[$id_cat])) {
            $point_do_cat[$id_cat] = round($point_do + $point_do_cat[$id_cat], 2);
        } else {
            $point_do_cat[$id_cat] = $point_do;
        }
    }
    //output variable, used in mvc mode
    $output = "";
    $str = "";
    if (!$mvc) {
        $str .= '<div class="std_block">';
    }
    $str .= '<div class="title">' . $lang->def('_TITLE') . ' : ' . $title . '</div><br />';
    if ($mvc) {
        $output .= $str;
    } else {
        $GLOBALS['page']->add($str, 'content');
    }
    if ($point_type != '1') {
        $save_score = $point_do;
    } else {
        $save_score = round(round($point_do / $max_score, 2) * 100, 2);
    }
    if ($show_score && $point_type != '1') {
        $str = '<span class="test_score_note">' . $lang->def('_TEST_TOTAL_SCORE') . '</span> ' . $point_do . ' / ' . $max_score . '<br />';
        if ($mvc) {
            $output .= $str;
        } else {
            $GLOBALS['page']->add($str, 'content');
        }
        if ($num_manual != 0) {
            $str = '<br /><span class="test_score_note">' . $lang->def('_TEST_MANUAL_SCORE') . '</span> ' . $manual_score . ' ' . $lang->def('_TEST_SCORES') . '<br />';
            if ($mvc) {
                $output .= $str;
            } else {
                $GLOBALS['page']->add($str, 'content');
            }
        }
    }
    if ($show_score && $point_type == '1') {
        $str = '<span class="test_score_note">' . $lang->def('_TEST_TOTAL_SCORE') . '</span> ' . $save_score . ' %' . '<br />';
        if ($mvc) {
            $output .= $str;
        } else {
            $GLOBALS['page']->add($str, 'content');
        }
        if ($num_manual != 0) {
            $str = '<br /><span class="test_score_note">' . $lang->def('_TEST_MANUAL_SCORE') . '</span> ' . $manual_score . ' ' . $lang->def('_TEST_SCORES') . '<br />';
            if ($mvc) {
                $output .= $str;
            } else {
                $GLOBALS['page']->add($str, 'content');
            }
        }
    }
    if ($show_score_cat) {
        $category = array();
        $reQuestCat = sql_query("\r\n\t\tSELECT idCategory \r\n\t\tFROM %lms_testquest\r\n\t\tWHERE idTest = '" . $idTest . "' AND idCategory != 0");
        while (list($id_cat) = sql_fetch_row($reQuestCat)) {
            $category[] = $id_cat;
        }
        if (!empty($category)) {
            require_once _lms_ . '/lib/lib.questcategory.php';
            $categories = Questcategory::getInfoAboutCategory($category);
            $str = '<br /><span class="test_score_note">' . $lang->def('_TEST_CATEGORY_SCORE') . '</span><br />';
            if ($mvc) {
                $output .= $str;
            } else {
                $GLOBALS['page']->add($str, 'content');
            }
            while (list($id_cat, $name_cat) = each($categories)) {
                $str = $name_cat . ', ' . $lang->def('_TEST_SCORES') . ': ' . (isset($point_do_cat[$id_cat]) ? $point_do_cat[$id_cat] : 0) . '<br />';
                if ($mvc) {
                    $output .= $str;
                } else {
                    $GLOBALS['page']->add($str, 'content');
                }
            }
        }
    }
    $str = '<br /><br /><div class="test_answer_space">' . $report_test . '</div>';
    if (!$mvc) {
        $str .= '</div>';
    }
    //end stdblock div
    if ($mvc) {
        return $output;
    } else {
        $GLOBALS['page']->add($str, 'content');
    }
}
Beispiel #5
0
function feedbackman()
{
    checkPerm('view', false, 'storage');
    $res = '';
    require_once _lms_ . '/lib/lib.questcategory.php';
    require_once _lms_ . '/lib/lib.assessment_rule.php';
    $id_test = Get::gReq('idTest', DOTY_INT, 0);
    $back_url = urldecode(Get::gReq('back_url', DOTY_STRING));
    $url_encode = htmlentities(urlencode($back_url));
    $back_link_url = 'index.php?modname=test&amp;op=modtestgui&amp;idTest=' . $id_test . '&amp;back_url=' . $url_encode;
    $url_base = 'index.php?modname=test&idTest=' . $id_test . '&back_url=' . $url_encode . '&op=';
    $categories = Questcategory::getTestQuestionsCategories($id_test);
    unset($categories[0]);
    $categories[0] = Lang::t('_TEST_TOTAL_SCORE', 'test');
    $res .= getTitleArea(array($back_link_url => Lang::t('_TEST_SECTION', 'test'), Lang::t('_FEEDBACK_MANAGEMENT', 'test')), 'test') . '<div class="std_block">' . getBackUi($back_link_url, Lang::t('_BACK'));
    if (empty($categories)) {
        $res .= Lang::t('_NO_CATEGORIES_AVAILABLE');
    } else {
        $asrule = new AssessmentRuleManager($id_test);
        $data = $asrule->getRules();
        $first = TRUE;
        foreach ($categories as $cat_id => $category) {
            if ($first) {
                $first = FALSE;
            } else {
                $res .= '<br /><br />';
            }
            $res .= '<p>' . ($cat_id > 0 ? Lang::t('_TEST_QUEST_CATEGORY', 'test') . ': ' : '') . '<b>' . $category . '</b></p>';
            if (isset($data[$cat_id])) {
                $tb = new Table(0, false);
                $tb->addHead(array(Lang::t('_SCORE', 'test'), Lang::t('_FEEDBACK_TEXT', 'test'), Get::sprite('subs_mod', Lang::t('_MOD', 'standard'), Lang::t('_MOD', 'standard')), Get::sprite('subs_del', Lang::t('_DEL', 'standard'), Lang::t('_DEL', 'standard'))), array('', '', 'image', 'image'));
                foreach ($data[$cat_id] as $row) {
                    $row_ln = array();
                    $row_ln[] = $row['from_score'] . ' - ' . $row['to_score'];
                    $row_ln[] = $row['feedback_txt'];
                    $row_ln[] = '<a class="ico-sprite subs_mod" href="' . $url_base . 'editfbkrule&item_id=' . $row['rule_id'] . '"><span></span></a>';
                    $row_ln[] = '<a id="del_rule_' . $row['rule_id'] . '" class="ico-sprite subs_del" href="' . $url_base . 'delfbkrule&item_id=' . $row['rule_id'] . '"><span></span></a>';
                    $tb->addBody($row_ln);
                }
                //$tb->addActionAdd('<a href="'.$url_base.'addfbkrule&cat_id='.$cat_id.'" class="ico-wt-sprite subs_add"><span>'.Lang::t('_ADD', 'test').'</span></a>');
                $res .= $tb->getTable();
            }
            $res .= '<div class="table-container-below">' . '<a href="' . $url_base . 'addfbkrule&cat_id=' . $cat_id . '" class="ico-wt-sprite subs_add"><span>' . Lang::t('_ADD', 'test') . '</span></a>' . '</div>';
        }
    }
    $res .= getBackUi($back_link_url, Lang::t('_BACK')) . '</div>';
    require_once _base_ . '/lib/lib.dialog.php';
    setupHrefDialogBox('a[id^=del_rule_]');
    $GLOBALS['page']->add($res, 'content');
}
Beispiel #6
0
 /**
  * this function modify a question
  * 
  * @param  string	$back_poll	indicates the return url
  * @return nothing
  * 
  * @access public
  * @author Fabio Pirovano (fabio@docebo.com)
  */
 function edit($back_poll)
 {
     $lang =& DoceboLanguage::createInstance('poll');
     require_once _base_ . '/lib/lib.form.php';
     $url_encode = htmlentities(urlencode($back_poll));
     //manage number of answer
     $num_answer = importVar('num_answer', true, 2);
     if (isset($_POST['more_answer'])) {
         ++$num_answer;
     }
     if (isset($_POST['less_answer']) && $num_answer > 1) {
         --$num_answer;
     }
     if (isset($_POST['save_question'])) {
         //update question
         $ins_query = "\r\n\t\t\tUPDATE " . $GLOBALS['prefix_lms'] . "_pollquest\r\n\t\t\tSET id_category = '" . (int) $_POST['id_category'] . "', \r\n\t\t\t\ttype_quest = '" . $this->getQuestionType() . "', \r\n\t\t\t\ttitle_quest = '" . $_POST['title_quest'] . "' \r\n\t\t\tWHERE id_quest = '" . (int) $this->id . "'";
         if (!sql_query($ins_query)) {
             getErrorUi($lang->def('_POLL_ERR_INS_QUEST') . getBackUi('index.php?modname=question_poll&amp;op=edit&amp;type_quest=' . $this->getQuestionType() . '&amp;id_quest=' . $this->id . '&amp;back_poll=' . $url_encode, $lang->def('_BACK')));
         }
         //update answer
         if (!isset($_POST['is_correct'])) {
             $_POST['is_correct'] = -1;
         }
         //find saved answer
         $re_answer = sql_query("\r\n\t\t\tSELECT id_answer\r\n\t\t\tFROM " . $GLOBALS['prefix_lms'] . "_pollquestanswer \r\n\t\t\tWHERE id_quest = '" . (int) $this->id . "'");
         while (list($id_a) = sql_fetch_row($re_answer)) {
             $existent_answer[$id_a] = 1;
         }
         for ($i = 0; $i < $num_answer; $i++) {
             //scannig answer
             if (isset($_POST['answer_id'][$i])) {
                 //must update
                 $id_answer = $_POST['answer_id'][$i];
                 if (isset($existent_answer[$id_answer])) {
                     unset($existent_answer[$id_answer]);
                 }
                 $upd_ans_query = "\r\n\t\t\t\t\tUPDATE " . $GLOBALS['prefix_lms'] . "_pollquestanswer \r\n\t\t\t\t\tSET answer = '" . $_POST['answer'][$i] . "'\r\n\t\t\t\t\tWHERE id_answer = '" . (int) $id_answer . "'";
                 if (!sql_query($upd_ans_query)) {
                     getErrorUi($lang->def('_POLL_ERR_INS_ANSWER') . getBackUi(Util::str_replace_once('&', '&amp;', $back_poll), $lang->def('_BACK')));
                 }
             } else {
                 //insert new answer
                 $ins_answer_query = "\r\n\t\t\t\t\tINSERT INTO " . $GLOBALS['prefix_lms'] . "_pollquestanswer \r\n\t\t\t\t\t( id_quest, answer, sequence ) VALUES\r\n\t\t\t\t\t( \t'" . $this->id . "', \r\n\t\t\t\t\t\t'" . $_POST['answer'][$i] . "',\r\n\t\t\t\t\t\t'" . $i . "' ) ";
                 if (!sql_query($ins_answer_query)) {
                     getErrorUi($lang->def('_POLL_ERR_INS_ANSWER') . getBackUi(Util::str_replace_once('&', '&amp;', $back_poll), $lang->def('_BACK')));
                 }
             }
         }
         while (list($idA) = each($existent_answer)) {
             //i must delete these answer
             $del_answer_query = "\r\n\t\t\t\tDELETE FROM " . $GLOBALS['prefix_lms'] . "_pollquestanswer\r\n\t\t\t\tWHERE id_quest = '" . (int) $this->id . "' AND id_answer = '" . (int) $idA . "'";
             if (!sql_query($del_answer_query)) {
                 getErrorUi($lang->def('_POLL_ERR_INS_ANSWER') . getBackUi(Util::str_replace_once('&', '&amp;', $back_poll), $lang->def('_BACK')));
             }
         }
         //back to question list
         Util::jump_to('' . $back_poll);
     }
     //insert form
     require_once $GLOBALS['where_lms'] . '/lib/lib.questcategory.php';
     $categories = Questcategory::getCategory();
     //writing difficult
     //load data
     if (!isset($_POST['answer_id'])) {
         list($sel_cat, $quest) = sql_fetch_row(sql_query("\r\n\t\t\tSELECT id_category, title_quest \r\n\t\t\tFROM " . $GLOBALS['prefix_lms'] . "_pollquest \r\n\t\t\tWHERE id_quest = '" . (int) $this->id . "'"));
         $re_answer = sql_query("\r\n\t\t\tSELECT id_answer, answer \r\n\t\t\tFROM " . $GLOBALS['prefix_lms'] . "_pollquestanswer \r\n\t\t\tWHERE id_quest = '" . (int) $this->id . "'\r\n\t\t\tORDER BY sequence");
         $i_load = 0;
         while (list($_POST['answer_id'][$i_load], $_POST['answer'][$i_load]) = sql_fetch_row($re_answer)) {
             ++$i_load;
         }
         $num_answer = $i_load;
     }
     $GLOBALS['page']->add(getTitleArea($lang->def('_POLL_SECTION'), 'poll') . '<div class="std_block">' . getBackUi(Util::str_replace_once('&', '&amp;', $back_poll), $lang->def('_BACK')) . '<div class="title_big">' . $lang->def('_QUEST_ACRN_' . strtoupper($this->getQuestionType())) . ' - ' . $lang->def('_QUEST_' . strtoupper($this->getQuestionType())) . '</div><br />' . Form::openForm('form_add_quest', 'index.php?modname=question_poll&amp;op=edit') . Form::openElementSpace() . Form::getHidden('type_quest', 'type_quest', $this->getQuestionType()) . Form::getHidden('id_quest', 'id_quest', $this->id) . Form::getHidden('back_poll', 'back_poll', $url_encode) . Form::getHidden('num_answer', 'num_answer', $num_answer) . Form::getTextarea($lang->def('_POLL_QUEST_TITLE'), 'title_quest', 'title_quest', isset($_POST['title_quest']) ? stripslashes($_POST['title_quest']) : $quest) . Form::getDropdown($lang->def('_CATEGORY'), 'id_category', 'id_category', $categories, isset($_POST['id_category']) ? $_POST['id_category'] : $sel_cat) . '<div class="nofloat"></div><br />', 'content');
     $GLOBALS['page']->add('<table class="test_answer" cellspacing="0" summary="' . $lang->def('_POLL_ANSWER_SUMMARY') . '">' . "\n" . '<caption>' . $lang->def('_ANSWER') . '</caption>' . "\n" . '<tr>' . '<th>' . $lang->def('_ANSWER') . '</th>' . '</tr>' . "\n", 'content');
     for ($i = 0; $i < $num_answer; $i++) {
         $this->_lineModAnswer($i);
     }
     $GLOBALS['page']->add('</table>' . Form::getButton('more_answer', 'more_answer', $lang->def('_POLL_ADD_ONE_ANSWER'), 'button_nowh'), 'content');
     if ($num_answer > 1) {
         $GLOBALS['page']->add(Form::getButton('less_answer', 'less_answer', $lang->def('_POLL_SUB_ONE_ANSWER'), 'button_nowh'), 'content');
     }
     $GLOBALS['page']->add(Form::closeElementSpace() . Form::openButtonSpace() . Form::getButton('save_question', 'save_question', $lang->def('_SAVE')) . Form::closeButtonSpace() . Form::closeForm() . '</div>', 'content');
 }
 /**
  * this function modify a question
  * 
  * @param  string	$back_test	indicates the return url
  * @return nothing
  * 
  * @access public
  * @author Fabio Pirovano (fabio@docebo.com)
  */
 function edit($back_test)
 {
     $lang =& DoceboLanguage::createInstance('test');
     require_once _base_ . '/lib/lib.form.php';
     $url_encode = htmlentities(urlencode($back_test));
     //manage number of answer
     $num_answer = importVar('num_answer', true, 2);
     if (isset($_POST['more_answer'])) {
         ++$num_answer;
     }
     if (isset($_POST['less_answer']) && $num_answer > 1) {
         --$num_answer;
     }
     if (isset($_POST['add_question'])) {
         //update question
         $ins_query = "\r\n\t\t\tUPDATE " . $GLOBALS['prefix_lms'] . "_testquest\r\n\t\t\tSET idCategory = '" . (int) $_POST['idCategory'] . "', \r\n\t\t\t\ttype_quest = '" . $this->getQuestionType() . "', \r\n\t\t\t\ttitle_quest = '" . $_POST['title_quest'] . "', \r\n\t\t\t\tdifficult = '" . (int) $_POST['difficult'] . "', \r\n\t\t\t\ttime_assigned = '" . (int) $_POST['time_assigned'] . "',\r\n\t\t\t\tshuffle = '" . (isset($_POST['shuffle']) ? 1 : 0) . "'\r\n\t\t\tWHERE idQuest = '" . (int) $this->id . "'";
         if (!sql_query($ins_query)) {
             $GLOBALS['page']->add(getErrorUi($lang->def('_OPERATION_FAILURE') . getBackUi('index.php?modname=question&amp;op=edit&amp;type_quest=' . $this->getQuestionType() . '&amp;idQuest=' . $this->id . '&amp;back_test=' . $url_encode, $lang->def('_BACK'))), 'content');
         }
         //update answer
         if (!isset($_POST['is_correct'])) {
             $_POST['is_correct'] = -1;
         }
         //find saved answer
         $re_answer = sql_query("\r\n\t\t\tSELECT idAnswer \r\n\t\t\tFROM " . $GLOBALS['prefix_lms'] . "_testquestanswer \r\n\t\t\tWHERE idQuest = '" . (int) $this->id . "'");
         while (list($id_a) = sql_fetch_row($re_answer)) {
             $existent_answer[$id_a] = 1;
         }
         for ($i = 0; $i < $num_answer; $i++) {
             //scannig answer
             if (isset($_POST['answer_id'][$i])) {
                 //must update
                 $idAnswer = $_POST['answer_id'][$i];
                 if (isset($existent_answer[$idAnswer])) {
                     unset($existent_answer[$idAnswer]);
                 }
                 $upd_ans_query = "\r\n\t\t\t\t\tUPDATE " . $GLOBALS['prefix_lms'] . "_testquestanswer \r\n\t\t\t\t\tSET is_correct = '" . (isset($_POST['is_correct'][$i]) ? 1 : 0) . "',\r\n\t\t\t\t\t\tanswer = '" . $_POST['answer'][$i] . "',\r\n\t\t\t\t\t\tcomment = '" . $_POST['comment'][$i] . "',\r\n\t\t\t\t\t\tscore_correct = '" . $this->_checkScore($_POST['score_correct'][$i]) . "', \r\n\t\t\t\t\t\tscore_incorrect = '" . $this->_checkScore($_POST['score_incorrect'][$i]) . "'\r\n\t\t\t\t\tWHERE idAnswer = '" . (int) $idAnswer . "'";
                 if (!sql_query($upd_ans_query)) {
                     $GLOBALS['page']->add(getErrorUi($lang->def('_OPERATION_FAILURE') . getBackUi(Util::str_replace_once('&', '&amp;', $back_test), $lang->def('_BACK'))), 'content');
                 }
             } else {
                 //insert new answer
                 $ins_answer_query = "\r\n\t\t\t\t\tINSERT INTO " . $GLOBALS['prefix_lms'] . "_testquestanswer \r\n\t\t\t\t\t( idQuest, is_correct, \r\n\t\t\t\t\t\tanswer, comment,\r\n\t\t\t\t\t\tscore_correct, score_incorrect ) VALUES\r\n\t\t\t\t\t( '" . $this->id . "', '" . (isset($_POST['is_correct'][$i]) ? 1 : 0) . "', \r\n\t\t\t\t\t\t'" . $_POST['answer'][$i] . "', '" . $_POST['comment'][$i] . "', \r\n\t\t\t\t\t\t'" . $this->_checkScore($_POST['score_correct'][$i]) . "', \r\n\t\t\t\t\t\t'" . $this->_checkScore($_POST['score_incorrect'][$i]) . "') ";
                 if (!sql_query($ins_answer_query)) {
                     $GLOBALS['page']->add(getErrorUi($lang->def('_OPERATION_FAILURE') . getBackUi(Util::str_replace_once('&', '&amp;', $back_test), $lang->def('_BACK'))), 'content');
                 }
             }
         }
         while (list($idA) = each($existent_answer)) {
             //i must delete these answer
             $del_answer_query = "\r\n\t\t\t\tDELETE FROM " . $GLOBALS['prefix_lms'] . "_testquestanswer\r\n\t\t\t\tWHERE idQuest = '" . (int) $this->id . "' AND idAnswer = '" . (int) $idA . "'";
             if (!sql_query($del_answer_query)) {
                 $GLOBALS['page']->add(getErrorUi($lang->def('_OPERATION_FAILURE') . getBackUi(Util::str_replace_once('&', '&amp;', $back_test), $lang->def('_BACK'))), 'content');
             }
         }
         //back to question list
         Util::jump_to('' . $back_test);
     }
     require_once $GLOBALS['where_lms'] . '/lib/lib.questcategory.php';
     $categories = Questcategory::getCategory();
     //writing difficult array
     $arr_dufficult = array(5 => '5 - ' . $lang->def('_VERY_HARD'), 4 => '4 - ' . $lang->def('_HARD'), 3 => '3 - ' . $lang->def('_DIFFICULT_MEDIUM'), 2 => '2 - ' . $lang->def('_DIFFICULT_EASY'), 1 => '1 - ' . $lang->def('_DIFFICULT_VERYEASY'));
     //load data
     if (!isset($_POST['answer_id'])) {
         list($sel_cat, $quest, $sel_diff, $sel_time, $shuffle) = sql_fetch_row(sql_query("\r\n\t\t\tSELECT idCategory, title_quest, difficult, time_assigned, shuffle \r\n\t\t\tFROM " . $GLOBALS['prefix_lms'] . "_testquest \r\n\t\t\tWHERE idQuest = '" . (int) $this->id . "'"));
         $re_answer = sql_query("\r\n\t\t\tSELECT idAnswer, is_correct, answer, comment, score_correct, score_incorrect \r\n\t\t\tFROM " . $GLOBALS['prefix_lms'] . "_testquestanswer \r\n\t\t\tWHERE idQuest = '" . (int) $this->id . "'\r\n\t\t\tORDER BY idAnswer");
         $i_load = 0;
         while (list($_POST['answer_id'][$i_load], $is_correct, $_POST['answer'][$i_load], $_POST['comment'][$i_load], $_POST['score_correct'][$i_load], $_POST['score_incorrect'][$i_load]) = sql_fetch_row($re_answer)) {
             if ($is_correct) {
                 $_POST['is_correct'][$i_load] = 1;
             }
             ++$i_load;
         }
         $num_answer = $i_load;
     }
     $GLOBALS['page']->add(getTitleArea($lang->def('_TEST_SECTION'), 'test') . '<div class="std_block">' . getBackUi(Util::str_replace_once('&', '&amp;', $back_test), $lang->def('_BACK')) . '<div class="title_big">' . $lang->def('_QUEST_ACRN_' . strtoupper($this->getQuestionType())) . ' - ' . $lang->def('_QUEST_' . strtoupper($this->getQuestionType())) . '</div><br />' . Form::openForm('form_add_quest', 'index.php?modname=question&amp;op=edit') . Form::openElementSpace() . Form::getHidden('type_quest', 'type_quest', $this->getQuestionType()) . Form::getHidden('idQuest', 'idQuest', $this->id) . Form::getHidden('back_test', 'back_test', $url_encode) . Form::getHidden('num_answer', 'num_answer', $num_answer) . Form::getTextarea($lang->def('_QUESTION'), 'title_quest', 'title_quest', isset($_POST['title_quest']) ? stripslashes($_POST['title_quest']) : $quest), 'content');
     if (count($categories) > 1) {
         $GLOBALS['page']->add(Form::getDropdown($lang->def('_TEST_QUEST_CATEGORY'), 'idCategory', 'idCategory', $categories, isset($_POST['idCategory']) ? $_POST['idCategory'] : $sel_cat), 'content');
     }
     $GLOBALS['page']->add(Form::getDropdown($lang->def('_DIFFICULTY'), 'difficult', 'difficult', $arr_dufficult, isset($_POST['difficult']) ? $_POST['difficult'] : $sel_diff) . Form::getCheckbox($lang->def('_TEST_QUEST_SHUFFLE'), 'shuffle', 'shuffle', '1', $shuffle) . Form::getTextfield($lang->def('_TEST_QUEST_TIMEASS'), 'time_assigned', 'time_assigned', 5, isset($_POST['time_assigned']) ? $_POST['time_assigned'] : $sel_time, $lang->def('_TEST_QUEST_TIMEASS'), $lang->def('_SECONDS')) . '<div class="nofloat"></div><br />' . '<table class="test_answer" cellspacing="0" summary="' . $lang->def('_TEST_ANSWER') . '">' . "\n" . '<caption>' . $lang->def('_TEST_ANSWER') . '</caption>' . "\n" . '<tr>' . '<th class="image">' . $lang->def('_TEST_CORRECT') . '</th>' . '<th>' . $lang->def('_TEST_TEXT_ANSWER') . '</th>' . '<th>' . $lang->def('_COMMENTS') . '</th>' . '<th colspan="2">' . $lang->def('_SCORE') . '</th>' . '</tr>' . "\n", 'content');
     for ($i = 0; $i < $num_answer; $i++) {
         $this->_lineModAnswer($i);
     }
     $GLOBALS['page']->add('</table>' . Form::getButton('more_answer', 'more_answer', $lang->def('_TEST_ADD_ONE_ANSWER'), 'button_nowh'), 'content');
     if ($num_answer > 1) {
         $GLOBALS['page']->add(Form::getButton('less_answer', 'less_answer', $lang->def('_TEST_SUB_ONE_ANSWER'), 'button_nowh'), 'content');
     }
     $GLOBALS['page']->add('' . Form::closeElementSpace() . Form::openButtonSpace() . Form::getButton('add_question', 'add_question', $lang->def('_SAVE')) . Form::closeButtonSpace() . Form::closeForm() . '</div>', 'content');
 }
 /**
  * function edit()
  *
  * @param $back_url	the url where the function retutn at the end of the operation
  * @return nothing
  */
 function edit($back_test)
 {
     $lang =& DoceboLanguage::createInstance('test');
     require_once _base_ . '/lib/lib.form.php';
     $url_encode = htmlentities(urlencode($back_test));
     if (isset($_POST['add_question'])) {
         //modify question
         if (substr_count($_POST['title_quest'], '[answer]') != 1) {
             errorCommunication($lang->def('_OPERATION_FAILURE') . getBackUi('index.php?modname=question&amp;op=create&amp;type_quest=' . $this->getQuestionType() . '&amp;idQuest=' . $this->id . '&amp;back_test=' . $url_encode, $lang->def('_BACK')));
         }
         $mod_query = "\r\n\t\t\tUPDATE " . $GLOBALS['prefix_lms'] . "_testquest \r\n\t\t\tSET idCategory = '" . $_POST['idCategory'] . "', \r\n\t\t\t\ttype_quest = '" . $this->getQuestionType() . "', \r\n\t\t\t\ttitle_quest = '" . $_POST['title_quest'] . "', \r\n\t\t\t\tdifficult = '" . $_POST['difficult'] . "',\r\n\t\t\t\ttime_assigned = '" . $_POST['time_assigned'] . "'\r\n\t\t\tWHERE idQuest = '" . (int) $this->id . "'";
         if (!sql_query($mod_query)) {
             errorCommunication($lang->def('_TEST_ERR_MOD_QUEST') . getBackUi('index.php?modname=question&amp;op=edit&amp;type_quest=' . $this->getQuestionType() . '&amp;idQuest=' . $this->id . '&amp;back_test=' . $url_encode, $lang->def('_BACK')));
         }
         //modify answer
         $mod_answer_query = "\r\n\t\t\tUPDATE " . $GLOBALS['prefix_lms'] . "_testquestanswer \r\n\t\t\tSET answer = '" . strtolower($_POST['answer']) . "',\r\n\t\t\t\tcomment = '" . $_POST['comment'] . "',\r\n\t\t\t\tscore_correct = '" . $this->_checkScore($_POST['score_correct']) . "', \r\n\t\t\t\tscore_incorrect = '" . $this->_checkScore($_POST['score_incorrect']) . "'\r\n\t\t\tWHERE idQuest = '" . (int) $this->id . "'";
         if (!sql_query($mod_answer_query)) {
             errorCommunication($lang->def('_OPERATION_FAILURE') . getBackUi(Util::str_replace_once('&', '&amp;', $back_test), $lang->def('_BACK')));
         }
         //back to quest list
         Util::jump_to('' . $back_test);
     }
     //finding categories
     require_once $GLOBALS['where_lms'] . '/lib/lib.questcategory.php';
     $categories = Questcategory::getCategory();
     //create array of difficult
     $arr_dufficult = array(5 => '5 - ' . $lang->def('_VERY_HARD'), 4 => '4 - ' . $lang->def('_HARD'), 3 => '3 - ' . $lang->def('_DIFFICULT_MEDIUM'), 2 => '2 - ' . $lang->def('_DIFFICULT_EASY'), 1 => '1 - ' . $lang->def('_DIFFICULT_VERYEASY'));
     //load data
     list($cat_sel, $title_quest, $diff_sel, $sel_time) = sql_fetch_row(sql_query("\r\n\t\tSELECT idCategory, title_quest, difficult, time_assigned\r\n\t\tFROM " . $GLOBALS['prefix_lms'] . "_testquest \r\n\t\tWHERE idQuest = '" . (int) $this->id . "'"));
     list($answer, $comment, $score_correct, $score_incorrect) = sql_fetch_row(sql_query("\r\n\t\tSELECT answer, comment, score_correct, score_incorrect \r\n\t\tFROM " . $GLOBALS['prefix_lms'] . "_testquestanswer \r\n\t\tWHERE idQuest = '" . (int) $this->id . "'"));
     //drawing form
     $GLOBALS['page']->add(getTitleArea($lang->def('_TEST_SECTION'), 'test') . '<div class="std_block">' . getBackUi(Util::str_replace_once('&', '&amp;', $back_test), $lang->def('_BACK')) . '<div class="title_big">' . $lang->def('_QUEST_ACRN_' . strtoupper($this->getQuestionType())) . ' - ' . $lang->def('_QUEST_' . strtoupper($this->getQuestionType())) . '</div><br />' . Form::openForm('form_mod_quest', 'index.php?modname=question&amp;op=edit') . Form::openElementSpace() . Form::getHidden('type_quest', 'type_quest', $this->getQuestionType()) . Form::getHidden('idQuest', 'idQuest', $this->id) . Form::getHidden('back_test', 'back_test', $url_encode) . Form::getTextarea($lang->def('_QUESTION'), 'title_quest', 'title_quest', $title_quest), 'content');
     if (count($categories) > 1) {
         $GLOBALS['page']->add(Form::getDropdown($lang->def('_TEST_QUEST_CATEGORY'), 'idCategory', 'idCategory', $categories, isset($_POST['idCategory']) ? $_POST['idCategory'] : $cat_sel), 'content');
     }
     $GLOBALS['page']->add(Form::getDropdown($lang->def('_DIFFICULTY'), 'difficult', 'difficult', $arr_dufficult, $diff_sel) . Form::getTextfield($lang->def('_TEST_QUEST_TIMEASS'), 'time_assigned', 'time_assigned', 5, isset($_POST['time_assigned']) ? $_POST['time_assigned'] : $sel_time, $lang->def('_TEST_QUEST_TIMEASS'), $lang->def('_SECONDS')) . '<div class="nofloat"></div><br />' . '<table class="test_answer"  summary="' . $lang->def('_TEST_ANSWER') . '">' . "\n" . '<caption>' . $lang->def('_TEST_ANSWER') . '</caption>' . "\n" . '<tr>' . "\n" . '<th class="image">' . $lang->def('_TEST_CORRECT') . '</th>' . '<th><label for="answer">' . $lang->def('_TEST_TEXT_ANSWER') . '</label></th>' . '<th><label for="comment">' . $lang->def('_COMMENTS') . '</label></th>' . '<th colspan="2">' . $lang->def('_SCORE') . '</th>' . '</tr>' . "\n" . '<tr class="line_answer">' . "\n" . '<td rowspan="2" class="align_center">' . '<img src="' . getPathImage() . 'test/correct.gif" alt="' . $lang->def('_TEST_ISCORRECT') . '" />' . '</td>' . '<td rowspan="2">' . '<input type="text" class="test_text_anwer" id="answer" name="answer" alt="' . $lang->def('_TEST_TEXT_ANSWER') . '" maxlength="255" value="' . $answer . '" />' . '</td>' . '<td rowspan="2" class="image">' . '<textarea class="test_comment" id="comment" name="comment" cols="14" rows="3">' . $comment . '</textarea>' . '</td>' . '<td class="test_ifcorrect">' . '<label for="score_correct">' . $lang->def('_TEST_IFCORRECT') . '</label>' . '</td>' . '<td class="align_right">' . '<input type="text" class="test_point" id="score_correct" name="score_correct" alt="' . $lang->def('_TEST_IFCORRECT') . '" size="5" value="' . $score_correct . '" />' . '</td>' . '</tr>' . "\n" . '<tr class="line_answer">' . "\n" . '<td class="test_ifcorrect">' . '<label for="score_incorrect">' . $lang->def('_TEST_IFINCORRECT') . '</label>' . '</td>' . '<td class="align_right">' . '- <input type="text" class="test_point" id="score_incorrect" name="score_incorrect" alt="' . $lang->def('_TEST_IFINCORRECT') . '" size="5"  value="' . $score_incorrect . '" />' . '</td>' . '</tr>' . "\n" . '</table>' . "\n" . Form::closeElementSpace() . Form::openButtonSpace() . Form::getButton('add_question', 'add_question', $lang->def('_SAVE')) . Form::closeButtonSpace() . Form::closeForm() . '</div>', 'content');
 }
Beispiel #9
0
function importquest(&$url)
{
    require_once _lib_ . '/lib.form.php';
    $lang =& DoceboLanguage::createInstance('test');
    $form = new Form();
    require_once _lms_ . '/lib/lib.quest_bank.php';
    $qb_man = new QuestBankMan();
    $supported_format = array_flip($qb_man->supported_format());
    require_once _lms_ . '/lib/lib.questcategory.php';
    $quest_categories = array(0 => $lang->def('_NONE'));
    $cman = new Questcategory();
    $arr = $cman->getCategory();
    foreach ($arr as $id_category => $name_category) {
        $quest_categories[$id_category] = $name_category;
    }
    unset($arr);
    $title = array($url->getUrl() => $lang->def('_QUEST_BANK', 'menu_course'), $lang->def('_IMPORT'));
    cout(getTitleArea($title, 'quest_bank') . '<div class="std_block">' . $form->openForm('import_form', $url->getUrl('op=doimportquest'), false, false, 'multipart/form-data') . $form->openElementSpace() . $form->getFilefield($lang->def('_FILE'), 'import_file', 'import_file') . $form->getRadioSet($lang->def('_FILE_FORMAT'), 'file_format', 'file_format', $supported_format, 0) . $form->getTextfield($lang->def('_FILE_ENCODE'), 'file_encode', 'file_encode', 255, 'utf-8') . $form->getDropdown($lang->def('_QUEST_CATEGORY'), 'quest_category', 'quest_category', $quest_categories) . $form->closeElementSpace() . $form->openButtonSpace() . $form->getButton('undo', 'undo', $lang->def('_UNDO')) . $form->getButton('quest_search', 'quest_search', $lang->def('_IMPORT')) . $form->closeButtonSpace() . $form->closeForm() . '</div>', 'content');
}