本文整理汇总了PHP中get_plugin_list函数的典型用法代码示例。如果您正苦于以下问题:PHP get_plugin_list函数的具体用法?PHP get_plugin_list怎么用?PHP get_plugin_list使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_plugin_list函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: definition
protected function definition()
{
global $CFG;
$mform =& $this->_form;
$mform->addElement('html', get_string('compilatioexplain', 'plagiarism_compilatio'));
$mform->addElement('checkbox', 'compilatio_use', get_string('usecompilatio', 'plagiarism_compilatio'));
$mform->addElement('text', 'compilatio_api', get_string('compilatio_api', 'plagiarism_compilatio'));
$mform->addHelpButton('compilatio_api', 'compilatio_api', 'plagiarism_compilatio');
$mform->addRule('compilatio_api', null, 'required', null, 'client');
$mform->setDefault('compilatio_api', 'http://service.compilatio.net/webservices/CompilatioUserClient2.wsdl');
$mform->addElement('passwordunmask', 'compilatio_password', get_string('compilatio_password', 'plagiarism_compilatio'));
$mform->addHelpButton('compilatio_password', 'compilatio_password', 'plagiarism_compilatio');
$mform->addRule('compilatio_password', null, 'required', null, 'client');
$mform->addElement('textarea', 'compilatio_student_disclosure', get_string('studentdisclosure', 'plagiarism_compilatio'), 'wrap="virtual" rows="6" cols="50"');
$mform->addHelpButton('compilatio_student_disclosure', 'studentdisclosure', 'plagiarism_compilatio');
$mform->setDefault('compilatio_student_disclosure', get_string('studentdisclosuredefault', 'plagiarism_compilatio'));
$mods = get_plugin_list('mod');
foreach ($mods as $mod => $modname) {
if (plugin_supports('mod', $mod, FEATURE_PLAGIARISM)) {
$modstring = 'compilatio_enable_mod_' . $mod;
$mform->addElement('checkbox', $modstring, get_string('compilatio_enableplugin', 'plagiarism_compilatio', get_string('pluginname', 'mod_' . $mod)));
}
}
$this->add_action_buttons(true);
}
开发者ID:romain-compi,项目名称:moodle-plagiarism_compilatio,代码行数:25,代码来源:compilatio_form.php
示例2: offlinequiz_report_list
/**
* Returns an array of reports to which the current user has access to.
* @return array reports are ordered as they should be for display in tabs.
*/
function offlinequiz_report_list($context)
{
global $DB;
static $reportlist = null;
if (!is_null($reportlist)) {
return $reportlist;
}
$reports = $DB->get_records('offlinequiz_reports', null, 'displayorder DESC', 'name, capability');
$reportdirs = get_plugin_list('offlinequiz');
// Order the reports tab in descending order of displayorder.
$reportcaps = array();
foreach ($reports as $key => $report) {
if (array_key_exists($report->name, $reportdirs)) {
$reportcaps[$report->name] = $report->capability;
}
}
// Add any other reports, which are on disc but not in the DB, on the end.
foreach ($reportdirs as $reportname => $notused) {
if (!isset($reportcaps[$reportname])) {
$reportcaps[$reportname] = null;
}
}
$reportlist = array();
foreach ($reportcaps as $name => $capability) {
if (empty($capability)) {
$capability = 'mod/offlinequiz:viewreports';
}
if (has_capability($capability, $context)) {
$reportlist[] = $name;
}
}
return $reportlist;
}
开发者ID:frankkoch,项目名称:moodle-mod_offlinequiz,代码行数:37,代码来源:reportlib.php
示例3: enrol_get_plugins
/**
* Returns instances of enrol plugins
* @param bool $enabled return enabled only
* @return array of enrol plugins name=>instance
*/
function enrol_get_plugins($enabled)
{
global $CFG;
$result = array();
if ($enabled) {
// sorted by enabled plugin order
$enabled = explode(',', $CFG->enrol_plugins_enabled);
$plugins = array();
foreach ($enabled as $plugin) {
$plugins[$plugin] = "{$CFG->dirroot}/enrol/{$plugin}";
}
} else {
// sorted alphabetically
$plugins = get_plugin_list('enrol');
ksort($plugins);
}
foreach ($plugins as $plugin => $location) {
if (!file_exists("{$location}/lib.php")) {
continue;
}
include_once "{$location}/lib.php";
$class = "enrol_{$plugin}_plugin";
if (!class_exists($class)) {
continue;
}
$result[$plugin] = new $class();
}
return $result;
}
开发者ID:vinoth4891,项目名称:clinique,代码行数:34,代码来源:enrollib.php
示例4: definition
function definition()
{
global $USER, $CFG, $COURSE;
$mform =& $this->_form;
//Accessibility: "Required" is bad legend text.
$strgeneral = get_string('general');
$strrequired = get_string('required');
/// Add some extra hidden fields
$mform->addElement('hidden', 'id');
$mform->addElement('hidden', 'course', $COURSE->id);
/// Print the required moodle fields first
$mform->addElement('header', 'moodle', $strgeneral);
$mform->addElement('text', 'username', get_string('username'), 'size="20"');
$mform->addRule('username', $strrequired, 'required', null, 'client');
$mform->setType('username', PARAM_RAW);
$auths = get_plugin_list('auth');
$auth_options = array();
foreach ($auths as $auth => $unused) {
$auth_options[$auth] = auth_get_plugin_title($auth);
}
$mform->addElement('select', 'auth', get_string('chooseauthmethod', 'auth'), $auth_options);
$mform->setHelpButton('auth', array('authchange', get_string('chooseauthmethod', 'auth')));
$mform->setAdvanced('auth');
$mform->addElement('passwordunmask', 'newpassword', get_string('newpassword'), 'size="20"');
$mform->setHelpButton('newpassword', array('newpassword', get_string('leavetokeep')));
$mform->setType('newpassword', PARAM_RAW);
$mform->addElement('advcheckbox', 'preference_auth_forcepasswordchange', get_string('forcepasswordchange'));
$mform->setHelpButton('preference_auth_forcepasswordchange', array('forcepasswordchange', get_string('forcepasswordchange')));
/// shared fields
useredit_shared_definition($mform);
/// Next the customisable profile fields
profile_definition($mform);
$this->add_action_buttons(false, get_string('updatemyprofile'));
}
开发者ID:ajv,项目名称:Offline-Caching,代码行数:34,代码来源:editadvanced_form.php
示例5: is_last
/**
* Is this the last plugin in the list?
*
* @return bool
*/
public final function is_last() {
if ((count(get_plugin_list($this->get_subtype()))-1) == get_config($this->get_subtype() . '_' . $this->get_type(), 'sortorder')) {
return true;
}
return false;
}
开发者ID:JP-Git,项目名称:moodle,代码行数:12,代码来源:assignmentplugin.php
示例6: definition
/**
* items in the form
*/
public function definition()
{
global $CURMAN, $CFG;
parent::definition();
$mform =& $this->_form;
$mform->addElement('hidden', 'id');
$mform->setType('id', PARAM_INT);
$mform->addElement('text', 'name', get_string('userset_name', 'local_elisprogram'));
$mform->setType('name', PARAM_TEXT);
$mform->addRule('name', get_string('required'), 'required', NULL, 'client');
$mform->addHelpButton('name', 'userset_name', 'local_elisprogram');
$mform->addElement('textarea', 'display', get_string('userset_description', 'local_elisprogram'), array('cols' => 40, 'rows' => 2));
$mform->setType('display', PARAM_CLEAN);
$mform->addHelpButton('display', 'userset_description', 'local_elisprogram');
$current_cluster_id = isset($this->_customdata['obj']->id) ? $this->_customdata['obj']->id : '';
//obtain the non-child clusters that we could become the child of, with availability
//determined based on the edit capability
$contexts = usersetpage::get_contexts('local/elisprogram:userset_edit');
$non_child_clusters = cluster_get_non_child_clusters($current_cluster_id, $contexts);
//parent dropdown
$mform->addElement('select', 'parent', get_string('userset_parent', 'local_elisprogram'), $non_child_clusters);
$mform->addHelpButton('parent', 'userset_parent', 'local_elisprogram');
// allow plugins to add their own fields
$mform->addElement('header', 'userassociationfieldset', get_string('userset_userassociation', 'local_elisprogram'));
$plugins = get_plugin_list(userset::ENROL_PLUGIN_TYPE);
foreach ($plugins as $plugin => $plugindir) {
require_once elis::plugin_file(userset::ENROL_PLUGIN_TYPE . '_' . $plugin, 'lib.php');
call_user_func('cluster_' . $plugin . '_edit_form', $this, $mform, $current_cluster_id);
}
// custom fields
$this->add_custom_fields('cluster', 'local/elisprogram:userset_edit', 'local/elisprogram:userset_view', 'cluster');
$this->add_action_buttons();
}
开发者ID:jamesmcq,项目名称:elis,代码行数:36,代码来源:usersetform.class.php
示例7: list_components
/**
* Returns a list of all components installed on the server
*
* @return array (string)legacyname => (string)frankenstylename
*/
public static function list_components()
{
$list['moodle'] = 'core';
$coresubsystems = get_core_subsystems();
ksort($coresubsystems);
// should be but just in case
foreach ($coresubsystems as $name => $location) {
if ($name != 'moodle.org') {
$list[$name] = 'core_' . $name;
}
}
$plugintypes = get_plugin_types();
foreach ($plugintypes as $type => $location) {
$pluginlist = get_plugin_list($type);
foreach ($pluginlist as $name => $ununsed) {
if ($type == 'mod') {
if (array_key_exists($name, $list)) {
throw new Exception('Activity module and core subsystem name collision');
}
$list[$name] = $type . '_' . $name;
} else {
$list[$type . '_' . $name] = $type . '_' . $name;
}
}
}
return $list;
}
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:32,代码来源:locallib.php
示例8: definition
function definition()
{
global $USER, $CFG, $COURSE;
$mform =& $this->_form;
$editoroptions = null;
$filemanageroptions = null;
$userid = $USER->id;
if (is_array($this->_customdata)) {
if (array_key_exists('editoroptions', $this->_customdata)) {
$editoroptions = $this->_customdata['editoroptions'];
}
if (array_key_exists('filemanageroptions', $this->_customdata)) {
$filemanageroptions = $this->_customdata['filemanageroptions'];
}
if (array_key_exists('userid', $this->_customdata)) {
$userid = $this->_customdata['userid'];
}
}
//Accessibility: "Required" is bad legend text.
$strgeneral = get_string('general');
$strrequired = get_string('required');
/// Add some extra hidden fields
$mform->addElement('hidden', 'id');
$mform->setType('id', PARAM_INT);
$mform->addElement('hidden', 'course', $COURSE->id);
$mform->setType('course', PARAM_INT);
/// Print the required moodle fields first
$mform->addElement('header', 'moodle', $strgeneral);
$mform->addElement('text', 'username', get_string('username'), 'size="20"');
$mform->addRule('username', $strrequired, 'required', null, 'client');
$mform->setType('username', PARAM_RAW);
$auths = get_plugin_list('auth');
$auth_options = array();
foreach ($auths as $auth => $unused) {
$auth_options[$auth] = get_string('pluginname', "auth_{$auth}");
}
$mform->addElement('select', 'auth', get_string('chooseauthmethod', 'auth'), $auth_options);
$mform->addHelpButton('auth', 'chooseauthmethod', 'auth');
$mform->addElement('advcheckbox', 'suspended', get_string('suspended', 'auth'));
$mform->addHelpButton('suspended', 'suspended', 'auth');
if (!empty($CFG->passwordpolicy)) {
$mform->addElement('static', 'passwordpolicyinfo', '', print_password_policy());
}
$mform->addElement('passwordunmask', 'newpassword', get_string('newpassword'), 'size="20"');
$mform->addHelpButton('newpassword', 'newpassword');
$mform->setType('newpassword', PARAM_RAW);
$mform->addElement('advcheckbox', 'preference_auth_forcepasswordchange', get_string('forcepasswordchange'));
$mform->addHelpButton('preference_auth_forcepasswordchange', 'forcepasswordchange');
/// shared fields
useredit_shared_definition($mform, $editoroptions, $filemanageroptions);
/// Next the customisable profile fields
profile_definition($mform, $userid);
if ($userid == -1) {
$btnstring = get_string('createuser');
} else {
$btnstring = get_string('updatemyprofile');
}
$this->add_action_buttons(false, $btnstring);
}
开发者ID:saurabh947,项目名称:MoodleLearning,代码行数:59,代码来源:editadvanced_form.php
示例9: test_get_submission_plugins
public function test_get_submission_plugins() {
$this->setUser($this->editingteachers[0]);
$assign = $this->create_instance();
$installedplugins = array_keys(get_plugin_list('assignsubmission'));
foreach ($assign->get_submission_plugins() as $plugin) {
$this->assertContains($plugin->get_type(), $installedplugins, 'Submission plugin not in list of installed plugins');
}
}
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:9,代码来源:locallib_test.php
示例10: is_last
/**
* Is this the last plugin in the list?
*
* @return bool
*/
public final function is_last() {
$lastindex = count(get_plugin_list($this->get_subtype()))-1;
$currentindex = get_config($this->get_subtype() . '_' . $this->get_type(), 'sortorder');
if ($lastindex == $currentindex) {
return true;
}
return false;
}
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:14,代码来源:assignmentplugin.php
示例11: __construct
function __construct()
{
$listPlugins = get_plugin_list("local");
if (isset($listPlugins["tpebbb"])) {
require_once $listPlugins["tpebbb"] . "/lib.php";
} else {
throw new Exception("require plugin 'local/tpebbb'");
}
$this->tpebbb = new TpeBigBlueButton();
global $LS_KEY, $SC_KEY, $BASIC_KEY, $INTER_KEY, $ADVAN_KEY;
$LS_KEY = "LS";
$SC_KEY = "SC";
$BASIC_KEY = 'Basic';
$INTER_KEY = 'Inter';
$ADVAN_KEY = 'Advan';
}
开发者ID:RCVDangTung,项目名称:syntax,代码行数:16,代码来源:test_demo_lang_lms.php
示例12: get_all_plugins_with_tests
/**
* Returns all the plugins having tests
* @param string $testtype The kind of test we are looking for
* @return array all the plugins having tests
*/
private static function get_all_plugins_with_tests($testtype)
{
$pluginswithtests = array();
$plugintypes = get_plugin_types();
ksort($plugintypes);
foreach ($plugintypes as $type => $unused) {
$plugs = get_plugin_list($type);
ksort($plugs);
foreach ($plugs as $plug => $fullplug) {
// Look for tests recursively
if (self::directory_has_tests($fullplug, $testtype)) {
$pluginswithtests[$type . '_' . $plug] = $fullplug;
}
}
}
return $pluginswithtests;
}
开发者ID:masaterutakeno,项目名称:MoodleMobile,代码行数:22,代码来源:tests_finder.php
示例13: definition
public function definition()
{
$mform = $this->_form;
$behaviour = array('deferredfeedback' => 'Deferred feedback', 'adaptive' => 'Adaptive', 'adaptivenopenalty' => 'Adaptive (no penalties)');
$qtypes = get_plugin_list('qtype');
foreach ($qtypes as $qtype => $notused) {
$qtypes[$qtype] = get_string($qtype, 'qtype_' . $qtype);
}
$mform->addElement('header', 'h1', 'Either extract a specific question_session');
$mform->addElement('text', 'attemptid', 'Quiz attempt id', array('size' => '10'));
$mform->addElement('text', 'questionid', 'Question id', array('size' => '10'));
$mform->addElement('header', 'h2', 'Or find and extract an example by type');
$mform->addElement('select', 'behaviour', 'Behaviour', $behaviour);
$mform->addElement('text', 'statehistory', 'State history', array('size' => '10'));
$mform->addElement('select', 'qtype', 'Question type', $qtypes);
$mform->addElement('text', 'extratests', 'Extra conditions', array('size' => '50'));
$this->add_action_buttons(false, 'Create test case');
}
开发者ID:sebastiansanio,项目名称:tallerdeprogramacion2fiuba,代码行数:18,代码来源:extracttestcase_form.php
示例14: validation
public function validation($data)
{
$mform =& $this->_form;
$errors = array();
$indicators = get_plugin_list('engagementindicator');
$sum = 0;
foreach ($indicators as $indicator => $path) {
$key = "weighting_{$indicator}";
if (isset($data[$key]) && (!is_numeric($data[$key]) || $data[$key] > 100 || $data[$key] < 0)) {
$errors["weight_group_{$indicator}"] = get_string('weightingmustbenumeric', 'coursereport_engagement');
continue;
}
if (isset($data[$key])) {
$sum += $data[$key];
}
}
if ($sum != 100) {
$errors['weightings_desc'] = get_string('weightingsumtoonehundred', 'coursereport_engagement');
}
return $errors;
}
开发者ID:netspotau,项目名称:moodle-coursereport_engagement,代码行数:21,代码来源:edit_form.php
示例15: coursereport_engagement_get_course_summary
function coursereport_engagement_get_course_summary($courseid)
{
global $CFG, $DB;
$risks = array();
// TODO: We want this to rely on enabled indicators in the course...
require_once $CFG->libdir . '/pluginlib.php';
require_once $CFG->dirroot . '/course/report/engagement/locallib.php';
$pluginman = plugin_manager::instance();
$instances = get_plugin_list('engagementindicator');
if (!($weightings = $DB->get_records_menu('coursereport_engagement', array('course' => $courseid), '', 'indicator, weight'))) {
// Setup default weightings, all equal.
$weight = sprintf('%.2f', 1 / count($instances));
foreach ($instances as $name => $path) {
$record = new stdClass();
$record->course = $courseid;
$record->indicator = $name;
$record->weight = $weight;
$record->configdata = null;
$wid = $DB->insert_record('coursereport_engagement', $record);
$weightings[$name] = $weight;
}
}
foreach ($instances as $name => $path) {
$plugin = coursereport_engagement_get_plugin_info($pluginman, 'engagementindicator_' . $name);
if ($plugin->is_enabled() && file_exists("{$path}/indicator.class.php")) {
require_once "{$path}/indicator.class.php";
$classname = "indicator_{$name}";
$indicator = new $classname($courseid);
$indicatorrisks = $indicator->get_course_risks();
$weight = isset($weightings[$name]) ? $weightings[$name] : 0;
foreach ($indicatorrisks as $userid => $risk) {
if (!isset($risks[$userid])) {
$risks[$userid] = 0;
}
$risks[$userid] += $risk->risk * $weight;
}
}
}
return $risks;
}
开发者ID:netspotau,项目名称:moodle-coursereport_engagement,代码行数:40,代码来源:lib.php
示例16: get_blocks_from_path
/**
* Load all the blocks information needed for a given path within moodle2 backup
*
* This function, given one full path (course, activities/xxxx) will look for all the
* blocks existing in the backup file, returning one array used to build the
* proper restore plan by the @restore_plan_builder
*/
public static function get_blocks_from_path($path)
{
global $DB;
$blocks = array();
// To return results
static $availableblocks = array();
// Get and cache available blocks
if (empty($availableblocks)) {
$availableblocks = array_keys(get_plugin_list('block'));
}
$path = $path . '/blocks';
// Always look under blocks subdir
if (!is_dir($path)) {
return array();
}
if (!($dir = opendir($path))) {
return array();
}
while (false !== ($file = readdir($dir))) {
if ($file == '.' || $file == '..') {
// Skip dots
continue;
}
if (is_dir($path . '/' . $file)) {
// Dir found, check it's a valid block
if (!file_exists($path . '/' . $file . '/block.xml')) {
// Skip if xml file not found
continue;
}
// Extract block name
$blockname = preg_replace('/(.*)_\\d+/', '\\1', $file);
// Check block exists and is installed
if (in_array($blockname, $availableblocks) && $DB->record_exists('block', array('name' => $blockname))) {
$blocks[$path . '/' . $file] = $blockname;
}
}
}
closedir($dir);
return $blocks;
}
开发者ID:Burick,项目名称:moodle,代码行数:47,代码来源:backup_general_helper.class.php
示例17: get_system_info
/**
* Gets the list of plugin types and the system available ingredients
*/
public function get_system_info()
{
// Load moodle plugins manager and get the plugins
$pluginman = plugin_manager::instance();
$pluginman->get_plugins();
$pluginman->get_subplugins();
// Getting the plugin types
$plugintypes = get_plugin_types();
foreach ($plugintypes as $type => $path) {
$plugins = get_plugin_list($type);
// We only add the plugin type if it has plugins
if ($plugins) {
// Core plugins
if ($coreplugins = $pluginman->standard_plugins_list($type)) {
$coreplugins = array_combine($coreplugins, $coreplugins);
}
// The plugin type data
$branchid = $type;
$branchname = $pluginman->plugintype_name_plural($type);
foreach ($plugins as $pluginname => $pluginpath) {
// We will only list the non standard plugins
if (!empty($coreplugins) && !empty($coreplugins[$pluginname])) {
continue;
}
$this->branches[$type]->branches[$pluginname] = new StdClass();
$this->branches[$type]->branches[$pluginname]->id = $pluginname;
// The plugin user friendly name
$pluginvisiblename = $this->get_system_plugin_visiblename($type, $pluginname);
$this->branches[$type]->branches[$pluginname]->name = $pluginvisiblename;
}
// Only if there is non core plugins
if (empty($this->branches[$type]->branches)) {
continue;
}
$this->branches[$type]->id = $branchid;
$this->branches[$type]->name = $branchname;
}
}
}
开发者ID:uofr,项目名称:moodle-local_flavours,代码行数:42,代码来源:flavours_ingredient_plugin.class.php
示例18: scorm_report_list
function scorm_report_list($context)
{
global $CFG;
static $reportlist;
if (!empty($reportlist)) {
return $reportlist;
}
$installed = get_plugin_list('scormreport');
foreach ($installed as $reportname => $notused) {
$pluginfile = $CFG->dirroot . '/mod/scorm/report/' . $reportname . '/report.php';
if (is_readable($pluginfile)) {
include_once $pluginfile;
$reportclassname = "scorm_{$reportname}_report";
if (class_exists($reportclassname)) {
$report = new $reportclassname();
if ($report->canview($context)) {
$reportlist[] = $reportname;
}
}
}
}
return $reportlist;
}
开发者ID:richheath,项目名称:moodle,代码行数:23,代码来源:reportlib.php
示例19: get_plugins
/**
* Gathers and returns the information about all plugins of the given type.
*
* @param string $type the name of the plugintype, eg. mod, auth or workshopform
* @param string $typerootdir full path to the location of the plugin dir
* @param string $typeclass the name of the actually called class
* @return array of plugintype classes, indexed by the plugin name
*/
public static function get_plugins($plugintype, $plugintyperootdir, $plugintypeclass)
{
global $CFG, $DB;
// Track our method result.
$result = array();
if (!$DB->get_manager()->table_exists('config_plugins')) {
return $result;
}
// Obtain the list of all file plugins.
$fileplugins = get_plugin_list('dhimport');
foreach ($fileplugins as $pluginname => $pluginpath) {
if (in_array($pluginname, array('sample', 'header', 'multiple'))) {
// Filter-out bogus plugins
continue;
}
// Set up the main plugin information.
$instance = new $plugintypeclass();
$instance->type = $plugintype;
$instance->typerootdir = $plugintyperootdir;
$instance->name = $pluginname;
$instance->rootdir = $pluginpath;
$instance->displayname = get_string('pluginname', $plugintype . '_' . $pluginname);
// Track the current database version.
$versiondb = get_config($plugintype . '_' . $pluginname, 'version');
$instance->versiondb = $versiondb !== false ? $versiondb : null;
// Track the proposed new version.
$plugin = new \stdClass();
include "{$instance->rootdir}/version.php";
$instance->versiondisk = $plugin->version;
$instance->init_is_standard();
// Is this really needed?
// Append to results.
$result[$pluginname] = $instance;
}
return $result;
}
开发者ID:jamesmcq,项目名称:elis,代码行数:44,代码来源:dhimport.php
示例20: load_course_settings
/**
* This function loads the course settings that are available for the user
*
* @param bool $forceopen If set to true the course node will be forced open
* @return navigation_node|false
*/
protected function load_course_settings($forceopen = false)
{
global $CFG;
$course = $this->page->course;
$coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
// note: do not test if enrolled or viewing here because we need the enrol link in Course administration section
$coursenode = $this->add(get_string('courseadministration'), null, self::TYPE_COURSE, null, 'courseadmin');
if ($forceopen) {
$coursenode->force_open();
}
if (has_capability('moodle/course:update', $coursecontext)) {
// Add the turn on/off settings
if ($this->page->url->compare(new moodle_url('/course/view.php'), URL_MATCH_BASE)) {
// We are on the course page, retain the current page params e.g. section.
$baseurl = clone $this->page->url;
$baseurl->param('sesskey', sesskey());
} else {
// Edit on the main course page.
$baseurl = new moodle_url('/course/view.php', array('id' => $course->id, 'return' => $this->page->url->out_as_local_url(false), 'sesskey' => sesskey()));
}
$editurl = clone $baseurl;
if ($this->page->user_is_editing()) {
$editurl->param('edit', 'off');
$editstring = get_string('turneditingoff');
} else {
$editurl->param('edit', 'on');
$editstring = get_string('turneditingon');
}
$coursenode->add($editstring, $editurl, self::TYPE_SETTING, null, null, new pix_icon('i/edit', ''));
// Add the module chooser toggle
$modchoosertoggleurl = clone $baseurl;
if ($this->page->user_is_editing() && course_ajax_enabled($course)) {
if ($usemodchooser = get_user_preferences('usemodchooser', $CFG->modchooserdefault)) {
$modchoosertogglestring = get_string('modchooserdisable', 'moodle');
$modchoosertoggleurl->param('modchooser', 'off');
} else {
$modchoosertogglestring = get_string('modchooserenable', 'moodle');
$modchoosertoggleurl->param('modchooser', 'on');
}
$modchoosertoggle = $coursenode->add($modchoosertogglestring, $modchoosertoggleurl, self::TYPE_SETTING);
$modchoosertoggle->add_class('modchoosertoggle');
$modchoosertoggle->add_class('visibleifjs');
user_preference_allow_ajax_update('usemodchooser', PARAM_BOOL);
}
if ($this->page->user_is_editing()) {
// Removed as per MDL-22732
// $this->add_course_editing_links($course);
}
// Add the course settings link
$url = new moodle_url('/course/edit.php', array('id' => $course->id));
$coursenode->add(get_string('editsettings'), $url, self::TYPE_SETTING, null, null, new pix_icon('i/settings', ''));
// Add the course completion settings link
if ($CFG->enablecompletion && $course->enablecompletion) {
$url = new moodle_url('/course/completion.php', array('id' => $course->id));
$coursenode->add(get_string('completion', 'completion'), $url, self::TYPE_SETTING, null, null, new pix_icon('i/settings', ''));
}
}
// add enrol nodes
enrol_add_course_navigation($coursenode, $course);
// Manage filters
if (has_capability('moodle/filter:manage', $coursecontext) && count(filter_get_available_in_context($coursecontext)) > 0) {
$url = new moodle_url('/filter/manage.php', array('contextid' => $coursecontext->id));
$coursenode->add(get_string('filters', 'admin'), $url, self::TYPE_SETTING, null, null, new pix_icon('i/filter', ''));
}
// Add view grade report is permitted
$reportavailable = false;
if (has_capability('moodle/grade:viewall', $coursecontext)) {
$reportavailable = true;
} else {
if (!empty($course->showgrades)) {
$reports = get_plugin_list('gradereport');
if (is_array($reports) && count($reports) > 0) {
// Get all installed reports
arsort($reports);
// user is last, we want to test it first
foreach ($reports as $plugin => $plugindir) {
if (has_capability('gradereport/' . $plugin . ':view', $coursecontext)) {
//stop when the first visible plugin is found
$reportavailable = true;
break;
}
}
}
}
}
if ($reportavailable) {
$url = new moodle_url('/grade/report/index.php', array('id' => $course->id));
$gradenode = $coursenode->add(get_string('grades'), $url, self::TYPE_SETTING, null, 'grades', new pix_icon('i/grades', ''));
}
// Add outcome if permitted
if (!empty($CFG->enableoutcomes) && has_capability('moodle/course:update', $coursecontext)) {
$url = new moodle_url('/grade/edit/outcome/course.php', array('id' => $course->id));
$coursenode->add(get_string('outcomes', 'grades'), $url, self::TYPE_SETTING, null, 'outcomes', new pix_icon('i/outcomes', ''));
}
//.........这里部分代码省略.........
开发者ID:saurabh947,项目名称:MoodleLearning,代码行数:101,代码来源:navigationlib.php
注:本文中的get_plugin_list函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论