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


PHP ExtraField::addElements方法代码示例

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


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


//.........这里部分代码省略.........
            }
            </script>';
            $form->addElement('html', $js);
        }
        // question name
        $form->addElement('text', 'questionName', get_lang('Question'), array('class' => 'span6'));
        $form->addRule('questionName', get_lang('GiveQuestion'), 'required');
        // Default content.
        $isContent = isset($_REQUEST['isContent']) ? intval($_REQUEST['isContent']) : null;
        // Question type
        $answerType = isset($_REQUEST['answerType']) ? intval($_REQUEST['answerType']) : $this->selectType();
        $form->addElement('hidden', 'answerType', $answerType);
        // html editor
        $editor_config = array('ToolbarSet' => 'TestQuestionDescription', 'Width' => '100%', 'Height' => '150');
        if (is_array($fck_config)) {
            $editor_config = array_merge($editor_config, $fck_config);
        }
        if (!api_is_allowed_to_edit(null, true)) {
            $editor_config['UserStatus'] = 'student';
        }
        $form->add_html_editor('questionDescription', get_lang('QuestionDescription'), false, false, $editor_config);
        // hidden values
        $my_id = isset($_REQUEST['myid']) ? intval($_REQUEST['myid']) : null;
        $form->addElement('hidden', 'myid', $my_id);
        if ($this->type != MEDIA_QUESTION) {
            if ($this->exercise->fastEdition == false) {
                // Advanced parameters
                $form->addElement('advanced_settings', 'advanced_params', get_lang('AdvancedParameters'));
                $form->addElement('html', '<div id="advanced_params_options" style="display:none;">');
            }
            // Level (difficulty).
            $select_level = Question::get_default_levels();
            $form->addElement('select', 'questionLevel', get_lang('Difficulty'), $select_level);
            // Media question.
            $course_medias = Question::prepare_course_media_select(api_get_course_int_id());
            $form->addElement('select', 'parent_id', get_lang('AttachToMedia'), $course_medias, array('id' => 'parent_id'));
            // Categories.
            $categoryJS = null;
            if (!empty($this->category_list)) {
                $trigger = '';
                foreach ($this->category_list as $category_id) {
                    if (!empty($category_id)) {
                        $cat = new Testcategory($category_id);
                        if ($cat->id) {
                            $trigger .= '$("#category_id").trigger("addItem",[{"title": "' . $cat->parent_path . '", "value": "' . $cat->id . '"}]);';
                        }
                    }
                }
                $categoryJS .= '<script>$(function() { ' . $trigger . ' });</script>';
            }
            $form->addElement('html', $categoryJS);
            $form->addElement('select', 'questionCategory', get_lang('Category'), array(), array('id' => 'category_id'));
            // Extra fields. (Injecting question extra fields!)
            $extraFields = new ExtraField('question');
            $extraFields->addElements($form, $this->id);
            if ($this->exercise->fastEdition == false) {
                $form->addElement('html', '</div>');
            }
        }
        // @todo why we need this condition??
        if ($this->setDefaultQuestionValues) {
            switch ($answerType) {
                case 1:
                    $this->question = get_lang('DefaultUniqueQuestion');
                    break;
                case 2:
                    $this->question = get_lang('DefaultMultipleQuestion');
                    break;
                case 3:
                    $this->question = get_lang('DefaultFillBlankQuestion');
                    break;
                case 4:
                    $this->question = get_lang('DefaultMathingQuestion');
                    break;
                case 5:
                    $this->question = get_lang('DefaultOpenQuestion');
                    break;
                case 9:
                    $this->question = get_lang('DefaultMultipleQuestion');
                    break;
            }
        }
        // default values
        $defaults = array();
        $defaults['questionName'] = $this->question;
        $defaults['questionDescription'] = $this->description;
        $defaults['questionLevel'] = $this->level;
        $defaults['questionCategory'] = $this->category_list;
        $defaults['parent_id'] = $this->parent_id;
        if (!empty($_REQUEST['myid'])) {
            $form->setDefaults($defaults);
        } else {
            if ($isContent == 1) {
                $form->setDefaults($defaults);
            }
        }
        if ($this->setDefaultValues) {
            $form->setDefaults($defaults);
        }
    }
