当前位置: 首页>>代码示例>>PHP>>正文


PHP Question::get_default_levels方法代码示例

本文整理汇总了PHP中Question::get_default_levels方法的典型用法代码示例。如果您正苦于以下问题:PHP Question::get_default_levels方法的具体用法?PHP Question::get_default_levels怎么用?PHP Question::get_default_levels使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Question的用法示例。


在下文中一共展示了Question::get_default_levels方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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();
//.........这里部分代码省略.........
开发者ID:ragebat,项目名称:chamilo-lms,代码行数:101,代码来源:question.class.php

示例2: createForm

    /**
     * Creates the form to create / edit a question
     * A subclass can redefine this function to add fields...
     * @param FormValidator $form
     */
    public function createForm(&$form)
    {
        echo '<style>
                .media { display:none;}
            </style>';
        echo '<script>
        // hack to hide http://cksource.com/forums/viewtopic.php?f=6&t=8700
        function FCKeditor_OnComplete( editorInstance ) {
            if (document.getElementById ( \'HiddenFCK\' + editorInstance.Name)) {
                HideFCKEditorByInstanceName (editorInstance.Name);
            }
        }

        function HideFCKEditorByInstanceName ( editorInstanceName ) {
            if (document.getElementById ( \'HiddenFCK\' + editorInstanceName ).className == "HideFCKEditor" ) {
                document.getElementById ( \'HiddenFCK\' + editorInstanceName ).className = "media";
            }
        }
        </script>';
        // question name
        $form->addElement('text', 'questionName', get_lang('Question'));
        $form->addRule('questionName', get_lang('GiveQuestion'), 'required');
        // default content
        $isContent = isset($_REQUEST['isContent']) ? intval($_REQUEST['isContent']) : null;
        // Question type
        $answerType = isset($_REQUEST['answerType']) ? intval($_REQUEST['answerType']) : null;
        $form->addElement('hidden', 'answerType', $answerType);
        // html editor
        $editorConfig = array('ToolbarSet' => 'TestQuestionDescription', 'Height' => '150');
        if (!api_is_allowed_to_edit(null, true)) {
            $editorConfig['UserStatus'] = 'student';
        }
        $form->addButtonAdvancedSettings('advanced_params');
        $form->addElement('html', '<div id="advanced_params_options" style="display:none">');
        $form->addHtmlEditor('questionDescription', get_lang('QuestionDescription'), false, false, $editorConfig);
        // hidden values
        $my_id = isset($_REQUEST['myid']) ? intval($_REQUEST['myid']) : null;
        $form->addElement('hidden', 'myid', $my_id);
        if ($this->type != MEDIA_QUESTION) {
            // Advanced parameters
            $select_level = Question::get_default_levels();
            $form->addElement('select', 'questionLevel', get_lang('Difficulty'), $select_level);
            // Categories
            $tabCat = TestCategory::getCategoriesIdAndName();
            $form->addElement('select', 'questionCategory', get_lang('Category'), $tabCat);
            if (in_array($this->type, array(UNIQUE_ANSWER, MULTIPLE_ANSWER))) {
                $buttonValue = $this->type == UNIQUE_ANSWER ? 'ConvertToMultipleAnswer' : 'ConvertToUniqueAnswer';
                $form->addElement('button', 'convertAnswer', get_lang($buttonValue));
            }
            //Medias
            //$course_medias = Question::prepare_course_media_select(api_get_course_int_id());
            //$form->addElement('select', 'parent_id', get_lang('AttachToMedia'), $course_medias);
        }
        $form->addElement('html', '</div>');
        if (!isset($_GET['fromExercise'])) {
            switch ($answerType) {
                case 1:
                    $this->question = get_lang('DefaultUniqueQuestion');
                    break;
                case 2:
                    $this->question = get_lang('DefaultMultipleQuestion');
                    break;
                case 3:
                    $this->question = get_lang('DefaultFillBlankQuestion');
                    break;
                case 4:
                    $this->question = get_lang('DefaultMathingQuestion');
                    break;
                case 5:
                    $this->question = get_lang('DefaultOpenQuestion');
                    break;
                case 9:
                    $this->question = get_lang('DefaultMultipleQuestion');
                    break;
            }
        }
        // default values
        $defaults = array();
        $defaults['questionName'] = $this->question;
        $defaults['questionDescription'] = $this->description;
        $defaults['questionLevel'] = $this->level;
        $defaults['questionCategory'] = $this->category;
        // Came from he question pool
        if (isset($_GET['fromExercise'])) {
            $form->setDefaults($defaults);
        }
        if (!empty($_REQUEST['myid'])) {
            $form->setDefaults($defaults);
        } else {
            if ($isContent == 1) {
                $form->setDefaults($defaults);
            }
        }
    }
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:99,代码来源:question.class.php

示例3: foreach

    foreach ($exercise_list as $row) {
        $my_exercise_list[$row['iid']] = "";
        if ($row['iid'] == $fromExercise && $selected_course == api_get_course_int_id()) {
            $my_exercise_list[$row['iid']] = ">&nbsp;&nbsp;&nbsp;&nbsp;";
            // hub 13-10-2011
        }
        $my_exercise_list[$row['iid']] .= $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 = Question::get_default_levels();
$levels['-1'] = get_lang('All');
$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');
$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]);
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:31,代码来源:question_pool.php

示例4: createForm

    /**
     * Creates the form to create / edit a question
     * A subclass can redifine this function to add fields...
     * @param FormValidator $form the formvalidator instance (by reference)
     */
    function createForm(&$form, $fck_config = 0)
    {
        echo '<style>
					.media { display:none;}
				</style>';
        echo '<script>
			// hack to hide http://cksource.com/forums/viewtopic.php?f=6&t=8700

			function FCKeditor_OnComplete( editorInstance ) {
			   if (document.getElementById ( \'HiddenFCK\' + editorInstance.Name )) {
			      HideFCKEditorByInstanceName (editorInstance.Name);
			   }
			}

			function HideFCKEditorByInstanceName ( editorInstanceName ) {
			   if (document.getElementById ( \'HiddenFCK\' + editorInstanceName ).className == "HideFCKEditor" ) {
			      document.getElementById ( \'HiddenFCK\' + editorInstanceName ).className = "media";
			      }
			}

			function show_media(){
				var my_display = document.getElementById(\'HiddenFCKquestionDescription\').style.display;
				if(my_display== \'none\' || my_display == \'\') {
				document.getElementById(\'HiddenFCKquestionDescription\').style.display = \'block\';
				document.getElementById(\'media_icon\').innerHTML=\'&nbsp;<img style="vertical-align: middle;" src="../img/looknfeelna.png" alt="" />&nbsp;' . get_lang('EnrichQuestion') . '\';
			} else {
				document.getElementById(\'HiddenFCKquestionDescription\').style.display = \'none\';
				document.getElementById(\'media_icon\').innerHTML=\'&nbsp;<img style="vertical-align: middle;" src="../img/looknfeel.png" alt="" />&nbsp;' . get_lang('EnrichQuestion') . '\';
			}
		}

		// hub 13-12-2010
		function visiblerDevisibler(in_id) {
			if (document.getElementById(in_id)) {
				if (document.getElementById(in_id).style.display == "none") {
					document.getElementById(in_id).style.display = "block";
					if (document.getElementById(in_id+"Img")) {
						document.getElementById(in_id+"Img").src = "../img/div_hide.gif";
					}
				}
				else {
					document.getElementById(in_id).style.display = "none";
					if (document.getElementById(in_id+"Img")) {
						document.getElementById(in_id+"Img").src = "../img/div_show.gif";
					}
				}
			}
		}
		</script>';
        // question name
        $form->addElement('text', 'questionName', get_lang('Question'), array('class' => 'span6'));
        $form->addRule('questionName', get_lang('GiveQuestion'), 'required');
        // default content
        $isContent = isset($_REQUEST['isContent']) ? intval($_REQUEST['isContent']) : null;
        // Question type
        $answerType = isset($_REQUEST['answerType']) ? intval($_REQUEST['answerType']) : null;
        $form->addElement('hidden', 'answerType', $answerType);
        // html editor
        $editor_config = array('ToolbarSet' => 'TestQuestionDescription', 'Width' => '100%', 'Height' => '150');
        if (is_array($fck_config)) {
            $editor_config = array_merge($editor_config, $fck_config);
        }
        if (!api_is_allowed_to_edit(null, true)) {
            $editor_config['UserStatus'] = 'student';
        }
        $form->addElement('advanced_settings', '
			<a href="javascript://" onclick=" return show_media()"><span id="media_icon"><img style="vertical-align: middle;" src="../img/looknfeel.png" alt="" />&nbsp;' . get_lang('EnrichQuestion') . '</span></a>
		');
        $form->addElement('html', '<div class="HideFCKEditor" id="HiddenFCKquestionDescription" >');
        $form->add_html_editor('questionDescription', get_lang('QuestionDescription'), false, false, $editor_config);
        $form->addElement('html', '</div>');
        // hidden values
        $my_id = isset($_REQUEST['myid']) ? intval($_REQUEST['myid']) : null;
        $form->addElement('hidden', 'myid', $my_id);
        if ($this->type != MEDIA_QUESTION) {
            // Advanced parameters
            $form->addElement('advanced_settings', '<a href="javascript:void(0)" onclick="visiblerDevisibler(\'id_advancedOption\')"><img id="id_advancedOptionImg" style="vertical-align:middle;" src="../img/div_show.gif" alt="" />&nbsp;' . get_lang("AdvancedParameters") . '</a>');
            $form->addElement('html', '<div id="id_advancedOption" style="display:none;">');
            $select_level = Question::get_default_levels();
            $form->addElement('select', 'questionLevel', get_lang('Difficulty'), $select_level);
            // Categories
            //$category_list = Testcategory::getCategoriesIdAndName();
            //$form->addElement('select', 'questionCategory', get_lang('Category'), $category_list, array('multiple' => 'multiple'));
            // Categories
            $tabCat = Testcategory::getCategoriesIdAndName();
            $form->addElement('select', 'questionCategory', get_lang('Category'), $tabCat);
            //Medias
            //$course_medias = Question::prepare_course_media_select(api_get_course_int_id());
            //$form->addElement('select', 'parent_id', get_lang('AttachToMedia'), $course_medias);
            $form->addElement('html', '</div>');
        }
        if (!isset($_GET['fromExercise'])) {
            switch ($answerType) {
                case 1:
                    $this->question = get_lang('DefaultUniqueQuestion');
//.........这里部分代码省略.........
开发者ID:annickvdp,项目名称:Chamilo1.9.10,代码行数:101,代码来源:question.class.php


注:本文中的Question::get_default_levels方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。