• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP core_component类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



在下文中一共展示了core_component类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: definition

 function definition()
 {
     global $CFG;
     $mform =& $this->_form;
     //$mform->addElement('html', get_string('unplagexplain', 'plagiarism_unplag'));
     $mform->addElement('checkbox', 'unplag_use', get_string('useunplag', 'plagiarism_unplag'));
     $mform->addElement('text', 'unplag_client_id', get_string('unplag_client_id', 'plagiarism_unplag'));
     $mform->addHelpButton('unplag_client_id', 'unplag_client_id', 'plagiarism_unplag');
     $mform->addRule('unplag_client_id', null, 'required', null, 'client');
     $mform->setType('unplag_client_id', PARAM_TEXT);
     $mform->addElement('text', 'unplag_api_secret', get_string('unplag_api_secret', 'plagiarism_unplag'));
     $mform->addHelpButton('unplag_api_secret', 'unplag_api_secret', 'plagiarism_unplag');
     $mform->addRule('unplag_api_secret', null, 'required', null, 'client');
     $mform->setType('unplag_api_secret', PARAM_TEXT);
     $mform->addElement('text', 'unplag_lang', get_string('unplag_lang', 'plagiarism_unplag'));
     $mform->addHelpButton('unplag_lang', 'unplag_lang', 'plagiarism_unplag');
     $mform->addRule('unplag_lang', null, 'required', null, 'client');
     $mform->setDefault('unplag_lang', 'en-US');
     $mform->setType('unplag_lang', PARAM_TEXT);
     $mform->addElement('textarea', 'unplag_student_disclosure', get_string('studentdisclosure', 'plagiarism_unplag'), 'wrap="virtual" rows="6" cols="50"');
     $mform->addHelpButton('unplag_student_disclosure', 'studentdisclosure', 'plagiarism_unplag');
     $mform->setDefault('unplag_student_disclosure', get_string('studentdisclosuredefault', 'plagiarism_unplag'));
     $mform->setType('unplag_student_disclosure', PARAM_TEXT);
     $mods = core_component::get_plugin_list('mod');
     foreach ($mods as $mod => $modname) {
         if (plugin_supports('mod', $mod, FEATURE_PLAGIARISM)) {
             $modstring = 'unplag_enable_mod_' . $mod;
             $mform->addElement('checkbox', $modstring, get_string('unplag_enableplugin', 'plagiarism_unplag', $mod));
         }
     }
     $this->add_action_buttons(true);
 }
开发者ID:POETGroup,项目名称:moodle-plagiarism_unplag,代码行数:32,代码来源:unplag_form.php


示例3: 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();
     //print_r($user);
     // 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";
             //print_r($function);
             if (function_exists($function)) {
                 //echo "Current function: ".$function."<br>";
                 $function($tree, $user, $iscurrentuser, $course);
             }
         }
     }
     // Plugins.
     $pluginswithfunction = get_plugins_with_function('myprofile_navigation', 'lib.php');
     foreach ($pluginswithfunction as $plugins) {
         foreach ($plugins as $function) {
             $function($tree, $user, $iscurrentuser, $course);
         }
     }
     $tree->sort_categories();
     return $tree;
 }
开发者ID:sirromas,项目名称:medical,代码行数:44,代码来源:manager.php


示例4: 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 = core_component::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:helenagarcia90,项目名称:moodle,代码行数:34,代码来源:enrollib.php


示例5: scorm_report_list

function scorm_report_list($context)
{
    global $CFG;
    static $reportlist;
    if (!empty($reportlist)) {
        return $reportlist;
    }
    $installed = core_component::get_plugin_list('scormreport');
    foreach ($installed as $reportname => $notused) {
        // Moodle 2.8+ style of autoloaded classes.
        $classname = "scormreport_{$reportname}\\report";
        if (class_exists($classname)) {
            $report = new $classname();
            if ($report->canview($context)) {
                $reportlist[] = $reportname;
            }
            continue;
        }
        // Legacy style of naming classes.
        $pluginfile = $CFG->dirroot . '/mod/scorm/report/' . $reportname . '/report.php';
        if (is_readable($pluginfile)) {
            debugging("Please use autoloaded classnames for your plugin. Refer MDL-46469 for details", DEBUG_DEVELOPER);
            include_once $pluginfile;
            $reportclassname = "scorm_{$reportname}_report";
            if (class_exists($reportclassname)) {
                $report = new $reportclassname();
                if ($report->canview($context)) {
                    $reportlist[] = $reportname;
                }
            }
        }
    }
    return $reportlist;
}
开发者ID:evltuma,项目名称:moodle,代码行数:34,代码来源:reportlib.php


