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


PHP FormValidator::addSelect方法代码示例

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


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

示例1: render

 /**
  * @param FormValidator $form
  * @param array $questionData
  * @param array $answers
  */
 public function render(FormValidator $form, $questionData = array(), $answers = '')
 {
     $name = 'question' . $questionData['question_id'];
     $form->addSelect($name, null, $questionData['options']);
     if (!empty($answers)) {
         $form->setDefaults([$name => $answers]);
     }
 }
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:13,代码来源:ch_dropdown.php

示例2: render

 /**
  * @param FormValidator $form
  * @param array $questionData
  * @param array $answers
  */
 public function render(FormValidator $form, $questionData = array(), $answers = '')
 {
     $options = array('--' => '--');
     foreach ($questionData['options'] as $key => &$value) {
         $options[$key] = $value;
     }
     $name = 'question' . $questionData['question_id'];
     $form->addSelect($name, null, $options);
     if (!empty($answers)) {
         $form->setDefaults([$name => $answers]);
     }
 }
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:17,代码来源:ch_percentage.php

示例3: render

 /**
  * @param FormValidator $form
  * @param array $questionData
  * @param array $answers
  */
 public function render(FormValidator $form, $questionData = array(), $answers = array())
 {
     $defaults = [];
     foreach ($questionData['options'] as $key => &$value) {
         $options = array();
         for ($i = 1; $i <= $questionData['maximum_score']; $i++) {
             $options[$i] = $i;
         }
         $name = 'question' . $questionData['question_id'] . '[' . $key . ']';
         $form->addSelect($name, $value, $options);
         if (!empty($answers)) {
             if (in_array($key, array_keys($answers))) {
                 $defaults[$name] = $answers[$key];
             }
         }
     }
     if (!empty($defaults)) {
         $form->setDefaults($defaults);
     }
 }
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:25,代码来源:ch_score.php

示例4: FormValidator

