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


PHP FormValidator::addGroup方法代码示例

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


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

示例1: settingsForm

/**
 * Returns a form displaying all options for this tool.
 * These are
 * - make all files visible / invisible
 * - set the default visibility of uploaded files
 * @param $defaults
 * @return string The HTML form
 */
function settingsForm($defaults)
{
    $is_allowed_to_edit = api_is_allowed_to_edit(null, true);
    if (!$is_allowed_to_edit) {
        return;
    }
    $url = api_get_path(WEB_CODE_PATH) . 'work/work.php?' . api_get_cidreq() . '&action=settings';
    $form = new FormValidator('edit_settings', 'post', $url);
    $form->addElement('hidden', 'changeProperties', 1);
    $form->addElement('header', get_lang('EditToolOptions'));
    $group = array($form->createElement('radio', 'show_score', null, get_lang('NewVisible'), 0), $form->createElement('radio', 'show_score', null, get_lang('NewUnvisible'), 1));
    $form->addGroup($group, '', get_lang('DefaultUpload'));
    $group = array($form->createElement('radio', 'student_delete_own_publication', null, get_lang('Yes'), 1), $form->createElement('radio', 'student_delete_own_publication', null, get_lang('No'), 0));
    $form->addGroup($group, '', get_lang('StudentAllowedToDeleteOwnPublication'));
    $form->addButtonSave(get_lang('Save'));
    $form->setDefaults($defaults);
    return $form->returnForm();
}
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:26,代码来源:work.lib.php

示例2: Template

                if (count($certificateStudent['certificates']) > 0) {
                    $certificateStudents[] = $certificateStudent;
                }
            }
        }
    }
}
/* View */
$template = new Template(get_lang('GradebookListOfStudentsCertificates'));
if (Session::has('reportErrorMessage')) {
    $template->assign('errorMessage', Session::read('reportErrorMessage'));
}
$searchBySessionCourseDateForm = new FormValidator('certificate_report_form', 'post', api_get_path(WEB_CODE_PATH) . 'gradebook/certificate_report.php');
$searchBySessionCourseDateForm->addSelect('session', get_lang('Sessions'), $sessions, ['id' => 'session']);
$searchBySessionCourseDateForm->addSelect('course', get_lang('Courses'), $courses, ['id' => 'course']);
$searchBySessionCourseDateForm->addGroup([$searchBySessionCourseDateForm->createElement('select', 'month', null, $months, ['id' => 'month']), $searchBySessionCourseDateForm->createElement('text', 'year', null, ['id' => 'year', 'placeholder' => get_lang('Year')])], null, get_lang('Date'));
$searchBySessionCourseDateForm->addButtonSearch();
$searchBySessionCourseDateForm->setDefaults(['session' => $selectedSession, 'course' => $selectedCourse, 'month' => $selectedMonth, 'year' => $selectedYear]);
if (api_is_student_boss()) {
    foreach ($userList as $studentId) {
        $students[$studentId] = api_get_user_info($studentId)['complete_name_with_username'];
    }
    $searchByStudentForm = new FormValidator('certificate_report_form', 'post', api_get_path(WEB_CODE_PATH) . 'gradebook/certificate_report.php');
    $searchByStudentForm->addSelect('student', get_lang('Students'), $students, ['id' => 'student']);
    $searchByStudentForm->addButtonSearch();
    $searchByStudentForm->setDefaults(['student' => $selectedStudent]);
    $template->assign('searchByStudentForm', $searchByStudentForm->returnForm());
}
$template->assign('searchBySessionCourseDateForm', $searchBySessionCourseDateForm->returnForm());
$template->assign('sessions', $sessions);
$template->assign('courses', $courses);
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:31,代码来源:certificate_report.php

示例3: array

    $form->addElement('hidden', 'title');
    $form->addElement('hidden', 'description');
}
// Action
$form->addElement('hidden', 'action');
// Groups per user
$group = array();
$group[] = $form->createElement('static', null, null, get_lang('QtyOfUserCanSubscribe_PartBeforeNumber'));
$possible_values = array();
for ($i = 1; $i <= 10; $i++) {
    $possible_values[$i] = $i;
}
$possible_values[GroupManager::GROUP_PER_MEMBER_NO_LIMIT] = get_lang('All');
$group[] = $form->createElement('select', 'groups_per_user', null, $possible_values);
$group[] = $form->createElement('static', null, null, get_lang('QtyOfUserCanSubscribe_PartAfterNumber'));
$form->addGroup($group, 'limit_group', get_lang('GroupLimit'), ' ', false);
$form->addRule('limit_group', get_lang('MaxGroupsPerUserInvalid'), 'callback', 'check_groups_per_user');
$form->addElement('html', '<br /><br /><div class="sectiontitle" >' . get_lang('DefaultSettingsForNewGroups'));
$form->addElement('html', '</div>');
// Members per group
$form->addElement('radio', 'max_member_no_limit', get_lang('GroupLimit'), get_lang('NoLimit'), GroupManager::MEMBER_PER_GROUP_NO_LIMIT);
$group = array();
$group[] = $form->createElement('radio', 'max_member_no_limit', null, get_lang('MaximumOfParticipants'), 1, array('id' => 'max_member_selected'));
$group[] = $form->createElement('text', 'max_member', null, array('size' => 2, 'id' => 'max_member'));
$group[] = $form->createElement('static', null, null, get_lang('GroupPlacesThis'));
$form->addGroup($group, 'max_member_group', null, '', false);
$form->addRule('max_member_group', get_lang('InvalidMaxNumberOfMembers'), 'callback', 'check_max_number_of_members');
// Self registration
$icon = Display::return_icon('user.png', get_lang('GroupSelfRegistration'), array(), ICON_SIZE_SMALL) . ' ';
$form->addElement('checkbox', 'self_reg_allowed', $icon . get_lang('GroupSelfRegistration'), get_lang('GroupAllowStudentRegistration'), 1);
$form->addElement('checkbox', 'self_unreg_allowed', null, get_lang('GroupAllowStudentUnregistration'), 1);
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:31,代码来源:group_category.php

