Пример #1
0
 protected function renderBody()
 {
     $contents = parent::renderBody();
     $options = TJavascript::toList(array('revert' => $this->getRevert()));
     $script = "new Draggable('{$this->ClientID}', {$options});";
     $contents .= TJavascript::render($script);
     return $contents;
 }
Пример #2
0
 public function renderEndTag($writer)
 {
     parent::renderEndTag($writer);
     $width = $this->getWidth();
     $height = $this->getHeight();
     $text = $this->getText();
     $target = $this->getClientID();
     $modal = $this->getModal();
     $link = "<a href='#TB_inline?height={$height}&width={$width}&inlineId={$target}&modal={$modal}' class='thickbox'>{$text}</a>";
     $writer->write($link);
 }
 /**
  * Renders and replaces the panel's content on the client-side.
  * When render() is called before the OnPreRender event, such as when render()
  * is called during a callback event handler, the rendering
  * is defered until OnPreRender event is raised.
  * @param THtmlWriter html writer
  */
 public function render($writer)
 {
     if ($this->getHasPreRendered()) {
         parent::render($writer);
         if ($this->getActiveControl()->canUpdateClientSide()) {
             $this->getPage()->getCallbackClient()->replaceContent($this, $writer);
         }
     } else {
         $this->getPage()->getAdapter()->registerControlToRender($this, $writer);
         if ($this->getHasControls()) {
             // If we update a TActivePanel on callback,
             // We shouldn't update all childs, because the whole content will be replaced by
             // the parent
             foreach ($this->findControlsByType('IActiveControl', false) as $control) {
                 $control->getActiveControl()->setEnableUpdate(false);
             }
         }
     }
 }
