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


PHP ExtraField::save方法代码示例

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


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

示例1: addMobilePhoneNumberField

 /**
  * addMobilePhoneNumberField (adds a mobile phone number field if it is not
  * already created)
  * @return  void
  */
 private function addMobilePhoneNumberField()
 {
     $extraField = new ExtraField('user');
     $extraFieldInfo = $extraField->get_handler_field_info_by_field_variable('mobile_phone_number');
     if (empty($extraFieldInfo)) {
         $extraField->save(array('field_type' => 1, 'variable' => 'mobile_phone_number', 'display_text' => $this->get_lang('mobile_phone_number'), 'default_value' => null, 'field_order' => 2, 'visible' => 1, 'changeable' => 1, 'filter' => null));
     }
 }
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:13,代码来源:SmsPlugin.php

示例2: install

 /**
  * Install the plugin
  */
 public function install()
 {
     $this->installHook();
     $result = Database::select('variable', Database::get_main_table(TABLE_EXTRA_FIELD), array('where' => array('variable = ?' => array('skype'))));
     if (empty($result)) {
         $extraField = new ExtraField('user');
         $extraField->save(array('field_type' => ExtraField::FIELD_TYPE_TEXT, 'variable' => 'skype', 'display_text' => 'Skype', 'visible' => 1, 'changeable' => 1));
     }
 }
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:12,代码来源:Skype.php

示例3: addAreaField

 /**
  * addAreaField() (adds an area field if it is not already created)
  * @return void
  */
 private function addAreaField()
 {
     $extraField = new ExtraField('user');
     $extraFieldHandler = $extraField->get_handler_field_info_by_field_variable('area');
     $areaExists = $extraFieldHandler !== false;
     if (!$areaExists) {
         $extraField = new ExtraField('user');
         $extraField->save(array('field_type' => 1, 'variable' => 'area', 'display_text' => get_plugin_lang('Area', 'AdvancedSubscriptionPlugin'), 'default_value' => null, 'field_order' => null, 'visible' => 1, 'changeable' => 1, 'filter' => null));
     }
 }
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:14,代码来源:AdvancedSubscriptionPlugin.php

示例4: prepareImport

 /**
  * Prepares extra fields before the import
  */
 private function prepareImport()
 {
     // Create user extra field: extra_external_user_id
     UserManager::create_extra_field($this->extraFieldIdNameList['user'], 1, 'External user id', null);
     // Create course extra field: extra_external_course_id
     CourseManager::create_course_extra_field($this->extraFieldIdNameList['course'], 1, 'External course id');
     // Create session extra field extra_external_session_id
     SessionManager::create_session_extra_field($this->extraFieldIdNameList['session'], 1, 'External session id');
     // Create calendar_event extra field extra_external_session_id
     $extraField = new ExtraField('calendar_event');
     $extraField->save(array('field_type' => ExtraField::FIELD_TYPE_TEXT, 'field_variable' => $this->extraFieldIdNameList['calendar_event'], 'field_display_text' => 'External calendar event id'));
 }
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:15,代码来源:import_csv.php

示例5:

</script>';
// The header.
Display::display_header($tool_name);
// Action handling: Add
switch ($action) {
    case 'add':
        if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) {
            api_not_allowed();
        }
        $url = api_get_self() . '?type=' . $obj->type . '&action=' . Security::remove_XSS($_GET['action']);
        $form = $obj->return_form($url, 'add');
        // The validation or display
        if ($form->validate()) {
            //if ($check) {
            $values = $form->exportValues();
            $res = $obj->save($values);
            if ($res) {
                Display::display_confirmation_message(get_lang('ItemAdded'));
            }
            //}
            $obj->display();
        } else {
            echo '<div class="actions">';
            echo '<a href="' . api_get_self() . '?type=' . $obj->type . '">' . Display::return_icon('back.png', get_lang('Back'), '', ICON_SIZE_MEDIUM) . '</a>';
            echo '</div>';
            $form->addElement('hidden', 'sec_token');
            $form->setConstants(array('sec_token' => $token));
            $form->display();
        }
        break;
    case 'edit':
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:31,代码来源:extra_fields.php

示例6: ExtraField

