本文整理汇总了PHP中question_edit_contexts::all方法的典型用法代码示例。如果您正苦于以下问题:PHP question_edit_contexts::all方法的具体用法?PHP question_edit_contexts::all怎么用?PHP question_edit_contexts::all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类question_edit_contexts
的用法示例。
在下文中一共展示了question_edit_contexts::all方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: quiz_print_pagecontrols
/**
* Print all the controls for adding questions directly into the
* specific page in the edit tab of edit.php
*
* @param unknown_type $quiz
* @param unknown_type $pageurl
* @param unknown_type $page
* @param unknown_type $hasattempts
*/
function quiz_print_pagecontrols($quiz, $pageurl, $page, $hasattempts)
{
global $CFG;
static $randombuttoncount = 0;
$randombuttoncount++;
echo '<div class="pagecontrols">';
// Get the current context
$thiscontext = get_context_instance(CONTEXT_COURSE, $quiz->course);
$contexts = new question_edit_contexts($thiscontext);
// Get the default category.
$defaultcategory = question_make_default_categories($contexts->all());
// Create the url the question page will return to
$returnurl_addtoquiz = new moodle_url($pageurl->out(true), array('addonpage' => $page));
// Print a button linking to the choose question type page.
$newquestionparams = array('returnurl' => $returnurl_addtoquiz->out(false), 'cmid' => $quiz->cmid, 'appendqnumstring' => 'addquestion');
create_new_question_button($defaultcategory->id, $newquestionparams, get_string('addaquestion', 'quiz'), get_string('createquestionandadd', 'quiz'), $hasattempts);
if ($hasattempts) {
$disabled = 'disabled="disabled"';
} else {
$disabled = '';
}
?>
<div class="singlebutton">
<form class="randomquestionform" action="<?php
echo $CFG->wwwroot;
?>
/mod/quiz/addrandom.php" method="get">
<div>
<input type="hidden" class="addonpage_formelement" name="addonpage_form" value="<?php
echo $page;
?>
" />
<input type="hidden" name="cmid" value="<?php
echo $quiz->cmid;
?>
" />
<input type="hidden" name="courseid" value="<?php
echo $quiz->course;
?>
" />
<input type="hidden" name="returnurl" value="<?php
echo urlencode($pageurl->out(true));
?>
" />
<input type="submit" id="addrandomdialoglaunch_<?php
echo $randombuttoncount;
?>
" value="<?php
echo get_string('addarandomquestion', 'quiz');
?>
" <?php
echo " {$disabled}";
?>
/>
</div>
</form>
</div>
<?php
helpbutton('random', get_string('random', 'quiz'), 'quiz', true, false, '');
?>
<?php
echo "\n</div>";
}