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


PHP FormValidator::addButtonNext方法代码示例

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


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

示例1: build_move_to_selector

 /**
  * @param $folders
  * @param $curdirpath
  * @param $move_file
  * @param string $group_dir
  * @return string
  */
 public static function build_move_to_selector($folders, $curdirpath, $move_file, $group_dir = '')
 {
     $form = new FormValidator('move_to', 'post', api_get_self() . '?' . api_get_cidreq());
     // Form title
     $form->addElement('hidden', 'move_file', $move_file);
     $options = array();
     // Group documents cannot be uploaded in the root
     if ($group_dir == '') {
         if ($curdirpath != '/') {
             $options['/'] = get_lang('Documents');
         }
         if (is_array($folders)) {
             foreach ($folders as &$folder) {
                 // Hide some folders
                 if ($folder == '/HotPotatoes_files' || $folder == '/certificates' || basename($folder) == 'css') {
                     continue;
                 }
                 // Admin setting for Hide/Show the folders of all users
                 if (api_get_setting('document.show_users_folders') == 'false' && (strstr($folder, '/shared_folder') || strstr($folder, 'shared_folder_session_'))) {
                     continue;
                 }
                 // Admin setting for Hide/Show Default folders to all users
                 if (api_get_setting('document.show_default_folders') == 'false' && ($folder == '/images' || $folder == '/flash' || $folder == '/audio' || $folder == '/video' || strstr($folder, '/images/gallery') || $folder == '/video/flv')) {
                     continue;
                 }
                 // Admin setting for Hide/Show chat history folder
                 if (api_get_setting('chat.show_chat_folder') == 'false' && $folder == '/chat_files') {
                     continue;
                 }
                 // You cannot move a file to:
                 // 1. current directory
                 // 2. inside the folder you want to move
                 // 3. inside a subfolder of the folder you want to move
                 if ($curdirpath != $folder && $folder != $move_file && substr($folder, 0, strlen($move_file) + 1) != $move_file . '/') {
                     $path_displayed = $folder;
                     // If document title is used, we have to display titles instead of real paths...
                     $path_displayed = DocumentManager::get_titles_of_path($folder);
                     if (empty($path_displayed)) {
                         $path_displayed = get_lang('Untitled');
                     }
                     $options[$folder] = $path_displayed;
                 }
             }
         }
     } else {
         foreach ($folders as $folder) {
             if ($curdirpath != $folder && $folder != $move_file && substr($folder, 0, strlen($move_file) + 1) != $move_file . '/') {
                 // Cannot copy dir into his own subdir
                 $path_displayed = DocumentManager::get_titles_of_path($folder);
                 $display_folder = substr($path_displayed, strlen($group_dir));
                 $display_folder = $display_folder == '' ? get_lang('Documents') : $display_folder;
                 //$form .= '<option value="'.$folder.'">'.$display_folder.'</option>';
                 $options[$folder] = $display_folder;
             }
         }
     }
     $form->addElement('select', 'move_to', get_lang('MoveTo'), $options);
     $form->addButtonNext(get_lang('MoveElement'), 'move_file_submit');
     return $form->returnForm();
 }
开发者ID:daffef,项目名称:chamilo-lms,代码行数:67,代码来源:document.lib.php

示例2: api_not_allowed


