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


PHP ExtraFieldValue::save_field_values方法代码示例

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


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

示例1: editQuestionAction

 /**
  * Edits a question for the question manager
  *
  * @param Application $app
  * @param int $id
  * @return Response
  */
 public function editQuestionAction(Application $app, $id)
 {
     $extraJS = array();
     //@todo improve this JS includes should be added using twig
     $extraJS[] = '<link href="' . api_get_path(WEB_LIBRARY_PATH) . 'javascript/tag/style.css" rel="stylesheet" type="text/css" />';
     $extraJS[] = '<script src="' . api_get_path(WEB_LIBRARY_PATH) . 'javascript/tag/jquery.fcbkcomplete.js" type="text/javascript" language="javascript"></script>';
     $app['extraJS'] = $extraJS;
     // Setting exercise obj.
     $exercise = new \Exercise();
     $exercise->edit_exercise_in_lp = true;
     // Setting question obj.
     /** @var  \Question $question */
     $question = \Question::read($id, null, $exercise);
     $question->submitClass = "btn save";
     $question->submitText = get_lang('ModifyQuestion');
     $question->setDefaultValues = true;
     // Generating edit URL.
     $url = $app['url_generator']->generate('admin_questions_edit', array('id' => $id));
     // Creating a new form
     $form = new \FormValidator('edit_question', 'post', $url);
     $extraFields = new \ExtraField('question');
     $extraFields->addElements($form, $id);
     // Validating if there are extra fields to modify.
     if (count($form->_elements) > 1) {
         $form->addElement('button', 'submit', get_lang('Update'));
         $app['template']->assign('question', $question);
         $app['template']->assign('form', $form->toHtml());
     } else {
         $app['template']->assign('message', \Display::return_message(get_lang('ThereAreNotExtrafieldsAvailable'), 'warning'));
     }
     // If form was submitted.
     if ($form->validate()) {
         $field_value = new \ExtraFieldValue('question');
         $params = $form->exportValues();
         $params['question_id'] = $id;
         $field_value->save_field_values($params);
         $app['template']->assign('message', \Display::return_message(get_lang('ItemUpdated'), 'success'));
         $url = $app['url_generator']->generate('admin_questions_edit', array('id' => $id));
         return $app->redirect($url);
     }
     $response = $app['template']->render_template('admin/questionmanager/edit_question.tpl');
     return new Response($response, 200, array());
 }
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:50,代码来源:QuestionManagerController.php

示例2: editQuestionAction

 /**
  * Edits a question for the question manager
  *
  * @Route("/edit")
  * @Method({"GET"})
  * @param int $id
  * @return Response
  */
 public function editQuestionAction($id)
 {
     // Setting exercise obj.
     $exercise = new \Exercise();
     $exercise->edit_exercise_in_lp = true;
     // Setting question obj.
     /** @var  \Question $question */
     $question = \Question::read($id, null, $exercise);
     $question->submitClass = "btn save";
     $question->submitText = get_lang('ModifyQuestion');
     $question->setDefaultValues = true;
     // Generating edit URL.
     $url = $this->generateControllerUrl('editQuestionAction', array('id' => $id));
     // Creating a new form
     $form = new \FormValidator('edit_question', 'post', $url);
     $extraFields = new \ExtraField('question');
     $extraFields->addElements($form, $id);
     // Validating if there are extra fields to modify.
     if (count($form->_elements) > 1) {
         $form->addElement('button', 'submit', get_lang('Update'));
         $this->getTemplate()->assign('question', $question);
         $this->getTemplate()->assign('form', $form->toHtml());
     } else {
         $this->addFlash('warning', get_lang('ThereAreNotExtrafieldsAvailable'));
     }
     // If form was submitted.
     if ($form->validate()) {
         $field_value = new \ExtraFieldValue('question');
         $params = $form->exportValues();
         $params['question_id'] = $id;
         $field_value->save_field_values($params);
         $this->addFlash('success', get_lang('ItemUpdated'));
         $url = $this->generateControllerUrl('editQuestionAction', array('id' => $id));
         return $this->redirect($url);
     }
     $response = $this->renderTemplate('edit_question.tpl');
     return new Response($response, 200, array());
 }
