/** * Build a list of available exercises that wil be used by claro_html_form_select to show a filter list * @param $excludeId an exercise id that doesn't have to be shown in filter list * @return array 2d array where keys are the exercise name and value is the exercise id * @author Sebastien Piraux <*****@*****.**> */ function get_filter_list($excludeId = '') { $tbl_cdb_names = get_module_course_tbl(array('qwz_exercise'), claro_get_current_course_id()); $tbl_quiz_exercise = $tbl_cdb_names['qwz_exercise']; $filterList[get_lang('All exercises')] = 'all'; $filterList[get_lang('Orphan questions')] = 'orphan'; // get exercise list $sql = "SELECT `id`, `title`\n FROM `" . $tbl_quiz_exercise . "`\n ORDER BY `title`"; $exerciseList = claro_sql_query_fetch_all($sql); if (is_array($exerciseList) && !empty($exerciseList)) { foreach ($exerciseList as $anExercise) { if ($excludeId != $anExercise['id']) { $filterList[$anExercise['title']] = $anExercise['id']; } } } $questionCategoryList = getQuestionCategoryList(); // category foreach ($questionCategoryList as $category) { $filterList[get_lang('Category') . ' ' . $category['title']] = 'categoryId' . $category['id']; } return $filterList; }
//ClaroBreadCrumbs::getInstance()->prepend( get_lang('Exercise'), './edit_exercise.php?exId='.$exId ); } else { ClaroBreadCrumbs::getInstance()->prepend(get_lang('Question pool'), Url::Contextualize('./question_pool.php')); } ClaroBreadCrumbs::getInstance()->prepend(get_lang('Exercises'), Url::Contextualize(get_module_url('CLQWZ') . '/exercise.php')); // Command list $cmdList = array(); $cmdList[] = array('img' => 'edit', 'name' => get_lang('Edit question'), 'url' => claro_htmlspecialchars(Url::Contextualize('./edit_question.php?exId=' . $exId . '&cmd=rqEdit&quId=' . $quId))); $cmdList[] = array('img' => 'edit', 'name' => get_lang('Edit answers'), 'url' => claro_htmlspecialchars(Url::Contextualize('./edit_answers.php?exId=' . $exId . '&cmd=rqEdit&quId=' . $quId))); $cmdList[] = array('img' => 'default_new', 'name' => get_lang('New question'), 'url' => claro_htmlspecialchars(Url::Contextualize('./edit_question.php?exId=' . $exId . '&cmd=rqEdit'))); $out = ''; $out .= claro_html_tool_title($nameTools, null, $cmdList); // dialog box if required $out .= $dialogBox->render(); $localizedQuestionType = get_localized_question_type(); if ($displayForm) { //-- edit form $display = new ModuleTemplate('CLQWZ', 'question_form.tpl.php'); $display->assign('question', $question); $display->assign('exId', $exId); $display->assign('data', $form); $display->assign('relayContext', claro_form_relay_context()); $display->assign('askDuplicate', $askDuplicate); $display->assign('categoryList', getQuestionCategoryList()); $display->assign('questionType', get_localized_question_type()); $out .= $display->render(); } else { $out .= $question->getQuestionAnswerHtml(); } $claroline->display->body->appendContent($out); echo $claroline->display->render();