Пример #4
0
 /**
  * parse a xml element 
  * @param $xml SimpleXMLElement object
  * @ignore-autocomplete on
  */
 private function parseElement($xml)
 {
     try {
         foreach ($xml as $object) {
             $class = (string) $object->{'class'};
             $properties = (array) $object;
             if (in_array(ini_get('php-gtk.codepage'), array('ISO8859-1', 'ISO-8859-1'))) {
                 array_walk_recursive($properties, array($this, 'arrayToIso8859'));
             }
             $properties = (object) $properties;
             $widget = NULL;
             switch ($class) {
                 case 'T' . 'Label':
                     $widget = $this->makeTLabel($properties);
                     break;
                 case 'T' . 'Button':
                     $widget = $this->makeTButton($properties);
                     break;
                 case 'T' . 'Entry':
                     $widget = $this->makeTEntry($properties);
                     break;
                 case 'T' . 'Password':
                     $widget = $this->makeTPassword($properties);
                     break;
                 case 'T' . 'Date':
                     $widget = $this->makeTDate($properties);
                     break;
                 case 'T' . 'SeekButton':
                     $widget = $this->makeTSeekButton($properties);
                     break;
                 case 'T' . 'Image':
                     $widget = $this->makeTImage($properties);
                     break;
                 case 'T' . 'Text':
                     $widget = $this->makeTText($properties);
                     break;
                 case 'T' . 'CheckGroup':
                     $widget = $this->makeTCheckGroup($properties);
                     break;
                 case 'T' . 'DBCheckGroup':
                     $widget = $this->makeTDBCheckGroup($properties);
                     break;
                 case 'T' . 'RadioGroup':
                     $widget = $this->makeTRadioGroup($properties);
                     break;
                 case 'T' . 'DBRadioGroup':
                     $widget = $this->makeTDBRadioGroup($properties);
                     break;
                 case 'T' . 'Combo':
                     $widget = $this->makeTCombo($properties);
                     break;
                 case 'T' . 'DBCombo':
                     $widget = $this->makeTDBCombo($properties);
                     break;
                 case 'T' . 'Notebook':
                     $widget = $this->makeTNotebook($properties);
                     break;
                 case 'T' . 'Frame':
                     $widget = $this->makeTFrame($properties);
                     break;
                 case 'T' . 'DataGrid':
                     $widget = $this->makeTDataGrid($properties);
                     break;
                 case 'T' . 'Spinner':
                     $widget = $this->makeTSpinner($properties);
                     break;
                 case 'T' . 'Slider':
                     $widget = $this->makeTSlider($properties);
                     break;
                 case 'T' . 'Select':
                     $widget = $this->makeTSelect($properties);
                     break;
                 case 'T' . 'DBSelect':
                     $widget = $this->makeTDBSelect($properties);
                     break;
             }
             if ($widget) {
                 parent::put($widget, (int) $properties->{'x'}, (int) $properties->{'y'});
             }
         }
     } catch (Exception $e) {
         return;
     }
 }
 /**
  * Class constructor
  * Creates the page and the registration form
  */
 function __construct()
 {
     parent::__construct();
     // creates the form
     $this->form = new TForm('form_clienteRegistro Detalhe');
     // creates a table
     $table = new TTable();
     $panel = new TPanel(480, 260);
     $notebook = new TNotebook(500, 250);
     // add the notebook inside the form
     $this->form->add($notebook);
     // add the notebook inside the form
     $this->form->add($table);
     // create the form fields
     $city_id2 = new TSeekButton('city_id2');
     $city_name2 = new TEntry('city_name2');
     $city_id2->setSize(100);
     $city_name2->setEditable(FALSE);
     //dados do cliente CRM
     TTransaction::open('db_crmbf');
     $criteria = new TCriteria();
     $criteria->add(new TFilter('cliente_id', '=', $_GET['key']));
     //
     $repository = new TRepository('CRM');
     $CRM = $repository->load($criteria);
     foreach ($CRM as $crms) {
         $codigoCRM = $crms->id;
         $tituloCRM = $crms->titulo;
         $projetoCRM = $crms->projeto_nome;
         $dataCRM = $crms->data_crm;
         $tempoCRM = $crms->tempo;
         $porcentagemCRM = $crms->porcentagem;
         $descricaoCRM = $crms->descricao;
         $solicitanteCRM = $crms->solicitante;
         $usuarioalteracaoCRM = $crms->usuarioalteracao;
         $responsavel_nomeCRM = $crms->responsavel_nome;
         $tipo_nomeCRM = $crms->tipo_nome;
         $cliente_nomeCRM = $crms->cliente_nome;
         $prioridade_nomeCRM = $crms->prioridade_nome;
         $status_nomeCRM = $crms->status_nome;
     }
     TTransaction::close();
     $notebook->appendPage('Registros CRMs', $table);
     $code = new TEntry('id');
     $crm_id = new TDBCombo('crm_id', 'db_crmbf', 'CRM', 'id', 'titulo');
     $tiporegistro_id = new TDBCombo('tiporegistro_id', 'db_crmbf', 'RegistroTipo', 'id', 'nome');
     $registro = new TText('registro');
     $temporegistro = new TEntry('tempo_registro');
     //        $temporegistro->setEditable(false);
     $dataregistro = new TDate('data_registro');
     $hora_registro = new TEntry('hora_registro');
     $numero_registro = new TEntry('numero_registro');
     // define some properties for the form fields
     $code->setEditable(FALSE);
     $code->setSize(100);
     $crm_id->setSize(320);
     $crm_id->setEditable(FALSE);
     $registro->setSize(320);
     $temporegistro->setSize(160);
     //$temporegistro->setValue(date("d/m/Y H:i:s"));
     $tiporegistro_id->setSize(160);
     //$dataregistro->setRange(0,1000,1);
     $dataregistro->setSize(90);
     // $hora_registro->setRange(0,100,1);
     $hora_registro->setSize(150);
     $hora_registro->setTip('Horario EX: 8:14');
     $numero_registro->setSize(320);
     $row = $table->addRow();
     $row->addCell(new TLabel('Code:'));
     $row->addCell($code);
     // add a row for the field name
     $row = $table->addRow();
     $row->addCell(new TLabel('CRM Titulo:'));
     $cell = $row->addCell($crm_id);
     // add a row for the field Telefone
     $row = $table->addRow();
     $row->addCell(new TLabel('Tipo Registro:'));
     $cell = $row->addCell($tiporegistro_id);
     // add a row for the field Email
     $row = $table->addRow();
     $row->addCell(new TLabel('Tempo:'));
     $cell = $row->addCell($temporegistro);
     // add a row for the field celular
     $row = $table->addRow();
     $row->addCell(new TLabel('Data:'));
     $cell = $row->addCell($dataregistro);
     // add a row for the field skype
     $row = $table->addRow();
     $row->addCell(new TLabel('Hora:'));
     $cell = $row->addCell($hora_registro);
     // add a row for the field endereco
     $row = $table->addRow();
     $row->addCell(new TLabel('Numero Registro:'));
     $row->addCell($numero_registro);
     // add a row for the field name
     $row = $table->addRow();
     $row->addCell(new TLabel('Registro:'));
     $cell = $row->addCell($registro);
     // $notebook->appendPage('Cidade', $table_contact);
     //        $notebook->appendPage('Skill (aggregation)', $table_skill);
     // create the form fields
     //        $code = new TEntry('id');
     //        $nome = new TEntry('nome');
     //        $email = new TEntry('email');
     //        $telefone = new TEntry('telefone');
     //        $celular = new TEntry('celular');
     //        $skype = new TEntry('skype');
     //        $endereco = new TEntry('endereco');
     ////        $cidade_id = new TSeekButton('cidade_id');
     //        $cidade_id = new TDBCombo('cidade_id', 'db_crmbf', 'Cidade', 'id', 'nome');
     //        $birthdate = new TDate('birthdate');
     //        $email = new TEntry('email');
     //        $gender = new TRadioGroup('gender');
     //        $status = new TCombo('status');
     //        $contacts_list = new TMultiField('contacts_list');
     // add field validators
     //        $nome->addValidation('Nome', new TRequiredValidator);
     //        $cidade_id->addValidation('Cidade', new TRequiredValidator);
     // $birthdate->addValidation('Birthdate', new TRequiredValidator);
     //        $cidade_id->addValidation('Category', new TRequiredValidator);
     //$obj = new CidadeFormList;
     //$cidade_id->setAction(new TAction(array($obj, 'onReload')));
     //        $itemGender = array();
     //        $itemGender['M'] = 'Male';
     //        $itemGender['F'] = 'Female';
     //        // add the combo options
     //        $gender->addItems($itemGender);
     //        $gender->setLayout('horizontal');
     //
     //        $itemStatus = array();
     //        $itemStatus['S'] = 'Single';
     //        $itemStatus['C'] = 'Committed';
     //        $itemStatus['M'] = 'Married';
     //        $status->addItems($itemStatus);
     // define some properties for the form fields
     //        $code->setEditable(FALSE);
     //        $code->setSize(100);
     //        $nome->setSize(320);
     //        $email->setSize(160);
     //        $telefone->setSize(160);
     //        $celular->setSize(160);
     //        $skype->setSize(160);
     //        $endereco->setSize(320);
     //        $cidade_id->setSize(150);
     //$cidade_id->setEditable(FALSE);
     // add a row for the field code
     $panel->put("CRM: ", $codigoCRM, 10, 5);
     $panel->put($tituloCRM, 10, 20);
     $panel->put($projetoCRM, 10, 40);
     $panel->put("Data de Criação: " . $dataCRM, 10, 75);
     $panel->put("Aberto por: " . $usuarioalteracaoCRM, 10, 95);
     $panel->put("Cliente: " . $cliente_nomeCRM, 10, 55);
     $panel->put("Responsavel: " . $responsavel_nomeCRM, 10, 110);
     $panel->put("Tipo: " . $tipo_nomeCRM, 10, 130);
     $panel->put("Percentual Conclusão: " . $porcentagemCRM, 10, 140);
     $panel->put("Tempo Gasto: " . $tempoCRM, 10, 160);
     $panel->put("Situação: " . $status_nomeCRM, 10, 180);
     $panel->put("Descrição: " . $descricaoCRM, 10, 200);
     //        $row = $table->addRow();
     //        $row->addCell(new TLabel('Titulo:'));
     //        $row->addCell($tituloCRM);
     //
     //        // add a row for the field name
     //        $row = $table->addRow();
     //        $row->addCell(new TLabel('Projeto:'));
     //        $cell = $row->addCell($projetoCRM);
     //        $cell->colspan = 3;
     //
     //        // add a row for the field Email
     //        $row = $table->addRow();
     //        $row->addCell(new TLabel('DATA:'));
     //        $cell = $row->addCell($dataCRM);
     //        $cell->colspan = 3;
     //
     //        // add a row for the field Telefone
     //        $row = $table->addRow();
     //        $row->addCell(new TLabel('Tempo:'));
     //        $cell = $row->addCell($tempoCRM);
     //        $cell->colspan = 3;
     //
     //        // add a row for the field celular
     //        $row = $table->addRow();
     //        $row->addCell(new TLabel('Porcentagem:'));
     //        $cell = $row->addCell($porcentagemCRM);
     //
     //        // add a row for the field skype
     //        $row = $table->addRow();
     //        $row->addCell(new TLabel('Solicitação:'));
     //        $cell = $row->addCell($solicitanteCRM);
     //        // add a row for the field endereco
     //        $row = $table_data->addRow();
     //        $row->addCell(new TLabel('Endereço:'));
     //        $row->addCell($endereco);
     //
     //        // add a row for the field endereco
     //        $row = $table_data->addRow();
     //        $row->addCell(new TLabel('Cidade:'));
     //        $row->addCell($cidade_id);
     // add a row for the field Category
     //        $row = $table_data->addRow();
     //        $row->addCell(new TLabel('Cidade:'));
     //        $cell = $row->addCell($cidade_id);
     // add a row for the field city
     //        $row=$table_data->addRow();
     //        $row->addCell(new TLabel('Cidade:'));
     //        $cell = $row->addCell($cidade_id);
     /*
      // add a row for the field Phone
      $row = $table_data->addRow();
      $row->addCell(new TLabel('Phone:'));
      $row->addCell($phone);
     
      // add a row for the field BirthDate
      $row->addCell(new TLabel('BirthDate:'));
      $row->addCell($birthdate);
     
      // add a row for the field status
      $row = $table_data->addRow();
      $row->addCell(new TLabel('Status:'));
      $cell = $row->addCell($status);
     
      // add a row for the field Email
      $row->addCell(new TLabel('Email:'));
      $cell = $row->addCell($email);
     
      // add a row for the field gender
      $row->addCell(new TLabel('Gender:'));
      $row->addCell($gender);
     
      $row = $table_contact->addRow();
      $cell = $row->addCell(new TLabel('<b>Contact</b>'));
      $cell->valign = 'top';
     
      // add two fields inside the multifield in the second sheet
      $contacts_list->setHeight(100);
      $contacts_list->setClass('Contact'); // define the returning class
      $contacts_list->addField('type', 'Contact Type: ', new TEntry('type'), 200);
      $contacts_list->addField('value', 'Contact Value: ', new TEntry('value'), 200);
      $row = $table_contact->addRow();
      $row->addCell($contacts_list);
     
      // create the radio button for the skills list
      $skill_list = new TDBCheckGroup('skill_list', 'samples', 'Skill', 'id', 'name');
      $table_skill->addRow()->addCell($lbl = new TLabel('Skills'));
      $table_skill->addRow()->addCell($skill_list);
      $lbl->setFontStyle('b');
     
     * 
     */
     // create an action button
     $button1 = new TButton('action1');
     $button1->setAction(new TAction(array($this, 'onSave')), 'Save');
     $button1->setImage('ico_save.png');
     // create an action button (go to list)
     $button2 = new TButton('list');
     $button2->setAction(new TAction(array('ClienteList', 'onReload')), 'Ir para Listagem');
     $button2->setImage('ico_datagrid.gif');
     // create an action button
     $button3 = new TButton('action3');
     $action3 = new TAction(array('RegistroForm', 'onEdit'));
     $action3->setParameter('fk', $codigoCRM);
     $button3->setImage('ico_save.png');
     $button3->setAction($action3, 'Inserir Registro');
     // define wich are the form fields
     $this->form->setFields(array($code, $crm_id, $registro, $temporegistro, $tiporegistro_id, $dataregistro, $hora_registro, $numero_registro, $button1, $button2, $button3));
     $subtable = new TTable();
     $row = $subtable->addRow();
     $row->addCell($button1);
     $row->addCell($button2);
     $row->addCell($button3);
     $table_layout = new TTable();
     $table_layout->addRow()->addCell($this->form);
     $table_layout->addRow()->addCell($subtable);
     //         // add a row for the field gender
     //          $row->addCell(new TLabel('Gender:'));
     //          $row->addCell($registroREG);
     //
     //        // add a row for the field Category
     //        $row = $table->addRow();
     //        $row->addCell(new TLabel('Cidade:'));
     //        $cell = $row->addCell($registroREG);
     // add the form inside the page
     parent::add($panel);
     parent::add($table_layout);
     // creates the form
     $this->form2 = new TForm('form_clienteRegistro Detalhe');
     //dados do cliente CRM
     TTransaction::open('db_crmbf');
     $criteria2 = new TCriteria();
     // $criteria->add(new TFilter('crm_id', '=', $_GET['key']));
     $criteria2->setProperty('order', 'id desc');
     $repository2 = new TRepository('Registro');
     $reg = $repository2->load($criteria2);
     foreach ($reg as $regs) {
         $row = $table->addRow();
         $row->addCell(new TLabel('ID:'));
         $cell = $row->addCell($regs->id);
         $row = $table->addRow();
         $row->addCell(new TLabel('CRM:'));
         $cell = $row->addCell($regs->crm_id);
         $row = $table->addRow();
         $row->addCell(new TLabel('CRM:'));
         $cell = $row->addCell($regs->tiporegistro_id);
         $row = $table->addRow();
         $row->addCell(new TLabel('Tempo:'));
         $cell = $row->addCell($regs->tempo_registro);
         $row = $table->addRow();
         $row->addCell(new TLabel('Data:'));
         $cell = $row->addCell($regs->data_registro);
         $row = $table->addRow();
         $row->addCell(new TLabel('Horario:'));
         $cell = $row->addCell($regs->hora_registro);
         $row = $table->addRow();
         $row->addCell(new TLabel('Numero Registro:'));
         $cell = $row->addCell($regs->numero_registro);
         $row = $table->addRow();
         $row->addCell(new TLabel('Registro:'));
         $cell = $row->addCell($regs->registro);
         $row = $table->addRow();
         $row->addCell(new TLabel(' '));
         $cell = $row->addCell(' ');
         //            $idREG = $regs->id;
         //            $crm_idREG = $regs->crm_id;
         //            $tiporegistro_idREG = $regs->tiporegistro_id;
         //            $tempoREG = $regs->tempo_registro;
         //            $dataREG = $regs->data_registro;
         //            $horaREG = $regs->hora_registro;
         //            $numRegistroREG = $regs->numero_registro;
         //            $registroREG = $regs->registro;
     }
     TTransaction::close();
 }
 /**
  * Class constructor
  * Creates the page and the registration form
  */
 function __construct()
 {
     parent::__construct();
     // creates the form
     $this->form = new TForm('form_clienteRegistro_Detalhe');
     new TSession();
     // creates a table
     $table = new TTable();
     $panel = new TPanel(480, 250);
     //  $panel->style = "background-image: url(app/images/background.png);";
     $notebook = new TNotebook(500, 250);
     // add the notebook inside the form
     $this->form->add($notebook);
     // add the notebook inside the form
     $this->form->add($table);
     // envia key e fk para sessao
     TSession::setValue('crm_key', $_GET['key']);
     TSession::setValue('cliente_fk', $_GET['fk']);
     //dados do cliente CRM
     TTransaction::open('db_crmbf');
     $criteria = new TCriteria();
     $criteria->add(new TFilter('cliente_id', '=', $_GET['fk']));
     $repository = new TRepository('CRM');
     $CRM = $repository->load($criteria);
     foreach ($CRM as $crms) {
         $codigoCRM = $crms->id;
         $tituloCRM = $crms->titulo;
         $projetoCRM = $crms->projeto_nome;
         $dataCRM = $crms->data_crm;
         $tempoCRM = $crms->tempo;
         $porcentagemCRM = $crms->porcentagem;
         $descricaoCRM = $crms->descricao;
         $solicitanteCRM = $crms->solicitante;
         $usuarioalteracaoCRM = $crms->usuarioalteracao;
         $responsavel_nomeCRM = $crms->responsavel_nome;
         $tipo_nomeCRM = $crms->tipo_nome;
         $cliente_nomeCRM = $crms->cliente_nome;
         $prioridade_nomeCRM = $crms->prioridade_nome;
         $status_nomeCRM = $crms->status_nome;
     }
     TTransaction::close();
     $titulo = new TLabel('CRM - Registros');
     $titulo->setFontSize(14);
     $titulo->setFontFace('Arial');
     $titulo->setFontColor('red');
     // add a row for the field code
     $panel->put($titulo, 10, 5);
     $panel->put("CRM: " . $codigoCRM, 10, 25);
     $panel->put("Titulo: " . $tituloCRM, 10, 45);
     $panel->put("Projeto: " . $projetoCRM, 10, 65);
     $panel->put("Data de Criação: " . $dataCRM, 10, 85);
     $panel->put("Aberto por: " . $usuarioalteracaoCRM, 10, 105);
     $panel->put("Cliente: " . $cliente_nomeCRM, 10, 125);
     $panel->put("Responsavel: " . $responsavel_nomeCRM, 10, 145);
     $panel->put("Tipo: " . $tipo_nomeCRM, 10, 165);
     $panel->put("Percentual Conclusão: " . $porcentagemCRM, 10, 185);
     $panel->put("Tempo Gasto: " . $tempoCRM, 10, 205);
     $panel->put("Situação: " . $status_nomeCRM, 10, 225);
     //inserir button no panel
     $panel->put($button1, 10, 325);
     $panel->put($button2, 100, 325);
     // create an action button
     $button1 = new TButton('action1');
     $action1 = new TAction(array('CRMClienteList', 'onReload'));
     $action1->setParameter('key', $_GET['fk']);
     $button1->setImage('ico_datagrid.png');
     $button1->setAction($action1, 'Voltar');
     // create an action button
     $button2 = new TButton('action2');
     $action2 = new TAction(array('RegistroForm', 'onEdit'));
     $action2->setParameter('fk', $_GET['fk']);
     $button2->setImage('ico_save.png');
     $button2->setAction($action2, 'Inserir Registro');
     // define wich are the form fields
     $this->form->setFields(array($button1, $button2));
     $subtable = new TTable();
     $row = $subtable->addRow();
     $row->addCell($button2);
     $row->addCell($button1);
     $table_layout = new TTable();
     $table_layout->addRow()->addCell($subtable);
     $table_layout->addRow()->addCell($this->form);
     //dados do cliente CRM
     TTransaction::open('db_crmbf');
     $criteria2 = new TCriteria();
     // $criteria->add(new TFilter('crm_id', '=', $_GET['key']));
     $criteria2->setProperty('order', 'id desc');
     $repository2 = new TRepository('Registro');
     $reg = $repository2->load($criteria2);
     foreach ($reg as $regs) {
         $row = $table->addRow();
         $row->addCell(new TLabel('ID:'));
         $cell = $row->addCell($regs->id);
         $row = $table->addRow();
         $row->addCell(new TLabel('CRM:'));
         $cell = $row->addCell($regs->crm_id);
         $row = $table->addRow();
         $row->addCell(new TLabel('CRM:'));
         $cell = $row->addCell($regs->tiporegistro_id);
         $row = $table->addRow();
         $row->addCell(new TLabel('Tempo:'));
         $cell = $row->addCell($regs->tempo_registro);
         $row = $table->addRow();
         $row->addCell(new TLabel('Data:'));
         $cell = $row->addCell($regs->data_registro);
         $row = $table->addRow();
         $row->addCell(new TLabel('Horario:'));
         $cell = $row->addCell($regs->hora_registro);
         $row = $table->addRow();
         $row->addCell(new TLabel('Numero Registro:'));
         $cell = $row->addCell($regs->numero_registro);
         $row = $table->addRow();
         $row->addCell(new TLabel('Registro:'));
         $cell = $row->addCell($regs->registro);
         $row = $table->addRow();
         $row->addCell(new TLabel(' '));
         $cell = $row->addCell(' ');
     }
     TTransaction::close();
     parent::add($panel);
     parent::add($table_layout);
 }
