本文整理汇总了PHP中question_edit_contexts::have_one_edit_tab_cap方法的典型用法代码示例。如果您正苦于以下问题:PHP question_edit_contexts::have_one_edit_tab_cap方法的具体用法?PHP question_edit_contexts::have_one_edit_tab_cap怎么用?PHP question_edit_contexts::have_one_edit_tab_cap使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类question_edit_contexts
的用法示例。
在下文中一共展示了question_edit_contexts::have_one_edit_tab_cap方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
* @package quiz
*/
require_once "../../config.php";
require_once "locallib.php";
$id = required_param('id', PARAM_INT);
if (!($course = $DB->get_record('course', array('id' => $id)))) {
print_error('invalidcourseid');
}
$coursecontext = get_context_instance(CONTEXT_COURSE, $id);
require_login($course->id);
add_to_log($course->id, "quiz", "view all", "index.php?id={$course->id}", "");
// Print the header
$strquizzes = get_string("modulenameplural", "quiz");
$streditquestions = '';
$editqcontexts = new question_edit_contexts($coursecontext);
if ($editqcontexts->have_one_edit_tab_cap('questions')) {
$streditquestions = "<form target=\"_parent\" method=\"get\" action=\"{$CFG->wwwroot}/question/edit.php\">\n <div>\n <input type=\"hidden\" name=\"courseid\" value=\"{$course->id}\" />\n <input type=\"submit\" value=\"" . get_string("editquestions", "quiz") . "\" />\n </div>\n </form>";
}
$navlinks = array();
$navlinks[] = array('name' => $strquizzes, 'link' => '', 'type' => 'activity');
$navigation = build_navigation($navlinks);
print_header_simple($strquizzes, '', $navigation, '', '', true, $streditquestions, navmenu($course));
// Get all the appropriate data
if (!($quizzes = get_all_instances_in_course("quiz", $course))) {
notice(get_string('thereareno', 'moodle', $strquizzes), "../../course/view.php?id={$course->id}");
die;
}
// Configure table for displaying the list of instances.
$headings = array(get_string('name'), get_string('quizcloses', 'quiz'));
$align = array('left', 'left');
if ($course->format == 'weeks' or $course->format == 'weekscss') {
示例2: questionbank_navigation_tabs
/**
* @param array $row tab objects
* @param question_edit_contexts $contexts object representing contexts available from this context
* @param string $querystring to append to urls
* */
function questionbank_navigation_tabs(&$row, $contexts, $querystring)
{
global $CFG, $QUESTION_EDITTABCAPS;
$tabs = array('questions' => array("{$CFG->wwwroot}/question/edit.php?{$querystring}", get_string('questions', 'quiz'), get_string('editquestions', 'quiz')), 'categories' => array("{$CFG->wwwroot}/question/category.php?{$querystring}", get_string('categories', 'quiz'), get_string('editqcats', 'quiz')), 'import' => array("{$CFG->wwwroot}/question/import.php?{$querystring}", get_string('import', 'quiz'), get_string('importquestions', 'quiz')), 'export' => array("{$CFG->wwwroot}/question/export.php?{$querystring}", get_string('export', 'quiz'), get_string('exportquestions', 'quiz')));
foreach ($tabs as $tabname => $tabparams) {
if ($contexts->have_one_edit_tab_cap($tabname)) {
$row[] = new tabobject($tabname, $tabparams[0], $tabparams[1], $tabparams[2]);
}
}
}
示例3: array
if ($currenttab == 'reports' and isset($mode)) {
$activated[] = 'reports';
$row = array();
$currenttab = '';
$reportlist = quiz_report_list($context);
foreach ($reportlist as $report) {
$row[] = new tabobject($report, "{$CFG->wwwroot}/mod/quiz/report.php?q={$quiz->id}&mode={$report}", get_string($report, 'quiz_' . $report));
if ($report == $mode) {
$currenttab = $report;
}
}
$tabs[] = $row;
}
if ($currenttab == 'edit' and isset($mode)) {
$activated[] = 'edit';
$row = array();
$currenttab = $mode;
$strquiz = get_string('modulename', 'quiz');
$streditingquiz = get_string("editinga", "moodle", $strquiz);
if (has_capability('mod/quiz:manage', $context) && $contexts->have_one_edit_tab_cap('editq')) {
//TODO: ensure that removing get_query_string here won't hurt
$row[] = new tabobject('editq', "{$CFG->wwwroot}/mod/quiz/edit.php?cmid={$cm->id}", $stredit, $streditingquiz);
$row[] = new tabobject('reorder', "{$CFG->wwwroot}/mod/quiz/edit.php?reordertool=1&cmid={$cm->id}", get_string('orderandpaging', 'quiz'), $streditingquiz);
}
//questionbank_navigation_tabs($row, $contexts, $thispageurl->get_query_string());
$tabs[] = $row;
}
if (!$quiz->questions) {
$inactive += array('info', 'reports', 'preview');
}
print_tabs($tabs, $currenttab, $inactive, $activated);
示例4: question_extend_settings_navigation
/**
* Adds question bank setting links to the given navigation node if caps are met.
*
* @param navigation_node $navigationnode The navigation node to add the question branch to
* @param object $context
* @return navigation_node Returns the question branch that was added
*/
function question_extend_settings_navigation(navigation_node $navigationnode, $context)
{
global $PAGE;
if ($context->contextlevel == CONTEXT_COURSE) {
$params = array('courseid' => $context->instanceid);
} else {
if ($context->contextlevel == CONTEXT_MODULE) {
$params = array('cmid' => $context->instanceid);
} else {
return;
}
}
if (($cat = $PAGE->url->param('cat')) && preg_match('~\\d+,\\d+~', $cat)) {
$params['cat'] = $cat;
}
$questionnode = $navigationnode->add(get_string('questionbank', 'question'), new moodle_url('/question/edit.php', $params), navigation_node::TYPE_CONTAINER);
$contexts = new question_edit_contexts($context);
if ($contexts->have_one_edit_tab_cap('questions')) {
$questionnode->add(get_string('questions', 'quiz'), new moodle_url('/question/edit.php', $params), navigation_node::TYPE_SETTING);
}
if ($contexts->have_one_edit_tab_cap('categories')) {
$questionnode->add(get_string('categories', 'quiz'), new moodle_url('/question/category.php', $params), navigation_node::TYPE_SETTING);
}
if ($contexts->have_one_edit_tab_cap('import')) {
$questionnode->add(get_string('import', 'quiz'), new moodle_url('/question/import.php', $params), navigation_node::TYPE_SETTING);
}
if ($contexts->have_one_edit_tab_cap('export')) {
$questionnode->add(get_string('export', 'quiz'), new moodle_url('/question/export.php', $params), navigation_node::TYPE_SETTING);
}
return $questionnode;
}
示例5: array
$contexts = new question_edit_contexts($context);
}
$tabs = array();
$row = array();
$inactive = array();
$activated = array();
if (has_capability('mod/quiz:view', $context)) {
$row[] = new tabobject('info', "{$CFG->wwwroot}/mod/quiz/view.php?q={$quiz->id}", get_string('info', 'quiz'));
}
if (has_capability('mod/quiz:viewreports', $context)) {
$row[] = new tabobject('reports', "{$CFG->wwwroot}/mod/quiz/report.php?q={$quiz->id}", get_string('results', 'quiz'));
}
if (has_capability('mod/quiz:preview', $context)) {
$row[] = new tabobject('preview', "{$CFG->wwwroot}/mod/quiz/attempt.php?q={$quiz->id}", get_string('preview', 'quiz'));
}
if ($contexts->have_one_edit_tab_cap('editq')) {
$row[] = new tabobject('edit', "{$CFG->wwwroot}/mod/quiz/edit.php?cmid={$cm->id}", get_string('edit'));
}
if ($currenttab == 'info' && count($row) == 1) {
// Don't show only an info tab (e.g. to students).
} else {
$tabs[] = $row;
}
if ($currenttab == 'reports' and isset($mode)) {
$inactive[] = 'reports';
$activated[] = 'reports';
$allreports = get_list_of_plugins("mod/quiz/report");
$reportlist = array('overview', 'regrade', 'grading', 'analysis');
// Standard reports we want to show first
foreach ($allreports as $report) {
if (!in_array($report, $reportlist)) {