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


PHP Header::location方法代码示例

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


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

示例1: updateAction

 public function updateAction()
 {
     if (empty($_GET['id']) || !($language = DBFactory::get($this->module)->get($_GET['id'])) instanceof Language) {
         Header::location(UrlFactory::module($this->module));
     }
     $this->valid($language, $_POST);
     $view = $this->getView('Form');
     $view->language = $language;
     $layout = $this->getLayout('Default', $view);
     $layout->addBreadcrumbsLink(new Link(Translator::get('module_languages'), UrlFactory::module($this->module)));
     $layout->addBreadcrumbsLink(new Link($language->name, UrlFactory::update($this->module, $language)));
     $layout->addBreadcrumbsLink(new Link(Translator::get('module_update')));
 }
开发者ID:ben33,项目名称:framework,代码行数:13,代码来源:LanguagesController.php

示例2: send

 public function send()
 {
     if ($this->request->responseType == 'json') {
         $response = array('status' => $this->status);
         if (!empty($this->location)) {
             $response['location'] = $this->location;
         }
         if ($this->layout instanceof Layout) {
             $response['content'] = $this->layout->renderJson();
         }
         echo json_encode($response);
     } else {
         Header::httpHeader($this->status->getDescription(), $this->status->getCode());
         if (!empty($this->location)) {
             Header::location($this->location);
         }
         if ($this->layout instanceof Layout) {
             $this->layout->renderHtml();
         }
     }
 }
开发者ID:ben33,项目名称:framework,代码行数:21,代码来源:HttpResponse.php

示例3: FormValidator

    $extraContentForm = new FormValidator('block_extra_data', 'post', '#', null, array('id' => 'block-extra-data', 'class' => ''), FormValidator::LAYOUT_BOX_NO_LABEL);
    $extraContentFormRenderer = $extraContentForm->getDefaultRenderer();
    if ($extraContentForm->validate()) {
        $extraData = $extraContentForm->getSubmitValues();
        $extraData = array_map(['Security', 'remove_XSS'], $extraData);
        if (!empty($extraData['block'])) {
            if (!is_dir($adminExtraContentDir)) {
                mkdir($adminExtraContentDir, api_get_permissions_for_new_directories(), true);
            }
            if (!is_writable($adminExtraContentDir)) {
                die;
            }
            $fullFilePath = $adminExtraContentDir . $extraData['block'];
            $fullFilePath .= "_extra.html";
            file_put_contents($fullFilePath, $extraData['extra_content']);
            Header::location(api_get_self());
        }
    }
    $extraContentForm->addTextarea('extra_content', null, ['id' => 'extra_content']);
    $extraContentFormRenderer->setElementTemplate('<div class="form-group">{element}</div>', 'extra_content');
    $extraContentForm->addElement('hidden', 'block', null, array('id' => 'extra-block'));
    $extraContentForm->addButtonExport(get_lang('Save'), 'submit_extra_content');
    $tpl->assign('extraDataForm', $extraContentForm->returnForm());
}
// The template contains the call to the AJAX version checker
$admin_template = $tpl->get_template('admin/settings_index.tpl');
$content = $tpl->fetch($admin_template);
$tpl->assign('content', $content);
$tpl->assign('message', $message);
$tpl->display_one_col_template();
// Note: version checking mechanism has now been moved to main/inc/ajax/admin.ajax.php
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:31,代码来源:index.php

示例4: api_not_allowed

