本文整理汇总了PHP中Exercise::update_question_positions方法的典型用法代码示例。如果您正苦于以下问题:PHP Exercise::update_question_positions方法的具体用法?PHP Exercise::update_question_positions怎么用?PHP Exercise::update_question_positions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Exercise
的用法示例。
在下文中一共展示了Exercise::update_question_positions方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: processCreation
/**
* function which process the creation of questions
* @param FormValidator $form
* @param Exercise $objExercise
*/
public function processCreation($form, $objExercise = null)
{
$this->updateTitle($form->getSubmitValue('questionName'));
$this->updateDescription($form->getSubmitValue('questionDescription'));
$this->updateLevel($form->getSubmitValue('questionLevel'));
$this->updateCategory($form->getSubmitValue('questionCategory'));
//Save normal question if NOT media
if ($this->type != MEDIA_QUESTION) {
$this->save($objExercise->id);
// modify the exercise
$objExercise->addToList($this->id);
$objExercise->update_question_positions();
}
}
示例2: processCreation
/**
* function which process the creation of questions
* @param FormValidator $form the formvalidator instance
* @param Exercise $objExercise the Exercise instance
*/
public function processCreation($form, $objExercise = null)
{
$this->updateParentId($form->getSubmitValue('parent_id'));
$this->updateTitle($form->getSubmitValue('questionName'));
$this->updateDescription($form->getSubmitValue('questionDescription'));
$this->updateLevel($form->getSubmitValue('questionLevel'));
$this->updateCategory($form->getSubmitValue('questionCategory'));
// Save normal question if NOT media
if ($this->type != MEDIA_QUESTION) {
$this->save($objExercise->id);
$field_value = new ExtraFieldValue('question');
$params = $form->getSubmitValues();
$params['question_id'] = $this->id;
$field_value->save_field_values($params);
if ($objExercise) {
// modify the exercise
$objExercise->addToList($this->id);
$objExercise->update_question_positions();
}
}
}
示例3: fill_exe
/**
* Loads the data and injects it into the Chamilo database, using the Chamilo
* internal functions.
* @return array List of user IDs for the users that have just been inserted
*/
function fill_exe()
{
$qc = 5000;
//how many questions to create per exercise
$eol = PHP_EOL;
$courses = array();
//declare only to avoid parsing notice
$qst = array();
require_once 'data_exe.php';
//fill the $users array
$output = array();
$output[] = array('title' => 'Exe Filling Report: ');
$i = 1;
$lib = api_get_path(SYS_CODE_PATH);
require_once $lib . 'exercice/exercise.class.php';
require_once $lib . 'exercice/question.class.php';
require_once $lib . 'exercice/answer.class.php';
foreach ($courses as $i => $course) {
//first check that the first item doesn't exist already
$output[$i]['line-init'] = $course['title'];
$res = CourseManager::create_course($course);
$output[$i]['line-info'] = $res ? $res : get_lang('NotInserted');
$i++;
if (is_array($res)) {
//now insert an exercise
foreach ($course['exes'] as $exe) {
$objExercise = new Exercise($res['real_id']);
$objExercise->id = 0;
$objExercise->course_id = $res['real_id'];
$objExercise->exercise = $exe['title'];
$objExercise->type = 1;
$objExercise->attempts = $exe['attempts'];
$objExercise->random = $exe['random'];
$objExercise->active = 1;
$objExercise->propagate_neg = 0;
$objExercise->pass_percentage = $exe['pass_percentage'];
$objExercise->session_id = 0;
$objExercise->results_disabled = 0;
$objExercise->expired_time = $exe['time'];
$objExercise->review_answers = $exe['review_answers'];
$objExercise->save();
$id = $objExercise->id;
if (!empty($id)) {
$qi = 0;
while ($qi < $qc) {
foreach ($qst as $q) {
error_log('Created ' . $qi . ' questions');
$question = Question::getInstance($q['type']);
$question->id = 0;
$question->question = $q['title'] . ' ' . $qi;
$question->description = $q['desc'];
$question->type = $q['type'];
$question->course = $res;
$r = $question->save($id);
if ($r === false) {
continue;
}
$qid = $question->id;
$objExercise->addToList($qid);
$objExercise->update_question_positions();
$aid = 1;
foreach ($q['answers'] as $asw) {
$answer = new UniqueAnswer($qid);
$answer->create_answer($aid, $qid, $asw['title'], '', $asw['score'], $asw['correct'], $res['real_id']);
$aid++;
}
$qi++;
}
}
}
}
}
}
return $output;
}