• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP TSession类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中TSession的典型用法代码示例。如果您正苦于以下问题:PHP TSession类的具体用法?PHP TSession怎么用?PHP TSession使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了TSession类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: onSave

 public function onSave($param)
 {
     try {
         $this->form->validate();
         $object = $this->form->getData();
         TTransaction::open('permission');
         $user = SystemUser::newFromLogin(TSession::getValue('login'));
         $user->name = $object->name;
         $user->email = $object->email;
         if ($object->password1) {
             if ($object->password1 != $object->password2) {
                 throw new Exception(_t('The passwords do not match'));
             }
             $user->password = md5($object->password1);
         } else {
             unset($user->password);
         }
         $user->store();
         $this->form->setData($object);
         new TMessage('info', TAdiantiCoreTranslator::translate('Record saved'));
         TTransaction::close();
     } catch (Exception $e) {
         new TMessage('error', $e->getMessage());
     }
 }
开发者ID:edurbs,项目名称:sobcontrole,代码行数:25,代码来源:SystemProfileForm.class.php


示例2: acesso

 public static function acesso($nivel)
 {
     $user = TSession::getValue('user');
     if ($user->permissao < $nivel) {
         AdiantiCoreApplication::loadPage('Home');
     }
 }
开发者ID:cbsistem,项目名称:livro_adianti_3_0,代码行数:7,代码来源:Usuario.class.php


示例3: __construct

 /**
  * Class constructor
  * Creates the page and the registration form
  */
 function __construct()
 {
     parent::__construct();
     // security check
     if (TSession::getValue('logged') !== TRUE) {
         throw new Exception(_t('Not logged'));
     }
     // security check
     TTransaction::open('library');
     if (User::newFromLogin(TSession::getValue('login'))->role->mnemonic !== 'LIBRARIAN') {
         throw new Exception(_t('Permission denied'));
     }
     TTransaction::close();
     // defines the database
     parent::setDatabase('library');
     // defines the active record
     parent::setActiveRecord('Publisher');
     // creates the form
     $this->form = new TQuickForm('form_Publisher');
     // create the form fields
     $id = new TEntry('id');
     $name = new TEntry('name');
     $id->setEditable(FALSE);
     // define the sizes
     $this->form->addQuickField(_t('Code'), $id, 100);
     $this->form->addQuickField(_t('Name'), $name, 200);
     // define the form action
     $this->form->addQuickAction(_t('Save'), new TAction(array($this, 'onSave')), 'ico_save.png');
     // add the form to the page
     parent::add($this->form);
 }
开发者ID:jhonleandres,项目名称:crmbf,代码行数:35,代码来源:PublisherForm.class.php


示例4: run

 public static function run($debug = FALSE)
 {
     new TSession();
     if ($_REQUEST) {
         $class = isset($_REQUEST['class']) ? $_REQUEST['class'] : '';
         if (TSession::getValue('logged')) {
             // logged
             $programs = (array) TSession::getValue('programs');
             // programs with permission
             $programs = array_merge($programs, array('Adianti\\Base\\TStandardSeek' => TRUE, 'LoginForm' => TRUE, 'AdiantiMultiSearchService' => TRUE, 'AdiantiUploaderService' => TRUE, 'EmptyPage' => TRUE));
             // default programs
             if (isset($programs[$class])) {
                 parent::run($debug);
             } else {
                 new TMessage('error', _t('Permission denied'));
             }
         } else {
             if ($class == 'LoginForm') {
                 parent::run($debug);
             } else {
                 new TMessage('error', _t('Permission denied'), new TAction(array('LoginForm', 'onLogout')));
             }
         }
     }
 }
开发者ID:jfrank1500,项目名称:curso_php,代码行数:25,代码来源:engine.php