示例4: array

$group = array();
$auth_sources = 0;
//make available wider as we need it in case of form reset (see below)
/*if (count($extAuthSource) > 0) {
	$group[] =& $form->createElement('radio', 'password_auto', null, get_lang('ExternalAuthentication').' ', 2);
	$auth_sources = array();
	foreach ($extAuthSource as $key => $info) {
		$auth_sources[$key] = $key;
	}
	$group[] =& $form->createElement('select', 'auth_source', null, $auth_sources);
	$group[] =& $form->createElement('static', '', '', '<br />');
}*/
$group[] =& $form->createElement('radio', 'password_auto', get_lang('Password'), get_lang('AutoGeneratePassword') . '<br />', 1);
$group[] =& $form->createElement('radio', 'password_auto', 'id="radio_user_password"', null, 0);
$group[] =& $form->createElement('password', 'password', null, array('onkeydown' => 'javascript: password_switch_radio_button(document.user_add,"password[password_auto]");'));
$form->addGroup($group, 'password', get_lang('Password'), '');
// Send email
$group = array();
$group[] =& $form->createElement('radio', 'send_mail', null, get_lang('Yes'), 1);
$group[] =& $form->createElement('radio', 'send_mail', null, get_lang('No'), 0);
$form->addGroup($group, 'mail', get_lang('SendMailToNewUser'), '&nbsp;');
// Set default values
$defaults = array();
$defaults['username'] = $userInfo['username'];
$defaults['mail']['send_mail'] = 0;
$defaults['password']['password_auto'] = 1;
$form->setDefaults($defaults);
// Submit button
$select_level = array();
$html_results_enabled[] = $form->addButtonUpdate(get_lang('Update'), 'submit', true);
$form->addGroup($html_results_enabled);
开发者ID:jloguercio,项目名称:chamilo-lms,代码行数:31,代码来源:user_edit.php