Пример #7
0
 /**
  * Render the javascript within the panel.
  */
 protected function onPreRender($param)
 {
     parent::onPreRender($param);
     $this->Page->registerClientScript("controls");
     $this->renderClientScript();
 }
/*
 * função __autoload()
 * carrega as classes necessárias sob demanda
 */
function __autoload($class)
{
    include_once "app.widgets/{$class}.class.php";
}
// instancia um objeto TWindow nas coordenadas 20,20 contendo um texto
$janela1 = new TWindow('janela1');
$janela1->setPosition(20, 20);
$janela1->setSize(200, 200);
$janela1->add(new TParagraph('conteúdo da janela 1'));
$janela1->show();
// instancia um objeto TWindow nas coordenadas 300,20 contendo uma imagem
$janela2 = new TWindow('janela2');
$janela2->setPosition(300, 20);
$janela2->setSize(200, 200);
$janela2->add(new TImage('app.images/gimp.png'));
$janela2->show();
// instancia um objeto painel
// coloca dentro do painel um texto e uma imagem
$painel = new TPanel(210, 130);
$painel->put(new TParagraph('<b>texto1</b>'), 20, 20);
$painel->put(new TImage('app.images/gnome.png'), 80, 20);
// instancia um objeto TWindow nas coordenadas 140,120 contendo um painel
$janela3 = new TWindow('janela3');
$janela3->setPosition(140, 120);
$janela3->setSize(220, 160);
$janela3->add($painel);
$janela3->show();
 /**
  * Class constructor
  * Creates the page
  */
 function __construct()
 {
     parent::__construct();
     // creates a panel
     $panel = new TPanel(480, 260);
     if (PHP_SAPI !== 'cli') {
         $panel->style = "background-image: url(app/images/background.png);";
     }
     // creates a label with the title
     $titulo = new TLabel('Panel Layout');
     $titulo->setFontSize(18);
     $titulo->setFontFace('Arial');
     $titulo->setFontColor('red');
     // put the title label in the panel
     $panel->put($titulo, 120, 4);
     $imagem = new TImage('app/images/mouse.png');
     // put the image in the panel
     $panel->put($imagem, 260, 140);
     // create the input widgets
     $id = new TEntry('id');
     $name = new TEntry('name');
     $address = new TEntry('address');
     $telephone = new TEntry('telephone');
     $city = new TCombo('city');
     $items = array();
     $items['1'] = 'Porto Alegre';
     $items['2'] = 'Lajeado';
     // add the options to the combo
     $city->addItems($items);
     // adjust the size of the fields
     $id->setSize(70);
     $name->setSize(140);
     $address->setSize(140);
     $telephone->setSize(140);
     $city->setSize(140);
     // create the labels
     $label1 = new TLabel('Code');
     $label2 = new TLabel('Name');
     $label3 = new TLabel('City');
     $label4 = new TLabel('Address');
     $label5 = new TLabel('Telephone');
     // put the widgets in the panel
     $panel->put($label1, 10, 40);
     $panel->put($id, 10, 60);
     $panel->put($label2, 30, 90);
     $panel->put($name, 40, 110);
     $panel->put($label3, 100, 140);
     $panel->put($city, 100, 160);
     $panel->put($label4, 230, 40);
     $panel->put($address, 230, 60);
     $panel->put($label5, 200, 90);
     $panel->put($telephone, 200, 110);
     if (PHP_SAPI !== 'cli') {
         $label6 = new TLabel('Obs');
         $label6->setFontStyle('b');
         $label6->setValue('PS: The panel background is just for understanding purposes.');
         $panel->put($label6, 2, 237);
     }
     // wrap the page content using vertical box
     $vbox = new TVBox();
     $vbox->add(new TXMLBreadCrumb('menu.xml', __CLASS__));
     $vbox->add($panel);
     parent::add($vbox);
 }