$currentUserId = api_get_user_id();
$currentUser = $entityManager->find('ChamiloUserBundle:User', $currentUserId);
$allowExport = $currentUser ? $currentUser->getId() === $skillIssue->getUser()->getId() : false;
$allowComment = $currentUser ? Skill::userCanAddFeedbackToUser($currentUser, $skillIssue->getUser()) : false;
$skillIssueDate = api_get_local_time($skillIssue->getAcquiredSkillAt());
$skillIssueInfo = ['id' => $skillIssue->getId(), 'datetime' => api_format_date($skillIssueDate, DATE_TIME_FORMAT_SHORT), 'argumentation' => $skillIssue->getArgumentation(), 'source_name' => $skillIssue->getSourceName(), 'user_id' => $skillIssue->getUser()->getId(), 'user_complete_name' => $skillIssue->getUser()->getCompleteName(), 'skill_badge_image' => $skillIssue->getSkill()->getWebIconPath(), 'skill_name' => $skillIssue->getSkill()->getName(), 'skill_short_code' => $skillIssue->getSkill()->getShortCode(), 'skill_description' => $skillIssue->getSkill()->getDescription(), 'skill_criteria' => $skillIssue->getSkill()->getCriteria(), 'badge_asserion' => [$skillIssue->getAssertionUrl()], 'comments' => [], 'feedback_average' => $skillIssue->getAverage()];
$skillIssueComments = $skillIssue->getComments(true);
foreach ($skillIssueComments as $comment) {
    $commentDate = api_get_local_time($comment->getFeedbackDateTime());
    $skillIssueInfo['comments'][] = ['text' => $comment->getFeedbackText(), 'value' => $comment->getFeedbackValue(), 'giver_complete_name' => $comment->getFeedbackGiver()->getCompleteName(), 'datetime' => api_format_date($commentDate, DATE_TIME_FORMAT_SHORT)];
}
$form = new FormValidator('comment');
$form->addTextarea('comment', get_lang('NewComment'), ['rows' => 4]);
$form->applyFilter('comment', 'trim');
$form->addRule('comment', get_lang('ThisFieldIsRequired'), 'required');
$form->addSelect('value', [get_lang('Value'), get_lang('RateTheSkillInPractice')], ['-', 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);
$form->addHidden('user', $skillIssue->getUser()->getId());
$form->addHidden('issue', $skillIssue->getId());
$form->addButtonSend(get_lang('Send'));
if ($form->validate() && $allowComment) {
    $values = $form->exportValues();
    $skillUserComment = new Chamilo\CoreBundle\Entity\SkillRelUserComment();
    $skillUserComment->setFeedbackDateTime(new DateTime())->setFeedbackGiver($currentUser)->setFeedbackText($values['comment'])->setFeedbackValue($values['value'] ? $values['value'] : null)->setSkillRelUser($skillIssue);
    $entityManager->persist($skillUserComment);
    $entityManager->flush();
    header("Location: " . $skillIssue->getIssueUrl());
    exit;
}
if ($allowExport) {
    $backpack = 'https://backpack.openbadges.org/';
    $configBackpack = api_get_setting('openbadges_backpack');
开发者ID:secuencia24,项目名称:chamilo-lms,代码行数:31,代码来源:issued.php

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

示例6: getTaskForm

 /**
  * @param $blog_id
  * @return FormValidator
  */
 public static function getTaskForm($blog_id)
 {
     // Init
     $tbl_users = Database::get_main_table(TABLE_MAIN_USER);
     $tbl_blogs_rel_user = Database::get_course_table(TABLE_BLOGS_REL_USER);
     $tbl_blogs_tasks = Database::get_course_table(TABLE_BLOGS_TASKS);
     $course_id = api_get_course_int_id();
     // Get users in this blog / make select list of it
     $sql = "SELECT user.user_id, user.firstname, user.lastname, user.username\n\t\t\t\tFROM {$tbl_users} user\n\t\t\t\tINNER JOIN {$tbl_blogs_rel_user} blogs_rel_user\n\t\t\t\tON user.user_id = blogs_rel_user.user_id\n\t\t\t\tWHERE blogs_rel_user.c_id = {$course_id} AND blogs_rel_user.blog_id = '" . (int) $blog_id . "'";
     $result = Database::query($sql);
     $options = array();
     while ($user = Database::fetch_array($result)) {
         $username = api_htmlentities(sprintf(get_lang('LoginX'), $user['username']), ENT_QUOTES);
         $options[$user['user_id']] = api_get_person_name($user['firstname'], $user['lastname']);
     }
     // Get tasks in this blog / make select list of it
     $sql = "\n\t\t\tSELECT\n\t\t\t\tblog_id,\n\t\t\t\ttask_id,\n\t\t\t\tblog_id,\n\t\t\t\ttitle,\n\t\t\t\tdescription,\n\t\t\t\tcolor,\n\t\t\t\tsystem_task\n\t\t\tFROM " . $tbl_blogs_tasks . "\n\t\t\tWHERE c_id = {$course_id} AND blog_id = " . (int) $blog_id . "\n\t\t\tORDER BY system_task, title";
     $result = Database::query($sql);
     $taskOptions = array();
     while ($task = Database::fetch_array($result)) {
         $taskOptions[$task['task_id']] = stripslashes($task['title']);
     }
     $form = new FormValidator('assign_task', 'post', api_get_path(WEB_CODE_PATH) . 'blog/blog.php?action=manage_tasks&blog_id=' . $blog_id);
     $form->addHeader(get_lang('AssignTask'));
     $form->addSelect('task_user_id', get_lang('SelectUser'), $options);
     $form->addSelect('task_task_id', get_lang('SelectTask'), $taskOptions);
     $form->addDatePicker('task_day', get_lang('SelectTargetDate'));
     $form->addHidden('action', '');
     $form->addButtonSave(get_lang('Ok'));
     return $form;
 }
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:35,代码来源:blog.lib.php

示例7: array

$condition = array('status = ?' => 1);
if ($form->validate()) {
    $data = $form->getSubmitValues();
    $filter = intval($data['filter']);
    if (!empty($filter)) {
        $condition = array('status = ? AND id = ? ' => array(1, $filter));
    }
}
$careers = $career->get_all(array('status = ?' => 1));
//only status =1
$career_select_list = array();
$career_select_list[0] = ' -- ' . get_lang('Select') . ' --';
foreach ($careers as $item) {
    $career_select_list[$item['id']] = $item['name'];
}
$form->addSelect('filter', get_lang('Career'), $career_select_list, array('id' => 'filter_1'));
$form->addButtonSearch(get_lang('Filter'));
// action links
echo '<div class="actions" style="margin-bottom:20px">';
echo '<a href="../admin/index.php">' . Display::return_icon('back.png', get_lang('BackTo') . ' ' . get_lang('PlatformAdmin'), '', ICON_SIZE_MEDIUM) . '</a>';
echo '<a href="careers.php">' . Display::return_icon('career.png', get_lang('Careers'), '', ICON_SIZE_MEDIUM) . '</a>';
echo '<a href="promotions.php">' . Display::return_icon('promotion.png', get_lang('Promotions'), '', ICON_SIZE_MEDIUM) . '</a>';
echo '</div>';
$form->display();
$careers = $career->get_all($condition);
//only status =1
$column_count = 3;
$i = 0;
$grid_js = '';
$career_array = array();
if (!empty($careers)) {
开发者ID:feroli1000,项目名称:chamilo-lms,代码行数:31,代码来源:career_dashboard.php

示例8: UserGroup

    $("#group_filter").change(function() {
        window.location = "class.php?' . api_get_cidreq() . '&type=' . $type . '" +"&group_filter=" + $(this).val();
    });
});
</script>';
$actions = '';
$usergroup = new UserGroup();
if (api_is_allowed_to_edit()) {
    $actions .= '<div class="actions">';
    if ($type == 'registered') {
        $actions .= '<a href="class.php?' . api_get_cidreq() . '&type=not_registered">' . Display::return_icon('add-class.png', get_lang("AddClassesToACourse"), array(), ICON_SIZE_MEDIUM) . '</a>';
    } else {
        $actions .= '<a href="class.php?' . api_get_cidreq() . '&type=registered">' . Display::return_icon('back.png', get_lang("Classes"), array(), ICON_SIZE_MEDIUM) . '</a>';
        $form = new FormValidator('groups', 'post', api_get_self(), '', '', FormValidator::LAYOUT_INLINE);
        $options = [-1 => get_lang('All'), 1 => get_lang('SocialGroups'), 0 => get_lang('Classes')];
        $form->addSelect('group_filter', get_lang('Groups'), $options, ['id' => 'group_filter']);
        $form->setDefaults(['group_filter' => $groupFilter]);
        $actions .= $form->returnForm();
    }
    $actions .= '</div>';
}
if (api_is_allowed_to_edit()) {
    $action = isset($_GET['action']) ? $_GET['action'] : null;
    switch ($action) {
        case 'add_class_to_course':
            $id = $_GET['id'];
            if (!empty($id)) {
                $usergroup->subscribe_courses_to_usergroup($id, array(api_get_course_int_id()), false);
                Display::addFlash(Display::return_message(get_lang('Added')));
            }
            break;
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:31,代码来源:class.php

示例9: get_search_form

 /**
  * Show the search form
  * @param string $query the value of the search box
  * @return string HTML form
  */
 public static function get_search_form($query)
 {
     $searchType = isset($_GET['search_type']) ? $_GET['search_type'] : null;
     $form = new FormValidator('search_user', 'get', api_get_path(WEB_PATH) . 'main/social/search.php', '', array(), FormValidator::LAYOUT_HORIZONTAL);
     $form->addText('q', get_lang('UsersGroups'), false);
     $options = array(0 => get_lang('Select'), 1 => get_lang('User'), 2 => get_lang('Group'));
     $form->addSelect('search_type', get_lang('Type'), $options, array('onchange' => 'javascript: extra_field_toogle();'));
     // Extra fields
     $extraFields = UserManager::get_extra_filtrable_fields();
     $defaults = [];
     if (is_array($extraFields) && count($extraFields) > 0) {
         foreach ($extraFields as $extraField) {
             $varName = 'field_' . $extraField['variable'];
             $options = [0 => get_lang('Select')];
             foreach ($extraField['data'] as $option) {
                 $checked = '';
                 if (isset($_GET[$varName])) {
                     if ($_GET[$varName] == $option[1]) {
                         $defaults[$option[1]] = true;
                     }
                 }
                 $options[$option[1]] = $option[1];
             }
             $form->addSelect($varName, $extraField['name'], $options);
         }
     }
     $defaults['search_type'] = intval($searchType);
     $defaults['q'] = api_htmlentities(Security::remove_XSS($query));
     $form->setDefaults($defaults);
     $form->addButtonSearch(get_lang('Search'));
     $js = '<script>
     extra_field_toogle();
     function extra_field_toogle() {
         if (jQuery("select[name=search_type]").val() != "1") { jQuery(".extra_field").hide(); } else { jQuery(".extra_field").show(); }
     }
     </script>';
     return $js . $form->returnForm();
 }
开发者ID:secuencia24,项目名称:chamilo-lms,代码行数:43,代码来源:usermanager.lib.php

示例10: Template

/* 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);
$template->assign('months', $months);
$template->assign('exportAllLink', $exportAllLink);
$template->assign('certificateStudents', $certificateStudents);
$content = $template->fetch("default/gradebook/certificate_report.tpl");
$template->assign('content', $content);
$template->display_one_col_template();
Session::erase('reportErrorMessage');
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:31,代码来源:certificate_report.php

示例11: set_extra_fields_in_form


//.........这里部分代码省略.........
                                        $values[$sub_option['id']] = $sub_option['display_text'];
                                    } else {
                                        if ($first_id === $sub_option['option_value']) {
                                            $second_values[$sub_option['id']] = $sub_option['display_text'];
                                        }
                                    }
                                }
                            }
                        }
                        $group = array();
                        $group[] = $form->createElement('select', 'extra_' . $field_details['variable'], null, $values, array('id' => $first_select_id));
                        $group[] = $form->createElement('select', 'extra_' . $field_details['variable'] . '_second', null, $second_values, array('id' => 'second_extra_' . $field_details['variable']));
                        $form->addGroup($group, 'extra_' . $field_details['variable'], $field_details['display_text'], '&nbsp;');
                        if (!$admin_permissions) {
                            if ($field_details['visible'] == 0) {
                                $form->freeze('extra_' . $field_details['variable']);
                            }
                        }
                        break;
                    case ExtraField::FIELD_TYPE_DIVIDER:
                        $form->addElement('static', $field_details['variable'], '<br /><strong>' . $field_details['display_text'] . '</strong>');
                        break;
                    case ExtraField::FIELD_TYPE_TAG:
                        $variable = $field_details['variable'];
                        $field_id = $field_details['id'];
                        //Added for correctly translate the extra_field
                        $get_lang_variables = false;
                        if (in_array($variable, ['tags'])) {
                            $get_lang_variables = true;
                        }
                        if ($get_lang_variables) {
                            $field_details['display_text'] = get_lang($field_details['display_text']);
                        }
                        $tagsSelect = $form->addSelect("extra_{$field_details['variable']}", $field_details['display_text']);
                        $tagsSelect->setAttribute('class', null);
                        $tagsSelect->setAttribute('id', "extra_{$field_details['variable']}");
                        $tagsSelect->setMultiple(true);
                        if ($this->type == 'user') {
                            /* //the magic should be here
                                                        $user_tags = UserManager::get_user_tags($user_id, $field_details[0]);
                            
                                                        $tag_list = '';
                                                        if (is_array($user_tags) && count($user_tags) > 0) {
                                                            foreach ($user_tags as $tag) {
                                                                $tag_list .= '<option value="'.$tag['tag'].'" class="selected">'.$tag['tag'].'</option>';
                                                            }
                                                        }
                            
                                                        $multi_select = '<select id="extra_'.$field_details[1].'" name="extra_'.$field_details[1].'">
                                                                '.$tag_list.'
                                                                </select>';
                            
                                                        $form->addElement('label', $field_details[3], $multi_select);
                                                        $url = api_get_path(WEB_AJAX_PATH).'user_manager.ajax.php';
                                                        $complete_text = get_lang('StartToType');
                                                        //if cache is set to true the jquery will be called 1 time
                                                        $jquery_ready_content = <<<EOF
                                                $("#extra_$field_details[1]").fcbkcomplete({
                                                    json_url: "$url?a=search_tags&field_id=$field_details[0]",
                                                    cache: false,
                                                    filter_case: true,
                                                    filter_hide: true,
                                                    complete_text:"$complete_text",
                                                    firstselected: true,
                                                    //onremove: "testme",
                                                    //onselect: "testme",
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:67,代码来源:extra_field.lib.php

示例12: array

$condition = array('status = ?' => 1);
if ($form->validate()) {
    $data = $form->getSubmitValues();
    $filter = intval($data['filter']);
    if (!empty($filter)) {
        $condition = array('status = ? AND id = ? ' => array(1, $filter));
    }
}
$careers = $career->get_all(array('status = ?' => 1));
//only status =1
$career_select_list = array();
$career_select_list[0] = ' -- ' . get_lang('Select') . ' --';
foreach ($careers as $item) {
    $career_select_list[$item['id']] = $item['name'];
}
$form->addSelect('filter', get_lang('Career'), $career_select_list, array('id' => 'filter_1', 'class' => 'chzn-select'));
$form->addButtonSearch(get_lang('Filter'));
// action links
echo '<div class="actions" style="margin-bottom:20px">';
echo '<a href="../admin/index.php">' . Display::return_icon('back.png', get_lang('BackTo') . ' ' . get_lang('PlatformAdmin'), '', ICON_SIZE_MEDIUM) . '</a>';
echo '<a href="careers.php">' . Display::return_icon('career.png', get_lang('Careers'), '', ICON_SIZE_MEDIUM) . '</a>';
echo '<a href="promotions.php">' . Display::return_icon('promotion.png', get_lang('Promotions'), '', ICON_SIZE_MEDIUM) . '</a>';
echo '</div>';
$form->display();
$careers = $career->get_all($condition);
//only status =1
$column_count = 3;
$i = 0;
$grid_js = '';
$career_array = array();
if (!empty($careers)) {
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:31,代码来源:career_dashboard.php

示例13: FormValidator

                Export::arrayToCsv($listToExport, $archiveFile);
            case 'xls':
                Export::arrayToXls($listToExport, $archiveFile);
                break;
        }
    } else {
        Display::addFlash(Display::return_message(get_lang('ThereAreNotSelectedCoursesOrCoursesListIsEmpty')));
    }
}
Display::display_header($tool_name);
$form = new FormValidator('export', 'post', api_get_self());
$form->addHeader($tool_name);
$form->addHidden('formSent', 1);
$form->addElement('radio', 'select_type', get_lang('Option'), get_lang('ExportAllCoursesList'), '1', ['onclick' => "javascript: if(this.checked){document.getElementById('div-course-list').style.display='none';}"]);
$form->addElement('radio', 'select_type', '', get_lang('ExportSelectedCoursesFromCoursesList'), '2', ['onclick' => "javascript: if(this.checked){document.getElementById('div-course-list').style.display='block';}"]);
if (!empty($course_list)) {
    $form->addHtml('<div id="div-course-list" style="display:none">');
    $coursesInList = [];
    foreach ($course_list as $course) {
        $coursesInList[$course['code']] = $course['title'] . ' (' . $course['code'] . ')';
    }
    $form->addSelect('course_code', get_lang('WhichCoursesToExport'), $coursesInList, ['multiple' => 'multiple']);
    $form->addHtml('</div>');
}
$form->addElement('radio', 'file_type', get_lang('OutputFileType'), 'CSV', 'csv', null);
$form->addElement('radio', 'file_type', '', 'XLS', 'xls', null);
$form->addElement('radio', 'file_type', null, 'XML', 'xml', null, array('id' => 'file_type_xml'));
$form->setDefaults(['select_type' => '1', 'file_type' => 'csv']);
$form->addButtonExport(get_lang('ExportCourses'));
$form->display();
Display::display_footer();
开发者ID:jloguercio,项目名称:chamilo-lms,代码行数:31,代码来源:course_export.php

示例14: FormValidator

$searchTerm = '';
$form = new FormValidator('search', 'get');
if ($form->validate()) {
    $selectedFilterType = $form->getSubmitValue('filter_type');
    $selectedStatus = $form->getSubmitValue('status');
    $searchTerm = $form->getSubmitValue('user');
    if ($selectedStatus === false) {
        $selectedStatus = BuyCoursesPlugin::SALE_STATUS_PENDING;
    }
    if ($selectedFilterType === false) {
        $selectedFilterType = '0';
    }
}
$form->addRadio('filter_type', get_lang('Filter'), [$plugin->get_lang('ByStatus'), $plugin->get_lang('ByUser')]);
$form->addHtml('<div id="report-by-status" ' . ($selectedFilterType !== '0' ? 'style="display:none"' : '') . '>');
$form->addSelect('status', $plugin->get_lang('OrderStatus'), $saleStatuses);
$form->addHtml('</div>');
$form->addHtml('<div id="report-by-user" ' . ($selectedFilterType !== '1' ? 'style="display:none"' : '') . '>');
$form->addText('user', get_lang('UserName'), false);
$form->addHtml('</div>');
$form->addButtonFilter(get_lang('Search'));
$form->setDefaults(['filter_type' => $selectedFilterType, 'status' => $selectedStatus]);
switch ($selectedFilterType) {
    case '0':
        $sales = $plugin->getSaleListByStatus($selectedStatus);
        break;
    case '1':
        $sales = $plugin->getSaleListByUser($searchTerm);
        break;
}
$saleList = [];
开发者ID:secuencia24,项目名称:chamilo-lms,代码行数:31,代码来源:sales_report.php

示例15: createAnswersForm

 /**
  * Function which redefines Question::createAnswersForm
  * @param FormValidator $form
  */
 public function createAnswersForm($form)
 {
     $defaults = array();
     $nb_matches = $nb_options = 2;
     $matches = array();
     $answer = null;
     if ($form->isSubmitted()) {
         $nb_matches = $form->getSubmitValue('nb_matches');
         $nb_options = $form->getSubmitValue('nb_options');
         if (isset($_POST['lessMatches'])) {
             $nb_matches--;
         }
         if (isset($_POST['moreMatches'])) {
             $nb_matches++;
         }
         if (isset($_POST['lessOptions'])) {
             $nb_options--;
         }
         if (isset($_POST['moreOptions'])) {
             $nb_options++;
         }
     } else {
         if (!empty($this->id)) {
             $answer = new Answer($this->id);
             $answer->read();
             if (count($answer->nbrAnswers) > 0) {
                 $nb_matches = $nb_options = 0;
                 for ($i = 1; $i <= $answer->nbrAnswers; $i++) {
                     if ($answer->isCorrect($i)) {
                         $nb_matches++;
                         $defaults['answer[' . $nb_matches . ']'] = $answer->selectAnswer($i);
                         $defaults['weighting[' . $nb_matches . ']'] = float_format($answer->selectWeighting($i), 1);
                         $answerInfo = $answer->getAnswerByAutoId($answer->correct[$i]);
                         $defaults['matches[' . $nb_matches . ']'] = isset($answerInfo['answer']) ? $answerInfo['answer'] : '';
                     } 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');
         }
     }
     for ($i = 1; $i <= $nb_matches; ++$i) {
         $matches[$i] = $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="85%">' . 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->addText("answer[{$i}]", null);
         $form->addSelect("matches[{$i}]", null, $matches);
         $form->addText("weighting[{$i}]", null, true, ['value' => 10, 'style' => 'width: 60px;']);
         $form->addHtml('</tr>');
     }
     $form->addHtml('</tbody></table>');
     $renderer->setElementTemplate('<div class="form-group"><div class="col-sm-offset-2">{element}', 'lessMatches');
     $renderer->setElementTemplate('{element}</div></div>', 'moreMatches');
     global $text;
     $group = [$form->addButtonDelete(get_lang('DelElem'), 'lessMatches', true), $form->addButtonCreate(get_lang('AddElem'), 'moreMatches', true), $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(['nb_matches' => $nb_matches, 'nb_options' => $nb_options]);
 }
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:99,代码来源:Draggable.php


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