示例5: __construct

 /**
  * Class Constructor
  * @param  $name name of the field
  * @param  $model name of the Model
  * @param  $form name of the Form
  * @param  $database name of the Database
  * @param  $filtros name of the field of filters (Array)
  * @param  $fields name of the fields of columns
  */
 public function __construct($name, $model, $form, $database, $filtros, $fields)
 {
     parent::__construct($name);
     $this->useOutEvent = TRUE;
     $this->setProperty('class', 'tfield tseekentry', TRUE);
     // classe CSS
     $image = new TImage('lib/adianti/images/ico_find.png');
     $this->button = new TElement('button');
     $this->button->{'class'} = 'btn btn-default tseekbutton';
     $this->button->{'type'} = 'button';
     $this->button->{'id'} = 'Pbutton_' . $name;
     $this->button->{'onmouseover'} = 'style.cursor = \'pointer\'';
     $this->button->{'name'} = '_' . $this->name . '_link';
     $this->button->{'onmouseout'} = 'style.cursor = \'default\'';
     $this->button->add($image);
     $url = 'index.php?class=PDBStandartSeek&method=onReload';
     $action = "__adianti_load_page( '{$url}');";
     $action .= "return false;";
     $this->button->onclick = $action;
     //configuração
     TSession::setValue('Model', $model);
     // model
     TSession::setValue('form', $form);
     //form de retorno
     TSession::setValue('database', $database);
     TSession::setValue('filtros', $filtros);
     TSession::setValue('fields', $fields);
 }
开发者ID:cbsistem,项目名称:PWD-Lib,代码行数:37,代码来源:PSeekButton.class.php


示例6: checkCliente

 public static function checkCliente()
 {
     if (!TSession::getValue('cliente_logado')) {
         new TMessage('info', 'Você não esta logado');
         TCoreApplication::executeMethod('ClientesLogin');
     }
 }
开发者ID:jhonleandres,项目名称:pecommerce,代码行数:7,代码来源:Clientes.class.php


示例7: onSave

 /**
  * method onSave()
  * Executed whenever the user clicks at the save button
  */
 function onSave()
 {
     try {
         TTransaction::open('app');
         // open a transaction
         // get the form data into an active record SystemUser
         $object = $this->form->getData('StdClass');
         $this->form->validate();
         // form validation
         $senhaatual = $object->current;
         $senhanova = $object->password;
         $confirmacao = $object->confirmation;
         $usuario = new SystemUser(TSession::getValue("userid"));
         if ($usuario->password == md5($senhaatual)) {
             if ($senhanova == $confirmacao) {
                 $usuario->password = md5($senhanova);
                 $usuario->store();
                 new TMessage('info', TAdiantiCoreTranslator::translate('Record saved'));
             } else {
                 new TMessage('error', "A nova senha deve ser igual a sua confirmação.");
             }
         } else {
             new TMessage('error', "A senha atual não confere.");
         }
         TTransaction::close();
         // close the transaction
         // shows the success message
     } catch (Exception $e) {
         // in case of exception
         new TMessage('error', '<b>Error</b> ' . $e->getMessage());
         // shows the exception error message
         TTransaction::rollback();
         // undo all pending operations
     }
 }
开发者ID:jfrank1500,项目名称:curso_php,代码行数:39,代码来源:TrocarSenhaForm.class.php


示例8: onSave

 /**
  * method onSave()
  * Executed whenever the user clicks at the save button
  */
 function onSave()
 {
     try {
         // open a transaction with database 'changeman'
         TTransaction::open('changeman');
         // get the form data into an active record Issue
         $object = $this->form->getData();
         // form validation
         $this->form->validate();
         $member = Member::newFromLogin(TSession::getValue('login'));
         if ($member->password !== md5($object->current_password)) {
             throw new Exception(_t('Current password does not match'));
         }
         if ($object->new_password1 !== $object->new_password2) {
             throw new Exception(_t('New password does not match the confirm password'));
         }
         // stores the object
         $member->password = md5($object->new_password1);
         $member->store();
         // fill the form with the active record data
         $this->form->setData($object);
         // close the transaction
         TTransaction::close();
         // shows the success message
         new TMessage('info', _t('Password changed successfully'));
         // reload the listing
     } catch (Exception $e) {
         // shows the exception error message
         new TMessage('error', '<b>Error</b> ' . $e->getMessage());
         // undo all pending operations
         TTransaction::rollback();
     }
 }
