本文整理汇总了PHP中question_engine::get_all_response_file_areas方法的典型用法代码示例。如果您正苦于以下问题:PHP question_engine::get_all_response_file_areas方法的具体用法?PHP question_engine::get_all_response_file_areas怎么用?PHP question_engine::get_all_response_file_areas使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类question_engine
的用法示例。
在下文中一共展示了question_engine::get_all_response_file_areas方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: add_question_usages
/**
* Attach to $element (usually attempts) the needed backup structures
* for question_usages and all the associated data.
*/
protected function add_question_usages($element, $usageidname)
{
global $CFG;
require_once $CFG->dirroot . '/question/engine/lib.php';
// Check $element is one nested_backup_element
if (!$element instanceof backup_nested_element) {
throw new backup_step_exception('question_states_bad_parent_element', $element);
}
if (!$element->get_final_element($usageidname)) {
throw new backup_step_exception('question_states_bad_question_attempt_element', $usageidname);
}
$quba = new backup_nested_element('question_usage', array('id'), array('component', 'preferredbehaviour'));
$qas = new backup_nested_element('question_attempts');
$qa = new backup_nested_element('question_attempt', array('id'), array('slot', 'behaviour', 'questionid', 'maxmark', 'minfraction', 'flagged', 'questionsummary', 'rightanswer', 'responsesummary', 'timemodified'));
$steps = new backup_nested_element('steps');
$step = new backup_nested_element('step', array('id'), array('sequencenumber', 'state', 'fraction', 'timecreated', 'userid'));
$response = new backup_nested_element('response');
$variable = new backup_nested_element('variable', null, array('name', 'value'));
// Build the tree
$element->add_child($quba);
$quba->add_child($qas);
$qas->add_child($qa);
$qa->add_child($steps);
$steps->add_child($step);
$step->add_child($response);
$response->add_child($variable);
// Set the sources
$quba->set_source_table('question_usages', array('id' => '../' . $usageidname));
$qa->set_source_sql('
SELECT *
FROM {question_attempts}
WHERE questionusageid = :questionusageid
ORDER BY slot', array('questionusageid' => backup::VAR_PARENTID));
$step->set_source_sql('
SELECT *
FROM {question_attempt_steps}
WHERE questionattemptid = :questionattemptid
ORDER BY sequencenumber', array('questionattemptid' => backup::VAR_PARENTID));
$variable->set_source_table('question_attempt_step_data', array('attemptstepid' => backup::VAR_PARENTID));
// Annotate ids
$qa->annotate_ids('question', 'questionid');
$step->annotate_ids('user', 'userid');
// Annotate files
$fileareas = question_engine::get_all_response_file_areas();
foreach ($fileareas as $filearea) {
$step->annotate_files('question', $filearea, 'id');
}
}
示例2: after_execute
protected function after_execute()
{
parent::after_execute();
// Restore any files belonging to responses.
foreach (question_engine::get_all_response_file_areas() as $filearea) {
$this->add_related_files('question', $filearea, 'question_attempt_step');
}
}
示例3: delete_response_files
/**
* Delete all the files belonging to the response variables in the gives
* question attempt steps.
* @param int $contextid the context these attempts belong to.
* @param string $itemidstest a bit of SQL that can be used in a
* WHERE itemid $itemidstest clause. Must use named params.
* @param array $params any query parameters used in $itemidstest.
*/
protected function delete_response_files($contextid, $itemidstest, $params)
{
$fs = get_file_storage();
foreach (question_engine::get_all_response_file_areas() as $filearea) {
$fs->delete_area_files_select($contextid, 'question', $filearea, $itemidstest, $params);
}
}