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


PHP FormValidator::addLabel方法代码示例

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


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

示例1: FormValidator

    $output .= '<tr>
                <td>' . GradebookUtils::build_type_icon_tag('evalnotempty') . '</td>
                <td>' . $evaluationRow['name'] . ' ' . Display::label(get_lang('Evaluation')) . '</td>';
    $output .= '<td>
                    <input type="hidden" name="eval_' . $evaluationRow['id'] . '" value="' . $evaluationRow['name'] . '" />
                    <input type="text" size="10" name="evaluation[' . $evaluationRow['id'] . ']" value="' . $item_weight . '"/>
                </td></tr>';
}
$my_api_cidreq = api_get_cidreq();
if ($my_api_cidreq == '') {
    $my_api_cidreq = 'cidReq=' . $my_category['course_code'];
}
$currentUrl = api_get_self() . '?' . api_get_cidreq() . '&selectcat=' . $my_selectcat;
$form = new FormValidator('auto_weight', 'post', $currentUrl);
$form->addHeader(get_lang('AutoWeight'));
$form->addLabel(null, get_lang('AutoWeightExplanation'));
$form->addButtonUpdate(get_lang('AutoWeight'));
if ($form->validate()) {
    $itemCount = count($links) + count($evaluations);
    $weight = round($original_total / $itemCount, 2);
    $total = $weight * $itemCount;
    $diff = null;
    if ($original_total !== $total) {
        if ($total > $original_total) {
            $diff = $total - $original_total;
        }
    }
    $total = 0;
    $diffApplied = false;
    foreach ($links as $link) {
        $weightToApply = $weight;
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:31,代码来源:gradebook_edit_all.php

示例2: manage_form

function manage_form($default, $select_from_user_list = null, $sent_to = null)
{
    $group_id = isset($_REQUEST['group_id']) ? intval($_REQUEST['group_id']) : null;
    $message_id = isset($_GET['message_id']) ? intval($_GET['message_id']) : null;
    $param_f = isset($_GET['f']) && $_GET['f'] == 'social' ? 'social' : null;
    $form = new FormValidator('compose_message', null, api_get_self() . '?f=' . $param_f, null, array('enctype' => 'multipart/form-data'));
    if (empty($group_id)) {
        if (isset($select_from_user_list)) {
            $form->addText('id_text_name', get_lang('SendMessageTo'), true, array('id' => 'id_text_name', 'onkeyup' => 'send_request_and_search()', 'autocomplete' => 'off'));
            $form->addRule('id_text_name', get_lang('ThisFieldIsRequired'), 'required');
            $form->addElement('html', '<div id="id_div_search" style="padding:0px" class="message-select-box" >&nbsp;</div>');
            $form->addElement('hidden', 'user_list', 0, array('id' => 'user_list'));
        } else {
            if (!empty($sent_to)) {
                $form->addLabel(get_lang('SendMessageTo'), $sent_to);
            }
            if (empty($default['users'])) {
                //fb select
                $form->addElement('select_ajax', 'users', get_lang('SendMessageTo'), array(), ['multiple' => 'multiple', 'url' => api_get_path(WEB_AJAX_PATH) . 'message.ajax.php?a=find_users']);
            } else {
                $form->addElement('hidden', 'hidden_user', $default['users'][0], array('id' => 'hidden_user'));
            }
        }
    } else {
        $userGroup = new UserGroup();
        $group_info = $userGroup->get($group_id);
        $form->addElement('label', get_lang('ToGroup'), api_xml_http_response_encode($group_info['name']));
        $form->addElement('hidden', 'group_id', $group_id);
        $form->addElement('hidden', 'parent_id', $message_id);
    }
    $form->addText('title', get_lang('Subject'), true);
    $form->addHtmlEditor('content', get_lang('Message'), false, false, array('ToolbarSet' => 'Messages', 'Width' => '100%', 'Height' => '250'));
    if (isset($_GET['re_id'])) {
        $message_reply_info = MessageManager::get_message_by_id($_GET['re_id']);
        $default['title'] = get_lang('MailSubjectReplyShort') . " " . $message_reply_info['title'];
        $form->addElement('hidden', 're_id', intval($_GET['re_id']));
        $form->addElement('hidden', 'save_form', 'save_form');
        //adding reply mail
        $user_reply_info = api_get_user_info($message_reply_info['user_sender_id']);
        $default['content'] = '<p><br/></p>' . sprintf(get_lang('XWroteY'), $user_reply_info['complete_name'], Security::filter_terms($message_reply_info['content']));
    }
    if (empty($group_id)) {
        $form->addElement('label', '', '<div  id="filepaths" class="form-group">
                    <div id="filepath_1">
                    <label>' . get_lang('FilesAttachment') . '</label>
                    <input type="file" name="attach_1"/>
                    <label>' . get_lang('Description') . '</label>
                    <input id="file-descrtiption" type="text" name="legend[]" class="form-control"/>
                    </div>
                </div>');
        $form->addElement('label', '', '<span id="link-more-attach"><a href="javascript://" onclick="return add_image_form()">' . get_lang('AddOneMoreFile') . '</a></span>&nbsp;(' . sprintf(get_lang('MaximunFileSizeX'), format_file_size(api_get_setting('message.message_max_upload_filesize'))) . ')');
    }
    $form->addButtonSend(get_lang('SendMessage'), 'compose');
    $form->setRequiredNote('<span class="form_required">*</span> <small>' . get_lang('ThisFieldIsRequired') . '</small>');
    if (!empty($group_id) && !empty($message_id)) {
        $message_info = MessageManager::get_message_by_id($message_id);
        $default['title'] = get_lang('MailSubjectReplyShort') . " " . $message_info['title'];
    }
    $form->setDefaults($default);
    $html = '';
    if ($form->validate()) {
        $check = Security::check_token('post');
        if ($check) {
            $user_list = $default['users'];
            $file_comments = $_POST['legend'];
            $title = $default['title'];
            $content = $default['content'];
            $group_id = isset($default['group_id']) ? $default['group_id'] : null;
            $parent_id = isset($default['parent_id']) ? $default['parent_id'] : null;
            if (is_array($user_list) && count($user_list) > 0) {
                //all is well, send the message
                foreach ($user_list as $user) {
                    $res = MessageManager::send_message($user, $title, $content, $_FILES, $file_comments, $group_id, $parent_id);
                    if ($res) {
                        $html .= MessageManager::display_success_message($user);
                    }
                }
            } else {
                Display::display_error_message('ErrorSendingMessage');
            }
        }
        Security::clear_token();
    } else {
        $token = Security::get_token();
        $form->addElement('hidden', 'sec_token');
        $form->setConstants(array('sec_token' => $token));
        $html .= $form->returnForm();
    }
    return $html;
}
开发者ID:jloguercio,项目名称:chamilo-lms,代码行数:90,代码来源:new_message.php

示例3: intval

$tpl = Container::getTwig();
$load_user = 0;
if (isset($_GET['load_user'])) {
    $load_user = 1;
}
$skill_condition = '';
$tpl->addGlobal('skill_id_to_load', '');
if (isset($_GET['skill_id'])) {
    $skillId = intval($_GET['skill_id']);
    $skill_condition = '&skill_id=' . $skillId;
    $tpl->addGlobal('skill_id_to_load', $skillId);
}
$url = api_get_path(WEB_AJAX_PATH) . "skill.ajax.php?a=get_skills_tree_json&load_user={$load_user}";
$tpl->addGlobal('wheel_url', $url);
$url = api_get_path(WEB_AJAX_PATH) . 'skill.ajax.php?1=1';
$tpl->addGlobal('url', $url);
$tpl->addGlobal('isAdministration', true);
$dialogForm = new FormValidator('form', 'post', null, null, ['id' => 'add_item']);
$dialogForm->addLabel(get_lang('Name'), Display::tag('p', null, ['id' => 'name', 'class' => 'form-control-static']));
$dialogForm->addLabel(get_lang('ShortCode'), Display::tag('p', null, ['id' => 'short_code', 'class' => 'form-control-static']));
$dialogForm->addLabel(get_lang('Parent'), Display::tag('p', null, ['id' => 'parent', 'class' => 'form-control-static']));
$dialogForm->addLabel([get_lang('Gradebook'), get_lang('WithCertificate')], Display::tag('ul', null, ['id' => 'gradebook', 'class' => 'form-control-static list-unstyled']));
$dialogForm->addLabel(get_lang('Description'), Display::tag('p', null, ['id' => 'description', 'class' => 'form-control-static']));
$tpl->addGlobal('dialogForm', $dialogForm->returnForm());
$saveProfileForm = new FormValidator('form', 'post', null, null, ['id' => 'dialog-form-profile']);
$saveProfileForm->addHidden('profile_id', null);
$saveProfileForm->addText('name', get_lang('Name'), true, ['id' => 'name_profile']);
$saveProfileForm->addTextarea('description', get_lang('Description'), ['id' => 'description_profile', 'rows' => 6]);
$tpl->addGlobal('saveProfileForm', $saveProfileForm->returnForm());
echo $tpl->render('@template_style/skill/skill_wheel.html.twig');
Container::$legacyTemplate = 'layout_one_col_no_content.html.twig';
开发者ID:daffef,项目名称:chamilo-lms,代码行数:31,代码来源:skills_wheel.php

示例4: array

$form->addElement('file', 'picture', get_lang('AddPicture'));
$allowed_picture_types = array('jpg', 'jpeg', 'png', 'gif');
$form->addRule('picture', get_lang('OnlyImagesAllowed') . ' (' . implode(',', $allowed_picture_types) . ')', 'filetype', $allowed_picture_types);
if (strlen($user_data['picture_uri']) > 0) {
    $form->addElement('checkbox', 'delete_picture', '', get_lang('DelImage'));
}
// Username
if (api_get_setting('login_is_email') != 'true') {
    $form->addElement('text', 'username', get_lang('LoginName'), array('maxlength' => USERNAME_MAX_LENGTH));
    $form->addRule('username', get_lang('ThisFieldIsRequired'), 'required');
    $form->addRule('username', sprintf(get_lang('UsernameMaxXCharacters'), (string) USERNAME_MAX_LENGTH), 'maxlength', USERNAME_MAX_LENGTH);
    $form->addRule('username', get_lang('OnlyLettersAndNumbersAllowed'), 'username');
    $form->addRule('username', get_lang('UserTaken'), 'username_available', $user_data['username']);
}
if (isset($extAuthSource) && !empty($extAuthSource) && count($extAuthSource) > 0) {
    $form->addLabel(get_lang('ExternalAuthentication'), $userInfo['auth_source']);
}
// Password
$form->addElement('radio', 'reset_password', get_lang('Password'), get_lang('DontResetPassword'), 0);
$nb_ext_auth_source_added = 0;
if (isset($extAuthSource) && !empty($extAuthSource) && count($extAuthSource) > 0) {
    $auth_sources = array();
    foreach ($extAuthSource as $key => $info) {
        // @todo : make uniform external authentication configuration (ex : cas and external_login ldap)
        // Special case for CAS. CAS is activated from Chamilo > Administration > Configuration > CAS
        // extAuthSource always on for CAS even if not activated
        // same action for file user_add.php
        if ($key == CAS_AUTH_SOURCE && api_get_setting('cas_activate') === 'true' || $key != CAS_AUTH_SOURCE) {
            $auth_sources[$key] = $key;
            $nb_ext_auth_source_added++;
        }
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:31,代码来源:user_edit.php

示例5: saveThreadScore

 }
 if (!empty($score)) {
     $saveResult = saveThreadScore($currentThread, $userIdToQualify, $threadId, $score, api_get_utc_datetime(), api_get_session_id());
 }
 // show qualifications history
 $type = isset($_GET['type']) ? $_GET['type'] : '';
 $historyList = getThreadScoreHistory($userIdToQualify, $threadId, $type);
 $counter = count($historyList);
 // Show current qualify in my form
 $qualify = current_qualify_of_thread($threadId, api_get_session_id(), $_GET['user']);
 $result = get_statistical_information($threadId, $_GET['user_id'], api_get_course_int_id());
 $url = api_get_path(WEB_CODE_PATH) . 'forum/forumqualify.php?' . api_get_cidreq() . '&forum=' . intval($_GET['forum']) . '&thread=' . $threadId . '&user=' . intval($_GET['user']) . '&user_id=' . intval($_GET['user']);
 $userToQualifyInfo = api_get_user_info($userIdToQualify);
 $form = new FormValidator('forum-thread-qualify', 'post', $url);
 $form->addHeader($userToQualifyInfo['complete_name']);
 $form->addLabel(get_lang('Thread'), $currentThread['thread_title']);
 $form->addLabel(get_lang('CourseUsers'), $result['user_course']);
 $form->addLabel(get_lang('PostsNumber'), $result['post']);
 $form->addLabel(get_lang('NumberOfPostsForThisUser'), $result['user_post']);
 $form->addLabel(get_lang('AveragePostPerUser'), round($result['user_post'] / $result['post'], 2));
 $form->addText('idtextqualify', array(get_lang('Qualification'), get_lang('MaxScore') . ' ' . $maxQualify), $qualify);
 include 'viewpost.inc.php';
 $form->addButtonSave(get_lang('QualifyThisThread'));
 $form->setDefaults(array('idtextqualify' => $qualify));
 $form->display();
 // Show past data
 if (api_is_allowed_to_edit() && $counter > 0) {
     if (isset($_GET['gradebook'])) {
         $view_gradebook = '&gradebook=view';
     }
     echo '<h4>' . get_lang('QualificationChangesHistory') . '</h4>';
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:31,代码来源:forumqualify.php

示例6: array

$label = get_lang('MaxFileSize') . ': ' . ini_get('upload_max_filesize') . '<br/>' . get_lang('DocumentQuota') . ': ' . $course_quota;
$form->addElement('file', 'file', array(get_lang('File'), $label), 'style="width: 250px" id="user_upload"');
$form->addElement('text', 'title', get_lang('Title'), array('id' => 'title_file'));
$form->addElement('textarea', 'comment', get_lang('Comment'));
// Advanced parameters
$form->addButtonAdvancedSettings('advanced_params');
$form->addElement('html', '<div id="advanced_params_options" style="display:none">');
// Check box options
$form->addElement('checkbox', 'unzip', get_lang('Options'), get_lang('Uncompress'), 'onclick="javascript: check_unzip();" value="1"');
if (api_get_setting('search.search_enabled') == 'true') {
    //TODO: include language file
    $supported_formats = get_lang('SupportedFormatsForIndex') . ': HTML, PDF, TXT, PDF, Postscript, MS Word, RTF, MS Power Point';
    $form->addElement('checkbox', 'index_document', '', get_lang('SearchFeatureDoIndexDocument') . '<div style="font-size: 80%" >' . $supported_formats . '</div>');
    $form->addElement('html', '<br /><div class="sub-form">');
    $form->addElement('html', '<div class="label">' . get_lang('SearchFeatureDocumentLanguage') . '</div>');
    $form->addLabel(get_lang('Language'), api_get_languages_combo());
    $form->addElement('html', '</div><div class="sub-form">');
    $specific_fields = get_specific_field_list();
    foreach ($specific_fields as $specific_field) {
        $form->addElement('text', $specific_field['code'], $specific_field['name']);
    }
    $form->addElement('html', '</div>');
}
$form->addElement('radio', 'if_exists', get_lang('UplWhatIfFileExists'), get_lang('UplDoNothing'), 'nothing');
$form->addElement('radio', 'if_exists', '', get_lang('UplOverwriteLong'), 'overwrite');
$form->addElement('radio', 'if_exists', '', get_lang('UplRenameLong'), 'rename');
// Close the java script and avoid the footer up
$form->addElement('html', '</div>');
// Button upload document
$form->addButtonSend(get_lang('SendDocument'), 'submitDocument');
$form->add_real_progress_bar('DocumentUpload', 'file');
开发者ID:jloguercio,项目名称:chamilo-lms,代码行数:31,代码来源:upload.php

示例7: array

    return $list;
}
/**
 * Just display the form needed to upload a SCORM and give its settings
 */
$nameTools = get_lang("FileUpload");
$interbreadcrumb[] = array("url" => "../newscorm/lp_controller.php?action=list", "name" => get_lang("ToolLearnpath"));
Display::display_header($nameTools, "Path");
require_once '../newscorm/content_makers.inc.php';
require_once api_get_path(LIBRARY_PATH) . 'specific_fields_manager.lib.php';
echo '<div class="actions">';
echo '<a href="../newscorm/lp_controller.php?cidReq=' . $_course['sysCode'] . '">' . Display::return_icon('back.png', get_lang('ReturnToLearningPaths'), '', ICON_SIZE_MEDIUM) . '</a>';
echo '</div>';
$form = new FormValidator('', 'POST', 'upload.php', '', array('id' => "upload_form", 'enctype' => "multipart/form-data"));
$form->addElement('header', $nameTools);
$form->addLabel(null, Display::return_icon('scorm_logo.jpg', null, ['style' => 'width:230px;height:100px']));
$form->addElement('hidden', 'curdirpath', $path);
$form->addElement('hidden', 'tool', $my_tool);
$form->addElement('file', 'user_file', get_lang('FileToUpload'));
$form->add_real_progress_bar('uploadScorm', 'user_file');
$form->addRule('user_file', get_lang('ThisFieldIsRequired'), 'required');
unset($content_origins[0]);
unset($content_origins[1]);
if (api_get_setting('search.search_enabled') == 'true') {
    $form->addElement('checkbox', 'index_document', '', get_lang('SearchFeatureDoIndexDocument'));
    $specific_fields = get_specific_field_list();
    foreach ($specific_fields as $specific_field) {
        $form->addElement('text', $specific_field['code'], $specific_field['name'] . ' : ');
    }
}
if (api_is_platform_admin()) {
开发者ID:jloguercio,项目名称:chamilo-lms,代码行数:31,代码来源:form.scorm.php

示例8: elseif

    $text_document = $form->addElement('text', 'document', get_lang('Document'));
    $defaults['document'] = '<a href="' . format_url($submitGroupWorkUrl) . '">' . $realUrl . '</a>';
    $text_document->freeze();
} elseif ($item_id && ($is_allowed_to_edit or $is_author)) {
    $workUrl = $currentCourseRepositoryWeb . $workUrl;
}*/
$form->addElement('hidden', 'id', $work_id);
$form->addElement('hidden', 'item_id', $item_id);
$form->addText('title', get_lang('Title'), true, array('id' => 'file_upload'));
if ($is_allowed_to_edit && !empty($item_id)) {
    $sql = "SELECT contains_file, url\n            FROM {$work_table}\n            WHERE c_id = {$course_id} AND id ='{$item_id}' ";
    $result = Database::query($sql);
    if ($result !== false && Database::num_rows($result) > 0) {
        $row = Database::fetch_array($result);
        if ($row['contains_file'] || !empty($row['url'])) {
            $form->addLabel(get_lang('Download'), '<a href="' . api_get_path(WEB_CODE_PATH) . 'work/download.php?id=' . $item_id . '&' . api_get_cidreq() . '">' . Display::return_icon('save.png', get_lang('Save'), array(), ICON_SIZE_MEDIUM) . '
                </a>');
        }
    }
}
$form->addHtmlEditor('description', get_lang('Description'), false, false, getWorkDescriptionToolbar());
$defaults['title'] = $work_item['title'];
$defaults["description"] = $work_item['description'];
$defaults['qualification'] = $work_item['qualification'];
if ($is_allowed_to_edit && !empty($item_id)) {
    // Get qualification from parent_id that will allow the validation qualification over
    $sql = "SELECT qualification FROM {$work_table}\n            WHERE c_id = {$course_id} AND id ='{$work_id}' ";
    $result = Database::query($sql);
    $row = Database::fetch_array($result);
    $qualification_over = $row['qualification'];
    if (!empty($qualification_over) && intval($qualification_over) > 0) {
        $form->addText('qualification', array(get_lang('Qualification'), " / " . $qualification_over), false, 'size="10"');
开发者ID:jloguercio,项目名称:chamilo-lms,代码行数:32,代码来源:edit.php

示例9: FormValidator

 $form = new FormValidator('icon_edit', 'post', $currentUrl);
 $form->addHeader(get_lang('EditIcon'));
 $form->addHtml('<div class="col-md-7">');
 $form->addText('name', get_lang('Name'));
 $form->addText('link', get_lang('Links'));
 $allowed_picture_types = array('jpg', 'jpeg', 'png');
 $form->addFile('icon', get_lang('CustomIcon'));
 $form->addRule('icon', get_lang('OnlyImagesAllowed') . ' (' . implode(',', $allowed_picture_types) . ')', 'filetype', $allowed_picture_types);
 $form->addSelect('target', get_lang('LinkTarget'), ['_self' => get_lang('LinkOpenSelf'), '_blank' => get_lang('LinkOpenBlank')]);
 $form->addSelect('visibility', get_lang('Visibility'), array(1 => get_lang('Visible'), 0 => get_lang('Invisible')));
 $form->addTextarea('description', get_lang('Description'), array('rows' => '3', 'cols' => '40'));
 $form->addButtonUpdate(get_lang('Update'));
 $form->addHtml('</div>');
 $form->addHtml('<div class="col-md-5">');
 if (isset($tool['custom_icon']) && !empty($tool['custom_icon'])) {
     $form->addLabel(get_lang('CurrentIcon'), Display::img(CourseHome::getCustomWebIconPath() . $tool['custom_icon']));
     $form->addCheckBox('delete_icon', null, get_lang('DeletePicture'));
 }
 $form->addHtml('</div>');
 $form->setDefaults($tool);
 $content = $form->returnForm();
 if ($form->validate()) {
     $data = $form->getSubmitValues();
     CourseHome::updateTool($id, $data);
     Display::addFlash(Display::return_message(get_lang('Updated')));
     if (isset($data['delete_icon'])) {
         CourseHome::deleteIcon($id);
     }
     $currentUrlReturn = api_get_self() . '?' . api_get_cidreq();
     header('Location: ' . $currentUrlReturn);
     exit;
开发者ID:jloguercio,项目名称:chamilo-lms,代码行数:31,代码来源:tools.php

示例10: handle_stylesheets


//.........这里部分代码省略.........
            }
        }
        closedir($handle);
    }
    // Sort styles in alphabetical order.
    asort($list_of_names);
    $select_list = array();
    foreach ($list_of_names as $style_dir => $item) {
        $select_list[$style_dir] = $item;
    }
    $styles =& $form_change->addElement('select', 'style', get_lang('NameStylesheet'), $select_list);
    $styles->setSelected($selected);
    if ($form_change->validate()) {
        // Submit stylesheets.
        if (isset($_POST['save'])) {
            store_stylesheets();
            Display::display_normal_message(get_lang('Saved'));
        }
        if (isset($_POST['download'])) {
            $arch = api_get_path(SYS_ARCHIVE_PATH) . $safe_style_dir . '.zip';
            $dir = api_get_path(SYS_CSS_PATH) . 'themes/' . $safe_style_dir;
            if (is_dir($dir)) {
                $zip = new PclZip($arch);
                // Remove path prefix except the style name and put file on disk
                $zip->create($dir, PCLZIP_OPT_REMOVE_PATH, substr($dir, 0, -strlen($safe_style_dir)));
                //@TODO: use more generic script to download.
                $str = '<a class="btn btn-primary btn-large" href="' . api_get_path(WEB_CODE_PATH) . 'course_info/download.php?archive=' . str_replace(api_get_path(SYS_ARCHIVE_PATH), '', $arch) . '">' . get_lang('ClickHereToDownloadTheFile') . '</a>';
                Display::display_normal_message($str, false);
            } else {
                Display::addFlash(Display::return_message(get_lang('FileNotFound'), 'warning'));
            }
        }
    }
    $logoForm = new FormValidator('logo_upload', 'post', 'settings.php?category=Stylesheets#tabs-2');
    $logoForm->addHtml(Display::return_message(sprintf(get_lang('TheLogoMustBeSizeXAndFormatY'), '250 x 70', 'PNG'), 'info'));
    $dir = api_get_path(SYS_PUBLIC_PATH) . 'css/themes/' . $selected . '/images/';
    $url = api_get_path(WEB_CSS_PATH) . 'themes/' . $selected . '/images/';
    $logoFileName = 'header-logo.png';
    $newLogoFileName = 'header-logo-custom.png';
    if (is_file($dir . $newLogoFileName)) {
        $logoForm->addLabel(get_lang('CurrentLogo'), '<img id="header-logo-custom" src="' . $url . $newLogoFileName . '?' . time() . '">');
    } else {
        $logoForm->addLabel(get_lang('CurrentLogo'), '<img id="header-logo-custom" src="' . $url . $logoFileName . '?' . time() . '">');
    }
    $logoForm->addFile('new_logo', get_lang('UpdateLogo'));
    $allowedFileTypes = ['png'];
    if (isset($_POST['logo_reset'])) {
        if (is_file($dir . $newLogoFileName)) {
            unlink($dir . $newLogoFileName);
            Display::display_normal_message(get_lang('ResetToTheOriginalLogo'));
            echo '<script>' . '$("#header-logo").attr("src","' . $url . $logoFileName . '");' . '</script>';
        }
    } elseif (isset($_POST['logo_upload'])) {
        $logoForm->addRule('new_logo', get_lang('InvalidExtension') . ' (' . implode(',', $allowedFileTypes) . ')', 'filetype', $allowedFileTypes);
        $logoForm->addRule('new_logo', get_lang('ThisFieldIsRequired'), 'required');
        if ($logoForm->validate()) {
            $imageInfo = getimagesize($_FILES['new_logo']['tmp_name']);
            $width = $imageInfo[0];
            $height = $imageInfo[1];
            if ($width <= 250 && $height <= 70) {
                if (is_file($dir . $newLogoFileName)) {
                    unlink($dir . $newLogoFileName);
                }
                $status = move_uploaded_file($_FILES['new_logo']['tmp_name'], $dir . $newLogoFileName);
                if ($status) {
                    Display::display_normal_message(get_lang('NewLogoUpdated'));
                    echo '<script>' . '$("#header-logo").attr("src","' . $url . $newLogoFileName . '");' . '</script>';
                } else {
                    Display::display_error_message('Error - ' . get_lang('UplNoFileUploaded'));
                }
            } else {
                Display::display_error_message('Error - ' . get_lang('InvalidImageDimensions'));
            }
        }
    }
    if ($is_style_changeable) {
        $group = [$form_change->addButtonSave(get_lang('SaveSettings'), 'save', true), $form_change->addButtonPreview(get_lang('Preview'), 'preview', true), $form_change->addButtonDownload(get_lang('Download'), 'download', true)];
        $form_change->addGroup($group);
        $logoGroup = [$logoForm->addButtonUpload(get_lang('Upload'), 'logo_upload', true), $logoForm->addButtonCancel(get_lang('Reset'), 'logo_reset', true)];
        $logoForm->addGroup($logoGroup);
        if ($show_upload_form) {
            echo '<script>
            $(function() {
                $( "#tabs" ).tabs();
            });
            </script>';
            echo Display::tabs(array(get_lang('Update'), get_lang('UpdateLogo'), get_lang('UploadNewStylesheet')), array($form_change->return_form(), $logoForm->return_form(), $form->return_form()));
        } else {
            $form_change->display();
        }
        //Little hack to update the logo image in update form when submiting
        if (isset($_POST['logo_reset'])) {
            echo '<script>' . '$("#header-logo-custom").attr("src","' . $url . $logoFileName . '");' . '</script>';
        } elseif (isset($_POST['logo_upload']) && is_file($dir . $newLogoFileName)) {
            echo '<script>' . '$("#header-logo-custom").attr("src","' . $url . $newLogoFileName . '");' . '</script>';
        }
    } else {
        $form_change->freeze();
    }
}
开发者ID:jloguercio,项目名称:chamilo-lms,代码行数:101,代码来源:settings.lib.php

示例11: array

    return $list;
}
/**
 * Just display the form needed to upload a SCORM and give its settings
 */
$nameTools = get_lang("FileUpload");
$interbreadcrumb[] = array("url" => "../newscorm/lp_controller.php?action=list", "name" => get_lang("ToolLearnpath"));
Display::display_header($nameTools, "Path");
require_once '../newscorm/content_makers.inc.php';
require_once api_get_path(LIBRARY_PATH) . 'specific_fields_manager.lib.php';
echo '<div class="actions">';
echo '<a href="../newscorm/lp_controller.php?cidReq=' . $_course['sysCode'] . '">' . Display::return_icon('back.png', get_lang('ReturnToLearningPaths'), '', ICON_SIZE_MEDIUM) . '</a>';
echo '</div>';
$form = new FormValidator('', 'POST', 'upload.php', '', array('id' => "upload_form", 'enctype' => "multipart/form-data"));
$form->addElement('header', $nameTools);
$form->addLabel(null, Display::img(api_get_path(WEB_IMG_PATH) . 'scorm_logo.jpg'));
$form->addElement('hidden', 'curdirpath', $path);
$form->addElement('hidden', 'tool', $my_tool);
$form->addElement('file', 'user_file', get_lang('FileToUpload'));
$form->add_real_progress_bar('uploadScorm', 'user_file');
$form->addRule('user_file', get_lang('ThisFieldIsRequired'), 'required');
unset($content_origins[0]);
unset($content_origins[1]);
if (api_get_setting('search_enabled') == 'true') {
    $form->addElement('checkbox', 'index_document', '', get_lang('SearchFeatureDoIndexDocument'));
    $specific_fields = get_specific_field_list();
    foreach ($specific_fields as $specific_field) {
        $form->addElement('text', $specific_field['code'], $specific_field['name'] . ' : ');
    }
}
if (api_is_platform_admin()) {
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:31,代码来源:form.scorm.php


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