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

PHP field类代码示例

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

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



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

示例1: test_success

 /**
  * Test successful userset delete
  */
 public function test_success()
 {
     global $DB;
     // Create custom field.
     $fieldcat = new field_category();
     $fieldcat->name = 'Test';
     $fieldcat->save();
     $field = new field();
     $field->categoryid = $fieldcat->id;
     $field->shortname = 'testfield';
     $field->name = 'Test Field';
     $field->datatype = 'text';
     $field->save();
     $fieldctx = new field_contextlevel();
     $fieldctx->fieldid = $field->id;
     $fieldctx->contextlevel = CONTEXT_ELIS_USERSET;
     $fieldctx->save();
     $this->give_permissions(array('local/elisprogram:userset_delete'));
     $userset = array('name' => 'testuserset', 'recursive' => true);
     // Setup userset to delete.
     $us = new userset(array('name' => 'testuserset'));
     $us->save();
     $response = local_datahub_elis_userset_delete::userset_delete($userset);
     $this->assertNotEmpty($response);
     $this->assertInternalType('array', $response);
     $this->assertArrayHasKey('messagecode', $response);
     $this->assertArrayHasKey('message', $response);
     $this->assertEquals(get_string('ws_userset_delete_success_code', 'local_datahub', get_string('ws_userset_delete_recursive', 'local_datahub')), $response['messagecode']);
     $this->assertEquals(get_string('ws_userset_delete_success_msg', 'local_datahub', get_string('ws_userset_delete_subsets', 'local_datahub')), $response['message']);
 }
开发者ID:jamesmcq,项目名称:elis,代码行数:33,代码来源:ws_elis_userset_delete_test.php


示例2: test_success

 /**
  * Test successful program delete
  */
 public function test_success()
 {
     global $DB;
     // Create custom field.
     $fieldcat = new field_category();
     $fieldcat->name = 'Test';
     $fieldcat->save();
     $field = new field();
     $field->categoryid = $fieldcat->id;
     $field->shortname = 'testfield';
     $field->name = 'Test Field';
     $field->datatype = 'text';
     $field->save();
     $fieldctx = new field_contextlevel();
     $fieldctx->fieldid = $field->id;
     $fieldctx->contextlevel = CONTEXT_ELIS_PROGRAM;
     $fieldctx->save();
     // Create test program to delete.
     $cur = new curriculum(array('idnumber' => 'testprogram', 'name' => 'testprogram'));
     $cur->save();
     $program = array('idnumber' => 'testprogram');
     $this->give_permissions(array('local/elisprogram:program_delete'));
     $response = local_datahub_elis_program_delete::program_delete($program);
     $this->assertNotEmpty($response);
     $this->assertInternalType('array', $response);
     $this->assertArrayHasKey('messagecode', $response);
     $this->assertArrayHasKey('message', $response);
     $this->assertEquals(get_string('ws_program_delete_success_code', 'local_datahub'), $response['messagecode']);
     $this->assertEquals(get_string('ws_program_delete_success_msg', 'local_datahub'), $response['message']);
     $this->assertFalse($DB->record_exists(curriculum::TABLE, array('idnumber' => 'testprogram')));
 }
开发者ID:jamesmcq,项目名称:elis,代码行数:34,代码来源:ws_elis_program_delete_test.php


示例3: build_elis_field_data

 /**
  * Method to create ELIS field & owner objects given test data array.
  *
  * @param array $inputarray The test data array with params to build elis field object & owner
  *        input array format:
  *        array('field' => array(fieldparam => fieldparam_value [,...]),
  *              'context' => contextlevel,
  *              'manual' => array(fieldowners_manual_param => fomp_value [,...]),
  *              'moodle_profile' => array(fieldowners_moodleprofile_param => fompp_value [,...]),
  *        )
  * @return object The ELIS field object created
  */
 public function build_elis_field_data($inputarray)
 {
     $field = new field((object) $inputarray['field']);
     $field->save();
     $fieldcontext = new field_contextlevel();
     $fieldcontext->fieldid = $field->id;
     $fieldcontext->contextlevel = $inputarray['context'];
     $fieldcontext->save();
     if (isset($inputarray['manual'])) {
         $manual = new field_owner();
         $manual->fieldid = $field->id;
         $manual->plugin = 'manual';
         foreach ($inputarray['manual'] as $key => $val) {
             $manual->{'param_' . $key} = $val;
         }
         $manual->save();
     }
     if (isset($inputarray['moodle_profile'])) {
         $moodleprofile = new field_owner();
         $moodleprofile->fieldid = $field->id;
         $moodleprofile->plugin = 'moodle_profile';
         foreach ($inputarray['moodle_profile'] as $key => $val) {
             $moodleprofile->{$key} = $val;
         }
         $moodleprofile->save();
     }
     $field->load();
     // TDB.
     return $field;
 }