//.........这里部分代码省略.........
    $tpl = new Template(null, $show_headers, $show_headers);
    $tpl->assign('hide_login_link', 1);
    $tpl->assign('content', $msg);
    if ($user_id != 0 && !api_is_anonymous() && (!isset($course) || $course == -1) && empty($_GET['cidReq'])) {
        // if the access is not authorized and there is some login information
        // but the cidReq is not found, assume we are missing course data and send the user
        // to the user_portal
        $tpl->display_one_col_template();
        exit;
    }
    if (!empty($_SERVER['REQUEST_URI']) && (!empty($_GET['cidReq']) || $this_section == SECTION_MYPROFILE || $this_section == SECTION_PLATFORM_ADMIN)) {
        $courseCode = api_get_course_id();
        // Only display form and return to the previous URL if there was a course ID included
        if ($user_id != 0 && !api_is_anonymous()) {
            //if there is a user ID, then the user is not allowed but the session is still there. Say so and exit
            $tpl->assign('content', $msg);
            $tpl->display_one_col_template();
            exit;
        }
        if (!is_null($courseCode)) {
            api_set_firstpage_parameter($courseCode);
        }
        // If the user has no user ID, then his session has expired
        $action = api_get_self() . '?' . Security::remove_XSS($_SERVER['QUERY_STRING']);
        $action = str_replace('&amp;', '&', $action);
        $form = new FormValidator('formLogin', 'post', $action, null, array(), FormValidator::LAYOUT_BOX_NO_LABEL);
        $form->addElement('text', 'login', null, array('placeholder' => get_lang('UserName'), 'class' => 'autocapitalize_off'));
        $form->addElement('password', 'password', null, array('placeholder' => get_lang('Password')));
        $form->addButton('submitAuth', get_lang('LoginEnter'), '', 'primary');
        // see same text in auth/gotocourse.php and main_api.lib.php function api_not_allowed (above)
        $content = Display::return_message(get_lang('NotAllowed'), 'error', false);
        if (!empty($courseCode)) {
            $content .= '<h4>' . get_lang('LoginToGoToThisCourse') . '</h4>';
        }
        if (api_is_cas_activated()) {
            $content .= Display::return_message(sprintf(get_lang('YouHaveAnInstitutionalAccount'), api_get_setting("Institution")), '', false);
            $content .= Display::div("<br/><a href='" . get_cas_direct_URL(api_get_course_id()) . "'>" . sprintf(get_lang('LoginWithYourAccount'), api_get_setting("Institution")) . "</a><br/><br/>", array('align' => 'center'));
            $content .= Display::return_message(get_lang('YouDontHaveAnInstitutionAccount'));
            $content .= "<p style='text-align:center'><a href='#' onclick='\$(this).parent().next().toggle()'>" . get_lang('LoginWithExternalAccount') . "</a></p>";
            $content .= "<div style='display:none;'>";
        }
        $content .= '<div class="well_login">';
        $content .= $form->return_form();
        $content .= '</div>';
        if (api_is_cas_activated()) {
            $content .= "</div>";
        }
        if (!empty($courseCode)) {
            $content .= '<hr/><p style="text-align:center"><a href="' . $home_url . '">' . get_lang('ReturnToCourseHomepage') . '</a></p>';
        } else {
            $content .= '<hr/><p style="text-align:center"><a href="' . $home_url . '">' . get_lang('CampusHomepage') . '</a></p>';
        }
        $tpl->setLoginBodyClass();
        $tpl->assign('content', $content);
        $tpl->display_one_col_template();
        exit;
    }
    if ($user_id != 0 && !api_is_anonymous()) {
        $tpl->display_one_col_template();
        exit;
    }
    $msg = null;
    // The session is over and we were not in a course,
    // or we try to get directly to a private course without being logged
    if (!is_null(api_get_course_int_id())) {
        api_set_firstpage_parameter(api_get_course_id());
        $tpl->setLoginBodyClass();
        $action = api_get_self() . '?' . Security::remove_XSS($_SERVER['QUERY_STRING']);
        $action = str_replace('&amp;', '&', $action);
        $form = new FormValidator('formLogin', 'post', $action, null, array('class' => 'form-stacked'));
        $form->addElement('text', 'login', null, array('placeholder' => get_lang('UserName'), 'class' => 'col-md-3 autocapitalize_off'));
        //new
        $form->addElement('password', 'password', null, array('placeholder' => get_lang('Password'), 'class' => 'col-md-3'));
        //new
        $form->addButtonNext(get_lang('LoginEnter'), 'submitAuth');
        // see same text in auth/gotocourse.php and main_api.lib.php function api_not_allowed (bellow)
        $msg = Display::return_message(get_lang('NotAllowed'), 'error', false);
        $msg .= '<h4>' . get_lang('LoginToGoToThisCourse') . '</h4>';
        if (api_is_cas_activated()) {
            $msg .= Display::return_message(sprintf(get_lang('YouHaveAnInstitutionalAccount'), api_get_setting("Institution")), '', false);
            $msg .= Display::div("<br/><a href='" . get_cas_direct_URL(api_get_course_int_id()) . "'>" . getCASLogoHTML() . " " . sprintf(get_lang('LoginWithYourAccount'), api_get_setting("Institution")) . "</a><br/><br/>", array('align' => 'center'));
            $msg .= Display::return_message(get_lang('YouDontHaveAnInstitutionAccount'));
            $msg .= "<p style='text-align:center'><a href='#' onclick='\$(this).parent().next().toggle()'>" . get_lang('LoginWithExternalAccount') . "</a></p>";
            $msg .= "<div style='display:none;'>";
        }
        $msg .= '<div class="well">';
        $msg .= $form->return_form();
        $msg .= '</div>';
        if (api_is_cas_activated()) {
            $msg .= "</div>";
        }
        $msg .= '<hr/><p style="text-align:center"><a href="' . $home_url . '">' . get_lang('ReturnToCourseHomepage') . '</a></p>';
    } else {
        // we were not in a course, return to home page
        $msg = Display::return_message(get_lang('NotAllowed') . '<br/><br/><a href="' . $home_url . '">' . get_lang('ReturnToCourseHomepage') . '</a><br />', 'error', false);
    }
    $tpl->assign('content', $msg);
    $tpl->display_one_col_template();
    exit;
}
开发者ID:feroli1000,项目名称:chamilo-lms,代码行数:101,代码来源:api.lib.php