示例5: FormValidator

     echo Display::url(Display::return_icon('folder_up.png', get_lang("Back"), '', ICON_SIZE_MEDIUM), api_get_path(WEB_CODE_PATH) . 'admin/course_category.php?category=' . Security::remove_XSS($category));
     echo '</div>';
     $form_title = $action == 'add' ? get_lang('AddACategory') : get_lang('EditNode');
     if (!empty($category)) {
         $form_title .= ' ' . get_lang('Into') . ' ' . Security::remove_XSS($category);
     }
     $url = api_get_self() . '?action=' . Security::remove_XSS($action) . '&category=' . Security::remove_XSS($category) . '&id=' . Security::remove_XSS($categoryId);
     $form = new FormValidator('course_category', 'post', $url);
     $form->addElement('header', '', $form_title);
     $form->addElement('hidden', 'formSent', 1);
     $form->addElement('text', 'code', get_lang("CategoryCode"));
     $form->addElement('text', 'name', get_lang("CategoryName"));
     $form->addRule('name', get_lang('PleaseEnterCategoryInfo'), 'required');
     $form->addRule('code', get_lang('PleaseEnterCategoryInfo'), 'required');
     $group = array($form->createElement('radio', 'auth_course_child', get_lang("AllowCoursesInCategory"), get_lang('Yes'), 'TRUE'), $form->createElement('radio', 'auth_course_child', null, get_lang('No'), 'FALSE'));
     $form->addGroup($group, null, get_lang("AllowCoursesInCategory"));
     if (!empty($categoryInfo)) {
         $class = "save";
         $text = get_lang('Save');
         $form->setDefaults($categoryInfo);
         $form->addButtonSave($text);
     } else {
         $class = "add";
         $text = get_lang('AddCategory');
         $form->setDefaults(array('auth_course_child' => 'TRUE'));
         $form->addButtonCreate($text);
     }
     $form->display();
 } elseif (api_get_multiple_access_url() && api_get_current_access_url_id() != 1) {
     // If multiple URLs and not main URL, prevent edition and inform user
     Display::display_warning_message(get_lang('CourseCategoriesAreGlobal'));
开发者ID:secuencia24,项目名称:chamilo-lms,代码行数:31,代码来源:course_category.php

示例6: createForm

 /**
  * Creates the form to create / edit an exercise
  * @param FormValidator $form
  */
 public function createForm($form, $type = 'full')
 {
     if (empty($type)) {
         $type = 'full';
     }
     // form title
     if (!empty($_GET['exerciseId'])) {
         $form_title = get_lang('ModifyExercise');
     } else {
         $form_title = get_lang('NewEx');
     }
     $form->addElement('header', $form_title);
     // Title.
     $form->addElement('text', 'exerciseTitle', get_lang('ExerciseName'), array('id' => 'exercise_title'));
     $form->addElement('advanced_settings', 'advanced_params', get_lang('AdvancedParameters'));
     $form->addElement('html', '<div id="advanced_params_options" style="display:none">');
     $editor_config = array('ToolbarSet' => 'TestQuestionDescription', 'Width' => '100%', 'Height' => '150');
     if (is_array($type)) {
         $editor_config = array_merge($editor_config, $type);
     }
     $form->addHtmlEditor('exerciseDescription', get_lang('ExerciseDescription'), false, false, $editor_config);
     if ($type == 'full') {
         //Can't modify a DirectFeedback question
         if ($this->selectFeedbackType() != EXERCISE_FEEDBACK_TYPE_DIRECT) {
             // feedback type
             $radios_feedback = array();
             $radios_feedback[] = $form->createElement('radio', 'exerciseFeedbackType', null, get_lang('ExerciseAtTheEndOfTheTest'), '0', array('id' => 'exerciseType_0', 'onclick' => 'check_feedback()'));
             if (api_get_setting('exercise.enable_quiz_scenario') == 'true') {
                 //Can't convert a question from one feedback to another if there is more than 1 question already added
                 if ($this->selectNbrQuestions() == 0) {
                     $radios_feedback[] = $form->createElement('radio', 'exerciseFeedbackType', null, get_lang('DirectFeedback'), '1', array('id' => 'exerciseType_1', 'onclick' => 'check_direct_feedback()'));
                 }
             }
             $radios_feedback[] = $form->createElement('radio', 'exerciseFeedbackType', null, get_lang('NoFeedback'), '2', array('id' => 'exerciseType_2'));
             $form->addGroup($radios_feedback, null, array(get_lang('FeedbackType'), get_lang('FeedbackDisplayOptions')), '');
             // Type of results display on the final page
             $radios_results_disabled = array();
             $radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('ShowScoreAndRightAnswer'), '0', array('id' => 'result_disabled_0'));
             $radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('DoNotShowScoreNorRightAnswer'), '1', array('id' => 'result_disabled_1', 'onclick' => 'check_results_disabled()'));
             $radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('OnlyShowScore'), '2', array('id' => 'result_disabled_2'));
             //$radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('ExamModeWithFinalScoreShowOnlyFinalScoreWithCategoriesIfAvailable'),  '3', array('id'=>'result_disabled_3','onclick' => 'check_results_disabled()'));
             $form->addGroup($radios_results_disabled, null, get_lang('ShowResultsToStudents'), '');
             // Type of questions disposition on page
             $radios = array();
             $radios[] = $form->createElement('radio', 'exerciseType', null, get_lang('SimpleExercise'), '1', array('onclick' => 'check_per_page_all()', 'id' => 'option_page_all'));
             $radios[] = $form->createElement('radio', 'exerciseType', null, get_lang('SequentialExercise'), '2', array('onclick' => 'check_per_page_one()', 'id' => 'option_page_one'));
             $form->addGroup($radios, null, get_lang('QuestionsPerPage'), '');
         } else {
             // if is Directfeedback but has not questions we can allow to modify the question type
             if ($this->selectNbrQuestions() == 0) {
                 // feedback type
                 $radios_feedback = array();
                 $radios_feedback[] = $form->createElement('radio', 'exerciseFeedbackType', null, get_lang('ExerciseAtTheEndOfTheTest'), '0', array('id' => 'exerciseType_0', 'onclick' => 'check_feedback()'));
                 if (api_get_setting('exercise.enable_quiz_scenario') == 'true') {
                     $radios_feedback[] = $form->createElement('radio', 'exerciseFeedbackType', null, get_lang('DirectFeedback'), '1', array('id' => 'exerciseType_1', 'onclick' => 'check_direct_feedback()'));
                 }
                 $radios_feedback[] = $form->createElement('radio', 'exerciseFeedbackType', null, get_lang('NoFeedback'), '2', array('id' => 'exerciseType_2'));
                 $form->addGroup($radios_feedback, null, array(get_lang('FeedbackType'), get_lang('FeedbackDisplayOptions')));
                 //$form->addElement('select', 'exerciseFeedbackType',get_lang('FeedbackType'),$feedback_option,'onchange="javascript:feedbackselection()"');
                 $radios_results_disabled = array();
                 $radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('ShowScoreAndRightAnswer'), '0', array('id' => 'result_disabled_0'));
                 $radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('DoNotShowScoreNorRightAnswer'), '1', array('id' => 'result_disabled_1', 'onclick' => 'check_results_disabled()'));
                 $radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('OnlyShowScore'), '2', array('id' => 'result_disabled_2', 'onclick' => 'check_results_disabled()'));
                 $form->addGroup($radios_results_disabled, null, get_lang('ShowResultsToStudents'), '');
                 // Type of questions disposition on page
                 $radios = array();
                 $radios[] = $form->createElement('radio', 'exerciseType', null, get_lang('SimpleExercise'), '1');
                 $radios[] = $form->createElement('radio', 'exerciseType', null, get_lang('SequentialExercise'), '2');
                 $form->addGroup($radios, null, get_lang('ExerciseType'));
             } else {
                 //Show options freeze
                 $radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('ShowScoreAndRightAnswer'), '0', array('id' => 'result_disabled_0'));
                 $radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('DoNotShowScoreNorRightAnswer'), '1', array('id' => 'result_disabled_1', 'onclick' => 'check_results_disabled()'));
                 $radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('OnlyShowScore'), '2', array('id' => 'result_disabled_2', 'onclick' => 'check_results_disabled()'));
                 $result_disable_group = $form->addGroup($radios_results_disabled, null, get_lang('ShowResultsToStudents'), '');
                 $result_disable_group->freeze();
                 //we force the options to the DirectFeedback exercisetype
                 $form->addElement('hidden', 'exerciseFeedbackType', EXERCISE_FEEDBACK_TYPE_DIRECT);
                 $form->addElement('hidden', 'exerciseType', ONE_PER_PAGE);
                 // Type of questions disposition on page
                 $radios[] = $form->createElement('radio', 'exerciseType', null, get_lang('SimpleExercise'), '1', array('onclick' => 'check_per_page_all()', 'id' => 'option_page_all'));
                 $radios[] = $form->createElement('radio', 'exerciseType', null, get_lang('SequentialExercise'), '2', array('onclick' => 'check_per_page_one()', 'id' => 'option_page_one'));
                 $type_group = $form->addGroup($radios, null, get_lang('QuestionsPerPage'), '');
                 $type_group->freeze();
             }
         }
         // number of random question
         $max = $this->id > 0 ? $this->selectNbrQuestions() : 10;
         $option = range(0, $max);
         $option[0] = get_lang('No');
         $option[-1] = get_lang('AllQuestionsShort');
         $form->addElement('select', 'randomQuestions', array(get_lang('RandomQuestions'), get_lang('RandomQuestionsHelp')), $option, array('id' => 'randomQuestions'));
         // Random answers
         $radios_random_answers = array();
         $radios_random_answers[] = $form->createElement('radio', 'randomAnswers', null, get_lang('Yes'), '1');
         $radios_random_answers[] = $form->createElement('radio', 'randomAnswers', null, get_lang('No'), '0');