开发者ID:jfrank1500,项目名称:curso_php,代码行数:37,代码来源:PasswordForm.class.php


示例9: checkPermission

 public static function checkPermission($action)
 {
     //pega as funcionalidades que o usuario logado pode acessar
     $funcionalidades = TSession::getValue('funcionalidades');
     //retorna true ou falso, indicando se o usuario pode ou nao acessar a tela
     return isset($funcionalidades[$action]) and $funcionalidades[$action];
 }
开发者ID:andermall,项目名称:tcc,代码行数:7,代码来源:PermissaoSistema.class.php


示例10: onSave

 /**
  * method onSave()
  * Executed whenever the user clicks at the save button
  */
 function onSave()
 {
     try {
         // open a transaction with database 'changeman'
         TTransaction::open('changeman');
         // get the form data into an active record Note
         $object = $this->form->getData('Note');
         $logged = Member::newFromLogin(TSession::getValue('login'));
         $object->id_user = $logged->id;
         $object->register_date = date('Y-m-d');
         $object->register_time = date('H:i');
         // form validation
         $this->form->validate();
         // stores the object
         $object->store();
         $issue = new Issue($object->id_issue);
         $project = new Project($issue->id_project);
         $member = new Member($issue->id_user);
         // who has opened the issue
         // read email configuration file
         $ini = parse_ini_file('app/config/email.ini');
         $members = $project->getMembers(array('MEMBER', 'MANAGER'));
         $members = array_merge($members, array($member));
         // merge the logged user
         $mail_template = file_get_contents('app/resources/note.html');
         $mail_template = str_replace('{DESCRIPTION}', $issue->description, $mail_template);
         $mail_template = str_replace('{OPENER}', $member->name . ' ' . $issue->register_date . ' ' . $issue->issue_time, $mail_template);
         $mail_template = str_replace('{NOTE}', $object->note, $mail_template);
         $mail_template = str_replace('{MEMBER}', $logged->name . ' ' . $object->register_date . ' ' . $object->register_time, $mail_template);
         $mail = new TMail();
         $mail->setFrom($ini['from'], $ini['name']);
         $mail->setSubject(_t('Note') . ' #' . $issue->id . ': ' . $issue->title);
         $mail->setHtmlBody($mail_template);
         foreach ($members as $member) {
             $emails = explode(',', $member->email);
             foreach ($emails as $email) {
                 $mail->addAddress(trim($email), $member->name);
                 // echo "{$email}, {$member-> name} <br>";
             }
         }
         $mail->SetUseSmtp();
         $mail->SetSmtpHost($ini['host'], $ini['port']);
         $mail->SetSmtpUser($ini['user'], $ini['pass']);
         $mail->setReplyTo($ini['repl']);
         $mail->send();
         // fill the form with the active record data
         $this->form->setData($object);
         // close the transaction
         TTransaction::close();
         // shows the success message
         new TMessage('info', TAdiantiCoreTranslator::translate('Record saved'));
         // reload the listing
     } catch (Exception $e) {
         // shows the exception error message
         new TMessage('error', '<b>Error</b> ' . $e->getMessage());
         // undo all pending operations
         TTransaction::rollback();
     }
 }
开发者ID:jfrank1500,项目名称:curso_php,代码行数:63,代码来源:NoteForm.class.php


示例11: require_connection

 public function require_connection()
 {
     if (!TSession::try_get_value('id_user', $id_user)) {
         return $this->connected = false;
     } else {
         return $this->connected = $id_user;
     }
 }
开发者ID:thalelinh,项目名称:MoneyManager,代码行数:8,代码来源:SimpleAction.class.php


示例12: onDelete

 public function onDelete($param)
 {
     $key = $param['key'];
     $objects = TSession::getValue('session_contacts');
     unset($objects[$key]);
     TSession::setValue('session_contacts', $objects);
     $this->onReload();
 }
开发者ID:jfrank1500,项目名称:curso_php,代码行数:8,代码来源:DatagridWindowForm.class.php