开发者ID:jamesmcq,项目名称:elis,代码行数:42,代码来源:custom_field_sync_test.php


示例4: cluster_display_priority_append_sort_data

/**
 * Appends additional data to query parameters based on existence of theme priority field
 *
 * @param  string  $cluster_id_field  The field to join on for the cluster id
 * @param  string  $select            The current select clause
 * @param  string  $join              The current join clause
 */
function cluster_display_priority_append_sort_data($cluster_id_field, &$select, &$join)
{
    global $CURMAN;
    //make sure we can get the field we need for ordering
    if ($theme_priority_field = new field(field::get_for_context_level_with_name('cluster', CLUSTER_DISPLAY_PRIORITY_FIELD)) and $contextlevel = context_level_base::get_custom_context_level('cluster', 'block_curr_admin')) {
        $field_data_table = $CURMAN->db->prefix_table($theme_priority_field->data_table());
        //use this for easier naming in terms of sorting
        $select .= ', field_data.data AS priority ';
        $join .= "LEFT JOIN ({$CURMAN->db->prefix_table('context')} context\n                  JOIN {$field_data_table} field_data\n                    ON field_data.contextid = context.id\n                    AND field_data.fieldid = {$theme_priority_field->id})\n\n                    ON context.contextlevel = {$contextlevel}\n                    AND context.instanceid = {$cluster_id_field} ";
    }
}
开发者ID:remotelearner,项目名称:elis.cm,代码行数:18,代码来源:lib.php


示例5: test_success

 /**
  * Test successful course update.
  */
 public function test_success()
 {
     global $DB;
     // Create custom field.
     $fieldcat = new field_category();
     $fieldcat->name = 'Test';
     $fieldcat->save();
     $field = new field();
     $field->categoryid = $fieldcat->id;
     $field->shortname = 'testfield';
     $field->name = 'Test Field';
     $field->datatype = 'text';
     $field->save();
     $fieldctx = new field_contextlevel();
     $fieldctx->fieldid = $field->id;
     $fieldctx->contextlevel = CONTEXT_ELIS_COURSE;
     $fieldctx->save();
     // Grant permissions.
     $this->give_permissions(array('local/elisprogram:course_edit'));
     // Create test program.
     $datagen = new elis_program_datagenerator($DB);
     $program = $datagen->create_program(array('idnumber' => 'TestProgram'));
     // Create test course to update.
     $crs = new course(array('idnumber' => 'TestCourse', 'name' => 'Test Course', 'syllabus' => ''));
     $crs->save();
     $course = array('idnumber' => 'TestCourse', 'name' => 'Test Course', 'code' => 'CRS1', 'syllabus' => 'Test syllabus', 'lengthdescription' => 'Weeks', 'length' => 2, 'credits' => 1.1, 'completion_grade' => 50, 'cost' => '$100', 'version' => '1.0.0', 'assignment' => $program->idnumber);
     // Update test course.
     $response = local_datahub_elis_course_update::course_update($course);
     $this->assertNotEmpty($response);
     $this->assertInternalType('array', $response);
     $this->assertArrayHasKey('messagecode', $response);
     $this->assertArrayHasKey('message', $response);
     $this->assertArrayHasKey('record', $response);
     $this->assertEquals(get_string('ws_course_update_success_code', 'local_datahub'), $response['messagecode']);
     $this->assertEquals(get_string('ws_course_update_success_msg', 'local_datahub'), $response['message']);
     $this->assertInternalType('array', $response['record']);
     $this->assertArrayHasKey('id', $response['record']);
     // Get course.
     $updatedcourse = new course($response['record']['id']);
     $updatedcourse->load();
     $updatedcourse = $updatedcourse->to_array();
     foreach ($course as $param => $val) {
         if ($param != 'assignment') {
             $this->assertArrayHasKey($param, $updatedcourse);
             $this->assertEquals($val, $updatedcourse[$param]);
         }
     }
     // Check that course was assigned to program.
     $curriculumcourseid = $DB->get_field(curriculumcourse::TABLE, 'id', array('curriculumid' => $program->id, 'courseid' => $response['record']['id']));
     $this->assertNotEmpty($curriculumcourseid);
 }