Пример #10
0
 public function renderEndTag($writer)
 {
     parent::renderEndTag($writer);
     $script = "<script type=\"text/javascript\">/*<![CDATA[*/ var modal_" . $this->ClientID . " = new Modal.Box('" . $this->ClientID . "') /*]]>*/</script>";
     $writer->write($script);
 }
Пример #11
0
 /**
  * Adds background-position and background-image style attributes.
  * 
  * Adds attribute name-value pairs to renderer.
  * This method overrides the parent implementation with additional textbox specific attributes.
  * @param THtmlWriter the writer used for the rendering purpose
  */
 protected function addAttributesToRender($writer)
 {
     parent::addAttributesToRender($writer);
     $offset = $this->getBackOffset();
     $writer->addStyleAttribute('background-position', "0 -{$offset}px");
     $url = trim($this->getBackImageUrl());
     $writer->addStyleAttribute('background-image', 'url(' . $url . ')');
 }
Пример #12
0
 /**
  * Override the parent implementation. If the Title property is
  * define, add the "title" attribute using the Title property.
  * @return array attributes array.
  */
 function getAttributesToRender()
 {
     $attributes = parent::getAttributesToRender();
     $title = $this->getTitle();
     if (!empty($title)) {
         $attributes['title'] = $title;
     }
     return $attributes;
 }
Пример #13
0
 /**
  * Constructor.
  * @param TDataGrid datagrid object
  */
 public function __construct($dataGrid)
 {
     parent::__construct();
     $this->_dataGrid = $dataGrid;
 }
Пример #14
0
 private function processChildren($writer)
 {
     if ($this->getNodeType() == MyTreeList::NODE_TYPE_INTERNAL_LINK) {
         $panel = new TPanel();
         $this->title = new InternalHyperLink();
         $this->title->setToPage($this->getToPage());
         $this->title->setGetVariables($this->getGetVariables());
         $this->title->setAnchor($this->getAnchor());
         $this->title->Attributes->OnClick = "toggleSub('" . $this->getID() . "')";
         $this->title->setID($this->getID());
         $panel->getControls()->add($this->title);
         $this->addContextMenu($this->getClientID());
     } elseif ($this->getNodeType() == MyTreeList::NODE_TYPE_INTERNAL_ACTIVE_LINK) {
         $panel = new TPanel();
         $this->title = new InternalHyperLink();
         $this->title->setToPage($this->getToPage());
         $this->title->setGetVariables($this->getGetVariables());
         $this->title->setAnchor($this->getAnchor());
         $this->title->Attributes->OnClick = "toggleSub('" . $this->getID() . "')";
         $this->title->setID($this->getID());
         $panel->getControls()->add($this->title);
         //$this->addContextMenu($this->getClientID());
     } elseif ($this->getNodeType() == MyTreeList::NODE_TYPE_LINK) {
         $this->title = new THyperLink();
         $this->title->setNavigateUrl($this->getToPage());
         $this->title->Attributes->OnClick = "toggleSub('" . $this->getID() . "')";
         $this->title->setID($this->getID());
     } else {
         $this->title = new TLabel();
     }
     $this->title->setCssClass($this->getTitleClass());
     $this->title->setText($this->getTitle());
     $panel = new TPanel();
     $panel->getControls()->add($this->title);
     $i = 0;
     foreach ($this->subTree as $c) {
         if (!$c instanceof TWebControl) {
             continue;
         }
         $i++;
         break;
     }
     if ($i == 0) {
         $class = "leaf";
         $fct = "";
     } else {
         $class = $this->getDeploy() ? "node" : "nodeDeployed";
         $fct = $this->getCanDeploy() ? "onClick='toggleSub(\"" . $this->getID() . "\")'" : "";
     }
     $writer->write("<li class='{$class}' {$fct} id='" . $this->getID() . MyTreeList::SUB_ID_LI . "'>");
     $this->title->render($writer);
     $writer->write("</li>");
     $cssclass = $this->getCssClass() ? " class='" . $this->getCssClass() . "'" : "";
     $style = $this->getDeploy() ? "block" : "none";
     if ($i > 0) {
         $writer->write("<li style='list-style: none outside; padding-left:0px; margin-left:0px; min-height: 0px;' id='" . $this->getID() . MyTreeList::SUB_ID_UL . "'><ul {$cssclass} style='display: {$style}'>\n");
     }
     $order = 0;
     foreach ($this->subTree as $c) {
         if (!$c instanceof TWebControl) {
             continue;
         }
         if ($c instanceof MyTreeList) {
             $c->Parent = $this;
             $c->setOrder($order++);
             $c->setCssClass($this->getCssClass());
             $c->render($writer);
         } else {
             $cssclass = $this->getCssClass() ? " class='" . $this->getCssClass() . "'" : "";
             $writer->write("<ul {$cssclass}><li class='leaf'>");
             $c->getPage()->addParsedObject($c);
             $c->render($writer);
             $writer->write("</li></ul>\n");
         }
     }
     if ($i > 0) {
         $writer->write("</ul></li>\n");
     }
 }
Пример #15
0
 /**
  * Renders and replaces the panel's content on the client-side.
  * When render() is called before the OnPreRender event, such as when render()
  * is called during a callback event handler, the rendering
  * is defered until OnPreRender event is raised.
  * @param THtmlWriter html writer
  */
 public function render($writer)
 {
     if ($this->getHasPreRendered()) {
         parent::render($writer);
         if ($this->getActiveControl()->canUpdateClientSide()) {
             $this->getPage()->getCallbackClient()->replaceContent($this->_container, $writer);
         }
     } else {
         $this->getPage()->getAdapter()->registerControlToRender($this->_container, $writer);
     }
 }
 /**
  * Register the required javascript libraries.
  */
 function onPreRender($param)
 {
     parent::onPreRender($param);
     $this->Page->registerClientScript('logger');
     $this->renderMessage();
 }
Пример #17
0
 /**
  * Renders the javascript for div tag.
  */
 protected function addAttributesToRender($writer)
 {
     parent::addAttributesToRender($writer);
     $writer->addAttribute('id', $this->getClientID());
     $this->getPage()->getClientScript()->registerPradoScript('prado');
     $this->getPage()->getClientScript()->registerPradoScript('ajax');
     $this->getPage()->getClientScript()->registerScriptFile('GoogleAjaxApi', 'http://www.google.com/jsapi?key=' . $this->getApiKey());
     $this->getPage()->getClientScript()->registerScriptFile('B', $this->publishAsset("assets/B.js", __CLASS__));
     $this->getPage()->getClientScript()->registerScriptFile('BActiveGoogleMap', $this->publishAsset("assets/BActiveGoogleMap.js", __CLASS__));
     //$this->getPage()->getClientScript()->registerScriptFile('GMap.js','http://maps.google.com/maps?file=api&amp;v=2&amp;key='.$this->getApiKey());
     //$url = $this->getPage()->getClientScript()->registerJavascriptPackages(dirname(__FILE__) . "/assets",array('activegooglemap'));
     //$this->getPage()->getClientScript()->registerScriptFile($url, $url);
     $this->getActiveControl()->registerCallbackClientScript($this->getClientClassName(), $this->getClientOptions());
 }
