当前位置: 首页>>代码示例>>PHP>>正文


PHP TSession::getValue方法代码示例

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


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

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

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

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

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

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

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

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

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

示例9: checkLogin

 public static function checkLogin()
 {
     if (!TSession::getValue('logado')) {
         new TMessage('error', 'Você não esta logado');
         TCoreApplication::executeMethod('FormLogar');
     }
 }
开发者ID:jhonleandres,项目名称:pecommerce,代码行数:7,代码来源:Usuario.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: 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

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

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

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

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


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