示例6: test_get_course_formats

 public function test_get_course_formats()
 {
     $result = tool_uploadcourse_helper::get_course_formats();
     $this->assertSame(array_keys(core_component::get_plugin_list('format')), $result);
     // Should be similar as first result, as cached.
     $this->assertSame($result, tool_uploadcourse_helper::get_course_formats());
 }
开发者ID:alanaipe2015,项目名称:moodle,代码行数:7,代码来源:helper_test.php


示例7: load_default_scheduled_tasks_for_component

 /**
  * Given a component name, will load the list of tasks in the db/tasks.php file for that component.
  *
  * @param string $componentname - The name of the component to fetch the tasks for.
  * @return \core\task\scheduled_task[] - List of scheduled tasks for this component.
  */
 public static function load_default_scheduled_tasks_for_component($componentname)
 {
     $dir = \core_component::get_component_directory($componentname);
     if (!$dir) {
         return array();
     }
     $file = $dir . '/' . CORE_TASK_TASKS_FILENAME;
     if (!file_exists($file)) {
         return array();
     }
     $tasks = null;
     include $file;
     if (!isset($tasks)) {
         return array();
     }
     $scheduledtasks = array();
     foreach ($tasks as $task) {
         $record = (object) $task;
         $scheduledtask = self::scheduled_task_from_record($record);
         // Safety check in case the task in the DB does not match a real class (maybe something was uninstalled).
         if ($scheduledtask) {
             $scheduledtask->set_component($componentname);
             $scheduledtasks[] = $scheduledtask;
         }
     }
     return $scheduledtasks;
 }
开发者ID:educakanchay,项目名称:campus,代码行数:33,代码来源:manager.php


示例8: get_install_path

 /**
  * Get the relative path for a plugin given it's type
  * 
  * @param string $type
  *   The plugin type (example: 'auth', 'block')
  * @param string $moodleversion
  *   The version of moodle we are running (example: '1.9', '2.9')
  * @return string
  *   The installation path relative to dirroot (example: 'auth', 'blocks', 
  *   'course/format')
  */
 private function get_install_path($type, $moodleversion)
 {
     global $CFG;
     // Convert moodle version to a float for more acurate comparison
     if (!is_float($moodleversion)) {
         $moodleversion = floatval($moodleversion);
     }
     if ($moodleversion >= 2.6) {
         $types = \core_component::get_plugin_types();
     } else {
         if ($moodleversion >= 2.0) {
             $types = get_plugin_types();
         } else {
             // Moodle 1.9 does not give us a way to determine plugin
             // installation paths.
             $types = array();
         }
     }
     if (empty($types) || !array_key_exists($type, $types)) {
         // Either the moodle version is lower than 2.0, in which case we
         // don't have a reliable way of determining the install path, or the
         // plugin is of an unknown type.
         //
         // Let's fall back to make our best guess.
         return $CFG->dirroot . '/' . $type;
     }
     return $types[$type];
 }
开发者ID:janeklb,项目名称:moosh,代码行数:39,代码来源:PluginInstall.php


