本文整理汇总了PHP中Functions::setFlash方法的典型用法代码示例。如果您正苦于以下问题:PHP Functions::setFlash方法的具体用法?PHP Functions::setFlash怎么用?PHP Functions::setFlash使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Functions
的用法示例。
在下文中一共展示了Functions::setFlash方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionEdit
/**
* Edit Project action
*/
public function actionEdit()
{
if (Yii::app()->request->getParam('id') && ($model = Projects::model()->byUser()->findByPk(Yii::app()->request->getParam('id')))) {
if (isset($_POST['Projects'])) {
// Add description to the activity
if ($_POST['Projects']['title'] != $model->title) {
$model->activity['description'] = 'Changed title from <strong>{old}</strong> to <strong>{new}</strong>';
$model->activity['params']['{old}'] = $model->title;
$model->activity['params']['{new}'] = $_POST['Projects']['title'];
}
$model->setAttributes($_POST['Projects']);
if ($model->save()) {
Functions::setFlash(Yii::t('projects', 'Project Updated.'));
$this->redirect(array('/projects'));
}
}
// Add title
$this->pageTitle[] = Yii::t('projects', 'Editing Project');
$this->render('edit', array('model' => $model));
} else {
$this->redirect(array('/projects'));
}
}
示例2: array
<?php
require_once 'includes/_header.php';
// Connexion via le CAS
if (!empty($_GET['ticket'])) {
$_SESSION['flash'] = array();
if ($Auth->loginUsingCas($_GET['ticket'])) {
Functions::setFlash("Authentification réussie !", 'success');
header('Location:index.php');
exit;
} else {
}
}
?>
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="utf-8">
<title>Connexion</title> <!--afficher dans le titre de la page web Bonjour icam précédé de title-for-layout qui est préciser dans chaque page-->
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Site internet Admin Ginger - Connexion">
<meta name="author" content="Antoine Giraud">
<link rel="shortcut icon" href="favicon.png">
<!-- Le styles -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<style type="text/css">
body {
padding-top: 40px;
padding-bottom: 40px;
background-color: #eee;
示例3: actionEdit
/**
* Update a ticket
*/
public function actionEdit()
{
if (Yii::app()->request->getParam('id') && ($model = Tickets::model()->findByPk(Yii::app()->request->getParam('id')))) {
// Form Submited
if (isset($_POST['Tickets'])) {
$model->setScenario('ticketupdate');
$model->setAttributes($_POST['Tickets']);
// Was the form submitted?
if (isset($_POST['submit'])) {
if ($model->save()) {
// Mark flash and redirect
Functions::setFlash(Yii::t('tickets', 'Tickets: Ticket Updated.'));
$this->redirect(array('/tickets'));
}
}
}
}
// Add title
$title = Yii::t('tickets', 'Updating Ticket');
$this->pageTitle[] = $title;
$this->render('create', array('model' => $model, 'title' => $title));
}
示例4: forbidden
/**
* Redirige un utilisateur
* */
function forbidden()
{
Functions::setFlash('<strong>Identification requise</strong> Vous ne pouvez accéder à cette page.', 'danger');
header('Location:connection.php' . (!empty($_GET['ticket']) ? '?ticket=' . $_GET['ticket'] : ''));
exit;
}
示例5: delete
/**
* Permet de supprimer une valeur dans la bdd.
* @param string $table
* @param array $data
* @return boolean
**/
public function delete($table, $data = null)
{
$fields = array();
if (is_array($data)) {
foreach ($data as $k => $v) {
if (!is_numeric($v)) {
$v = '"' . htmlspecialchars($v, ENT_QUOTES, "UTF-8") . '"';
}
$fields[] = "{$k}={$v}";
}
} else {
$fields[] = $data;
}
if (!empty($data)) {
$sql = 'DELETE FROM ' . $table . ' WHERE ' . implode(' AND ', $fields);
} else {
$sql = 'DELETE FROM ' . $table;
}
try {
$pre = $this->db->query($sql);
return true;
} catch (PDOException $e) {
Functions::setFlash($e, 'danger');
}
}
示例6: actionrevisions
/**
* View a wiki page revisions list
*
*/
public function actionrevisions()
{
if (Yii::app()->request->getParam('id') && ($model = WikiPages::model()->findByPk(Yii::app()->request->getParam('id')))) {
$revisions = WikiPagesRev::model()->with(array('author'))->byPageId($model->id)->orderBy('revisionid', 'desc')->findAll();
$title = Yii::t('wiki', 'Viewing Wiki Page Revisions');
$this->pageTitle[] = $title;
$this->render('revisions', array('title' => $title, 'model' => $model, 'revisions' => $revisions));
} else {
Functions::setFlash(Yii::t('wiki', 'Sorry, we could not find that page.'));
$this->redirect(array('/wiki'));
}
}