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


PHP backup_helper::is_sqlparam方法代码示例

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


在下文中一共展示了backup_helper::is_sqlparam方法的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: 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

示例3: 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

示例4: 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

示例5: 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

示例6: define_structure

 protected function define_structure()
 {
     // The lesson table
     // This table contains all of the goodness for the lesson module, quite
     // alot goes into it but nothing relational other than course when will
     // need to be corrected upon restore.
     $lesson = new backup_nested_element('lesson', array('id'), array('course', 'name', 'intro', 'introformat', 'practice', 'modattempts', 'usepassword', 'password', 'dependency', 'conditions', 'grade', 'custom', 'ongoing', 'usemaxgrade', 'maxanswers', 'maxattempts', 'review', 'nextpagedefault', 'feedback', 'minquestions', 'maxpages', 'timelimit', 'retake', 'activitylink', 'mediafile', 'mediaheight', 'mediawidth', 'mediaclose', 'slideshow', 'width', 'height', 'bgcolor', 'displayleft', 'displayleftif', 'progressbar', 'available', 'deadline', 'timemodified', 'completionendreached', 'completiontimespent'));
     // The lesson_pages table
     // Grouped within a `pages` element, important to note that page is relational
     // to the lesson, and also to the previous/next page in the series.
     // Upon restore prevpageid and nextpageid will need to be corrected.
     $pages = new backup_nested_element('pages');
     $page = new backup_nested_element('page', array('id'), array('prevpageid', 'nextpageid', 'qtype', 'qoption', 'layout', 'display', 'timecreated', 'timemodified', 'title', 'contents', 'contentsformat'));
     // The lesson_answers table
     // Grouped within an answers `element`, the lesson_answers table relates
     // to the page and lesson with `pageid` and `lessonid` that will both need
     // to be corrected during restore.
     $answers = new backup_nested_element('answers');
     $answer = new backup_nested_element('answer', array('id'), array('jumpto', 'grade', 'score', 'flags', 'timecreated', 'timemodified', 'answer_text', 'response', 'answerformat', 'responseformat'));
     // Tell the answer element about the answer_text elements mapping to the answer
     // database field.
     $answer->set_source_alias('answer', 'answer_text');
     // The lesson_attempts table
     // Grouped by an `attempts` element this is relational to the page, lesson,
     // and user.
     $attempts = new backup_nested_element('attempts');
     $attempt = new backup_nested_element('attempt', array('id'), array('userid', 'retry', 'correct', 'useranswer', 'timeseen'));
     // The lesson_branch table
     // Grouped by a `branch` element this is relational to the page, lesson,
     // and user.
     $branches = new backup_nested_element('branches');
     $branch = new backup_nested_element('branch', array('id'), array('userid', 'retry', 'flag', 'timeseen', 'nextpageid'));
     // The lesson_grades table
     // Grouped by a grades element this is relational to the lesson and user.
     $grades = new backup_nested_element('grades');
     $grade = new backup_nested_element('grade', array('id'), array('userid', 'grade', 'late', 'completed'));
     // The lesson_timer table
     // Grouped by a `timers` element this is relational to the lesson and user.
     $timers = new backup_nested_element('timers');
     $timer = new backup_nested_element('timer', array('id'), array('userid', 'starttime', 'lessontime', 'completed'));
     $overrides = new backup_nested_element('overrides');
     $override = new backup_nested_element('override', array('id'), array('groupid', 'userid', 'available', 'deadline', 'timelimit', 'review', 'maxattempts', 'retake', 'password'));
     // Now that we have all of the elements created we've got to put them
     // together correctly.
     $lesson->add_child($pages);
     $pages->add_child($page);
     $page->add_child($answers);
     $answers->add_child($answer);
     $answer->add_child($attempts);
     $attempts->add_child($attempt);
     $page->add_child($branches);
     $branches->add_child($branch);
     $lesson->add_child($grades);
     $grades->add_child($grade);
     $lesson->add_child($timers);
     $timers->add_child($timer);
     $lesson->add_child($overrides);
     $overrides->add_child($override);
     // Set the source table for the elements that aren't reliant on the user
     // at this point (lesson, lesson_pages, lesson_answers)
     $lesson->set_source_table('lesson', array('id' => backup::VAR_ACTIVITYID));
     //we use SQL here as it must be ordered by prevpageid so that restore gets the pages in the right order.
     $page->set_source_table('lesson_pages', array('lessonid' => backup::VAR_PARENTID), 'prevpageid ASC');
     // We use SQL here as answers must be ordered by id so that the restore gets them in the right order
     $answer->set_source_table('lesson_answers', array('pageid' => backup::VAR_PARENTID), 'id ASC');
     // Lesson overrides to backup are different depending of user info.
     $overrideparams = array('lessonid' => backup::VAR_PARENTID);
     // Check if we are also backing up user information
     if ($this->get_setting_value('userinfo')) {
         // Set the source table for elements that are reliant on the user
         // lesson_attempts, lesson_branch, lesson_grades, lesson_timer.
         $attempt->set_source_table('lesson_attempts', array('answerid' => backup::VAR_PARENTID));
         $branch->set_source_table('lesson_branch', array('pageid' => backup::VAR_PARENTID));
         $grade->set_source_table('lesson_grades', array('lessonid' => backup::VAR_PARENTID));
         $timer->set_source_table('lesson_timer', array('lessonid' => backup::VAR_PARENTID));
     } else {
         $overrideparams['userid'] = backup_helper::is_sqlparam(null);
         //  Without userinfo, skip user overrides.
     }
     $override->set_source_table('lesson_overrides', $overrideparams);
     // Annotate the user id's where required.
     $attempt->annotate_ids('user', 'userid');
     $branch->annotate_ids('user', 'userid');
     $grade->annotate_ids('user', 'userid');
     $timer->annotate_ids('user', 'userid');
     $override->annotate_ids('user', 'userid');
     $override->annotate_ids('group', 'groupid');
     // Annotate the file areas in user by the lesson module.
     $lesson->annotate_files('mod_lesson', 'intro', null);
     $lesson->annotate_files('mod_lesson', 'mediafile', null);
     $page->annotate_files('mod_lesson', 'page_contents', 'id');
     $answer->annotate_files('mod_lesson', 'page_answers', 'id');
     $answer->annotate_files('mod_lesson', 'page_responses', 'id');
     $attempt->annotate_files('mod_lesson', 'essay_responses', 'id');
     // Prepare and return the structure we have just created for the lesson module.
     return $this->prepare_activity_structure($lesson);
 }
开发者ID:evltuma,项目名称:moodle,代码行数:97,代码来源:backup_lesson_stepslib.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
     $forum = new backup_nested_element('forum', array('id'), array('type', 'name', 'intro', 'introformat', 'assessed', 'assesstimestart', 'assesstimefinish', 'scale', 'maxbytes', 'maxattachments', 'forcesubscribe', 'trackingtype', 'rsstype', 'rssarticles', 'timemodified', 'warnafter', 'blockafter', 'blockperiod', 'completiondiscussions', 'completionreplies', 'completionposts', 'displaywordcount'));
     $discussions = new backup_nested_element('discussions');
     $discussion = new backup_nested_element('discussion', array('id'), array('name', 'firstpost', 'userid', 'groupid', 'assessed', 'timemodified', 'usermodified', 'timestart', 'timeend'));
     $posts = new backup_nested_element('posts');
     $post = new backup_nested_element('post', array('id'), array('parent', 'userid', 'created', 'modified', 'mailed', 'subject', 'message', 'messageformat', 'messagetrust', 'attachment', 'totalscore', 'mailnow'));
     $ratings = new backup_nested_element('ratings');
     $rating = new backup_nested_element('rating', array('id'), array('component', 'ratingarea', 'scaleid', 'value', 'userid', 'timecreated', 'timemodified'));
     $subscriptions = new backup_nested_element('subscriptions');
     $subscription = new backup_nested_element('subscription', array('id'), array('userid'));
     $digests = new backup_nested_element('digests');
     $digest = new backup_nested_element('digest', array('id'), array('userid', 'maildigest'));
     $readposts = new backup_nested_element('readposts');
     $read = new backup_nested_element('read', array('id'), array('userid', 'discussionid', 'postid', 'firstread', 'lastread'));
     $trackedprefs = new backup_nested_element('trackedprefs');
     $track = new backup_nested_element('track', array('id'), array('userid'));
     // Build the tree
     $forum->add_child($discussions);
     $discussions->add_child($discussion);
     $forum->add_child($subscriptions);
     $subscriptions->add_child($subscription);
     $forum->add_child($digests);
     $digests->add_child($digest);
     $forum->add_child($readposts);
     $readposts->add_child($read);
     $forum->add_child($trackedprefs);
     $trackedprefs->add_child($track);
     $discussion->add_child($posts);
     $posts->add_child($post);
     $post->add_child($ratings);
     $ratings->add_child($rating);
     // Define sources
     $forum->set_source_table('forum', array('id' => backup::VAR_ACTIVITYID));
     // All these source definitions only happen if we are including user info
     if ($userinfo) {
         $discussion->set_source_sql('
             SELECT *
               FROM {forum_discussions}
              WHERE forum = ?', array(backup::VAR_PARENTID));
         // Need posts ordered by id so parents are always before childs on restore
         $post->set_source_table('forum_posts', array('discussion' => backup::VAR_PARENTID), 'id ASC');
         $subscription->set_source_table('forum_subscriptions', array('forum' => backup::VAR_PARENTID));
         $digest->set_source_table('forum_digests', array('forum' => backup::VAR_PARENTID));
         $read->set_source_table('forum_read', array('forumid' => backup::VAR_PARENTID));
         $track->set_source_table('forum_track_prefs', array('forumid' => backup::VAR_PARENTID));
         $rating->set_source_table('rating', array('contextid' => backup::VAR_CONTEXTID, 'component' => backup_helper::is_sqlparam('mod_forum'), 'ratingarea' => backup_helper::is_sqlparam('post'), 'itemid' => backup::VAR_PARENTID));
         $rating->set_source_alias('rating', 'value');
     }
     // Define id annotations
     $forum->annotate_ids('scale', 'scale');
     $discussion->annotate_ids('group', 'groupid');
     $post->annotate_ids('user', 'userid');
     $rating->annotate_ids('scale', 'scaleid');
     $rating->annotate_ids('user', 'userid');
     $subscription->annotate_ids('user', 'userid');
     $digest->annotate_ids('user', 'userid');
     $read->annotate_ids('user', 'userid');
     $track->annotate_ids('user', 'userid');
     // Define file annotations
     $forum->annotate_files('mod_forum', 'intro', null);
     // This file area hasn't itemid
     $post->annotate_files('mod_forum', 'post', 'id');
     $post->annotate_files('mod_forum', 'attachment', 'id');
     // Return the root element (forum), wrapped into standard activity structure
     return $this->prepare_activity_structure($forum);
 }
开发者ID:sumitnegi933,项目名称:Moodle_lms_New,代码行数:70,代码来源:backup_forum_stepslib.php

示例8: define_structure

 protected function define_structure()
 {
     global $CFG;
     // To know if we are including userinfo.
     $userinfo = $this->get_setting_value('userinfo');
     // Define each element separated.
     $dataform = new backup_nested_element('dataform', array('id'), array('name', 'intro', 'introformat', 'inlineview', 'embedded', 'timemodified', 'timeavailable', 'timedue', 'timeinterval', 'intervalcount', 'grade', 'gradeitems', 'maxentries', 'entriesrequired', 'individualized', 'grouped', 'anonymous', 'timelimit', 'css', 'cssincludes', 'js', 'jsincludes', 'defaultview', 'defaultfilter', 'completionentries', 'completionspecificgrade'));
     $fields = new backup_nested_element('fields');
     $field = new backup_nested_element('field', array('id'), array('type', 'name', 'description', 'visible', 'editable', 'label', 'defaultcontentmode', 'defaultcontent', 'param1', 'param2', 'param3', 'param4', 'param5', 'param6', 'param7', 'param8', 'param9', 'param10'));
     $filters = new backup_nested_element('filters');
     $filter = new backup_nested_element('filter', array('id'), array('name', 'description', 'visible', 'perpage', 'selection', 'search', 'customsort', 'customsearch'));
     $views = new backup_nested_element('views');
     $view = new backup_nested_element('view', array('id'), array('type', 'name', 'description', 'visible', 'perpage', 'filterid', 'patterns', 'submission', 'section', 'param1', 'param2', 'param3', 'param4', 'param5', 'param6', 'param7', 'param8', 'param9', 'param10'));
     $entries = new backup_nested_element('entries');
     $entry = new backup_nested_element('entry', array('id'), array('userid', 'groupid', 'timecreated', 'timemodified', 'state'));
     $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.
     $dataform->add_child($fields);
     $fields->add_child($field);
     $dataform->add_child($filters);
     $filters->add_child($filter);
     $dataform->add_child($views);
     $views->add_child($view);
     $dataform->add_child($entries);
     $entries->add_child($entry);
     $entry->add_child($contents);
     $contents->add_child($content);
     $entry->add_child($ratings);
     $ratings->add_child($rating);
     // Define sources.
     $dataform->set_source_table('dataform', array('id' => backup::VAR_ACTIVITYID));
     $field->set_source_table('dataform_fields', array('dataid' => backup::VAR_PARENTID));
     $filter->set_source_table('dataform_filters', array('dataid' => backup::VAR_PARENTID));
     $view->set_source_table('dataform_views', array('dataid' => backup::VAR_PARENTID));
     // All the rest of elements only happen if we are including user info.
     if ($userinfo) {
         $entry->set_source_table('dataform_entries', array('dataid' => backup::VAR_PARENTID));
         $content->set_source_table('dataform_contents', array('entryid' => backup::VAR_PARENTID));
         // Entry ratings.
         $rating->set_source_table('rating', array('contextid' => backup::VAR_CONTEXTID, 'itemid' => backup::VAR_PARENTID, 'component' => backup_helper::is_sqlparam('mod_dataform')));
         $rating->set_source_alias('rating', 'value');
     }
     // Define id annotations.
     $entry->annotate_ids('user', 'userid');
     $entry->annotate_ids('group', 'groupid');
     $rating->annotate_ids('scale', 'scaleid');
     $rating->annotate_ids('user', 'userid');
     // Define file annotations.
     $dataform->annotate_files('mod_dataform', 'intro', null);
     // This file area hasn't itemid.
     $dataform->annotate_files('mod_dataform', 'activityicon', null);
     // This file area hasn't itemid.
     $content->annotate_files('mod_dataform', 'content', 'id');
     // By content->id.
     $this->annotate_dataformplugin_files('dataformfield', $field);
     // By field->id.
     $this->annotate_dataformplugin_files('dataformview', $view);
     // By view->id.
     // Return the root element (data), wrapped into standard activity structure.
     return $this->prepare_activity_structure($dataform);
 }
开发者ID:parksandwildlife,项目名称:learning,代码行数:64,代码来源:backup_dataform_stepslib.php

示例9: 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', 'optionflags', 'penaltyscheme', 'attempts', 'attemptonlast', 'grademethod', 'decimalpoints', 'questiondecimalpoints', 'review', 'questionsperpage', 'shufflequestions', 'shuffleanswers', 'questions', 'sumgrades', 'grade', 'timecreated', 'timemodified', 'timelimit', 'password', 'subnet', 'popup', 'delay1', 'delay2', 'showuserpicture', 'showblocks'));
     $qinstances = new backup_nested_element('question_instances');
     $qinstance = new backup_nested_element('question_instance', array('id'), array('question', 'grade'));
     $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('uniqueid', 'userid', 'attemptnum', 'sumgrades', 'timestart', 'timefinish', 'timemodified', 'layout', 'preview'));
     // 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_attempts_states($attempt, 'uniqueid');
     $this->add_question_attempts_sessions($attempt, 'uniqueid');
     // 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_question_instances', array('quiz' => 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_table('quiz_attempts', array('quiz' => backup::VAR_PARENTID));
     }
     // Define source alias
     $grade->set_source_alias('grade', 'gradeval');
     $attempt->set_source_alias('attempt', 'attemptnum');
     // Define id annotations
     $qinstance->annotate_ids('question', 'question');
     $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:vuchannguyen,项目名称:web,代码行数:63,代码来源:backup_quiz_stepslib.php

示例10: define_structure

 protected function define_structure()
 {
     // To know if we are including userinfo
     $userinfo = $this->get_setting_value('userinfo');
     // Define each element separated
     $forumng = new backup_nested_element('forumng', array('id'), array('name', 'intro', 'introformat', 'type', 'ratingscale', 'ratingfrom', 'ratinguntil', 'ratingthreshold', 'grading', 'attachmentmaxbytes', 'reportingemail', 'subscription', 'feedtype', 'feeditems', 'maxpostsperiod', 'maxpostsblock', 'postingfrom', 'postinguntil', 'typedata', 'magicnumber', 'completiondiscussions', 'completionreplies', 'completionposts', 'removeafter', 'removeto', 'shared', 'originalcmid', 'gradingscale', 'canpostanon', 'tags', 'enableratings'));
     $discussions = new backup_nested_element('discussions');
     $discussion = new backup_nested_element('discussion', array('id'), array('groupid', 'timestart', 'timeend', 'deleted', 'locked', 'sticky'));
     $posts = new backup_nested_element('posts');
     $post = new backup_nested_element('post', array('id'), array('parentpostid', 'userid', 'created', 'modified', 'deleted', 'deleteuserid', 'important', 'mailstate', 'oldversion', 'edituserid', 'subject', 'message', 'messageformat', 'attachments', 'asmoderator'));
     $newratings = new backup_nested_element('newratings');
     $newrating = new backup_nested_element('newrating', array('id'), array('component', 'ratingarea', 'scaleid', 'value', 'userid', 'timecreated', 'timemodified'));
     $ratings = new backup_nested_element('ratings');
     $rating = new backup_nested_element('rating', array('id'), array('userid', 'time', 'rating'));
     $subscriptions = new backup_nested_element('subscriptions');
     $subscription = new backup_nested_element('subscription', array('id'), array('userid', 'subscribed', 'discussionid', 'clonecmid', 'groupid'));
     $readdiscussions = new backup_nested_element('readdiscussions');
     $read = new backup_nested_element('read', array('id'), array('userid', 'time'));
     $readposts = new backup_nested_element('readposts');
     $readp = new backup_nested_element('readpost', array('id'), array('userid', 'time'));
     $drafts = new backup_nested_element('drafts');
     $draft = new backup_nested_element('draft', array('id'), array('userid', 'groupid', 'parentpostid', 'subject', 'message', 'messageformat', 'attachments', 'saved', 'options', 'asmoderator'));
     $flags = new backup_nested_element('flags');
     $flag = new backup_nested_element('flag', array('id'), array('userid', 'flagged'));
     $flagsd = new backup_nested_element('flagsd');
     $flagd = new backup_nested_element('flagd', array('id'), array('userid', 'flagged'));
     $tags = new backup_nested_element('tags');
     $tag = new backup_nested_element('tag', array('id'), array('name', 'rawname'));
     $forumtaginstances = new backup_nested_element('forumtaginstances');
     $forumtaginstance = new backup_nested_element('forumtaginstance', array('id'), array('name', 'rawname', 'tagid', 'itemtype', 'tiuserid', 'ordering', 'component'));
     $forumgrouptaginstances = new backup_nested_element('forumgrouptaginstances');
     $forumgrouptaginstance = new backup_nested_element('forumgrouptaginstance', array('id'), array('name', 'rawname', 'tagid', 'itemtype', 'itemid', 'tiuserid', 'ordering', 'component'));
     // Build the tree
     $forumng->add_child($discussions);
     $discussions->add_child($discussion);
     $forumng->add_child($subscriptions);
     $subscriptions->add_child($subscription);
     $forumng->add_child($drafts);
     $drafts->add_child($draft);
     $discussion->add_child($posts);
     $posts->add_child($post);
     $discussion->add_child($readdiscussions);
     $readdiscussions->add_child($read);
     $discussion->add_child($flagsd);
     $flagsd->add_child($flagd);
     $post->add_child($newratings);
     $newratings->add_child($newrating);
     $post->add_child($ratings);
     $ratings->add_child($rating);
     $post->add_child($flags);
     $flags->add_child($flag);
     $post->add_child($readposts);
     $readposts->add_child($readp);
     $discussion->add_child($tags);
     $tags->add_child($tag);
     $forumng->add_child($forumtaginstances);
     $forumtaginstances->add_child($forumtaginstance);
     $forumng->add_child($forumgrouptaginstances);
     $forumgrouptaginstances->add_child($forumgrouptaginstance);
     // Define sources
     $forumng->set_source_table('forumng', array('id' => backup::VAR_ACTIVITYID));
     // All these source definitions only happen if we are including user info
     if ($userinfo) {
         $discussion->set_source_table('forumng_discussions', array('forumngid' => backup::VAR_PARENTID));
         $subscription->set_source_table('forumng_subscriptions', array('forumngid' => backup::VAR_PARENTID));
         $draft->set_source_table('forumng_drafts', array('forumngid' => backup::VAR_PARENTID));
         // Need posts ordered by id so parents are always before childs on restore
         $post->set_source_sql("SELECT * FROM {forumng_posts} WHERE discussionid = ?" . "ORDER BY id", array(backup::VAR_PARENTID));
         $read->set_source_table('forumng_read', array('discussionid' => backup::VAR_PARENTID));
         $readp->set_source_table('forumng_read_posts', array('postid' => backup::VAR_PARENTID));
         $newrating->set_source_table('rating', array('contextid' => backup::VAR_CONTEXTID, 'itemid' => backup::VAR_PARENTID, 'component' => backup_helper::is_sqlparam('mod_forumng'), 'ratingarea' => backup_helper::is_sqlparam('post')));
         $newrating->set_source_alias('rating', 'value');
         $rating->set_source_table('forumng_ratings', array('postid' => backup::VAR_PARENTID));
         $flag->set_source_table('forumng_flags', array('postid' => backup::VAR_PARENTID));
         $flagd->set_source_table('forumng_flags', array('discussionid' => backup::VAR_PARENTID));
         $tag->set_source_sql('SELECT t.id, t.name, t.rawname
                                 FROM {tag} t
                                 JOIN {tag_instance} ti ON ti.tagid = t.id
                                WHERE ti.itemtype = ?
                                  AND ti.component = ?
                                  AND ti.itemid = ?', array(backup_helper::is_sqlparam('forumng_discussions'), backup_helper::is_sqlparam('mod_forumng'), backup::VAR_PARENTID));
     }
     $forumtaginstance->set_source_sql('SELECT t.name, t.rawname, ti.*
             FROM {tag} t
             JOIN {tag_instance} ti ON ti.tagid = t.id
             WHERE ti.contextid = ?
             AND ti.itemid = ?
             AND ti.itemtype = ?
             AND ti.component = ?', array(backup::VAR_CONTEXTID, backup::VAR_PARENTID, backup_helper::is_sqlparam('forumng'), backup_helper::is_sqlparam('mod_forumng')));
     $forumgrouptaginstance->set_source_sql('SELECT t.name, t.rawname, ti.*
             FROM {tag} t
             JOIN {tag_instance} ti ON ti.tagid = t.id
            WHERE ti.contextid = ?
             AND ti.itemtype = ?
             AND ti.component = ?', array(backup::VAR_CONTEXTID, backup_helper::is_sqlparam('groups'), backup_helper::is_sqlparam('mod_forumng')));
     // Define id annotations
     $forumng->annotate_ids('course_modules', 'originalcmid');
     $forumng->annotate_ids('scale', 'ratingscale');
     $discussion->annotate_ids('group', 'groupid');
     $post->annotate_ids('user', 'userid');
//.........这里部分代码省略.........
开发者ID:ULCC-QMUL,项目名称:moodle-mod_forumng,代码行数:101,代码来源:backup_forumng_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
     $wiki = new backup_nested_element('wiki', array('id'), array('name', 'intro', 'introformat', 'timecreated', 'timemodified', 'firstpagetitle', 'wikimode', 'defaultformat', 'forceformat', 'editbegin', 'editend'));
     $subwikis = new backup_nested_element('subwikis');
     $subwiki = new backup_nested_element('subwiki', array('id'), array('groupid', 'userid'));
     $pages = new backup_nested_element('pages');
     $page = new backup_nested_element('page', array('id'), array('title', 'cachedcontent', 'timecreated', 'timemodified', 'timerendered', 'userid', 'pageviews', 'readonly'));
     $synonyms = new backup_nested_element('synonyms');
     $synonym = new backup_nested_element('synonym', array('id'), array('pageid', 'pagesynonym'));
     $links = new backup_nested_element('links');
     $link = new backup_nested_element('link', array('id'), array('frompageid', 'topageid', 'tomissingpage'));
     $versions = new backup_nested_element('versions');
     $version = new backup_nested_element('version', array('id'), array('content', 'contentformat', 'version', 'timecreated', 'userid'));
     $tags = new backup_nested_element('tags');
     $tag = new backup_nested_element('tag', array('id'), array('name', 'rawname'));
     // Build the tree
     $wiki->add_child($subwikis);
     $subwikis->add_child($subwiki);
     $subwiki->add_child($pages);
     $pages->add_child($page);
     $subwiki->add_child($synonyms);
     $synonyms->add_child($synonym);
     $subwiki->add_child($links);
     $links->add_child($link);
     $page->add_child($versions);
     $versions->add_child($version);
     $page->add_child($tags);
     $tags->add_child($tag);
     // Define sources
     $wiki->set_source_table('wiki', array('id' => backup::VAR_ACTIVITYID));
     // All these source definitions only happen if we are including user info
     if ($userinfo) {
         $subwiki->set_source_sql('
             SELECT *
               FROM {wiki_subwikis}
              WHERE wikiid = ?', array(backup::VAR_PARENTID));
         $page->set_source_table('wiki_pages', array('subwikiid' => backup::VAR_PARENTID));
         $synonym->set_source_table('wiki_synonyms', array('subwikiid' => backup::VAR_PARENTID));
         $link->set_source_table('wiki_links', array('subwikiid' => backup::VAR_PARENTID));
         $version->set_source_table('wiki_versions', array('pageid' => backup::VAR_PARENTID));
         $tag->set_source_sql('SELECT t.id, t.name, t.rawname
                                 FROM {tag} t
                                 JOIN {tag_instance} ti ON ti.tagid = t.id
                                WHERE ti.itemtype = ?
                                  AND ti.itemid = ?', array(backup_helper::is_sqlparam('wiki_pages'), backup::VAR_PARENTID));
     }
     // Define id annotations
     $subwiki->annotate_ids('group', 'groupid');
     $subwiki->annotate_ids('user', 'userid');
     $page->annotate_ids('user', 'userid');
     $version->annotate_ids('user', 'userid');
     // Define file annotations
     $wiki->annotate_files('mod_wiki', 'intro', null);
     // This file area hasn't itemid
     $subwiki->annotate_files('mod_wiki', 'attachments', 'id');
     // This file area hasn't itemid
     // Return the root element (wiki), wrapped into standard activity structure
     return $this->prepare_activity_structure($wiki);
 }
开发者ID:alanaipe2015,项目名称:moodle,代码行数:62,代码来源:backup_wiki_stepslib.php

示例12: define_structure

 /**
  * Defines the backup structure of the module
  *
  * @return backup_nested_element
  */
 protected function define_structure()
 {
     // Get know if we are including userinfo.
     $userinfo = $this->get_setting_value('userinfo');
     // Define the root element describing the resop instance.
     $resop = new backup_nested_element('resop', array('id'), array('name', 'intro', 'introformat', 'grade', 'id_abt', 'type'));
     // If we had more elements, we would build the tree here.
     //(kr) yes, I forgot this, so the backup contains nothing :-)
     //leider nicht verstanden - backup bleibt erstmal unvollständig
     //https://docs.moodle.org/dev/Backup_2.0_for_developers#Defining_each_element
     /* 
      * Problem: habe elemente, die die gesamte moodle-Instanz betreffen und elemente,
      * die nur das Modul hier betreffen - mir unklar, wie ich hier ein Backup
      * mit der moodlefunktionalität stricken kann.
      * vielleicht muesen die in der task class aufgenommen werden ?
      * 
      * */
     $usedResources = new backup_nested_element('usedResources');
     //mdl_resop_resource_user
     $usedResource = new backup_nested_element('usedResource', array('id'), array('uid', 'resid', 'actid', 'creation', 'termin', 'moun', 'note', 'time'));
     $usedUsers = new backup_nested_element('usedUsers');
     //mdl_resop_resop_user, alle s. unten bei source
     $usedUser = new backup_nested_element('usedUser', array('uid'), array('actid'));
     //die uid reicht an sich
     //bei fester actid muesste uid eindeutig sein! lasse ich actid jedoch weg, speichert er nichts
     $resources = new backup_nested_element('resources');
     //mdl_resop_resource
     $resource = new backup_nested_element('resource', array('id'), array('actid', 'name', 'anzahl'));
     $departements = new backup_nested_element('departements');
     //mdl_resop_abt, alle s. unten bei source
     $departement = new backup_nested_element('departement', array('id'), array('name'));
     $users = new backup_nested_element('users');
     //mdl_resop_user, alle s. unten bei source
     $user = new backup_nested_element('user', array('id'), array('name'));
     //
     /*
     		//$users = new backup_nested_element('users');//mdl_resop_user
     		//$user = new backup_nested_element('user', array('id'), array('name'));
     		$usedUsers = new backup_nested_element('usedUsers');//mdl_resop_resop_user
     		$usedUser = new backup_nested_element('usedUser', array('id'),array('actid','uid'));
     		//Problem: have no id in this the resop_resop_user table, so maybe i have to generate one
     */
     //build the tree
     $resop->add_child($usedResources);
     $usedResources->add_child($usedResource);
     $resop->add_child($resources);
     $resources->add_child($resource);
     $resop->add_child($usedUsers);
     $usedUsers->add_child($usedUser);
     $resop->add_child($departements);
     $departements->add_child($departement);
     $resop->add_child($users);
     $users->add_child($user);
     /*
     //$resop->add_child($users);
     //$users->add_child($user);
     $resop->add_child($usedUsers);
     $usedUsers->add_child($usedUser);
     */
     // Define data sources.
     $resop->set_source_table('resop', array('id' => backup::VAR_ACTIVITYID));
     $usedResource->set_source_table('resop_resource_user', array('actid' => backup::VAR_ACTIVITYID));
     $resource->set_source_table('resop_resource', array('actid' => backup::VAR_ACTIVITYID));
     $usedUser->set_source_table('resop_resop_user', array('actid' => backup::VAR_ACTIVITYID));
     //muesste einfacher gehen, da uid eindeutig wenn actid fest
     //$usedUser->set_source_sql('SELECT @i:=@i+1 AS id, t.* FROM mdl_resop_resop_user AS t, (SELECT @i:=0) AS foo where t.actid=?',
     //							array('actid' => backup::VAR_ACTIVITYID));
     //hier nehme ich alle
     $departement->set_source_sql('select * from {resop_abt} where id like ?', array(backup_helper::is_sqlparam('%')));
     $user->set_source_sql('select * from {resop_user} where id like ?', array(backup_helper::is_sqlparam('%')));
     //damit alle departements
     //$usedUser->set_source_table('resop_resop_user',array('actid'=>backup::VAR_ACTIVITYID));
     /* nicht verstanden 
      */
     // If we were referring to other tables, we would annotate the relation
     // with the element's annotate_ids() method.
     //$usedUser->annotate_ids('resop_user', 'uid');
     //$resop->annotate_ids('resop_abt','id_abt'); //hmm, kein unterschied?, ist glaube ich auch uninteressant
     // Define file annotations (we do not use itemid in this example).
     $resop->annotate_files('mod_resop', 'intro', null);
     // Return the root element (resop), wrapped into standard activity structure.
     return $this->prepare_activity_structure($resop);
 }
开发者ID:Roemke,项目名称:resop,代码行数:88,代码来源:backup_resop_stepslib.php

示例13: 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

示例14: 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

示例15: define_structure

 /**
  * Define the structure for the assign activity
  * @return void
  */
 protected function define_structure()
 {
     // To know if we are including userinfo.
     $userinfo = $this->get_setting_value('userinfo');
     // Define each element separated.
     $assign = new backup_nested_element('assign', array('id'), array('name', 'intro', 'introformat', 'alwaysshowdescription', 'submissiondrafts', 'sendnotifications', 'sendlatenotifications', 'sendstudentnotifications', 'duedate', 'cutoffdate', 'allowsubmissionsfromdate', 'grade', 'timemodified', 'completionsubmit', 'requiresubmissionstatement', 'teamsubmission', 'requireallteammemberssubmit', 'teamsubmissiongroupingid', 'blindmarking', 'revealidentities', 'attemptreopenmethod', 'maxattempts', 'markingworkflow', 'markingallocation', 'preventsubmissionnotingroup'));
     $userflags = new backup_nested_element('userflags');
     $userflag = new backup_nested_element('userflag', array('id'), array('userid', 'assignment', 'mailed', 'locked', 'extensionduedate', 'workflowstate', 'allocatedmarker'));
     $submissions = new backup_nested_element('submissions');
     $submission = new backup_nested_element('submission', array('id'), array('userid', 'timecreated', 'timemodified', 'status', 'groupid', 'attemptnumber', 'latest'));
     $grades = new backup_nested_element('grades');
     $grade = new backup_nested_element('grade', array('id'), array('userid', 'timecreated', 'timemodified', 'grader', 'grade', 'attemptnumber'));
     $pluginconfigs = new backup_nested_element('plugin_configs');
     $pluginconfig = new backup_nested_element('plugin_config', array('id'), array('plugin', 'subtype', 'name', 'value'));
     $overrides = new backup_nested_element('overrides');
     $override = new backup_nested_element('override', array('id'), array('groupid', 'userid', 'sortorder', 'allowsubmissionsfromdate', 'duedate', 'cutoffdate'));
     // Build the tree.
     $assign->add_child($userflags);
     $userflags->add_child($userflag);
     $assign->add_child($submissions);
     $submissions->add_child($submission);
     $assign->add_child($grades);
     $grades->add_child($grade);
     $assign->add_child($pluginconfigs);
     $pluginconfigs->add_child($pluginconfig);
     $assign->add_child($overrides);
     $overrides->add_child($override);
     // Define sources.
     $assign->set_source_table('assign', array('id' => backup::VAR_ACTIVITYID));
     $pluginconfig->set_source_table('assign_plugin_config', array('assignment' => backup::VAR_PARENTID));
     // Assign overrides to backup are different depending of user info.
     $overrideparams = array('assignid' => backup::VAR_PARENTID);
     if ($userinfo) {
         $userflag->set_source_table('assign_user_flags', array('assignment' => backup::VAR_PARENTID));
         $submission->set_source_table('assign_submission', array('assignment' => backup::VAR_PARENTID));
         $grade->set_source_table('assign_grades', array('assignment' => backup::VAR_PARENTID));
         // Support 2 types of subplugins.
         $this->add_subplugin_structure('assignsubmission', $submission, true);
         $this->add_subplugin_structure('assignfeedback', $grade, true);
     } else {
         $overrideparams['userid'] = backup_helper::is_sqlparam(null);
         // Without userinfo, skip user overrides.
     }
     $override->set_source_table('assign_overrides', $overrideparams);
     // Define id annotations.
     $userflag->annotate_ids('user', 'userid');
     $userflag->annotate_ids('user', 'allocatedmarker');
     $submission->annotate_ids('user', 'userid');
     $submission->annotate_ids('group', 'groupid');
     $grade->annotate_ids('user', 'userid');
     $grade->annotate_ids('user', 'grader');
     $assign->annotate_ids('grouping', 'teamsubmissiongroupingid');
     $override->annotate_ids('user', 'userid');
     $override->annotate_ids('group', 'groupid');
     // Define file annotations.
     // These file areas don't have an itemid.
     $assign->annotate_files('mod_assign', 'intro', null);
     $assign->annotate_files('mod_assign', 'introattachment', null);
     $this->annotate_plugin_config_files($assign, 'assignsubmission');
     $this->annotate_plugin_config_files($assign, 'assignfeedback');
     // Return the root element (choice), wrapped into standard activity structure.
     return $this->prepare_activity_structure($assign);
 }
开发者ID:lucaboesch,项目名称:moodle,代码行数:67,代码来源:backup_assign_stepslib.php


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