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


PHP FormValidator::addDatePicker方法代码示例

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


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

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

示例2: set_extra_fields_in_form


//.........这里部分代码省略.........
                                                                $table->setCellContents($row, $column, $fieldValue);
                                                                $column++;
                                                                $table->setCellContents($row, $column, $comment);
                                                                $column++;
                                                                $table->setCellContents($row, $column, api_get_local_time($log->getLoggedAt()->format('Y-m-d H:i:s')));
                                                                $column++;
                                                                $table->setCellContents($row, $column, $log->getUsername());
                                                                $row++;
                                                            }
                                                            $form->addElement('label', null, $html.$table->toHtml());
                                                        }
                                                    }
                                                }
                                                */
                        if (!$admin_permissions) {
                            if ($field_details['visible'] == 0) {
                                $form->freeze('extra_' . $field_details['variable']);
                            }
                        }
                        break;
                    case ExtraField::FIELD_TYPE_SELECT_MULTIPLE:
                        $options = array();
                        foreach ($field_details['options'] as $option_id => $option_details) {
                            $options[$option_details['option_value']] = $option_details['display_text'];
                        }
                        $form->addElement('select', 'extra_' . $field_details['variable'], $field_details['display_text'], $options, array('multiple' => 'multiple'));
                        if (!$admin_permissions) {
                            if ($field_details['visible'] == 0) {
                                $form->freeze('extra_' . $field_details['variable']);
                            }
                        }
                        break;
                    case ExtraField::FIELD_TYPE_DATE:
                        $form->addDatePicker('extra_' . $field_details['variable'], $field_details['display_text']);
                        if (!$admin_permissions) {
                            if ($field_details['visible'] == 0) {
                                $form->freeze('extra_' . $field_details['variable']);
                            }
                        }
                        $form->applyFilter('theme', 'trim');
                        break;
                    case ExtraField::FIELD_TYPE_DATETIME:
                        $form->addDateTimePicker('extra_' . $field_details['variable'], $field_details['display_text']);
                        $defaults['extra_' . $field_details['variable']] = api_get_local_time();
                        if (!isset($form->_defaultValues['extra_' . $field_details['variable']])) {
                            $form->setDefaults($defaults);
                        }
                        if (!$admin_permissions) {
                            if ($field_details['visible'] == 0) {
                                $form->freeze('extra_' . $field_details['variable']);
                            }
                        }
                        $form->applyFilter('theme', 'trim');
                        break;
                    case ExtraField::FIELD_TYPE_DOUBLE_SELECT:
                        $first_select_id = 'first_extra_' . $field_details['variable'];
                        $url = api_get_path(WEB_AJAX_PATH) . 'extra_field.ajax.php?1=1';
                        $jquery_ready_content .= '
                        $("#' . $first_select_id . '").on("change", function() {
                            var id = $(this).val();
                            if (id) {
                                $.ajax({
                                    url: "' . $url . '&a=get_second_select_options",
                                    dataType: "json",
                                    data: "type=' . $type . '&field_id=' . $field_details['id'] . '&option_value_id="+id,
                                    success: function(data) {
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:67,代码来源:extra_field.lib.php

示例3: intval

    /**
     * @param FormValidator $form
     * @param $extra_data
     * @param $form_name
     * @param bool $admin_permissions
     * @param null $user_id
     * @deprecated
     * @return array
     */
    static function set_extra_fields_in_form($form, $extra_data, $admin_permissions = false, $user_id = null)
    {
        $user_id = intval($user_id);
        // EXTRA FIELDS
        $extra = UserManager::get_extra_fields(0, 50, 5, 'ASC');
        $jquery_ready_content = null;
        foreach ($extra as $field_details) {
            if (!$admin_permissions) {
                if ($field_details[6] == 0) {
                    continue;
                }
            }
            switch ($field_details[2]) {
                case ExtraField::FIELD_TYPE_TEXT:
                    $form->addElement('text', 'extra_' . $field_details[1], $field_details[3], array('size' => 40));
                    $form->applyFilter('extra_' . $field_details[1], 'stripslashes');
                    $form->applyFilter('extra_' . $field_details[1], 'trim');
                    $form->applyFilter('extra_' . $field_details[1], 'html_filter');
                    if (!$admin_permissions) {
                        if ($field_details[7] == 0) {
                            $form->freeze('extra_' . $field_details[1]);
                        }
                    }
                    break;
                case ExtraField::FIELD_TYPE_TEXTAREA:
                    $form->addHtmlEditor('extra_' . $field_details[1], $field_details[3], false, false, array('ToolbarSet' => 'Profile', 'Width' => '100%', 'Height' => '130'));
                    $form->applyFilter('extra_' . $field_details[1], 'stripslashes');
                    $form->applyFilter('extra_' . $field_details[1], 'trim');
                    if (!$admin_permissions) {
                        if ($field_details[7] == 0) {
                            $form->freeze('extra_' . $field_details[1]);
                        }
                    }
                    break;
                case ExtraField::FIELD_TYPE_RADIO:
                    $group = array();
                    foreach ($field_details[9] as $option_id => $option_details) {
                        $options[$option_details[1]] = $option_details[2];
                        $group[] = $form->createElement('radio', 'extra_' . $field_details[1], $option_details[1], $option_details[2] . '<br />', $option_details[1]);
                    }
                    $form->addGroup($group, 'extra_' . $field_details[1], $field_details[3], '');
                    if (!$admin_permissions) {
                        if ($field_details[7] == 0) {
                            $form->freeze('extra_' . $field_details[1]);
                        }
                    }
                    break;
                case ExtraField::FIELD_TYPE_SELECT:
                    $get_lang_variables = false;
                    if (in_array($field_details[1], array('mail_notify_message', 'mail_notify_invitation', 'mail_notify_group_message'))) {
                        $get_lang_variables = true;
                    }
                    $options = array();
                    foreach ($field_details[9] as $option_id => $option_details) {
                        if ($get_lang_variables) {
                            $options[$option_details[1]] = get_lang($option_details[2]);
                        } else {
                            $options[$option_details[1]] = $option_details[2];
                        }
                    }
                    if ($get_lang_variables) {
                        $field_details[3] = get_lang($field_details[3]);
                    }
                    $form->addElement('select', 'extra_' . $field_details[1], $field_details[3], $options, array('id' => 'extra_' . $field_details[1]));
                    if (!$admin_permissions) {
                        if ($field_details[7] == 0) {
                            $form->freeze('extra_' . $field_details[1]);
                        }
                    }
                    break;
                case ExtraField::FIELD_TYPE_SELECT_MULTIPLE:
                    $options = array();
                    foreach ($field_details[9] as $option_id => $option_details) {
                        $options[$option_details[1]] = $option_details[2];
                    }
                    $form->addElement('select', 'extra_' . $field_details[1], $field_details[3], $options, array('multiple' => 'multiple'));
                    if (!$admin_permissions) {
                        if ($field_details[7] == 0) {
                            $form->freeze('extra_' . $field_details[1]);
                        }
                    }
                    break;
                case ExtraField::FIELD_TYPE_DATE:
                    $form->addDatePicker('extra_' . $field_details[1], $field_details[3]);
                    $defaults['extra_' . $field_details[1]] = date('Y-m-d 12:00:00');
                    $form->setDefaults($defaults);
                    if (!$admin_permissions) {
                        if ($field_details[7] == 0) {
                            $form->freeze('extra_' . $field_details[1]);
                        }
                    }
//.........这里部分代码省略.........
开发者ID:secuencia24,项目名称:chamilo-lms,代码行数:101,代码来源:usermanager.lib.php

示例4: array

// Form title
$form->addElement('header', get_lang('AddLpToStart'));
// Title
$form->addElement('text', 'lp_name', api_ucfirst(get_lang('LPName')), array('autofocus' => 'autofocus'));
$form->applyFilter('lp_name', 'html_filter');
$form->addRule('lp_name', get_lang('ThisFieldIsRequired'), 'required');
$form->addElement('hidden', 'post_time', time());
$form->addElement('hidden', 'action', 'add_lp');
$form->addButtonAdvancedSettings('advanced_params');
$form->addElement('html', '<div id="advanced_params_options" style="display:none">');
$items = learnpath::getCategoryFromCourseIntoSelect(api_get_course_int_id(), true);
$form->addElement('select', 'category_id', get_lang('Category'), $items);
// Start date
$form->addElement('checkbox', 'activate_start_date_check', null, get_lang('EnableStartTime'), array('onclick' => 'activate_start_date()'));
$form->addElement('html', '<div id="start_date_div" style="display:block;">');
$form->addDatePicker('publicated_on', get_lang('PublicationDate'));
$form->addElement('html', '</div>');
//End date
$form->addElement('checkbox', 'activate_end_date_check', null, get_lang('EnableEndTime'), array('onclick' => 'activate_end_date()'));
$form->addElement('html', '<div id="end_date_div" style="display:none;">');
$form->addDatePicker('expired_on', get_lang('ExpirationDate'));
$form->addElement('html', '</div>');
$form->addElement('html', '</div>');
$defaults['activate_start_date_check'] = 1;
$defaults['publicated_on'] = date('Y-m-d 08:00:00');
$defaults['expired_on'] = date('Y-m-d 08:00:00', time() + 86400);
$form->setDefaults($defaults);
$form->addButtonCreate(get_lang('CreateLearningPath'));
$form->display();
// Footer
Display::display_footer();
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:31,代码来源:lp_add.php


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