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


PHP backup_helper类代码示例

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


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

示例1: define_structure

 protected function define_structure()
 {
     global $DB;
     // Get the block
     $block = $DB->get_record('block_instances', array('id' => $this->task->get_blockid()));
     // Extract configdata
     $config = unserialize(base64_decode($block->configdata));
     // Get array of used rss feeds
     if (!empty($config->rssid)) {
         $feedids = $config->rssid;
         // Get the IN corresponding query
         list($in_sql, $in_params) = $DB->get_in_or_equal($feedids);
         // Define all the in_params as sqlparams
         foreach ($in_params as $key => $value) {
             $in_params[$key] = backup_helper::is_sqlparam($value);
         }
     }
     // Define each element separated
     $rss_client = new backup_nested_element('rss_client', array('id'), null);
     $feeds = new backup_nested_element('feeds');
     $feed = new backup_nested_element('feed', array('id'), array('title', 'preferredtitle', 'description', 'shared', 'url'));
     // Build the tree
     $rss_client->add_child($feeds);
     $feeds->add_child($feed);
     // Define sources
     $rss_client->set_source_array(array((object) array('id' => $this->task->get_blockid())));
     // Only if there are feeds
     if (!empty($config->rssid)) {
         $feed->set_source_sql("\n                SELECT *\n                  FROM {block_rss_client}\n                 WHERE id {$in_sql}", $in_params);
     }
     // Annotations (none)
     // Return the root element (rss_client), wrapped into standard block structure
     return $this->prepare_block_structure($rss_client);
 }
开发者ID:evltuma,项目名称:moodle,代码行数:34,代码来源:backup_rss_client_stepslib.php

示例2: log

 public function log($message, $level, $a = null, $depth = null, $display = false)
 {
     if (is_null($this->task)) {
         throw new base_step_exception('not_specified_base_task');
     }
     backup_helper::log($message, $level, $a, $depth, $display, $this->get_logger());
 }
开发者ID:evltuma,项目名称:moodle,代码行数:7,代码来源:base_step.class.php

示例3: define_execution

 protected function define_execution() {
     global $CFG;
     restore_controller_dbops::drop_restore_temp_tables($this->get_restoreid()); // Drop ids temp table
     backup_helper::delete_old_backup_dirs(time() - (4 * 60 * 60));              // Delete > 4 hours temp dirs
     if (empty($CFG->keeptempdirectoriesonbackup)) { // Conditionally
         backup_helper::delete_backup_dir($this->task->get_tempdir()); // Empty restore dir
     }
 }
开发者ID:nottmoo,项目名称:moodle,代码行数:8,代码来源:restore_stepslib.php

示例4: __construct

 public function __construct($restoreid)
 {
     $this->restoreid = $restoreid;
     parent::__construct(array());
     // Get itemnames handled by inforef files
     $items = backup_helper::get_inforef_itemnames();
     // Let's add all them as target paths for the processor
     foreach ($items as $itemname) {
         $pathvalue = '/inforef/' . $itemname . 'ref/' . $itemname;
         $this->add_path($pathvalue);
     }
 }
开发者ID:evltuma,项目名称:moodle,代码行数:12,代码来源:restore_inforef_parser_processor.class.php

示例5: define_structure

 protected function define_structure()
 {
     // To know if we are including userinfo
     $userinfo = $this->get_setting_value('userinfo');
     // Define each element separated
     $glossary = new backup_nested_element('glossary', array('id'), array('name', 'intro', 'introformat', 'allowduplicatedentries', 'displayformat', 'mainglossary', 'showspecial', 'showalphabet', 'showall', 'allowcomments', 'allowprintview', 'usedynalink', 'defaultapproval', 'globalglossary', 'entbypage', 'editalways', 'rsstype', 'rssarticles', 'assessed', 'assesstimestart', 'assesstimefinish', 'scale', 'timecreated', 'timemodified', 'completionentries'));
     $entries = new backup_nested_element('entries');
     $entry = new backup_nested_element('entry', array('id'), array('userid', 'concept', 'definition', 'definitionformat', 'definitiontrust', 'attachment', 'timecreated', 'timemodified', 'teacherentry', 'sourceglossaryid', 'usedynalink', 'casesensitive', 'fullmatch', 'approved'));
     $aliases = new backup_nested_element('aliases');
     $alias = new backup_nested_element('alias', array('id'), array('alias_text'));
     $ratings = new backup_nested_element('ratings');
     $rating = new backup_nested_element('rating', array('id'), array('component', 'ratingarea', 'scaleid', 'value', 'userid', 'timecreated', 'timemodified'));
     $categories = new backup_nested_element('categories');
     $category = new backup_nested_element('category', array('id'), array('name', 'usedynalink'));
     $categoryentries = new backup_nested_element('category_entries');
     $categoryentry = new backup_nested_element('category_entry', array('id'), array('entryid'));
     // Build the tree
     $glossary->add_child($entries);
     $entries->add_child($entry);
     $entry->add_child($aliases);
     $aliases->add_child($alias);
     $entry->add_child($ratings);
     $ratings->add_child($rating);
     $glossary->add_child($categories);
     $categories->add_child($category);
     $category->add_child($categoryentries);
     $categoryentries->add_child($categoryentry);
     // Define sources
     $glossary->set_source_table('glossary', array('id' => backup::VAR_ACTIVITYID));
     $category->set_source_table('glossary_categories', array('glossaryid' => backup::VAR_PARENTID));
     // All the rest of elements only happen if we are including user info
     if ($userinfo) {
         $entry->set_source_table('glossary_entries', array('glossaryid' => backup::VAR_PARENTID));
         $alias->set_source_table('glossary_alias', array('entryid' => backup::VAR_PARENTID));
         $alias->set_source_alias('alias', 'alias_text');
         $rating->set_source_table('rating', array('contextid' => backup::VAR_CONTEXTID, 'itemid' => backup::VAR_PARENTID, 'component' => backup_helper::is_sqlparam('mod_glossary'), 'ratingarea' => backup_helper::is_sqlparam('entry')));
         $rating->set_source_alias('rating', 'value');
         $categoryentry->set_source_table('glossary_entries_categories', array('categoryid' => backup::VAR_PARENTID));
     }
     // Define id annotations
     $glossary->annotate_ids('scale', 'scale');
     $entry->annotate_ids('user', 'userid');
     $rating->annotate_ids('scale', 'scaleid');
     $rating->annotate_ids('user', 'userid');
     // Define file annotations
     $glossary->annotate_files('mod_glossary', 'intro', null);
     // This file area hasn't itemid
     $entry->annotate_files('mod_glossary', 'entry', 'id');
     $entry->annotate_files('mod_glossary', 'attachment', 'id');
     // Return the root element (glossary), wrapped into standard activity structure
     return $this->prepare_activity_structure($glossary);
 }
开发者ID:EmmanuelYupit,项目名称:educursos,代码行数:52,代码来源:backup_glossary_stepslib.php

示例6: define_course_plugin_structure

 protected function define_course_plugin_structure()
 {
     $plugin = $this->get_plugin_element();
     $plugin_element = new backup_nested_element($this->get_recommended_name());
     $plugin->add_child($plugin_element);
     // Add courses from Turnitintool table
     $turnitin_courses = new backup_nested_element('turnitin_courses');
     $turnitin_course = new backup_nested_element('turnitin_course', array('id'), array('courseid', 'ownerid', 'turnitin_ctl', 'turnitin_cid', 'course_type'));
     $plugin_element->add_child($turnitin_courses);
     $turnitin_courses->add_child($turnitin_course);
     $turnitin_course->set_source_table('turnitintooltwo_courses', array('courseid' => backup::VAR_COURSEID, 'course_type' => backup_helper::is_sqlparam('PP')));
     return $plugin;
 }
开发者ID:University-of-Strathclyde-LTE-Team,项目名称:moodle-plagiarism_turnitin,代码行数:13,代码来源:backup_plagiarism_turnitin_plugin.class.php

示例7: define_structure

 protected function define_structure()
 {
     // To know if we are including userinfo
     $userinfo = $this->get_setting_value('userinfo');
     // Define each element separated
     $data = new backup_nested_element('data', array('id'), array('name', 'intro', 'introformat', 'comments', 'timeavailablefrom', 'timeavailableto', 'timeviewfrom', 'timeviewto', 'requiredentries', 'requiredentriestoview', 'maxentries', 'rssarticles', 'singletemplate', 'listtemplate', 'listtemplateheader', 'listtemplatefooter', 'addtemplate', 'rsstemplate', 'rsstitletemplate', 'csstemplate', 'jstemplate', 'asearchtemplate', 'approval', 'manageapproved', 'scale', 'assessed', 'assesstimestart', 'assesstimefinish', 'defaultsort', 'defaultsortdir', 'editany', 'notification'));
     $fields = new backup_nested_element('fields');
     $field = new backup_nested_element('field', array('id'), array('type', 'name', 'description', 'required', 'param1', 'param2', 'param3', 'param4', 'param5', 'param6', 'param7', 'param8', 'param9', 'param10'));
     $records = new backup_nested_element('records');
     $record = new backup_nested_element('record', array('id'), array('userid', 'groupid', 'timecreated', 'timemodified', 'approved'));
     $contents = new backup_nested_element('contents');
     $content = new backup_nested_element('content', array('id'), array('fieldid', 'content', 'content1', 'content2', 'content3', 'content4'));
     $ratings = new backup_nested_element('ratings');
     $rating = new backup_nested_element('rating', array('id'), array('component', 'ratingarea', 'scaleid', 'value', 'userid', 'timecreated', 'timemodified'));
     // Build the tree
     $data->add_child($fields);
     $fields->add_child($field);
     $data->add_child($records);
     $records->add_child($record);
     $record->add_child($contents);
     $contents->add_child($content);
     $record->add_child($ratings);
     $ratings->add_child($rating);
     // Define sources
     $data->set_source_table('data', array('id' => backup::VAR_ACTIVITYID));
     $field->set_source_sql('
         SELECT *
           FROM {data_fields}
          WHERE dataid = ?', array(backup::VAR_PARENTID));
     // All the rest of elements only happen if we are including user info
     if ($userinfo) {
         $record->set_source_table('data_records', array('dataid' => backup::VAR_PARENTID));
         $content->set_source_table('data_content', array('recordid' => backup::VAR_PARENTID));
         $rating->set_source_table('rating', array('contextid' => backup::VAR_CONTEXTID, 'itemid' => backup::VAR_PARENTID, 'component' => backup_helper::is_sqlparam('mod_data'), 'ratingarea' => backup_helper::is_sqlparam('entry')));
         $rating->set_source_alias('rating', 'value');
     }
     // Define id annotations
     $data->annotate_ids('scale', 'scale');
     $record->annotate_ids('user', 'userid');
     $record->annotate_ids('group', 'groupid');
     $rating->annotate_ids('scale', 'scaleid');
     $rating->annotate_ids('user', 'userid');
     // Define file annotations
     $data->annotate_files('mod_data', 'intro', null);
     // This file area hasn't itemid
     $content->annotate_files('mod_data', 'content', 'id');
     // By content->id
     // Return the root element (data), wrapped into standard activity structure
     return $this->prepare_activity_structure($data);
 }
开发者ID:pzhu2004,项目名称:moodle,代码行数:50,代码来源:backup_data_stepslib.php

示例8: define_course_plugin_structure

 protected function define_course_plugin_structure()
 {
     // Define the virtual plugin element without conditions as the global class checks already.
     $plugin = $this->get_plugin_element();
     // Create one standard named plugin element (the visible container).
     $pluginwrapper = new backup_nested_element($this->get_recommended_name());
     // Connect the visible container ASAP.
     $plugin->add_child($pluginwrapper);
     // Save id from compilatio course.
     $compilatioconfigs = new backup_nested_element('compilatio_configs');
     $compilatioconfig = new backup_nested_element('compilatio_config', array('id'), array('plugin', 'name', 'value'));
     $pluginwrapper->add_child($compilatioconfigs);
     $compilatioconfigs->add_child($compilatioconfig);
     $compilatioconfig->set_source_table('config_plugins', array('name' => backup::VAR_PARENTID, 'plugin' => backup_helper::is_sqlparam('plagiarism_compilatio_course')));
     return $plugin;
 }
开发者ID:romain-compi,项目名称:moodle-plagiarism_compilatio,代码行数:16,代码来源:backup_plagiarism_compilatio_plugin.class.php

示例9: define_execution

 protected function define_execution()
 {
     global $CFG;
     restore_controller_dbops::drop_restore_temp_tables($this->get_restoreid());
     // Drop ids temp table
     $progress = $this->task->get_progress();
     $progress->start_progress('Deleting backup dir');
     backup_helper::delete_old_backup_dirs(strtotime('-1 week'), $progress);
     // Delete > 1 week old temp dirs.
     if (empty($CFG->keeptempdirectoriesonbackup)) {
         // Conditionally
         backup_helper::delete_backup_dir($this->task->get_tempdir(), $progress);
         // Empty restore dir
     }
     $progress->end_progress();
 }
开发者ID:Jinelle,项目名称:moodle,代码行数:16,代码来源:restore_stepslib.php

示例10: define_structure

 protected function define_structure()
 {
     // Define each element separated
     $evalcomix = new backup_nested_element('evalcomix', array('id'), array('viewmode'));
     $evalcomix_environment = new backup_nested_element('environment', null, array('courseid', 'moodlename'));
     $evalcomix_tools = new backup_nested_element('tools');
     $evalcomix_tool = new backup_nested_element('tool', array('id'), array('title', 'type', 'timecreated', 'timemodified', 'idtool', 'code'));
     $evalcomix_tasks = new backup_nested_element('tasks');
     $evalcomix_task = new backup_nested_element('task', array('id'), array('instanceid', 'maxgrade', 'weighing', 'timemodified', 'visible'));
     //$evalcomix_task = new backup_nested_element('task', array('instanceid'), array('id', 'maxgrade', 'weighing', 'timemodified'));
     $evalcomix_assessments = new backup_nested_element('assessments');
     //$evalcomix_assessment = new backup_nested_element('assessment', array('id'), array('assessorid', 'studentid', 'grade', 'timemodified', 'code'));
     $evalcomix_assessment = new backup_nested_element('assessment', array('id'), array('assessorid', 'studentid', 'grade', 'timemodified'));
     $evalcomix_modes = new backup_nested_element('modes');
     $evalcomix_mode = new backup_nested_element('mode', array('id'), array('toolid', 'modality', 'weighing'));
     $evalcomix_modes_time = new backup_nested_element('mode_time', array('id'), array('timeavailable', 'timedue'));
     $evalcomix_modes_extra = new backup_nested_element('mode_extra', array('id'), array('anonymous', 'visible', 'whoassesses'));
     $evalcomix_grades = new backup_nested_element('grades');
     $evalcomix_grade = new backup_nested_element('grade', array('id'), array('userid', 'cmid', 'finalgrade', 'courseid'));
     $evalcomix_allowedusers = new backup_nested_element('allowedusers');
     $evalcomix_alloweduser = new backup_nested_element('alloweduser', array('id'), array('cmid', 'assessorid', 'studentid'));
     // $invented = new backup_nested_element('invented', null, array('one', 'two', 'three')        );
     // Build the tree
     $evalcomix->add_child($evalcomix_tools);
     $evalcomix->add_child($evalcomix_environment);
     $evalcomix->add_child($evalcomix_tasks);
     $evalcomix->add_child($evalcomix_grades);
     $evalcomix_grades->add_child($evalcomix_grade);
     $evalcomix->add_child($evalcomix_allowedusers);
     $evalcomix_allowedusers->add_child($evalcomix_alloweduser);
     $evalcomix_tools->add_child($evalcomix_tool);
     $evalcomix_tasks->add_child($evalcomix_task);
     $evalcomix_task->add_child($evalcomix_assessments);
     $evalcomix_task->add_child($evalcomix_modes);
     $evalcomix_assessments->add_child($evalcomix_assessment);
     $evalcomix_modes->add_child($evalcomix_mode);
     $evalcomix_mode->add_child($evalcomix_modes_time);
     $evalcomix_mode->add_child($evalcomix_modes_extra);
     //$inventeds->add_child($invented);
     // Define sources
     global $DB, $COURSE, $CFG;
     $courseid = $this->get_courseid();
     $cms = $DB->get_records('course_modules', array('course' => $courseid));
     $items = array();
     foreach ($cms as $cm) {
         $items[] = $cm->id;
     }
     $in_params = array();
     if (!empty($items)) {
         list($in_sql, $in_params) = $DB->get_in_or_equal($items);
         foreach ($in_params as $key => $value) {
             $in_params[$key] = backup_helper::is_sqlparam($value);
         }
     }
     if ($block = $DB->get_record('block_evalcomix', array('courseid' => $courseid))) {
         $evalcomix->set_source_table('block_evalcomix', array('id' => backup_helper::is_sqlparam($block->id)));
     }
     include_once $CFG->dirroot . '/blocks/evalcomix/configeval.php';
     include_once $CFG->dirroot . '/blocks/evalcomix/classes/webservice_evalcomix_client.php';
     include_once $CFG->dirroot . '/blocks/evalcomix/classes/evalcomix_tasks.php';
     $evalcomix_environment->set_source_array(array((object) array('courseid' => $COURSE->id, 'moodlename' => MOODLE_NAME)));
     try {
         $array_xml_tool = array();
         $xml = webservice_evalcomix_client::get_ws_xml_tools2(array('courseid' => $courseid));
         foreach ($xml as $toolxml) {
             $id = (string) $toolxml['id'];
             foreach ($toolxml as $txml) {
                 $array_xml_tool[$id] = $txml->asXML();
             }
         }
         if ($tools = $DB->get_records('block_evalcomix_tools', array('evxid' => $block->id))) {
             $array = array();
             foreach ($tools as $tool) {
                 $time = time();
                 $idtool = $tool->idtool;
                 if (isset($array_xml_tool[$idtool])) {
                     $array[] = (object) array('id' => $tool->id, 'title' => $tool->title, 'type' => $tool->type, 'timecreated' => $time, 'timemodified' => $time, 'idtool' => $idtool, 'code' => $array_xml_tool[$idtool]);
                 }
             }
             $evalcomix_tool->set_source_array($array);
         }
     } catch (Exception $e) {
     }
     /*$invented->set_source_array(array((object)array('one' => 1, 'two' => 2, 'three' => 3),
       (object)array('one' => 11, 'two' => 22, 'three' => 33))); // 2 object array*/
     //$evalcomix_tool->set_source_table('block_evalcomix_tools', array('evxid' => backup::VAR_PARENTID));
     if (!empty($in_params)) {
         $evalcomix_task->set_source_sql("\n                SELECT *\n                  FROM {block_evalcomix_tasks}\n                 WHERE instanceid {$in_sql}", $in_params);
         $evalcomix_grade->set_source_sql("\n                SELECT *\n                  FROM {block_evalcomix_grades}\n                 WHERE cmid {$in_sql}", $in_params);
         $evalcomix_alloweduser->set_source_sql("\n                SELECT *\n                  FROM {block_evalcomix_allowedusers}\n                 WHERE cmid {$in_sql}", $in_params);
     }
     $evalcomix_assessment->set_source_table('block_evalcomix_assessments', array('taskid' => backup::VAR_PARENTID));
     $evalcomix_mode->set_source_table('block_evalcomix_modes', array('taskid' => backup::VAR_PARENTID));
     $evalcomix_modes_time->set_source_table('block_evalcomix_modes_time', array('modeid' => backup::VAR_PARENTID));
     $evalcomix_modes_extra->set_source_table('block_evalcomix_modes_extra', array('modeid' => backup::VAR_PARENTID));
     // Define annotations
     $evalcomix_task->annotate_ids('course_modules', 'instanceid');
     //$evalcomix->set_source_table('block_evalcomix', array('id' => backup::VAR_BLOCKID));
     //$evalcomix->set_source_array(array((object)array('id' => $this->task->get_blockid())));
     //$evalcomix_tool->set_source_table('evalcomix_tools', array('evxid' => '../id'));
//.........这里部分代码省略.........
开发者ID:srpaedagogus,项目名称:aulavirtual,代码行数:101,代码来源:backup_evalcomix_stepslib.php

示例11: define_structure

 protected function define_structure()
 {
     // To know if we are including userinfo
     $userinfo = $this->get_setting_value('userinfo');
     // Define each element separated
     $oublog = new backup_nested_element('oublog', array('id'), array('name', 'course', 'accesstoken', 'intro', 'introformat', 'allowcomments', 'individual', 'maxbytes', 'maxattachments', 'maxvisibility', 'global', 'views', 'completionposts', 'completioncomments', 'reportingemail', 'displayname', 'statblockon', 'allowimport', 'introonpost', 'tags', 'assessed', 'assesstimestart', 'assesstimefinish', 'scale', 'grading', 'restricttags', 'postfrom', 'postuntil', 'commentfrom', 'commentuntil'));
     $instances = new backup_nested_element('instances');
     $instance = new backup_nested_element('instance', array('id'), array('userid', 'name', 'summary', 'accesstoken', 'views'));
     $links = new backup_nested_element('links');
     $link = new backup_nested_element('link', array('id'), array('title', 'url', 'sortorder'));
     $posts = new backup_nested_element('posts');
     $post = new backup_nested_element('post', array('id'), array('groupid', 'title', 'message', 'timeposted', 'allowcomments', 'timeupdated', 'lasteditedby', 'deletedby', 'timedeleted', 'visibility'));
     $ratings = new backup_nested_element('ratings');
     $rating = new backup_nested_element('rating', array('id'), array('component', 'ratingarea', 'scaleid', 'value', 'userid', 'timecreated', 'timemodified'));
     $comments = new backup_nested_element('comments');
     $comment = new backup_nested_element('comment', array('id'), array('userid', 'title', 'message', 'timeposted', 'deletedby', 'timedeleted', 'authorname', 'authorip', 'timeapproved'));
     $edits = new backup_nested_element('edits');
     $edit = new backup_nested_element('edit', array('id'), array('userid', 'oldtitle', 'oldmessage', 'timeupdated'));
     $taginstances = new backup_nested_element('tags');
     $taginstance = new backup_nested_element('tag', array('id'), array('tag'));
     // Build the tree
     $oublog->add_child($instances);
     $instances->add_child($instance);
     $oublog->add_child($links);
     $links->add_child($link);
     $instance->add_child($posts);
     $posts->add_child($post);
     $post->add_child($ratings);
     $ratings->add_child($rating);
     $post->add_child($comments);
     $comments->add_child($comment);
     $post->add_child($edits);
     $edits->add_child($edit);
     $post->add_child($taginstances);
     $taginstances->add_child($taginstance);
     // Define sources
     $oublog->set_source_table('oublog', array('id' => backup::VAR_ACTIVITYID));
     // All the rest of elements only happen if we are including user info
     if ($userinfo) {
         $instance->set_source_table('oublog_instances', array('oublogid' => backup::VAR_PARENTID));
         $link->set_source_table('oublog_links', array('oubloginstancesid' => backup::VAR_PARENTID));
         $post->set_source_table('oublog_posts', array('oubloginstancesid' => backup::VAR_PARENTID));
         $comment->set_source_table('oublog_comments', array('postid' => backup::VAR_PARENTID));
         $edit->set_source_table('oublog_edits', array('postid' => backup::VAR_PARENTID));
         $taginstance->set_source_sql("SELECT t.id, t.tag\n                                          FROM {oublog_tags} t\n                                          JOIN {oublog_taginstances} ti\n                                           ON t.id=ti.tagid\n                                          WHERE ti.postid=?", array(backup::VAR_PARENTID));
         $rating->set_source_table('rating', array('contextid' => backup::VAR_CONTEXTID, 'component' => backup_helper::is_sqlparam('mod_oublog'), 'ratingarea' => backup_helper::is_sqlparam('post')));
         $rating->set_source_alias('rating', 'value');
     }
     // Define id annotations
     $instance->annotate_ids('user', 'userid');
     $post->annotate_ids('group', 'groupid');
     $post->annotate_ids('user', 'lasteditedby');
     $post->annotate_ids('user', 'deletedby');
     $comment->annotate_ids('user', 'userid');
     $edit->annotate_ids('user', 'userid');
     $link->annotate_ids('oublog_instances', 'id');
     $oublog->annotate_ids('scale', 'scale');
     $rating->annotate_ids('scale', 'scaleid');
     $rating->annotate_ids('user', 'userid');
     // Define file annotations
     $oublog->annotate_files('mod_oublog', 'intro', null);
     // This file area hasn't itemid
     $instance->annotate_files('mod_oublog', 'summary', 'id');
     $post->annotate_files('mod_oublog', 'attachment', 'id');
     $post->annotate_files('mod_oublog', 'message', 'id');
     $edit->annotate_files('mod_oublog', 'edit', 'id');
     $comment->annotate_files('mod_oublog', 'messagecomment', 'id');
     // Return the root element (oublog), wrapped into standard activity structure
     return $this->prepare_activity_structure($oublog);
 }
开发者ID:eugeneventer,项目名称:moodle-mod_oublog,代码行数:70,代码来源:backup_oublog_stepslib.php

示例12: log

 public function log($message, $level, $a = null, $depth = null, $display = false)
 {
     backup_helper::log($message, $level, $a, $depth, $display, $this->get_logger());
 }
开发者ID:JP-Git,项目名称:moodle,代码行数:4,代码来源:restore_plan.class.php

示例13: to_moodle2_format

 /**
  * Converts the given directory with the backup into moodle2 format
  *
  * @param string $tempdir The directory to convert
  * @param string $format The current format, if already detected
  * @param base_logger|null if the conversion should be logged, use this logger
  * @throws convert_helper_exception
  * @return bool false if unable to find the conversion path, true otherwise
  */
 public static function to_moodle2_format($tempdir, $format = null, $logger = null)
 {
     if (is_null($format)) {
         $format = backup_general_helper::detect_backup_format($tempdir);
     }
     // get the supported conversion paths from all available converters
     $converters = self::available_converters();
     $descriptions = array();
     foreach ($converters as $name) {
         $classname = "{$name}_converter";
         if (!class_exists($classname)) {
             throw new convert_helper_exception('class_not_loaded', $classname);
         }
         if ($logger instanceof base_logger) {
             backup_helper::log('available converter', backup::LOG_DEBUG, $classname, 1, false, $logger);
         }
         $descriptions[$name] = call_user_func($classname . '::description');
     }
     // choose the best conversion path for the given format
     $path = self::choose_conversion_path($format, $descriptions);
     if (empty($path)) {
         if ($logger instanceof base_logger) {
             backup_helper::log('unable to find the conversion path', backup::LOG_ERROR, null, 0, false, $logger);
         }
         return false;
     }
     if ($logger instanceof base_logger) {
         backup_helper::log('conversion path established', backup::LOG_INFO, implode(' => ', array_merge($path, array('moodle2'))), 0, false, $logger);
     }
     foreach ($path as $name) {
         if ($logger instanceof base_logger) {
             backup_helper::log('running converter', backup::LOG_INFO, $name, 0, false, $logger);
         }
         $converter = convert_factory::get_converter($name, $tempdir, $logger);
         $converter->convert();
     }
     // make sure we ended with moodle2 format
     if (!self::detect_moodle2_format($tempdir)) {
         throw new convert_helper_exception('conversion_failed');
     }
     return true;
 }
开发者ID:sebastiansanio,项目名称:tallerdeprogramacion2fiuba,代码行数:51,代码来源:convert_helper.class.php

示例14: log

 /**
  * If the logger was set for the converter, log the message
  *
  * If the $display is enabled, the spaces in the $message text are removed
  * and the text is used as a string identifier in the core_backup language file.
  *
  * @see backup_helper::log()
  * @param string $message message text
  * @param int $level message level {@example backup::LOG_WARNING}
  * @param null|mixed $a additional information
  * @param null|int $depth the message depth
  * @param bool $display whether the message should be sent to the output, too
  */
 public function log($message, $level, $a = null, $depth = null, $display = false)
 {
     if ($this->logger instanceof base_logger) {
         backup_helper::log($message, $level, $a, $depth, $display, $this->logger);
     }
 }
开发者ID:evltuma,项目名称:moodle,代码行数:19,代码来源:convertlib.php

示例15: define_structure

 protected function define_structure()
 {
     // To know if we are including userinfo.
     $userinfo = $this->get_setting_value('userinfo');
     // Define each element separated.
     $quiz = new backup_nested_element('quiz', array('id'), array('name', 'intro', 'introformat', 'timeopen', 'timeclose', 'timelimit', 'overduehandling', 'graceperiod', 'preferredbehaviour', 'attempts_number', 'attemptonlast', 'grademethod', 'decimalpoints', 'questiondecimalpoints', 'reviewattempt', 'reviewcorrectness', 'reviewmarks', 'reviewspecificfeedback', 'reviewgeneralfeedback', 'reviewrightanswer', 'reviewoverallfeedback', 'questionsperpage', 'navmethod', 'shufflequestions', 'shuffleanswers', 'sumgrades', 'grade', 'timecreated', 'timemodified', 'password', 'subnet', 'browsersecurity', 'delay1', 'delay2', 'showuserpicture', 'showblocks'));
     // Define elements for access rule subplugin settings.
     $this->add_subplugin_structure('quizaccess', $quiz, true);
     $qinstances = new backup_nested_element('question_instances');
     $qinstance = new backup_nested_element('question_instance', array('id'), array('slot', 'page', 'questionid', 'maxmark'));
     $feedbacks = new backup_nested_element('feedbacks');
     $feedback = new backup_nested_element('feedback', array('id'), array('feedbacktext', 'feedbacktextformat', 'mingrade', 'maxgrade'));
     $overrides = new backup_nested_element('overrides');
     $override = new backup_nested_element('override', array('id'), array('userid', 'groupid', 'timeopen', 'timeclose', 'timelimit', 'attempts', 'password'));
     $grades = new backup_nested_element('grades');
     $grade = new backup_nested_element('grade', array('id'), array('userid', 'gradeval', 'timemodified'));
     $attempts = new backup_nested_element('attempts');
     $attempt = new backup_nested_element('attempt', array('id'), array('userid', 'attemptnum', 'uniqueid', 'layout', 'currentpage', 'preview', 'state', 'timestart', 'timefinish', 'timemodified', 'timecheckstate', 'sumgrades'));
     // This module is using questions, so produce the related question states and sessions
     // attaching them to the $attempt element based in 'uniqueid' matching.
     $this->add_question_usages($attempt, 'uniqueid');
     // Define elements for access rule subplugin attempt data.
     $this->add_subplugin_structure('quizaccess', $attempt, true);
     // Build the tree.
     $quiz->add_child($qinstances);
     $qinstances->add_child($qinstance);
     $quiz->add_child($feedbacks);
     $feedbacks->add_child($feedback);
     $quiz->add_child($overrides);
     $overrides->add_child($override);
     $quiz->add_child($grades);
     $grades->add_child($grade);
     $quiz->add_child($attempts);
     $attempts->add_child($attempt);
     // Define sources.
     $quiz->set_source_table('quiz', array('id' => backup::VAR_ACTIVITYID));
     $qinstance->set_source_table('quiz_slots', array('quizid' => backup::VAR_PARENTID));
     $feedback->set_source_table('quiz_feedback', array('quizid' => backup::VAR_PARENTID));
     // Quiz overrides to backup are different depending of user info.
     $overrideparams = array('quiz' => backup::VAR_PARENTID);
     if (!$userinfo) {
         //  Without userinfo, skip user overrides.
         $overrideparams['userid'] = backup_helper::is_sqlparam(null);
     }
     $override->set_source_table('quiz_overrides', $overrideparams);
     // All the rest of elements only happen if we are including user info.
     if ($userinfo) {
         $grade->set_source_table('quiz_grades', array('quiz' => backup::VAR_PARENTID));
         $attempt->set_source_sql('
                 SELECT *
                 FROM {quiz_attempts}
                 WHERE quiz = :quiz AND preview = 0', array('quiz' => backup::VAR_PARENTID));
     }
     // Define source alias.
     $quiz->set_source_alias('attempts', 'attempts_number');
     $grade->set_source_alias('grade', 'gradeval');
     $attempt->set_source_alias('attempt', 'attemptnum');
     // Define id annotations.
     $qinstance->annotate_ids('question', 'questionid');
     $override->annotate_ids('user', 'userid');
     $override->annotate_ids('group', 'groupid');
     $grade->annotate_ids('user', 'userid');
     $attempt->annotate_ids('user', 'userid');
     // Define file annotations.
     $quiz->annotate_files('mod_quiz', 'intro', null);
     // This file area hasn't itemid.
     $feedback->annotate_files('mod_quiz', 'feedback', 'id');
     // Return the root element (quiz), wrapped into standard activity structure.
     return $this->prepare_activity_structure($quiz);
 }
开发者ID:sumitnegi933,项目名称:Moodle_lms_New,代码行数:70,代码来源:backup_quiz_stepslib.php


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