本文整理汇总了PHP中TAction类的典型用法代码示例。如果您正苦于以下问题:PHP TAction类的具体用法?PHP TAction怎么用?PHP TAction使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TAction类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct()
{
parent::__construct();
// creates one datagrid
$this->datagrid = new TDataGrid();
// create the datagrid columns
$code = new TDataGridColumn('code', 'Code', 'left', 50);
$name = new TDataGridColumn('name', 'Name', 'left', 180);
$address = new TDataGridColumn('address', 'Address', 'left', 140);
$telephone = new TDataGridColumn('fone', 'Phone', 'center', 100);
// add the columns to the datagrid
$this->datagrid->addColumn($code);
$this->datagrid->addColumn($name);
$this->datagrid->addColumn($address);
$this->datagrid->addColumn($telephone);
$action1 = new TAction(array($this, 'onColumnAction'));
$action1->setParameter('column', 'code');
$code->setAction($action1);
$action2 = new TAction(array($this, 'onColumnAction'));
$action2->setParameter('column', 'name');
$name->setAction($action2);
// creates the datagrid model
$this->datagrid->createModel();
// wrap the page content using vertical box
$vbox = new TVBox();
$vbox->add(new TXMLBreadCrumb('menu.xml', __CLASS__));
$vbox->add($this->datagrid);
parent::add($vbox);
}
开发者ID:jfrank1500,项目名称:curso_php,代码行数:29,代码来源:DatagridColumnActionsView.class.php
示例2: __construct
public function __construct()
{
parent::__construct();
// instancia objeto DataGrid
$this->datagrid = new TDataGrid();
// instancia as colunas da DataGrid
$codigo = new TDataGridColumn('id', 'Código', 'right', 50);
$nome = new TDataGridColumn('nome', 'Nome', 'left', 180);
$endereco = new TDataGridColumn('endereco', 'Endereço', 'left', 140);
$qualifica = new TDataGridColumn('qualifica', 'Qualificações', 'left', 200);
$action1 = new TAction(array($this, 'onReload'));
$action1->setParameter('order', 'id');
$action2 = new TAction(array($this, 'onReload'));
$action2->setParameter('order', 'nome');
$codigo->setAction($action1);
$nome->setAction($action2);
// adiciona as colunas à DataGrid
$this->datagrid->addColumn($codigo);
$this->datagrid->addColumn($nome);
$this->datagrid->addColumn($endereco);
$this->datagrid->addColumn($qualifica);
// cria o modelo da DataGrid, montando sua estrutura
$this->datagrid->createModel();
// adiciona a DataGrid à página
parent::add($this->datagrid);
}
开发者ID:CodeBooks,项目名称:php-programando-com-orientacao-a-objetos,代码行数:26,代码来源:list5.php
示例3: __construct
public function __construct()
{
parent::__construct();
$this->form = new TForm();
// creates one datagrid
$this->datagrid = new TQuickGrid();
$this->datagrid->disableDefaultClick();
$this->form->add($this->datagrid);
// creates the action button
$button1 = new TButton('action1');
// define the button action
$action_button1 = new TAction(array($this, 'onUpdate'));
$action_button1->setParameter('id', filter_input(INPUT_GET, 'id'));
$button1->setAction($action_button1, 'Atualizar');
$button1->setImage('fa:check-circle-o green');
$this->form->addField($button1);
// add the columns
$this->datagrid->addQuickColumn('Tipo de Atividade', 'nome', 'left', 180);
$this->datagrid->addQuickColumn('Ticket', 'ticket', 'left', 180);
$this->datagrid->addQuickColumn('Sistema', 'sistema', 'left', 180);
// creates the datagrid model
$this->datagrid->createModel();
// wrap the page content using vertical box
$vbox = new TVBox();
$vbox->add($button1);
$vbox->add($this->form);
parent::add($vbox);
}
开发者ID:jhonleandres,项目名称:Atividades,代码行数:28,代码来源:TipoAtividadesVinculos.class.php
示例4: __construct
/**
* Class Constructor
* @param $type Type of the message (info, error)
* @param $message Message to be shown
* @param $action Action to be processed when closing the dialog
*/
public function __construct($type, $message, TAction $action = NULL)
{
$this->id = uniqid();
if ($action) {
$this->action = "__adianti_load_page('{$action->serialize()}');";
}
if (TPage::isMobile()) {
$img = new TElement('img');
$img->src = "lib/adianti/images/{$type}.png";
$table = new TTable();
$table->width = '250px';
$table->bgcolor = '#E5E5E5';
$table->style = "border-collapse:collapse";
$row = $table->addRow();
$row->addCell($img);
$row->addCell($message);
$table->show();
} else {
TPage::include_css('lib/adianti/include/tmessage/tmessage.css');
// creates a pannel to show the dialog
$painel = new TElement('div');
$painel->{'class'} = 'tmessage';
$painel->id = 'tmessage_' . $this->id;
// creates a table for layout
$table = new TTable();
// creates a row for the icon and the message
$row = $table->addRow();
$row->addCell(new TImage("lib/adianti/images/{$type}.png"));
$scroll = new TScroll();
$scroll->setSize(400, 200);
$scroll->add($message);
$cell = $row->addCell($scroll);
// add the table to the pannel
$painel->add($table);
// show the pannel
$painel->show();
$script = new TElement('script');
$script->{'type'} = 'text/javascript';
$script->add(' $(function() {
$( "#' . $painel->id . '" ).dialog({
height: 340,
width: 500,
stack: false,
zIndex: 3000,
modal: true,
buttons: {
OK: function() {
$( this ).dialog( "close" ); ' . $this->action . '
}
}
}).css("visibility", "visible");
$( "#' . $painel->id . ' a" ).click(function () {
window.open($(this).attr(\'href\'));
});
});');
$script->show();
}
}
开发者ID:jhonleandres,项目名称:crmbf,代码行数:65,代码来源:TMessage.class.php
示例5: setAction
/**
* Define o ID para carregar o conteudo dinamicamente
* @param $id ID a ser carregada
* @param $getContentAjax Campo a ser carregado via ajax
*/
public function setAction(TAction $action, $getContentAjax = null)
{
if (is_null($getContentAjax)) {
$this->action = '__adianti_load_page(\'' . $action->serialize() . '\');';
} else {
$this->action = '__adianti_load_page(\'' . $action->serialize() . '&' . $getContentAjax . '=\'+$("#' . $getContentAjax . '").val());';
}
}
开发者ID:enieber,项目名称:adianti,代码行数:13,代码来源:TAccordionDialog.class.php
示例6: onDelete
/**
* method onDelete()
* executed whenever the user clicks at the delete button
* Ask if the user really wants to delete the record
*/
function onDelete($param)
{
// define the next action
$action = new TAction(array($this, 'Delete'));
$action->setParameters($param);
// pass 'key' parameter ahead
// shows a dialog to the user
new TQuestion('Do you really want to delete ?', $action);
}
开发者ID:jfrank1500,项目名称:curso_php,代码行数:14,代码来源:DesignedDataGridView.class.php
示例7: setChangeAction
/**
* Define the action to be executed when the user changes the combo
* @param $action TAction object
*/
public function setChangeAction(TAction $action)
{
if ($action->isStatic()) {
$this->changeAction = $action;
} else {
$string_action = $action->toString();
throw new Exception(TAdiantiCoreTranslator::translate('Action (^1) must be static to be used in ^2', $string_action, __METHOD__));
}
}
开发者ID:jhonleandres,项目名称:pecommerce,代码行数:13,代码来源:TRadioGroup.class.php
示例8: setExitAction
/**
* Define the action to be executed when the user leaves the form field
* @param $action TAction object
*/
function setExitAction(TAction $action)
{
if ($action->isStatic()) {
$this->exitAction = $action;
} else {
$string_action = $action->toString();
throw new Exception(TAdiantiCoreTranslator::translate('Action (^1) must be static to be used in ^2', $string_action, __METHOD__));
}
$this->widget->connect_after('focus-out-event', array($this, 'onExecuteExitAction'));
}
开发者ID:jhonleandres,项目名称:pecommerce,代码行数:14,代码来源:TPassword.class.php
示例9: __construct
/**
* Class Constructor
* @param $message A string containint the question
* @param $action_yes Action taken for YES response
* @param $action_no Action taken for NO response
*/
public function __construct($message, TAction $action_yes, TAction $action_no = NULL)
{
$buttons = array(Gtk::STOCK_YES, Gtk::RESPONSE_YES);
if ($action_no instanceof TAction) {
$buttons[] = Gtk::STOCK_NO;
$buttons[] = Gtk::RESPONSE_NO;
}
$buttons[] = Gtk::STOCK_CANCEL;
$buttons[] = Gtk::RESPONSE_CANCEL;
parent::__construct('', NULL, Gtk::DIALOG_MODAL, $buttons);
parent::set_position(Gtk::WIN_POS_CENTER);
parent::set_size_request(500, 300);
$textview = new GtkTextView();
$textview->set_wrap_mode(Gtk::WRAP_WORD);
$textview->set_border_width(12);
$textbuffer = $textview->get_buffer();
$tagtable = $textbuffer->get_tag_table();
$customTag = new GtkTextTag();
$tagtable->add($customTag);
$customTag->set_property('foreground', '#525252');
$tagBegin = $textbuffer->create_mark('tagBegin', $textbuffer->get_end_iter(), true);
$textbuffer->insert_at_cursor("\n " . $message);
$tagEnd = $textbuffer->create_mark('tagEnd', $textbuffer->get_end_iter(), true);
$start = $textbuffer->get_iter_at_mark($tagBegin);
$end = $textbuffer->get_iter_at_mark($tagEnd);
$textbuffer->apply_tag($customTag, $start, $end);
$textview->set_editable(FALSE);
$textview->set_cursor_visible(FALSE);
$pango = new PangoFontDescription('Sans 14');
$textview->modify_font($pango);
$image = GtkImage::new_from_stock(Gtk::STOCK_DIALOG_QUESTION, Gtk::ICON_SIZE_DIALOG);
$scroll = new GtkScrolledWindow();
$scroll->set_policy(Gtk::POLICY_NEVER, Gtk::POLICY_ALWAYS);
$scroll->add($textview);
$hbox = new GtkHBox();
$this->vbox->pack_start($hbox);
$hbox->pack_start($image, FALSE, FALSE);
$hbox->pack_start($scroll, TRUE, TRUE);
$this->show_all();
$result = parent::run();
if ($result == Gtk::RESPONSE_YES) {
parent::destroy();
call_user_func_array($action_yes->getAction(), array($action_yes->getParameters()));
} else {
if ($result == Gtk::RESPONSE_NO) {
parent::destroy();
call_user_func_array($action_no->getAction(), array($action_no->getParameters()));
} else {
parent::destroy();
}
}
}
开发者ID:jhonleandres,项目名称:crmbf,代码行数:58,代码来源:TQuestion.class.php
示例10: addQuickColumn
/**
* Add a column
* @param $label Field Label
* @param $object Field Object
* @param $size Field Size
*/
public function addQuickColumn($label, $name, $align = 'left', $size = 200, TAction $action = NULL, $param = NULL)
{
// creates a new column
$object = new TDataGridColumn($name, $label, $align, $size);
if ($action instanceof TAction) {
// create ordering
$action->setParameter($param[0], $param[1]);
$object->setAction($action);
}
// add the column to the datagrid
parent::addColumn($object);
return $object;
}
开发者ID:enieber,项目名称:adianti,代码行数:19,代码来源:TQuickGrid.class.php
示例11: __construct
public function __construct()
{
parent::__construct();
// create two actions
$action1 = new TAction(array($this, 'onAction1'));
$action2 = new TAction(array($this, 'onAction2'));
// define os parâmetros de cada ação
$action1->setParameter('parameter', 1);
$action2->setParameter('parameter', 2);
// shows the question dialog
new TQuestion('Do you really want to perform this operation ?', $action1, $action2);
parent::add(new TXMLBreadCrumb('menu.xml', __CLASS__));
}
开发者ID:jfrank1500,项目名称:curso_php,代码行数:13,代码来源:DialogQuestionView.class.php
示例12: __construct
/**
* Class constructor
* Creates the page, the form and the listing
*/
public function __construct()
{
parent::__construct();
new TSession();
// creates a DataGrid
$this->datagrid = new TDataGrid();
$this->datagrid->setHeight(280);
// creates the datagrid columns
$id = new TDataGridColumn('id', 'id', 'right', 40);
$name = new TDataGridColumn('name', 'Name', 'left', 200);
$address = new TDataGridColumn('address', 'Address', 'left', 200);
// creates the datagrid actions
$order1 = new TAction(array($this, 'onReload'));
$order2 = new TAction(array($this, 'onReload'));
// define the ordering parameters
$order1->setParameter('order', 'id');
$order2->setParameter('order', 'name');
// assign the ordering actions
$id->setAction($order1);
$name->setAction($order2);
// add the columns to the DataGrid
$this->datagrid->addColumn($id);
$this->datagrid->addColumn($name);
$this->datagrid->addColumn($address);
// creates a datagrid action
$action1 = new TDataGridAction(array('CustomerFormView', 'onEdit'));
$action1->setLabel('Edit');
$action1->setImage('ico_edit.png');
$action1->setField('id');
// add the actions to the datagrid
$this->datagrid->addAction($action1);
// creates the edit action
$editaction = new TDataGridAction(array($this, 'onEdit'));
$editaction->setField('id');
$name->setEditAction($editaction);
// create the datagrid model
$this->datagrid->createModel();
// creates the page navigation
$this->pageNavigation = new TPageNavigation();
$this->pageNavigation->setAction(new TAction(array($this, 'onReload')));
$this->pageNavigation->setWidth($this->datagrid->getWidth());
// creates the page structure using a table
$vbox = new TVBox();
$vbox->add(new TXMLBreadCrumb('menu.xml', __CLASS__));
$vbox->add($this->datagrid);
$vbox->add($this->pageNavigation);
// add the table inside the page
parent::add($vbox);
}
开发者ID:jfrank1500,项目名称:curso_php,代码行数:53,代码来源:InlineDataGridView.class.php
示例13: __construct
/**
* método construtor
* instancia objeto TQuestion
* @param $message = pergunta ao usuário
* @param $action_yes = ação para resposta positiva
* @param $action_no = ação para resposta negativa
*/
function __construct($message, TAction $action_yes, TAction $action_no)
{
$style = new TStyle('tquestion');
$style->position = 'absolute';
$style->left = '30%';
$style->top = '30%';
$style->width = '300';
$style->height = '150';
$style->border_width = '1px';
$style->color = 'black';
$style->background = '#DDDDDD';
$style->border = '4px solid #000000';
$style->z_index = '10000000000000000';
// converte os nomes de métodos em URL's
$url_yes = $action_yes->serialize();
$url_no = $action_no->serialize();
// exibe o estilo na tela
$style->show();
// instancia o painel para exibir o diálogo
$painel = new TElement('div');
$painel->class = "tquestion";
// cria um botão para a resposta positiva
$button1 = new TElement('input');
$button1->type = 'button';
$button1->value = 'Sim';
$button1->onclick = "javascript:location='{$url_yes}'";
// cria um botão para a resposta negativa
$button2 = new TElement('input');
$button2->type = 'button';
$button2->value = 'Não';
$button2->onclick = "javascript:location='{$url_no}'";
// cria uma tabela para organizar o layout
$table = new TTable();
$table->align = 'center';
$table->cellspacing = 10;
// cria uma linha para o ícone e a mensagem
$row = $table->addRow();
$row->addCell(new TImage('app.images/question.png'));
$row->addCell($message);
// cria uma linha para os botões
$row = $table->addRow();
$row->addCell($button1);
$row->addCell($button2);
// adiciona a tabela ao painél
$painel->add($table);
// exibe o painél
$painel->show();
}
开发者ID:ricardohenriq,项目名称:learn-php,代码行数:55,代码来源:TQuestion.class.php
示例14: __construct
/**
* Class constructor
* Creates the page and the registration form
*/
function __construct()
{
parent::__construct();
parent::setDatabase('esales');
// defines the database
parent::setActiveRecord('Pessoa');
// defines the active record
// creates the form
$this->form = new TQuickForm('form_Pessoa');
$this->form->class = 'tform';
// CSS class
$this->form->style = 'width: 500px';
// define the form title
$this->form->setFormTitle('Pessoa');
// create the form fields
$id = new TEntry('id');
$nome = new TEntry('nome');
$telefone = new TEntry('telefone');
$email = new TEntry('email');
$endereco = new TEntry('endereco');
$numero = new TEntry('numero');
$cidade_id = new TSeekButton('cidade_id');
$cidade_id->addValidation('Cidade', new TRequiredValidator());
$cidade_name = new TEntry('cidade_name');
$obj = new TStandardSeek();
$action = new TAction(array($obj, 'onSetup'));
$action->setParameter('database', 'esales');
$action->setParameter('parent', 'form_Pessoa');
$action->setParameter('model', 'Cidade');
$action->setParameter('display_field', 'descricao');
$action->setParameter('receive_key', 'cidade_id');
$action->setParameter('receive_field', 'cidade_name');
$cidade_id->setAction($action);
$cep = new TEntry('cep');
$cpf_cnpj = new TEntry('cpf_cnpj');
$tipo_pessoa = new TRadioGroup('tipo_pessoa');
$tipo_pessoa->addItems(array('F' => 'Fisica', 'J' => 'Juridica'));
// add the fields
$this->form->addQuickField('Codigo', $id, 100);
$this->form->addQuickField('Nome', $nome, 200);
$this->form->addQuickField('Telefone', $telefone, 200);
$this->form->addQuickField('Email', $email, 200);
$this->form->addQuickField('Endereço', $endereco, 200);
$this->form->addQuickField('Numero', $numero, 200);
$this->form->addQuickFields('Cidade', array($cidade_id, $cidade_name), true);
$this->form->addQuickField('CEP', $cep, 200);
$this->form->addQuickField('CPF/CNPJ', $cpf_cnpj, 100);
$this->form->addQuickField('Tipo de pessoa', $tipo_pessoa, 200);
// create the form actions
$this->form->addQuickAction('Salvar', new TAction(array($this, 'onSave')), 'ico_save.png');
$this->form->addQuickAction('Novo', new TAction(array($this, 'onEdit')), 'ico_new.png');
// add the form to the page
parent::add($this->form);
}
开发者ID:klausetgeton,项目名称:esales-gtk,代码行数:58,代码来源:PessoaForm.class.php
示例15: __construct
/**
* Class Constructor
* @param $type Type of the message (info, error)
* @param $message Message to be shown
* @param $action Action to be processed when closing the dialog
*/
public function __construct($type, $message, TAction $action = NULL)
{
parent::__construct('', NULL, Gtk::DIALOG_MODAL, array(Gtk::STOCK_OK, Gtk::RESPONSE_OK));
parent::set_position(Gtk::WIN_POS_CENTER);
parent::set_size_request(500, 300);
$textview = new GtkTextView();
$textview->set_wrap_mode(Gtk::WRAP_WORD);
$textview->set_border_width(12);
$textbuffer = $textview->get_buffer();
$tagtable = $textbuffer->get_tag_table();
$customTag = new GtkTextTag();
$tagtable->add($customTag);
$customTag->set_property('foreground', '#525252');
$message = "\n " . str_replace('<br>', "\n ", $message);
$tagBegin = $textbuffer->create_mark('tagBegin', $textbuffer->get_end_iter(), true);
$textbuffer->insert_at_cursor(strip_tags($message));
$tagEnd = $textbuffer->create_mark('tagEnd', $textbuffer->get_end_iter(), true);
$start = $textbuffer->get_iter_at_mark($tagBegin);
$end = $textbuffer->get_iter_at_mark($tagEnd);
$textbuffer->apply_tag($customTag, $start, $end);
$textview->set_editable(FALSE);
$textview->set_cursor_visible(FALSE);
$pango = new PangoFontDescription('Sans 14');
$textview->modify_font($pango);
$image = $type == 'info' ? GtkImage::new_from_stock(Gtk::STOCK_DIALOG_INFO, Gtk::ICON_SIZE_DIALOG) : GtkImage::new_from_stock(Gtk::STOCK_DIALOG_ERROR, Gtk::ICON_SIZE_DIALOG);
$scroll = new GtkScrolledWindow();
$scroll->set_policy(Gtk::POLICY_NEVER, Gtk::POLICY_ALWAYS);
$scroll->add($textview);
$hbox = new GtkHBox();
$this->vbox->pack_start($hbox);
$hbox->pack_start($image, FALSE, FALSE);
$hbox->pack_start($scroll, TRUE, TRUE);
$this->show_all();
parent::connect('key_press_event', array($this, 'onClose'));
$result = parent::run();
if ($result == Gtk::RESPONSE_OK) {
if ($action) {
$parameters = $action->getParameters();
call_user_func_array($action->getAction(), array($parameters));
}
}
parent::destroy();
}
开发者ID:jhonleandres,项目名称:crmbf,代码行数:49,代码来源:TMessage.class.php
示例16: __construct
/**
* Class Constructor
* @param $name name of the form field
* @param $database name of the database connection
* @param $form name of the parent form
* @param $model name of the Active Record to be searched
* @param $display_field name of the field to be searched and shown
* @param $receive_key name of the form field to receive the primary key
* @param $receive_display_field name of the form field to receive the "display field"
*/
public function __construct($name, $database, $form, $model, $display_field, $receive_key, $receive_display_field)
{
parent::__construct($name);
$obj = new TStandardSeek();
// define the action parameters
$action = new TAction(array($obj, 'onSetup'));
$action->setParameter('database', $database);
$action->setParameter('parent', $form);
$action->setParameter('model', $model);
$action->setParameter('display_field', $display_field);
$action->setParameter('receive_key', $receive_key);
$action->setParameter('receive_field', $receive_display_field);
parent::setAction($action);
}
开发者ID:jhonleandres,项目名称:pecommerce,代码行数:24,代码来源:TDBSeekButton.class.php
示例17: setAction
/**
* Define the action for the SeekButton
* @param $action Action taken when the user clicks over the Seek Button (A TAction object)
*/
public function setAction(TAction $action)
{
$callback = $action->getAction();
$this->btn->setAction($action, '');
$param = array();
if (is_array($callback)) {
$classname = get_class($callback[0]);
if ($classname == 'TStandardSeek') {
$param['key'] = 3;
$param['parent'] = $action->getParameter('parent');
$param['database'] = $action->getParameter('database');
$param['model'] = $action->getParameter('model');
$param['display_field'] = $action->getParameter('display_field');
$param['receive_key'] = $action->getParameter('receive_key');
$param['receive_field'] = $action->getParameter('receive_field');
}
}
if ($this->useOutEvent) {
// get_text aqui não é on-the-fly, tem que chamar um método na hora do evento
$this->entry->connect_simple('focus-out-event', array($this, 'onBlur'), $callback, $param);
}
}
开发者ID:jhonleandres,项目名称:crmbf,代码行数:26,代码来源:TSeekButton.class.php
示例18: __construct
function __construct()
{
parent::__construct();
//Cria uma Tabela
$this->table = new TTable();
//Define as propriedades da Tabela
$this->table->border = 1;
$this->table->width = 500;
$this->table->style = 'border-collapse:collapse';
//Adiciona uma linha na tabela
$row = $this->table->addRow();
//Cria tres Ações
$action1 = new TAction(array($this, 'onProdutos'));
$action2 = new TAction(array($this, 'onContatos'));
$action3 = new TAction(array($this, 'onEmpresa'));
//Cria tres Links
$link1 = new TElement('a');
$link2 = new TElement('a');
$link3 = new TElement('a');
//Define Ação dos Links
$link1->href = $action1->serialize();
$link2->href = $action2->serialize();
$link3->href = $action3->serialize();
//Define o Rotulo dos Links
$link1->add('Produtos');
$link2->add('Contatos');
$link3->add('Empresa');
//Adiciona os Links na Linha
//Logo serão Criadas 3 Linhas
$row->addCell($link1);
$row->addCell($link2);
$row->addCell($link3);
//Cria uma linha para o Conteudo
//Cria uma linha e atribui a referencia a $content
$this->content = $this->table->addRow();
//Adiciona a tabela na pagina
parent::add($this->table);
}
开发者ID:ricardohenriq,项目名称:learn-php,代码行数:38,代码来源:page4.php
示例19: __construct
/**
* método __construct()
* instancia uma nova página
*/
function __construct()
{
parent::__construct();
// cria uma tabela
$this->table = new TTable();
// define algumas propriedades para tabela
$this->table->border = 1;
$this->table->width = 500;
$this->table->style = 'border-collapse:collapse';
// adiciona uma linha na tabela
$row = $this->table->addRow();
$row->bgcolor = '#d0d0d0';
// cria três ações
$action1 = new TAction(array($this, 'onProdutos'));
$action2 = new TAction(array($this, 'onContato'));
$action3 = new TAction(array($this, 'onEmpresa'));
// cria três links
$link1 = new TElement('a');
$link2 = new TElement('a');
$link3 = new TElement('a');
// define a ação dos links
$link1->href = $action1->serialize();
$link2->href = $action2->serialize();
$link3->href = $action3->serialize();
// define o rótulo de texto dos links
$link1->add('Produtos');
$link2->add('Contato');
$link3->add('Empresa');
// adiciona os links na linha
$row->addCell($link1);
$row->addCell($link2);
$row->addCell($link3);
// cria uma linha para conteúdo
$this->content = $this->table->addRow();
// adiciona a tabela na página
parent::add($this->table);
}
开发者ID:CodeBooks,项目名称:php-programando-com-orientacao-a-objetos,代码行数:41,代码来源:page4.php
示例20: __construct
/**
* Class constructor
* Creates the page and the registration form
*/
function __construct()
{
parent::__construct();
parent::setDatabase('esales');
// defines the database
parent::setActiveRecord('Produto');
// defines the active record
// creates the form
$this->form = new TQuickForm('form_Produto');
$this->form->class = 'tform';
// CSS class
$this->form->style = 'width: 500px';
// define the form title
$this->form->setFormTitle('Produto');
// create the form fields
$id = new TEntry('id');
$descricao = new TEntry('descricao');
$preco_compra = new TEntry('preco_compra');
$preco_venda = new TEntry('preco_venda');
$marca_id = new TEntry('marca_id');
$marca_id = new TSeekButton('marca_id');
$marca_name = new TEntry('marca_name');
$obj = new TStandardSeek();
$action = new TAction(array($obj, 'onSetup'));
$action->setParameter('database', 'esales');
$action->setParameter('parent', 'form_Produto');
$action->setParameter('model', 'Marca');
$action->setParameter('display_field', 'descricao');
$action->setParameter('receive_key', 'marca_id');
$action->setParameter('receive_field', 'marca_name');
$marca_id->setAction($action);
// add the fields
$this->form->addQuickField('Codigo', $id, 100);
$this->form->addQuickField('Descricao', $descricao, 200);
$this->form->addQuickField('Preco compra', $preco_compra, 200);
$this->form->addQuickField('Preco venda', $preco_venda, 200);
$this->form->addQuickFields('Marca', array($marca_id, $marca_name));
// create the form actions
$this->form->addQuickAction('Salvar', new TAction(array($this, 'onSave')), 'ico_save.png');
$this->form->addQuickAction('Novo', new TAction(array($this, 'onEdit')), 'ico_new.png');
// add the form to the page
parent::add($this->form);
}
开发者ID:klausetgeton,项目名称:esales-gtk,代码行数:47,代码来源:ProdutoForm.class.php
注:本文中的TAction类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论