本文整理汇总了PHP中Flash::addFlash方法的典型用法代码示例。如果您正苦于以下问题:PHP Flash::addFlash方法的具体用法?PHP Flash::addFlash怎么用?PHP Flash::addFlash使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Flash
的用法示例。
在下文中一共展示了Flash::addFlash方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
public static function run()
{
$sessao = new TSessao(true);
include 'util/Validacao.php';
$flashes = null;
$usuario = $sessao->getVar('usuario');
include 'app.functions/validate.php';
$valida = validate($usuario);
//include 'relatorios/teste.php';
if ($valida) {
if ($usuario) {
$menu = new TMenu($usuario->permissoes, array('gerenciar'));
TApplication::setStyle('menu');
TApplication::setStyle('controler_bar');
}
if (!$_GET) {
if ($usuario == null) {
require "app.comuns/app.control/login.php";
TApplication::setStyle('login');
$templatePage = "app.comuns/template/login.phtml";
} else {
if ($sessao->getVar('msg1') != null) {
if ($sessao->getVar('msg1') == 5) {
Flash::addFlash('Você não tem permissão!');
$flashes = Flash::getFlashes();
$sessao->removeVar('msg1');
}
}
$templatePage = "app.comuns/template/panel.phtml";
}
} else {
$modulo = isset($_GET['modulo']) ? $_GET['modulo'] : null;
$page = isset($_GET['page']) ? $_GET['page'] : null;
if (file_exists("modulos/{$modulo}/app.control/{$page}.php")) {
require "modulos/{$modulo}/app.control/{$page}.php";
}
if (file_exists("modulos/{$modulo}/template/{$page}.phtml")) {
$templatePage = "modulos/{$modulo}/template/{$page}.phtml";
}
}
if (isset($validacao)) {
if ($validacao !== true) {
$erros = $validacao;
}
}
if (Flash::hasFlashes()) {
$flashes = Flash::getFlashes();
}
if (!isset($_GET['ajax'])) {
TApplication::setStyle('style');
TApplication::setStyle('principal');
TApplication::setStyle('redmond/jquery-ui-1.8.16.custom');
require 'layout/index.phtml';
}
} else {
header('location: index.php');
}
}
示例2:
<?php
$id = $_GET['key'];
$usuario = Utils::findById($id, 'usuarios', 'id_usuario');
$itens = EmpMapper::getEmps($id);
if ($sessao->getVar('msg') != null) {
if ($sessao->getVar('msg') == 1) {
Flash::addFlash('Empréstimo concluído.');
$sessao->removeVar('msg');
}
}
示例3: filter_var
$foodOrder->setEmail($email);
$foodOrder->setProductId($product_id);
//set default status
$foodOrder->setStatus('PENDING');
//$foodOrder -> setPickupTime($pickup_time);
$foodOrder->setDate(date("Y-m-d H:i:s"));
$status = '';
if (isset($_POST['food_order']['status'])) {
$status = filter_var($_POST['food_order']['status'], FILTER_SANITIZE_STRING);
} else {
$status = 'PENDING';
}
$data = array('product_id' => $_POST['food_order']['order_list'], 'user_id' => 1, 'full_name' => 'Bob Smith', 'email' => 'abc123@hotmail.com', 'phone_number' => '0278839406', 'date' => date("Y-m-d H:i:s"), 'status' => $status);
// var_dump($_POST);
// die();
// map
FoodOrderMapper::map($foodOrder, $data);
// validate
// $errors = FoodOrderValidator::validate($foodOrder);
// if (empty($errors)) {
// save
$dao = new FoodOrderDao();
$foodOrder = $dao->save($foodOrder);
Flash::addFlash('Thank you for ordering with us.');
// redirect
Utils::redirect('home');
// }
}
$productDao = new ProductDao();
$product_id = Utils::getUrlParam('product_id');
$products = $productDao->find();
示例4: array
// private $createdBy;
// private $modifiedBy;
// private $description;
// private $nameOfRestaurant;
// private $overallRating;
// private $restaurant_id;
// private $username;
// private $status = self::PENDING;
$blogPostData = array('content' => $_POST['content'], 'date' => $_POST['date'] . ' 00:00:00', 'created_by' => 'char', 'modified_by' => 'char', 'description' => $_POST['content'], 'restaurant_id' => '44', 'status' => 'pending', 'modified_date' => $_POST['date'] . ' 00:00:00');
$blogRestaurantData = array('name_of_restaurant' => $_POST['name_of_restaurant'], 'overall_rating' => $_POST['overall_rating']);
$blogChipData = array('chip_colour' => $_POST['chip_colour'], 'chip_crunch' => $_POST['chip_crunch'], 'chip_condiments' => $_POST['chip_condiments'], 'chip_consistency' => $_POST['chip_consistency'], 'chip_cash' => $_POST['chip_cash'], 'chip_charisma' => $_POST['chip_charisma']);
// map
BlogPostMapper::simpleMap($blogPost, $blogPostData);
BlogRestaurantMapper::map($blogRestaurant, $blogRestaurantData);
BlogChipMapper::map($blogChip, $blogChipData);
// validate
$errors = BlogPostValidator::validate($blogPost);
$errors = BlogRestaurantValidator::validate($blogRestaurant);
if (empty($errors)) {
// save
$blogPostDao = new BlogPostDao();
$blogRestaurantDao = new BlogRestaurantDao();
$blogChipDao = new BlogChipDao();
$blogPost = $blogPostDao->save($blogPost);
$blogRestaurant = $blogRestaurantDao->save($blogRestaurant);
$blogChip = $blogChipDao->save($blogChip);
Flash::addFlash('Thanks for the review Chipper!');
// redirect
Utils::redirect('list', array('status' => 'pending'));
}
}
示例5: header
if (array_key_exists('key', $_GET)) {
$id = $_GET['key'];
$requisicoes = Utils::findById($id, 'req_manutencao', 'id_requisicao');
if ($requisicoes['requisitante_id'] != $sessao->getVar('usuario')->id_usuario) {
$sessao->addVar('msg', 3);
header('location:index.php?modulo=manutencoes&page=visualizar');
}
}
if (array_key_exists('save', $_POST)) {
$dados = array('dt_requisicao' => array('Data Atual', 'tipo' => 'data'), 'equipamento_requisicao' => array('Equipamento'), 'local_equipamento' => array('Localização'), 'defeito_requisicao' => array('Defeito'));
$validacao = ValidaFormulario($dados);
if ($validacao === true) {
$data = array('dt_requisicao' => $_POST['dt_requisicao'], 'equipamento_requisicao' => $_POST['equipamento_requisicao'], 'local_equipamento' => $_POST['local_equipamento'], 'defeito_requisicao' => $_POST['defeito_requisicao'], 'requisitante_id' => $sessao->getVar('usuario')->id_usuario, 'estado_id' => '1');
$requisicao = new Requerir();
RequerirMapper::map($requisicao, $data);
RequerirMapper::RequisicaoInsert($requisicao);
$sessao->addVar('msg', 1);
header('location:index.php?modulo=manutencoes&page=visualizar');
} else {
Flash::addFlash($validacao);
}
}
if (array_key_exists('update', $_POST)) {
$data = array('dt_requisicao' => $_POST['dt_requisicao'], 'equipamento_requisicao' => $_POST['equipamento_requisicao'], 'local_equipamento' => $_POST['local_equipamento'], 'defeito_requisicao' => $_POST['defeito_requisicao'], 'requisitante_id' => $sessao->getVar('usuario')->id_usuario, 'estado_id' => '1');
$requisicao = new Requerir();
$requisicao->setIdRequisicao($id);
RequerirMapper::map($requisicao, $data);
RequerirMapper::RequisicaoUpdate($requisicao);
$sessao->addVar('msg', 2);
header('location:index.php?modulo=manutencoes&page=visualizar');
}
示例6: User
<?php
$user_id = $_POST['user']['id'];
$user_obj = null;
$updatedUser_obj = null;
$user_obj = new User();
$updatedUser_obj = new User();
if (array_key_exists('find', $_POST)) {
$data = array('id' => $_POST['user']['id']);
UserMapper::map($user_obj, $data);
$dao = new UserDao();
$foundUser = $dao->findById($user_id);
}
if (array_key_exists('update', $_POST)) {
$data = array('id' => $_POST['user']['id'], 'first_name' => $_POST['user']['first_name'], 'user_password' => $_POST['user']['user_password']);
UserMapper::map($updatedUser_obj, $data);
$dao = new UserDao();
$dao->update($updatedUser_obj);
Flash::addFlash('user record(s) updated successfully :)');
}
示例7: SearchCriteria
<?php
$criteria = new SearchCriteria();
if (array_key_exists('busca', $_POST)) {
$criteria->setValueCriteria($_POST['CampoBusca']);
}
$usuarios = UsuarioMapper::getUsuarios($criteria);
$sessao->addVar('usuarios', $usuarios);
if (array_key_exists('empCancel', $_GET)) {
$sessao->removeVar('mat');
}
if ($sessao->getVar('msg') != null) {
if ($sessao->getVar('msg') == 1) {
Flash::addFlash('Usuário alterado.');
} elseif ($sessao->getVar('msg') == 2) {
Flash::addFlash('Permissão alterada.');
} elseif ($sessao->getVar('msg') == 3) {
Flash::addFlash('Empréstimo salvo com sucesso.');
} elseif ($sessao->getVar('msg') == 4) {
Flash::addFlash("Usuário excluído");
}
$sessao->removeVar('msg');
}
示例8: TodoDao
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the GPL Version 2 section of the License file that
* accompanied this code. If applicable, add the following below the
* License Header, with the fields enclosed by brackets [] replaced by
* your own identifying information:
* "Portions Copyrighted [year] [name of copyright owner]"
*
* If you wish your version of this file to be governed by only the CDDL
* or only the GPL Version 2, indicate your decision by adding
* "[Contributor] elects to include this software in this distribution
* under the [CDDL or GPL Version 2] license." If you do not indicate a
* single choice of license, a recipient has the option to distribute
* your version of this file under either the CDDL, the GPL Version 2 or
* to extend the choice of license to its licensees as provided above.
* However, if you add GPL Version 2 code and therefore, elected the GPL
* Version 2 license, then the option applies only if the new code is
* made subject to such option by the copyright holder.
*
* Contributor(s):
*
* Portions Copyrighted 2011 Sun Microsystems, Inc.
*/
$todo = Utils::getTodoByGetId();
$todo->setStatus(Utils::getUrlParam('status'));
if (array_key_exists('comment', $_POST)) {
$todo->setComment($_POST['comment']);
}
$dao = new TodoDao();
$dao->save($todo);
Flash::addFlash('TODO status changed successfully.');
Utils::redirect('detail', array('id' => $todo->getId()));
示例9: MerchandiseDao
<?php
if (isset($_GET['item_id'])) {
$dao = new MerchandiseDao();
$item_id = Utils::getUrlParam('item_id');
$merchandise = $dao->delete($item_id);
Flash::addFlash('Item deleted successfully.');
// redirect
Utils::redirect('home');
} else {
Flash::addFlash("Cannot delete item.");
}
示例10: elseif
// redirect
Utils::redirect('list');
} elseif (array_key_exists('save', $_POST)) {
// for security reasons, do not map the whole $_POST['todo']
//pretending to have values in $_POST
//$data = array('first_name' => 'Bob', 'no_of_passengers' => 2);
// private $id;
// private $date;
// private $content;
// private $createdBy;
// private $modifiedBy;
// private $description;
// private $nameOfRestaurant;
// private $overallRating;
// private $restaurant_id;
// private $username;
// private $status = self::PENDING;
$data = array('username' => $_POST['username'], 'email' => $_POST['email'], 'password' => $_POST['password']);
// map
BlogMemberMapper::map($blogMember, $data);
// validate
$errors = BlogMemberValidator::validate($blogMember);
if (empty($errors)) {
// save
$blogMemberDao = new BlogMemberDao();
$blogMember = $blogMemberDao->save($blogMember);
Flash::addFlash('Thanks for Registering Chipper!');
// redirect
Utils::redirect('list', array('status' => 'pending'));
}
}
示例11: elseif
//$flightBooking->setPriority(Todo::PRIORITY_MEDIUM);
//$dueOn = new DateTime("+1 day");
//$dueOn->setTime(0, 0, 0);
//$flightBooking->setDueOn($dueOn);
}
if (array_key_exists('cancel', $_POST)) {
// redirect
Utils::redirect('home');
} elseif (array_key_exists('enter', $_POST)) {
// for security reasons, do not map the whole $_POST['todo']
//pretending to have values in $_POST
$data = array('username' => 'char', 'password' => 'test', 'email' => 'char@cm.com');
// $data = array(
// 'member_id'=> $_POST ['member_id'],
// 'username' => $_POST ['username'],
// 'password' => $_POST ['password'],
// 'email' => $_POST ['email']
// );
// map
BlogMemberMapper::map($blogMember, $data);
// validate
$errors = BlogMemberValidator::validate($blogMember);
if (empty($errors)) {
// save
$blogMemberDao = new BlogMemberDao();
$blogMember = $blogMemberDao->enter($blogMember);
Flash::addFlash('Login Succesful!');
// redirect
Utils::redirect('list', array('status' => 'pending'));
}
}
示例12: json_encode
<?php
if (isset($_POST['val'])) {
$itens = SolMapper::getItens($_POST['val']);
echo json_encode($itens);
}
$criteria = new SearchCriteria();
if (array_key_exists('busca', $_POST)) {
$criteria->setValueCriteria($_POST['CampoBusca']);
}
$solicitacoes = SolMapper::getSolicitacoes($criteria);
if ($sessao->getVar('msg') != null) {
if ($sessao->getVar('msg') == '2') {
Flash::addFlash('Solicitação excluida!');
}
if ($sessao->getVar('msg') == '3') {
Flash::addFlash('Solicitação registrada!');
}
$sessao->removeVar('msg');
}
示例13: array
$merchandise = null;
$errors = array();
$id_error = '';
//check if edit
$edit = array_key_exists('item_id', $_GET);
if ($edit) {
$merchandise = Utils::getMerchandiseByGetId();
} else {
// set defaults
$merchandise = new Merchandise();
}
//Breaking dry principle, but can be fixed
//netbeans wouldnt work until I added the backslash, not 100% if correct
if (array_key_exists('cancel', $_POST)) {
} elseif (array_key_exists('save', $_POST)) {
$data = array('item_name' => filter_var($_POST['merchandise']['item_name'], FILTER_SANITIZE_STRING), 'item_price' => filter_var($_POST['merchandise']['item_price'], FILTER_SANITIZE_NUMBER_FLOAT), 'original_url' => filter_var($_POST['merchandise']['original_url'], FILTER_SANITIZE_URL), 'img_url' => filter_var($_POST['merchandise']['img_url'], FILTER_SANITIZE_STRING), 'company_id' => filter_var($_POST['merchandise']['company_id'], FILTER_SANITIZE_NUMBER_INT));
// map
MerchandiseMapper::map($merchandise, $data);
// validate
// Couldnt get the company id validation to work after 5 hours, hopefully it doesnt affect my pass grade.
$errors = MerchandiseValidator::validate($merchandise);
if (empty($errors)) {
// save
$dao = new MerchandiseDao();
$merchandise = $dao->save($merchandise);
Flash::addFlash('Item saved successfully.');
// redirect
Utils::redirect('home');
}
}
示例14: header
}
}
}
if (array_key_exists('del', $_GET)) {
$sessao->delArray('matSol', $_GET['nome']);
header('location:index.php?modulo=solicitacoes&page=gerar&items=1&add-mat=1');
}
if (array_key_exists('save-aquisicao', $_GET)) {
$dados = $sessao->getVar('infos');
$sol = new Sol();
$sol->setRequisitanteId($sessao->getVar('usuario')->id_usuario);
SolMapper::map($sol, $dados);
$data = explode(' ', $dados['dt_aquisicao_inicial']);
$date_inicial = Utils::conv_data_to_us($data[0]);
$sol->setDtAquisicaoInicial($date_inicial . ' ' . $data[1]);
if ($sessao->getVar('matSol') != null) {
foreach ($sessao->getVar('matSol') as $item) {
$itemObject = new ItemSol();
ItemSolMapper::map($itemObject, $item);
$sol->addItens($itemObject);
}
SolMapper::insert($sol);
$sessao->removeVar('matSol');
$sessao->addVar('msg', 3);
$sessao->removeVar('infos');
header('location:index.php?modulo=solicitacoes&page=visualizar');
} else {
header('location:index.php?modulo=solicitacoes&page=gerar&items=1');
Flash::addFlash('Por favor adicione um item.');
}
}
示例15: array
<?php
$errors = array();
$user = null;
$edit = array_key_exists('id', $_GET);
if ($edit) {
$user = Utils::getUserByGetId();
} else {
$user = new User();
}
if (array_key_exists('cancel', $_POST)) {
} elseif (array_key_exists('save', $_POST)) {
$data = array('first_name' => $_POST['user']['first_name'], 'user_password' => $_POST['user']['user_password']);
// map
UserMapper::map($user, $data);
// validate
$errors = UserValidator::validate($user);
// validate
if (empty($errors)) {
// save
$dao = new UserDao();
$user = $dao->save($user);
Flash::addFlash('Success sign in :)');
// redirect
Utils::redirect('home');
}
}