//.........这里部分代码省略.........
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:101,代码来源:exercise.class.php

示例7: array

$form->addText('department_name', get_lang('CourseDepartment'), false, array('size' => '60'));
$form->applyFilter('department_name', 'html_filter');
$form->applyFilter('department_name', 'trim');
// Department URL
$form->addText('department_url', get_lang('CourseDepartmentURL'), false, array('size' => '60'));
$form->applyFilter('department_url', 'html_filter');
$form->addElement('select_language', 'course_language', get_lang('CourseLanguage'));
$form->applyFilter('select_language', 'html_filter');
$form->addElement('checkbox', 'exemplary_content', '', get_lang('FillWithExemplaryContent'));
$group = array();
$group[] = $form->createElement('radio', 'visibility', get_lang('CourseAccess'), get_lang('OpenToTheWorld'), COURSE_VISIBILITY_OPEN_WORLD);
$group[] = $form->createElement('radio', 'visibility', null, get_lang('OpenToThePlatform'), COURSE_VISIBILITY_OPEN_PLATFORM);
$group[] = $form->createElement('radio', 'visibility', null, get_lang('Private'), COURSE_VISIBILITY_REGISTERED);
$group[] = $form->createElement('radio', 'visibility', null, get_lang('CourseVisibilityClosed'), COURSE_VISIBILITY_CLOSED);
$group[] = $form->createElement('radio', 'visibility', null, get_lang('CourseVisibilityHidden'), COURSE_VISIBILITY_HIDDEN);
$form->addGroup($group, '', get_lang('CourseAccess'), '<br />');
$group = array();
$group[] = $form->createElement('radio', 'subscribe', get_lang('Subscription'), get_lang('Allowed'), 1);
$group[] = $form->createElement('radio', 'subscribe', null, get_lang('Denied'), 0);
$form->addGroup($group, '', get_lang('Subscription'), '<br />');
$group = array();
$group[] = $form->createElement('radio', 'unsubscribe', get_lang('Unsubscription'), get_lang('AllowedToUnsubscribe'), 1);
$group[] = $form->createElement('radio', 'unsubscribe', null, get_lang('NotAllowedToUnsubscribe'), 0);
$form->addGroup($group, '', get_lang('Unsubscription'), '<br />');
$form->addElement('text', 'disk_quota', array(get_lang('CourseQuota'), null, get_lang('MB')));
$form->addRule('disk_quota', get_lang('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);
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:31,代码来源:course_add.php

示例8: FormValidator

 }
 // display form
 $form = new FormValidator('thematic_advance', 'POST', 'index.php?action=thematic_advance_list&thematic_id=' . $thematic_id . '&' . api_get_cidreq(), '', 'style="width: 100%;"');
 $form->addElement('header', $header_form);
 $form->addElement('hidden', 'thematic_advance_token', $token);
 $form->addElement('hidden', 'action', $action);
 if (!empty($thematic_advance_id)) {
     $form->addElement('hidden', 'thematic_advance_id', $thematic_advance_id);
 }
 if (!empty($thematic_id)) {
     $form->addElement('hidden', 'thematic_id', $thematic_id);
 }
 $radios = array();
 $radios[] = $form->createElement('radio', 'start_date_type', null, get_lang('StartDateFromAnAttendance'), '1', array('onclick' => 'check_per_attendance(this)', 'id' => 'from_attendance'));
 $radios[] = $form->createElement('radio', 'start_date_type', null, get_lang('StartDateCustom'), '2', array('onclick' => 'check_per_custom_date(this)', 'id' => 'custom_date'));
 $form->addGroup($radios, null, get_lang('StartDateOptions'));
 if (isset($thematic_advance_data['attendance_id']) && $thematic_advance_data['attendance_id'] == 0) {
     $form->addElement('html', '<div id="div_custom_datetime" style="display:block">');
 } else {
     $form->addElement('html', '<div id="div_custom_datetime" style="display:none">');
 }
 $form->addElement('datepicker', 'custom_start_date', get_lang('StartDate'), array('form_name' => 'thematic_advance'));
 $form->addElement('html', '</div>');
 if (isset($thematic_advance_data['attendance_id']) && $thematic_advance_data['attendance_id'] == 0) {
     $form->addElement('html', '<div id="div_datetime_by_attendance" style="display:none">');
 } else {
     $form->addElement('html', '<div id="div_datetime_by_attendance" style="display:block">');
 }
 if (count($attendance_select) > 1) {
     $form->addElement('select', 'attendance_select', get_lang('Attendances'), $attendance_select, array('id' => 'id_attendance_select', 'onchange' => 'datetime_by_attendance(this.value)'));
 } else {
开发者ID:annickvdp,项目名称:Chamilo1.9.10,代码行数:31,代码来源:thematic_advance.php

示例9: FormValidator

         if ($number_of_students > 0) {
             $base_group_options[$group['id']] = $group['name'] . ' (' . $number_of_students . ' ' . get_lang('Users') . ')';
         }
     }
     if (count($base_group_options) > 0) {
         $create_subgroups_form = new FormValidator('create_subgroups');
         $create_subgroups_form->addElement('header', get_lang('CreateSubgroups'));
         $create_subgroups_form->addElement('html', get_lang('CreateSubgroupsInfo'));
         $create_subgroups_form->addElement('hidden', 'action');
         $group_el = array();
         $group_el[] = $create_subgroups_form->createElement('static', null, null, get_lang('CreateNumberOfGroups'));
         $group_el[] = $create_subgroups_form->createElement('text', 'number_of_groups', null, array('size' => 3));
         $group_el[] = $create_subgroups_form->createElement('static', null, null, get_lang('WithUsersFrom'));
         $group_el[] = $create_subgroups_form->createElement('select', 'base_group', null, $base_group_options);
         $group_el[] = $create_subgroups_form->createElement('button', 'submit', get_lang('Ok'));
         $create_subgroups_form->addGroup($group_el, 'create_groups', null, ' ', false);
         $defaults = array();
         $defaults['action'] = 'create_subgroups';
         $create_subgroups_form->setDefaults($defaults);
         $create_subgroups_form->display();
     }
 }
 /*
  * Show form to generate groups from classes subscribed to the course
  */
 $options['where'] = array(" usergroup.course_id = ? " => api_get_real_course_id());
 $obj = new UserGroup();
 $classes = $obj->get_usergroup_in_course($options);
 if (count($classes) > 0) {
     echo '<b>' . get_lang('GroupsFromClasses') . '</b>';
     echo '<blockquote>';
开发者ID:annickvdp,项目名称:Chamilo1.9.10,代码行数:31,代码来源:group_creation.php

示例10: createAnswersForm


//.........这里部分代码省略.........
                         $defaults['weighting[' . $nb_matches . ']'] = float_format($answer->selectWeighting($i), 1);
                         $defaults['matches[' . $nb_matches . ']'] = $answer->correct[$i];
                     } else {
                         $nb_options++;
                         $defaults['option[' . $nb_options . ']'] = $answer->selectAnswer($i);
                     }
                 }
             }
         } else {
             $defaults['answer[1]'] = get_lang('DefaultMakeCorrespond1');
             $defaults['answer[2]'] = get_lang('DefaultMakeCorrespond2');
             $defaults['matches[2]'] = '2';
             $defaults['option[1]'] = get_lang('DefaultMatchingOptA');
             $defaults['option[2]'] = get_lang('DefaultMatchingOptB');
         }
     }
     if (empty($matches)) {
         for ($i = 1; $i <= $nb_options; ++$i) {
             // fill the array with A, B, C.....
             $matches[$i] = chr(64 + $i);
         }
     } else {
         for ($i = $counter; $i <= $nb_options; ++$i) {
             // fill the array with A, B, C.....
             $matches[$i] = chr(64 + $i);
         }
     }
     $form->addElement('hidden', 'nb_matches', $nb_matches);
     $form->addElement('hidden', 'nb_options', $nb_options);
     // DISPLAY MATCHES
     $html = '<table class="table table-striped table-hover">
         <thead>
             <tr>
                 <th width="5%">' . get_lang('Number') . '</th>
                 <th width="70%">' . get_lang('Answer') . '</th>
                 <th width="15%">' . get_lang('MatchesTo') . '</th>
                 <th width="10%">' . get_lang('Weighting') . '</th>
             </tr>
         </thead>
         <tbody>';
     $form->addHeader(get_lang('MakeCorrespond'));
     $form->addHtml($html);
     if ($nb_matches < 1) {
         $nb_matches = 1;
         Display::display_normal_message(get_lang('YouHaveToCreateAtLeastOneAnswer'));
     }
     for ($i = 1; $i <= $nb_matches; ++$i) {
         $renderer =& $form->defaultRenderer();
         $renderer->setElementTemplate('<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error -->{element}</td>', "answer[{$i}]");
         $renderer->setElementTemplate('<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error -->{element}</td>', "matches[{$i}]");
         $renderer->setElementTemplate('<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error -->{element}</td>', "weighting[{$i}]");
         $form->addHtml('<tr>');
         $form->addHtml("<td>{$i}</td>");
         $form->addText("answer[{$i}]", null);
         $form->addSelect("matches[{$i}]", null, $matches);
         $form->addText("weighting[{$i}]", null, true, ['value' => 10]);
         $form->addHtml('</tr>');
     }
     $form->addHtml('</tbody></table>');
     $group = array();
     $form->addGroup($group);
     // DISPLAY OPTIONS
     $html = '<table class="table table-striped table-hover">
         <thead>
             <tr>
                 <th width="15%">' . get_lang('Number') . '</th>
                 <th width="85%">' . get_lang('Answer') . '</th>
             </tr>
         </thead>
         <tbody>';
     $form->addHtml($html);
     if ($nb_options < 1) {
         $nb_options = 1;
         Display::display_normal_message(get_lang('YouHaveToCreateAtLeastOneAnswer'));
     }
     for ($i = 1; $i <= $nb_options; ++$i) {
         $renderer =& $form->defaultRenderer();
         $renderer->setElementTemplate('<td><!-- BEGIN error --><span class="form_error">{error}</span><!-- END error -->{element}</td>', "option[{$i}]");
         $form->addHtml('<tr>');
         $form->addHtml('<td>' . chr(64 + $i) . '</td>');
         $form->addText("option[{$i}]", null);
         $form->addHtml('</tr>');
     }
     $form->addHtml('</table>');
     $group = array();
     global $text;
     // setting the save button here and not in the question class.php
     $group[] = $form->addButtonDelete(get_lang('DelElem'), 'lessOptions', true);
     $group[] = $form->addButtonCreate(get_lang('AddElem'), 'moreOptions', true);
     $group[] = $form->addButtonSave($text, 'submitQuestion', true);
     $form->addGroup($group);
     if (!empty($this->id)) {
         $form->setDefaults($defaults);
     } else {
         if ($this->isContent == 1) {
             $form->setDefaults($defaults);
         }
     }
     $form->setConstants(array('nb_matches' => $nb_matches, 'nb_options' => $nb_options));
 }
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:101,代码来源:matching.class.php