示例3: Sequence

    $sequence = new Sequence();
    $sequence->setName($values['name']);
    $em->persist($sequence);
    $em->flush();
    header('Location: ' . api_get_self());
    exit;
}
$selectSequence = new FormValidator('');
$selectSequence->addHidden('sequence_type', 'session');
$em = Database::getManager();
$sequenceList = $em->getRepository('ChamiloCoreBundle:Sequence')->findAll();
$selectSequence->addSelect('sequence', get_lang('Sequence'), $sequenceList, ['id' => 'sequence_id', 'cols-size' => [3, 7, 2]]);
$form = new FormValidator('');
$form->addHtml("<div class='col-md-6'>");
$form->addHidden('sequence_type', 'session');
$form->addSelect('sessions', get_lang('Sessions'), $sessionList, ['id' => 'item', 'cols-size' => [4, 7, 1]]);
$form->addButtonNext(get_lang('UseAsReference'), 'use_as_reference', ['cols-size' => [4, 7, 1]]);
$form->addHtml("</div>");
$form->addHtml("<div class='col-md-6'>");
$form->addSelect('requirements', get_lang('Requirements'), $sessionList, ['id' => 'requirements', 'cols-size' => [3, 7, 2]]);
$form->addButtonCreate(get_lang('SetAsRequirement'), 'set_requirement', false, ['cols-size' => [3, 7, 2]]);
$form->addHtml("</div>");
$formSave = new FormValidator('');
$formSave->addHidden('sequence_type', 'session');
$formSave->addButton('save_resource', get_lang('SaveSettings'), 'floppy-o', 'success', null, null, ['cols-size' => [1, 10, 1]]);
$tpl->assign('create_sequence', $formSequence->returnForm());
$tpl->assign('select_sequence', $selectSequence->returnForm());
$tpl->assign('configure_sequence', $form->returnForm());
$tpl->assign('save_sequence', $formSave->returnForm());
$layout = $tpl->get_template('admin/resource_sequence.tpl');
$tpl->display($layout);
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:31,代码来源:resource_sequence.php

示例4: Template

require_once api_get_path(SYS_PATH) . 'main/auth/cas/authcas.php';
$msg = null;
if (isset($_GET['firstpage'])) {
    $firstpage = $_GET['firstpage'];
    // if course is public, go to course without auth
    $tab_course_info = api_get_course_info($firstpage);
    api_set_firstpage_parameter($firstpage);
    $tpl = new Template(null, 1, 1);
    $action = api_get_self() . '?' . Security::remove_XSS($_SERVER['QUERY_STRING']);
    $action = str_replace('&amp;', '&', $action);
    $form = new FormValidator('formLogin', 'post', $action, null, array('class' => 'form-stacked'));
    $form->addElement('text', 'login', null, array('placeholder' => get_lang('UserName'), 'class' => 'autocapitalize_off'));
    //new
    $form->addElement('password', 'password', null, array('placeholder' => get_lang('Password')));
    //new
    $form->addButtonNext(get_lang('LoginEnter'), 'submitAuth');
    // see same text in main_api.lib.php function api_not_allowed
    if (api_is_cas_activated()) {
        $msg .= Display::return_message(sprintf(get_lang('YouHaveAnInstitutionalAccount'), api_get_setting("Institution")), '', false);
        $msg .= Display::div("<br/><a href='" . get_cas_direct_URL(api_get_course_id()) . "'>" . getCASLogoHTML() . " " . sprintf(get_lang('LoginWithYourAccount'), api_get_setting("Institution")) . "</a><br/><br/>", array('align' => 'center'));
        $msg .= Display::return_message(get_lang('YouDontHaveAnInstitutionAccount'));
        $msg .= "<p style='text-align:center'><a href='#' onclick='\$(this).parent().next().toggle()'>" . get_lang('LoginWithExternalAccount') . "</a></p>";
        $msg .= "<div style='display:none;'>";
    }
    $msg .= '<div class="well_login">';
    $msg .= $form->return_form();
    $msg .= '</div>';
    if (api_is_cas_activated()) {
        $msg .= "</div>";
    }
    $msg .= '<hr/><p style="text-align:center"><a href="' . api_get_path(WEB_PATH) . '">' . get_lang('ReturnToCourseHomepage') . '</a></p>';
开发者ID:omaoibrahim,项目名称:chamilo-lms,代码行数:31,代码来源:gotocourse.php


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