本文整理汇总了PHP中Question::get_question_type_list方法的典型用法代码示例。如果您正苦于以下问题:PHP Question::get_question_type_list方法的具体用法?PHP Question::get_question_type_list怎么用?PHP Question::get_question_type_list使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Question
的用法示例。
在下文中一共展示了Question::get_question_type_list方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: check_question_type
function check_question_type($parameter)
{
$question_list = Question::get_question_type_list();
foreach ($question_list as $key => $value) {
$valid_question_types[] = $key;
}
if (in_array($parameter, $valid_question_types)) {
return true;
} else {
return false;
}
}
示例2: getRules
/**
* @param string $courseCode
* @param array $rules
* @param array $columns
* @param array $column_model
* @return array
*/
public static function getRules($courseCode, &$rules, &$columns, &$column_model, $questionFields, $checkFields = false)
{
// sessions
// course
// categories
// exercises
// difficult
// type
if (empty($courseCode)) {
// Session.
$sessionList = SessionManager::get_sessions_by_general_coach(api_get_user_id());
$fields = array();
if (!empty($sessionList)) {
$new_options = array();
$new_options[] = "-1:" . get_lang('All');
foreach ($sessionList as $session) {
$new_options[] = "{$session['id']}:{$session['name']}";
}
$string = implode(';', $new_options);
$fields[] = array('field_display_text' => get_lang('Session'), 'field_variable' => 'session_id', 'field_type' => ExtraField::FIELD_TYPE_SELECT, 'field_default_value' => null, 'field_options' => $string);
}
} else {
// $courseList = array(api_get_course_info());
//$courseList = CourseManager::get_course_list_of_user_as_course_admin(api_get_user_id());
}
// Courses.
$courseList = CourseManager::get_course_list_of_user_as_course_admin(api_get_user_id());
if (!empty($courseList)) {
$new_options = array();
$new_options[] = "-1:" . get_lang('All');
foreach ($courseList as $course) {
$new_options[] = "{$course['id']}:{$course['title']}";
}
$string = implode(';', $new_options);
$fields[] = array('field_display_text' => get_lang('Course'), 'field_variable' => 'c_id', 'field_type' => ExtraField::FIELD_TYPE_SELECT, 'field_default_value' => null, 'field_options' => $string);
}
// Categories.
$string = null;
if (!empty($courseList)) {
$new_options = array();
$new_options[] = "-1:" . get_lang('All');
// Global categories
// @todo use tree view
$categories = Testcategory::getCategoriesIdAndName(0);
if (!empty($categories)) {
foreach ($categories as $id => $category) {
if (!empty($id)) {
$new_options[] = "{$id}:[Global] - " . $category;
}
}
}
foreach ($courseList as $course) {
$categories = Testcategory::getCategoriesIdAndName($course['real_id']);
if (!empty($categories)) {
foreach ($categories as $id => $category) {
if (!empty($id)) {
$new_options[] = "{$id}:" . $course['title'] . " - " . $category;
}
}
}
}
$string = implode(';', $new_options);
$fields[] = array('field_display_text' => get_lang('Category'), 'field_variable' => 'category_id', 'field_type' => ExtraField::FIELD_TYPE_SELECT, 'field_default_value' => null, 'field_options' => $string);
}
$course = api_get_course_int_id();
$sessionId = api_get_session_id();
// Exercises.
$exerciseList = ExerciseLib::get_all_exercises_for_course_id($sessionId, $course);
if (!empty($exerciseList)) {
$new_options = array();
$new_options[] = "-1:" . get_lang('All');
$new_options[] = "0:" . get_lang('Orphan');
foreach ($exerciseList as $exercise) {
$new_options[] = "{$exercise['iid']}:{$exercise['title']}";
}
$string = implode(';', $new_options);
$fields[] = array('field_display_text' => get_lang('Exercise'), 'field_variable' => 'exercise_id', 'field_type' => ExtraField::FIELD_TYPE_SELECT, 'field_default_value' => null, 'field_options' => $string);
}
// Question type.
$questionList = Question::get_question_type_list();
if (!empty($questionList)) {
$new_options = array();
$new_options[] = "-1:" . get_lang('All');
foreach ($questionList as $key => $question) {
$new_options[] = "{$key}:" . get_lang($question['1']);
}
$string = implode(';', $new_options);
$fields[] = array('field_display_text' => get_lang('AnswerType'), 'field_variable' => 'question_type', 'field_type' => ExtraField::FIELD_TYPE_SELECT, 'field_default_value' => null, 'field_options' => $string);
}
// Difficult.
$levels = Question::get_default_levels();
if (!empty($levels)) {
$new_options = array();
//.........这里部分代码省略.........
示例3: reset_menu_lvl_type
$my_exercise_list[$row['id']] = "> ";
}
$my_exercise_list[$row['id']] .= $row['title'];
}
}
if ($exercice_id_changed == 1) {
reset_menu_lvl_type();
}
$select_exercise_html = Display::select('exerciseId', $my_exercise_list, $exerciseId, array('class' => 'chzn-select', 'onchange' => 'mark_exercice_id_changed(); submit_form(this);'), false);
echo Display::form_row(get_lang('Exercise'), $select_exercise_html);
// Difficulty list (only from 0 to 5)
$levels = array(-1 => get_lang('All'), 0 => 0, 1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5);
$select_difficulty_html = Display::select('exerciseLevel', $levels, $exerciseLevel, array('class' => 'chzn-select', 'onchange' => 'submit_form(this);'), false);
echo Display::form_row(get_lang('Difficulty'), $select_difficulty_html);
// Answer type
$question_list = Question::get_question_type_list();
$new_question_list = array();
$new_question_list['-1'] = get_lang('All');
if (!empty($_course)) {
$objExercise = new Exercise();
$objExercise->read($fromExercise);
foreach ($question_list as $key => $item) {
if ($objExercise->feedback_type == EXERCISE_FEEDBACK_TYPE_DIRECT) {
if (!in_array($key, array(HOT_SPOT_DELINEATION, UNIQUE_ANSWER))) {
continue;
}
$new_question_list[$key] = get_lang($item[1]);
} else {
if ($key == HOT_SPOT_DELINEATION) {
continue;
}
示例4: get_type_icon_html
/**
* @return array the image filename of the question type
*/
public function get_type_icon_html()
{
$type = $this->selectType();
$tabQuestionList = Question::get_question_type_list();
// [0]=file to include [1]=type name
require_once $tabQuestionList[$type][0];
$img = $explanation = null;
eval('$img = ' . $tabQuestionList[$type][1] . '::$typePicture;');
eval('$explanation = get_lang(' . $tabQuestionList[$type][1] . '::$explanationLangVar);');
return array($img, $explanation);
}
示例5: api_get_self
$objQuestion = Question::getInstance($_REQUEST['answerType']);
$action = api_get_self() . "?" . api_get_cidreq() . "&modifyQuestion=" . $modifyQuestion . "&newQuestion=" . $newQuestion;
}
if (is_object($objQuestion)) {
// FORM CREATION
$form = new FormValidator('question_admin_form', 'post', $action);
if (isset($_GET['editQuestion'])) {
$class = "btn btn-default";
$text = get_lang('ModifyQuestion');
$type = isset($_GET['type']) ? Security::remove_XSS($_GET['type']) : null;
} else {
$class = "btn btn-default";
$text = get_lang('AddQuestionToExercise');
$type = $_REQUEST['answerType'];
}
$typesInformation = Question::get_question_type_list();
$form_title_extra = isset($typesInformation[$type][1]) ? get_lang($typesInformation[$type][1]) : null;
// form title
$form->addElement('header', $text . ': ' . $form_title_extra);
// question form elements
$objQuestion->createForm($form);
// answer form elements
$objQuestion->createAnswersForm($form);
// this variable $show_quiz_edition comes from admin.php blocks the exercise/quiz modifications
if ($objExercise->edit_exercise_in_lp == false) {
$form->freeze();
}
// FORM VALIDATION
if (isset($_POST['submitQuestion']) && $form->validate()) {
// question
$objQuestion->processCreation($form, $objExercise);