本文整理汇总了PHP中Flash::error方法的典型用法代码示例。如果您正苦于以下问题:PHP Flash::error方法的具体用法?PHP Flash::error怎么用?PHP Flash::error使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Flash
的用法示例。
在下文中一共展示了Flash::error方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: subir
public function subir($contrato_id)
{
$this->contrato = $contrato_id;
if (Input::hasPost('oculto')) {
//para saber si se envió el form
$_FILES['archivo']['name'] = date("Y_m_d_H_i_s_") . $_FILES['archivo']['name'];
$archivo = Upload::factory('archivo');
//llamamos a la libreria y le pasamos el nombre del campo file del formulario
$archivo->setExtensions(array('pdf'));
//le asignamos las extensiones a permitir
$url = '/files/upload/';
$archivo->setPath(getcwd() . $url);
if ($archivo->isUploaded()) {
if ($archivo->save()) {
Flash::valid('Archivo subido correctamente!!!');
$nuevo_documento = new Documentos(Input::post("documentos"));
// $nuevo_documento->contratos_id = $contrato_id;
// $nuevo_documento->subido_por = Auth::get("id");
// $nuevo_documento->tipo_documento = ;
$nuevo_documento->url = $url . $_FILES['archivo']['name'];
if ($nuevo_documento->save()) {
Flash::valid("Documento Guardado");
} else {
Flash::error("No se pudo guardar el documento");
}
}
} else {
Flash::warning('No se ha Podido Subir el Archivo...!!!');
}
}
}
示例2: postEdit
public function postEdit($slug)
{
$album = $this->repo->album($slug);
if (!\Request::get('name')) {
\Flash::error('Musisz podać nazwę.');
return \Redirect::back()->withInput();
}
$name = \Request::get('name');
$slug = \Str::slug($name);
$description = \Request::get('description');
$exists = $this->repo->album($slug);
if ($exists && $exists->id != $album->id) {
\Flash::error('Album z tą nazwą już istnieje.');
return \Redirect::back()->withInput();
}
if (\Input::hasFile('image')) {
$image_name = \Str::random(32) . \Str::random(32) . '.png';
$image = \Image::make(\Input::file('image')->getRealPath());
$image->save(public_path('assets/gallery/album_' . $image_name));
$callback = function ($constraint) {
$constraint->upsize();
};
$image->widen(480, $callback)->heighten(270, $callback)->resize(480, 270);
$image->save(public_path('assets/gallery/album_thumb_' . $image_name));
$album->image = $image_name;
}
$album->name = $name;
$album->slug = $slug;
$album->description = $description;
$album->save();
\Flash::success('Pomyślnie edytowano album.');
return \Redirect::to('admin/gallery/' . $slug . '/edit');
}
示例3: add_to_gallery
function add_to_gallery()
{
$gallery_peer = new GalleryPeer();
$gallery = $gallery_peer->find_by_id(Params::get("id_gallery"));
$collection_peer = new GalleryCollectionPeer();
$gallery_collection = $collection_peer->find_by_id($gallery->id_gallery_collection);
$full_folder_path = GalleryCollectionController::GALLERY_COLLECTION_ROOT_DIR . $gallery_collection->folder . "/" . $gallery->folder;
if (Upload::isUploadSuccessful("file")) {
$filename = Random::newHexString() . "_" . Upload::getRealFilename("file");
$gallery_dir = new Dir($full_folder_path);
$uploaded_img = Upload::saveTo("file", $gallery_dir, $filename);
if (isset(Config::instance()->GALLERY_RESIZE_BY_WIDTH)) {
image_w($uploaded_img->getPath(), Config::instance()->GALLERY_RESIZE_BY_WIDTH);
} else {
if (isset(Config::instance()->GALLERY_RESIZE_BY_HEIGHT)) {
image_h($uploaded_img->getPath(), Config::instance()->GALLERY_RESIZE_BY_HEIGHT);
}
}
$peer = new GalleryImagePeer();
$do = $peer->new_do();
$peer->setupByParams($do);
$do->image_name = $filename;
$peer->save($do);
return Redirect::success();
} else {
Flash::error(Upload::getUploadError("file"));
return Redirect::failure();
}
}
示例4: after_validation
public function after_validation()
{
if ($this->edad < 18 || $this->edad > 70) {
Flash::error('Los usuarios deben de tener entre 18 y 70 años');
return 'cancel';
}
}
示例5: add
function add()
{
if (Upload::isUploadSuccessful("my_file")) {
$peer = new ImmaginiPeer();
$do = $peer->new_do();
$peer->setupByParams($do);
$d = new Dir("/immagini/user/" . Session::get("/session/username") . Params::get("folder"));
if (!$d->exists()) {
$d->touch();
}
$do->save_folder = $d->getPath();
$do->real_name = Upload::getRealFilename("my_file");
$do->folder = Params::get("folder");
$tokens = explode(".", Upload::getRealFilename("my_file"));
$extension = $tokens[count($tokens) - 1];
$do->hash_name = md5(uniqid()) . "." . strtolower($extension);
Upload::saveTo("my_file", $do->save_folder, $do->hash_name);
$peer->save($do);
if (is_html()) {
Flash::ok("Immagine aggiunta con successo.");
return Redirect::success();
} else {
return ActiveRecordUtils::toArray($do);
}
} else {
Flash::error(Upload::getUploadError("my_file"));
return Redirect::failure();
}
}
示例6: invia_commento
function invia_commento()
{
try {
$nome = Params::get("nome");
$subject = Params::get("subject");
$email = Params::get("email");
$testo = Params::get("testo");
//$codice_hidden = Params::get("codice_hidden");
//$codice = Params::get("codice");
//if ($codice_hidden!=$codice)
// throw new InvalidParameterException("Il codice non e' impostato correttamente!!");
if ($nome != null && $subject != null && $email != null && $testo != null && isset(Config::instance()->EMAIL_COMMENT_RECEIVED)) {
$e = new EMail("no_reply@" . Host::current_no_www(), Config::instance()->EMAIL_COMMENT_RECEIVED, "[Nuova commento da : " . $nome . "] - " . Host::current(), EMail::HTML_FORMAT);
$e->render_and_send("include/messages/mail/alert/" . Lang::current() . "/nuovo_commento.php.inc", array("nome" => $nome, "email" => $email, "subject" => $subject, "testo" => $testo));
return Redirect::success();
} else {
if (!isset(Config::instance()->EMAIL_COMMENT_RECEIVED)) {
throw new InvalidDataException("Il parametri di configurazione EMAIL_COMMENT_RECEIVED non e' impostato correttamente!!");
} else {
throw new InvalidDataException("I dati immessi nella form non sono validi!!");
}
}
} catch (Exception $ex) {
Flash::error($ex->getMessage());
return Redirect::failure();
}
}
示例7: sala
public function sala()
{
// http://gravatar.com/avatar/
$this->title = 'Sala de Asistencia';
if (Input::post("nombre") and Input::post("email") and Input::post("ayuda")) {
$usuario = new Usuario();
$usuario->nombre = Input::post("nombre");
$usuario->email = Input::post("email");
$usuario->online = 1;
if ($usuario->save()) {
$id = $usuario->find('columns: id', 'limit: 1', 'order: id desc');
$canal = new Canal();
$this->imagen = $this->get_gravatar($usuario->email);
$imagen = "<img style='float:left;padding:4px;' src='" . $this->imagen . "' width=\"50\" alt=\"Tu Imagen\">";
$canal->mensaje = "<span style='float:left;padding-top:10px;'>" . $imagen . "<b>" . $usuario->nombre . "(" . $usuario->email . ")</b>: <br>" . Input::post("ayuda") . "</span> <div class='clearfix'></div>";
$canal->identificador_canal = md5(Input::post("email") . date("Y-m-d") . $id[0]->id);
$canal->usuario_id = $id[0]->id;
if ($canal->save()) {
$this->nombre = Input::post("nombre");
$this->email = Input::post("email");
$this->identificador_canal = $canal->identificador_canal;
$this->usuario_id = $canal->usuario_id;
} else {
Flash::error("No se pudo abrir un canal de asistencia, Vuelva a intentarlo por favor!");
Router::redirect("index/chat");
}
} else {
Flash::error("No pudo ingresar a una sala de asistencia, por favor intentelo de nuevo");
}
} else {
Flash::error("El nombre, email y la consulta de como podemos ayudarte, son obligatorios");
Router::redirect("index/chat");
}
}
示例8: getExtend
public function getExtend($uid, $period)
{
/* @var $user User */
$user = User::find($uid);
if (empty($user->announcement_stream)) {
Flash::error('Пользователь не подписан на рассылку.');
return Redirect::to('admin/subscriptions');
}
// Already has an active subscription.
if ($user->announcement_expires && $user->announcement_expires->isFuture()) {
$user->announcement_expires = $user->announcement_expires->addDays($period);
}
// Subscription expired.
if ($user->announcement_expires && $user->announcement_expires->isPast()) {
// Start tomorrow.
$start = new Carbon();
$start->setTime(0, 0, 0)->addDays(1);
$user->announcement_start = $start;
// Expire in $period from tomorrow.
$expires = clone $start;
$expires->addDays($period);
$user->announcement_expires = $expires;
}
$user->save();
Flash::success('Подписка продленна.');
return Redirect::to('admin/subscriptions');
}
示例9: handle
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
*
* @return mixed
*/
public function handle($request, \Closure $next)
{
if (\Setting::get('user::enable-profile')) {
return $next($request);
}
\Flash::error(trans('user::messages.profile disabled'));
return \Redirect::route('dashboard.index');
}
示例10: before_filter
protected function before_filter()
{
// Verificando si el rol del usuario actual tiene permisos para la acción a ejecutar
if (!$this->acl->is_allowed($this->userRol, $this->controller_name, $this->action_name)) {
Flash::error("Acceso negado");
return Router::redirect("usuario/ingresar");
}
}
示例11: borrar
/**
* Borra un Registro
*/
public function borrar($id)
{
if (!Load::model($this->model)->delete((int) $id)) {
Flash::error('Falló Operación');
}
//enrutando al index para listar los articulos
Redirect::to();
}
示例12: before_delete
/**
* Se verifica mediante un callback de ActiveRecord
* que el perfil a eliminar no se encuentre asociado
* algún controller
*/
public function before_delete()
{
$controller = new Controllers();
if ($controller->count("perfil_id={$this->id}")) {
Flash::error('El perfil no se puede eliminar porque esta asociado');
return 'cancel';
}
}
示例13: banear
public function banear($id, $tiempo = null)
{
View::select(null);
$usuario = new Usuario();
$ban = $usuario->banear($id);
Flash::error('Usuario baneado hasta el ' . $ban);
Redirect::to('index');
}
示例14: show
/**
* Display the specified resource.
*
* @param int $id
* @return Response
*/
public function show($id)
{
$tag = Tag::find($id);
if (empty($tag)) {
Flash::error('Tag not found');
return redirect(route('admin.tags.index'));
}
return view('admin.tags.show')->with('tag', $tag);
}
示例15: store
public function store(PostRequest $request)
{
// Post::create($request->all());
$this->post = new Post();
$this->post->fill($request->all());
$tmp_post_id = $_POST['post_id'];
if ($tmp_post_id == '-1') {
//新規作成
$this->post->post_id = Post::max('post_id') + 1;
$this->post->res_id = 0;
} else {
$this->post->post_id = $tmp_post_id;
$this->post->res_id = Post::where('post_id', '=', $tmp_post_id)->max('res_id') + 1;
}
if ($this->post->contributor == null || $this->post->contributor == "") {
$this->post->contributor = 'No name';
}
$image = Input::file('data');
// dd(var_dump($image));
if (!empty($image)) {
if ($image->getClientSize() > 10000000) {
\Flash::error('アップロードは10M以下の画像ファイル(ipg, png, gif)のみです。');
return redirect()->back();
}
$this->post->fig_mime = $image->getMimeType();
switch ($this->post->fig_mime) {
case "image/jpeg":
$flag = TRUE;
break;
case "image/png":
$flag = TRUE;
break;
case "image/gif":
$flag = TRUE;
break;
default:
$flag = FALSE;
}
if ($flag == FALSE) {
\Flash::error('アップロード可能な画像ファイルは jpg, png, gif のみです。');
return redirect()->back();
}
$name = md5(sha1(uniqid(mt_rand(), true))) . '.' . $image->getClientOriginalExtension();
$upload = $image->move('media', $name);
#サムネイル作成
Image::make('media/' . $name)->resize(400, 400)->save('media/mini/' . $name);
$this->post->fig_name = $name;
// $this->post->fig_orig = file_get_contents($image);
}
$this->post->save();
\Flash::success('記事が投稿されました。');
if ($tmp_post_id == '-1') {
//新規作成
return redirect()->route('posts.index');
}
return redirect()->route('posts.show', [$tmp_post_id]);
}