当前位置: 首页>>代码示例>>PHP>>正文


PHP get_plugin_list_with_function函数代码示例

本文整理汇总了PHP中get_plugin_list_with_function函数的典型用法代码示例。如果您正苦于以下问题:PHP get_plugin_list_with_function函数的具体用法?PHP get_plugin_list_with_function怎么用?PHP get_plugin_list_with_function使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了get_plugin_list_with_function函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: build_tree

 /**
  * Parse all callbacks and builds the tree.
  *
  * @param integer   $user ID of the user for which the profile is displayed.
  * @param bool      $iscurrentuser true if the profile being viewed is of current user, else false.
  * @param \stdClass $course Course object
  *
  * @return tree Fully build tree to be rendered on my profile page.
  */
 public static function build_tree($user, $iscurrentuser, $course = null)
 {
     global $CFG;
     $tree = new tree();
     // Add core nodes.
     require_once $CFG->libdir . "/myprofilelib.php";
     core_myprofile_navigation($tree, $user, $iscurrentuser, $course);
     // Core components.
     $components = \core_component::get_core_subsystems();
     foreach ($components as $component => $directory) {
         if (empty($directory)) {
             continue;
         }
         $file = $directory . "/lib.php";
         if (is_readable($file)) {
             require_once $file;
             $function = "core_" . $component . "_myprofile_navigation";
             if (function_exists($function)) {
                 $function($tree, $user, $iscurrentuser, $course);
             }
         }
     }
     // Plugins.
     $types = \core_component::get_plugin_types();
     foreach ($types as $type => $dir) {
         $pluginlist = get_plugin_list_with_function($type, "myprofile_navigation", "lib.php");
         foreach ($pluginlist as $function) {
             $function($tree, $user, $iscurrentuser, $course);
         }
     }
     $tree->sort_categories();
     return $tree;
 }
开发者ID:educakanchay,项目名称:campus,代码行数:42,代码来源:manager.php

示例2: block_course_overview_get_overviews

/**
 * Display overview for courses
 *
 * @param array $courses courses for which overview needs to be shown
 * @return array html overview
 */
function block_course_overview_get_overviews($courses)
{
    $htmlarray = array();
    if ($modules = get_plugin_list_with_function('mod', 'print_overview')) {
        foreach ($modules as $fname) {
            $fname($courses, $htmlarray);
        }
    }
    return $htmlarray;
}
开发者ID:JP-Git,项目名称:moodle,代码行数:16,代码来源:locallib.php

示例3: __construct

 /**
  * Gather a list of dndupload handlers from the different mods
  *
  * @param object $course The course this is being added to (to check course_allowed_module() )
  */
 public function __construct($course, $modnames = null)
 {
     global $CFG, $PAGE;
     // Add some default types to handle.
     // Note: 'Files' type is hard-coded into the Javascript as this needs to be ...
     // ... treated a little differently.
     $this->register_type('url', array('url', 'text/uri-list', 'text/x-moz-url'), get_string('addlinkhere', 'moodle'), get_string('nameforlink', 'moodle'), get_string('whatforlink', 'moodle'), 10);
     $this->register_type('text/html', array('text/html'), get_string('addpagehere', 'moodle'), get_string('nameforpage', 'moodle'), get_string('whatforpage', 'moodle'), 20);
     $this->register_type('text', array('text', 'text/plain'), get_string('addpagehere', 'moodle'), get_string('nameforpage', 'moodle'), get_string('whatforpage', 'moodle'), 30);
     // Loop through all modules to find handlers.
     $mods = get_plugin_list_with_function('mod', 'dndupload_register');
     foreach ($mods as $component => $funcname) {
         list($modtype, $modname) = normalize_component($component);
         if ($modnames && !array_key_exists($modname, $modnames)) {
             continue;
             // Module is deactivated (hidden) at the site level.
         }
         if (!course_allowed_module($course, $modname)) {
             continue;
             // User does not have permission to add this module to the course.
         }
         $resp = $funcname();
         if (!$resp) {
             continue;
         }
         if (isset($resp['files'])) {
             foreach ($resp['files'] as $file) {
                 $this->register_file_handler($file['extension'], $modname, $file['message']);
             }
         }
         if (isset($resp['addtypes'])) {
             foreach ($resp['addtypes'] as $type) {
                 if (isset($type['priority'])) {
                     $priority = $type['priority'];
                 } else {
                     $priority = 100;
                 }
                 if (!isset($type['handlermessage'])) {
                     $type['handlermessage'] = '';
                 }
                 $this->register_type($type['identifier'], $type['datatransfertypes'], $type['addmessage'], $type['namemessage'], $type['handlermessage'], $priority);
             }
         }
         if (isset($resp['types'])) {
             foreach ($resp['types'] as $type) {
                 $noname = !empty($type['noname']);
                 $this->register_type_handler($type['identifier'], $modname, $type['message'], $noname);
             }
         }
         $PAGE->requires->string_for_js('pluginname', $modname);
     }
 }