开发者ID:ragebat,项目名称:chamilo-lms,代码行数:101,代码来源:question.class.php

示例4: array

$form->addElement('checkbox', 'activate_end_date_check', null, get_lang('EnableEndTime'), array('onclick' => 'activate_end_date()'));
$display_date = 'none';
if ($expired_on != '0000-00-00 00:00:00' && !empty($expired_on)) {
    $display_date = 'block';
    $defaults['activate_end_date_check'] = 1;
}
$form->addElement('html', '<div id="end_date_div" style="display:' . $display_date . ';">');
$form->addElement('datepicker', 'expired_on', get_lang('ExpirationDate'), array('form_name' => 'exercise_admin'), 5);
$form->addElement('html', '</div>');
if (api_is_platform_admin()) {
    $form->addElement('checkbox', 'use_max_score', null, get_lang('UseMaxScore100'));
    $defaults['use_max_score'] = $_SESSION['oLP']->use_max_score;
}
$form->addElement('checkbox', 'subscribe_users', null, get_lang('SubscribeUsersToLP'));
$extraField = new ExtraField('lp');
$extra = $extraField->addElements($form, $_SESSION['oLP']->get_id());
$htmlHeadXtra[] = '<script src="' . api_get_path(WEB_LIBRARY_PATH) . 'javascript/tag/jquery.fcbkcomplete.js" type="text/javascript" language="javascript"></script>';
$htmlHeadXtra[] = '<link  href="' . api_get_path(WEB_LIBRARY_PATH) . 'javascript/tag/style.css" rel="stylesheet" type="text/css" />';
$htmlHeadXtra[] = '<script>
$(function() {
    ' . $extra['jquery_ready_content'] . '
});
</script>';
//Submit button
$form->addElement('style_submit_button', 'Submit', get_lang('SaveLPSettings'), 'class="save"');
// Hidden fields
$form->addElement('hidden', 'action', 'update_lp');
$form->addElement('hidden', 'lp_id', $_SESSION['oLP']->get_id());
$defaults['publicated_on'] = $publicated_on != '0000-00-00 00:00:00' && !empty($publicated_on) ? api_get_local_time($publicated_on) : date('Y-m-d 12:00:00');
$defaults['expired_on'] = $expired_on != '0000-00-00 00:00:00' && !empty($expired_on) ? api_get_local_time($expired_on) : date('Y-m-d 12:00:00', time() + 84600);
$defaults['max_attempts'] = $_SESSION['oLP']->get_max_attempts();
开发者ID:ragebat,项目名称:chamilo-lms,代码行数:31,代码来源:lp_edit.php

示例5: array

$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('ThisFieldShouldBeNumeric'), 'numeric');
$obj = new GradeModel();
$obj->fill_grade_model_select_in_form($form);
//Extra fields
$extra_field = new ExtraField('course');
$extra = $extra_field->addElements($form);
$htmlHeadXtra[] = '
<script>

$(function() {
    ' . $extra['jquery_ready_content'] . '
});
</script>';
$form->add_progress_bar();
$form->addButtonCreate(get_lang('CreateCourse'));
// Set some default values.
$values['course_language'] = api_get_setting('platformLanguage');
$values['disk_quota'] = round(api_get_setting('default_document_quotum') / 1024 / 1024, 1);
$default_course_visibility = api_get_setting('courses_default_creation_visibility');
if (isset($default_course_visibility)) {
    $values['visibility'] = api_get_setting('courses_default_creation_visibility');
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:31,代码来源:course_add.php

示例6: ExtraField

            $form->addRule('competences', get_lang('ThisFieldIsRequired'), 'required');
        }
        if (api_get_setting_in_list('registration.extendedprofile_registration', 'mydiplomas') == 'true' && api_get_setting_in_list('registration.extendedprofile_registrationrequired', 'mydiplomas') == 'true') {
            $form->addRule('diplomas', get_lang('ThisFieldIsRequired'), 'required');
        }
        if (api_get_setting_in_list('registration.extendedprofile_registration', 'myteach') == 'true' && api_get_setting_in_list('registration.extendedprofile_registrationrequired', 'myteach') == 'true') {
            $form->addRule('teach', get_lang('ThisFieldIsRequired'), 'required');
        }
        if (api_get_setting_in_list('registration.extendedprofile_registration', 'mypersonalopenarea') == 'true' && api_get_setting_in_list('registration.extendedprofile_registrationrequired', 'mypersonalopenarea') == 'true') {
            $form->addRule('openarea', get_lang('ThisFieldIsRequired'), 'required');
        }
    }
    // EXTRA FIELDS
    if (in_array('extra_fields', $allowedFields)) {
        $extraField = new ExtraField('user');
        $returnParams = $extraField->addElements($form);
    }
}
if (isset($_SESSION['user_language_choice']) && $_SESSION['user_language_choice'] != '') {
    $defaults['language'] = $_SESSION['user_language_choice'];
} else {
    $defaults['language'] = api_get_setting('language.platform_language');
}
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:omaoibrahim,项目名称:chamilo-lms,代码行数:31,代码来源:inscription.php

示例7: sprintf