/* For licensing terms, see /license.txt */
require_once '../../../global.inc.php';
if (api_is_anonymous()) {
    api_not_allowed(true);
}
$roomName = isset($_GET['room']) ? $_GET['room'] : null;
$room = VideoChat::getChatRoomByName($roomName);
if ($room === false) {
    Header::location(api_get_path(WEB_PATH));
}
$friend_html = SocialManager::listMyFriendsBlock($user_id, $link_shared, $show_full_profile);
$isSender = $room['from_user'] == api_get_user_id();
$isReceiver = $room['to_user'] == api_get_user_id();
if (!$isSender && !$isReceiver) {
    Header::location(api_get_path(WEB_PATH));
}
if ($isSender) {
    $chatUser = api_get_user_info($room['to_user']);
} elseif ($isReceiver) {
    $chatUser = api_get_user_info($room['from_user']);
}
$idUserLocal = api_get_user_id();
$userLocal = api_get_user_info($idUserLocal, true);
$htmlHeadXtra[] = '<script type="text/javascript" src="' . api_get_path(WEB_PATH) . 'web/assets/simplewebrtc/latest.js' . '"></script>' . "\n";
$template = new Template();
$template->assign('room', $room);
$template->assign('chat_user', $chatUser);
$template->assign('user_local', $userLocal);
$template->assign('block_friends', $friend_html);
$content = $template->fetch('default/chat/video.tpl');
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:30,代码来源:video.php

示例5: array

                            continue;
                        }
                    }
                    $certificateStudent['certificates'][] = array('createdAt' => api_convert_and_format_date($certificate['created_at']), 'id' => $certificate['id']);
                }
                if (count($certificateStudent['certificates']) > 0) {
                    $certificateStudents[] = $certificateStudent;
                }
            }
        }
    }
} elseif ($searchStudentOnly) {
    $selectedStudentInfo = api_get_user_info($selectedStudent);
    if (empty($selectedStudentInfo)) {
        Session::write('reportErrorMessage', get_lang('NoUser'));
        Header::location($selfUrl);
    }
    $sessionList = SessionManager::getSessionsFollowedByUser($selectedStudent);
    foreach ($sessionList as $session) {
        $sessionCourseList = SessionManager::get_course_list_by_session_id($session['id']);
        foreach ($sessionCourseList as $sessionCourse) {
            $gradebookCategories = Category::load(null, null, $sessionCourse['code'], null, false, $session['id']);
            $gradebook = null;
            if (!empty($gradebookCategories)) {
                $gradebook = current($gradebookCategories);
            }
            if (!is_null($gradebook)) {
                $sessionName = $session['name'];
                $courseName = $sessionCourse['title'];
                $certificateStudent = ['fullName' => $selectedStudentInfo['complete_name'], 'sessionName' => $sessionName, 'courseName' => $courseName, 'certificates' => []];
                $studentCertificates = GradebookUtils::get_list_gradebook_certificates_by_user_id($selectedStudent, $gradebook->get_id());
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:31,代码来源:certificate_report.php

示例6: define

            }
        }
    }
}
$request->langue = $response->langue = $userLangue;
define('LANGUE', $request->langue->code);
define('BASE_URL_LANGUE', BASE_URL . $request->langue->code . '/');
ini_set('default_charset', CHARSET);
setlocale(LC_TIME, $request->langue->locale . '.' . mb_strtolower(CHARSET));
if (in_array('translations', $backoModules) && file_exists(ROOT . 'traductions.inc.php')) {
    Translator::init($request->langue->code, DEFAULT_LANG);
}
require_once APPLICATION_ROOT . 'UrlFactory.php';
UrlSingleton::init(new UrlFactory(), $request->langue);
if (in_array('admins', $allowedModules) && (empty($_SESSION['admin']) || !($admin = DBFactory::get('admins')->get($_SESSION['admin'])) instanceof Admin) && $request->url != UrlFactory::module('admins', 'login') && $request->url != UrlFactory::module('admins', 'init')) {
    Header::location(UrlFactory::module('admins', 'login'));
}
try {
    if (!file_exists($file = APPLICATION_MODULES . $request->module . DS . $request->controller . '.php')) {
        throw new Error404Exception($response);
    }
    require $file;
    $controller = new $request->controller($response);
    Logger::addPhpLog($request);
    if (!method_exists($controller, $request->method)) {
        throw new Error404Exception($response);
    }
    $controller->handleRequest($request);
} catch (Error404Exception $exception) {
    require APPLICATION_MODULES . 'errors' . DS . 'ErrorsController.php';
    $controller = new ErrorsController($response);
开发者ID:ben33,项目名称:framework,代码行数:31,代码来源:index.php

示例7: foreach

        continue;
    }
    $skillList[$skill['id']] = $skill['name'];
}
foreach ($allGradebooks as $gradebook) {
    $gradebookList[$gradebook['id']] = $gradebook['name'];
}
/* Form */
$editForm = new FormValidator('skill_edit');
$editForm->addHeader(get_lang('SkillEdit'));
$editForm->addText('name', get_lang('Name'), true, ['id' => 'name']);
$editForm->addText('short_code', get_lang('ShortCode'), false, ['id' => 'short_code']);
$editForm->addSelect('parent_id', get_lang('Parent'), $skillList, ['id' => 'parent_id']);
$editForm->addSelect('gradebook_id', [get_lang('Gradebook'), get_lang('WithCertificate')], $gradebookList, ['id' => 'gradebook_id', 'multiple' => 'multiple', 'size' => 10]);
$editForm->addTextarea('description', get_lang('Description'), ['id' => 'description', 'rows' => 7]);
$editForm->addButtonSave(get_lang('Save'));
$editForm->addHidden('id', null);
$editForm->setDefaults($skillDefaultInfo);
if ($editForm->validate()) {
    $updated = $objSkill->edit($editForm->getSubmitValues());
    if ($updated) {
        Session::write('message', Display::return_message(get_lang('TheSkillHasBeenUpdated'), 'success'));
    } else {
        Session::write('message', Display::return_message(get_lang('CannotUpdateSkill'), 'error'));
    }
    Header::location(api_get_path(WEB_CODE_PATH) . 'admin/skill_list.php');
}
/* view */
$tpl = new Template(get_lang('SkillEdit'));
$tpl->assign('content', $editForm->returnForm());
$tpl->display_one_col_template();
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:31,代码来源:skill_edit.php