开发者ID:masaterutakeno,项目名称:MoodleMobile,代码行数:57,代码来源:dnduploadlib.php

示例4: block_course_overview_get_overviews

/**
 * Display overview for courses
 *
 * @param array $courses courses for which overview needs to be shown
 * @return array html overview
 */
function block_course_overview_get_overviews($courses)
{
    $htmlarray = array();
    if ($modules = get_plugin_list_with_function('mod', 'print_overview')) {
        // Split courses list into batches with no more than MAX_MODINFO_CACHE_SIZE courses in one batch.
        // Otherwise we exceed the cache limit in get_fast_modinfo() and rebuild it too often.
        if (defined('MAX_MODINFO_CACHE_SIZE') && MAX_MODINFO_CACHE_SIZE > 0 && count($courses) > MAX_MODINFO_CACHE_SIZE) {
            $batches = array_chunk($courses, MAX_MODINFO_CACHE_SIZE, true);
        } else {
            $batches = array($courses);
        }
        foreach ($batches as $courses) {
            foreach ($modules as $fname) {
                $fname($courses, $htmlarray);
            }
        }
    }
    return $htmlarray;
}
开发者ID:evltuma,项目名称:moodle,代码行数:25,代码来源:locallib.php

示例5: load_local_plugin_settings

 /**
  * This function gives local plugins an opportunity to modify the settings navigation.
  */
 protected function load_local_plugin_settings()
 {
     foreach (get_plugin_list_with_function('local', 'extend_settings_navigation') as $function) {
         $function($this, $this->context);
     }
 }
开发者ID:evltuma,项目名称:moodle,代码行数:9,代码来源:navigationlib.php

示例6: load_front_page_settings

 /**
  * This function loads all of the front page settings into the settings navigation.
  * This function is called when the user is on the front page, or $COURSE==$SITE
  * @param bool $forceopen (optional)
  * @return navigation_node
  */
 protected function load_front_page_settings($forceopen = false)
 {
     global $SITE, $CFG;
     $course = clone $SITE;
     $coursecontext = context_course::instance($course->id);
     // Course context
     $frontpage = $this->add(get_string('frontpagesettings'), null, self::TYPE_SETTING, null, 'frontpage');
     if ($forceopen) {
         $frontpage->force_open();
     }
     $frontpage->id = 'frontpagesettings';
     if ($this->page->user_allowed_editing()) {
         // Add the turn on/off settings
         $url = new moodle_url('/course/view.php', array('id' => $course->id, 'sesskey' => sesskey()));
         if ($this->page->user_is_editing()) {
             $url->param('edit', 'off');
             $editstring = get_string('turneditingoff');
         } else {
             $url->param('edit', 'on');
             $editstring = get_string('turneditingon');
         }
         $frontpage->add($editstring, $url, self::TYPE_SETTING, null, null, new pix_icon('i/edit', ''));
     }
     if (has_capability('moodle/course:update', $coursecontext)) {
         // Add the course settings link
         $url = new moodle_url('/admin/settings.php', array('section' => 'frontpagesettings'));
         $frontpage->add(get_string('editsettings'), $url, self::TYPE_SETTING, null, null, new pix_icon('i/settings', ''));
     }
     // add enrol nodes
     enrol_add_course_navigation($frontpage, $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));
         $frontpage->add(get_string('filters', 'admin'), $url, self::TYPE_SETTING, null, null, new pix_icon('i/filter', ''));
     }
     // View course reports.
     if (has_capability('moodle/site:viewreports', $coursecontext)) {
         // Basic capability for listing of reports.
         $frontpagenav = $frontpage->add(get_string('reports'), null, self::TYPE_CONTAINER, null, 'frontpagereports', new pix_icon('i/stats', ''));
         $coursereports = core_component::get_plugin_list('coursereport');
         foreach ($coursereports as $report => $dir) {
             $libfile = $CFG->dirroot . '/course/report/' . $report . '/lib.php';
             if (file_exists($libfile)) {
                 require_once $libfile;
                 $reportfunction = $report . '_report_extend_navigation';
                 if (function_exists($report . '_report_extend_navigation')) {
                     $reportfunction($frontpagenav, $course, $coursecontext);
                 }
             }
         }
         $reports = get_plugin_list_with_function('report', 'extend_navigation_course', 'lib.php');
         foreach ($reports as $reportfunction) {
             $reportfunction($frontpagenav, $course, $coursecontext);
         }
     }
     // Backup this course
     if (has_capability('moodle/backup:backupcourse', $coursecontext)) {
         $url = new moodle_url('/backup/backup.php', array('id' => $course->id));
         $frontpage->add(get_string('backup'), $url, self::TYPE_SETTING, null, null, new pix_icon('i/backup', ''));
     }
     // Restore to this course
     if (has_capability('moodle/restore:restorecourse', $coursecontext)) {
         $url = new moodle_url('/backup/restorefile.php', array('contextid' => $coursecontext->id));
         $frontpage->add(get_string('restore'), $url, self::TYPE_SETTING, null, null, new pix_icon('i/restore', ''));
     }
     // Questions
     require_once $CFG->libdir . '/questionlib.php';
     question_extend_settings_navigation($frontpage, $coursecontext)->trim_if_empty();
     // Manage files
     if ($course->legacyfiles == 2 and has_capability('moodle/course:managefiles', $this->context)) {
         //hiden in new installs
         $url = new moodle_url('/files/index.php', array('contextid' => $coursecontext->id));
         $frontpage->add(get_string('sitelegacyfiles'), $url, self::TYPE_SETTING, null, null, new pix_icon('i/folder', ''));
     }
     // Let plugins hook into frontpage navigation.
     $pluginsfunction = get_plugins_with_function('extend_navigation_frontpage', 'lib.php');
     foreach ($pluginsfunction as $plugintype => $plugins) {
         foreach ($plugins as $pluginfunction) {
             $pluginfunction($frontpage, $course, $coursecontext);
         }
     }
     return $frontpage;
 }
开发者ID:nadavkav,项目名称:moodle-accessibility,代码行数:89,代码来源:navigationlib.php

示例7: remove_course_contents


//.........这里部分代码省略.........
                $moddeletecourse($course, $showfeedback);
            }
            if ($instances and $showfeedback) {
                echo $OUTPUT->notification($strdeleted . get_string('pluginname', $modname), 'notifysuccess');
            }
        } else {
            // Ooops, this module is not properly installed, force-delete it in the next block.
        }
    }
    // We have tried to delete everything the nice way - now let's force-delete any remaining module data.
    // Remove all data from availability and completion tables that is associated
    // with course-modules belonging to this course. Note this is done even if the
    // features are not enabled now, in case they were enabled previously.
    $DB->delete_records_select('course_modules_completion', 'coursemoduleid IN (SELECT id from {course_modules} WHERE course=?)', array($courseid));
    // Remove course-module data.
    $cms = $DB->get_records('course_modules', array('course' => $course->id));
    foreach ($cms as $cm) {
        if ($module = $DB->get_record('modules', array('id' => $cm->module))) {
            try {
                $DB->delete_records($module->name, array('id' => $cm->instance));
            } catch (Exception $e) {
                // Ignore weird or missing table problems.
            }
        }
        context_helper::delete_instance(CONTEXT_MODULE, $cm->id);
        $DB->delete_records('course_modules', array('id' => $cm->id));
    }
    if ($showfeedback) {
        echo $OUTPUT->notification($strdeleted . get_string('type_mod_plural', 'plugin'), 'notifysuccess');
    }
    // Cleanup the rest of plugins.
    $cleanuplugintypes = array('report', 'coursereport', 'format');
    foreach ($cleanuplugintypes as $type) {
        $plugins = get_plugin_list_with_function($type, 'delete_course', 'lib.php');
        foreach ($plugins as $plugin => $pluginfunction) {
            $pluginfunction($course->id, $showfeedback);
        }
        if ($showfeedback) {
            echo $OUTPUT->notification($strdeleted . get_string('type_' . $type . '_plural', 'plugin'), 'notifysuccess');
        }
    }
    // Delete questions and question categories.
    question_delete_course($course, $showfeedback);
    if ($showfeedback) {
        echo $OUTPUT->notification($strdeleted . get_string('questions', 'question'), 'notifysuccess');
    }
    // Make sure there are no subcontexts left - all valid blocks and modules should be already gone.
    $childcontexts = $coursecontext->get_child_contexts();
    // Returns all subcontexts since 2.2.
    foreach ($childcontexts as $childcontext) {
        $childcontext->delete();
    }
    unset($childcontexts);
    // Remove all roles and enrolments by default.
    if (empty($options['keep_roles_and_enrolments'])) {
        // This hack is used in restore when deleting contents of existing course.
        role_unassign_all(array('contextid' => $coursecontext->id, 'component' => ''), true);
        enrol_course_delete($course);
        if ($showfeedback) {
            echo $OUTPUT->notification($strdeleted . get_string('type_enrol_plural', 'plugin'), 'notifysuccess');
        }
    }
    // Delete any groups, removing members and grouping/course links first.
    if (empty($options['keep_groups_and_groupings'])) {
        groups_delete_groupings($course->id, $showfeedback);
        groups_delete_groups($course->id, $showfeedback);
开发者ID:riawarra,项目名称:moodle,代码行数:67,代码来源:moodlelib.php

示例8: get_activities_overview

 /**
  * Return activities overview for the given courses.
  *
  * @param array $courseids a list of course ids
  * @return array of warnings and the activities overview
  * @since Moodle 3.2
  * @throws moodle_exception
  */
 public static function get_activities_overview($courseids)
 {
     global $USER;
     // Parameter validation.
     $params = self::validate_parameters(self::get_activities_overview_parameters(), array('courseids' => $courseids));
     $courseoverviews = array();
     list($courses, $warnings) = external_util::validate_courses($params['courseids']);
     if (!empty($courses)) {
         // Add lastaccess to each course (required by print_overview function).
         // We need the complete user data, the ws server does not load a complete one.
         $user = get_complete_user_data('id', $USER->id);
         foreach ($courses as $course) {
             if (isset($user->lastcourseaccess[$course->id])) {
                 $course->lastaccess = $user->lastcourseaccess[$course->id];
             } else {
                 $course->lastaccess = 0;
             }
         }
         $overviews = array();
         if ($modules = get_plugin_list_with_function('mod', 'print_overview')) {
             foreach ($modules as $fname) {
                 $fname($courses, $overviews);
             }
         }
         // Format output.
         foreach ($overviews as $courseid => $modules) {
             $courseoverviews[$courseid]['id'] = $courseid;
             $courseoverviews[$courseid]['overviews'] = array();
             foreach ($modules as $modname => $overviewtext) {
                 $courseoverviews[$courseid]['overviews'][] = array('module' => $modname, 'overviewtext' => $overviewtext);
             }
         }
     }
     $result = array('courses' => $courseoverviews, 'warnings' => $warnings);
     return $result;
 }
开发者ID:dg711,项目名称:moodle,代码行数:44,代码来源:externallib.php

示例9: get_supported_reports

 /**
  * Get a list of reports that support the given store instance.
  *
  * @param string $logstore Name of the store.
  *
  * @return array List of supported reports
  */
 public function get_supported_reports($logstore)
 {
     $allstores = self::get_store_plugins();
     if (empty($allstores[$logstore])) {
         // Store doesn't exist.
         return array();
     }
     $reports = get_plugin_list_with_function('report', 'supports_logstore', 'lib.php');
     $enabled = $this->stores;
     if (empty($enabled[$logstore])) {
         // Store is not enabled, init an instance.
         $classname = '\\' . $logstore . '\\log\\store';
         $instance = new $classname($this);
     } else {
         $instance = $enabled[$logstore];
     }
     $return = array();
     foreach ($reports as $report => $fulldir) {
         if (component_callback($report, 'supports_logstore', array($instance), false)) {
             $return[$report] = get_string('pluginname', $report);
         }
     }
     return $return;
 }
开发者ID:sriysk,项目名称:moodle-integration,代码行数:31,代码来源:manager.php

示例10: course_section_cm


//.........这里部分代码省略.........
         }
         $assetrestrictions .= "<div class='text'>{$groupinfo}</div>";
     }
     // TODO - ask what this is...
     if (!empty($mod->groupingid) && $canmanagegroups) {
         // Grouping label.
         $groupings = groups_get_all_groupings($mod->course);
         $assetrestrictions .= "<div class='text text-danger'>" . format_string($groupings[$mod->groupingid]->name) . "</div>";
         // TBD - add a title to show this is the Grouping...
     }
     $canviewhidden = has_capability('moodle/course:viewhiddenactivities', $mod->context);
     // If the module isn't available, or we are a teacher (can view hidden activities) then get availability
     // info.
     $availabilityinfo = '';
     if (!$mod->available || $canviewhidden) {
         $availabilityinfo = $this->course_section_cm_availability($mod, $displayoptions);
     }
     if ($availabilityinfo !== '') {
         $conditionalinfo = get_string('conditional', 'theme_snap');
         $assetrestrictions .= "<div class='text text-danger'>{$conditionalinfo}.{$availabilityinfo}</div>";
     }
     $assetrestrictions = "<div class='snap-restrictions-meta'>{$assetrestrictions}</div>";
     $assetmeta .= $assetcompletionmeta . $assetrestrictions;
     // Build output.
     $postcontent = '<div class="snap-asset-meta" data-cmid="' . $mod->id . '">' . $mod->afterlink . $assetmeta . '</div>';
     $output .= $assetlink . $contentpart . $postcontent;
     // Bail at this point if we aren't using a supported format. (Folder view is only partially supported).
     $supported = ['folderview', 'topics', 'weeks', 'site'];
     if (!in_array($COURSE->format, $supported)) {
         return parent::course_section_cm($course, $completioninfo, $mod, $sectionreturn, $displayoptions) . $assetmeta;
     }
     // Build up edit actions.
     $actions = '';
     $actionsadvanced = array();
     $coursecontext = context_course::instance($mod->course);
     $modcontext = context_module::instance($mod->id);
     $baseurl = new moodle_url('/course/mod.php', array('sesskey' => sesskey()));
     if (has_capability('moodle/course:update', $modcontext)) {
         $str = get_strings(array('delete', 'move', 'duplicate', 'hide', 'show', 'roles'), 'moodle');
         // TODO - add snap strings here.
         // Move, Edit, Delete.
         if (has_capability('moodle/course:manageactivities', $modcontext)) {
             $movealt = get_string('move', 'theme_snap', $mod->get_formatted_name());
             $moveicon = "<img title='{$movealt}' aria-hidden='true' class='svg-icon' src='" . $this->output->pix_url('move', 'theme') . "' />";
             $editalt = get_string('edit', 'theme_snap', $mod->get_formatted_name());
             $editicon = "<img title='{$editalt}' alt='{$editalt}' class='svg-icon' src='" . $this->output->pix_url('edit', 'theme') . "'/>";
             $actions .= "<input id='snap-move-mod-{$mod->id}' class='js-snap-asset-move sr-only' type='checkbox'><label class='snap-asset-move' for='snap-move-mod-{$mod->id}'><span class='sr-only'>{$movealt}</span>{$moveicon}</label>";
             $actions .= "<a class='snap-edit-asset' href='" . new moodle_url($baseurl, array('update' => $mod->id)) . "'>{$editicon}</a>";
             $actionsadvanced[] = "<a href='" . new moodle_url($baseurl, array('delete' => $mod->id)) . "'>{$str->delete}</a>";
         }
         // Hide/Show.
         if (has_capability('moodle/course:activityvisibility', $modcontext)) {
             $actionsadvanced[] = "<a href='" . new moodle_url($baseurl, array('hide' => $mod->id)) . "' class='editing_hide js_snap_hide'>{$str->hide}</a>";
             $actionsadvanced[] = "<a href='" . new moodle_url($baseurl, array('show' => $mod->id)) . "' class='editing_show js_snap_show'>{$str->show}</a>";
             // AX click to change.
         }
         // Duplicate.
         $dupecaps = array('moodle/backup:backuptargetimport', 'moodle/restore:restoretargetimport');
         if (has_all_capabilities($dupecaps, $coursecontext) && plugin_supports('mod', $mod->modname, FEATURE_BACKUP_MOODLE2) && plugin_supports('mod', $mod->modname, 'duplicate', true)) {
             $actionsadvanced[] = "<a href='" . new moodle_url($baseurl, array('duplicate' => $mod->id)) . "' class='js_snap_duplicate'>{$str->duplicate}</a>";
         }
         // Asign roles.
         if (has_capability('moodle/role:assign', $modcontext)) {
             $actionsadvanced[] = "<a href='" . new moodle_url('/admin/roles/assign.php', array('contextid' => $modcontext->id)) . "'>{$str->roles}</a>";
         }
         // Give local plugins a chance to add icons.
         $localplugins = array();
         foreach (get_plugin_list_with_function('local', 'extend_module_editing_buttons') as $function) {
             $localplugins = array_merge($localplugins, $function($mod));
         }
         // TODO - pld string is far too long....
         $locallinks = '';
         foreach ($localplugins as $localplugin) {
             $url = $localplugin->url;
             $text = $localplugin->text;
             $class = $localplugin->attributes['class'];
             $actionsadvanced[] = "<a href='{$url}' class='{$class}'>{$text}</a>";
         }
     }
     $advancedactions = '';
     if (!empty($actionsadvanced)) {
         $moreicon = "<img title='" . get_string('more', 'theme_snap') . "' alt='" . get_string('more', 'theme_snap') . "' class='svg-icon' src='" . $this->output->pix_url('more', 'theme') . "'/>";
         $advancedactions = "<div class='dropdown snap-edit-more-dropdown'>\n                      <a href='#' class='dropdown-toggle snap-edit-asset-more' data-toggle='dropdown' aria-expanded='false' aria-haspopup='true'>{$moreicon}</a>\n                      <ul class='dropdown-menu'>";
         foreach ($actionsadvanced as $action) {
             $advancedactions .= "<li>{$action}</li>";
         }
         $advancedactions .= "</ul></div>";
     }
     // Add actions menu.
     if ($actions) {
         $output .= "<div class='snap-asset-actions' role='region' aria-label='actions'>";
         $output .= $actions . $advancedactions;
         $output .= "</div>";
     }
     $output .= "</div>";
     // Close .activityinstance.
     $output .= "</div>";
     // Close .asset-wrapper.
     return $output;
 }
