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


PHP ExtraFieldValue::saveFieldValues方法代码示例

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


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

示例1: ExtraFieldValue

            $username = $email;
        }
        UserManager::update_user($user_id, $firstname, $lastname, $username, $password, $auth_source, $email, $status, $official_code, $phone, $picture_uri, $expiration_date, $active, null, $hr_dept_id, null, $language, null, $send_mail, $reset_password);
        if (api_get_setting('openid_authentication') == 'true' && !empty($user['openid'])) {
            $up = UserManager::update_openid($user_id, $user['openid']);
        }
        $currentUserId = api_get_user_id();
        if ($user_id != $currentUserId) {
            if ($platform_admin == 1) {
                UserManager::add_user_as_admin($user_id);
            } else {
                UserManager::remove_user_admin($user_id);
            }
        }
        $extraFieldValue = new ExtraFieldValue('user');
        $extraFieldValue->saveFieldValues($user);
        $tok = Security::get_token();
        header('Location: user_list.php?action=show_message&message=' . urlencode(get_lang('UserUpdated')) . '&sec_token=' . $tok);
        exit;
    }
}
$message = null;
if ($error_drh) {
    $err_msg = get_lang('StatusCanNotBeChangedToHumanResourcesManager');
    $message = Display::return_message($err_msg, 'error');
}
$content = null;
$bigImage = Usermanager::getUserPicture(api_get_user_id(), USER_IMAGE_SIZE_BIG);
$normalImage = Usermanager::getUserPicture(api_get_user_id(), USER_IMAGE_SIZE_ORIGINAL);
$content .= '<a class="expand-image" href="' . $bigImage . '" /><img src="' . $normalImage . '"></a>';
// Display form
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:31,代码来源:user_edit.php

