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 TWindow.php

Documentation is available at TWindow.php

  1. <?php
  2. namespace Adianti\Control;
  3.  
  4. use Adianti\Control\TAction;
  5. use Adianti\Widget\Container\TJQueryDialog;
  6. use Adianti\Widget\Base\TScript;
  7.  
  8. use ReflectionClass;
  9.  
  10. /**
  11.  * Window Container (JQueryDialog wrapper)
  12.  *
  13.  * @version    7.4
  14.  * @package    control
  15.  * @author     Pablo Dall'Oglio
  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 TWindow extends TPage
  20. {
  21.     private $wrapper;
  22.     
  23.     public function __construct()
  24.     {
  25.         parent::__construct();
  26.         
  27.         $this->wrapper new TJQueryDialog;
  28.         $this->wrapper->setUseOKButton(FALSE);
  29.         $this->wrapper->setTitle('');
  30.         $this->wrapper->setSize(1000500);
  31.         $this->wrapper->setModal(TRUE);
  32.         $this->wrapper->{'widget''T'.'Window';
  33.         $this->wrapper->{'name'$this->getClassName();
  34.         
  35.         $this->{'id''window_' mt_rand(10000000001999999999);
  36.         $this->{'window_name'$this->wrapper->{'name'};
  37.         $this->{'role''window-wrapper';
  38.         parent::add($this->wrapper);
  39.     }
  40.     
  41.     /**
  42.      * Returns ID
  43.      */
  44.     public function getId()
  45.     {
  46.         return $this->wrapper->getId();
  47.     }
  48.     
  49.     /**
  50.      * Create a window
  51.      */
  52.     public static function create($title$width$height$params null)
  53.     {
  54.         $inst new static($params);
  55.         $inst->setIsWrapped(TRUE);
  56.         $inst->setTitle($title);
  57.         $inst->setSize($width$height);
  58.         unset($inst->wrapper->{'widget'});
  59.         return $inst;
  60.     }
  61.     
  62.     /**
  63.      * Remove padding
  64.      */
  65.     public function removePadding()
  66.     {
  67.         $this->setProperty('class''window_modal');
  68.     }
  69.     
  70.     /**
  71.      * Remove titlebar
  72.      */
  73.     public function removeTitleBar()
  74.     {
  75.         $this->setDialogClass('no-title');
  76.     }
  77.     
  78.     /**
  79.      * Set Dialog class
  80.      * @param $class Class name
  81.      */
  82.     public function setDialogClass($class)
  83.     {
  84.         $this->wrapper->setDialogClass($class);
  85.     }
  86.     
  87.     /**
  88.      * Define the stack order (zIndex)
  89.      * @param $order Stack order
  90.      */
  91.     public function setStackOrder($order)
  92.     {
  93.         $this->wrapper->setStackOrder($order);
  94.     }
  95.     
  96.     /**
  97.      * Define the window's title
  98.      * @param  $title Window's title
  99.      */
  100.     public function setTitle($title)
  101.     {
  102.         $this->wrapper->setTitle($title);
  103.     }
  104.     
  105.     /**
  106.      * Turn on/off modal
  107.      * @param $modal Boolean
  108.      */
  109.     public function setModal($modal)
  110.     {
  111.         $this->wrapper->setModal($modal);
  112.     }
  113.     
  114.     /**
  115.      * Disable Escape
  116.      */
  117.     public function disableEscape()
  118.     {
  119.         $this->wrapper->disableEscape();
  120.     }
  121.     
  122.     /**
  123.      * Disable scrolling
  124.      */
  125.     public function disableScrolling()
  126.     {
  127.         $this->wrapper->disableScrolling();
  128.     }
  129.     
  130.     /**
  131.      * Define the window's size
  132.      * @param  $width  Window's width
  133.      * @param  $height Window's height
  134.      */
  135.     public function setSize($width$height)
  136.     {
  137.         $this->wrapper->setSize($width$height);
  138.     }
  139.     
  140.     /**
  141.      * Define the window's min width between percent and absolute
  142.      * @param  $percent width
  143.      * @param  $absolute width
  144.      */
  145.     public function setMinWidth($percent$absolute)
  146.     {
  147.         $this->wrapper->setMinWidth($percent$absolute);
  148.     }
  149.     
  150.     /**
  151.      * Define the top corner positions
  152.      * @param $x left coordinate
  153.      * @param $y top  coordinate
  154.      */
  155.     public function setPosition($x$y)
  156.     {
  157.         $this->wrapper->setPosition($x$y);
  158.     }
  159.     
  160.     /**
  161.      * Define the Property value
  162.      * @param $property Property name
  163.      * @param $value Property value
  164.      */
  165.     public function setProperty($property$value)
  166.     {
  167.         $this->wrapper->$property $value;
  168.     }
  169.     
  170.     /**
  171.      * Add some content to the window
  172.      * @param $content Any object that implements the show() method
  173.      */
  174.     public function add($content)
  175.     {
  176.         $this->wrapper->add($content);
  177.     }
  178.     
  179.     /**
  180.      * set close action
  181.      * @param $action close action
  182.      */
  183.     public function setCloseAction(TAction $action)
  184.     {
  185.         $this->wrapper->setCloseAction($action);
  186.     }
  187.     
  188.     /**
  189.      * Block UI
  190.      */
  191.     public static function blockUI($timeout null)
  192.     {
  193.         TScript::create('tjquerydialog_block_ui()'true$timeout);
  194.     }
  195.     
  196.     /**
  197.      * Unblock UI
  198.      */
  199.     public static function unBlockUI($timeout null)
  200.     {
  201.         TScript::create('tjquerydialog_unblock_ui()'true$timeout);
  202.     }
  203.     
  204.     /**
  205.      * Close TJQueryDialog's
  206.      */
  207.     public static function closeWindow($id null)
  208.     {
  209.         if (!empty($id))
  210.         {
  211.             TJQueryDialog::closeById($id);
  212.         }
  213.         else
  214.         {
  215.             TJQueryDialog::closeLatest();
  216.         }
  217.     }
  218.     
  219.     /**
  220.      * Close window by name of controller
  221.      */
  222.     public static function closeWindowByName($name)
  223.     {
  224.         TScript::create' $(\'[window_name="'.$name.'"]\').remove(); ' );
  225.     }
  226. }