示例13: __construct

 /**
  * Class constructor
  * Creates the page and the registration form
  */
 function __construct()
 {
     parent::__construct();
     // security check
     if (TSession::getValue('logged') !== TRUE) {
         throw new Exception(_t('Not logged'));
     }
 }
开发者ID:jfrank1500,项目名称:curso_php,代码行数:12,代码来源:ViewDocumentForm.class.php


示例14: __construct

 /**
  * Class constructor
  * Creates the page, the form and the listing
  */
 public function __construct()
 {
     parent::__construct();
     parent::setDatabase('samples');
     // defines the database
     parent::setActiveRecord('Product');
     // defines the active record
     parent::setDefaultOrder('id', 'asc');
     // defines the default order
     parent::addFilterField('description', 'like');
     // add a filter field
     parent::addFilterField('unity', '=');
     // add a filter field
     // creates the form, with a table inside
     $this->form = new TQuickForm('form_search_Product');
     $this->form->class = 'tform';
     $this->form->style = 'width: 650px';
     $this->form->setFormTitle('Products');
     $units = array('PC' => 'Pieces', 'GR' => 'Grain');
     // create the form fields
     $description = new TEntry('description');
     $unit = new TCombo('unity');
     $unit->addItems($units);
     // add a row for the filter field
     $this->form->addQuickField('Description', $description, 200);
     $this->form->addQuickField('Unit', $unit, 200);
     $this->form->setData(TSession::getValue('Product_filter_data'));
     $this->form->addQuickAction(_t('Find'), new TAction(array($this, 'onSearch')), 'ico_find.png');
     $this->form->addQuickAction(_t('New'), new TAction(array('ProductForm', 'onEdit')), 'ico_new.png');
     // creates a DataGrid
     $this->datagrid = new TQuickGrid();
     $this->datagrid->setHeight(320);
     // creates the datagrid columns
     $id = $this->datagrid->addQuickColumn('ID', 'id', 'center', 50);
     $description = $this->datagrid->addQuickColumn('Description', 'description', 'left', 300);
     $stock = $this->datagrid->addQuickColumn('Stock', 'stock', 'right', 70);
     $sale_price = $this->datagrid->addQuickColumn('Sale Price', 'sale_price', 'right', 70);
     $unity = $this->datagrid->addQuickColumn('Unit', 'unity', 'right', 70);
     // create the datagrid actions
     $edit_action = new TDataGridAction(array('ProductForm', 'onEdit'));
     $delete_action = new TDataGridAction(array($this, 'onDelete'));
     // add the actions to the datagrid
     $this->datagrid->addQuickAction(_t('Edit'), $edit_action, 'id', 'ico_edit.png');
     $this->datagrid->addQuickAction(_t('Delete'), $delete_action, 'id', 'ico_delete.png');
     // create the datagrid model
     $this->datagrid->createModel();
     // create the page navigation
     $this->pageNavigation = new TPageNavigation();
     $this->pageNavigation->setAction(new TAction(array($this, 'onReload')));
     $this->pageNavigation->setWidth($this->datagrid->getWidth());
     // create the page container
     $container = new TVBox();
     $container->add(new TXMLBreadCrumb('menu.xml', 'ProductList'));
     $container->add($this->form);
     $container->add($this->datagrid);
     $container->add($this->pageNavigation);
     parent::add($container);
 }
开发者ID:jfrank1500,项目名称:curso_php,代码行数:62,代码来源:ProductList.class.php