$date = sprintf(get_lang('CreatedByXYOnZ'), 'user_information.php?user_id=' . $user_data['creator_id'], $creatorInfo['username'], $user_data['registration_date']);
$form->addElement('label', get_lang('RegistrationDate'), $date);
if (!$user_data['platform_admin']) {
    // Expiration Date
    $form->addElement('radio', 'radio_expiration_date', get_lang('ExpirationDate'), get_lang('NeverExpires'), 0);
    $group = array();
    $group[] = $form->createElement('radio', 'radio_expiration_date', null, get_lang('Enabled'), 1);
    $group[] = $form->createElement('DateTimePicker', 'expiration_date', null, array('onchange' => 'javascript: enable_expiration_date();'));
    $form->addGroup($group, 'max_member_group', null, '', false);
    // Active account or inactive account
    $form->addElement('radio', 'active', get_lang('ActiveAccount'), get_lang('Active'), 1);
    $form->addElement('radio', 'active', '', get_lang('Inactive'), 0);
}
// EXTRA FIELDS
$extraField = new ExtraField('user');
$returnParams = $extraField->addElements($form, $user_data['user_id']);
$jquery_ready_content = $returnParams['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>';
// Submit button
$form->addButtonSave(get_lang('Save'));
// Set default values
$user_data['reset_password'] = 0;
$expiration_date = $user_data['expiration_date'];
if (empty($expiration_date)) {
    $user_data['radio_expiration_date'] = 0;
    $user_data['expiration_date'] = api_get_local_time();
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:31,代码来源:user_edit.php

示例8: array

$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');
//Extra fields
$extra_field = new ExtraField('course');
$extra = $extra_field->addElements($form, $courseId);
$htmlHeadXtra[] = '
<script>
$(function() {
    ' . $extra['jquery_ready_content'] . '
});
</script>';
$form->addButtonUpdate(get_lang('ModifyCourseInfo'));
// Set some default values
$courseInfo['disk_quota'] = round(DocumentManager::get_course_quota($courseInfo['code']) / 1024 / 1024, 1);
$courseInfo['real_code'] = $courseInfo['code'];
$courseInfo['add_teachers_to_sessions_courses'] = isset($courseInfo['add_teachers_to_sessions_courses']) ? $courseInfo['add_teachers_to_sessions_courses'] : 0;
$form->setDefaults($courseInfo);
// Validate form
if ($form->validate()) {
    $course = $form->getSubmitValues();
开发者ID:jloguercio,项目名称:chamilo-lms,代码行数:31,代码来源:course_edit.php

示例9: array

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']);
}
//    SUBMIT
开发者ID:jloguercio,项目名称:chamilo-lms,代码行数:31,代码来源:profile.php

示例10: setForm

 /**
  * @param FormValidator $form
  *
  * @return array
  */
 public static function setForm(FormValidator &$form, $sessionId = 0)
 {
     $categoriesList = SessionManager::get_all_session_category();
     $userInfo = api_get_user_info();
     $categoriesOptions = array('0' => get_lang('None'));
     if ($categoriesList != false) {
         foreach ($categoriesList as $categoryItem) {
             $categoriesOptions[$categoryItem['id']] = $categoryItem['name'];
         }
     }
     // Database Table Definitions
     $tbl_user = Database::get_main_table(TABLE_MAIN_USER);
     $form->addElement('text', 'name', get_lang('SessionName'), array('maxlength' => 50));
     $form->addRule('name', get_lang('ThisFieldIsRequired'), 'required');
     $form->addRule('name', get_lang('SessionNameAlreadyExists'), 'callback', 'check_session_name');
     if (!api_is_platform_admin() && api_is_teacher()) {
         $form->addElement('select', 'coach_username', get_lang('CoachName'), [api_get_user_id() => $userInfo['complete_name']], array('id' => 'coach_username', 'class' => 'chzn-select', 'style' => 'width:370px;'));
     } else {
         $sql = "SELECT COUNT(1) FROM {$tbl_user} WHERE status = 1";
         $rs = Database::query($sql);
         $countUsers = Database::result($rs, 0, 0);
         if (intval($countUsers) < 50) {
             $orderClause = "ORDER BY ";
             $orderClause .= api_sort_by_first_name() ? "firstname, lastname, username" : "lastname, firstname, username";
             $sql = "SELECT user_id, lastname, firstname, username\n                        FROM {$tbl_user}\n                        WHERE status = '1' " . $orderClause;
             if (api_is_multiple_url_enabled()) {
                 $userRelAccessUrlTable = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
                 $accessUrlId = api_get_current_access_url_id();
                 if ($accessUrlId != -1) {
                     $sql = "SELECT user.user_id, username, lastname, firstname\n                        FROM {$tbl_user} user\n                        INNER JOIN {$userRelAccessUrlTable} url_user\n                        ON (url_user.user_id = user.user_id)\n                        WHERE\n                            access_url_id = {$accessUrlId} AND\n                            status = 1 " . $orderClause;
                 }
             }
             $result = Database::query($sql);
             $coachesList = Database::store_result($result);
             $coachesOptions = array();
             foreach ($coachesList as $coachItem) {
                 $coachesOptions[$coachItem['user_id']] = api_get_person_name($coachItem['firstname'], $coachItem['lastname']) . ' (' . $coachItem['username'] . ')';
             }
             $form->addElement('select', 'coach_username', get_lang('CoachName'), $coachesOptions);
         } else {
             $form->addElement('select_ajax', 'coach_username', get_lang('CoachName'), null, ['url' => api_get_path(WEB_AJAX_PATH) . 'session.ajax.php?a=search_general_coach', 'width' => '100%']);
         }
     }
     $form->addRule('coach_username', get_lang('ThisFieldIsRequired'), 'required');
     $form->addHtml('<div id="ajax_list_coachs"></div>');
     $form->addButtonAdvancedSettings('advanced_params');
     $form->addElement('html', '<div id="advanced_params_options" style="display:none">');
     $form->addSelect('session_category', get_lang('SessionCategory'), $categoriesOptions, array('id' => 'session_category', 'class' => 'chzn-select', 'style' => 'width:370px;'));
     $form->addHtmlEditor('description', get_lang('Description'), false, false, array('ToolbarSet' => 'Minimal'));
     $form->addElement('checkbox', 'show_description', null, get_lang('ShowDescription'));
     $visibilityGroup = array();
     $visibilityGroup[] = $form->createElement('select', 'session_visibility', null, array(SESSION_VISIBLE_READ_ONLY => get_lang('SessionReadOnly'), SESSION_VISIBLE => get_lang('SessionAccessible'), SESSION_INVISIBLE => api_ucfirst(get_lang('SessionNotAccessible'))));
     $form->addGroup($visibilityGroup, 'visibility_group', get_lang('SessionVisibility'), null, false);
     $options = [0 => get_lang('ByDuration'), 1 => get_lang('ByDates')];
     $form->addSelect('access', get_lang('Access'), $options, array('onchange' => 'accessSwitcher()', 'id' => 'access'));
     $form->addElement('html', '<div id="duration" style="display:none">');
     $form->addElement('number', 'duration', array(get_lang('SessionDurationTitle'), get_lang('SessionDurationDescription')), array('maxlength' => 50));
     $form->addElement('html', '</div>');
     $form->addElement('html', '<div id="date_fields" style="display:none">');
     // Dates
     $form->addDateTimePicker('access_start_date', array(get_lang('SessionStartDate'), get_lang('SessionStartDateComment')), array('id' => 'access_start_date'));
     $form->addDateTimePicker('access_end_date', array(get_lang('SessionEndDate'), get_lang('SessionEndDateComment')), array('id' => 'access_end_date'));
     $form->addRule(array('access_start_date', 'access_end_date'), get_lang('StartDateMustBeBeforeTheEndDate'), 'compare_datetime_text', '< allow_empty');
     $form->addDateTimePicker('display_start_date', array(get_lang('SessionDisplayStartDate'), get_lang('SessionDisplayStartDateComment')), array('id' => 'display_start_date'));
     $form->addDateTimePicker('display_end_date', array(get_lang('SessionDisplayEndDate'), get_lang('SessionDisplayEndDateComment')), array('id' => 'display_end_date'));
     $form->addRule(array('display_start_date', 'display_end_date'), get_lang('StartDateMustBeBeforeTheEndDate'), 'compare_datetime_text', '< allow_empty');
     $form->addDateTimePicker('coach_access_start_date', array(get_lang('SessionCoachStartDate'), get_lang('SessionCoachStartDateComment')), array('id' => 'coach_access_start_date'));
     $form->addDateTimePicker('coach_access_end_date', array(get_lang('SessionCoachEndDate'), get_lang('SessionCoachEndDateComment')), array('id' => 'coach_access_end_date'));
     $form->addRule(array('coach_access_start_date', 'coach_access_end_date'), get_lang('StartDateMustBeBeforeTheEndDate'), 'compare_datetime_text', '< allow_empty');
     $form->addElement('html', '</div>');
     $form->addCheckBox('send_subscription_notification', [get_lang('SendSubscriptionNotification'), get_lang('SendAnEmailWhenAUserBeingSubscribed')]);
     // Extra fields
     $extra_field = new ExtraField('session');
     $extra = $extra_field->addElements($form, $sessionId);
     $form->addElement('html', '</div>');
     $js = $extra['jquery_ready_content'];
     return ['js' => $js];
 }
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:83,代码来源:sessionmanager.lib.php

示例11: ExtraField

$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() {
    ' . $extra['jquery_ready_content'] . '
});
</script>';
$form->addButtonUpdate(get_lang('ModifyCourseInfo'));
// Set some default values
$courseInfo['disk_quota'] = round(DocumentManager::get_course_quota($courseInfo['code']) / 1024 / 1024, 1);
$courseInfo['real_code'] = $courseInfo['code'];
$courseInfo['add_teachers_to_sessions_courses'] = isset($courseInfo['add_teachers_to_sessions_courses']) ? $courseInfo['add_teachers_to_sessions_courses'] : 0;
$form->setDefaults($courseInfo);
// Validate form
if ($form->validate()) {
    $course = $form->getSubmitValues();
开发者ID:secuencia24,项目名称:chamilo-lms,代码行数:31,代码来源:course_edit.php

示例12: ExtraField

    if (api_get_setting('profile.extended_profile') == 'true') {
        if (api_get_setting_in_list('registration.extendedprofile_registrationrequired', 'mycomptetences') == 'true') {
            $form->addRule('competences', get_lang('ThisFieldIsRequired'), 'required');
        }
        if (api_get_setting_in_list('registration.extendedprofile_registrationrequired', 'mydiplomas') == 'true') {
            $form->addRule('diplomas', get_lang('ThisFieldIsRequired'), 'required');
        }
        if (api_get_setting_in_list('registration.extendedprofile_registrationrequired', 'myteach') == 'true') {
            $form->addRule('teach', get_lang('ThisFieldIsRequired'), 'required');
        }
        if (api_get_setting_in_list('registration.extendedprofile_registrationrequired', 'mypersonalopenarea') == 'true') {
            $form->addRule('openarea', get_lang('ThisFieldIsRequired'), 'required');
        }
    }
    $extraField = new ExtraField('user');
    $extraField->addElements($form);
}
// Terms and conditions
if (api_get_setting('registration.allow_terms_conditions') == 'true') {
    $language = api_get_interface_language();
    $language = api_get_language_id($language);
    $term_preview = LegalManager::get_last_condition($language);
    if (!$term_preview) {
        //we load from the platform
        $language = api_get_setting('language.platform_language');
        $language = api_get_language_id($language);
        $term_preview = LegalManager::get_last_condition($language);
        //if is false we load from english
        if (!$term_preview) {
            $language = api_get_language_id('english');
            //this must work
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:31,代码来源:configure_inscription.php

示例13: array

$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');
//Extra fields
$extra_field = new ExtraField('course');
$extra = $extra_field->addElements($form, $course_code);
$htmlHeadXtra[] = '
<script>
$(function() {
    ' . $extra['jquery_ready_content'] . '
});
</script>';
$form->addElement('style_submit_button', 'button', get_lang('ModifyCourseInfo'), 'onclick="valide()"; class="save"');
// Set some default values
//$course['disk_quota'] = round($course['disk_quota']/1024/1024, 1);
$course['disk_quota'] = round(DocumentManager::get_course_quota($course_code) / 1024 / 1024, 1);
$course['title'] = api_html_entity_decode($course['title'], ENT_QUOTES, $charset);
$course['real_code'] = $course['code'];
$form->setDefaults($course);
// Validate form
if ($form->validate()) {
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:31,代码来源:course_edit.php

示例14: ExtraField

if ($expired_on != '0000-00-00 00:00:00' && !empty($expired_on)) {
    $display_date = 'block';
    $defaults['activate_end_date_check'] = 1;
}
$form->addElement('html', '<div id="end_date_div" style="display:' . $display_date . ';">');
$form->addElement('DatePicker', 'expired_on', get_lang('ExpirationDate'));
$form->addElement('html', '</div>');
if (api_is_platform_admin()) {
    $form->addElement('checkbox', 'use_max_score', null, get_lang('UseMaxScore100'));
    $defaults['use_max_score'] = $learnpath->use_max_score;
}
$form->addElement('checkbox', 'subscribe_users', null, get_lang('SubscribeUsersToLp'));
$enableLpExtraFields = false;
if ($enableLpExtraFields) {
    $extraField = new ExtraField('lp');
    $extra = $extraField->addElements($form, $learnpath->get_id());
}
// Submit button
$form->addButtonSave(get_lang('SaveLPSettings'));
// Hidden fields
$form->addElement('hidden', 'action', 'update_lp');
$form->addElement('hidden', 'lp_id', $learnpath->get_id());
if ($enableLpExtraFields) {
    $htmlHeadXtra[] = '<script>
    $(function() {
        ' . $extra['jquery_ready_content'] . '
    });
    </script>';
}
$defaults['publicated_on'] = $publicated_on != '0000-00-00 00:00:00' && !empty($publicated_on) ? api_get_local_time($publicated_on) : date('Y-m-d 12:00:00');
$defaults['expired_on'] = $expired_on != '0000-00-00 00:00:00' && !empty($expired_on) ? api_get_local_time($expired_on) : date('Y-m-d 12:00:00', time() + 84600);
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:31,代码来源:lp_edit.php


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