示例11: get_settings_form

 /**
  * Returns an HTML form (generated by FormValidator) of the plugin settings
  * @return string FormValidator-generated form
  */
 public function get_settings_form()
 {
     $result = new FormValidator($this->get_name());
     $defaults = array();
     foreach ($this->fields as $name => $type) {
         $value = $this->get($name);
         $defaults[$name] = $value;
         $type = isset($type) ? $type : 'text';
         $help = null;
         if ($this->get_lang_plugin_exists($name . '_help')) {
             $help = $this->get_lang($name . '_help');
         }
         switch ($type) {
             case 'html':
                 $result->addElement('html', $this->get_lang($name));
                 break;
             case 'wysiwyg':
                 $result->add_html_editor($name, $this->get_lang($name));
                 break;
             case 'text':
                 $result->addElement($type, $name, array($this->get_lang($name), $help));
                 break;
             case 'boolean':
                 $group = array();
                 $group[] = $result->createElement('radio', $name, '', get_lang('Yes'), 'true');
                 $group[] = $result->createElement('radio', $name, '', get_lang('No'), 'false');
                 $result->addGroup($group, null, array($this->get_lang($name), $help));
                 break;
         }
     }
     $result->setDefaults($defaults);
     $result->addElement('style_submit_button', 'submit_button', $this->get_lang('Save'));
     return $result;
 }