示例15: __construct

 /**
  * Class constructor
  * Creates the page and the registration form
  */
 function __construct()
 {
     parent::__construct();
     // security check
     if (TSession::getValue('logged') !== TRUE) {
         throw new Exception(_t('Not logged'));
     }
     // security check
     TTransaction::open('library');
     if (User::newFromLogin(TSession::getValue('login'))->role->mnemonic !== 'LIBRARIAN') {
         throw new Exception(_t('Permission denied'));
     }
     TTransaction::close();
     // defines the database
     parent::setDatabase('library');
     // defines the active record
     parent::setActiveRecord('Classification');
     // creates the form
     $this->form = new TQuickForm('form_Classification');
     // create the form fields
     $id = new TEntry('id');
     $description = new TEntry('description');
     $id->setEditable(FALSE);
     // define the sizes
     $this->form->addQuickField(_t('Code'), $id, 100);
     $this->form->addQuickField(_t('Description'), $description, 200);
     // define the form action
     $this->form->addQuickAction(_t('Save'), new TAction(array($this, 'onSave')), 'ico_save.png');
     $this->form->addQuickAction(_t('New'), new TAction(array($this, 'onEdit')), 'ico_new.png');
     // creates a DataGrid
     $this->datagrid = new TQuickGrid();
     $this->datagrid->setHeight(320);
     // creates the datagrid columns
     $this->datagrid->addQuickColumn(_t('Code'), 'id', 'left', 100, new TAction(array($this, 'onReload')), array('order', 'id'));
     $this->datagrid->addQuickColumn(_t('Description'), 'description', 'left', 200, new TAction(array($this, 'onReload')), array('order', 'description'));
     // add the actions to the datagrid
     $this->datagrid->addQuickAction(_t('Edit'), new TDataGridAction(array($this, 'onEdit')), 'id', 'ico_edit.png');
     $this->datagrid->addQuickAction(_t('Delete'), new TDataGridAction(array($this, 'onDelete')), 'id', 'ico_delete.png');
     // 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
     $table = new TTable();
     // add a row to the form
     $row = $table->addRow();
     $row->addCell($this->form);
     // add a row to the datagrid
     $row = $table->addRow();
     $row->addCell($this->datagrid);
     // add a row for page navigation
     $row = $table->addRow();
     $row->addCell($this->pageNavigation);
     // add the table inside the page
     parent::add($table);
 }
开发者ID:jhonleandres,项目名称:crmbf,代码行数:62,代码来源:ClassificationFormList.class.php


示例16: __construct

 /**
  * Class constructor
  * Creates the page, the form and the listing
  */
 public function __construct()
 {
     parent::__construct();
     Usuario::checkLogin();
     parent::setDatabase('sample');
     // defines the database
     parent::setActiveRecord('Usuario');
     // defines the active record
     parent::setDefaultOrder('id', 'asc');
     // defines the default order
     parent::setFilterField('login');
     // defines the filter field
     // creates the form, with a table inside
     $this->form = new TForm('form_search_Usuario');
     $table = new TTable();
     $this->form->add($table);
     // create the form fields
     $filter = new TEntry('login');
     $filter->setValue(TSession::getValue('Usuario_login'));
     // add a row for the filter field
     $table->addRowSet(new TLabel('login:'), $filter);
     // create two action buttons to the form
     $find_button = new TButton('find');
     $new_button = new TButton('new');
     $find_button->setAction(new TAction(array($this, 'onSearch')), _t('Find'));
     $new_button->setAction(new TAction(array('UsuarioForm', 'onEdit')), _t('New'));
     $find_button->setImage('ico_find.png');
     $new_button->setImage('ico_new.png');
     // add a row for the form actions
     $table->addRowSet($find_button, $new_button);
     // define wich are the form fields
     $this->form->setFields(array($filter, $find_button, $new_button));
     // creates a DataGrid
     $this->datagrid = new TQuickGrid();
     $this->datagrid->setHeight(320);
     // creates the datagrid columns
     $id = $this->datagrid->addQuickColumn('id', 'id', 'right', 100);
     $login = $this->datagrid->addQuickColumn('login', 'login', 'left', 200);
     $senha = $this->datagrid->addQuickColumn('senha', 'senha', 'left', 200);
     // create the datagrid actions
     $edit_action = new TDataGridAction(array('UsuarioForm', 'onEdit'));
     $delete_action = new TDataGridAction(array($this, 'onDelete'));
     // add the actions to the datagrid
     $this->datagrid->addQuickAction(_t('Edit'), $edit_action, 'id', 'ico_edit.png');
     $this->datagrid->addQuickAction(_t('Delete'), $delete_action, 'id', 'ico_delete.png');
     // create the datagrid model
     $this->datagrid->createModel();
     // create the page navigation
     $this->pageNavigation = new TPageNavigation();
     $this->pageNavigation->setAction(new TAction(array($this, 'onReload')));
     $this->pageNavigation->setWidth($this->datagrid->getWidth());
     // create the page container
     $container = new TVBox();
     $container->add($this->form);
     $container->add($this->datagrid);
     $container->add($this->pageNavigation);
     parent::add($container);
 }
开发者ID:jhonleandres,项目名称:pecommerce,代码行数:62,代码来源:UsuarioList.class.php


示例17: treat_success

 /** @param PDOStatement $query_result */
 private function treat_success($query_result)
 {
     if ($query_result->rowCount() > 0 && TSession::try_get_value('id_user', $id_user)) {
         (new Insert_user_event(array('id_user' => $id_user, 'id_event' => TTransaction::get_last_inserted_id())))->run();
     } else {
         parent::set_error(102);
         TTransaction::rollback();
     }
 }
开发者ID:thalelinh,项目名称:MoneyManager,代码行数:10,代码来源:Insert_event.class.php


示例18: __construct

 /**
  * Class constructor
  * Creates the page and the registration form
  */
 function __construct()
 {
     parent::__construct();
     // security check
     if (TSession::getValue('logged') !== TRUE) {
         throw new Exception(_t('Not logged'));
     }
     // security check
     TTransaction::open('changeman');
     if (Member::newFromLogin(TSession::getValue('login'))->role_mnemonic !== 'ADMINISTRATOR' and Member::newFromLogin(TSession::getValue('login'))->role_mnemonic !== 'MANAGER') {
         throw new Exception(_t('Permission denied'));
     }
     TTransaction::close();
     // creates a table
     $table = new TTable();
     // creates the form
     $this->form = new TForm('form_Document');
     $this->form->add($this->notebook);
     $this->form->class = 'tform';
     $this->form->add($table);
     $table->addRowSet(new TLabel(_t('Document')), '')->class = 'tformtitle';
     // create the form fields
     $id = new TEntry('id');
     $id_project = new TDBCombo('id_project', 'changeman', 'Project', 'id', 'description');
     $title = new TEntry('title');
     $content = new THtmlEditor('content');
     $id->setEditable(FALSE);
     // define the sizes
     $id->setSize(100);
     $id_project->setSize(200);
     $title->setSize(200, 40);
     $content->setSize(680, 350);
     $table->addRowSet(new TLabel('ID:'), $id);
     $table->addRowSet(new TLabel(_t('Project') . ': '), $id_project);
     $table->addRowSet(new TLabel(_t('Title') . ': '), $title);
     $hbox = new THBox();
     $hbox->style = 'margin: 10px';
     $hbox->add($content);
     $row = $table->addRow();
     $row->addCell($lbl = new TLabel(_t('Content') . ': '));
     $lbl->setFontStyle('b');
     $row = $table->addRow();
     $cell = $row->addCell($hbox);
     $cell->colspan = 3;
     // create an action button (save)
     $save_button = new TButton('save');
     // define the button action
     $save_button->setAction(new TAction(array($this, 'onSave')), _t('Save'));
     $save_button->setImage('ico_save.png');
     // define wich are the form fields
     $this->form->setFields(array($id, $id_project, $title, $content, $save_button));
     $table->addRowSet($save_button, '')->class = 'tformaction';
     $container = new TTable();
     $container->addRow()->addCell($this->form);
     // add the form to the page
     parent::add($container);
 }
开发者ID:jfrank1500,项目名称:curso_php,代码行数:61,代码来源:DocumentForm.class.php