$schedule->save(array('field_type' => ExtraField::FIELD_TYPE_TEXT, 'variable' => 'schedule', 'display_text' => get_lang('Schedule'), 'visible' => 1, 'changeable' => 1));
$allowVisitors = new ExtraField('session');
$allowVisitors->save(array('field_type' => ExtraField::FIELD_TYPE_CHECKBOX, 'variable' => 'allow_visitors', 'display_text' => get_lang('AllowVisitors'), 'visible' => 1, 'changeable' => 1));
$modeOptions = array(get_lang('Online'), get_lang('Presencial'), get_lang('B-Learning'));
$mode = new ExtraField('session');
$mode->save(array('field_type' => ExtraField::FIELD_TYPE_SELECT, 'variable' => 'mode', 'display_text' => get_lang('Mode'), 'visible' => 1, 'changeable' => 1, 'field_options' => implode('; ', $modeOptions)));
$isInductionSession = new ExtraField('session');
$isInductionSession->save(array('field_type' => ExtraField::FIELD_TYPE_CHECKBOX, 'variable' => 'is_induction_session', 'display_text' => get_lang('IsInductionSession'), 'visible' => 1, 'changeable' => 1));
$isOpenSession = new ExtraField('session');
$isOpenSession->save(array('field_type' => ExtraField::FIELD_TYPE_CHECKBOX, 'variable' => 'is_open_session', 'display_text' => get_lang('IsOpenSession'), 'visible' => 1, 'changeable' => 1));
$duration = new ExtraField('session');
$duration->save(array('field_type' => ExtraField::FIELD_TYPE_TEXT, 'variable' => 'human_text_duration', 'display_text' => get_lang('DurationInWords'), 'visible' => 1, 'changeable' => 1));
$showStatusOptions = array(get_lang('Open'), get_lang('InProcess'), get_lang('Closed'));
$showStatus = new ExtraField('session');
$showStatus->save(array('field_type' => ExtraField::FIELD_TYPE_SELECT, 'variable' => 'show_status', 'display_text' => get_lang('ShowStatus'), 'visible' => 1, 'changeable' => 1, 'field_options' => implode('; ', $showStatusOptions)));
$publicationStartDate = new ExtraField('session');
$publicationStartDate->save(array('field_type' => ExtraField::FIELD_TYPE_DATE, 'variable' => 'publication_start_date', 'display_text' => get_lang('PublicationStartDate'), 'visible' => 1, 'changeable' => 1));
$publicationEndDate = new ExtraField('session');
$publicationEndDate->save(array('field_type' => ExtraField::FIELD_TYPE_DATE, 'variable' => 'publication_end_date', 'display_text' => get_lang('PublicationEndDate'), 'visible' => 1, 'changeable' => 1));
$banner = new ExtraField('session');
$banner->save(array('field_type' => ExtraField::FIELD_TYPE_FILE_IMAGE, 'variable' => 'banner', 'display_text' => get_lang('SessionBanner'), 'visible' => 1, 'changeable' => 1));
$brochure = new ExtraField('session');
$brochure->save(array('field_type' => ExtraField::FIELD_TYPE_FILE, 'variable' => 'brochure', 'display_text' => get_lang('Brochure'), 'visible' => 1, 'changeable' => 1));
$targetOptions = array(get_lang('Minedu'), get_lang('Regiones'));
$target = new ExtraField('session');
$target->save(array('field_type' => ExtraField::FIELD_TYPE_SELECT, 'variable' => 'target', 'display_text' => get_lang('TargetAudience'), 'visible' => 1, 'changeable' => 1, 'field_options' => implode('; ', $targetOptions)));
$shortDescription = new ExtraField('session');
$shortDescription->save(array('field_type' => ExtraField::FIELD_TYPE_TEXT, 'variable' => 'short_description', 'display_text' => get_lang('ShortDescription'), 'visible' => 1, 'changeable' => 1));
$id = new ExtraField('session');
$id->save(array('field_type' => ExtraField::FIELD_TYPE_TEXT, 'variable' => 'code', 'display_text' => get_lang('Code'), 'visible' => 1, 'changeable' => 1));
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:30,代码来源:insert_session_fields.php

示例7: create_extra_field

 /**
  * Creates a new extra field
  * @param    string    $variable Field's internal variable name
  * @param    int       $fieldType  Field's type
  * @param    string    $displayText Field's language var name
  * @param    string    $default Field's default value
  * @return int
  */
 public static function create_extra_field($variable, $fieldType, $displayText, $default)
 {
     $extraField = new ExtraField('user');
     $params = ['variable' => $variable, 'field_type' => $fieldType, 'display_text' => $displayText, 'default_value' => $default];
     return $extraField->save($params);
 }
开发者ID:secuencia24,项目名称:chamilo-lms,代码行数:14,代码来源:usermanager.lib.php

示例8: create_session_extra_field

 /**
  * Creates a new extra field for a given session
  * @param	string	$variable Field's internal variable name
  * @param	int		$fieldType Field's type
  * @param	string	$displayText Field's language var name
  * @return int     new extra field id
  */
 public static function create_session_extra_field($variable, $fieldType, $displayText)
 {
     $extraField = new ExtraField('session');
     $params = ['variable' => $variable, 'field_type' => $fieldType, 'display_text' => $displayText];
     return $extraField->save($params);
 }
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:13,代码来源:sessionmanager.lib.php

