public function Form() { $form = new TForm(); if ($this->setting['title'] == null) { $title = _lg('Simple Text widget title'); } else { $title = $this->setting['title']; } $form->AddField('text', _lg('title'), $title, array('name' => 'title')); $form->AddField('submit', '', _lg('send')); $result = $form->FormBody(); return $result; }
/** * Open an input dialog */ public function onInputDialog($param) { $name = new TEntry('name'); $amount = new TEntry('amount'); $name->setValue($param['key']); $form = new TForm('input_form'); $form->style = 'padding:20px'; $table = new TTable(); $table->addRowSet(new TLabel('Name: '), $name); $table->addRowSet($lbl = new TLabel('Amount: '), $amount); $lbl->setFontColor('red'); $form->setFields(array($name, $amount)); $form->add($table); // show the input dialog new TInputDialog('Input dialog', $form, new TAction(array($this, 'onConfirm')), 'Confirm'); }
/** * Show the widget */ public function show() { $this->tag->name = $this->name; // tag name $this->setProperty('style', "width:{$this->size}px", FALSE); //aggregate style info if ($this->height) { $this->setProperty('style', "height:{$this->height}px", FALSE); //aggregate style info } // check if the field is not editable if (!parent::getEditable()) { // make the widget read-only $this->tag->readonly = "1"; $this->tag->{'class'} = 'tfield_disabled'; // CSS } if (isset($this->exitAction)) { if (!TForm::getFormByName($this->formName) instanceof TForm) { throw new Exception(TAdiantiCoreTranslator::translate('You must pass the ^1 (^2) as a parameter to ^3', __CLASS__, $this->name, 'TForm::setFields()')); } $string_action = $this->exitAction->serialize(FALSE); $this->setProperty('onBlur', "serialform=(\$('#{$this->formName}').serialize());\n ajaxLookup('{$string_action}&'+serialform, this)"); } // add the content to the textarea $this->tag->add(htmlspecialchars($this->value)); // show the tag $this->tag->show(); }
/** * Show the widget at the screen */ public function show() { // define the tag properties $this->tag->name = $this->name; // tag name $this->tag->value = $this->value; // tag value $this->tag->type = 'password'; // input type $this->setProperty('style', "width:{$this->size}px", FALSE); //aggregate style info // verify if the field is not editable if (parent::getEditable()) { if (isset($this->exitAction)) { if (!TForm::getFormByName($this->formName) instanceof TForm) { throw new Exception(TAdiantiCoreTranslator::translate('You must pass the ^1 (^2) as a parameter to ^3', __CLASS__, $this->name, 'TForm::setFields()')); } $string_action = $this->exitAction->serialize(FALSE); $this->setProperty('onBlur', "serialform=(\$('#{$this->formName}').serialize());\n ajaxLookup('{$string_action}&'+serialform, this)"); } } else { // make the field read-only $this->tag->readonly = "1"; $this->tag->{'class'} = 'tfield_disabled'; // CSS } // show the tag $this->tag->show(); }
/** * Executed when the user clicks at a tree node * @param $param URL parameters containing key and value */ public function onSelect($param) { $obj = new StdClass(); $obj->key = $param['key']; // get node key (index) $obj->value = $param['value']; // get node value (contend) // fill the form with this object attributes TForm::sendData('form_test', $obj); }
public static function onChangeAction($param) { $obj = new StdClass(); $id = $param['tipo_material_consumo_id']; TTransaction::open("app"); $entidade = new TipoMaterialConsumo($id); $obj->custo = $entidade->custo; TForm::sendData('form_MaterialConsumo', $obj); TTransaction::close(); }
/** * Add a form action * @param $name Action name * @param $callback Action callback * @param $label Action label * @param $icon Action icon */ public function addAction($name, $callback, $label, $icon) { // creates the action button $button1 = new TButton($name); $button1->setAction($callback, $label); $button1->setImage($icon); // add the field to the form parent::addField($button1); // add a row for the button $row = $this->table->addRow(); $row->addCell($button1); }
public function Form() { if ($this->setting['title'] == null) { $title = _lg('Link generator'); } else { $title = $this->setting['title']; } if ($this->setting['type'] == null) { $type = null; } else { $type = $this->setting['type']; } if ($this->setting['id'] == null) { $id = null; } else { $id = $this->setting['id']; } // $result = 'title:<input type="text" name="title" value="' . $title . '" />'; // $result .= 'type:<select>' // . '<option value="0" > category </option>' // . '<option value="1" > tag </option>' // . '<option value="2" > topic </option>' // . '</select>'; // $result .= 'id:<input type="text" id="autocomp" />'; // $result .= '<input type="hidden" name="id" value="' . $id . '" />'; // $result .= 'id:<input type="submit" value="save" />'; $form = new TForm(); $form->AddField('select', 'title', $type, array('name' => 'type'), array(0 => array('0', 'category'), 1 => array('1', 'tag'), 2 => array('2', 'topic'))); $form->AddField('text', 'title', $title, array('class' => 'autocomplete', 'name' => 'title')); $form->AddField('hidden', '', $id, array('name' => 'id', 'class' => 'hidden')); $form->AddField('submit', '', _lg('save')); return $form->FormBody(); }
function __construct() { parent::__construct('form_conclui_venda'); // instancia uma tabela $table = new TTable(); // adiciona a tabela ao formulário parent::add($table); // cria os campos do formulário $cliente = new TEntry('id_cliente'); $desconto = new TEntry('desconto'); $valor_total = new TEntry('valor_total'); $valor_pago = new TEntry('valor_pago'); // define alguns atributos para os campos do formulário $valor_total->setEditable(FALSE); $cliente->setSize(100); $desconto->setSize(100); $valor_total->setSize(100); $valor_pago->setSize(100); // adiciona uma linha para o campo cliente $row = $table->addRow(); $row->addCell(new TLabel('Cliente:')); $row->addCell($cliente); // adiciona uma linha para o campo desconto $row = $table->addRow(); $row->addCell(new TLabel('Desconto:')); $row->addCell($desconto); // adiciona uma linha para o campo valor total $row = $table->addRow(); $row->addCell(new TLabel('Valor Total:')); $row->addCell($valor_total); // adiciona uma linha para o campo valor pago $row = $table->addRow(); $row->addCell(new TLabel('Valor Pago:')); $row->addCell($valor_pago); // cria um botão de ação para o formulário $this->button = new TButton('action1'); // adiciona uma linha para as ações do formulário $row = $table->addRow(); $row->addCell(''); $row->addCell($this->button); // define quais são os campos do formulário parent::setFields(array($cliente, $desconto, $valor_total, $valor_pago, $this->button)); }
/** * Add a form action * @param $label Action Label * @param $action TAction Object * @param $icon Action Icon */ public function addQuickAction($label, $action, $icon = 'ico_save.png') { // cria um botão de ação (salvar) $button = new TButton('save'); parent::addField($button); // define the button action $button->setAction($action, $label); $button->setImage($icon); if (!$this->has_action) { // creates the action table $this->actions = new TTable(); $this->action_row = $this->actions->addRow(); $row = $this->table->addRow(); $cell = $row->addCell($this->actions); $cell->colspan = 2; } // add cell for button $this->action_row->addCell($button); $this->has_action = TRUE; }
/** * Add a form action * @param $label Action Label * @param $action TAction Object * @param $icon Action Icon */ public function addQuickAction($label, TAction $action, $icon = 'ico_save.png') { $name = strtolower(str_replace(' ', '_', $label)); $button = new TButton($name); parent::addField($button); // define the button action $button->setAction($action, $label); $button->setImage($icon); if (!$this->has_action) { // creates the action table $this->actions = new TTable(); $this->action_row = $this->actions->addRow(); $row = $this->table->addRow(); $cell = $row->addCell($this->actions); $cell->colspan = 2; } // add cell for button $this->action_row->addCell($button); $this->has_action = TRUE; }
function __autoload($classe) { $pastas = array('app.widgets', 'app.ado'); foreach ($pastas as $pasta) { if (file_exists("{$pasta}/{$classe}.class.php")) { include_once "{$pasta}/{$classe}.class.php"; } } } // cria classe para manipulação dos registros de pessoas class Pessoa extends TRecord { const TABLENAME = 'pessoa'; } // instancia um formulário $form = new TForm('form_pessoas'); // instancia uma tabela $table = new TTable(); // define algumas propriedades da tabela $table->bgcolor = '#f0f0f0'; $table->style = 'border:2px solid grey'; $table->width = 400; // adiciona a tabela ao formulário $form->add($table); // cria os campos do formulário $codigo = new TEntry('id'); $nome = new TEntry('nome'); $endereco = new TEntry('endereco'); $datanasc = new TEntry('datanasc'); $sexo = new TRadioGroup('sexo'); $linguas = new TCheckGroup('linguas');
/** * Executed when the user chooses the record */ function onSelect($param) { $key = $param['key']; $prefix = TSession::getValue('prefix'); try { $model = isset($param['model']) ? $param['model'] : TSession::getValue('model'); TTransaction::open(TSession::getValue('banco')); // load the active record $campos = new $model($key); $cliente = new stdClass(); foreach (TSession::getValue('campos') as $field => $label) { $cliente->{$prefix . '_' . $field} = $campos->{$field}; } TForm::sendData(TSession::getValue('parent'), $cliente); parent::closeWindow(); // closes the window } catch (Exception $e) { throw new Exception('Erro com a mensagem ' . $e->getMesage()); // undo pending operations TTransaction::rollback(); } parent::closeWindow(); }
<?php $frm = new TForm(UR_MP . 'Member/RIns', 'post', array('class' => 'form rtl')); $frm->AddField('text', 'عنوان ', null, array('name' => 'report_title')); $frm->AddField('hidden', '', $this->id, array('name' => 'report_member_id')); $frm->AddField('textarea', 'کارنامه', null, array('name' => 'report_text', 'class' => 'ckeditor')); $frm->AddField('submit', '', 'ارسال'); ?> <br /> <h2 class="rtl"> <?php echo $this->title; ?> </h2> <br /> <br /> <div class="row"> <div class="grd-primary"> <?php $frm->Render(); ?> </div> <div class="grd-secondary"> </div> </div>
<?php global $MANAGER_TYPE; $frm = new TForm(UR_MP . 'Manager/Insert', 'post', array('class' => 'form')); $frm->AddField('text', 'نام کاربری', null, array('name' => 'manager_username')); $frm->AddField('email', 'ایمیل', null, array('name' => 'manager_email')); $frm->AddField('password', 'گذرواژه', null, array('name' => 'manager_password')); $frm->AddField('text', 'نام نمایشی', null, array('name' => 'manager_displayname')); $frm->AddField('select', 'نوع', null, array('name' => 'manager_type'), $MANAGER_TYPE); $frm->AddField('checkbox', 'محاظت شده', 1, array('name' => 'manager_protected')); $frm->AddField('submit', '', 'ارسال'); ?> <br /> <h2 class="rtl"> <?php echo $this->title; ?> </h2> <br /> <br /> <div class="row"> <div class="grd-primary"> <?php $frm->Render(); ?> </div> <div class="grd-secondary"> </div>
/** * Select the register by ID and return the information to the main form * When using onblur signal, AJAX passes all needed parameters via GET * instead of calling onSetup before. */ public function onSelect($param) { $key = $param['key']; $database = isset($param['database']) ? $param['database'] : TSession::getValue('standard_seek_database'); $receive_key = isset($param['receive_key']) ? $param['receive_key'] : TSession::getValue('standard_seek_receive_key'); $receive_field = isset($param['receive_field']) ? $param['receive_field'] : TSession::getValue('standard_seek_receive_field'); $display_field = isset($param['display_field']) ? $param['display_field'] : TSession::getValue('standard_seek_display_field'); $parent = isset($param['parent']) ? $param['parent'] : TSession::getValue('standard_seek_parent'); try { TTransaction::open($database); // load the active record $model = isset($param['model']) ? $param['model'] : TSession::getValue('standard_seek_model'); $activeRecord = new $model($key); TTransaction::close(); $object = new StdClass(); $object->{$receive_key} = $activeRecord->{'id'}; $object->{$receive_field} = $activeRecord->{$display_field}; TForm::sendData($parent, $object); parent::closeWindow(); // closes the window } catch (Exception $e) { // clear fields $object = new StdClass(); $object->{$receive_key} = ''; $object->{$receive_field} = ''; TForm::sendData($parent, $object); // undo all pending operations TTransaction::rollback(); } }
<?php $frm = new TForm(UR_MP . 'Member/Insert', 'post', array('class' => 'form rtl')); $frm->AddField('text', 'نام', null, array('name' => 'member_name')); $frm->AddField('email', 'ایمیل', null, array('name' => 'member_email')); $frm->AddField('password', 'گذرواژه', null, array('name' => 'member_password')); $frm->AddField('text', 'استاتوس', null, array('name' => 'member_status')); $frm->AddField('text', 'زمان تمدید', null, array('name' => 'member_active_time', 'class' => _lg('datepicker'))); $frm->AddField('file', 'آواتار', null, array('name' => 'member_avatar')); $frm->AddField('text', 'مقطع', null, array('name' => 'member_degree')); $frm->AddField('text', 'رشته تحصیلی', null, array('name' => 'member_field')); $frm->AddField('text', 'شماره تماس', null, array('name' => 'member_number')); $frm->AddField('text', 'شهر', null, array('name' => 'member_city')); $frm->AddField('select', 'نوع', null, array('name' => 'member_type'), array(0 => array('0', 'تایید نشده'), 1 => array('1', 'تایید شده'), 2 => array('2', 'اخراجی'))); $frm->AddField('submit', '', 'ارسال'); ?> <br /> <h2 class="rtl"> <?php echo $this->title; ?> </h2> <br /> <br /> <div class="row"> <div class="grd-primary"> <?php $frm->Render(); ?> </div>
<?php if (!isset($_COOKIE['mid'])) { Redirect('/ورود'); } $m = newUR_MP_ASSETS("member", 'member_'); $record = $m->GetRecord($_COOKIE['mid']); $frm = new TForm('', 'post', array('class' => 'form')); $frm->AddField('text', 'نام', $record['member_name'], array('name' => 'member_name')); $frm->AddField('text', 'استاتوس', $record['member_status'], array('name' => 'member_status')); $frm->AddField('file', 'آواتار', $record['member_id'], array('name' => 'member_avatar')); $frm->AddField('text', 'مقطع', $record['member_degree'], array('name' => 'member_degree')); $frm->AddField('text', 'رشته تحصیلی', $record['member_field'], array('name' => 'member_field')); $frm->AddField('text', 'شماره تماس', $record['member_number'], array('name' => 'member_number')); $frm->AddField('text', 'شهر', $record['member_city'], array('name' => 'member_city')); $frm->AddField('hidden', '', '/form/profile', array('class' => 'action')); $frm->AddField('submit', '', 'ویرایش'); $reg_frm = $frm->FormHeader(); $reg_frm .= $frm->FormBody(); $reg_frm .= $frm->FormFooter(); $smarty->assign('reg_frm', $reg_frm);
/** * Show the widget at the screen */ public function show() { if ($this->items) { // iterate the RadioButton options foreach ($this->items as $index => $label) { $button = new TRadioButton($this->name); $button->setTip($this->tag->title); $button->setValue($index); // check if contains any value if ($this->value == $index) { // mark as checked $button->setProperty('checked', '1'); } // check whether the widget is non-editable if (parent::getEditable()) { if (isset($this->changeAction)) { if (!TForm::getFormByName($this->formName) instanceof TForm) { throw new Exception(TAdiantiCoreTranslator::translate('You must pass the ^1 (^2) as a parameter to ^3', __CLASS__, $this->name, 'TForm::setFields()')); } $string_action = $this->changeAction->serialize(FALSE); $button->setProperty('onChange', "serialform=(\$('#{$this->formName}').serialize());\n ajaxLookup('{$string_action}&'+serialform, this)"); } } else { $button->setEditable(FALSE); } // create the label for the button $obj = new TLabel($label); $obj->add($button); $obj->show(); if ($this->layout == 'vertical') { // shows a line break $br = new TElement('br'); $br->show(); } echo "\n"; } } }
/** * Execute the exit action */ public function onExecuteExitAction() { $callback = $this->exitAction->getAction(); $param = (array) TForm::retrieveData($this->formName); call_user_func($callback, $param); }
/** * Executed when the user chooses the record */ function onSelect($param) { try { $key = $param['key']; TTransaction::open('samples'); // load the active record $city = new City($key); // closes the transaction TTransaction::close(); $object = new StdClass(); $object->city_id1 = $city->id; $object->city_name1 = $city->name; TForm::sendData('form_seek_sample', $object); parent::closeWindow(); // closes the window } catch (Exception $e) { // em caso de exceção // clear fields $object = new StdClass(); $object->city_id1 = ''; $object->city_name1 = ''; TForm::sendData('form_seek_sample', $object); // undo pending operations TTransaction::rollback(); } }
/** * Калькулятор примерной стоимости квартиры */ function showCalculator(&$params) { $house_type = sql_getRows('SELECT id, name FROM obj_housetypes WHERE 1 ORDER BY id, name ASC', true); $house_type['0'] = 'не выбрано'; $rooms = array('0' => 'не выбрано', '1' => 1, '2' => 2, '3' => 3, '4' => 4, '5' => '5 и более'); $distance = array('0' => 'не выбрано', '1' => 'До 5 минут пешком', '2' => '5-10 минут пешком', '3' => '10-15 минут пешком', '4' => 'Более 15 минут пешком', '5' => 'До 5 минут транспортом', '6' => '5-10 минут транспортом', '7' => '10-15 минут транспортом и далее'); $storeys_number = array('0' => 'не выбрано', '1' => 'до 9 этажа', '2' => 'от 10 до 22 этажа', '3' => 'более 22'); $ret = array(); $page =& Registry::get('TPage'); $metro = sql_getRows('SELECT id, name FROM obj_locat_metrostations WHERE 1 ORDER BY id, name ASC', true); // $metro[0] = 'не выбрано'; //Читаем файл настроек chdir("./configs"); $filename = "settings.txt"; $handle = fopen($filename, 'r'); $contents = fread($handle, filesize($filename)); fclose($handle); chdir("../"); $settings = explode("##", $contents); //Массив обязательных полей $required = unserialize($settings[0]); $percent = unserialize($settings[1]); $form = new TForm(null, $this); $form->form_name = 'сalculator'; $form->elements = array('metro_id' => array('name' => 'metro_id', 'type' => 'select', 'options' => $metro, 'text' => 'Метро', 'req' => isset($required[1]) ? 1 : 0, 'atrib' => 'style="width: 100%"'), 'house_type' => array('name' => 'house_type', 'type' => 'select', 'options' => $house_type, 'text' => 'Тип дома', 'req' => isset($required[2]) ? 1 : 0, 'atrib' => 'style="width: 100%"'), 'rooms' => array('name' => 'rooms', 'type' => 'select', 'options' => $rooms, 'text' => 'Количество комнат', 'req' => isset($required[3]) ? 1 : 0, 'atrib' => 'style="width: 100%"'), 'storey' => array('name' => 'storey', 'type' => 'radio', 'text' => 'Этаж квартиры', 'options' => array('0' => 'Любой', '1' => 'Не крайний', '2' => 'Крайний'), 'value' => 0, 'req' => isset($required[4]) ? 1 : 0, 'onerror' => '{#msg_err_invalid_phone#}'), 'storeys_number' => array('name' => 'storeys_number', 'type' => 'select', 'options' => $storeys_number, 'text' => 'Этажность', 'req' => isset($required[5]) ? 1 : 0, 'atrib' => 'style="width: 100%"'), 'distance' => array('name' => 'distance', 'type' => 'select', 'options' => $distance, 'text' => 'Расстояние от метро', 'req' => isset($required[6]) ? 1 : 0, 'atrib' => 'style="width: 100%"'), 'total_area' => array('name' => 'total_area', 'type' => 'text', 'text' => 'Общая площадь кв.м.', 'req' => isset($required[7]) ? 1 : 0, 'onerror' => '{#msg_err_invalid_phone#}', 'atrib' => 'style="width: 100%" class="input_text"'), array('name' => 'button1', 'type' => 'submit', 'value' => $page->tpl->get_config_vars("calculate"), 'group' => 'system', 'atrib' => 'class="Button"'), array('name' => 'button2', 'type' => 'reset', 'value' => $page->tpl->get_config_vars("reset"), 'group' => 'system', 'atrib' => 'class="Button"')); $fdata = $form->generate(); $fdata['form']['action'] = $page->content['href'] . "#report"; $fdata['form']['width'] = '80%'; if (empty($fdata['form']['errors']) && isset($_POST['fld'])) { $fdata['form']['report'] = $this->calculate($percent); } $ret['fdata'] = $fdata; return $ret; }
<?php /* Criar um Formulario com * Abstração de Componentes * Usando Painel (TPanel) * FOCO -- * Design e Layout */ function __autoload($classe) { if (file_exists("../app.widgets/{$classe}.class.php")) { include_once "../app.widgets/{$classe}.class.php"; } } //Cria o Formulario $form = new TForm('formPessoas'); //Cria um Painel $painel = new TPanel('440', '200'); //Adicona o Painel ao Formulario $form->add($painel); //Cria um rotulo de texto para o Titulo $titulo = new TLabel('Exemplo'); $titulo->setFontFace('Arial'); $titulo->setFontColor('#ff0000'); $titulo->setFontSize('18'); //Posiciona o titulo no Painel $painel->put($titulo, '120', '4'); $imagem = new TImage('../app.images/mouse.png'); //Posiciona a imagem no painel $painel->put($imagem, '320', '120'); //Cria uma serie de Campos de entrada de dados
<?php /* Criar um Formulario com * Abstração de Componentes * Usando Tabela (TTable) * FOCO -- * Criar Formulario Estruturado e Estatico */ function __autoload($classe) { if (file_exists("../app.widgets/{$classe}.class.php")) { include_once "../app.widgets/{$classe}.class.php"; } } //Cria o Formulario $form = new TForm('formPessoas'); //Cria a Tabala $table = new TTable(); //Adiciona tabela no Formulario $form->add($table); //Cria uma serie de Campos de entrada de dados $nome = new TEntry('Nome'); $email = new TEntry('Email'); $titulo = new TEntry('Titulo'); $mensagem = new TText('Mensagem'); //Adiciona uma linha para o Campo Nome $row = $table->addRow(); $row->addCell(new TLabel('Nome: ')); $row->addCell($nome); //Adiciona uma linha para o Campo Email $row = $table->addRow();
/** * Execute the exit action */ public function onExecuteExitAction() { if (!TForm::getFormByName($this->formName) instanceof TForm) { throw new Exception(TAdiantiCoreTranslator::translate('You must pass the ^1 (^2) as a parameter to ^3', __CLASS__, $this->wname, 'TForm::setFields()')); } if (isset($this->exitAction) and $this->exitAction instanceof TAction) { $callback = $this->exitAction->getAction(); $param = (array) TForm::retrieveData($this->formName); call_user_func($callback, $param); } }
/** * Clear the field * @param $form_name Form name * @param $field Field name */ public static function clearField($form_name, $field) { $form = TForm::getFormByName($form_name); if ($form instanceof TForm) { $field = $form->getField($field); if ($field instanceof IWidget) { $field->model->clear(); } } }
$listview->AddColum(_lg('plugin name'), 'plugin_name', 10); $listview->AddColum(_lg('plugin author'), 'plugin_author', 10); $listview->SetPattern(1, '<img src="' . UR_MP_ASSETS . 'images/active%s.png" alt="[plugin status]" />'); $listview->AddColum(_lg('status'), '%1plugin_status', 2); $listview->AddColum('', 'plugin_discrption', 16); $pattern = '<a class="button delete" href="' . UR_MP . 'Plugin/Delete/%id%"> ' . _lg('Delete') . ' </a> <a class="button active" href="' . UR_MP . 'Plugin/Status/%id%/1"> ' . _lg('Active') . ' </a> <a class="button deactive" href="' . UR_MP . 'Plugin/Status/%id%/0"> ' . _lg('Deactive') . '</a>'; $listview->AddAction($pattern, 6, 'plugin_status'); $listview->AddFilter(_lg('Deactived'), 'plugin_status', '0'); $listview->AddFilter(_lg('Actived'), 'plugin_status', '1'); $listview->AddBulkAcction(_lg('Deactive'), 'Edit', 'plugin_status,0'); $listview->AddBulkAcction(_lg('Active'), 'Edit', 'plugin_status,1'); $listview->AddBulkAcction(_lg('Delete'), 'Delete', null); $listview->Render('Plugin'); $frm = new TForm(UR_MP . 'Plugin/upload'); $frm->AddField('file', _lg('zip file'), null, array('name' => 'file')); $frm->AddField('submit', '', _lg('Upload')); ?> <br /> <div style="background: #1392e9;padding:1em;margin:1em;"> <h2> <?php _lp('Upload new plugin'); ?> </h2> <br /> <?php $frm->Render(); ?>
<?php //var_dump($this->record); $date = TDate::GetInstance(); $frm = new TForm(UR_MP . 'Member/Update/' . $this->record['member_id'], 'post', array('class' => 'form rtl')); $frm->AddField('text', 'نام', $this->record['member_name'], array('name' => 'member_name')); $frm->AddField('email', 'ایمیل', $this->record['member_email'], array('name' => 'member_email')); $frm->AddField('password', 'گذرواژه', null, array('name' => 'member_password')); $frm->AddField('text', 'استاتوس', $this->record['member_status'], array('name' => 'member_status')); $frm->AddField('text', 'زمان تمدید', $date->PDate('Y/m/d', $this->record['member_active_time']), array('name' => 'member_active_time', 'class' => _lg('datepicker'))); $frm->AddField('file', 'آواتار', $this->record['member_id'], array('name' => 'member_avatar')); $frm->AddField('text', 'مقطع', $this->record['member_degree'], array('name' => 'member_degree')); $frm->AddField('text', 'رشته تحصیلی', $this->record['member_field'], array('name' => 'member_field')); $frm->AddField('text', 'شماره تماس', $this->record['member_number'], array('name' => 'member_number')); $frm->AddField('text', 'شهر', $this->record['member_city'], array('name' => 'member_city')); $frm->AddField('textarea', 'توصیه مشاور/ پشتیبان', $this->record['member_comment'], array('name' => 'member_comment', 'class' => 'full-width')); $frm->AddField('select', 'نوع', $this->record['member_type'], array('name' => 'member_type'), array(0 => array('0', 'تایید نشده'), 1 => array('1', 'تایید شده'), 2 => array('2', 'اخراجی'))); $frm->AddField('select', 'وضعیت چت', $this->record['member_chat'], array('name' => 'member_chat'), array(0 => array('1', ' فعال'), 1 => array('0', 'اخراجی'))); $frm->AddField('submit', '', 'ویرایش'); //print_r($this->reports); ?> <br /> <h2 class="rtl"> <?php echo $this->title; ?> </h2> <br /> <br /> <div class="row"> <div class="grd-primary">
/** * Executed when the user chooses the record */ public function onSelect($param) { try { $key = $param['key']; TTransaction::open('library'); // load the active record $rep = new TRepository('Item'); $criteria = new TCriteria(); $criteria->add(new TFilter('barcode', '=', $key)); $objects = $rep->load($criteria); if ($objects) { $item = $objects[0]; $object = new StdClass(); $object->barcode_input = $item->barcode; $object->book_title_input = $item->title; TForm::sendData('form_Loan', $object); } else { $object = new StdClass(); $object->barcode_input = ''; $object->book_title_input = ''; TForm::sendData('form_Loan', $object); } // closes the transaction TTransaction::close(); parent::closeWindow(); // closes the window } catch (Exception $e) { // exibe a mensagem gerada pela exceção new TMessage('error', $e->getMessage()); // desfaz todas alterações no banco de dados TTransaction::rollback(); } }
function formgenerate() { //генерируем форму $page =& Registry::get('TPage'); $form = new TForm(array('action' => $page->content['href']), $this); $form->form_name = 'guestbook'; $form->elements = array('name' => array('name' => 'name', 'type' => 'text', 'req' => 1, 'atrib' => 'style="width: 100%; height: 20px;"'), 'message' => array('name' => 'message', 'type' => 'textarea', 'req' => 1, 'atrib' => 'style="width: 100%; height: 120px;"')); $fdata = $form->generate(); /* if (isset($_GET['ok'])||isset($_GET['fail'])) { $fdata['form']['result'] = isset($_GET['ok']) ? 'Успешно отправлено.' : (isset($_GET['fail']) ? 'Ошибка отправки.' : ''); $fdata['form']['show_result'] = 1; } */ /** * @var TRusoft_View $view */ $view =& Registry::get('TRusoft_View'); $view->assign(array('fdata' => $fdata)); $this->form = $view->render('form.html'); }