示例19: __construct

 /**
  * Class constructor
  * Creates the page and the registration form
  */
 function __construct()
 {
     parent::__construct();
     // security check
     if (TSession::getValue('logged') !== TRUE) {
         throw new Exception(_t('Not logged'));
     }
     // creates a table
     $table = new TTable();
     $this->notebook = new TNotebook();
     $this->notebook->setSize(600, 350);
     $this->notebook->appendPage(_t('Data'), $table);
     // creates the form
     $this->form = new TForm('form_Release');
     $this->form->add($this->notebook);
     $options = array('Y' => _t('Yes'), 'N' => _t('No'));
     // create the form fields
     $id = new TEntry('id');
     $id_project = new TEntry('project');
     $name = new TEntry('name');
     $description = new THtmlEditor('description');
     $id->setEditable(FALSE);
     $id_project->setEditable(FALSE);
     $name->setEditable(FALSE);
     $description->setEditable(FALSE);
     // define the sizes
     $id->setSize(100);
     $id_project->setSize(200);
     $name->setSize(200, 40);
     $description->setSize(530, 200);
     // add a row for the field id
     $row = $table->addRow();
     $row->addCell(new TLabel('ID:'));
     $row->addCell($id);
     // add a row for the field id_project
     $row = $table->addRow();
     $row->addCell(new TLabel(_t('Project') . ': '));
     $row->addCell($id_project);
     // add a row for the field name
     $row = $table->addRow();
     $row->addCell(new TLabel(_t('Name') . ': '));
     $row->addCell($name);
     // add a row for the field description
     $row = $table->addRow();
     $row->addCell($lbl = new TLabel(_t('Description') . ': '));
     $lbl->setFontStyle('b');
     $row = $table->addRow();
     $cell = $row->addCell($description);
     $cell->colspan = 3;
     // define wich are the form fields
     $this->form->setFields(array($id, $id_project, $name, $description));
     $container = new TTable();
     $container->addRow()->addCell($this->form);
     // add the form to the page
     parent::add($container);
 }
开发者ID:jfrank1500,项目名称:curso_php,代码行数:60,代码来源:ViewReleaseForm.class.php


示例20: finalizar

 public function finalizar()
 {
     try {
         TTransaction::open('sample');
         $produtos = PCart::getItens();
         // pegamos os dados do cliente
         $cliente = new PCliente();
         $cliente_compra = new Clientes(TSession::getValue('id'));
         $cliente->setNome($cliente_compra->nome . ' ' . $cliente_compra->sobrenome);
         $cliente->setCep($cliente_compra->cep);
         $cliente->setLogradouro($cliente_compra->logradouro);
         $cliente->setBairro($cliente_compra->bairro);
         $cliente->setCidade($cliente_compra->cidade);
         $cliente->setUf($cliente_compra->uf);
         $cliente->setDD($cliente_compra->dd);
         $cliente->setTelefone($cliente_compra->telefone);
         $this->pagseguro->addCliente($cliente);
         // cria o pedido
         $pedidos = new Pedidos();
         $pedidos->clientes_id = TSession::getValue('id');
         //seta o id do cliente
         $pedidos->dataP = date('Y-m-d');
         // seta a data
         $pedidos->status = 1;
         // estatus 1 é de aguardando pagamento
         $pedidos->store();
         // salva o pedido
         if ($produtos) {
             foreach ($produtos as $p) {
                 $this->pagseguro->addItem($p);
                 // add os itens no pagseguro
                 $pedido_produto = new PedidosProdutos();
                 // cria os itens do pedido
                 $pedido_produto->pedidos_id = $pedidos->id;
                 //seta o id do pedido
                 $pedido_produto->produtos_id = $p->getId();
                 // seta o id do item
                 $pedido_produto->qtd = $p->getQtd();
                 // seta a qtd do iten
                 $pedido_produto->store();
                 //salva o item
             }
         }
         $this->pagseguro->addCodVenda($pedidos->id);
         // seta o code do pedido no pagseguro
         $link = new PLink('Finalizar');
         $link->setLink($this->pagseguro->getButton());
         $link->show();
         PCart::clean();
         // limpra o carrinho
         TTransaction::close();
         exit;
     } catch (Exception $e) {
         new TMessage('error', $e->getMessage());
     }
 }
开发者ID:jhonleandres,项目名称:pecommerce,代码行数:56,代码来源:ListarCarrinho.class.php



注:本文中的TSession类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP TSocket类代码示例发布时间:2022-05-23
下一篇:
PHP TRepository类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap