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


PHP backup_nested_element::set_source_sql方法代码示例

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


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

示例1: define_structure

 protected function define_structure()
 {
     // To know if we are including userinfo
     $userinfo = $this->get_setting_value('userinfo');
     // Define each element separated
     $rcontent = new backup_nested_element('rcontent', array('id'), array('course', 'name', 'intro', 'introformat', 'levelid', 'whatgrade', 'popup', 'popup_options', 'frame', 'width', 'height', 'timecreated', 'timemodified', 'levelcode', 'isbn', 'unitcode', 'activitycode'));
     $grades = new backup_nested_element('grades');
     $grade = new backup_nested_element('grade', array('id'), array('userid', 'rcontentid', 'grade', 'mingrade', 'maxgrade', 'attempt', 'maxattempts', 'starttime', 'totaltime', 'maxtotaltime', 'status', 'comments', 'urlviewresults', 'sumweights', 'timecreated', 'timemodified', 'unitcode', 'activitycode'));
     $grades_details = new backup_nested_element('grades_details');
     $grade_detail = new backup_nested_element('grade_detail', array('id'), array('userid', 'rcontentid', 'code', 'typeid', 'description', 'grade', 'mingrade', 'maxgrade', 'starttime', 'totaltime', 'maxtotaltime', 'attempt', 'maxattempts', 'weight', 'urlviewresults', 'timecreated', 'timemodified', 'unitcode', 'activitycode'));
     $track_credentials = new backup_nested_element('track_credentials');
     $track_credential = new backup_nested_element('track_credential', array('id'), array('username', 'password', 'publisherid', 'timecreated', 'timemodified'));
     // Build the tree
     $rcontent->add_child($grades);
     $grades->add_child($grade);
     $grade->add_child($grades_details);
     $grades_details->add_child($grade_detail);
     $rcontent->add_child($track_credentials);
     $track_credentials->add_child($track_credential);
     // Define sources
     //$rcontent->set_source_table('rcontent', array('id' => backup::VAR_ACTIVITYID));
     $rcontent->set_source_sql('SELECT rc.*,rlevel.code as levelcode, rcb.isbn as isbn, unit.code as unitcode, activity.code as activitycode
           FROM {rcontent} rc
           LEFT outer JOIN {rcommon_level} rlevel on rlevel.id=rc.levelid
           LEFT outer JOIN {rcommon_books} rcb on rcb.id=rc.bookid and rcb.levelid=rc.levelid
           LEFT outer JOIN {rcommon_books_units} unit on unit.id=rc.unitid and unit.bookid=rc.bookid
           LEFT outer JOIN {rcommon_books_activities} activity on activity.id=rc.activityid and activity.bookid=rc.bookid and activity.unitid = rc.unitid
          WHERE rc.id = ?', array(backup::VAR_ACTIVITYID));
     // Use set_source_sql for other calls as set_source_table returns records in reverse order
     // and order is important for several rcontent fields - esp rcontent_scoes.
     $grade->set_source_sql('
             SELECT rg.*, unit.code as unitcode, activity.code as activitycode
             FROM {rcontent_grades} rg
             INNER JOIN {rcontent} rc ON rc.id=rg.rcontentid
             LEFT outer JOIN {rcommon_books_units} unit on unit.id=rc.unitid and unit.bookid=rc.bookid
             LEFT outer JOIN {rcommon_books_activities} activity on activity.id=rc.activityid and activity.bookid=rc.bookid and activity.unitid = rc.unitid
             WHERE rg.rcontentid = :rcontent
             ORDER BY rg.id', array('rcontent' => backup::VAR_PARENTID));
     $grade_detail->set_source_sql('
             SELECT rc.*, unit.code as unitcode, activity.code as activitycode
             FROM {rcontent_grades_details} rg
             INNER JOIN {rcontent} rc ON rc.id=rg.rcontentid
             LEFT outer JOIN {rcommon_books_units} unit on unit.id=rc.unitid and unit.bookid=rc.bookid
             LEFT outer JOIN {rcommon_books_activities} activity on activity.id=rc.activityid and activity.bookid=rc.bookid and activity.unitid = rc.unitid
             WHERE rg.rcontentid = :rcontent
             ORDER BY rg.id', array('rcontent' => backup::VAR_PARENTID));
     $track_credentials->set_source_sql('
             SELECT *
             FROM {rcontent_track_credentials}
             ORDER BY id', array());
     // Define id annotations
     $grade->annotate_ids('user', 'userid');
     $grade_detail->annotate_ids('user', 'userid');
     // Define file annotations
     $rcontent->annotate_files('mod_rcontent', 'intro', null);
     // This file area hasn't itemid
     // Return the root element (rcontent), wrapped into standard activity structure
     return $this->prepare_activity_structure($rcontent);
 }
开发者ID:kevin-bruton,项目名称:marsupial,代码行数:59,代码来源:backup_rcontent_stepslib.php

示例2: define_structure

 /**
  * Define the structure for the links block.
  * @return void
  */
 protected function define_structure()
 {
     // Define each element separated.
     $link = new backup_nested_element('link', null, array('id', 'linktext', 'url', 'notes', 'defaultshow', 'department'));
     // Define sources.
     $link->set_source_sql("SELECT * FROM {block_links}", array());
     // Annotations (none).
     // Return the root element (links), wrapped into standard block structure.
     return $this->prepare_block_structure($link);
 }
开发者ID:sbourget,项目名称:moodle-block_links,代码行数:14,代码来源:backup_links_stepslib.php

示例3: define_structure

 protected function define_structure()
 {
     // Define each element separated
     $module = new backup_nested_element('module', array('id', 'version'), array('modulename', 'sectionid', 'sectionnumber', 'idnumber', 'added', 'score', 'indent', 'visible', 'visibleold', 'groupmode', 'groupingid', 'groupmembersonly', 'completion', 'completiongradeitemnumber', 'completionview', 'completionexpected', 'availablefrom', 'availableuntil', 'showavailability'));
     $availinfo = new backup_nested_element('availability_info');
     $availability = new backup_nested_element('availability', array('id'), array('sourcecmid', 'requiredcompletion', 'gradeitemid', 'grademin', 'grademax'));
     // Define the tree
     $module->add_child($availinfo);
     $availinfo->add_child($availability);
     // Set the sources
     $module->set_source_sql('
         SELECT cm.*, m.version, m.name AS modulename, s.id AS sectionid, s.section AS sectionnumber
           FROM {course_modules} cm
           JOIN {modules} m ON m.id = cm.module
           JOIN {course_sections} s ON s.id = cm.section
          WHERE cm.id = ?', array(backup::VAR_MODID));
     $availability->set_source_table('course_modules_availability', array('coursemoduleid' => backup::VAR_MODID));
     // Define annotations
     $module->annotate_ids('grouping', 'groupingid');
     // Return the root element ($module)
     return $module;
 }
开发者ID:vuchannguyen,项目名称:web,代码行数:22,代码来源:backup_stepslib.php


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