开发者ID:jamesmcq,项目名称:elis,代码行数:54,代码来源:ws_elis_course_update_test.php


示例6: create_profile_field

 /**
  * Helper function for creating a Moodle user profile field
  *
  * @param string $name Profile field shortname
  * @param string $datatype Profile field data type
  * @param int $categoryid Profile field category id
  * @return int The id of the created profile field
  */
 private function create_profile_field($name, $datatype, $categoryid, $contextlevelname = 'user')
 {
     global $CFG;
     require_once $CFG->dirroot . '/local/eliscore/lib/data/customfield.class.php';
     $file = get_plugin_directory('dhimport', 'version1elis') . '/lib.php';
     require_once $file;
     $field = new field(array('categoryid' => $categoryid, 'shortname' => $name, 'name' => $name));
     $field->save();
     // Field contextlevel.
     $contextlevel = \local_eliscore\context\helper::get_level_from_name($contextlevelname);
     $fieldcontextlevel = new field_contextlevel(array('fieldid' => $field->id, 'contextlevel' => $contextlevel));
     $fieldcontextlevel->save();
     return $field->id;
 }
开发者ID:jamesmcq,项目名称:elis,代码行数:22,代码来源:version1elis_import_config_test.php


示例7: create_custom_field

 /**
  * Create a custom field.
  */
 protected function create_custom_field()
 {
     $data = new stdClass();
     $data->shortname = 'testfield';
     $data->name = 'Test Field';
     $data->categoryid = 1;
     $data->description = 'Test Field';
     $data->datatype = 'text';
     $data->forceunique = '0';
     $data->mform_showadvanced_last = 0;
     $data->multivalued = '0';
     $data->defaultdata = '';
     $data->manual_field_enabled = '1';
     $data->manual_field_edit_capability = '';
     $data->manual_field_view_capability = '';
     $data->manual_field_control = 'text';
     $data->manual_field_options_source = '';
     $data->manual_field_options = '';
     $data->manual_field_columns = 30;
     $data->manual_field_rows = 10;
     $data->manual_field_maxlength = 2048;
     $field = new field($data);
     $field->save();
     $fieldcontext = new field_contextlevel();
     $fieldcontext->fieldid = $field->id;
     $fieldcontext->contextlevel = $this->contextlevel;
     $fieldcontext->save();
 }
开发者ID:jamesmcq,项目名称:elis,代码行数:31,代码来源:autocomplete_eliswithcustomfields_test.php


示例8: codemirror

 function codemirror($attrs)
 {
     $url = zotop::module('codemirror', 'url');
     $options = new stdClass();
     $options->path = $url . '/codemirror/js/';
     $options->parserfile = array('parsexml.js');
     $options->stylesheet = array($url . '/codemirror/css/xmlcolors.css');
     $options->height = is_numeric($attrs['height']) ? $attrs['height'] . 'px' : $attrs['height'];
     $options->width = is_numeric($attrs['width']) ? $width . 'px' : $attrs['width'];
     $options->continuousScanning = 500;
     $options->autoMatchParens = true;
     if ($attrs['linenumbers'] !== false) {
         $options->lineNumbers = true;
         $options->textWrapping = false;
     }
     if ($attrs['tabmode'] == '') {
         $options->tabMode = 'shift';
     }
     $html = array();
     $html[] = html::script($url . '/codemirror/js/codemirror.js');
     $html[] = html::stylesheet($url . '/codemirror/css/codemirror.css');
     $html[] = '	' . field::textarea($attrs);
     $html[] = '<script type="text/javascript">';
     $html[] = '	var editor = CodeMirror.fromTextArea("' . $attrs['name'] . '", ' . json_encode($options) . ');';
     $html[] = '$(function(){';
     $html[] = '	$("form").submit(function(){';
     $html[] = '		$("textarea[name=+' . $attrs['name'] . '+]").val(editor.getCode());';
     $html[] = '	});';
     $html[] = '})';
     $html[] = '</script>';
     return implode("\n", $html);
 }
开发者ID:dalinhuang,项目名称:zotop,代码行数:32,代码来源:admin.php


示例9: __construct

 function __construct($name, $caption, $is_required = false, $value, $dir, $prefix = "", $help = "", $help_url = "")
 {
     // Вызываем конструктор базового класса field для
     // инициализации его данных
     parent::__construct($name, "file", $caption, $is_required, $value, "", $help, $help_url);
     $this->dir = $dir;
     $this->prefix = $prefix;
     if (!empty($this->value)) {
         // Проверяем, не является ли файл скриптом PHP
         // или Perl, html, если это так преобразуем его в формат .txt
         $extentions = array("#\\.php#is", "#\\.phtml#is", "#\\.php3#is", "#\\.html#is", "#\\.htm#is", "#\\.hta#is", "#\\.pl#is", "#\\.xml#is", "#\\.inc#is", "#\\.shtml#is", "#\\.xht#is", "#\\.xhtml#is");
         // Заменяем русские символы на транслит
         $this->value[$this->name]['name'] = $this->encodestring($this->value[$this->name]['name']);
         // Извлекаем из имени файла расширение
         $path_parts = pathinfo($this->value[$this->name]['name']);
         $ext = "." . $path_parts['extension'];
         $path = basename(date("y_m_d_h_i_") . $this->value[$this->name]['name'], $ext);
         $add = $ext;
         foreach ($extentions as $exten) {
             if (preg_match($exten, $ext)) {
                 $add = ".txt";
             }
         }
         $path .= $add;
         $path = str_replace("//", "/", $dir . "/" . $prefix . $path);
         // Перемещаем файл из временной директории сервера в
         // директорию /files Web-приложения
         if (copy($this->value[$this->name]['tmp_name'], $path)) {
             // Уничтожаем файл во временной директории
             @unlink($this->value[$this->name]['tmp_name']);
             // Изменяем права доступа к файлу
             @chmod($path, 0644);
         }
     }
 }
开发者ID:volhali,项目名称:mebel,代码行数:35,代码来源:class.field.file.php


示例10: add

 public function add($param = "")
 {
     global $myAdmin;
     global $formMaj;
     global $datas_lang;
     global $smarty;
     global $thisSite;
     $this->LANG_DATAS = $myAdmin->LANG_DATAS;
     parent::add();
     $smarty->assign('this', $this);
     $smarty->assign('param', $param);
     $smarty->assign('language', $thisSite->LIST_LANG_COMP[$myAdmin->LANG_INTERFACE]);
     $toolbars = array();
     $toolbars["Default"][1] = "cut copy paste pastetext | undo redo | bold italic underline strikethrough | subscript superscript | removeformat | charmap emoticons hr nonbreaking";
     $toolbars["Default"][2] = "bullist numlist | outdent indent | alignleft aligncenter alignright alignjustify | image | inserttable tableprops deletetable cell row column | link unlink | anchor  | template  | visualblocks | code";
     $toolbars["Default"][3] = "styleselect  fontselect fontsizeselect | forecolor backcolor";
     $toolbars["Basic"][1] = "bold italic underline strikethrough | subscript superscript | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent";
     $toolbars["Basic"][2] = "styleselect | link unlink | image charmap | code";
     $toolbars["Simple"][1] = "bold italic underline strikethrough | alignleft aligncenter alignright alignjustify | bullist numlist | link unlink | image charmap | code";
     $toolbars["Image"][1] = "image | code";
     $smarty->assign('toolbar', $toolbars[$this->toolbar]);
     $data = $smarty->fetch($this->pathTemplate . 'inc/fields/class.editortm.tpl');
     addStructure("addJsStructure", DOS_OUTILS_ADMIN . "tinymceJQ/jquery.tinymce.min.js");
     addStructure("addJsStructure", DOS_OUTILS_ADMIN . "tinymceJQ/tinymce.min.js");
     $this->smartAssign($this->field, $data);
     return $data;
 }
开发者ID:wedesign-pf,项目名称:Tit,代码行数:27,代码来源:class.editortm.php


示例11: xmldb_crlm_cluster_themes_upgrade

/**
 * ELIS(TM): Enterprise Learning Intelligence Suite
 * Copyright (C) 2008-2012 Remote Learner.net Inc http://www.remote-learner.net
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 * @package    elis
 * @subpackage curriculummanagement
 * @author     Remote-Learner.net Inc
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL
 * @copyright  (C) 2008-2012 Remote Learner.net Inc http://www.remote-learner.net
 *
 */
function xmldb_crlm_cluster_themes_upgrade($oldversion = 0)
{
    global $CFG, $THEME, $db;
    $result = true;
    if ($result && $oldversion < 2010080602) {
        require_once $CFG->dirroot . '/curriculum/lib/customfield.class.php';
        require_once $CFG->dirroot . '/curriculum/plugins/cluster_classification/lib.php';
        require_once $CFG->dirroot . '/curriculum/plugins/cluster_classification/clusterclassification.class.php';
        //theme priority
        $theme_priority_field = new field(field::get_for_context_level_with_name('cluster', 'cluster_themepriority'));
        if (isset($theme_priority_field->owners['manual'])) {
            $theme_priority_owner = new field_owner($theme_priority_field->owners['manual']);
            $theme_priority_owner->param_help_file = 'crlm_cluster_themes/cluster_themepriority';
            $theme_priority_owner->update();
        }
        //theme selection
        $theme_field = new field(field::get_for_context_level_with_name('cluster', 'cluster_theme'));
        if (isset($theme_field->owners['manual'])) {
            $theme_owner = new field_owner($theme_field->owners['manual']);
            $theme_owner->param_help_file = 'crlm_cluster_themes/cluster_theme';
            $theme_owner->update();
        }
    }
    return $result;
}
开发者ID:remotelearner,项目名称:elis.cm,代码行数:49,代码来源:upgrade.php


示例12: actionEditable

 public function actionEditable()
 {
     $name = yii::$app->request->post('name');
     $value = yii::$app->request->post('value');
     $pk = unserialize(base64_decode(yii::$app->request->post('pk')));
     field::saveEdit($pk, $name, $value);
 }
开发者ID:oakcms,项目名称:oakcms,代码行数:7,代码来源:FieldController.php


示例13: image

 /**
  * 自定义一个图片控件,该控件只对当前控制器页面有效
  *  
  * @param array 控件参数
  */
 public function image($attrs)
 {
     $html = array();
     $html[] = field::hidden($attrs);
     $html[] = '<div class="textarea" style="margin-top:-1px;height:100px;">';
     $html[] = '	<ul class="zotop-image-list" id="' . $attrs['name'] . '-images">';
     for ($i = 0; $i < 10; $i++) {
         $image = url::theme() . '/image/userface/' . $i . '.gif';
         $class = $attrs['value'] == $image ? 'selected' : 'normal';
         $html[] = '		<li class="' . $class . '"><a href="javascript:void(0);" onfocus="blur()"><img src="' . $image . '" style="width:64px;height:64px;"></a></li>';
     }
     $html[] = '	</ul>';
     $html[] = '</div>';
     $html[] = '
     <script>
     	$(function(){
 			var name = "' . $attrs['name'] . '";
     		var id = "#' . $attrs['name'] . '-images";
     		$(id).find("li").click(function(){
 				var image = $(this).find("img").attr("src");
 				$(this).parents("ul").find("li").removeClass("selected");
 				$(this).addClass("selected");
 				$("#"+name).val(image);
 			})
 		});        
     </script>
     ';
     return implode("\n", $html);
 }
开发者ID:dalinhuang,项目名称:zotop,代码行数:34,代码来源:mine.php


示例14: cluster_themes_install

/**
 * Sets up the fields necessary for enabling cluster theming
 *
 * @return  boolean  Returns true to indicate success
 */
function cluster_themes_install()
{
    //retrieve the cluster context
    $cluster_context = context_level_base::get_custom_context_level('cluster', 'block_curr_admin');
    //set up the cluster theme category
    $theme_category = new field_category();
    $theme_category->name = get_string('cluster_theme_category', 'crlm_cluster_themes');
    //set up the theme priority field
    $theme_priority_field = new field();
    $theme_priority_field->shortname = 'cluster_themepriority';
    $theme_priority_field->name = get_string('cluster_theme_priority', 'crlm_cluster_themes');
    $theme_priority_field->datatype = 'int';
    //set up the field and category
    $theme_priority_field = field::ensure_field_exists_for_context_level($theme_priority_field, $cluster_context, $theme_category);
    $owner_options = array('required' => 0, 'edit_capability' => '', 'view_capability' => '', 'control' => 'text', 'columns' => 30, 'rows' => 10, 'maxlength' => 2048, 'help_file' => 'crlm_cluster_themes/cluster_themepriority');
    field_owner::ensure_field_owner_exists($theme_priority_field, 'manual', $owner_options);
    //set up the field for selecting the applicable theme
    $theme_field = new field();
    $theme_field->shortname = 'cluster_theme';
    $theme_field->name = get_string('cluster_theme', 'crlm_cluster_themes');
    $theme_field->datatype = 'char';
    //set up the field and category
    $theme_field = field::ensure_field_exists_for_context_level($theme_field, $cluster_context, $theme_category);
    $owner_options = array('control' => 'menu', 'options_source' => 'themes', 'required' => 0, 'edit_capability' => '', 'view_capability' => '', 'columns' => 30, 'rows' => 10, 'maxlength' => 2048, 'help_file' => 'crlm_cluster_themes/cluster_theme');
    field_owner::ensure_field_owner_exists($theme_field, 'manual', $owner_options);
    return true;
}
开发者ID:remotelearner,项目名称:elis.cm,代码行数:32,代码来源:lib.php


示例15: render

 public function render()
 {
     $output = '';
     if (!empty($this->field)) {
         $data = array();
         $data += parent::setGeneralData();
         if (isset($this->field['type']['maxlength']) && $this->field['type']['maxlength']) {
             $data['maxlength'] = $this->field['type']['maxlength'];
         } else {
             $data['maxlength'] = 32;
         }
         if ($this->field['code'] == 'captcha') {
             $setting = oc::registry()->config->get('quick_order_pro_setting');
             $data['maxlength'] = $setting['captcha_count_items'];
             $data['text_captcha_reload'] = oc::registry()->load->language->get('text_captcha_reload');
         }
         $data['mask'] = $data['placeholder'] = '';
         if (!empty($this->field['type']['use_mask']) && $this->field['type']['use_mask'] && !empty($this->field['type']['mask'])) {
             $data['mask'] = $this->field['type']['mask'];
             oc::registry()->document->addScript('catalog/view/javascript/quick_order_pro/jquery.maskedinput.min.js');
         }
         if (!empty($this->field['type']['placeholder'])) {
             $data['placeholder'] = $this->field['type']['placeholder'];
         }
         $output = $this->renderField($data);
     }
     return $output;
 }
开发者ID:SwayWebStudio,项目名称:night.com,代码行数:28,代码来源:class.field.text.php


示例16: add

 public function add($param = "")
 {
     global $formMaj;
     global $datas_lang;
     global $smarty;
     global $thisSite;
     parent::add();
     $smarty->assign('this', $this);
     $rangeLg = array();
     foreach ($this->list_lang as $clg => $extlg) {
         $value = $this->getValue($clg);
         $values = explode(",", $value);
         if (count($values) == 2) {
             $range = 1;
         } else {
             if (count($values) == 1) {
                 $range = 0;
             } else {
                 return false;
             }
         }
         $rangeLg[$clg] = $range;
     }
     $smarty->assign('rangeLg', $rangeLg);
     $data = $smarty->fetch($this->pathTemplate . 'inc/fields/class.slider.tpl');
     $this->smartAssign($this->field, $data);
     return $data;
 }
开发者ID:wedesign-pf,项目名称:Tit,代码行数:28,代码来源:class.slider.php


示例17: create_custom_field

 /**
  * Create the necessary custom field
  *
  * @return int The id of the created field
  */
 private function create_custom_field()
 {
     global $CFG;
     require_once $CFG->dirroot . '/local/eliscore/lib/data/customfield.class.php';
     require_once $CFG->dirroot . '/local/elisprogram/accesslib.php';
     // Field category.
     $fieldcategory = new field_category(array('name' => 'testcategoryname'));
     $fieldcategory->save();
     // Custom field.
     $field = new field(array('categoryid' => $fieldcategory->id, 'shortname' => 'testfieldshortname', 'name' => 'testfieldname', 'datatype' => 'bool'));
     $field->save();
     // Field context level assocation.
     $fieldcontextlevel = new field_contextlevel(array('fieldid' => $field->id, 'contextlevel' => CONTEXT_ELIS_USER));
     $fieldcontextlevel->save();
     return $field->id;
 }
开发者ID:jamesmcq,项目名称:elis,代码行数:21,代码来源:elis_user_field_mappings_test.php


示例18: validate

 /**
  * Validate field
  * @param string $value
  * @return string
  */
 public function validate($value)
 {
     if (!empty($value) && strstr($value, '://') === FALSE) {
         $value = 'http://' . $value;
     }
     return parent::validate($value);
 }
开发者ID:saitinet,项目名称:parsimony,代码行数:12,代码来源:url.php


示例19: render

 public function render()
 {
     $output = '';
     if (!empty($this->field)) {
         $data = array();
         $data += parent::setGeneralData();
         $data['text_select'] = oc::registry()->load->language->get('text_select');
         $data['multiple'] = $this->field['type']['multiple'];
         if ($data['multiple']) {
             $data['class'] .= ($data['class'] ? ' ' : '') . 'multiple';
         }
         $data['selected'] = array();
         if ($data['value']) {
             if (is_array($data['value'])) {
                 $data['selected'] = $data['value'];
             } else {
                 $data['selected'][] = $data['value'];
             }
         } elseif (!empty($this->field['type']['selected'])) {
             $data['selected'][] = $this->field['type']['selected'];
         }
         if (!empty($this->field['type']['option']) && $this->field['type']['option']) {
             $data['option'] = $this->field['type']['option'];
         } else {
             return $output;
         }
         $output = $this->renderField($data);
     }
     return $output;
 }
开发者ID:SwayWebStudio,项目名称:night.com,代码行数:30,代码来源:class.field.select.php


示例20: create

 /**
  * @param $database
  * @return self
  * @throws \Exception
  */
 public static function create($database)
 {
     $file = core_dir . '/db/structures/' . $database . '.json';
     if (file_exists($file)) {
         $file = file_get_contents($file);
         $file = preg_replace_callback('#//@include \'(.*?)\'#', function ($matches) {
             $sub_file = core_dir . '/db/structures/' . $matches[1];
             return file_get_contents($sub_file);
         }, $file);
         $json = json_decode($file);
         if (is_object($json)) {
             if (!isset($json->fieldset)) {
                 $json->fieldset = [];
             }
             foreach ($json->fieldset as &$field) {
                 $field = field::create($field);
             }
             $module = new self();
             foreach ($json as $key => $value) {
                 $module->{$key} = $value;
             }
             return $module;
         } else {
             throw new \Exception('Stub is not valid JSON: ' . $database);
         }
     } else {
         throw new \Exception('Could not find table stub: ' . $database);
     }
 }
开发者ID:robchett,项目名称:framework,代码行数:34,代码来源:module.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP file类代码示例发布时间:2022-05-23
下一篇:
PHP fform类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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