开发者ID:pramithkm,项目名称:moodle-theme_snap,代码行数:101,代码来源:course_renderer.php

示例11: local_print_course_overview

/**
 * an adaptation of the standard print_course_overview()
 * @param array $courses a course array to print
 * @param boolean $return if true returns the string
 * @return the rendered view if return is true
 */
function local_print_course_overview($courses, $options = array())
{
    global $PAGE, $OUTPUT;
    $renderer = $PAGE->get_renderer('local_my');
    // Be sure we have something in lastaccess.
    foreach ($courses as $cid => $c) {
        $courses[$cid]->lastaccess = 0 + @$courses[$cid]->lastaccess;
    }
    $overviews = array();
    if ($modules = get_plugin_list_with_function('mod', 'print_overview')) {
        foreach ($modules as $fname) {
            $fname($courses, $overviews);
        }
    }
    $str = '';
    $str .= '<div class="courselist">';
    foreach ($courses as $cid => $c) {
        $str .= '<div>';
        if (empty($options['nocompletion'])) {
            $str .= $renderer->course_completion_gauge($c, 'div', $options['gaugewidth'], $options['gaugeheight']);
        }
        $str .= $renderer->course_simple_div($c);
        $str .= '</div>';
    }
    $str .= '</div>';
    return $str;
}
开发者ID:vfremaux,项目名称:moodle-local_my,代码行数:33,代码来源:lib.php

