本文整理汇总了PHP中ST::redirect方法的典型用法代码示例。如果您正苦于以下问题:PHP ST::redirect方法的具体用法?PHP ST::redirect怎么用?PHP ST::redirect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ST
的用法示例。
在下文中一共展示了ST::redirect方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: savePwd
public function savePwd($userId)
{
if (!Auth::compareIds($userId, App::$instance)) {
$this->error('403');
}
Token::checkToken();
$request = Request::createFromGlobals();
$request = $request->request;
//check pass
$this->validator->validate(['Старый пароль' => [$request->get('old_pwd'), 'required'], 'Новый_пароль' => [$request->get('new_pwd'), 'required|min(5)|max(25)|pwd'], 'Новый пароль подтверждение' => [$request->get('new_pwd_confirm'), 'required|matches(Новый_пароль)']]);
//if no passes
if (!$this->validator->passes()) {
App::$instance->MQ->setMessage($this->validator->errors()->all());
ST::redirect("back");
}
$oldPwd = md5($request->get('old_pwd'));
if (User::where("id", $userId)->where('password', $oldPwd)->count()) {
$user = User::find($userId);
$user->password = md5($request->get('new_pwd'));
try {
$user->save();
} catch (Exception $e) {
App::$instance->MQ->setMessage('Ошибка при сохранении');
}
App::$instance->MQ->setMessage('Пароль обновлен');
ST::redirect("back");
} else {
App::$instance->MQ->setMessage('Старый пароль введен не верно');
ST::redirect("back");
}
}
示例2: store
public function store()
{
Token::checkToken();
$xml = new SimpleXMLElement('<root/>');
// dump($this->request->request->get('modules'));
// die;
if ($this->request->request->has('modules')) {
foreach ($this->request->request->get('modules') as $module) {
$this->validator->validate(['name' => [$module['name'], 'required|max(255)'], 'description' => [$module['description'], 'required|max(560)'], 'help' => [$module['help'], 'required|max(1000)'], 'value' => [$module['value'], 'between(0,1)']]);
//if no passes
if (!$this->validator->passes()) {
$this->putUserDataAtBackPack($this->request);
App::$instance->MQ->setMessage($this->validator->errors()->all());
ST::redirect("back");
}
$srvXml = $xml->addChild('module');
$srvXml->addAttribute('name', $module['name']);
$srvXml->addAttribute('description', $module['name']);
$srvXml->addAttribute('help', $module['help']);
$srvXml->addAttribute('value', intval($module['value']));
}
}
$xml->asXML("config/modules-cfg.xml");
App::$instance->MQ->setMessage('Список обновлен');
App::$instance->log->logWrite(LOG_CONFIG_CHANGE, 'Изменен список модулей системы');
ST::redirect("back");
}
示例3: isDefaultUserIteractBlock
private function isDefaultUserIteractBlock($id)
{
Auth::isAdminOrDie(App::$instance);
if (in_array($id, [1])) {
App::$instance->MQ->setMessage('Нелья редактировать системныe записи');
ST::redirect("back");
}
}
示例4: unmark
public function unmark($caVksId)
{
Auth::isAdminOrDie(App::$instance);
foreach (AdminCaNote::where('vks_id', $caVksId)->get() as $caVks) {
$caVks->delete();
}
App::$instance->MQ->setMessage("У ВКС ЦА {$caVksId} удален флаг");
ST::redirect('back');
}
示例5: delete
public function delete($id)
{
Auth::isAdminOrDie(App::$instance);
if ($id == 1) {
App::$instance->MQ->setMessage("Это удалить нельзя, просто переименуйте как вам нужно");
ST::redirect('back');
}
$department = Department::findorFail($id);
$department->delete();
App::$instance->MQ->setMessage("Успешно удалено");
App::$instance->log->logWrite(LOG_CONFIG_CHANGE, 'Подразделение удалено' . $department->name);
ST::redirectToRoute('Departments/index');
}
示例6: pushToStack
function pushToStack($vks_id, $force = false)
{
try {
$vks = Vks::approved()->notEnded()->findOrFail($vks_id);
} catch (Exception $e) {
$this->error('404');
}
if (!OutlookCalendarRequest::where('user_id', App::$instance->user->id)->where('vks_id', $vks->id)->count()) {
OutlookCalendarRequest::create(array('user_id' => App::$instance->user->id, 'vks_id' => $vks->id, 'request_type' => OutlookCalendarRequest::REQUEST_TYPE_NEW, 'send_status' => OutlookCalendarRequest::SEND_STATUS_REQUIRED));
App::$instance->log->logWrite(LOG_OTHER_EVENTS, "New Outlook request create for " . App::$instance->user->login . ', vks: ' . $vks->id);
App::$instance->MQ->setMessage("Приглашение сформировано, ожидайте, отправка будет произведена в течении 2х минут");
} else {
if ($force) {
$reSend = OutlookCalendarRequest::where('user_id', App::$instance->user->id)->where('vks_id', $vks->id)->first();
$reSend->send_status = OutlookCalendarRequest::SEND_STATUS_REQUIRED;
$reSend->save();
App::$instance->log->logWrite(LOG_OTHER_EVENTS, "New Outlook request create for " . App::$instance->user->login . ', vks: ' . $vks->id);
App::$instance->MQ->setMessage("Приглашение сформировано, ожидайте, отправка будет произведена в течении 2х минут");
} else {
App::$instance->MQ->setMessage("Приглашение уже отправлялось в ваш календарь, <a class='confirmation' href='" . ST::route('OutlookCalendarRequest/pushToStack/' . $vks->id . '/forced') . "'>Отправить еще раз</a>");
}
}
ST::redirect('back');
}
示例7: update
public function update($blocked_time_id)
{
$request = $this->request->request;
$this->validator->validate(['Дата начала блокировки' => [$request->get('start_at_date'), 'required|date'], 'Дата окончания блокировки' => [$request->get('end_at_date'), 'required|date'], 'Время начала блокировки' => [$request->get('start_at_time'), 'required'], 'Время окончания блокировки' => [$request->get('end_at_time'), 'required'], 'Описание' => [$request->get('description'), 'required|max(360)']]);
//if no passes
if (!$this->validator->passes()) {
$this->putUserDataAtBackPack($this->request);
App::$instance->MQ->setMessage($this->validator->errors()->all());
ST::redirect("back");
}
//prepare dates
$start_at = date_create($request->get('start_at_date') . " " . $request->get('start_at_time') . ":00");
$end_at = date_create($request->get('end_at_date') . " " . $request->get('end_at_time') . ":00");
if ($end_at <= $start_at) {
$this->putUserDataAtBackPack($this->request);
App::$instance->MQ->setMessage('Дата начала не может быть больше или равна окончанию', 'danger');
ST::redirect("back");
}
// die;
$block = BlockedTime::findOrFail($blocked_time_id);
$block->start_at = $start_at;
$block->end_at = $end_at;
$block->vks_type_blocked = VKS::TYPE_SIMPLE;
$block->description = $request->get('description');
$block->save();
App::$instance->log->logWrite(LOG_CONFIG_CHANGE, "Блокировка {$block->start_at} - {$block->end_at}, {$block->blocked_type_named} изменена");
App::$instance->MQ->setMessage("Блокировка изменена");
ST::redirectToRoute('BlockedTime/index');
}
示例8: storeHelp
public function storeHelp()
{
Token::checkToken();
$xml = new SimpleXMLElement('<root/>');
if ($this->request->request->has('help')) {
foreach ($this->request->request->get('help') as $help) {
$this->validator->validate([$help['humanized'] => [$help['content'], 'required|max(320)']]);
//if no passes
if (!$this->validator->passes()) {
$this->putUserDataAtBackPack($this->request);
App::$instance->MQ->setMessage($this->validator->errors()->all());
ST::redirect("back");
}
$srvXml = $xml->addChild('element');
$srvXml->addChild('humanized', $help['humanized']);
$srvXml->addChild('name', $help['name']);
$srvXml->addChild('content', $help['content']);
}
$xml->asXML("config/help_standart.xml");
App::$instance->MQ->setMessage('Список обновлен');
App::$instance->log->logWrite(LOG_CONFIG_CHANGE, 'изменены сообщения помощи');
} else {
App::$instance->MQ->setMessage('Нет обязательного параметра');
}
return ST::redirectToRoute('index/index');
}
示例9: backWithData
public function backWithData($message, $message_class = 'danger')
{
$this->putUserDataAtBackPack($this->request);
App::$instance->MQ->setMessage($message, $message_class);
ST::redirect("back");
}
示例10: ctrRedirAndShowMessage
static function ctrRedirAndShowMessage($location, $message)
{
// @session_start();
$_SESSION['pm'] = $message;
ST::redirect($location);
}
示例11: restoreDefaultsColors
public function restoreDefaultsColors()
{
$user = User::find(App::$instance->user->id);
$user->colors = Null;
$user->save();
App::$instance->MQ->setMessage('Цветовая схема сброшена');
ST::redirect("back");
}
示例12: makeExcel
//.........这里部分代码省略.........
/** Include PHPExcel */
require_once CORE_REPOSITORY_REAL_PATH . 'phpExcel/PHPExcel.php';
// Create new PHPExcel object
$objPHPExcel = new PHPExcel();
// Set document properties
$objPHPExcel->getProperties()->setCreator("Vks")->setLastModifiedBy("Vks")->setTitle("Отчет о созданных ВКС")->setSubject("Отчет о созданных ВКС")->setDescription("")->setKeywords("office 2007 openxml php")->setCategory("VKS REPORT");
// Add some data
$number = '1';
$letter = 'A';
$sheet = $objPHPExcel->getActiveSheet();
$sheet->getRowDimension($number)->setRowHeight(40);
$sheet->getColumnDimension($letter)->setWidth(5);
$objPHPExcel->setActiveSheetIndex(0)->setCellValue($letter++ . $number, 'id');
$sheet->getColumnDimension($letter)->setWidth(25);
$objPHPExcel->setActiveSheetIndex(0)->setCellValue($letter++ . $number, 'Название');
$sheet->getColumnDimension($letter)->setWidth(15);
$objPHPExcel->setActiveSheetIndex(0)->setCellValue($letter++ . $number, 'Дата');
$sheet->getColumnDimension($letter)->setWidth(15);
$objPHPExcel->setActiveSheetIndex(0)->setCellValue($letter++ . $number, 'Начало');
$sheet->getColumnDimension($letter)->setWidth(15);
$objPHPExcel->setActiveSheetIndex(0)->setCellValue($letter++ . $number, 'Окончание');
$sheet->getColumnDimension($letter)->setWidth(25);
$objPHPExcel->setActiveSheetIndex(0)->setCellValue($letter++ . $number, 'Подразделение');
$sheet->getColumnDimension($letter)->setWidth(25);
$objPHPExcel->setActiveSheetIndex(0)->setCellValue($letter++ . $number, 'Заказчик ФИО');
$sheet->getColumnDimension($letter)->setWidth(25);
$objPHPExcel->setActiveSheetIndex(0)->setCellValue($letter++ . $number, 'Заказчик тел.');
$sheet->getColumnDimension($letter)->setWidth(25);
$objPHPExcel->setActiveSheetIndex(0)->setCellValue($letter++ . $number, 'Заказчик почта');
$sheet->getColumnDimension($letter)->setWidth(25);
$objPHPExcel->setActiveSheetIndex(0)->setCellValue($letter++ . $number, 'Статус');
$sheet->getColumnDimension($letter)->setWidth(25);
$objPHPExcel->setActiveSheetIndex(0)->setCellValue($letter++ . $number, 'Тип');
$sheet->getColumnDimension($letter)->setWidth(15);
$objPHPExcel->setActiveSheetIndex(0)->setCellValue($letter++ . $number, 'Участники с раб. мест');
$sheet->getColumnDimension($letter)->setWidth(5);
$objPHPExcel->setActiveSheetIndex(0)->setCellValue($letter++ . $number, 'Участники из справочника');
$sheet->getColumnDimension($letter)->setWidth(5);
$objPHPExcel->setActiveSheetIndex(0)->setCellValue($letter++ . $number, 'Владелец');
$sheet->getColumnDimension($letter)->setWidth(25);
$objPHPExcel->setActiveSheetIndex(0)->setCellValue($letter++ . $number, 'Утвердил админ');
$sheet->getColumnDimension($letter)->setWidth(5);
$objPHPExcel->setActiveSheetIndex(0)->setCellValue($letter++ . $number, 'Запись ВКС');
$sheet->getColumnDimension($letter)->setWidth(5);
$style = array('alignment' => array('horizontal' => PHPExcel_Style_Alignment::HORIZONTAL_CENTER, 'vertical' => PHPExcel_Style_Alignment::VERTICAL_CENTER));
$sheet->getStyle("A1:Z500")->applyFromArray($style);
$number = '2';
foreach ($collectVkses as $vks) {
$letter = 'A';
//always start at A
$objPHPExcel->setActiveSheetIndex(0)->setCellValue($letter++ . $number, $vks->id);
$objPHPExcel->setActiveSheetIndex(0)->setCellValue($letter++ . $number, $vks->title);
$objPHPExcel->setActiveSheetIndex(0)->setCellValue($letter++ . $number, $vks->humanized->date);
$objPHPExcel->setActiveSheetIndex(0)->setCellValue($letter++ . $number, $vks->humanized->startTime);
$objPHPExcel->setActiveSheetIndex(0)->setCellValue($letter++ . $number, $vks->humanized->endTime);
$objPHPExcel->setActiveSheetIndex(0)->setCellValue($letter++ . $number, $vks->department_rel ? $vks->department_rel->prefix . ". " . $vks->department_rel->name : '-');
$objPHPExcel->setActiveSheetIndex(0)->setCellValue($letter++ . $number, $vks->init_customer_fio);
$objPHPExcel->setActiveSheetIndex(0)->setCellValue($letter++ . $number, $vks->init_customer_phone);
$objPHPExcel->setActiveSheetIndex(0)->setCellValue($letter++ . $number, $vks->init_customer_mail);
$objPHPExcel->setActiveSheetIndex(0)->setCellValue($letter++ . $number, $vks->humanized->status);
$type = '';
$type .= $vks->is_simple ? 'Простая' : 'Стандартная';
$type .= $vks->other_tb_required ? '+ТБ-ТБ' : '';
$type .= !$vks->other_tb_required && $vks->link_ca_vks_id ? '+По приглашению ЦА' : '';
$objPHPExcel->setActiveSheetIndex(0)->setCellValue($letter++ . $number, $type);
$objPHPExcel->setActiveSheetIndex(0)->setCellValue($letter++ . $number, $vks->in_place_participants_count);
$objPHPExcel->setActiveSheetIndex(0)->setCellValue($letter++ . $number, count($vks->participants));
$objPHPExcel->setActiveSheetIndex(0)->setCellValue($letter++ . $number, $vks->owner ? $vks->owner->login : '-');
$objPHPExcel->setActiveSheetIndex(0)->setCellValue($letter++ . $number, $vks->approver ? $vks->approver->login : "-");
$objPHPExcel->setActiveSheetIndex(0)->setCellValue($letter++ . $number, $vks->record_required ? 'да' : 'нет');
$number++;
}
// Miscellaneous glyphs, UTF-8
// $objPHPExcel->setActiveSheetIndex(0)
// ->setCellValue('A4', 'Miscellaneous glyphs')
// ->setCellValue('A5', 'Что насчет русских букв!');
// Rename worksheet
// $objPHPExcel->getActiveSheet()->setTitle('Simple');
// Set active sheet index to the first sheet, so Excel opens this as the first sheet
$objPHPExcel->setActiveSheetIndex(0);
// Redirect output to a client’s web browser (Excel2007)
header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
header('Content-Disposition: attachment;filename="vks_report' . date_create()->getTimestamp() . '.xlsx"');
header('Cache-Control: max-age=0');
// If you're serving to IE 9, then the following may be needed
header('Cache-Control: max-age=1');
// If you're serving to IE over SSL, then the following may be needed
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
// Date in the past
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
// always modified
header('Cache-Control: cache, must-revalidate');
// HTTP/1.1
header('Pragma: public');
// HTTP/1.0
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
ob_end_clean();
$objWriter->save('php://output');
ST::redirect('Report/index');
}
示例13: delete
public function delete($id)
{
$att = Attendance::findOrFail($id);
$att->delete();
App::$instance->MQ->setMessage("Успешно удалено");
ST::redirect("?route=AttendanceNew/show/" . $att->parent_id);
}
示例14: publicStatusChange
public function publicStatusChange($vksId)
{
try {
$vks = Vks::findorFail($vksId);
} catch (Exception $e) {
$this->error("404", $e->getMessage());
}
if (!$this->isThisUserCanEdit($vks)) {
$this->error('403');
}
$vks->is_private = $vks->is_private ? 0 : 1;
$vks->save();
$m = $vks->is_private ? 'Скрыт' : 'Виден всем';
App::$instance->MQ->setMessage("Вкс {$vks->id}, видимость кода изменена, теперь код - " . $m);
OutlookCalendarRequest_controller::changeRequestTypeAndPutToResend($vks->id, OutlookCalendarRequest::REQUEST_TYPE_UPDATE);
ST::redirect('back');
}