示例9: _create_extra_fields

 /**
  * Helper function to create extra fields in the Chamilo database. If the
  * extra field aleady exists, then just return the ID of this field. If
  * options are provided ('options' sub-array), then options are inserted in
  * the corresponding x_field_options table.
  * @param Array An array containing an 'extra_fields' entry with details about the required extra fields
  * @return void
  */
 private function _create_extra_fields(&$table)
 {
     $extra_fields = array();
     error_log('Inserting (if not exist) extra fields for : ' . $table['dest_table'] . " \n");
     foreach ($table['extra_fields'] as $extra_field) {
         //error_log('Preparing for insertion of extra field ' . $extra_field['field_display_text'] . "\n");
         $options = isset($extra_field['options']) ? $extra_field['options'] : null;
         unset($extra_field['options']);
         $extra_field_obj = new ExtraField($table['dest_table']);
         $extra_field_id = $extra_field_obj->save($extra_field);
         $selected_fields = self::prepare_field_match($options);
         //Adding options. This is only processed if the corresponding
         // extra_field has an 'options' sub-aray defined
         if (!empty($options)) {
             $extra_field_option_obj = new ExtraFieldOption($table['dest_table']);
             // use the query defined in the 'query' item as returned in a select by prepare_field_match above
             $this->select_all($options['orig_table'], $selected_fields);
             $num_rows = $this->num_rows();
             if ($num_rows) {
                 $data_to_insert = array();
                 $data_to_insert['field_id'] = $extra_field_id;
                 while ($row = $this->fetch_array()) {
                     $data = self::execute_field_match($options, $row);
                     $data_to_insert = array_merge($data_to_insert, $data);
                     $extra_field_option_obj->save_one_item($data_to_insert, false, false);
                     //error_log(print_r($extra_fields[$table['dest_table']]['extra_field_'.$extra_field['field_variable']], 1));
                     $extra_fields[$table['dest_table']]['extra_field_' . $extra_field['field_variable']]['options'][] = $data_to_insert;
                     $extra_fields[$table['dest_table']]['extra_field_' . $extra_field['field_variable']]['field_type'] = $extra_field['field_type'];
                 }
                 //$extra_fields[$table['dest_table']]['extra_field_'.$extra_field['field_variable']]['selected_option'] =
                 //error_log('$data: ' . print_r($data_to_insert, 1));
             }
         } else {
             // if there are no pre-defined options, then just return the field_id for this variable
             $extra_fields[$table['dest_table']]['extra_field_' . $extra_field['field_variable']] = $extra_field_id;
         }
     }
     return $extra_fields;
 }
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:47,代码来源:migration.class.php

示例10: createExtraField

 /**
  * Create the drupal_user_id when it not exists
  */
 private function createExtraField()
 {
     $extraFieldExists = $this->getExtraFieldInfo() !== false;
     if (!$extraFieldExists) {
         $extraField = new ExtraField('user');
         $extraField->save(['field_type' => ExtraField::FIELD_TYPE_INTEGER, 'variable' => self::EXTRAFIELD_VARIABLE_NAME, 'display_text' => get_plugin_lang('DrupalUserId', 'CreateDrupalUser'), 'default_value' => null, 'field_order' => null, 'visible' => false, 'changeable' => false, 'filter' => null]);
     }
 }
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:11,代码来源:CreateDrupalUser.php

示例11: ExtraField

<?php

//Adding extra fields
$extra_field = new ExtraField('user');
$params = array('field_type' => ExtraField::FIELD_TYPE_TEXT, 'field_variable' => 'exam_room', 'field_display_text' => 'Aula', 'field_visible' => false);
$extra_field->save($params);
$params = array('field_type' => ExtraField::FIELD_TYPE_TEXT, 'field_variable' => 'exam_schedule', 'field_display_text' => 'Horario', 'field_visible' => false);
$extra_field->save($params);
$params = array('field_type' => ExtraField::FIELD_TYPE_TEXT, 'field_variable' => 'exam_password', 'field_display_text' => 'Password', 'field_visible' => false);
$extra_field->save($params);
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:10,代码来源:install.php

示例12: init

 /**
  * Create the user extra field
  */
 public static function init()
 {
     $extraField = new ExtraField('user');
     $fieldInfo = $extraField->get_handler_field_info_by_field_variable(self::EXTRA_FIELD_GCM_REGISTRATION);
     if (empty($fieldInfo)) {
         $extraField->save(['variable' => self::EXTRA_FIELD_GCM_REGISTRATION, 'field_type' => ExtraField::FIELD_TYPE_TEXT, 'display_text' => self::EXTRA_FIELD_GCM_REGISTRATION]);
     }
 }
开发者ID:jloguercio,项目名称:chamilo-lms,代码行数:11,代码来源:MessagesWebService.class.php


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