示例12: init_search_conditions

 /**
  * Initialize search conditions from plugins
  * local_*_get_question_bank_search_conditions() must return an array of
  * \core_question\bank\search\condition objects.
  */
 protected function init_search_conditions()
 {
     $searchplugins = get_plugin_list_with_function('local', 'get_question_bank_search_conditions');
     foreach ($searchplugins as $component => $function) {
         foreach ($function($this) as $searchobject) {
             $this->add_searchcondition($searchobject);
         }
     }
 }
开发者ID:Gavinthisisit,项目名称:Moodle,代码行数:14,代码来源:view.php

示例13: require_login

// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
/**
 * On install, builds the search data for all existing content.
 *
 * @package local_ousearch
 * @copyright 2014 The Open University
 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */
require __DIR__ . '/../../config.php';
// Check administrator or similar.
require_login();
require_capability('moodle/site:config', context_system::instance());
$url = new moodle_url('/local/ousearch/postinstall.php');
$PAGE->set_url($url);
$PAGE->set_context(context_system::instance());
echo $OUTPUT->header();
if ($_SERVER['REQUEST_METHOD'] === 'POST' && confirm_sesskey()) {
    require_once __DIR__ . '/searchlib.php';
    $plugins = get_plugin_list_with_function('mod', 'ousearch_update_all');
    foreach ($plugins as $plugin => $fn) {
        $fn(true);
    }
} else {
    echo $OUTPUT->box(get_string('postinstall', 'local_ousearch'));
    echo $OUTPUT->single_button($url, get_string('continue'));
}
echo $OUTPUT->footer();
开发者ID:profcab,项目名称:moodle-local_ousearch,代码行数:31,代码来源:postinstall.php