示例9: test_duplicate

 /**
  * Tests the backup and restore of single activity to same course (duplicate)
  * when it contains fields and views.
  */
 public function test_duplicate()
 {
     global $DB, $CFG;
     $this->resetAfterTest(true);
     $this->setAdminUser();
     $generator = $this->getDataGenerator();
     $dataformgenerator = $generator->get_plugin_generator('mod_dataform');
     // Create a course.
     $course = $generator->create_course();
     // DATAFORM 1.
     $params = array('course' => $course->id, 'grade' => 100);
     $dataform1 = $dataformgenerator->create_instance($params);
     $df1 = mod_dataform_dataform::instance($dataform1->id);
     // Add fields.
     $fieldtypes = array_keys(core_component::get_plugin_list('dataformfield'));
     $fieldtypescount = count($fieldtypes);
     foreach ($fieldtypes as $type) {
         $df1->field_manager->add_field($type);
     }
     // Add views.
     $viewtypes = array_keys(core_component::get_plugin_list('dataformview'));
     $viewtypescount = count($viewtypes);
     foreach ($viewtypes as $type) {
         $df1->view_manager->add_view($type);
     }
     // Fetch the grade item.
     $params = array('itemtype' => 'mod', 'itemmodule' => 'dataform', 'iteminstance' => $dataform1->id, 'courseid' => $course->id, 'itemnumber' => 0);
     $gradeitem1 = grade_item::fetch($params);
     // Check number of dataforms.
     $this->assertEquals(1, $DB->count_records('dataform'));
     // Check number of fields.
     $this->assertEquals($fieldtypescount, $DB->count_records('dataform_fields'));
     $this->assertEquals($fieldtypescount, $DB->count_records('dataform_fields', array('dataid' => $dataform1->id)));
     // Check number of views.
     $this->assertEquals($viewtypescount, $DB->count_records('dataform_views'));
     $this->assertEquals($viewtypescount, $DB->count_records('dataform_views', array('dataid' => $dataform1->id)));
     // Check number of filters.
     // $this->assertEquals(2, $DB->count_records('dataform_filters'));
     // $this->assertEquals(2, $DB->count_records('dataform_filters', array('dataid' => $dataform1->id)));.
     // DUPLICATE the dataform instance.
     $dataform2 = $dataformgenerator->duplicate_instance($course, $dataform1->cmid);
     // Check number of dataforms.
     $this->assertEquals(2, $DB->count_records('dataform'));
     // Check duplication of fields.
     $this->assertEquals($fieldtypescount * 2, $DB->count_records('dataform_fields'));
     $this->assertEquals($fieldtypescount, $DB->count_records('dataform_fields', array('dataid' => $dataform1->id)));
     $this->assertEquals($fieldtypescount, $DB->count_records('dataform_fields', array('dataid' => $dataform2->id)));
     // Check duplication of views.
     $this->assertEquals($viewtypescount * 2, $DB->count_records('dataform_views'));
     $this->assertEquals($viewtypescount, $DB->count_records('dataform_views', array('dataid' => $dataform1->id)));
     $this->assertEquals($viewtypescount, $DB->count_records('dataform_views', array('dataid' => $dataform2->id)));
     // Check number of filters.
     // $this->assertEquals(4, $DB->count_records('dataform_filters');
     // $this->assertEquals(2, $DB->count_records('dataform_filters', array('dataid' => $dataform1->id));
     // $this->assertEquals(2, $DB->count_records('dataform_filters', array('dataid' => $dataform2->id));.
     // Dataform cleanup.
     $dataformgenerator->delete_all_instances();
 }
开发者ID:parksandwildlife,项目名称:learning,代码行数:62,代码来源:backup_restore_test.php


