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


PHP ExtraField::get_handler_field_info_by_field_variable方法代码示例

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


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

示例3: ExtraField

$show_full_profile = true;
if ($show_full_profile) {
    $t_ufo = Database::get_main_table(TABLE_EXTRA_FIELD_OPTIONS);
    $extra_user_data = UserManager::get_extra_user_data($user_id, false, true);
    $extra_information = '';
    if (is_array($extra_user_data) && count($extra_user_data) > 0) {
        $extra_information_value = '';
        $extraField = new ExtraField('user');
        foreach ($extra_user_data as $key => $data) {
            // Avoiding parameters
            if (in_array($key, array('mail_notify_invitation', 'mail_notify_message', 'mail_notify_group_message'))) {
                continue;
            }
            // get display text, visibility and type from user_field table
            $field_variable = str_replace('extra_', '', $key);
            $extraFieldInfo = $extraField->get_handler_field_info_by_field_variable($field_variable);
            if ($extraFieldInfo['visible'] != 1) {
                continue;
            }
            if (is_array($data)) {
                $extra_information_value .= '<dt>' . ucfirst($extraFieldInfo['display_text']) . '</dt>' . '<dd> ' . implode(',', $data) . '</dd>';
            } else {
                switch ($extraFieldInfo['field_type']) {
                    case ExtraField::FIELD_TYPE_DOUBLE_SELECT:
                        $id_options = explode(';', $data);
                        $value_options = array();
                        // get option display text from user_field_options table
                        foreach ($id_options as $id_option) {
                            $sql = "SELECT display_text FROM {$t_ufo} WHERE id = '{$id_option}'";
                            $res_options = Database::query($sql);
                            $row_options = Database::fetch_row($res_options);
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:31,代码来源:profile.php

示例4: importCalendarStatic

 /**
  * @param string $file
  * @param bool   $moveFile
  *
  * @return int
  */
 private function importCalendarStatic($file, $moveFile = true)
 {
     $data = Import::csv_to_array($file);
     if (!empty($data)) {
         $this->logger->addInfo(count($data) . " records found.");
         $eventsToCreate = array();
         $errorFound = false;
         foreach ($data as $row) {
             $sessionId = null;
             $externalSessionId = null;
             if (isset($row['external_sessionID'])) {
                 $externalSessionId = $row['external_sessionID'];
                 $sessionId = SessionManager::get_session_id_from_original_id($externalSessionId, $this->extraFieldIdNameList['session']);
             }
             $courseCode = null;
             if (isset($row['coursecode'])) {
                 $courseCode = $row['coursecode'];
             }
             $courseInfo = api_get_course_info($courseCode);
             if (empty($courseInfo)) {
                 $this->logger->addInfo("Course '{$courseCode}' does not exists");
             }
             if (empty($sessionId)) {
                 $this->logger->addInfo("external_sessionID: " . $externalSessionId . " does not exists.");
             }
             $teacherId = null;
             if (!empty($sessionId) && !empty($courseInfo)) {
                 $courseIncluded = SessionManager::relation_session_course_exist($sessionId, $courseInfo['code']);
                 if ($courseIncluded == false) {
                     $this->logger->addInfo("Course '{$courseCode}' is not included in session: {$sessionId}");
                     $errorFound = true;
                 } else {
                     $teachers = CourseManager::get_coach_list_from_course_code($courseInfo['code'], $sessionId);
                     // Getting first teacher.
                     if (!empty($teachers)) {
                         $teacher = current($teachers);
                         $teacherId = $teacher['user_id'];
                     } else {
                         $sessionInfo = api_get_session_info($sessionId);
                         $teacherId = $sessionInfo['id_coach'];
                     }
                 }
             } else {
                 $errorFound = true;
             }
             if (empty($teacherId)) {
                 $errorFound = true;
                 $this->logger->addInfo("No teacher found in course code : '{$courseCode}' and session: '{$sessionId}'");
             }
             $date = $row['date'];
             $startTime = $row['time_start'];
             $endTime = $row['time_end'];
             $title = $row['title'];
             $comment = $row['comment'];
             $color = isset($row['color']) ? $row['color'] : '';
             $startDateYear = substr($date, 0, 4);
             $startDateMonth = substr($date, 4, 2);
             $startDateDay = substr($date, 6, 8);
             $startDate = $startDateYear . '-' . $startDateMonth . '-' . $startDateDay . ' ' . $startTime . ":00";
             $endDate = $startDateYear . '-' . $startDateMonth . '-' . $startDateDay . ' ' . $endTime . ":00";
             if (!api_is_valid_date($startDate) || !api_is_valid_date($endDate)) {
                 $this->logger->addInfo("Verify your dates:  '{$startDate}' : '{$endDate}' ");
                 $errorFound = true;
             }
             // If old events do nothing.
             /*if (api_strtotime($startDate) < time()) {
                   continue;
               }*/
             if ($errorFound == false) {
                 $eventsToCreate[] = array('start' => $startDate, 'end' => $endDate, 'title' => $title, 'sender_id' => $teacherId, 'course_id' => $courseInfo['real_id'], 'session_id' => $sessionId, 'comment' => $comment, 'color' => $color, $this->extraFieldIdNameList['calendar_event'] => $row['external_calendar_itemID']);
             }
         }
         if (empty($eventsToCreate)) {
             $this->logger->addInfo("No events to add");
             return 0;
         }
         $this->logger->addInfo("Ready to insert events");
         $agenda = new Agenda();
         $extraFieldValue = new ExtraFieldValue('calendar_event');
         $extraFieldName = $this->extraFieldIdNameList['calendar_event'];
         $externalEventId = null;
         $extraField = new ExtraField('calendar_event');
         $extraFieldInfo = $extraField->get_handler_field_info_by_field_variable($extraFieldName);
         if (empty($extraFieldInfo)) {
             $this->logger->addInfo("No calendar event extra field created: {$extraFieldName}");
             return 0;
         }
         foreach ($eventsToCreate as $event) {
             $update = false;
             $item = null;
             if (!isset($event[$extraFieldName])) {
                 $this->logger->addInfo("No external_calendar_itemID found. Skipping ...");
                 continue;
             } else {
//.........这里部分代码省略.........
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:101,代码来源:import_csv.php

示例5: save_field_values

 /**
  * Saves a series of records given as parameter into the coresponding table
  * @param array  Structured parameter for the insertion into the *_field_values table
  * @return mixed false on empty params, void otherwise
  * @assert (array()) === false
  */
 public function save_field_values($params)
 {
     $extra_field = new ExtraField($this->type);
     if (empty($params[$this->handler_id])) {
         return false;
     }
     foreach ($params as $key => $value) {
         $found = strpos($key, '__persist__');
         if ($found) {
             $tempKey = str_replace('__persist__', '', $key);
             if (!isset($params[$tempKey])) {
                 $params[$tempKey] = array();
             }
             break;
         }
     }
     // Parse params.
     foreach ($params as $key => $value) {
         if (substr($key, 0, 6) == 'extra_') {
             // An extra field.
             $field_variable = substr($key, 6);
             $extra_field_info = $extra_field->get_handler_field_info_by_field_variable($field_variable);
             if ($extra_field_info) {
                 $commentVariable = 'extra_' . $field_variable . '_comment';
                 $comment = isset($params[$commentVariable]) ? $params[$commentVariable] : null;
                 switch ($extra_field_info['field_type']) {
                     case ExtraField::FIELD_TYPE_TAG:
                         $old = self::getAllValuesByItemAndField($extra_field_info['id'], $params[$this->handler_id]);
                         $deleteItems = array();
                         if (!empty($old)) {
                             $oldIds = array();
                             foreach ($old as $oldItem) {
                                 $oldIds[] = $oldItem['field_value'];
                             }
                             $deleteItems = array_diff($oldIds, $value);
                         }
                         foreach ($value as $optionId) {
                             $new_params = array($this->handler_id => $params[$this->handler_id], 'field_id' => $extra_field_info['id'], 'field_value' => $optionId, 'comment' => $comment);
                             self::save($new_params);
                         }
                         if (!empty($deleteItems)) {
                             foreach ($deleteItems as $deleteFieldValue) {
                                 self::deleteValuesByHandlerAndFieldAndValue($extra_field_info['id'], $params[$this->handler_id], $deleteFieldValue);
                             }
                         }
                         break;
                     default:
                         $new_params = array($this->handler_id => $params[$this->handler_id], 'field_id' => $extra_field_info['id'], 'field_value' => $value, 'comment' => $comment);
                         self::save($new_params);
                 }
             }
         }
     }
 }
开发者ID:ragebat,项目名称:chamilo-lms,代码行数:60,代码来源:extra_field_value.lib.php

示例6: get_extra_field_information_by_name

 /**
  * Get the extra field information for a certain field (the options as well)
  * @param  int     $variable The name of the field we want to know everything about
  * @return array   Array containing all the information about the extra profile field
  * (first level of array contains field details, then 'options' sub-array contains options details,
  * as returned by the database)
  * @author Julio Montoya
  * @since v1.8.6
  */
 public static function get_extra_field_information_by_name($variable)
 {
     $extraField = new ExtraField('user');
     return $extraField->get_handler_field_info_by_field_variable($variable);
 }
开发者ID:secuencia24,项目名称:chamilo-lms,代码行数:14,代码来源:usermanager.lib.php

示例7: array

$group[] = $form->createElement('radio', 'visibility', null, get_lang('CourseVisibilityClosed'), COURSE_VISIBILITY_CLOSED);
$group[] = $form->createElement('radio', 'visibility', null, get_lang('CourseVisibilityHidden'), COURSE_VISIBILITY_HIDDEN);
$form->addGroup($group, '', get_lang('CourseAccess'), '<br />');
$group = array();
$group[] = $form->createElement('radio', 'subscribe', get_lang('Subscription'), get_lang('Allowed'), 1);
$group[] = $form->createElement('radio', 'subscribe', null, get_lang('Denied'), 0);
$form->addGroup($group, '', get_lang('Subscription'), '<br />');
$group = array();
$group[] = $form->createElement('radio', 'unsubscribe', get_lang('Unsubscription'), get_lang('AllowedToUnsubscribe'), 1);
$group[] = $form->createElement('radio', 'unsubscribe', null, get_lang('NotAllowedToUnsubscribe'), 0);
$form->addGroup($group, '', get_lang('Unsubscription'), '<br />');
$form->addElement('text', 'disk_quota', array(get_lang('CourseQuota'), null, get_lang('MB')));
$form->addRule('disk_quota', get_lang('ThisFieldIsRequired'), 'required');
$form->addRule('disk_quota', get_lang('ThisFieldShouldBeNumeric'), 'numeric');
$specialCourseField = new ExtraField('course');
$specialCourseFieldInfo = $specialCourseField->get_handler_field_info_by_field_variable('special_course');
if (!empty($specialCourseFieldInfo)) {
    $specialCourseValue = new ExtraFieldValue('course');
    $specialCourseValueInfo = $specialCourseValue->get_values_by_handler_and_field_variable($course_code, 'special_course');
    $specialCourseAttributes = array();
    if (!empty($specialCourseValueInfo) && $specialCourseValueInfo['value'] == 1) {
        $specialCourseAttributes['checked'] = '';
    }
    $form->addElement('checkbox', 'extra_special_course', array(null, get_lang('AllUsersAreAutomaticallyRegistered')), get_lang('SpecialCourse'), $specialCourseAttributes);
}
//Extra fields
$extra_field = new ExtraField('course');
$extra = $extra_field->addElements($form, $courseId, ['special_course']);
$htmlHeadXtra[] = '
<script>
$(function() {
开发者ID:secuencia24,项目名称:chamilo-lms,代码行数:31,代码来源:course_edit.php

示例8: ExtraFieldValue

 static function get_horario_value($session_id)
 {
     $extra_field_value = new ExtraFieldValue('session');
     //Getting horario info
     $extra_field = new ExtraField('session');
     $extra_field_info = $extra_field->get_handler_field_info_by_field_variable('horario');
     $horario_info = $extra_field_value->get_values_by_handler_and_field_id($session_id, $extra_field_info['id']);
     $extra_field_option = new ExtraFieldOption('session');
     $horario_info = $extra_field_option->get_field_option_by_field_and_option($extra_field_info['id'], $horario_info['field_value']);
     $time = "08:00";
     if (isset($horario_info) && isset($horario_info[0])) {
         $horario = $horario_info[0]['option_display_text'];
         $horario_array = explode(' ', $horario);
         //Schedule format is "(01) 07:00 09:00" in this case. Adapt to your case
         if (isset($horario_array[1])) {
             $time = $horario_array[1];
         }
     }
     return $time;
 }
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:20,代码来源:migration.custom.class.php

示例9: save_field_values

 /**
  * Saves a series of records given as parameter into the coresponding table
  * @param array  Structured parameter for the insertion into the *_field_values table
  * @return mixed false on empty params, void otherwise
  * @assert (array()) === false
  */
 public function save_field_values($params)
 {
     $extra_field = new ExtraField($this->type);
     if (empty($params[$this->handler_id])) {
         return false;
     }
     // Parse params.
     foreach ($params as $key => $value) {
         if (substr($key, 0, 6) == 'extra_') {
             // An extra field.
             $field_variable = substr($key, 6);
             $extra_field_info = $extra_field->get_handler_field_info_by_field_variable($field_variable);
             if ($extra_field_info) {
                 $commentVariable = 'extra_' . $field_variable . '_comment';
                 $comment = isset($params[$commentVariable]) ? $params[$commentVariable] : null;
                 $new_params = array($this->handler_id => $params[$this->handler_id], 'field_id' => $extra_field_info['id'], 'field_value' => $value, 'comment' => $comment);
                 self::save($new_params);
             }
         }
     }
 }
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:27,代码来源:extra_field_value.lib.php

示例10: getExtraFieldInfo

 /**
  * Get the drupal_user_id extra field information
  * @return array The info
  */
 private function getExtraFieldInfo()
 {
     $extraField = new ExtraField('user');
     $extraFieldHandler = $extraField->get_handler_field_info_by_field_variable(self::EXTRAFIELD_VARIABLE_NAME);
     return $extraFieldHandler;
 }
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:10,代码来源:CreateDrupalUser.php

示例11: function

        Session::write('is_courseMember', $is_courseMember);
        Session::write('is_courseTutor', $is_courseTutor);
        Session::write('is_courseCoach', $is_courseCoach);
        Session::write('is_allowed_in_course', $is_allowed_in_course);
        Session::write('is_sessionAdmin', $is_sessionAdmin);
    }
};
/**
 * Deletes the exam_password user extra field *only* to students
 * @todo move to the login hook system
 * @param Request $request
 */
$afterLogin = function (Request $request) use($app) {
    if (isset($app['current_user']) && isset($app['current_user']['user_id']) && $app['current_user']['status'] == STUDENT) {
        $extraField = new ExtraField('user');
        $extraFieldData = $extraField->get_handler_field_info_by_field_variable('exam_password');
        if ($extraFieldData && !empty($extraFieldData)) {
            $extraField = new ExtraFieldValue('user');
            $extraFieldValue = $extraField->get_values_by_handler_and_field_variable($app['current_user']['user_id'], 'exam_password');
            if (!empty($extraFieldValue)) {
                $extraField->delete_values_by_handler_and_field_id($app['current_user']['user_id'], $extraFieldValue['id']);
            }
        }
    }
};
/** Removes the cid reset and other session values */
$removeCidReset = function (Request $request) use($app) {
    // Deleting course info.
    Session::erase('_cid');
    Session::erase('_real_cid');
    Session::erase('_course');
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:31,代码来源:routes.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

示例13: importCalendarStatic

 /**
  * @param string $file
  * @param bool   $moveFile
  *
  * @return int
  */
 private function importCalendarStatic($file, $moveFile = true)
 {
     $data = Import::csvToArray($file);
     if ($this->getDumpValues()) {
         // Remove all calendar items
         $truncateTables = array(Database::get_course_table(TABLE_AGENDA), Database::get_course_table(TABLE_AGENDA_ATTACHMENT), Database::get_course_table(TABLE_AGENDA_REPEAT), Database::get_course_table(TABLE_AGENDA_REPEAT_NOT), Database::get_main_table(TABLE_PERSONAL_AGENDA), Database::get_main_table(TABLE_PERSONAL_AGENDA_REPEAT_NOT), Database::get_main_table(TABLE_PERSONAL_AGENDA_REPEAT));
         foreach ($truncateTables as $table) {
             $sql = "TRUNCATE {$table}";
             Database::query($sql);
         }
         $table = Database::get_course_table(TABLE_ITEM_PROPERTY);
         $sql = "DELETE FROM {$table} WHERE tool = 'calendar_event'";
         Database::query($sql);
     }
     if (!empty($data)) {
         $this->logger->addInfo(count($data) . " records found.");
         $eventsToCreate = array();
         $errorFound = false;
         foreach ($data as $row) {
             $sessionId = null;
             $externalSessionId = null;
             if (isset($row['external_sessionID'])) {
                 $externalSessionId = $row['external_sessionID'];
                 $sessionId = SessionManager::getSessionIdFromOriginalId($externalSessionId, $this->extraFieldIdNameList['session']);
             }
             $courseCode = null;
             if (isset($row['coursecode'])) {
                 $courseCode = $row['coursecode'];
             }
             $courseInfo = api_get_course_info($courseCode);
             if (empty($courseInfo)) {
                 $this->logger->addInfo("Course '{$courseCode}' does not exists");
             }
             if (empty($sessionId)) {
                 $this->logger->addInfo("external_sessionID: " . $externalSessionId . " does not exists.");
             }
             $teacherId = null;
             if (!empty($sessionId) && !empty($courseInfo)) {
                 $courseIncluded = SessionManager::relation_session_course_exist($sessionId, $courseInfo['real_id']);
                 if ($courseIncluded == false) {
                     $this->logger->addInfo("Course '{$courseCode}' is not included in session: {$sessionId}");
                     $errorFound = true;
                 } else {
                     $teachers = CourseManager::get_coach_list_from_course_code($courseInfo['code'], $sessionId);
                     // Getting first teacher.
                     if (!empty($teachers)) {
                         $teacher = current($teachers);
                         $teacherId = $teacher['user_id'];
                     } else {
                         $sessionInfo = api_get_session_info($sessionId);
                         $teacherId = $sessionInfo['id_coach'];
                     }
                 }
             } else {
                 $errorFound = true;
             }
             if (empty($teacherId)) {
                 $errorFound = true;
                 $this->logger->addInfo("No teacher found in course code : '{$courseCode}' and session: '{$sessionId}'");
             }
             $date = $row['date'];
             $startTime = $row['time_start'];
             $endTime = $row['time_end'];
             $title = $row['title'];
             $startDateYear = substr($date, 0, 4);
             $startDateMonth = substr($date, 4, 2);
             $startDateDay = substr($date, 6, 8);
             $startDate = $startDateYear . '-' . $startDateMonth . '-' . $startDateDay . ' ' . $startTime . ":00";
             $endDate = $startDateYear . '-' . $startDateMonth . '-' . $startDateDay . ' ' . $endTime . ":00";
             if (!api_is_valid_date($startDate) or !api_is_valid_date($endDate)) {
                 $this->logger->addInfo("Verify your dates:  '{$startDate}' : '{$endDate}' ");
                 $errorFound = true;
             }
             if ($errorFound == false) {
                 $eventsToCreate[] = array('start' => $startDate, 'end' => $endDate, 'title' => $title, 'sender_id' => $teacherId, 'course_id' => $courseInfo['real_id'], 'session_id' => $sessionId, $this->extraFieldIdNameList['calendar_event'] => $row['external_calendar_itemID']);
             }
         }
         if (empty($eventsToCreate)) {
             $this->logger->addInfo("No events to add");
             return 0;
         }
         $this->logger->addInfo("Ready to insert events");
         $content = null;
         $agenda = new Agenda();
         $extraFieldValue = new ExtraFieldValue('calendar_event');
         $extraFieldName = $this->extraFieldIdNameList['calendar_event'];
         $externalEventId = null;
         $extraField = new ExtraField('calendar_event');
         $extraFieldInfo = $extraField->get_handler_field_info_by_field_variable($extraFieldName);
         if (empty($extraFieldInfo)) {
             $this->logger->addInfo("No calendar event extra field created: {$extraFieldName}");
             return 0;
         }
         foreach ($eventsToCreate as $event) {
//.........这里部分代码省略.........
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:101,代码来源:import_csv.php

示例14: array

<?php

//Removing extra fields
$extra_fields = array('exam_room', 'exam_schedule', 'exam_password');
foreach ($extra_fields as $extra) {
    $extra_field = new ExtraField('user');
    $field_info = $extra_field->get_handler_field_info_by_field_variable($extra);
    if (isset($field_info['id'])) {
        $extra_field->delete($field_info['id']);
    }
}
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:11,代码来源:uninstall.php


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