示例14: lti_extend_lti_services

/**
 * Extend the LTI services through the ltisource plugins
 *
 * @param stdClass $data LTI request data
 * @return bool
 * @throws coding_exception
 */
function lti_extend_lti_services($data)
{
    $plugins = get_plugin_list_with_function('ltisource', $data->messagetype);
    if (!empty($plugins)) {
        // There can only be one.
        if (count($plugins) > 1) {
            throw new coding_exception('More than one ltisource plugin handler found');
        }
        $data->xml = new SimpleXMLElement($data->body);
        $callback = current($plugins);
        call_user_func($callback, $data);
        return true;
    }
    return false;
}
开发者ID:evltuma,项目名称:moodle,代码行数:22,代码来源:servicelib.php

示例15: local_ltiprovider_call_hook

/**
 * Call a hook present in a subplugin
 *
 * @param  string $hookname The hookname (function without franken style prefix)
 * @param  object $data     Object containing data to be used by the hook function
 * @return bool             Allways false
 */
function local_ltiprovider_call_hook($hookname, $data)
{
    $plugins = get_plugin_list_with_function('ltiproviderextension', $hookname);
    if (!empty($plugins)) {
        foreach ($plugins as $plugin) {
            call_user_func($plugin, $data);
        }
    }
    return false;
}
开发者ID:OctaveBabel,项目名称:moodle-itop,代码行数:17,代码来源:lib.php


注:本文中的get_plugin_list_with_function函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。