示例2: create_course

 /**
  * Creates a course
  * @param   array $params columns in the main.course table
  *
  * @return  mixed  false if the course was not created, array with the course info
  */
 public static function create_course($params, $extraFields = array())
 {
     global $_configuration;
     // Check portal limits
     $access_url_id = 1;
     if (api_get_multiple_access_url()) {
         $access_url_id = api_get_current_access_url_id();
     }
     if (isset($_configuration[$access_url_id]) && is_array($_configuration[$access_url_id])) {
         if (isset($_configuration[$access_url_id]['hosting_limit_courses']) && $_configuration[$access_url_id]['hosting_limit_courses'] > 0) {
             $num = self::count_courses($access_url_id);
             if ($num >= $_configuration[$access_url_id]['hosting_limit_courses']) {
                 api_warn_hosting_contact('hosting_limit_courses');
                 return api_set_failure(get_lang('PortalCoursesLimitReached'));
             }
         }
         if (isset($_configuration[$access_url_id]['hosting_limit_active_courses']) && $_configuration[$access_url_id]['hosting_limit_active_courses'] > 0) {
             $num = self::countActiveCourses($access_url_id);
             if ($num >= $_configuration[$access_url_id]['hosting_limit_active_courses']) {
                 api_warn_hosting_contact('hosting_limit_active_courses');
                 return api_set_failure(get_lang('PortalActiveCoursesLimitReached'));
             }
         }
     }
     if (empty($params['title'])) {
         return false;
     }
     if (empty($params['wanted_code'])) {
         $params['wanted_code'] = $params['title'];
         // Check whether the requested course code has already been occupied.
         $params['wanted_code'] = CourseManager::generate_course_code(api_substr($params['title'], 0, self::MAX_COURSE_LENGTH_CODE));
     }
     // Create the course keys
     $keys = AddCourse::define_course_keys($params['wanted_code']);
     $params['exemplary_content'] = isset($params['exemplary_content']) ? $params['exemplary_content'] : false;
     if (count($keys)) {
         $params['code'] = $keys['currentCourseCode'];
         $params['visual_code'] = $keys['currentCourseId'];
         $params['directory'] = $keys['currentCourseRepository'];
         $course_info = api_get_course_info($params['code']);
         if (empty($course_info)) {
             $course_id = AddCourse::register_course($params);
             $course_info = api_get_course_info_by_id($course_id);
             if (!empty($course_info)) {
                 AddCourse::prepare_course_repository($course_info['directory'], $course_info['code']);
                 AddCourse::fill_db_course($course_id, $course_info['directory'], $course_info['course_language'], $params['exemplary_content']);
                 if (api_get_setting('gradebook.gradebook_enable_grade_model') == 'true') {
                     //Create gradebook_category for the new course and add
                     // a gradebook model for the course
                     if (isset($params['gradebook_model_id']) && !empty($params['gradebook_model_id']) && $params['gradebook_model_id'] != '-1') {
                         GradebookUtils::create_default_course_gradebook($course_info['code'], $params['gradebook_model_id']);
                     }
                 }
                 // If parameter defined, copy the contents from a specific
                 // template course into this new course
                 $template = api_get_setting('course.course_creation_use_template');
                 if (!empty($template)) {
                     // Include the necessary libraries to generate a course copy
                     require_once api_get_path(SYS_CODE_PATH) . 'coursecopy/classes/CourseBuilder.class.php';
                     require_once api_get_path(SYS_CODE_PATH) . 'coursecopy/classes/CourseRestorer.class.php';
                     require_once api_get_path(SYS_CODE_PATH) . 'coursecopy/classes/CourseSelectForm.class.php';
                     // Call the course copy object
                     $originCourse = api_get_course_info_by_id($template);
                     $originCourse['official_code'] = $originCourse['code'];
                     $cb = new CourseBuilder(null, $originCourse);
                     $course = $cb->build(null, $originCourse['code']);
                     $cr = new CourseRestorer($course);
                     $cr->set_file_option();
                     $cr->restore($course_info['id']);
                     //course_info[id] is the course.code value (I know...)
                 }
                 $params['course_code'] = $course_info['code'];
                 $params['item_id'] = $course_info['real_id'];
                 $courseFieldValue = new ExtraFieldValue('course');
                 $courseFieldValue->saveFieldValues($params);
                 return $course_info;
             }
         }
     }
     return false;
 }
开发者ID:feroli1000,项目名称:chamilo-lms,代码行数:87,代码来源:course.lib.php

示例3: isset

 $unsubscribe = isset($course['unsubscribe']) ? $course['unsubscribe'] : '';
 $course['course_code'] = $course_code;
 if (!stristr($department_url, 'http://')) {
     $department_url = 'http://' . $department_url;
 }
 $manager = Database::getManager();
 $courseObj = $manager->getRepository('ChamiloCoreBundle:Course')->find($courseId);
 if ($courseObj) {
     $url = $manager->getRepository('ChamiloCoreBundle:AccessUrl')->find(api_get_current_access_url_id());
     $courseObj->setTitle($title)->setCourseLanguage($course_language)->setCategoryCode($category_code)->setVisualCode($visual_code)->setDepartmentName($department_name)->setDepartmentUrl($department_url)->setDiskQuota(intval($disk_quota))->setVisibility($visibility)->setSubscribe(intval($subscribe))->setUnsubscribe(intval($unsubscribe))->setCurrentUrl($url);
     $manager->persist($courseObj);
     $manager->flush();
 }
 // update the extra fields
 $courseFieldValue = new ExtraFieldValue('course');
 $courseFieldValue->saveFieldValues($course);
 $addTeacherToSessionCourses = isset($course['add_teachers_to_sessions_courses']) && !empty($course['add_teachers_to_sessions_courses']) ? 1 : 0;
 $sessionCoaches = isset($course['session_coaches']) ? $course['session_coaches'] : '';
 // Updating teachers
 if ($addTeacherToSessionCourses) {
     if (!empty($sessionCoaches)) {
         foreach ($sessionCoaches as $sessionId => $teacherInfo) {
             $coachesToSubscribe = $teacherInfo['coaches_by_session'];
             SessionManager::updateCoaches($sessionId, $courseId, $coachesToSubscribe, true);
         }
     }
     CourseManager::updateTeachers($courseId, $teachers, true, true, false);
 } else {
     // Normal behaviour
     CourseManager::updateTeachers($courseId, $teachers, true, false);
     // Updating session coaches
开发者ID:jloguercio,项目名称:chamilo-lms,代码行数:31,代码来源:course_edit.php

示例4: ExtraFieldValue

        UserManager::updatePassword(api_get_user_id(), $password);
    }
    if (api_get_setting('profile', 'officialcode') == 'true' && isset($user_data['official_code'])) {
        $sql .= ", official_code = '" . Database::escape_string($user_data['official_code']) . "'";
    }
    $sql .= " WHERE user_id  = '" . api_get_user_id() . "'";
    Database::query($sql);
    if ($passwordWasChecked == false) {
        Display::addFlash(Display::return_message(get_lang('ProfileReg'), 'normal', false));
    } else {
        if ($validPassword) {
            Display::addFlash(Display::return_message(get_lang('ProfileReg'), 'normal', false));
        }
    }
    $extraField = new ExtraFieldValue('user');
    $extraField->saveFieldValues($user_data);
    $userInfo = api_get_user_info();
    Session::write('_user', $userInfo);
    // re-init the system to take new settings into account
    //$_SESSION['_user']['uidReset'] = true;
    //$_SESSION['noredirection'] = true;
    $url = api_get_self();
    header("Location: " . $url);
    exit;
}
// the header
$actions = null;
if (api_get_setting('social.allow_social_tool') != 'true') {
    if (api_get_setting('profile.extended_profile') == 'true') {
        $actions .= '<div class="actions">';
        if (api_get_setting('social.allow_social_tool') == 'true' && api_get_setting('message.allow_message_tool') == 'true') {
开发者ID:jloguercio,项目名称:chamilo-lms,代码行数:31,代码来源:profile.php

示例5: edit_session

 /**
  * Edit a session
  * @author Carlos Vargas from existing code
  * @param integer   $id Session primary key
  * @param string    $name
  * @param string    $startDate
  * @param string    $endDate
  * @param string    $displayStartDate
  * @param string    $displayEndDate
  * @param string    $coachStartDate
  * @param string    $coachEndDate
  * @param integer   $coachId
  * @param integer   $sessionCategoryId
  * @param int       $visibility
  * @param string    $description
  * @param bool      $showDescription
  * @param int       $duration
  * @param array     $extraFields
  * @param int       $sessionAdminId
  * @param boolean $sendSubscritionNotification Optional.
  *          Whether send a mail notification to users being subscribed
  * @return mixed
  */
 public static function edit_session($id, $name, $startDate, $endDate, $displayStartDate, $displayEndDate, $coachStartDate, $coachEndDate, $coachId, $sessionCategoryId, $visibility, $description = null, $showDescription = 0, $duration = null, $extraFields = array(), $sessionAdminId = 0, $sendSubscritionNotification = false)
 {
     $name = trim(stripslashes($name));
     $coachId = intval($coachId);
     $sessionCategoryId = intval($sessionCategoryId);
     $visibility = intval($visibility);
     $tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
     if (empty($name)) {
         $msg = get_lang('SessionNameIsRequired');
         return $msg;
     } elseif (empty($coachId)) {
         $msg = get_lang('CoachIsRequired');
         return $msg;
     } elseif (!empty($startDate) && !api_is_valid_date($startDate, 'Y-m-d H:i')) {
         $msg = get_lang('InvalidStartDate');
         return $msg;
     } elseif (!empty($endDate) && !api_is_valid_date($endDate, 'Y-m-d H:i')) {
         $msg = get_lang('InvalidEndDate');
         return $msg;
     } elseif (!empty($startDate) && !empty($endDate) && $startDate >= $endDate) {
         $msg = get_lang('StartDateShouldBeBeforeEndDate');
         return $msg;
     } else {
         $sql = "SELECT id FROM {$tbl_session} WHERE name='" . Database::escape_string($name) . "'";
         $rs = Database::query($sql);
         $exists = false;
         while ($row = Database::fetch_array($rs)) {
             if ($row['id'] != $id) {
                 $exists = true;
             }
         }
         if ($exists) {
             $msg = get_lang('SessionNameAlreadyExists');
             return $msg;
         } else {
             $values = ['name' => $name, 'duration' => $duration, 'id_coach' => $coachId, 'description' => $description, 'show_description' => intval($showDescription), 'visibility' => $visibility, 'send_subscription_notification' => $sendSubscritionNotification];
             if (!empty($sessionAdminId)) {
                 $values['session_admin_id'] = $sessionAdminId;
             }
             if (!empty($startDate)) {
                 $values['access_start_date'] = $startDate;
             }
             if (!empty($endDate)) {
                 $values['access_end_date'] = $endDate;
             }
             if (!empty($displayStartDate)) {
                 $values['display_start_date'] = $displayStartDate;
             }
             if (!empty($displayEndDate)) {
                 $values['display_end_date'] = $displayEndDate;
             }
             if (!empty($coachStartDate)) {
                 $values['coach_access_start_date'] = $coachStartDate;
             }
             if (!empty($coachEndDate)) {
                 $values['coach_access_end_date'] = $coachEndDate;
             }
             if (!empty($sessionCategoryId)) {
                 $values['session_category_id'] = $sessionCategoryId;
             }
             Database::update($tbl_session, $values, array('id = ?' => $id), true);
             if (!empty($extraFields)) {
                 $extraFields['item_id'] = $id;
                 $sessionFieldValue = new ExtraFieldValue('session');
                 $sessionFieldValue->saveFieldValues($extraFields);
             }
             return $id;
         }
     }
 }
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:93,代码来源:sessionmanager.lib.php

示例6: ExtraFieldValue

 }
 if (isset($_REQUEST['activate_end_date_check']) && $_REQUEST['activate_end_date_check'] == 1) {
     $expired_on = $_REQUEST['expired_on'];
 } else {
     $expired_on = null;
 }
 $learnPath->setCategoryId($_REQUEST['category_id']);
 $learnPath->set_modified_on();
 $learnPath->set_publicated_on($publicated_on);
 $learnPath->set_expired_on($expired_on);
 if (isset($_REQUEST['remove_picture']) && $_REQUEST['remove_picture']) {
     $learnPath->delete_lp_image();
 }
 $extraFieldValue = new ExtraFieldValue('lp');
 $params = array('lp_id' => $learnPath->id);
 $extraFieldValue->saveFieldValues($_REQUEST);
 if ($_FILES['lp_preview_image']['size'] > 0) {
     $learnPath->upload_image($_FILES['lp_preview_image']);
 }
 if (api_get_setting('search.search_enabled') === 'true') {
     require_once api_get_path(LIBRARY_PATH) . 'specific_fields_manager.lib.php';
     $specific_fields = get_specific_field_list();
     foreach ($specific_fields as $specific_field) {
         $learnPath->set_terms_by_prefix($_REQUEST[$specific_field['code']], $specific_field['code']);
         $new_values = explode(',', trim($_REQUEST[$specific_field['code']]));
         if (!empty($new_values)) {
             array_walk($new_values, 'trim');
             delete_all_specific_field_value(api_get_course_id(), $specific_field['id'], TOOL_LEARNPATH, $learnPath->lp_id);
             foreach ($new_values as $value) {
                 if (!empty($value)) {
                     add_specific_field_value($specific_field['id'], api_get_course_id(), TOOL_LEARNPATH, $learnPath->lp_id, $value);
开发者ID:jloguercio,项目名称:chamilo-lms,代码行数:31,代码来源:lp_controller.php


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