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(); } }
/** * 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(); }
/** * 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); }
/** * 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(); } }
public function onDelete($param) { $key = $param['key']; $objects = TSession::getValue('session_contacts'); unset($objects[$key]); TSession::setValue('session_contacts', $objects); $this->onReload(); }
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'))); }
/** * 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); }
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()); }
/** * 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()); } }
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'); } }
/** * 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); }
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(); } }
/** * método onLogout * Executado quando o usuário clicar no botão logout */ function onLogout() { TSession::setValue('logged', FALSE); TApplication::executeMethod('LoginForm', ''); }
/** * 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(); }
/** * método onLogout * Executado quando o usuário clicar no botão logout */ function onLogout() { TSession::setValue('logged', FALSE); TApplication::gotoPage('LoginForm', ''); }
public function onClean() { // clear session filters TSession::setValue('RequisitoDesenvolvimentoList_filter_id', NULL); TSession::setValue('RequisitoDesenvolvimentoList_filter_titulo', NULL); TSession::setValue('RequisitoDesenvolvimentoList_filter_data_cadastro', NULL); $this->form->clear(); $this->onReload(); }
/** * 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(); TSession::setValue('Release_filter', NULL); TSession::setValue('Release_name', ''); // check if the user has filled the form if (isset($data->name)) { // creates a filter using what the user has typed $filter = new TFilter('name', 'like', "%{$data->name}%"); // stores the filter in the session TSession::setValue('Release_filter', $filter); TSession::setValue('Release_name', $data->name); // fill the form with data again $this->form->setData($data); } $param = array(); $param['offset'] = 0; $param['first_page'] = 1; $this->onReload($param); }
/** * Set the MASTER key */ public function onSetProject($param) { $id = $param['key']; // get some project info TTransaction::open('samples'); $project = new Project($id); TSession::setValue('project_id', $project->id); TSession::setValue('project_name', $project->name); $this->project->setValue($project->name); TTransaction::close(); $this->onReload(); }
function onSearch() { $data = $this->form->getData(); TSession::setValue('Plantavalores_id_filter', NULL); TSession::setValue('Plantavalores_id', ''); if ($data->plantavalores_id) { $filter = new TFilter('plantavalores_id', 'like', "%{$data->plantavalores_id}%"); TSession::setValue('Plantavalores_id_filter', $filter); TSession::setValue('Plantavalores_id', $data->plantavalores_id); } $this->form->setData($data); $param = array(); $param['offset'] = 0; $param['first_page'] = 1; $this->onReload($param); }
/** * method Delete() * Delete a record */ function Delete($param) { try { // get the parameter $key $key = $param['key']; $persisted_objects = TSession::getValue('checkin_objects'); unset($persisted_objects[$key]); TSession::setValue('checkin_objects', $persisted_objects); // reload the listing $this->onReload(); // shows the success message new TMessage('info', TAdiantiCoreTranslator::translate('Record deleted')); } catch (Exception $e) { // shows the exception error message new TMessage('error', '<b>Error</b> ' . $e->getMessage()); // undo all pending operations } }
/** * 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(); TSession::setValue('s_id_filter', NULL); TSession::setValue('s_dni_filter', NULL); TSession::setValue('s_name_filter', NULL); TSession::setValue('s_address_filter', NULL); TSession::setValue('s_email_filter', NULL); TSession::setValue('s_phone_filter', NULL); TSession::setValue('s_id', ''); TSession::setValue('s_dni', ''); TSession::setValue('s_name', ''); TSession::setValue('s_address', ''); TSession::setValue('s_email', ''); TSession::setValue('s_phone', ''); // check if the user has filled the form if ($data->id) { // creates a filter using what the user has typed $filter = new TFilter('id', '=', "{$data->id}"); // stores the filter in the session TSession::setValue('s_id_filter', $filter); TSession::setValue('s_id', $data->id); } if ($data->dni) { // creates a filter using what the user has typed $filter = new TFilter('dni', '=', "{$data->dni}"); // stores the filter in the session TSession::setValue('s_dni_filter', $filter); TSession::setValue('s_dni', $data->dni); } if ($data->name) { // creates a filter using what the user has typed $filter = new TFilter('name', 'like', "%{$data->name}%"); TSession::setValue('s_name_filter', $filter); TSession::setValue('s_name', $data->name); } if ($data->address) { // creates a filter using what the user has typed $filter = new TFilter('address', 'like', "%{$data->address}%"); TSession::setValue('s_address_filter', $filter); TSession::setValue('s_address', $data->address); } if ($data->email) { // creates a filter using what the user has typed $filter = new TFilter('email', 'like', "%{$data->email}%"); TSession::setValue('s_email_filter', $filter); TSession::setValue('s_email', $data->email); } // fill the form with data again $this->form->setData($data); $param = array(); $param['offset'] = 0; $param['first_page'] = 1; $this->onReload($param); }
/** * 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->name) and $data->name) { // creates a filter using what the user has typed $filter = new TFilter('name', 'like', "{$data->name}%"); // stores the filter in the session TSession::setValue('customer_filter1', $filter); TSession::setValue('customer_name', $data->name); } else { TSession::setValue('customer_filter1', NULL); TSession::setValue('customer_name', ''); } // check if the user has filled the form if ($data->city_name) { // creates a filter using what the user has typed $filter = new TFilter('(SELECT name from city WHERE id=customer.city_id)', 'like', "{$data->city_name}%"); // stores the filter in the session TSession::setValue('customer_filter2', $filter); TSession::setValue('customer_city_name', $data->city_name); } else { TSession::setValue('customer_filter2', NULL); TSession::setValue('customer_city_name', ''); } // fill the form with data again $this->form->setData($data); $param = array(); $param['offset'] = 0; $param['first_page'] = 1; $this->onReload($param); }
<?php include 'app.widgets/TSession.class.php'; new TSession(); if (!TSession::getValue('counted')) { echo 'registrando visita'; TSession::setValue('counted', true); } else { echo 'visita j� registrada'; } ?>
function onSearch() { $data = $this->form->getData(); TSession::setValue('contribuinte_id_filter', NULL); TSession::setValue('contribuinte_id', ''); TSession::setValue('contribuinte_nome_filter', NULL); TSession::setValue('contribuinte_nome', ''); if ($data->contribuinte_id) { $filter = new TFilter('contribuinte_id', 'like', "%{$data->contribuinte_id}%"); TSession::setValue('contribuinte_id_filter', $filter); TSession::setValue('contribuinte_id', $data->contribuinte_id); } if ($data->contribuinte_nome) { $filter = new TFilter('contribuinte_nome', 'like', "%{$data->contribuinte_nome}%"); TSession::setValue('contribuinte_nome_filter', $filter); TSession::setValue('contribuinte_nome', $data->contribuinte_nome); } $this->form->setData($data); $param = array(); $param['offset'] = 0; $param['first_page'] = 1; $this->onReload($param); }
/** * Register a filter in the session */ function onSearch() { // get the form data $data = $this->form->getData(); // check if the user has filled the fields if (isset($data->name)) { // cria um filtro pelo conteúdo digitado $filter = new TFilter(TSession::getValue('filtro'), 'like', "%{$data->name}%"); // armazena o filtro na seção TSession::setValue('filter', $filter); TSession::setValue('name', $data->name); // put the data back to the form $this->form->setData($data); } // redefine the parameters for reload method $param = array(); $param['offset'] = 0; $param['first_page'] = 1; $this->onReload($param); }
/** * Limpa o form e a sessão */ public function onEdit($param) { TSession::setValue('person_dados', array()); $this->form->clear(); $this->onReload($param); }
/** * 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(); TSession::setValue('Issue_filter', NULL); TSession::setValue('Issue_id_status', ''); TSession::setValue('Issue_id_project', ''); TSession::setValue('Issue_id_priority', ''); TSession::setValue('Issue_id_category', ''); TSession::setValue('Issue_title', ''); $filters = array(); // check if the user has filled the form if ($data->id_status) { // creates a filter using what the user has typed $filters[] = new TFilter('id_status', '=', "{$data->id_status}"); // stores the filter in the session TSession::setValue('Issue_id_status', $data->id_status); } if ($data->id_project) { // creates a filter using what the user has typed $filters[] = new TFilter('id_project', '=', "{$data->id_project}"); // stores the filter in the session TSession::setValue('Issue_id_project', $data->id_project); } if ($data->id_priority) { // creates a filter using what the user has typed $filters[] = new TFilter('id_priority', '=', "{$data->id_priority}"); // stores the filter in the session TSession::setValue('Issue_id_priority', $data->id_priority); } if ($data->id_category) { // creates a filter using what the user has typed $filters[] = new TFilter('id_category', '=', "{$data->id_category}"); // stores the filter in the session TSession::setValue('Issue_id_category', $data->id_category); } if ($data->title) { // creates a filter using what the user has typed $filters[] = new TFilter('title', 'like', "%{$data->title}%"); // stores the filter in the session TSession::setValue('Issue_title', $data->title); } if (count($filters) > 0) { TSession::setValue('Issue_filter', $filters); } // fill the form with data again $this->form->setData($data); $param = array(); $param['offset'] = 0; $param['first_page'] = 1; $this->onReload($param); }
/** * 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(); $filters = array(); TSession::setValue('Book_title', ''); TSession::setValue('Book_author_id', ''); TSession::setValue('Book_author_name', ''); TSession::setValue('Book_collection_id', ''); TSession::setValue('Book_classification_id', ''); TSession::setValue('Book_filters', array()); // check if the user has filled the form if ($data->title) { // creates a filter using what the user has typed $filter = new TFilter('title', 'like', "%{$data->title}%"); // stores the filter in the session TSession::setValue('Book_title', $data->title); $filters[] = $filter; } if ($data->author_id) { // creates a filter using what the user has typed $filter = new TFilter('author_id', '=', "{$data->author_id}"); // stores the filter in the session TSession::setValue('Book_author_id', $data->author_id); TSession::setValue('Book_author_name', $data->author_name); $filters[] = $filter; } if ($data->collection_id) { // creates a filter using what the user has typed $filter = new TFilter('collection_id', '=', "{$data->collection_id}"); // stores the filter in the session TSession::setValue('Book_collection_id', $data->collection_id); $filters[] = $filter; } if ($data->classification_id) { // creates a filter using what the user has typed $filter = new TFilter('classification_id', '=', "{$data->classification_id}"); // stores the filter in the session TSession::setValue('Book_classification_id', $data->classification_id); $filters[] = $filter; } if ($filters) { TSession::setValue('Book_filters', $filters); } // fill the form with data again $this->form->setData($data); $param = array(); $param['offset'] = 0; $param['first_page'] = 1; $this->onReload($param); }
/** * Register a filter in the session */ function onSearch() { // get the form data $data = $this->form->getData(); // armazena o filtro na seção TSession::setValue('test_item_filter', NULL); TSession::setValue('test_item_barcode', ''); // check if the user has filled the fields if (isset($data->barcode) and $data->barcode) { // cria um filtro pelo conteúdo digitado $filter = new TFilter('barcode', '=', "{$data->barcode}"); // armazena o filtro na seção TSession::setValue('test_item_filter', $filter); TSession::setValue('test_item_barcode', $data->barcode); // put the data back to the form $this->form->setData($data); } // redefine the parameters for reload method $param = array(); $param['offset'] = 0; $param['first_page'] = 1; $this->onReload($param); }
/** * 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(); //TSession::setValue('Frequencia_servidor_id_filter', NULL); //TSession::setValue('Frequnecia_Servidor_id', ''); TSession::setValue('Frequencia_servidor_nome_filter', NULL); TSession::setValue('Frequencia_servidor_nome', ''); TSession::setValue('Frequencia_diames_filter', NULL); TSession::setValue('Frequencia_diames', ''); // check if the user has filled the form if ($data->servidor_nome) { // creates a filter using what the user has typed $filter_servidor_nome = new TFilter('servidor_nome', 'like', "%{$data->servidor_nome}%"); // stores the filter in the session TSession::setValue('Frequencia_servidor_nome_filter', $filter_servidor_nome); TSession::setValue('Frequencia_servidor_nome', $data->servidor_nome); } if ($data->diames) { // creates a filter using what the user has typed $filter_diames = new TFilter('diames', 'like', "%{$data->diames}%"); // stores the filter in the session TSession::setValue('Frequencia_diames_filter', $filter_diames); TSession::setValue('Frequencia_diames', $data->diames); } // fill the form with data again $this->form->setData($data); $param = array(); $param['offset'] = 0; $param['first_page'] = 1; $this->onReload($param); }