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

PHP TTransaction类代码示例

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

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



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

示例1: __construct

 /**
  * Class constructor
  * Creates the page
  */
 function __construct()
 {
     parent::__construct();
     try {
         TTransaction::open("sample");
         $evento = new Agenda(R);
         $evento->nome = "Curso Adianti framework";
         $evento->lugar = "Progs Scholl alterado";
         $evento->descricao = "Curso basico";
         $evento->data_ev = date("Y-m-d");
         $evento->hora_ev = date("h:m:");
         $evento->store();
         TTransaction::close();
     } catch (Exception $e) {
         echo $e->getMessage();
     }
     TPage::include_css('app/resources/styles.css');
     $this->html = new THtmlRenderer('app/resources/wellcome.html');
     // define replacements for the main section
     $replace = array();
     // replace the main section variables
     $this->html->enableSection('main', $replace);
     // add the template to the page
     parent::add($this->html);
 }
开发者ID:cbsistem,项目名称:Cursos,代码行数:29,代码来源:WellcomeView.class.php


示例2: onView

 /**
  * method onEdit()
  * Executed whenever the user clicks at the edit button da datagrid
  */
 function onView($param)
 {
     try {
         if (isset($param['key'])) {
             // get the parameter $key
             $key = $param['key'];
             // open a transaction with database 'changeman'
             TTransaction::open('changeman');
             // instantiates object Document
             $object = new Document($key);
             $element = new TElement('div');
             $element->add($object->content);
             parent::add($element);
             // close the transaction
             TTransaction::close();
         } else {
             $this->form->clear();
         }
     } 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,代码行数:29,代码来源:ViewDocumentForm.class.php


示例3: onSave

 public function onSave()
 {
     try {
         // open a transaction with database
         TTransaction::open($this->database);
         // get the form data
         $object = $this->form->getData($this->activeRecord);
         // validate data
         $this->form->validate();
         // stores the object
         $object->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', AdiantiCoreTranslator::translate('Record saved'));
         parent::add(new TAlert('info', AdiantiCoreTranslator::translate('Record saved')));
         // reload the listing
         $this->onReload();
         return $object;
     } catch (Exception $e) {
         // get the form data
         $object = $this->form->getData($this->activeRecord);
         // fill the form with the active record data
         $this->form->setData($object);
         // shows the exception error message
         new TMessage('error', $e->getMessage());
         // undo all pending operations
         TTransaction::rollback();
     }
 }
开发者ID:edurbs,项目名称:sobcontrole,代码行数:32,代码来源:TStandardFormListWAM.php


示例4: onSave

 /**
  * Overloaded method onSave()
  * Executed whenever the user clicks at the save button
  */
 public function onSave()
 {
     // first, use the default onSave()
     $object = parent::onSave();
     // if the object has been saved
     if ($object instanceof Product) {
         $source_file = 'tmp/' . $object->photo_path;
         $target_file = 'images/' . $object->photo_path;
         $finfo = new finfo(FILEINFO_MIME_TYPE);
         // if the user uploaded a source file
         if (file_exists($source_file) and $finfo->file($source_file) == 'image/png') {
             // move to the target directory
             rename($source_file, $target_file);
             try {
                 TTransaction::open($this->database);
                 // update the photo_path
                 $object->photo_path = 'images/' . $object->photo_path;
                 $object->store();
                 TTransaction::close();
             } catch (Exception $e) {
                 new TMessage('error', '<b>Error</b> ' . $e->getMessage());
                 TTransaction::rollback();
             }
         }
     }
 }
开发者ID:jfrank1500,项目名称:curso_php,代码行数:30,代码来源:ProductForm.class.php


示例5: getCustomers

 public function getCustomers()
 {
     TTransaction::open('samples');
     $customers = Customer::getObjects();
     var_dump($customers);
     TTransaction::close();
 }
开发者ID:jfrank1500,项目名称:curso_php,代码行数:7,代码来源:CommandLineFacade.class.php


示例6: listar

 public function listar($param)
 {
     try {
         TTransaction::open('sample');
         $criteria = new TCriteria();
         $criteria->add(new TFilter('categoria_id', '=', $param['id']));
         $produtos = Produtos::getObjects($criteria);
         TTransaction::close();
         //cria um array vario
         $replace_detail = array();
         if ($produtos) {
             // iterate products
             foreach ($produtos as $p) {
                 // adicio os itens no array
                 // a função toArray(), transforma o objeto em um array
                 // passando assim para a $variavel
                 $replace_detail[] = $p->toArray();
             }
         }
         // ativa a sessão e substitui as variaveis
         //o parametro true quer dizer que é um loop
         $this->produtos->enableSection('produtos', $replace_detail, TRUE);
     } catch (Exception $e) {
         new Message('error', $e->getMessage());
     }
 }
开发者ID:jhonleandres,项目名称:pecommerce,代码行数:26,代码来源:Home.class.php


示例7: setRowData

 /**
  * Assign values to the database columns
  * @param $column   Name of the database column
  * @param $value    Value for the database column
  */
 public function setRowData($column, $value)
 {
     // get the current connection
     $conn = TTransaction::get();
     // store just scalar values (string, integer, ...)
     if (is_scalar($value)) {
         // if is a string
         if (is_string($value) and !empty($value)) {
             // fill an array indexed by the column names
             $this->columnValues[$column] = $conn->quote($value);
         } else {
             if (is_bool($value)) {
                 // fill an array indexed by the column names
                 $this->columnValues[$column] = $value ? 'TRUE' : 'FALSE';
             } else {
                 if ($value !== '') {
                     // fill an array indexed by the column names
                     $this->columnValues[$column] = $value;
                 } else {
                     // if the value is NULL
                     $this->columnValues[$column] = "NULL";
                 }
             }
         }
     }
 }
开发者ID:jhonleandres,项目名称:pecommerce,代码行数:31,代码来源:TSqlUpdate.class.php


示例8: onLogin

 /**
  * Autenticates the User
  */
 function onLogin()
 {
     try {
         TTransaction::open('permission');
         $data = $this->form->getData('StdClass');
         $this->form->validate();
         $user = SystemUser::autenticate($data->login, $data->password);
         if ($user) {
             $programs = $user->getPrograms();
             $programs['LoginForm'] = TRUE;
             TSession::setValue('logged', TRUE);
             TSession::setValue('login', $data->login);
             TSession::setValue('username', $user->name);
             TSession::setValue('frontpage', '');
             TSession::setValue('programs', $programs);
             $frontpage = $user->frontpage;
             if ($frontpage instanceof SystemProgram and $frontpage->controller) {
                 TApplication::gotoPage($frontpage->controller);
                 // reload
                 TSession::setValue('frontpage', $frontpage->controller);
             } else {
                 TApplication::gotoPage('EmptyPage');
                 // reload
                 TSession::setValue('frontpage', 'EmptyPage');
             }
         }
         TTransaction::close();
     } catch (Exception $e) {
         new TMessage('error', $e->getMessage());
         TSession::setValue('logged', FALSE);
         TTransaction::rollback();
     }
 }
开发者ID:cbsistem,项目名称:templateERP_Bootstrap,代码行数:36,代码来源:LoginForm.class.php


示例9: __construct

 /**
  * Class Constructor
  * @param  $name     widget's name
  * @param  $database database name
  * @param  $model    model class name
  * @param  $key      table field to be used as key in the combo
  * @param  $value    table field to be listed in the combo
  * @param  $ordercolumn column to order the fields (optional)
  * @param  array $filter   TFilter (optional) By Alexandre
  * @param array $expresione TExpression (opcional) by Alexandre
  */
 public function __construct($name, $database, $model, $key, $value, $ordercolumn = NULL, $filter = NULL, $expression = NULL)
 {
     new TSession();
     // executes the parent class constructor
     parent::__construct($name);
     // carrega objetos do banco de dados
     TTransaction::open($database);
     // instancia um repositório de Estado
     $repository = new TRepository($model);
     $criteria = new TCriteria();
     $criteria->setProperty('order', isset($ordercolumn) ? $ordercolumn : $key);
     if ($filter) {
         foreach ($filter as $fil) {
             if ($expression) {
                 foreach ($expression as $ex) {
                     $criteria->add($fil, $ex);
                 }
             } else {
                 $criteria->add($fil);
             }
         }
     }
     // carrega todos objetos
     $collection = $repository->load($criteria);
     // adiciona objetos na combo
     if ($collection) {
         $items = array();
         foreach ($collection as $object) {
             $items[$object->{$key}] = $object->{$value};
         }
         parent::addItems($items);
     }
     TTransaction::close();
 }
开发者ID:jhonleandres,项目名称:pecommerce,代码行数:45,代码来源:TDBFCombo.class.php


示例10: __construct

 public function __construct()
 {
     parent::__construct();
     try {
         TTransaction::open('samples');
         // abre uma transação
         // cria novo objeto
         $giovani = new Customer();
         $giovani->name = 'Giovanni Dall Oglio';
         $giovani->address = 'Rua da Conceicao';
         $giovani->phone = '(51) 8111-2222';
         $giovani->birthdate = '2013-02-15';
         $giovani->status = 'S';
         $giovani->email = '[email protected]';
         $giovani->gender = 'M';
         $giovani->category_id = '1';
         $giovani->city_id = '1';
         $giovani->store();
         // armazena o objeto
         new TMessage('info', 'Objeto armazenado com sucesso');
         TTransaction::close();
         // fecha a transação.
     } catch (Exception $e) {
         new TMessage('error', $e->getMessage());
     }
 }
开发者ID:jfrank1500,项目名称:curso_php,代码行数:26,代码来源:ObjectStore.class.php


示例11: __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


示例12: logar

 public static function logar($email, $senha)
 {
     try {
         TTransaction::open('sample');
         $criteria = new TCriteria();
         $filter = new TFilter('email', '=', $email);
         $filter2 = new TFilter('senha', '=', $senha);
         $criteria->add($filter);
         $criteria->add($filter2);
         $user = Clientes::getObjects($criteria);
         if ($user) {
             TSession::setValue('cliente_logado', true);
             // cria a sessão para mostrar que o usuario esta no sistema
             TSession::setValue('cliente', $user);
             // guarda os dados do cliente
             foreach ($user as $c) {
                 TSession::setValue('id', $c->id);
                 // guarda os dados do cliente
             }
             TCoreApplication::executeMethod('Home');
         } else {
             new TMessage('error', 'Usuario ou Senha invalidos');
         }
         TTransaction::close();
     } catch (Exception $e) {
         echo $e->getMessage();
     }
 }
开发者ID:jhonleandres,项目名称:pecommerce,代码行数:28,代码来源:Clientes.class.php


示例13: __construct

 public function __construct()
 {
     parent::__construct();
     try {
         // connection info
         $db = array();
         $db['host'] = '';
         $db['port'] = '';
         $db['name'] = 'app/database/samples.db';
         $db['user'] = '';
         $db['pass'] = '';
         $db['type'] = 'sqlite';
         TTransaction::open(NULL, $db);
         // open transaction
         $conn = TTransaction::get();
         // get PDO connection
         // make query
         $result = $conn->query('SELECT id, name from customer order by id');
         // iterate results
         foreach ($result as $row) {
             print $row['id'] . '-';
             print $row['name'] . "<br>\n";
         }
         TTransaction::close();
         // close transaction
     } catch (Exception $e) {
         new TMessage('error', $e->getMessage());
     }
 }
开发者ID:jfrank1500,项目名称:curso_php,代码行数:29,代码来源:ManualConnection.class.php


示例14: 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


示例15: onLogin

 /**
  * Validate the login
  */
 function onLogin()
 {
     try {
         TTransaction::open('changeman');
         $data = $this->form->getData('StdClass');
         // validate form data
         $this->form->validate();
         $auth = Member::authenticate($data->user, md5($data->password));
         if ($auth) {
             TSession::setValue('logged', TRUE);
             TSession::setValue('login', $data->user);
             TSession::setValue('language', $data->language);
             // reload page
             TApplication::gotoPage('NewIssueForm', 'nonono');
         }
         TTransaction::close();
         // finaliza a transação
     } catch (Exception $e) {
         TSession::setValue('logged', FALSE);
         // exibe a mensagem gerada pela exceção
         new TMessage('error', '<b>Erro</b> ' . $e->getMessage());
         // desfaz todas alterações no banco de dados
         TTransaction::rollback();
     }
 }
开发者ID:jfrank1500,项目名称:curso_php,代码行数:28,代码来源:LoginForm.class.php


示例16: getSocial

 public function getSocial()
 {
     //RECUPERA CONEXAO BANCO DE DADOS
     TTransaction::open('my_bd_site');
     //TABELA exposition_gallery
     $criteria = new TCriteria();
     $criteria->setProperty('order', 'nome ASC');
     // instancia a instrução de SELECT
     $sql = new TSqlSelect();
     $sql->addColumn('*');
     $sql->setEntity('social');
     //  atribui o critério passado como parâmetro
     $sql->setCriteria($criteria);
     // obtém transação ativa
     if ($conn = TTransaction::get()) {
         // registra mensagem de log
         TTransaction::log($sql->getInstruction());
         // executa a consulta no banco de dados
         $result = $conn->Query($sql->getInstruction());
         $this->results = array();
         if ($result) {
             // percorre os resultados da consulta, retornando um objeto
             while ($row = $result->fetchObject()) {
                 // armazena no array $this->results;
                 $this->results[] = $row;
             }
         }
     }
     TTransaction::close();
     return $this->results;
 }
开发者ID:rodu-pereira,项目名称:RogerioPereira,代码行数:31,代码来源:controladorSocial.class.php


示例17: treat_success

 /** @param PDOStatement $query_result */
 private function treat_success($query_result)
 {
     if ($query_result->rowCount() > 0) {
         (new Insert_user_dummy(array('id_user' => $this->connected, 'id_dummy' => TTransaction::get_last_inserted_id())))->run();
     } else {
         TTransaction::rollback();
     }
 }
开发者ID:thalelinh,项目名称:MoneyManager,代码行数:9,代码来源:Insert_dummy.class.php


示例18: treat_success

 /** @param PDOStatement $query_result */
 private function treat_success($query_result)
 {
     if ($query_result->rowCount() > 0) {
         (new Delete_invitation(array('id' => parent::get_input('id_invitation'))))->run();
     } else {
         TTransaction::rollback();
     }
 }
开发者ID:thalelinh,项目名称:MoneyManager,代码行数:9,代码来源:Insert_user_user.class.php


示例19: getConfiguracoes

 /**
  * Método getConfiguracoes
  * Retorna as configura?es do banco de dados
  * 
  * @access public
  * @return tbConfiguracoes   Configura?es do site
  */
 public function getConfiguracoes()
 {
     $this->configuracao = NULL;
     //RECUPERA CONEXAO BANCO DE DADOS
     TTransaction::open('my_bd_site');
     $this->configuracao = (new tbConfiguracoes())->load(1);
     return $this->configuracao;
 }
开发者ID:GroupSofter,项目名称:LiderSeg,代码行数:15,代码来源:controladorConfiguracoes.php


示例20: __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



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP TVBox类代码示例发布时间:2022-05-23
下一篇:
PHP TTi18n类代码示例发布时间: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