Пример #18
0
 /**
  * Determins which wizard step to show and appropriate navigation elements.
  * @param TEventParameter event parameter to be passed to the event handlers
  */
 protected function onPreRender($param)
 {
     parent::onPreRender($param);
     $index = $this->getActiveStepIndex();
     $totalSteps = count($this->steps);
     //show the current step
     for ($i = 0; $i < $totalSteps; $i++) {
         $this->steps[$i]->setVisible($i == $index);
     }
     //determine which link is active
     for ($i = 0; $i < count($this->sidebarLinks); $i++) {
         $this->sidebarLinks[$i]->CssClass = $i == $index ? 'active' : '';
     }
     //hide all the navigations first.
     foreach ($this->navigation as $navigation) {
         foreach ($navigation as $nav) {
             $nav->setVisible(false);
         }
     }
     $final = $this->steps[$index]->Type == TWizardStep::TYPE_FINAL;
     //if it is not the final step
     if (!$final && $this->isSideBarVisible()) {
         $this->showNavigation(TWizardTemplate::ID_SIDEBAR);
     }
     $finishStep = $index == $totalSteps - 1;
     $finishStep = $finishStep || isset($this->steps[$index + 1]) && $this->steps[$index + 1]->Type == TWizardStep::TYPE_FINAL;
     //now show the appropriate navigation elements.
     if ($index == 0) {
         $this->showNavigation(TWizardTemplate::ID_START);
     } else {
         if ($final) {
         } else {
             if ($finishStep) {
                 $this->showNavigation(TWizardTemplate::ID_FINISH);
             } else {
                 $this->showNavigation(TWizardTemplate::ID_STEP);
             }
         }
     }
 }
Пример #19
0
 /**
  * Ensure that the ID attribute is rendered and registers the javascript code
  * for initializing the active control.
  */
 protected function addAttributesToRender($writer)
 {
     parent::addAttributesToRender($writer);
     $cs = $this->getPage()->getClientScript();
     if ($this->getGhosting() == TDraggableGhostingOptions::SuperGhosting) {
         $cs->registerPradoScript('dragdropextra');
     } else {
         $cs->registerPradoScript('dragdrop');
     }
     $writer->addAttribute('id', $this->getClientID());
     $options = TJavascript::encode($this->getPostBackOptions());
     $class = $this->getClientClassName();
     $code = "new {$class}('{$this->getClientId()}', {$options}) ";
     $cs->registerEndScript(sprintf('%08X', crc32($code)), $code);
 }
<?php

// inclui as classes necessárias
include_once 'app.widgets/TStyle.class.php';
include_once 'app.widgets/TElement.class.php';
include_once 'app.widgets/TPanel.class.php';
include_once 'app.widgets/TImage.class.php';
include_once 'app.widgets/TParagraph.class.php';
// instancia novo painel
$painel = new TPanel(400, 300);
// coloca objeto parágrafo na posição 10,10
$texto = new TParagraph('isso é um teste, x:10,y:10');
$painel->put($texto, 10, 10);
// coloca objeto parágrafo na posição 200,200
$texto = new TParagraph('outro teste, x:200,y:200');
$painel->put($texto, 200, 200);
// coloca objeto imagem na posição 10,180
$texto = new TImage('app.images/gnome.png');
$painel->put($texto, 10, 180);
// coloca objeto imagem na posição 240,10
$texto = new TImage('app.images/gimp.png');
$painel->put($texto, 240, 10);
$painel->show();