• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP set_field函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: xmldb_artefact_ilps_upgrade

function xmldb_artefact_ilps_upgrade($oldversion = 0)
{
    if ($oldversion < 2012160300) {
        set_field('artefact', 'container', 1, 'artefacttype', 'ilp');
    }
    return true;
}
开发者ID:rossdash,项目名称:Individual-Learning-Plan,代码行数:7,代码来源:upgrade.php


示例2: display

 function display()
 {
     global $CFG, $PAGE;
     require_capability('format/page:managepages', $this->context);
     $locks = format_page_lock::get_locks();
     $mform = new format_page_lock_form($CFG->wwwroot . '/course/format/page/format.php', format_page_lock::decode($this->page->locks));
     if ($mform->is_cancelled()) {
         redirect($PAGE->url_build('action', 'manage'));
     } else {
         if ($data = $mform->get_data()) {
             $lockdata = array();
             foreach ($locks as $lock) {
                 $lockdata = array_merge($lockdata, $lock->process_form($data));
             }
             $lockinfo = array();
             $lockinfo['showprereqs'] = $data->showprereqs;
             $lockinfo['visible'] = $data->visible;
             $lockinfo['locks'] = $lockdata;
             if (empty($lockinfo['locks'])) {
                 $lockinfo = '';
             } else {
                 $lockinfo = format_page_lock::encode($lockinfo);
             }
             if (!set_field('format_page', 'locks', $lockinfo, 'id', $this->page->id)) {
                 error('Failed to save lock information');
             }
             redirect($PAGE->url_build('page', $this->page->id, 'action', 'lock'));
         } else {
             $PAGE->print_tabs('manage');
             $mform->display();
         }
     }
 }
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:33,代码来源:lock.php


示例3: xmldb_artefact_milestones_upgrade

function xmldb_artefact_milestones_upgrade($oldversion = 0)
{
    if ($oldversion < 2010072302) {
        set_field('artefact', 'container', 1, 'artefacttype', 'milestone');
    }
    return true;
}
开发者ID:vohung96,项目名称:mahara,代码行数:7,代码来源:upgrade.php


示例4: xmldb_blocktype_externalvideo_upgrade

function xmldb_blocktype_externalvideo_upgrade($oldversion = 0)
{
    if ($oldversion < 2014030500) {
        $urlpattern = '#\\b(https?://)prezi\\.com/bin/preziloader\\.swf\\?prezi_id=([a-z0-9]+)\\b#';
        $matches = array();
        $sql = "SELECT id, configdata FROM {block_instance} WHERE blocktype='externalvideo'";
        $records = get_records_sql_array($sql, array());
        if ($records) {
            foreach ($records as $r) {
                $configdata = unserialize($r->configdata);
                if (isset($configdata['html'])) {
                    preg_match($urlpattern, $configdata['html'], $matches);
                } else {
                    if (isset($configdata['videoid'])) {
                        preg_match($urlpattern, $configdata['videoid'], $matches);
                    }
                }
                if (count($matches) >= 3) {
                    $newurl = $matches[1] . 'prezi.com/embed/' . $matches[2];
                    $width = !empty($configdata['width']) ? $configdata['width'] : 0;
                    $height = !empty($configdata['height']) ? $configdata['height'] : 0;
                    $configdata['html'] = $configdata['videoid'] = PluginBlocktypeExternalvideo::iframe_code($newurl, $width, $height);
                    set_field('block_instance', 'configdata', serialize($configdata), 'id', $r->id);
                }
            }
        }
        ensure_record_exists('iframe_source_icon', (object) array('name' => 'Prezi', 'domain' => 'prezi.com'), (object) array('name' => 'Prezi', 'domain' => 'prezi.com'));
        ensure_record_exists('iframe_source', (object) array('prefix' => 'prezi.com/embed/', 'name' => 'Prezi'), (object) array('prefix' => 'prezi.com/embed/', 'name' => 'Prezi'));
        update_safe_iframe_regex();
    }
    return true;
}
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:32,代码来源:upgrade.php


示例5: xmldb_artefact_cpds_upgrade

function xmldb_artefact_cpds_upgrade($oldversion = 0)
{
    if ($oldversion < 2011051501) {
        set_field('artefact', 'container', 1, 'artefacttype', 'cpd');
    }
    return true;
}
开发者ID:swjbakker,项目名称:mahara-artefact_cpds,代码行数:7,代码来源:upgrade.php


示例6: editurl_submit