示例10: test_get_submission_plugins

 public function test_get_submission_plugins()
 {
     $this->setUser($this->editingteachers[0]);
     $assign = $this->create_instance();
     $installedplugins = array_keys(core_component::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:janaece,项目名称:globalclassroom4_clean,代码行数:9,代码来源:locallib_test.php


示例11: test_field_events

 /**
  * Test field events for standard types.
  */
 public function test_field_events()
 {
     $this->setAdminUser();
     $df = $this->get_a_dataform();
     $fieldtypes = array_keys(core_component::get_plugin_list('dataformfield'));
     foreach ($fieldtypes as $type) {
         $this->try_crud_field($type, $df);
     }
 }
开发者ID:parksandwildlife,项目名称:learning,代码行数:12,代码来源:events_test.php


示例12: is_last

 /**
  * Is this the last plugin in the list?
  *
  * @return bool
  */
 public final function is_last()
 {
     $lastindex = count(core_component::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:EmmanuelYupit,项目名称:educursos,代码行数:14,代码来源:assignmentplugin.php


示例13: get_list_of_calendar_types

 /**
  * Returns a list of calendar typess available for use.
  *
  * @return array the list of calendar types
  */
 public static function get_list_of_calendar_types()
 {
     $calendars = array();
     $calendardirs = \core_component::get_plugin_list('calendartype');
     foreach ($calendardirs as $name => $location) {
         $calendars[$name] = get_string('name', "calendartype_{$name}");
     }
     return $calendars;
 }
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:14,代码来源:type_factory.php


示例14: external_function_info

/**
 * Returns detailed function information
 *
 * @param string|object $function name of external function or record from external_function
 * @param int $strictness IGNORE_MISSING means compatible mode, false returned if record not found, debug message if more found;
 *                        MUST_EXIST means throw exception if no record or multiple records found
 * @return stdClass description or false if not found or exception thrown
 * @since Moodle 2.0
 */
function external_function_info($function, $strictness = MUST_EXIST)
{
    global $DB, $CFG;
    if (!is_object($function)) {
        if (!($function = $DB->get_record('external_functions', array('name' => $function), '*', $strictness))) {
            return false;
        }
    }
    //first find and include the ext implementation class
    $function->classpath = empty($function->classpath) ? core_component::get_component_directory($function->component) . '/externallib.php' : $CFG->dirroot . '/' . $function->classpath;
    if (!file_exists($function->classpath)) {
        throw new coding_exception('Can not find file with external function implementation');
    }
    require_once $function->classpath;
    $function->parameters_method = $function->methodname . '_parameters';
    $function->returns_method = $function->methodname . '_returns';
    // make sure the implementaion class is ok
    if (!method_exists($function->classname, $function->methodname)) {
        throw new coding_exception('Missing implementation method of ' . $function->classname . '::' . $function->methodname);
    }
    if (!method_exists($function->classname, $function->parameters_method)) {
        throw new coding_exception('Missing parameters description');
    }
    if (!method_exists($function->classname, $function->returns_method)) {
        throw new coding_exception('Missing returned values description');
    }
    // fetch the parameters description
    $function->parameters_desc = call_user_func(array($function->classname, $function->parameters_method));
    if (!$function->parameters_desc instanceof external_function_parameters) {
        throw new coding_exception('Invalid parameters description');
    }
    // fetch the return values description
    $function->returns_desc = call_user_func(array($function->classname, $function->returns_method));
    // null means void result or result is ignored
    if (!is_null($function->returns_desc) and !$function->returns_desc instanceof external_description) {
        throw new coding_exception('Invalid return description');
    }
    //now get the function description
    //TODO MDL-31115 use localised lang pack descriptions, it would be nice to have
    //      easy to understand descriptions in admin UI,
    //      on the other hand this is still a bit in a flux and we need to find some new naming
    //      conventions for these descriptions in lang packs
    $function->description = null;
    $servicesfile = core_component::get_component_directory($function->component) . '/db/services.php';
    if (file_exists($servicesfile)) {
        $functions = null;
        include $servicesfile;
        if (isset($functions[$function->name]['description'])) {
            $function->description = $functions[$function->name]['description'];
        }
        if (isset($functions[$function->name]['testclientpath'])) {
            $function->testclientpath = $functions[$function->name]['testclientpath'];
        }
    }
    return $function;
}
开发者ID:tyleung,项目名称:CMPUT401MoodleExams,代码行数:65,代码来源:externallib.php


示例15: __construct

 /**
  * Do not instantinate this directly, use {@link grading_manager::get_controller()}
  *
  * @param stdClass $context the context of the form
  * @param string $component the frankenstyle name of the component
  * @param string $area the name of the gradable area
  * @param int $areaid the id of the gradable area record
  */
 public function __construct(stdClass $context, $component, $area, $areaid)
 {
     global $DB;
     $this->context = $context;
     list($type, $name) = core_component::normalize_component($component);
     $this->component = $type . '_' . $name;
     $this->area = $area;
     $this->areaid = $areaid;
     $this->load_definition();
 }
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:18,代码来源:lib.php


示例16: scheduled_tasks_table

 /**
  * This function will render one beautiful table with all the scheduled tasks.
  *
  * @param \core\task\scheduled_task[] $tasks - list of all scheduled tasks.
  * @return string HTML to output.
  */
 public function scheduled_tasks_table($tasks)
 {
     global $CFG;
     $table = new html_table();
     $table->head = array(get_string('name'), get_string('component', 'tool_task'), get_string('edit'), get_string('lastruntime', 'tool_task'), get_string('nextruntime', 'tool_task'), get_string('taskscheduleminute', 'tool_task'), get_string('taskschedulehour', 'tool_task'), get_string('taskscheduleday', 'tool_task'), get_string('taskscheduledayofweek', 'tool_task'), get_string('taskschedulemonth', 'tool_task'), get_string('faildelay', 'tool_task'), get_string('default', 'tool_task'));
     $table->attributes['class'] = 'admintable generaltable';
     $data = array();
     $yes = get_string('yes');
     $no = get_string('no');
     $never = get_string('never');
     $asap = get_string('asap', 'tool_task');
     $disabled = get_string('disabled', 'tool_task');
     foreach ($tasks as $task) {
         $customised = $task->is_customised() ? $no : $yes;
         $lastrun = $task->get_last_run_time() ? userdate($task->get_last_run_time()) : $never;
         $nextrun = $task->get_next_run_time();
         if ($task->get_disabled()) {
             $nextrun = $disabled;
         } else {
             if ($nextrun > time()) {
                 $nextrun = userdate($nextrun);
             } else {
                 $nextrun = $asap;
             }
         }
         if (empty($CFG->preventscheduledtaskchanges)) {
             $configureurl = new moodle_url('/admin/tool/task/scheduledtasks.php', array('action' => 'edit', 'task' => get_class($task)));
             $editlink = $this->action_icon($configureurl, new pix_icon('t/edit', get_string('edittaskschedule', 'tool_task', $task->get_name())));
         } else {
             $editlink = $this->render(new pix_icon('t/locked', get_string('scheduledtaskchangesdisabled', 'tool_task')));
         }
         $namecell = new html_table_cell($task->get_name() . "\n" . html_writer::tag('span', '\\' . get_class($task), array('class' => 'task-class')));
         $namecell->header = true;
         $component = $task->get_component();
         list($type, $plugin) = core_component::normalize_component($component);
         if ($type === 'core') {
             $componentcell = new html_table_cell(get_string('corecomponent', 'tool_task'));
         } else {
             if ($plugininfo = core_plugin_manager::instance()->get_plugin_info($component)) {
                 $plugininfo->init_display_name();
                 $componentcell = new html_table_cell($plugininfo->displayname);
             } else {
                 $componentcell = new html_table_cell($component);
             }
         }
         $row = new html_table_row(array($namecell, $componentcell, new html_table_cell($editlink), new html_table_cell($lastrun), new html_table_cell($nextrun), new html_table_cell($task->get_minute()), new html_table_cell($task->get_hour()), new html_table_cell($task->get_day()), new html_table_cell($task->get_day_of_week()), new html_table_cell($task->get_month()), new html_table_cell($task->get_fail_delay()), new html_table_cell($customised)));
         if ($task->get_disabled()) {
             $row->attributes['class'] = 'disabled';
         }
         $data[] = $row;
     }
     $table->data = $data;
     return html_writer::table($table);
 }
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:60,代码来源:renderer.php


示例17: xmldb_dataform_install

/**
 * Install the plugin.
 */
function xmldb_dataform_install()
{
    // Enable existing field plugins.
    $type = 'dataformfield';
    $enabled = array_keys(core_component::get_plugin_list($type));
    set_config("enabled_{$type}", implode(',', $enabled), 'mod_dataform');
    // Enable existing view plugins.
    $type = 'dataformview';
    $enabled = array_keys(core_component::get_plugin_list($type));
    set_config("enabled_{$type}", implode(',', $enabled), 'mod_dataform');
}
开发者ID:parksandwildlife,项目名称:learning,代码行数:14,代码来源:install.php


示例18: run

 public function run($command)
 {
     global $CFG;
     $data = $CFG->dataroot . '/tool_composer';
     $composerfile = $data . '/composer.json';
     if (!is_writable($data)) {
         throw new \moodle_exception('notwritable');
     }
     if (!file_exists($data)) {
         mkdir($data, $CFG->directorypermissions, true);
     }
     $vendordir = $data . '/vendor';
     $autoloadphp = '$CFG->dataroot . \'tool_composer/vendor/autoload.php\'';
     if ($this->installincodebase) {
         $vendordir = $CFG->dirroot . '/lib/vendor';
         $autoloadphp = '$CFG->dirroot . \'/lib/vendor/autoload.php\'';
     }
     $composer = new \stdClass();
     $composer->require = ['wikimedia/composer-merge-plugin' => '^1.3'];
     $include = [];
     foreach (\core_component::get_plugin_types() as $type => $dir) {
         $plugins = \core_component::get_plugin_list_with_file($type, 'composer.json');
         foreach ($plugins as $pluginname => $filepath) {
             // Ignore this plugin
             if ($type == 'tool' && $pluginname == 'composer') {
                 continue;
             }
             $include[] = $filepath;
             // Overwrite the autoload files if necessary
             $autoload = dirname($filepath) . '/vendor/autoload.php';
             if (file_exists($autoload)) {
                 if (!is_writable($autoload)) {
                     throw new \moodle_exception('notwritable');
                 }
                 // Back up the file if we haven't done so already.
                 if (!file_exists($autoload . '.bak')) {
                     file_put_contents($autoload . '.bak', file_get_contents($autoload));
                 }
                 file_put_contents($autoload, '<?php require_once ' . $autoloadphp . ';');
             }
         }
     }
     $composer->extra = (object) ['merge-plugin' => (object) ['include' => $include]];
     file_put_contents($composerfile, json_encode($composer));
     putenv('COMPOSER=' . $composerfile);
     putenv('COMPOSER_VENDOR_DIR=' . $vendordir);
     if ($this->installincodebase) {
         // Allow us to install Moodle plugins into the codebase
         chdir($CFG->dirroot);
     }
     // TODO: We may want to force --no-dev here for install / update
     passthru('composer --no-interaction ' . $command);
 }
开发者ID:micaherne,项目名称:moodle-tool_composer,代码行数:53,代码来源:manager.php


示例19: getComponentInstallDirectory

 /**
  * Get the absolute install directory path within Moodle.
  *
  * @param string $component Moodle component, EG: mod_forum
  *
  * @return string Absolute path, EG: /path/to/mod/forum
  */
 public function getComponentInstallDirectory($component)
 {
     $this->requireConfig();
     /* @noinspection PhpUndefinedClassInspection */
     list($type, $name) = \core_component::normalize_component($component);
     /* @noinspection PhpUndefinedClassInspection */
     $types = \core_component::get_plugin_types();
     if (!array_key_exists($type, $types)) {
         throw new \InvalidArgumentException(sprintf('The component %s has an unknown plugin type of %s', $component, $type));
     }
     return $types[$type] . '/' . $name;
 }
开发者ID:gjb2048,项目名称:moodle-plugin-ci,代码行数:19,代码来源:Moodle.php


示例20: test_report_participation_supports_logstore

 /**
  * Test report_log_supports_logstore.
  */
 public function test_report_participation_supports_logstore()
 {
     $logmanager = get_log_manager();
     $allstores = \core_component::get_plugin_list_with_class('logstore', 'log\\store');
     $supportedstores = array('logstore_legacy' => '\\logstore_legacy\\log\\store', 'logstore_standard' => '\\logstore_standard\\log\\store');
     // Make sure all supported stores are installed.
     $expectedstores = array_keys(array_intersect($allstores, $supportedstores));
     $stores = $logmanager->get_supported_logstores('report_outline');
     $stores = array_keys($stores);
     foreach ($expectedstores as $expectedstore) {
         $this->assertContains($expectedstore, $stores);
     }
 }
开发者ID:alanaipe2015,项目名称:moodle,代码行数:16,代码来源:lib_test.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP core_date类代码示例发布时间:2022-05-23
下一篇:
PHP core_collator类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap