Lançado Adianti Framework 7.6!
Clique aqui para saber mais
menu

Adianti Solutions

API

Adianti, Framework, PHP, MVC, Active record, Front controller, IDE, RAD, Web, multiplataforma, geração de código, desenvolvimento rápido, relatórios, formulários, listagens, datagrids, gráficos, banco de dados, padrões de projeto, design patterns API do Adianti Framework.
API Docs
code
Selecione a classe

Source for file TMessage.php

Documentation is available at TMessage.php

  1. <?php
  2. namespace Adianti\Widget\Dialog;
  3.  
  4. use Adianti\Core\AdiantiCoreTranslator;
  5. use Adianti\Control\TAction;
  6. use Adianti\Widget\Base\TScript;
  7.  
  8. /**
  9.  * Message Dialog
  10.  *
  11.  * @version    7.4
  12.  * @package    widget
  13.  * @subpackage dialog
  14.  * @author     Pablo Dall'Oglio
  15.  * @author     Victor Feitoza <vfeitoza [at] gmail.com> (process action after OK)
  16.  * @copyright  Copyright (c) 2006 Adianti Solutions Ltd. (http://www.adianti.com.br)
  17.  * @license    http://www.adianti.com.br/framework-license
  18.  */
  19. class TMessage
  20. {
  21.     /**
  22.      * Class Constructor
  23.      * @param $type    Type of the message (info, warning, error)
  24.      * @param $message Message to be shown
  25.      * @param $action  Action to be processed when closing the dialog
  26.      * @param $title_msg  Dialog Title
  27.      */
  28.     public function __construct($type$messageTAction $action NULL$title_msg '')
  29.     {
  30.         if (!empty($title_msg))
  31.         {
  32.             $title $title_msg;
  33.         }
  34.         else
  35.         {
  36.             $titles [];
  37.             $titles['info']    AdiantiCoreTranslator::translate('Information');
  38.             $titles['error']   AdiantiCoreTranslator::translate('Error');
  39.             $titles['warning'AdiantiCoreTranslator::translate('Warning');
  40.             $title !empty($titles[$type])$titles[$type'';
  41.         }
  42.         
  43.         $callback 'undefined';
  44.         
  45.         if ($action)
  46.         {
  47.             $callback "function () { __adianti_load_page('{$action->serialize()}') }";
  48.         }
  49.         
  50.         $title addslashes($title);
  51.         $message addslashes($message);
  52.         
  53.         if ($type == 'info')
  54.         {
  55.             TScript::create("__adianti_message('{$title}', '{$message}', $callback)");
  56.         }
  57.         else if ($type == 'warning')
  58.         {
  59.             TScript::create("__adianti_warning('{$title}', '{$message}', $callback)");
  60.         }
  61.         else
  62.         {
  63.             TScript::create("__adianti_error('{$title}', '{$message}', $callback)");
  64.         }
  65.     }
  66. }