示例8: generateAction

 public function generateAction()
 {
     if (!empty($_POST)) {
         require_once MODEL . 'Translation.php';
         $translation = new Translation();
         foreach ($_POST as $variable => $languages) {
             $translation->languages = $languages;
             $translation->variable = $variable;
             $translation->save();
         }
     }
     $this->generate();
     Header::location(UrlFactory::module($this->module));
 }
开发者ID:ben33,项目名称:framework,代码行数:14,代码来源:TranslationsController.php

示例9: toModule

 /**
  * @static
  * @param string $pModule
  * @param string $pController
  * @param string $pAction
  * @param array $pParams
  * @return void
  */
 public static function toModule($pModule = 'front', $pController = "", $pAction = "", $pParams = array())
 {
     $rewriteURL = Configuration::$server_url . $pModule . "/";
     $rewriteURL .= Core::rewriteURL($pController, $pAction, $pParams);
     Header::location($rewriteURL);
 }
开发者ID:arno06,项目名称:Achilles,代码行数:14,代码来源:class.Go.php

示例10: initAction

 public function initAction()
 {
     DBFactory::get($this->module)->init();
     $this->getLayout('Default', '');
     Header::location(UrlFactory::module($this->module));
 }
开发者ID:ben33,项目名称:framework,代码行数:6,代码来源:BackofficeController.php

示例11: array

                    }
                    // Student Session inscription
                    if ($data['newStatus'] == ADVANCED_SUBSCRIPTION_QUEUE_STATUS_ADMIN_APPROVED) {
                        SessionManager::suscribe_users_to_session($data['sessionId'], array($data['studentUserId']), null, false);
                    }
                    // Send mails
                    $result['mailIds'] = $plugin->sendMail($data, $data['mailAction']);
                    // Check if mails were sent
                    if (!empty($result['mailIds'])) {
                        $result['error'] = false;
                        $result['errorMessage'] = 'User has been processed';
                        // Check if exist mail to render
                        if (isset($result['mailIds']['render'])) {
                            // Render mail
                            $url = $plugin->getRenderMailUrl(array('queueId' => $result['mailIds']['render']));
                            Header::location($url);
                            exit;
                        }
                    }
                } else {
                    $result['errorMessage'] = 'User queue can not be updated';
                }
            }
            break;
        default:
            $result['errorMessage'] = 'This action does not exist!';
    }
}
if ($showJSON) {
    // Echo result as json
    echo json_encode($result);
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:31,代码来源:advanced_subscription.ajax.php


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