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


PHP ExtraField类代码示例

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


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

示例4: 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

示例5: getQuestions

 /**
  * Get all questions
  * @param Application $app
  * @param int $categoryId
  * @param int $exerciseId
  * @param int $courseId
  * @param array $options
  * @param bool $get_count
  * @return array
  */
 public static function getQuestions($app, $categoryId, $exerciseId, $courseId, $options, $get_count = false)
 {
     $questionTable = Database::get_course_table(TABLE_QUIZ_QUESTION);
     $questionPoolFields = array('question_session_id' => array('innerjoin' => " INNER JOIN " . Database::get_course_table(TABLE_QUIZ_TEST_QUESTION) . " as quiz_rel_question_session ON (quiz_rel_question_session.question_id = s.iid)\n                                 INNER JOIN " . Database::get_course_table(TABLE_QUIZ_TEST) . " as quizsession ON (quizsession.iid = quiz_rel_question_session.exercice_id)\n                                 INNER JOIN " . Database::get_main_table(TABLE_MAIN_SESSION) . " session ON (session.id = quizsession.session_id)", 'where' => 'session_id', 'inject_fields' => 'session.name as question_session_id, '), 'question_category_id' => array('innerjoin' => " INNER JOIN " . Database::get_course_table(TABLE_QUIZ_QUESTION_REL_CATEGORY) . " as quiz_rel_cat ON (quiz_rel_cat.question_id = s.iid)\n                                 INNER JOIN " . Database::get_course_table(TABLE_QUIZ_CATEGORY) . " as cat ON (cat.iid = quiz_rel_cat.category_id)", 'where' => 'quiz_rel_cat.category_id', 'inject_fields' => 'cat.title as question_category_id, '), 'question_exercise_id' => array('innerjoin' => " INNER JOIN " . Database::get_course_table(TABLE_QUIZ_TEST_QUESTION) . " as quiz_rel_question ON (quiz_rel_question.question_id = s.iid)\n                                 INNER JOIN " . Database::get_course_table(TABLE_QUIZ_TEST) . " as quizexercise ON (quizexercise.iid = quiz_rel_question.exercice_id) ", 'where' => 'quiz_rel_question.exercice_id', 'inject_fields' => 'quizexercise.title as question_exercise_id, '), 'question_c_id' => array('where' => 's.c_id', 'innerjoin' => " INNER JOIN " . Database::get_main_table(TABLE_MAIN_COURSE) . " as course ON (course.id = s.c_id) ", 'inject_fields' => 'course.title as question_c_id, '), 'question_question_type' => array('where' => 's.type ', 'inject_fields' => 's.type as question_question_type,'), 'question_difficulty' => array('where' => 's.level', 'inject_fields' => 's.level as question_difficulty, '));
     // Checking if you're looking for orphan questions.
     $isOrphanQuestion = false;
     if (isset($options['question'])) {
         foreach ($options['question'] as $option) {
             if (isset($option['field']) && $option['field'] == 'question_exercise_id') {
                 if ($option['data'] == 0) {
                     $isOrphanQuestion = true;
                     break;
                 }
             }
         }
     }
     // Special case for orphan questions.
     if ($isOrphanQuestion) {
         $questionPoolFields['question_exercise_id'] = array('innerjoin' => " LEFT JOIN " . Database::get_course_table(TABLE_QUIZ_TEST_QUESTION) . " as quiz_rel_question ON (quiz_rel_question.question_id = s.iid)\n                                 LEFT JOIN " . Database::get_course_table(TABLE_QUIZ_TEST) . " as quizexercise ON (quizexercise.iid = quiz_rel_question.exercice_id) ", 'where' => 'quiz_rel_question.exercice_id', 'inject_fields' => 'quizexercise.title as question_exercise_id, ');
     }
     $inject_extra_fields = null;
     $inject_joins = null;
     $where = $options['where'];
     $newQuestionPoolField = array();
     if (isset($options['question'])) {
         foreach ($options['question'] as $question) {
             if (isset($questionPoolFields[$question['field']])) {
                 $newQuestionPoolField[$question['field']] = $questionPoolFields[$question['field']];
             }
         }
     }
     $inject_question_fields = null;
     $questionPoolFields = $newQuestionPoolField;
     // Injecting inner joins.
     foreach ($questionPoolFields as $field => $option) {
         $where = str_replace($field, $option['where'], $where);
         if (isset($option['innerjoin']) && !empty($option['innerjoin'])) {
             $inject_joins .= $option['innerjoin'];
         }
         if (isset($option['inject_fields']) && !empty($option['inject_fields'])) {
             $inject_question_fields .= $option['inject_fields'];
         }
     }
     $options['where'] = $where;
     $extra_field = new ExtraField('question');
     $conditions = $extra_field->parseConditions($options);
     $inject_joins .= $conditions['inject_joins'];
     $where = $conditions['where'];
     $inject_where = $conditions['inject_where'];
     $inject_extra_fields = $conditions['inject_extra_fields'];
     $order = $conditions['order'];
     $limit = $conditions['limit'];
     if ($get_count == true) {
         $select = " SELECT count(*) as total_rows";
     } else {
         $select = " SELECT s.*, {$inject_extra_fields} {$inject_question_fields} 1 ";
     }
     $extraCondition = null;
     // Used by the question manager
     if (!empty($categoryId)) {
         $categoryRelQuestionTable = Database::get_course_table(TABLE_QUIZ_QUESTION_REL_CATEGORY);
         $extraCondition = " INNER JOIN {$categoryRelQuestionTable} c ON (s.iid = c.question_id)";
         $categoryId = intval($categoryId);
         $where .= " AND category_id = {$categoryId} ";
     }
     /*if (!empty($exerciseId)) {
           $exerciseRelQuestionTable = Database::get_course_table(TABLE_QUIZ_TEST_QUESTION);
           $extraCondition .= " INNER JOIN $exerciseRelQuestionTable e ON (s.iid = e.question_id)";
           $exerciseId = intval($exerciseId);
           $where .= " AND exercice_id = $exerciseId ";
       }*/
     // Orphan questions
     if ($isOrphanQuestion) {
         //$exerciseRelQuestionTable = Database::get_course_table(TABLE_QUIZ_TEST_QUESTION);
         //$extraCondition .= " INNER JOIN $exerciseRelQuestionTable e ON (s.iid = e.question_id)";
         $where .= " OR quizexercise.active = -1 OR quiz_rel_question.exercice_id IS NULL";
     }
     if (!empty($courseId)) {
         $courseId = intval($courseId);
         $where .= " AND s.c_id = {$courseId} ";
     }
     if (isset($options['question'])) {
         $courseList = CourseManager::get_course_list_of_user_as_course_admin(api_get_user_id());
         foreach ($options['question'] as $questionOption) {
             if ($questionOption['field'] == 'question_c_id') {
                 if (isset($questionOption['data'])) {
                     if (!isset($courseList[$questionOption['data']])) {
                         return array();
                     }
                 }
//.........这里部分代码省略.........
开发者ID:ragebat,项目名称:chamilo-lms,代码行数:101,代码来源:question.class.php

示例6: switch

    if (isset($_POST['action'])) {
        switch ($_POST['action']) {
            case 'unsubscribe':
                // Make sure we don't unsubscribe current user from the course
                if (is_array($_POST['user'])) {
                    $user_ids = array_diff($_POST['user'], array($user_id));
                    if (count($user_ids) > 0) {
                        CourseManager::unsubscribe_user($user_ids, $courseCode);
                        Display::addFlash(Display::return_message(get_lang('UsersUnsubscribed')));
                    }
                }
        }
    }
}
// Getting extra fields that have the filter option "on"
$extraField = new ExtraField('user');
$extraFields = $extraField->get_all(array('filter = ?' => 1));
$user_image_pdf_size = 80;
if (api_is_allowed_to_edit(null, true)) {
    if (isset($_GET['action'])) {
        switch ($_GET['action']) {
            case 'set_tutor':
                $userId = isset($_GET['user_id']) ? intval($_GET['user_id']) : null;
                $isTutor = isset($_GET['is_tutor']) ? intval($_GET['is_tutor']) : 0;
                if (!empty($userId)) {
                    if ($sessionId) {
                        /*$res = SessionManager::set_coach_to_course_session(
                              $userId,
                              $sessionId,
                              $courseCode,
                              true
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:31,代码来源:user.php

示例7: isset

require_once '../inc/global.inc.php';
$extraFieldType = isset($_REQUEST['type']) ? $_REQUEST['type'] : null;
$this_section = SECTION_PLATFORM_ADMIN;
api_protect_admin_script();
//Add the JS needed to use the jqgrid
$htmlHeadXtra[] = api_get_jqgrid_js();
// setting breadcrumbs
$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
$tool_name = null;
$action = isset($_GET['action']) ? $_GET['action'] : null;
if (!in_array($extraFieldType, ExtraField::getValidExtraFieldTypes())) {
    api_not_allowed();
}
$check = Security::check_token('request');
$token = Security::get_token();
$obj = new ExtraField($extraFieldType);
$obj->setupBreadcrumb($interbreadcrumb, $action);
//jqgrid will use this URL to do the selects
$url = api_get_path(WEB_AJAX_PATH) . 'model.ajax.php?a=get_extra_fields&type=' . $extraFieldType;
//The order is important you need to check the the $column variable in the model.ajax.php file
$columns = $obj->getJqgridColumnNames();
//Column config
$column_model = $obj->getJqgridColumnModel();
//Autowidth
$extra_params['autowidth'] = 'true';
//height auto
$extra_params['height'] = 'auto';
$extra_params['sortname'] = 'field_order';
$action_links = $obj->getJqgridActionLinks($token);
$htmlHeadXtra[] = '<script>
$(function() {
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:31,代码来源:extra_fields.php

示例8: isset

     $whereCondition .= ' AND ' . $whereConditionInForm;
 }
 $filters = isset($_REQUEST['filters']) && !is_array($_REQUEST['filters']) ? json_decode($_REQUEST['filters']) : false;
 if (!empty($filters)) {
     if (in_array($action, ['get_questions', 'get_sessions'])) {
         switch ($action) {
             case 'get_questions':
                 $type = 'question';
                 break;
             case 'get_sessions':
                 $type = 'session';
                 break;
         }
         if (!empty($type)) {
             // Extra field.
             $extraField = new ExtraField($type);
             $result = $extraField->getExtraFieldRules($filters, 'extra_');
             $extra_fields = $result['extra_fields'];
             $condition_array = $result['condition_array'];
             $extraCondition = '';
             if (!empty($condition_array)) {
                 $extraCondition = ' AND ( ';
                 $extraCondition .= implode($filters->groupOp, $condition_array);
                 $extraCondition .= ' ) ';
             }
             $whereCondition .= $extraCondition;
             // Question field
             $resultQuestion = $extraField->getExtraFieldRules($filters, 'question_');
             $questionFields = $resultQuestion['extra_fields'];
             $condition_array = $resultQuestion['condition_array'];
             if (!empty($condition_array)) {
开发者ID:jloguercio,项目名称:chamilo-lms,代码行数:31,代码来源:model.ajax.php

示例9: get_sessions_admin_complete

 /**
  * Gets the admin session list callback of the session/session_list.php
  * page with all user/details in the right fomat
  * @param array
  * @result array Array of rows results
  * @asset ('a') === false
  */
 public static function get_sessions_admin_complete($options = array())
 {
     if (!is_array($options)) {
         return false;
     }
     $tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
     $tbl_session_category = Database::get_main_table(TABLE_MAIN_SESSION_CATEGORY);
     $tbl_user = Database::get_main_table(TABLE_MAIN_USER);
     $tbl_session_rel_course = Database::get_main_table(TABLE_MAIN_SESSION_COURSE);
     $tbl_course = Database::get_main_table(TABLE_MAIN_COURSE);
     $tbl_session_field_values = Database::get_main_table(TABLE_MAIN_SESSION_FIELD_VALUES);
     $tbl_session_field_options = Database::get_main_table(TABLE_MAIN_SESSION_FIELD_OPTIONS);
     $where = 'WHERE 1 = 1 ';
     $user_id = api_get_user_id();
     if (!api_is_platform_admin()) {
         if (api_is_session_admin() && api_get_setting('allow_session_admins_to_manage_all_sessions') == 'false') {
             $where .= " AND s.session_admin_id = {$user_id} ";
         }
     }
     $coach_name = " CONCAT(u.lastname , ' ', u.firstname) as coach_name ";
     if (api_is_western_name_order()) {
         $coach_name = " CONCAT(u.firstname, ' ', u.lastname) as coach_name ";
     }
     $today = api_get_utc_datetime();
     $inject_extra_fields = null;
     $extra_fields = array();
     $extra_fields_info = array();
     //for now only sessions
     $extra_field = new ExtraField('session');
     $double_fields = array();
     $extra_field_option = new ExtraFieldOption('session');
     if (isset($options['extra'])) {
         $extra_fields = $options['extra'];
         if (!empty($extra_fields)) {
             foreach ($extra_fields as $extra) {
                 $inject_extra_fields .= " IF (fv.field_id = {$extra['id']}, fvo.option_display_text, NULL ) as {$extra['field']} , ";
                 if (isset($extra_fields_info[$extra['id']])) {
                     $info = $extra_fields_info[$extra['id']];
                 } else {
                     $info = $extra_field->get($extra['id']);
                     $extra_fields_info[$extra['id']] = $info;
                 }
                 if ($info['field_type'] == ExtraField::FIELD_TYPE_DOUBLE_SELECT) {
                     $double_fields[$info['id']] = $info;
                 }
             }
         }
     }
     $options_by_double = array();
     foreach ($double_fields as $double) {
         $my_options = $extra_field_option->get_field_options_by_field($double['id'], true);
         $options_by_double['extra_' . $double['field_variable']] = $my_options;
     }
     //sc.name as category_name,
     $select = "\n                SELECT * FROM (\n                    SELECT DISTINCT\n                         IF (\n                            (s.access_start_date <= '{$today}' AND '{$today}' < s.access_end_date) OR\n                            (s.access_start_date  = '0000-00-00 00:00:00' AND s.access_end_date  = '0000-00-00 00:00:00' ) OR\n                            (s.access_start_date  IS NULL AND s.access_end_date IS NULL) OR\n                            (s.access_start_date <= '{$today}' AND ('0000-00-00 00:00:00' = s.access_end_date OR s.access_end_date IS NULL )) OR\n                            ('{$today}' < s.access_end_date AND ('0000-00-00 00:00:00' = s.access_start_date OR s.access_start_date IS NULL) )\n                        , 1, 0) as session_active,\n                s.name,\n                s.nbr_courses,\n                s.nbr_users,\n                s.display_start_date,\n                s.display_end_date,\n                {$coach_name},\n                access_start_date,\n                access_end_date,\n                s.visibility,\n                u.user_id,\n                {$inject_extra_fields}\n                c.title as course_title,\n                s.id ";
     if (!empty($options['where'])) {
         if (!empty($options['extra'])) {
             $options['where'] = str_replace(' 1 = 1  AND', '', $options['where']);
             $options['where'] = str_replace('AND', 'OR', $options['where']);
             foreach ($options['extra'] as $extra) {
                 $options['where'] = str_replace($extra['field'], 'fv.field_id = ' . $extra['id'] . ' AND fvo.option_value', $options['where']);
             }
         }
         $options['where'] = str_replace('course_title', 'c.title', $options['where']);
         $where .= ' AND ' . $options['where'];
     }
     if (!empty($options['limit'])) {
         $where .= " LIMIT " . $options['limit'];
     }
     $query = "{$select} FROM {$tbl_session} s\n                    LEFT JOIN {$tbl_session_field_values} fv ON (fv.session_id = s.id)\n                    LEFT JOIN {$tbl_session_field_options} fvo ON (fv.field_id = fvo.field_id)\n                    LEFT JOIN {$tbl_session_rel_course} src ON (src.id_session = s.id)\n                    LEFT JOIN {$tbl_course} c ON (src.c_id = c.id)\n                    LEFT JOIN {$tbl_session_category} sc ON (s.session_category_id = sc.id)\n                    INNER JOIN {$tbl_user} u ON (s.id_coach = u.user_id) " . $where;
     if (api_is_multiple_url_enabled()) {
         $table_access_url_rel_session = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
         $access_url_id = api_get_current_access_url_id();
         if ($access_url_id != -1) {
             $where .= " AND ar.access_url_id = {$access_url_id} ";
             $query = "{$select}\n                    FROM {$tbl_session} s\n                    LEFT JOIN {$tbl_session_field_values} fv ON (fv.session_id = s.id)\n                    LEFT JOIN {$tbl_session_field_options} fvo ON (fv.field_id = fvo.field_id)\n                    LEFT JOIN {$tbl_session_rel_course} src ON (src.id_session = s.id)\n                    LEFT JOIN {$tbl_course} c ON (src.c_id = c.id)\n                    LEFT JOIN {$tbl_session_category} sc ON (s.session_category_id = sc.id)\n                    INNER JOIN {$tbl_user} u ON (s.id_coach = u.user_id)\n                    INNER JOIN {$table_access_url_rel_session} ar ON (ar.session_id = s.id)\n                    {$where}";
         }
     }
     $query .= ") AS session_table";
     if (!empty($options['order'])) {
         $query .= " ORDER BY " . $options['order'];
     }
     //error_log($query);
     //echo $query;
     $result = Database::query($query);
     $formatted_sessions = array();
     if (Database::num_rows($result)) {
         $sessions = Database::store_result($result, 'ASSOC');
         foreach ($sessions as $session) {
             $session_id = $session['id'];
             $session['name'] = Display::url($session['name'], "resume_session.php?id_session=" . $session['id']);
             $session['coach_name'] = Display::url($session['coach_name'], "user_information.php?user_id=" . $session['user_id']);
             if ($session['session_active'] == 1) {
//.........这里部分代码省略.........
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:101,代码来源:sessionmanager.lib.php

示例10: get_all_info_to_certificate

 /**
  * Return all content to replace and all content to be replace
  * @param int $user_id
  * @param int $course_id
  * @param bool $is_preview
  * @return array
  */
 static function get_all_info_to_certificate($user_id, $course_id, $is_preview = false)
 {
     $info_list = array();
     $user_id = intval($user_id);
     $course_info = api_get_course_info($course_id);
     //info portal
     $organization_name = api_get_setting('platform.institution');
     $portal_name = api_get_setting('platform.site_name');
     // Extra user data information
     $extra_user_info_data = UserManager::get_extra_user_data($user_id, false, false, false, true);
     // get extra fields
     $extraField = new ExtraField('user');
     $extraFields = $extraField->get_all(['filter = ? AND visible = ?' => [1, 1]]);
     //Student information
     $user_info = api_get_user_info($user_id);
     $first_name = $user_info['firstname'];
     $last_name = $user_info['lastname'];
     $official_code = $user_info['official_code'];
     //Teacher information
     $info_teacher_id = UserManager::get_user_id_of_course_admin_or_session_admin($course_info);
     $teacher_info = api_get_user_info($info_teacher_id);
     $teacher_first_name = $teacher_info['firstname'];
     $teacher_last_name = $teacher_info['lastname'];
     // info gradebook certificate
     $info_grade_certificate = UserManager::get_info_gradebook_certificate($course_id, $user_id);
     $date_certificate = $info_grade_certificate['created_at'];
     $date_long_certificate = '';
     $date_no_time = api_convert_and_format_date(api_get_utc_datetime(), DATE_FORMAT_LONG_NO_DAY);
     if (!empty($date_certificate)) {
         $date_long_certificate = api_convert_and_format_date($date_certificate);
         $date_no_time = api_convert_and_format_date($date_certificate, DATE_FORMAT_LONG_NO_DAY);
     }
     if ($is_preview) {
         $date_long_certificate = api_convert_and_format_date(api_get_utc_datetime());
         $date_no_time = api_convert_and_format_date(api_get_utc_datetime(), DATE_FORMAT_LONG_NO_DAY);
     }
     $url = api_get_path(WEB_PATH) . 'certificates/index.php?id=' . $info_grade_certificate['id'];
     //replace content
     $info_to_replace_in_content_html = array($first_name, $last_name, $organization_name, $portal_name, $teacher_first_name, $teacher_last_name, $official_code, $date_long_certificate, $date_no_time, $course_id, $course_info['name'], $info_grade_certificate['grade'], $url, '<a href="' . $url . '" target="_blank">' . get_lang('CertificateOnlineLink') . '</a>', '((certificate_barcode))');
     $info_to_be_replaced_in_content_html = array('((user_firstname))', '((user_lastname))', '((gradebook_institution))', '((gradebook_sitename))', '((teacher_firstname))', '((teacher_lastname))', '((official_code))', '((date_certificate))', '((date_certificate_no_time))', '((course_code))', '((course_title))', '((gradebook_grade))', '((certificate_link))', '((certificate_link_html))', '((certificate_barcode))');
     if (!empty($extraFields)) {
         foreach ($extraFields as $extraField) {
             $valueExtra = isset($extra_user_info_data[$extraField['variable']]) ? $extra_user_info_data[$extraField['variable']] : '';
             $info_to_be_replaced_in_content_html[] = '((' . strtolower($extraField['variable']) . '))';
             $info_to_replace_in_content_html[] = $valueExtra;
         }
     }
     $info_list[] = $info_to_be_replaced_in_content_html;
     $info_list[] = $info_to_replace_in_content_html;
     return $info_list;
 }
开发者ID:daffef,项目名称:chamilo-lms,代码行数:58,代码来源:document.lib.php

示例11: isset

$sessionId = isset($_REQUEST['s']) ? intval($_REQUEST['s']) : null;
// Init template
$tpl = new Template($plugin->get_lang('plugin_title'));
// Get all sessions
$sessionList = $plugin->listAllSessions();
if (!empty($sessionId)) {
    // Get student list in queue
    $studentList = $plugin->listAllStudentsInQueueBySession($sessionId);
    // Set selected to current session
    $sessionList[$sessionId]['selected'] = 'selected="selected"';
    $studentList['session']['id'] = $sessionId;
    // Assign variables
    $fieldsArray = array('description', 'target', 'mode', 'publication_end_date', 'recommended_number_of_participants', 'vacancies');
    $sessionArray = api_get_session_info($sessionId);
    $extraSession = new ExtraFieldValue('session');
    $extraField = new ExtraField('session');
    // Get session fields
    $fieldList = $extraField->get_all(array('variable IN ( ?, ?, ?, ?, ?, ?)' => $fieldsArray));
    // Index session fields
    foreach ($fieldList as $field) {
        $fields[$field['id']] = $field['variable'];
    }
    $params = array(' item_id = ? ' => $sessionId);
    $sessionFieldValueList = $extraSession->get_all(array('where' => $params));
    foreach ($sessionFieldValueList as $sessionFieldValue) {
        // Check if session field value is set in session field list
        if (isset($fields[$sessionFieldValue['field_id']])) {
            $var = $fields[$sessionFieldValue['field_id']];
            $val = $sessionFieldValue['value'];
            // Assign session field value to session
            $sessionArray[$var] = $val;
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:31,代码来源:admin_view.php

示例12: intval

        }
        if (!empty($_GET['class'])) {
            $result = Database::query("DELETE FROM {$tbl_session_rel_class}\n                             WHERE session_id='{$sessionId}' AND class_id=" . intval($_GET['class']));
            $nbr_affected_rows = Database::affected_rows($result);
            Database::query("UPDATE {$tbl_session} SET nbr_classes=nbr_classes-{$nbr_affected_rows} WHERE id='{$sessionId}'");
        }
        if (!empty($_GET['user'])) {
            SessionManager::unsubscribe_user_from_session($sessionId, $_GET['user']);
        }
        break;
}
$sessionHeader = Display::page_header(Display::return_icon('session.png', get_lang('Session')) . ' ' . $sessionInfo['name'], null, 'h3');
$url = Display::url(Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL), "session_edit.php?page=resume_session.php&id={$sessionId}");
$sessionTitle = Display::page_subheader(get_lang('GeneralProperties') . $url);
$generalCoach = api_get_user_info($sessionInfo['id_coach']);
$sessionField = new ExtraField('session');
$extraFieldData = $sessionField->getDataAndFormattedValues($sessionId);
$multiple_url_is_on = api_get_multiple_access_url();
$urlList = [];
if ($multiple_url_is_on) {
    $urlList = UrlManager::get_access_url_from_session($sessionId);
}
$url = Display::url(Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL), "add_courses_to_session.php?page=resume_session.php&id_session={$sessionId}");
$courseListToShow = Display::page_subheader(get_lang('CourseList') . $url);
$courseListToShow .= '<table id="session-list-course" class="data_table">
<tr>
  <th width="35%">' . get_lang('CourseTitle') . '</th>
  <th width="30%">' . get_lang('CourseCoach') . '</th>
  <th width="10%">' . get_lang('UsersNumber') . '</th>
  <th width="25%">' . get_lang('Actions') . '</th>
</tr>';
开发者ID:jloguercio,项目名称:chamilo-lms,代码行数:31,代码来源:resume_session.php

示例13: array

//    PASSWORD, if auth_source is platform
if (is_platform_authentication() && is_profile_editable() && api_get_setting('profile', 'password') == 'true') {
    $form->addElement('password', 'password0', array(get_lang('Pass'), get_lang('Enter2passToChange')), array('size' => 40));
    $form->addElement('password', 'password1', get_lang('NewPass'), array('id' => 'password1', 'size' => 40));
    $checkPass = api_get_setting('security.allow_strength_pass_checker');
    if ($checkPass == 'true') {
        $form->addElement('label', null, '<div id="password_progress"></div>');
    }
    $form->addElement('password', 'password2', get_lang('Confirmation'), array('size' => 40));
    //    user must enter identical password twice so we can prevent some user errors
    $form->addRule(array('password1', 'password2'), get_lang('PassTwo'), 'compare');
    if (CHECK_PASS_EASY_TO_FIND) {
        $form->addRule('password1', get_lang('CurrentPasswordEmptyOrIncorrect'), 'callback', 'api_check_password');
    }
}
$extraField = new ExtraField('user');
$return = $extraField->addElements($form, api_get_user_id());
$jquery_ready_content = $return['jquery_ready_content'];
// the $jquery_ready_content variable collects all functions that
// will be load in the $(document).ready javascript function
$htmlHeadXtra[] = '<script>
$(document).ready(function(){
    ' . $jquery_ready_content . '
});
</script>';
if (api_get_setting('profile', 'apikeys') == 'true') {
    $form->addElement('html', '<div id="div_api_key">');
    $form->addElement('text', 'api_key_generate', get_lang('MyApiKey'), array('size' => 40, 'id' => 'id_api_key_generate'));
    $form->addElement('html', '</div>');
    $form->addButton('generate_api_key', get_lang('GenerateApiKey'), 'cogs', 'default', 'default', null, ['id' => 'id_generate_api_key']);
}
开发者ID:jloguercio,项目名称:chamilo-lms,代码行数:31,代码来源:profile.php

示例14: get_lang

        if (api_get_setting('extendedprofile_registration', 'mycomptetences') == 'true' && api_get_setting('extendedprofile_registrationrequired', 'mycomptetences') == 'true') {
            $form->addRule('competences', get_lang('ThisFieldIsRequired'), 'required');
        }
        if (api_get_setting('extendedprofile_registration', 'mydiplomas') == 'true' && api_get_setting('extendedprofile_registrationrequired', 'mydiplomas') == 'true') {
            $form->addRule('diplomas', get_lang('ThisFieldIsRequired'), 'required');
        }
        if (api_get_setting('extendedprofile_registration', 'myteach') == 'true' && api_get_setting('extendedprofile_registrationrequired', 'myteach') == 'true') {
            $form->addRule('teach', get_lang('ThisFieldIsRequired'), 'required');
        }
        if (api_get_setting('extendedprofile_registration', 'mypersonalopenarea') == 'true' && api_get_setting('extendedprofile_registrationrequired', 'mypersonalopenarea') == 'true') {
            $form->addRule('openarea', get_lang('ThisFieldIsRequired'), 'required');
        }
    }
    // EXTRA FIELDS
    $extra_data = UserManager::get_extra_user_data(api_get_user_id(), true);
    $extraField = new ExtraField('user');
    $extraField->set_extra_fields_in_form($form, $extra_data, 'registration', false, null);
}
if (isset($_SESSION['user_language_choice']) && $_SESSION['user_language_choice'] != '') {
    $defaults['language'] = $_SESSION['user_language_choice'];
} else {
    $defaults['language'] = api_get_setting('platformLanguage');
}
if (!empty($_GET['username'])) {
    $defaults['username'] = Security::remove_XSS($_GET['username']);
}
if (!empty($_GET['email'])) {
    $defaults['email'] = Security::remove_XSS($_GET['email']);
}
if (!empty($_GET['phone'])) {
    $defaults['phone'] = Security::remove_XSS($_GET['phone']);
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:31,代码来源:inscription.php

示例15: array

     if (!in_array($sidx, $columns)) {
         $sidx = 'name';
     }
     $result = Database::select('*', "{$obj->table} ", array('order' => "{$sidx} {$sord}", 'LIMIT' => "{$start} , {$limit}"));
     $new_result = array();
     foreach ($result as $item) {
         $new_result[] = $item;
     }
     $result = $new_result;
     break;
 case 'get_usergroups':
     $columns = array('id', 'name', 'users', 'courses', 'sessions', 'actions');
     $result = $obj->getUsergroupsPagination($sidx, $sord, $start, $limit);
     break;
 case 'get_extra_fields':
     $obj = new ExtraField($type);
     $columns = array('field_display_text', 'field_variable', 'field_type', 'field_changeable', 'field_visible', 'field_filter', 'field_order');
     $result = Database::select('*', $obj->table, array('order' => "{$sidx} {$sord}", 'LIMIT' => "{$start} , {$limit}"));
     $new_result = array();
     if (!empty($result)) {
         foreach ($result as $item) {
             $item['field_type'] = $obj->get_field_type_by_id($item['field_type']);
             $item['field_changeable'] = $item['field_changeable'] ? Display::return_icon('right.gif') : Display::return_icon('wrong.gif');
             $item['field_visible'] = $item['field_visible'] ? Display::return_icon('right.gif') : Display::return_icon('wrong.gif');
             $item['field_filter'] = $item['field_filter'] ? Display::return_icon('right.gif') : Display::return_icon('wrong.gif');
             $new_result[] = $item;
         }
         $result = $new_result;
     }
     break;
 case 'get_exercise_grade':
开发者ID:annickvdp,项目名称:Chamilo1.9.10,代码行数:31,代码来源:model.ajax.php


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