开发者ID:ragebat,项目名称:chamilo-lms,代码行数:46,代码来源:QuestionManagerController.php

示例3: processCreation

 /**
  * function which process the creation of questions
  * @param FormValidator $form the formvalidator instance
  * @param Exercise $objExercise the Exercise instance
  */
 public function processCreation($form, $objExercise = null)
 {
     $this->updateParentId($form->getSubmitValue('parent_id'));
     $this->updateTitle($form->getSubmitValue('questionName'));
     $this->updateDescription($form->getSubmitValue('questionDescription'));
     $this->updateLevel($form->getSubmitValue('questionLevel'));
     $this->updateCategory($form->getSubmitValue('questionCategory'));
     // Save normal question if NOT media
     if ($this->type != MEDIA_QUESTION) {
         $this->save($objExercise->id);
         $field_value = new ExtraFieldValue('question');
         $params = $form->getSubmitValues();
         $params['question_id'] = $this->id;
         $field_value->save_field_values($params);
         if ($objExercise) {
             // modify the exercise
             $objExercise->addToList($this->id);
             $objExercise->update_question_positions();
         }
     }
 }
开发者ID:ragebat,项目名称:chamilo-lms,代码行数:26,代码来源:question.class.php

示例4: ExtraFieldValue

            	$expired_on   = null;
            }

            $_SESSION['oLP']->set_modified_on();
            $_SESSION['oLP']->set_publicated_on($publicated_on);
            $_SESSION['oLP']->set_expired_on($expired_on);

            if (isset($_REQUEST['remove_picture']) && $_REQUEST['remove_picture']) {
                $_SESSION['oLP']->delete_lp_image();
            }

            $extraFieldValue = new ExtraFieldValue('lp');
            $params = array(
                'lp_id' => $_SESSION['oLP']->id
            );
            $extraFieldValue->save_field_values($_REQUEST);

            if ($_FILES['lp_preview_image']['size'] > 0)
                $_SESSION['oLP']->upload_image($_FILES['lp_preview_image']);

            if (api_get_setting('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) {
                    $_SESSION['oLP']->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'],
开发者ID:annickvdp,项目名称:Chamilo1.9.10,代码行数:31,代码来源:lp_controller.php

示例5: update

 /**
  * Updates a course with the given array of attributes
  * @param array Array of attributes
  * @return array Array of course attributes
  * @assert () === false
  */
 public static function update($params)
 {
     if (!is_array($params) or count($params) < 1) {
         return false;
     }
     $course_user_table = Database::get_main_table(TABLE_MAIN_COURSE_USER);
     $course_table = Database::get_main_table(TABLE_MAIN_COURSE);
     $course_code = $params['code'];
     $courseInfo = api_get_course_info($course_code);
     $visual_code = $params['visual_code'];
     $field_value = new ExtraFieldValue('course');
     $params['course_code'] = $course_code;
     $field_value->save_field_values($params);
     /*$tutor_id = $params['tutor_name'];
       $tutor_name=$platform_teachers[$tutor_id];*/
     $teachers = $params['group']['course_teachers'];
     $title = $params['title'];
     $category_code = $params['category_code'];
     $department_name = $params['department_name'];
     $department_url = $params['department_url'];
     $course_language = $params['course_language'];
     $course['disk_quota'] = $params['disk_quota'] * 1024 * 1024;
     $disk_quota = $params['disk_quota'];
     $visibility = $params['visibility'];
     $subscribe = $params['subscribe'];
     $unsubscribe = $params['unsubscribe'];
     if (!stristr($department_url, 'http://')) {
         $department_url = 'http://' . $department_url;
     }
     //tutor_name='".Database::escape_string($tutor_name)."',
     $sql = "UPDATE {$course_table} SET\n                    course_language='" . Database::escape_string($course_language) . "',\n                    title='" . Database::escape_string($title) . "',\n                    category_code='" . Database::escape_string($category_code) . "',\n                    visual_code='" . Database::escape_string($visual_code) . "',\n                    department_name='" . Database::escape_string($department_name) . "',\n                    department_url='" . Database::escape_string($department_url) . "',\n                    disk_quota='" . Database::escape_string($disk_quota) . "',\n                    visibility = '" . Database::escape_string($visibility) . "',\n                    subscribe = '" . Database::escape_string($subscribe) . "',\n                    unsubscribe='" . Database::escape_string($unsubscribe) . "'\n                WHERE code='" . Database::escape_string($course_code) . "'";
     Database::query($sql);
     //Delete only teacher relations that doesn't match the selected teachers
     $cond = '';
     if (count($teachers) > 0) {
         foreach ($teachers as $key) {
             $cond .= " AND user_id<>'" . $key . "'";
         }
     }
     $sql = 'DELETE FROM ' . $course_user_table . ' WHERE c_id = "' . Database::escape_string($courseInfo['real_id']) . '" AND status="1"' . $cond;
     Database::query($sql);
     if (count($teachers) > 0) {
         foreach ($teachers as $key) {
             //We check if the teacher is already subscribed in this course
             $sql_select_teacher = 'SELECT 1 FROM ' . $course_user_table . ' WHERE user_id = "' . $key . '" AND c_id = "' . $courseInfo['real_id'] . '" ';
             $result = Database::query($sql_select_teacher);
             if (Database::num_rows($result) == 1) {
                 $sql = 'UPDATE ' . $course_user_table . ' SET status = "1" WHERE c_id = "' . $courseInfo['real_id'] . '" AND user_id = "' . $key . '"  ';
             } else {
                 $sql = "INSERT INTO " . $course_user_table . " SET\n                        c_id = '" . Database::escape_string($courseInfo['real_id']) . "',\n                        user_id = '" . $key . "',\n                        status = '1',\n                        role = '',\n                        tutor_id = '0',\n                        sort = '0',\n                        user_course_cat = '0'";
             }
             Database::query($sql);
         }
     }
     //user_id = '".$tutor_id . "',
     $sql = "INSERT IGNORE INTO " . $course_user_table . " SET\n                    course_code = '" . Database::escape_string($course_code) . "',\n                    status = '1',\n                    role = '',\n                    tutor_id='0',\n                    sort='0',\n                    user_course_cat='0'";
     Database::query($sql);
     $course_info = api_get_course_info($course_code);
     return $course_info;
 }
开发者ID:ragebat,项目名称:chamilo-lms,代码行数:66,代码来源:course.lib.php

示例6: intval

        if ($user['radio_expiration_date'] == '1') {
            $expiration_date = Text::return_datetime_from_array($user['expiration_date']);
        } else {
            $expiration_date = null;
        }
        $active = intval($user['active']);
        if (api_get_setting('login_is_email') == 'true') {
            $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']);
        }
        // Using the extra field value obj
        $extraFieldValues = new ExtraFieldValue('user');
        $extraFieldValues->save_field_values($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');
}
// USER PICTURE
$image_path = UserManager::get_user_picture_path_by_id($user_id, 'web');
$image_dir = $image_path['dir'];
$image = $image_path['file'];
$image_file = $image != '' ? $image_dir . $image : api_get_path(WEB_CODE_PATH) . 'img/unknown.jpg';
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:31,代码来源:user_edit.php

示例7: update

 /**
  * Simple update user need to add validations here
  * @param type $params
  * @return boolean
  */
 public static function update($params)
 {
     $table = Database::get_main_table(TABLE_MAIN_USER);
     if (empty($params['user_id'])) {
         return false;
     }
     //saving extra fields
     $field_value = new ExtraFieldValue('user');
     $params['user_id'] = $params['user_id'];
     $field_value->save_field_values($params);
     $clean_params = self::clean_params($params);
     return Database::update($table, $clean_params, array('user_id = ?' => $params['user_id']));
 }
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:18,代码来源:usermanager.lib.php


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