function editurl_submit(Pieform $form, $values)
{
    global $iframesources, $iframedomains, $SESSION;
    if (isset($iframesources[$values['url']])) {
        $oldname = $iframesources[$values['url']];
        $newname = strip_tags($values['name']);
        $iframesources[$values['url']] = $newname;
        db_begin();
        // Update the icon list if necessary
        if (!isset($iframedomains[$newname])) {
            insert_record('iframe_source_icon', (object) array('name' => $newname, 'domain' => $values['icon']));
        } else {
            if ($iframedomains[$newname] != $values['icon']) {
                set_field('iframe_source_icon', 'domain', $values['icon'], 'name', $newname);
            }
        }
        set_field('iframe_source', 'name', $newname, 'prefix', $values['url']);
        if (!in_array($oldname, $iframesources)) {
            delete_records('iframe_source_icon', 'name', $oldname);
        }
        update_safe_iframe_regex();
        db_commit();
        $SESSION->add_ok_msg(get_string('itemupdated'));
    } else {
        $SESSION->add_error_msg(get_string('updatefailed'));
    }
    redirect('/admin/extensions/iframesites.php');
}
开发者ID:rboyatt,项目名称:mahara,代码行数:28,代码来源:iframesites.php


示例7: write_setting

 /**
  * Save the options to the site course's format field.
  *
  * Possible values: site and page
  *
  * @return string
  **/
 function write_setting($data)
 {
     if ($data == '1') {
         $format = 'page';
     } else {
         $format = 'site';
     }
     return set_field('course', 'format', $format, 'id', SITEID) ? '' : get_string('errorsetting', 'admin') . $this->visiblename . '<br />';
 }
开发者ID:nadavkav,项目名称:MoodleTAO,代码行数:16,代码来源:adminsetting.php


示例8: save_session_and_responses

 function save_session_and_responses(&$question, &$state)
 {
     $responses = 'dataset' . $state->options->datasetitem . '-' . $state->responses[''];
     // Set the legacy answer field
     if (!set_field('question_states', 'answer', $responses, 'id', $state->id)) {
         return false;
     }
     return true;
 }
开发者ID:nadavkav,项目名称:MoodleTAO,代码行数:9,代码来源:abstractqtype.php


示例9: questionnaire_upgrade_2006031700

function questionnaire_upgrade_2006031700()
{
    /// Upgrade the questionnaire_response table to use integer timestamps.
    table_column('questionnaire_response', 'submitted', 'submitted', 'varchar', '20', '', ' ');
    /// This will be heavy on the database....
    if (($numrecs = count_records('questionnaire_response')) > 0) {
        $recstart = 0;
        $recstoget = 100;
        while ($recstart < $numrecs) {
            if ($records = get_records('questionnaire_response', '', '', '', '*', $recstart, $recstoget)) {
                foreach ($records as $record) {
                    $tstampparts = explode(' ', $record->submitted);
                    $dateparts = explode('-', $tstampparts[0]);
                    $timeparts = explode(':', $tstampparts[1]);
                    $time = mktime($timeparts[0], $timeparts[1], $timeparts[2], $dateparts[1], $dateparts[2], $dateparts[0]);
                    set_field('questionnaire_response', 'submitted', $time, 'id', $record->id);
                    if ($record->qtype == 'unlimited') {
                        $qtype = 0;
                    } else {
                        if ($record->type == 'once') {
                            $qtype = 1;
                        }
                    }
                    set_field('questionnaire_response', 'qtype', $qtype, 'id', $record->id);
                }
            }
            $recstart += $recstoget;
        }
    }
    table_column('questionnaire_response', 'submitted', 'submitted', 'integer', '10');
    /// This will be heavy on the database....
    if (($numrecs = count_records('questionnaire')) > 0) {
        $recstart = 0;
        $recstoget = 100;
        while ($recstart < $numrecs) {
            if ($records = get_records('questionnaire', '', '', '', '*', $recstart, $recstoget)) {
                foreach ($records as $record) {
                    if ($record->qtype == 'unlimited') {
                        $qtype = 0;
                    } else {
                        if ($record->qtype == 'once') {
                            $qtype = 1;
                        }
                    }
                    set_field('questionnaire', 'qtype', $qtype, 'id', $record->id);
                }
            }
            $recstart += $recstoget;
        }
    }
    /// Modify the qtype field of the 'questionnaire' table to be integer instead of enum.
    table_column('questionnaire', 'qtype', 'qtype', 'integer', '10');
    /// Add response viewing eligibility.
    table_column('questionnaire', '', 'resp_view', 'integer', '2', 'unsigned', '0', 'not null', 'resp_eligible');
    return true;
}
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:56,代码来源:postgres7.php


示例10: backup_set_config

