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


PHP backup_nested_element::get_name方法代码示例

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


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

示例1: add_plugin_structure

 /**
  * Add plugin structure to any element in the structure backup tree
  *
  * @param string $plugintype type of plugin as defined by get_plugin_types()
  * @param backup_nested_element $element element in the structure backup tree that
  *                                       we are going to add plugin information to
  * @param bool $multiple to define if multiple plugins can produce information
  *                       for each instance of $element (true) or no (false)
  */
 protected function add_plugin_structure($plugintype, $element, $multiple)
 {
     global $CFG;
     // Check the requested plugintype is a valid one
     if (!array_key_exists($plugintype, get_plugin_types($plugintype))) {
         throw new backup_step_exception('incorrect_plugin_type', $plugintype);
     }
     // Arrived here, plugin is correct, let's create the optigroup
     $optigroupname = $plugintype . '_' . $element->get_name() . '_plugin';
     $optigroup = new backup_optigroup($optigroupname, null, $multiple);
     $element->add_child($optigroup);
     // Add optigroup to stay connected since beginning
     // Get all the optigroup_elements, looking across all the plugin dirs
     $pluginsdirs = get_plugin_list($plugintype);
     foreach ($pluginsdirs as $name => $plugindir) {
         $classname = 'backup_' . $plugintype . '_' . $name . '_plugin';
         $backupfile = $plugindir . '/backup/moodle2/' . $classname . '.class.php';
         if (file_exists($backupfile)) {
             require_once $backupfile;
             $backupplugin = new $classname($plugintype, $name, $optigroup, $this);
             // Add plugin returned structure to optigroup
             $backupplugin->define_plugin_structure($element->get_name());
         }
     }
 }
开发者ID:sebastiansanio,项目名称:tallerdeprogramacion2fiuba,代码行数:34,代码来源:backup_structure_step.class.php

示例2: add_subplugin_structure

 /**
  * Add subplugin structure to any element in the activity backup tree
  *
  * @param string $subplugintype type of subplugin as defined in activity db/subplugins.php
  * @param backup_nested_element $element element in the activity backup tree that
  *                                       we are going to add subplugin information to
  * @param bool $multiple to define if multiple subplugins can produce information
  *                       for each instance of $element (true) or no (false)
  * @return void
  */
 protected function add_subplugin_structure($subplugintype, $element, $multiple)
 {
     global $CFG;
     // Check the requested subplugintype is a valid one
     $subpluginsfile = $CFG->dirroot . '/mod/' . $this->task->get_modulename() . '/db/subplugins.php';
     if (!file_exists($subpluginsfile)) {
         throw new backup_step_exception('activity_missing_subplugins_php_file', $this->task->get_modulename());
     }
     include $subpluginsfile;
     if (!array_key_exists($subplugintype, $subplugins)) {
         throw new backup_step_exception('incorrect_subplugin_type', $subplugintype);
     }
     // Arrived here, subplugin is correct, let's create the optigroup
     $optigroupname = $subplugintype . '_' . $element->get_name() . '_subplugin';
     $optigroup = new backup_optigroup($optigroupname, null, $multiple);
     $element->add_child($optigroup);
     // Add optigroup to stay connected since beginning
     // Get all the optigroup_elements, looking across all the subplugin dirs
     $subpluginsdirs = get_plugin_list($subplugintype);
     foreach ($subpluginsdirs as $name => $subpluginsdir) {
         $classname = 'backup_' . $subplugintype . '_' . $name . '_subplugin';
         $backupfile = $subpluginsdir . '/backup/moodle2/' . $classname . '.class.php';
         if (file_exists($backupfile)) {
             require_once $backupfile;
             $backupsubplugin = new $classname($subplugintype, $name, $optigroup, $this);
             // Add subplugin returned structure to optigroup
             $backupsubplugin->define_subplugin_structure($element->get_name());
         }
     }
 }
开发者ID:nutanrajmalanai,项目名称:moodle,代码行数:40,代码来源:backup_stepslib.php

示例3: add_subplugin_structure

 /**
  * Add subplugin structure for a given plugin to any element in the structure backup tree.
  *
  * This method allows the injection of subplugins (of a specified plugin) data to any
  * element in any backup structure.
  *
  * NOTE: Initially subplugins were only available for activities (mod), so only the
  * {@link backup_activity_structure_step} class had support for them, always
  * looking for /mod/modulenanme subplugins. This new method is a generalization of the
  * existing one for activities, supporting all subplugins injecting information everywhere.
  *
  * @param string $subplugintype type of subplugin as defined in plugin's db/subplugins.php.
  * @param backup_nested_element $element element in the backup tree (anywhere) that
  *                                       we are going to add subplugin information to.
  * @param bool $multiple to define if multiple subplugins can produce information
  *                       for each instance of $element (true) or no (false).
  * @param string $plugintype type of the plugin.
  * @param string $pluginname name of the plugin.
  * @return void
  */
 protected function add_subplugin_structure($subplugintype, $element, $multiple, $plugintype = null, $pluginname = null)
 {
     global $CFG;
     // This global declaration is required, because where we do require_once($backupfile);
     // That file may in turn try to do require_once($CFG->dirroot ...).
     // That worked in the past, we should keep it working.
     // Verify if this is a BC call for an activity backup. See NOTE above for this special case.
     if ($plugintype === null and $pluginname === null) {
         $plugintype = 'mod';
         $pluginname = $this->task->get_modulename();
         // TODO: Once all the calls have been changed to add both not null plugintype and pluginname, add a debugging here.
     }
     // Check the requested plugintype is a valid one.
     if (!array_key_exists($plugintype, core_component::get_plugin_types())) {
         throw new backup_step_exception('incorrect_plugin_type', $plugintype);
     }
     // Check the requested pluginname, for the specified plugintype, is a valid one.
     if (!array_key_exists($pluginname, core_component::get_plugin_list($plugintype))) {
         throw new backup_step_exception('incorrect_plugin_name', array($plugintype, $pluginname));
     }
     // Check the requested subplugintype is a valid one.
     $subpluginsfile = core_component::get_component_directory($plugintype . '_' . $pluginname) . '/db/subplugins.php';
     if (!file_exists($subpluginsfile)) {
         throw new backup_step_exception('plugin_missing_subplugins_php_file', array($plugintype, $pluginname));
     }
     include $subpluginsfile;
     if (!array_key_exists($subplugintype, $subplugins)) {
         throw new backup_step_exception('incorrect_subplugin_type', $subplugintype);
     }
     // Arrived here, subplugin is correct, let's create the optigroup.
     $optigroupname = $subplugintype . '_' . $element->get_name() . '_subplugin';
     $optigroup = new backup_optigroup($optigroupname, null, $multiple);
     $element->add_child($optigroup);
     // Add optigroup to stay connected since beginning.
     // Every subplugin optionally can have a common/parent subplugin
     // class for shared stuff.
     $parentclass = 'backup_' . $plugintype . '_' . $pluginname . '_' . $subplugintype . '_subplugin';
     $parentfile = core_component::get_component_directory($plugintype . '_' . $pluginname) . '/backup/moodle2/' . $parentclass . '.class.php';
     if (file_exists($parentfile)) {
         require_once $parentfile;
     }
     // Get all the optigroup_elements, looking over all the subplugin dirs.
     $subpluginsdirs = core_component::get_plugin_list($subplugintype);
     foreach ($subpluginsdirs as $name => $subpluginsdir) {
         $classname = 'backup_' . $subplugintype . '_' . $name . '_subplugin';
         $backupfile = $subpluginsdir . '/backup/moodle2/' . $classname . '.class.php';
         if (file_exists($backupfile)) {
             require_once $backupfile;
             $backupsubplugin = new $classname($subplugintype, $name, $optigroup, $this);
             // Add subplugin returned structure to optigroup.
             $backupsubplugin->define_subplugin_structure($element->get_name());
         }
     }
 }
开发者ID:evltuma,项目名称:moodle,代码行数:74,代码来源:backup_structure_step.class.php


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