本文整理汇总了PHP中XMLDBField类的典型用法代码示例。如果您正苦于以下问题:PHP XMLDBField类的具体用法?PHP XMLDBField怎么用?PHP XMLDBField使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了XMLDBField类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: xmldb_assignment_upgrade
function xmldb_assignment_upgrade($oldversion = 0)
{
global $CFG, $THEME, $db;
$result = true;
if ($result && $oldversion < 2007072200) {
require_once $CFG->dirroot . '/mod/assignment/lib.php';
// too much debug output
$db->debug = false;
assignment_update_grades();
$db->debug = true;
}
if ($result && $oldversion < 2007091900) {
/// MDL-11268
/// Changing nullability of field data1 on table assignment_submissions to null
$table = new XMLDBTable('assignment_submissions');
$field = new XMLDBField('data1');
$field->setAttributes(XMLDB_TYPE_TEXT, 'small', null, null, null, null, null, null, 'numfiles');
/// Launch change of nullability for field data1
$result = $result && change_field_notnull($table, $field);
/// Changing nullability of field data2 on table assignment_submissions to null
$field = new XMLDBField('data2');
$field->setAttributes(XMLDB_TYPE_TEXT, 'small', null, null, null, null, null, null, 'data1');
/// Launch change of nullability for field data2
$result = $result && change_field_notnull($table, $field);
}
return $result;
}
示例2: xmldb_ezproxy_upgrade
function xmldb_ezproxy_upgrade($oldversion = 0)
{
global $CFG, $THEME, $db;
$result = true;
/// And upgrade begins here. For each one, you'll need one
/// block of code similar to the next one. Please, delete
/// this comment lines once this file start handling proper
/// upgrade code.
if ($result && $oldversion < 2009042403) {
/// Rebuild the course cache of every course which uses one of these modules in it to get
/// the new link.
if ($courseids = get_records_menu('ezproxy', '', '', 'course ASC', 'id, course')) {
/// Just get the unique course ID values.
$courseids = array_unique(array_values($courseids));
if (!empty($courseids)) {
require_once $CFG->dirroot . '/course/lib.php';
foreach ($courseids as $courseid) {
rebuild_course_cache($courseid);
// Does not return a bool
}
}
}
}
if ($result && $oldversion < 2009042404) {
$table = new XMLDBTable('ezproxy');
$field = new XMLDBField('serverurl');
$field->setAttributes(XMLDB_TYPE_TEXT, 'big', null, null, null, null, null, '', 'name');
$result = change_field_type($table, $field);
}
return $result;
}
示例3: xmldb_groupselect_upgrade
function xmldb_groupselect_upgrade($oldversion = 0)
{
global $CFG, $THEME, $db;
$result = true;
if ($result && $oldversion < 2009020600) {
/// Define field signuptype to be added to groupselect
$table = new XMLDBTable('groupselect');
$field = new XMLDBField('signuptype');
$field->setAttributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, null, null, null, null, '0', 'intro');
$result = $result && add_field($table, $field);
/// Define field timecreated to be added to groupselect
$table = new XMLDBTable('groupselect');
$field = new XMLDBField('timecreated');
$field->setAttributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'timedue');
$result = $result && add_field($table, $field);
}
if ($result && $oldversion < 2009030500) {
/// Define field targetgrouping to be added to groupselect
$table = new XMLDBTable('groupselect');
$field = new XMLDBField('targetgrouping');
$field->setAttributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'intro');
$result = $result && add_field($table, $field);
}
return $result;
}
示例4: xmldb_qtype_dragdrop_upgrade
function xmldb_qtype_dragdrop_upgrade($oldversion = 0)
{
global $CFG, $THEME, $db;
$result = true;
/// And upgrade begins here. For each one, you'll need one
/// block of code similar to the next one. Please, delete
/// this comment lines once this file start handling proper
/// upgrade code.
/// if ($result && $oldversion < YYYYMMDD00) { //New version in version.php
/// $result = result of "/lib/ddllib.php" function calls
/// }
// Add a field so that question authors can choose in how many columns
// the drag and drop media is arranged.
if ($result && $oldversion < 2008060501) {
$table = new XMLDBTable('question_dragdrop');
$field = new XMLDBField('arrangemedia');
$field->setAttributes(XMLDB_TYPE_INTEGER, '4', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, 0, 'feedbackmissed');
$result = $result && add_field($table, $field);
}
// Add a field so that question authors can choose where to place the media
// below or right beside the background.
if ($result && $oldversion < 2008060502) {
$table = new XMLDBTable('question_dragdrop');
$field = new XMLDBField('placemedia');
$field->setAttributes(XMLDB_TYPE_INTEGER, '4', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, 0, 'arrangemedia');
$result = $result && add_field($table, $field);
}
return $result;
}
示例5: xmldb_assignment_upgrade
function xmldb_assignment_upgrade($oldversion = 0)
{
global $CFG, $THEME, $db;
$result = true;
if ($result && $oldversion < 2007091900) {
/// MDL-11268
/// Changing nullability of field data1 on table assignment_submissions to null
$table = new XMLDBTable('assignment_submissions');
$field = new XMLDBField('data1');
$field->setAttributes(XMLDB_TYPE_TEXT, 'small', null, null, null, null, null, null, 'numfiles');
/// Launch change of nullability for field data1
$result = $result && change_field_notnull($table, $field);
/// Changing nullability of field data2 on table assignment_submissions to null
$field = new XMLDBField('data2');
$field->setAttributes(XMLDB_TYPE_TEXT, 'small', null, null, null, null, null, null, 'data1');
/// Launch change of nullability for field data2
$result = $result && change_field_notnull($table, $field);
}
if ($result && $oldversion < 2007091902) {
// add draft tracking default to existing upload assignments
$sql = "UPDATE {$CFG->prefix}assignment SET var4=1 WHERE assignmenttype='upload'";
$result = execute_sql($sql);
}
//===== 1.9.0 upgrade line ======//
if ($result && $oldversion < 2007101511) {
notify('Processing assignment grades, this may take a while if there are many assignments...', 'notifysuccess');
// change grade typo to text if no grades MDL-13920
require_once $CFG->dirroot . '/mod/assignment/lib.php';
// too much debug output
$db->debug = false;
assignment_update_grades();
$db->debug = true;
}
return $result;
}
示例6: xmldb_block_file_manager_upgrade
function xmldb_block_file_manager_upgrade($oldversion = 0)
{
/// This function does anything necessary to upgrade
/// older versions to match current functionality
$result = true;
if ($result && $oldversion < 2008061700) {
/// Define field ownertype to be added to fmanager_link
$table = new XMLDBTable('fmanager_link');
$field = new XMLDBField('ownertype');
$field->setAttributes(XMLDB_TYPE_INTEGER, '3', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, null, 'owner');
/// Launch add field ownertype
$result = $result && add_field($table, $field);
/// Define field ownertype to be added to fmanager_categories
$table = new XMLDBTable('fmanager_categories');
$field = new XMLDBField('ownertype');
$field->setAttributes(XMLDB_TYPE_INTEGER, '3', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, null, 'owner');
/// Launch add field ownertype
$result = $result && add_field($table, $field);
/// Define field ownertype to be added to fmanager_folders
$table = new XMLDBTable('fmanager_folders');
$field = new XMLDBField('ownertype');
$field->setAttributes(XMLDB_TYPE_INTEGER, '3', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, null, 'owner');
/// Launch add field ownertype
$result = $result && add_field($table, $field);
/// Define field ownertype to be added to fmanager_shared
$table = new XMLDBTable('fmanager_shared');
$field = new XMLDBField('ownertype');
$field->setAttributes(XMLDB_TYPE_INTEGER, '3', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, null, 'owner');
/// Launch add field ownertype
$result = $result && add_field($table, $field);
}
return $result;
}
示例7: xmldb_ilpconcern_upgrade
function xmldb_ilpconcern_upgrade($oldversion = 0)
{
global $CFG, $THEME, $db;
$result = true;
/// And upgrade begins here. For each one, you'll need one
if ($result && $oldversion < 2008072501) {
/// Define field courserelated to be added to ilptarget_posts
$table = new XMLDBTable('ilpconcern_posts');
$field = new XMLDBField('courserelated');
$field->setAttributes(XMLDB_TYPE_INTEGER, '1', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'course');
/// Launch add field courserelated
$result = $result && add_field($table, $field);
$field = new XMLDBField('targetcourse');
$field->setAttributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'courserelated');
/// Launch add field targetcourse
$result = $result && add_field($table, $field);
}
if ($result && $oldversion < 2008072200) {
/// Define field course to be added to ilptarget_posts
$table = new XMLDBTable('ilpconcern_status');
$field = new XMLDBField('modifiedbyuser');
$field->setAttributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, null, null, null, null, '0', 'modified');
/// Launch add field course
$result = $result && add_field($table, $field);
}
if ($result && $oldversion < 2008052800) {
/// Define field course to be added to ilptarget_posts
$table = new XMLDBTable('ilpconcern_posts');
$field = new XMLDBField('course');
$field->setAttributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, null, null, null, null, '0', 'setbyuserid');
/// Launch add field course
$result = $result && add_field($table, $field);
}
return $result;
}
示例8: xmldb_artefact_comment_upgrade
function xmldb_artefact_comment_upgrade($oldversion = 0)
{
$success = true;
if ($oldversion < 2011011201) {
$table = new XMLDBTable('artefact_comment_comment');
$field = new XMLDBField('rating');
$field->setAttributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED);
$success = $success && add_field($table, $field);
}
if ($oldversion < 2013072400) {
$table = new XMLDBTable('artefact_comment_comment');
$field = new XMLDBField('lastcontentupdate');
$field->setAttributes(XMLDB_TYPE_DATETIME);
$success = $success && add_field($table, $field);
$success = $success && execute_sql('update {artefact_comment_comment} acc
set lastcontentupdate = (
select a.mtime
from {artefact} a
where a.id = acc.artefact
)');
}
if ($oldversion < 2015081000) {
// Set default maxindent for threaded comments
set_config_plugin('artefact', 'comment', 'maxindent', 5);
}
return $success;
}
示例9: xmldb_wwassignment_upgrade
function xmldb_wwassignment_upgrade($oldversion = 0)
{
global $CFG, $THEME, $db;
$result = true;
/// And upgrade begins here. For each one, you'll need one
/// block of code similar to the next one. Please, delete
/// this comment lines once this file start handling proper
/// upgrade code.
/// if ($result && $oldversion < YYYYMMDD00) { //New version in version.php
/// $result = result of "/lib/ddllib.php" function calls
/// }
//===== 1.9.0 upgrade line ======//
if ($result && $oldversion < 2008092818) {
//Define field grade to be added to wwassignment
$table = new XMLDBTable('wwassignment');
$field = new XMLDBField('grade');
$field->setAttributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'webwork_set');
/// Launch add field grade
$result = $result && add_field($table, $field);
/// Define field timemodified to be added to wwassignment
$table = new XMLDBTable('wwassignment');
$field = new XMLDBField('timemodified');
$field->setAttributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'grade');
/// Launch add field timemodified to wwassignment_bridge
$result = $result && add_field($table, $field);
//notify('Processing assignment grades, this may take a while if there are many assignments...', 'notifysuccess');
// change grade typo to text if no grades MDL-13920
//require_once $CFG->dirroot.'/mod/wwassignment/lib.php';
// too much debug output
//$db->debug = false;
//wwassignment_update_grades();
//$db->debug = true;
}
return $result;
}
示例10: xmldb_block_accessibility_upgrade
function xmldb_block_accessibility_upgrade($oldversion = 0)
{
global $CFG, $THEME, $db;
$result = true;
/// And upgrade begins here. For each one, you'll need one
/// block of code similar to the next one. Please, delete
/// this comment lines once this file start handling proper
/// upgrade code.
if ($result && $oldversion < 2009082500) {
/// Define field colourscheme to be added to accessibility
$table = new XMLDBTable('accessibility');
$field = new XMLDBField('colourscheme');
$field->setAttributes(XMLDB_TYPE_INTEGER, '1', XMLDB_UNSIGNED, null, null, null, null, null, 'fontsize');
/// Launch add field colourscheme
$result = $result && add_field($table, $field);
}
if ($result && $oldversion < 2009071000) {
/// Changing type of field fontsize on table accessibility to number
$table = new XMLDBTable('accessibility');
$field = new XMLDBField('fontsize');
$field->setAttributes(XMLDB_TYPE_NUMBER, '4, 1', XMLDB_UNSIGNED, null, null, null, null, null, 'userid');
/// Launch change of type for field fontsize
$result = $result && change_field_type($table, $field);
}
return $result;
}
示例11: xmldb_artefact_resume_upgrade
function xmldb_artefact_resume_upgrade($oldversion = 0)
{
$status = true;
if ($oldversion < 2009122100) {
$table = new XMLDBTable('artefact_resume_employmenthistory');
$field = new XMLDBField('employeraddress');
$field->setAttributes(XMLDB_TYPE_TEXT);
add_field($table, $field);
$table = new XMLDBTable('artefact_resume_educationhistory');
$field = new XMLDBField('institutionaddress');
$field->setAttributes(XMLDB_TYPE_TEXT);
add_field($table, $field);
}
if ($oldversion < 2010020300) {
$table = new XMLDBTable('artefact_resume_educationhistory');
$field = new XMLDBField('qualtype');
$field->setAttributes(XMLDB_TYPE_TEXT);
change_field_notnull($table, $field);
$table = new XMLDBTable('artefact_resume_educationhistory');
$field = new XMLDBField('qualname');
$field->setAttributes(XMLDB_TYPE_TEXT);
change_field_notnull($table, $field);
}
if ($oldversion < 2013071300) {
$table = new XMLDBTable('artefact_resume_book');
$field = new XMLDBField('url');
$field->setAttributes(XMLDB_TYPE_TEXT);
add_field($table, $field);
}
if ($oldversion < 2013072900) {
execute_sql("UPDATE {blocktype_installed_category} SET category = 'internal' WHERE category = 'resume'");
}
return $status;
}
示例12: xmldb_block_task_list_upgrade
function xmldb_block_task_list_upgrade($oldversion = 0)
{
$result = true;
if ($result and $oldversion < 2007011501) {
/// Define field format to be added to block_task_list
$table = new XMLDBTable('block_task_list');
$field = new XMLDBField('format');
$field->setAttributes(XMLDB_TYPE_INTEGER, '4', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'name');
/// Launch add field format
$result = $result and add_field($table, $field);
}
if ($result and $oldversion < 2007011503) {
/// Manually remove bad capabilities
$result = $result and delete_records('capabilities', 'name', 'block/tast_list:manage');
$result = $result and delete_records('capabilities', 'name', 'block/tast_list:checkofftasks');
}
if ($result and $oldversion < 2007011505) {
//TODO: The info field might be able to be removed, as it doesn't seem to be used anywhere, but in the meantime, change it to allow nulls
/// Changing nullability of field info on table block_task_list to allow null
$table = new XMLDBTable('block_task_list');
$field = new XMLDBField('info');
$field->setAttributes(XMLDB_TYPE_TEXT, 'small', null, null, null, null, null, null, 'checked');
/// Launch change of nullability for field info
$result = $result && change_field_notnull($table, $field);
}
return $result;
}
示例13: xmldb_ilptarget_upgrade
function xmldb_ilptarget_upgrade($oldversion = 0)
{
global $CFG, $THEME, $db;
$result = true;
if ($result && $oldversion < 2008052906) {
/// Define field name to be added to ilptarget_posts
$table = new XMLDBTable('ilptarget_posts');
$field = new XMLDBField('name');
$field->setAttributes(XMLDB_TYPE_CHAR, '255', null, XMLDB_NOTNULL, null, null, null, null, 'data2');
/// Launch add field name
$result = $result && add_field($table, $field);
}
if ($result && $oldversion < 2008052904) {
/// Define field courserelated to be added to ilptarget_posts
$table = new XMLDBTable('ilptarget_posts');
$field = new XMLDBField('courserelated');
$field->setAttributes(XMLDB_TYPE_INTEGER, '1', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'course');
/// Launch add field courserelated
$result = $result && add_field($table, $field);
$field = new XMLDBField('targetcourse');
$field->setAttributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'courserelated');
/// Launch add field targetcourse
$result = $result && add_field($table, $field);
}
if ($result && $oldversion < 2008052902) {
/// Define field course to be added to ilptarget_posts
$table = new XMLDBTable('ilptarget_posts');
$field = new XMLDBField('course');
$field->setAttributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, null, null, null, null, '0', 'setbyuserid');
/// Launch add field course
$result = $result && add_field($table, $field);
}
return $result;
}
示例14: xmldb_report_customsql_upgrade
/**
* Database upgrade script for the custom SQL report.
*
* @package report_customsql
* @copyright 2009 The Open University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
function xmldb_report_customsql_upgrade($oldversion = 0)
{
global $CFG, $db;
$result = true;
if ($result && $oldversion < 2009102802) {
/// Define field runable to be added to report_customsql_queries
$table = new XMLDBTable('report_customsql_queries');
$field = new XMLDBField('runable');
$field->setAttributes(XMLDB_TYPE_CHAR, '32', null, XMLDB_NOTNULL, null, null, null, 'manual', 'lastexecutiontime');
/// Launch add field runable
$result = $result && add_field($table, $field);
}
if ($result && $oldversion < 2009102900) {
/// Define field singlerow to be added to report_customsql_queries
$table = new XMLDBTable('report_customsql_queries');
$field = new XMLDBField('singlerow');
$field->setAttributes(XMLDB_TYPE_INTEGER, '1', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', 'runable');
/// Launch add field singlerow
$result = $result && add_field($table, $field);
}
if ($result && $oldversion < 2009103000) {
/// Changing the default of field lastrun on table report_customsql_queries to 0
$table = new XMLDBTable('report_customsql_queries');
$field = new XMLDBField('lastrun');
$field->setAttributes(XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, null, null, null, null, '0', 'capability');
/// Launch change of default for field lastrun
$result = $result && change_field_default($table, $field);
}
return $result;
}
示例15: xmldb_block_student_gradeviewer_upgrade
function xmldb_block_student_gradeviewer_upgrade($oldversion = 0)
{
global $CFG, $THEME, $db;
$result = true;
if ($result && $oldversion < 2010070912) {
/// Define field opt to be dropped from block_teacher_referral_opt
$table = new XMLDBTable('block_teacher_referral_opt');
// First let's drop the index
$index = new XMLDBIndex('bloc_tea_usesec_uix');
$index->setAttributes(XMLDB_INDEX_UNIQUE, array('usersid', 'sectionsid'));
$failing_field = new XMLDBField('failing');
$lagging_field = new XMLDBField('lagging');
$usersid_field = new XMLDBField('usersid');
/// Launch drop field opt
$result = $result && drop_index($table, $index) && drop_field($table, $usersid_field) && drop_field($table, $lagging_field) && drop_field($table, $failing_field);
// Add the following fields
$fields = array('sectionsid', 'primary_instructor', 'non_primary_instructor', 'student', 'non_primary_control');
foreach (range(1, count($fields) - 1) as $index) {
$field = new XMLDBField($fields[$index]);
$field->setAttributes(XMLDB_TYPE_INTEGER, '1', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, null, null, '0', $fields[$index - 1]);
$result = $result && add_field($table, $field);
}
$index = new XMLDBIndex('bloc_tea_usesec_uix');
$index->setAttributes(XMLDB_INDEX_UNIQUE, array('sectionsid'));
$result = $result && add_index($table, $index);
}
return $result;
}