function backup_set_config($name, $value)
{
    if (get_field("backup_config", "name", "name", $name)) {
        return set_field("backup_config", "value", addslashes($value), "name", $name);
    } else {
        $config = new object();
        $config->name = $name;
        $config->value = addslashes($value);
        return insert_record("backup_config", $config);
    }
}
开发者ID:BackupTheBerlios,项目名称:samouk-svn,代码行数:11,代码来源:lib.php


示例11: cleanup

 /**
  * Delete the temporary view
  */
 public static function cleanup(PluginImportLeap $importer)
 {
     if (self::$tempview) {
         if (self::$savetempview) {
             $title = get_string('entriesimportedfromleapexport', 'artefact.comment');
             set_field('view', 'title', $title, 'id', self::$tempview);
         } else {
             delete_records('view', 'id', self::$tempview);
         }
     }
 }
开发者ID:richardmansfield,项目名称:richardms-mahara,代码行数:14,代码来源:lib.php


示例12: config_write

 function config_write($name, $value)
 {
     if ($value == 1) {
         $format = 'page';
     } else {
         $format = 'site';
     }
     if (set_field('course', 'format', $format, 'id', SITEID)) {
         return parent::config_write($name, $value);
     }
 }
开发者ID:NextEinstein,项目名称:riverhills,代码行数:11,代码来源:frontpage.php


示例13: set_ousearch_instance_configdata

/**
 * This function sets search-type of the existing block instances to muliactivity as default
 * @param void
 * @return boolean
 */
function set_ousearch_instance_configdata()
{
    if (!($blockid = get_field('block', 'id', 'name', 'ousearch'))) {
        return false;
    }
    $multiactivity = 'Tzo2OiJvYmplY3QiOjQ6e3M6MTM6Ik1BWF9GSUxFX1NJWkUiO3M6OToiMTE1MzQzMzYwIjtzOjE4OiJfcWZfX291c2VhcmNoX2Zvcm0iO3M6MToiMSI7czoxMDoic2VhcmNodHlwZSI7czoxMzoibXVsdGlhY3Rpdml0eSI7czoxMjoic3VibWl0YnV0dG9uIjtzOjEyOiJTYXZlIGNoYW5nZXMiO30=';
    if (!set_field('block_instance', 'configdata', $multiactivity, 'blockid', $blockid)) {
        error("Could not set the filed 'configdata' in 'block_instance' table");
        return false;
    }
    return true;
}
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:17,代码来源:upgrade.php


示例14: set_config

 public static function set_config($plugin, $data, $user = 0)
 {
     if (record_exists('sharing_cart_plugins', 'plugin', $plugin, 'user', $user)) {
         return set_field('sharing_cart_plugins', 'data', serialize($data), 'plugin', $plugin, 'user', $user);
     } else {
         $record = new stdClass();
         $record->plugin = $plugin;
         $record->user = $user;
         $record->data = serialize($data);
         return insert_record('sharing_cart_plugins', $record);
     }
 }
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:12,代码来源:plugins.php


示例15: useredit_update_picture

function useredit_update_picture(&$usernew, &$userform)
{
    global $CFG;
    if (isset($usernew->deletepicture) and $usernew->deletepicture) {
        $location = $CFG->dataroot . '/users/' . $usernew->id;
        @remove_dir($location);
        set_field('user', 'picture', 0, 'id', $usernew->id);
    } else {
        if ($usernew->picture = save_profile_image($usernew->id, $userform->get_um(), 'users')) {
            set_field('user', 'picture', 1, 'id', $usernew->id);
        }
    }
}
开发者ID:BackupTheBerlios,项目名称:samouk-svn,代码行数:13,代码来源:editlib.php


示例16: useredit_update_picture

function useredit_update_picture(&$usernew, &$userform)
{
    global $CFG;
    if (isset($usernew->deletepicture) and $usernew->deletepicture) {
        $location = make_user_directory($usernew->id, true);
        @remove_dir($location);
        set_field('user', 'picture', 0, 'id', $usernew->id);
    } else {
        if ($usernew->picture = save_profile_image($usernew->id, $userform->get_um(), 'user')) {
            set_field('user', 'picture', 1, 'id', $usernew->id);
        }
    }
}
开发者ID:r007,项目名称:PMoodle,代码行数:13,代码来源:editlib.php


示例17: xmldb_block_rss_client_upgrade

function xmldb_block_rss_client_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 < 2007080100) {
        //New version in version.php
        /// block_rss_timeout config setting must be block_rss_client_timeout
        set_field('config', 'name', 'block_rss_client_timeout', 'name', 'block_rss_timeout');
    }
    return $result;
}
开发者ID:JackCanada,项目名称:moodle-hacks,代码行数:15,代码来源:upgrade.php


示例18: scorm_add_instance