开发者ID:ragebat,项目名称:chamilo-lms,代码行数:38,代码来源:plugin.class.php

示例12: array

            $attributes['checked'] = 'checked';
        }
        $element = Display::input('checkbox', $id, null, $attributes);
        $table->setCellContents($row, $column, $element);
        $form->addElement('hidden', 'hidden_' . $idForm, $value, array('id' => 'hidden_' . $id));
        $column++;
    }
    $row++;
}
if (!empty($roleId)) {
    $form->addElement('html', $table->toHtml());
    $group = array();
    $group[] = $form->createElement('button', 'submit', get_lang('Save'));
    $group[] = $form->createElement('button', 'select_all', get_lang('SelectAll'), array('class' => 'btn select_all'));
    $group[] = $form->createElement('button', 'unselect_all', get_lang('UnSelectAll'), array('class' => 'btn unselect_all'));
    $form->addGroup($group, '', null, ' ');
    $form->setDefaults(array('status' => $roleId));
} else {
    $form->addElement('button', 'submit', get_lang('Edit'));
}
$form->display();
if ($form->validate()) {
    $values = $form->getSubmitValues();
    $result = $values['hidden_extra_field_status'];
    if (!empty($result)) {
        foreach ($result as $id => $items) {
            foreach ($items as $subItemId => $value) {
                $extraFieldOptionRelFieldOption = $app['orm.em']->getRepository('Entity\\ExtraFieldOptionRelFieldOption')->findOneBy(array('fieldId' => $field_id, 'fieldOptionId' => $subItemId, 'roleId' => $roleId, 'relatedFieldOptionId' => $id));
                if ($value == 1) {
                    if (empty($extraFieldOptionRelFieldOption)) {
                        $extraFieldOptionRelFieldOption = new Entity\ExtraFieldOptionRelFieldOption();
开发者ID:ilosada,项目名称:chamilo-lms-icpna,代码行数:31,代码来源:extra_field_workflow.php

示例13: header

    Display::addFlash(Display::return_message(get_lang('SessionCategoryDelete')));
    header('Location: ' . api_get_self() . '?sort=' . $sort);
    exit;
}
//$interbreadcrumb[] = array("url" => "index.php", "name" => get_lang('PlatformAdmin'));
$interbreadcrumb[] = array('url' => 'session_list.php', 'name' => get_lang('SessionList'));
if (isset($_GET['search']) && $_GET['search'] == 'advanced') {
    $interbreadcrumb[] = array("url" => 'session_category_list.php', "name" => get_lang('ListSessionCategory'));
    $tool_name = get_lang('SearchASession');
    Display::display_header($tool_name);
    $form = new FormValidator('advanced_search', 'get');
    $form->addElement('header', '', $tool_name);
    $active_group = array();
    $active_group[] = $form->createElement('checkbox', 'active', '', get_lang('Active'));
    $active_group[] = $form->createElement('checkbox', 'inactive', '', get_lang('Inactive'));
    $form->addGroup($active_group, '', get_lang('ActiveSession'), '<br/>', false);
    $form->addButtonSearch(get_lang('SearchUsers'));
    $defaults['active'] = 1;
    $defaults['inactive'] = 1;
    $form->setDefaults($defaults);
    $form->display();
} else {
    $limit = 20;
    $from = $page * $limit;
    //if user is crfp admin only list its sessions
    $where = null;
    if (!api_is_platform_admin()) {
        $where .= empty($_REQUEST['keyword']) ? "" : " WHERE name LIKE '%" . Database::escape_string(trim($_REQUEST['keyword'])) . "%'";
    } else {
        $where .= empty($_REQUEST['keyword']) ? "" : " WHERE name LIKE '%" . Database::escape_string(trim($_REQUEST['keyword'])) . "%'";
    }
开发者ID:jloguercio,项目名称:chamilo-lms,代码行数:31,代码来源:session_category_list.php

示例14: generate_settings_form

function generate_settings_form($settings, $settings_by_access_list)
{
    global $_configuration, $settings_to_avoid, $convert_byte_to_mega_list;
    $table_settings_current = Database::get_main_table(TABLE_MAIN_SETTINGS_CURRENT);
    $form = new FormValidator('settings', 'post', 'settings.php?category=' . Security::remove_XSS($_GET['category']));
    $form->addElement('hidden', 'search_field', !empty($_GET['search_field']) ? Security::remove_XSS($_GET['search_field']) : null);
    $url_id = api_get_current_access_url_id();
    if (!empty($_configuration['multiple_access_urls']) && api_is_global_platform_admin() && $url_id == 1) {
        $group = array();
        $group[] = $form->createElement('button', 'mark_all', get_lang('MarkAll'));
        $group[] = $form->createElement('button', 'unmark_all', get_lang('UnmarkAll'));
        $form->addGroup($group, 'buttons_in_action_right');
    }
    $default_values = array();
    $url_info = api_get_access_url($url_id);
    $i = 0;
    foreach ($settings as $row) {
        if (in_array($row['variable'], array_keys($settings_to_avoid))) {
            continue;
        }
        if (!empty($_configuration['multiple_access_urls'])) {
            if (api_is_global_platform_admin()) {
                if ($row['access_url_locked'] == 0) {
                    if ($url_id == 1) {
                        if ($row['access_url_changeable'] == '1') {
                            $form->addElement('html', '<div style="float: right;"><a class="share_this_setting" data_status = "0"  data_to_send = "' . $row['variable'] . '" href="javascript:void(0);">' . Display::return_icon('shared_setting.png', get_lang('ChangeSharedSetting')) . '</a></div>');
                        } else {
                            $form->addElement('html', '<div style="float: right;"><a class="share_this_setting" data_status = "1" data_to_send = "' . $row['variable'] . '" href="javascript:void(0);">' . Display::return_icon('shared_setting_na.png', get_lang('ChangeSharedSetting')) . '</a></div>');
                        }
                    } else {
                        if ($row['access_url_changeable'] == '1') {
                            $form->addElement('html', '<div style="float: right;">' . Display::return_icon('shared_setting.png', get_lang('ChangeSharedSetting')) . '</div>');
                        } else {
                            $form->addElement('html', '<div style="float: right;">' . Display::return_icon('shared_setting_na.png', get_lang('ChangeSharedSetting')) . '</div>');
                        }
                    }
                }
            }
        }
        $hideme = array();
        $hide_element = false;
        if ($_configuration['access_url'] != 1) {
            if ($row['access_url_changeable'] == 0) {
                // We hide the element in other cases (checkbox, radiobutton) we 'freeze' the element.
                $hide_element = true;
                $hideme = array('disabled');
            } elseif ($url_info['active'] == 1) {
                // We show the elements.
                if (empty($row['variable'])) {
                    $row['variable'] = 0;
                }
                if (empty($row['subkey'])) {
                    $row['subkey'] = 0;
                }
                if (empty($row['category'])) {
                    $row['category'] = 0;
                }
                if (is_array($settings_by_access_list[$row['variable']][$row['subkey']][$row['category']])) {
                    // We are sure that the other site have a selected value.
                    if ($settings_by_access_list[$row['variable']][$row['subkey']][$row['category']]['selected_value'] != '') {
                        $row['selected_value'] = $settings_by_access_list[$row['variable']][$row['subkey']][$row['category']]['selected_value'];
                    }
                }
                // There is no else{} statement because we load the default $row['selected_value'] of the main Chamilo site.
            }
        }
        switch ($row['type']) {
            case 'textfield':
                if (in_array($row['variable'], $convert_byte_to_mega_list)) {
                    $form->addElement('text', $row['variable'], array(get_lang($row['title']), get_lang($row['comment']), get_lang('MB')), array('maxlength' => '8'));
                    $form->applyFilter($row['variable'], 'html_filter');
                    $default_values[$row['variable']] = round($row['selected_value'] / 1024 / 1024, 1);
                } elseif ($row['variable'] == 'account_valid_duration') {
                    $form->addElement('text', $row['variable'], array(get_lang($row['title']), get_lang($row['comment'])), array('maxlength' => '5'));
                    $form->applyFilter($row['variable'], 'html_filter');
                    $default_values[$row['variable']] = $row['selected_value'];
                    // For platform character set selection: Conversion of the textfield to a select box with valid values.
                } elseif ($row['variable'] == 'platform_charset') {
                    continue;
                } else {
                    $hideme['class'] = 'col-md-4';
                    $form->addElement('text', $row['variable'], array(get_lang($row['title']), get_lang($row['comment'])), $hideme);
                    $form->applyFilter($row['variable'], 'html_filter');
                    $default_values[$row['variable']] = $row['selected_value'];
                }
                break;
            case 'textarea':
                if ($row['variable'] == 'header_extra_content') {
                    $file = api_get_path(SYS_PATH) . api_get_home_path() . 'header_extra_content.txt';
                    $value = '';
                    if (file_exists($file)) {
                        $value = file_get_contents($file);
                    }
                    $form->addElement('textarea', $row['variable'], array(get_lang($row['title']), get_lang($row['comment'])), array('rows' => '10'), $hideme);
                    $default_values[$row['variable']] = $value;
                } elseif ($row['variable'] == 'footer_extra_content') {
                    $file = api_get_path(SYS_PATH) . api_get_home_path() . 'footer_extra_content.txt';
                    $value = '';
                    if (file_exists($file)) {
                        $value = file_get_contents($file);
//.........这里部分代码省略.........
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:101,代码来源:settings.lib.php

示例15: foreach

\t<div class="control-group">
\t\t<label>
\t\t\t<!-- BEGIN required --><span class="form_required">*</span> <!-- END required -->{label}
\t\t</label>
\t\t<div class="controls">
\t\t\t<table cellpadding="0" cellspacing="0">
\t\t\t\t<tr>
\t\t\t\t\t<!-- BEGIN error --><span class="form_error">{error}</span><br /><!-- END error -->\t<td>{element}</td>
\t\t\t\t</tr>
\t\t\t</table>
\t\t</div>
\t</div>
EOT;
$renderer = $form->defaultRenderer();
$renderer->setElementTemplate($element_template, 'group');
$form->addGroup($group, 'group', get_lang('CourseTeachers'), '</td><td width="80" align="center">' . '<input class="arrowr" style="width:30px;height:30px;padding-right:12px" type="button" onclick="moveItem(document.getElementById(\'platform_teachers\'), document.getElementById(\'course_teachers\'))"><br><br>' . '<input class="arrowl" style="width:30px;height:30px;padding-left:13px" type="button" onclick="moveItem(document.getElementById(\'course_teachers\'), document.getElementById(\'platform_teachers\'))"></td><td>');
if (array_key_exists('add_teachers_to_sessions_courses', $course)) {
    $form->addElement('checkbox', 'add_teachers_to_sessions_courses', null, get_lang('TeachersWillBeAddedAsCoachInAllCourseSessions'));
}
$coursesInSession = SessionManager::get_session_by_course($course['code']);
if (!empty($coursesInSession)) {
    foreach ($coursesInSession as $session) {
        $sessionId = $session['id'];
        $coaches = SessionManager::getCoachesByCourseSession($sessionId, $course['code']);
        $teachers = $allTeachers;
        $sessionTeachers = array();
        foreach ($coaches as $coachId) {
            $userInfo = api_get_user_info($coachId);
            $sessionTeachers[$coachId] = $userInfo['complete_name'];
            if (isset($teachers[$coachId])) {
                unset($teachers[$coachId]);
开发者ID:annickvdp,项目名称:Chamilo1.9.10,代码行数:31,代码来源:course_edit.php


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