本文整理汇总了PHP中TSession::setValue方法的典型用法代码示例。如果您正苦于以下问题:PHP TSession::setValue方法的具体用法?PHP TSession::setValue怎么用?PHP TSession::setValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TSession
的用法示例。
在下文中一共展示了TSession::setValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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();
}
}
示例2: onDelete
/**
* Delete an item from cart items
*/
public function onDelete($param)
{
$cart_items = TSession::getValue('cart_items');
unset($cart_items[$param['key']]);
TSession::setValue('cart_items', $cart_items);
$this->onReload();
}
示例3: __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);
}
示例4: 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();
}
}
示例5: onDelete
public function onDelete($param)
{
$key = $param['key'];
$objects = TSession::getValue('session_contacts');
unset($objects[$key]);
TSession::setValue('session_contacts', $objects);
$this->onReload();
}
示例6: onSave
public function onSave($param)
{
$data = $this->form->getData();
// put the data back to the form
$this->form->setData($data);
$objects = TSession::getValue('session_contacts');
$objects[$data->code] = $data;
TSession::setValue('session_contacts', $objects);
// show the message
new TMessage('info', 'Record added', new TAction(array('DatagridWindowForm', 'onReload')));
}
示例7: onBuyClick
/**
* Executed when the user clicks at click to buy button
*/
public function onBuyClick($param)
{
$cart_items = TSession::getValue('cart_items');
if (isset($cart_items[$param['product_id']])) {
$cart_items[$param['product_id']]++;
} else {
$cart_items[$param['product_id']] = 1;
}
TSession::setValue('cart_items', $cart_items);
$this->enableManagement();
$posAction = new TAction(array('CartManagementView', 'onReload'));
new TMessage('info', 'You have chosen the product: ' . $param['product_id'], $posAction);
}
示例8: __construct
public function __construct()
{
require_once 'lib/Simple_html_dom.php';
require_once 'lib/Simple_html_dom_node.php';
new TSession();
TSession::setValue('id', session_id());
$cookie = TSession::getValue('id');
// $this->cookieFile = 'app/output/'.$cookie;
$this->cookieFile = $cookie;
if (!file_exists($this->cookieFile)) {
$file = fopen($this->cookieFile, 'w');
fclose($file);
}
$this->token = self::getCaptchaToken();
$this->imgCaptcha = $this->getCaptcha($this->getTokenIdCaptcha());
}
示例9: onNextForm
/**
* onNextForm
*/
public function onNextForm()
{
try {
$this->form->validate();
$data = $this->form->getData();
if ($data->password !== $data->confirm) {
throw new Exception('Passwords do not match');
}
// store data in the session
TSession::setValue('form_step1_data', $data);
// Load another page
TApplication::loadPage('MultiStepMultiForm2View', 'onLoadFromForm1', (array) $data);
} catch (Exception $e) {
new TMessage('error', $e->getMessage());
}
}
示例10: logar
public function logar($param)
{
$login = Usuario::logar($param['login'], $param['senha']);
if ($login) {
foreach ($login as $l) {
TSession::setValue('user', $l);
// guardamos o objeto usuario
TSession::setValue('user_login', true);
// valor true para logado
TSession::setValue('permissao', $l->permissao);
// guardo somentea permissão
}
AdiantiCoreApplication::gotoPage('ClienteList');
} else {
new TMessage('info', print_r($param), null, 'Erro ao logar');
}
}
示例11: onSearch
/**
* method onSearch()
* Register the filter in the session when the user performs a search
*/
function onSearch()
{
// get the search form data
$data = $this->form->getData();
// check if the user has filled the form
if (isset($data->{$this->filterField})) {
// creates a filter using what the user has typed
$filter = new TFilter($this->filterField, 'like', "%{$data->{$this->filterField}}%");
// stores the filter in the session
TSession::setValue($this->activeRecord . '_filter', $filter);
TSession::setValue($this->activeRecord . '_' . $this->filterField, $data->{$this->filterField});
// fill the form with data again
$this->form->setData($data);
}
$param = array();
$param['offset'] = 0;
$param['first_page'] = 1;
$this->onReload($param);
}
示例12: logar
public static function logar($user, $senha)
{
try {
TTransaction::open('sample');
$criteria = new TCriteria();
$filter = new TFilter('login', '=', $user);
$filter2 = new TFilter('senha', '=', $senha);
$criteria->add($filter);
$criteria->add($filter2);
$user = Usuario::getObjects($criteria);
if ($user) {
TSession::setValue('logado', true);
// cria a sessão para mostrar que o usuario esta no sistema
TCoreApplication::executeMethod('CategoriaList');
} else {
new TMessage('error', 'Usuario ou Senha invalidos');
}
TTransaction::close();
} catch (Exception $e) {
echo $e->getMessage();
}
}
示例13: onLogout
/**
* método onLogout
* Executado quando o usuário clicar no botão logout
*/
function onLogout()
{
TSession::setValue('logged', FALSE);
TApplication::executeMethod('LoginForm', '');
}
示例14: onSetup
/**
* define the standars seek parameters
*/
public function onSetup($param = NULL)
{
// store the parameters in the section
TSession::setValue('tstandardseek_filter', NULL);
TSession::setValue('tstandardseek_display_value', NULL);
TSession::setValue('standard_seek_receive_key', $param['receive_key']);
TSession::setValue('standard_seek_receive_field', $param['receive_field']);
TSession::setValue('standard_seek_display_field', $param['display_field']);
TSession::setValue('standard_seek_model', $param['model']);
TSession::setValue('standard_seek_database', $param['database']);
TSession::setValue('standard_seek_parent', $param['parent']);
$this->onReload();
}
示例15: onLogout
/**
* método onLogout
* Executado quando o usuário clicar no botão logout
*/
function onLogout()
{
TSession::setValue('logged', FALSE);
TApplication::gotoPage('LoginForm', '');
}