function scorm_add_instance($scorm)
{
    global $CFG;
    require_once 'locallib.php';
    if (($packagedata = scorm_check_package($scorm)) != null) {
        $scorm->pkgtype = $packagedata->pkgtype;
        $scorm->datadir = $packagedata->datadir;
        $scorm->launch = $packagedata->launch;
        $scorm->parse = 1;
        $scorm->timemodified = time();
        if (!scorm_external_link($scorm->reference)) {
            $scorm->md5hash = md5_file($CFG->dataroot . '/' . $scorm->course . '/' . $scorm->reference);
        } else {
            $scorm->dir = $CFG->dataroot . '/' . $scorm->course . '/moddata/scorm';
            $scorm->md5hash = md5_file($scorm->dir . $scorm->datadir . '/' . basename($scorm->reference));
        }
        $scorm = scorm_option2text($scorm);
        $scorm->width = str_replace('%', '', $scorm->width);
        $scorm->height = str_replace('%', '', $scorm->height);
        //sanitize submitted values a bit
        $scorm->width = clean_param($scorm->width, PARAM_INT);
        $scorm->height = clean_param($scorm->height, PARAM_INT);
        if (!isset($scorm->whatgrade)) {
            $scorm->whatgrade = 0;
        }
        $scorm->grademethod = $scorm->whatgrade * 10 + $scorm->grademethod;
        $id = insert_record('scorm', $scorm);
        if (scorm_external_link($scorm->reference) || basename($scorm->reference) != 'imsmanifest.xml' && $scorm->reference[0] != '#') {
            // Rename temp scorm dir to scorm id
            $scorm->dir = $CFG->dataroot . '/' . $scorm->course . '/moddata/scorm';
            if (file_exists($scorm->dir . '/' . $id)) {
                //delete directory as it shouldn't exist! - most likely there from an old moodle install with old files in dataroot
                scorm_delete_files($scorm->dir . '/' . $id);
            }
            rename($scorm->dir . $scorm->datadir, $scorm->dir . '/' . $id);
        }
        // Parse scorm manifest
        if ($scorm->parse == 1) {
            $scorm->id = $id;
            $scorm->launch = scorm_parse($scorm);
            set_field('scorm', 'launch', $scorm->launch, 'id', $scorm->id);
        }
        scorm_grade_item_update(stripslashes_recursive($scorm));
        return $id;
    } else {
        print_error('badpackage', 'scorm');
    }
}
开发者ID:kai707,项目名称:ITSA-backup,代码行数:48,代码来源:lib.php


示例19: label_get_coursemodule_info

/**
 * Given a course_module object, this function returns any
 * "extra" information that may be needed when printing
 * this activity in a course listing.
 * See get_array_of_activities() in course/lib.php
 */
function label_get_coursemodule_info($coursemodule)
{
    if ($label = get_record('label', 'id', $coursemodule->instance, '', '', '', '', 'id, content, name')) {
        if (empty($label->name)) {
            // label name missing, fix it
            $label->name = "label{$label->id}";
            set_field('label', 'name', $label->name, 'id', $label->id);
        }
        $info = new object();
        $info->extra = urlencode($label->content);
        $info->name = urlencode($label->name);
        return $info;
    } else {
        return null;
    }
}
开发者ID:edwinphillips,项目名称:moodle-485cb39,代码行数:22,代码来源:lib.php


示例20: ezproxy_get_coursemodule_info

/**
 * Given a course_module object, this function returns any
 * "extra" information that may be needed when printing
 * this activity in a course listing.
 * See get_array_of_activities() in course/lib.php
 */
function ezproxy_get_coursemodule_info($coursemodule)
{
    if ($ezproxy = get_record('ezproxy', 'id', $coursemodule->instance, '', '', '', '', 'id, name')) {
        if (empty($ezproxy->name)) {
            // ezproxy name missing, fix it
            $ezproxy->name = get_string('ezproxymodinfo', 'ezproxy') . "{$ezproxy->id}";
            set_field('ezproxy', 'name', $ezproxy->name, 'id', $ezproxy->id);
        }
        $info = new object();
        $info->name = $ezproxy->name;
        $info->extra = urlencode("onclick=\"this.target='ezproxy{$ezproxy->id}'; return " . "openpopup('/mod/ezproxy/view.php?inpopup=true&amp;id=" . $coursemodule->id . "','ezproxy{$ezproxy->id}','location=yes," . "menubar=yes,resizeable=yes,scrollbars=yes,satus=yes,toolbar=yes');\"");
        return $info;
    } else {
        return null;
    }
}
开发者ID:arshanam,项目名称:Moodle-ITScholars-LMS,代码行数:22,代码来源:lib.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP set_field_select函数代码示例发布时间:2022-05-15
下一篇:
PHP set_exception_handler函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap