/** * Load an specific program */ public static function loadProgram($param) { $program = $param['input'][0]; if ($program) { TApplication::loadPage($program); } }
/** * Load an specific program */ public function loadProgram($param) { $data = $this->form->getData(); $programs = array_keys($data->input); $program = $programs[0]; TApplication::loadPage($program); }
/** * Constructor Method */ function __construct() { parent::__construct(); parent::set_size_request(840, 640); parent::set_position(GTK::WIN_POS_CENTER); parent::connect_simple('delete-event', array($this, 'onClose')); parent::connect_simple('destroy', array('Gtk', 'main_quit')); parent::set_title(self::APP_TITLE); parent::set_icon(GdkPixbuf::new_from_file('favicon.png')); $gtk = GtkSettings::get_default(); $gtk->set_long_property("gtk-button-images", TRUE, 0); $gtk->set_long_property("gtk-menu-images", TRUE, 0); self::$inst = $this; $ini = parse_ini_file('application.ini'); $lang = $ini['language']; TAdiantiCoreTranslator::setLanguage($lang); TApplicationTranslator::setLanguage($lang); date_default_timezone_set($ini['timezone']); $this->content = new GtkFixed(); $vbox = new GtkVBox(); parent::add($vbox); $vbox->pack_start(GtkImage::new_from_file('app/images/pageheader-gtk.png'), false, false); $MenuBar = TMenuBar::newFromXML('menu.xml'); $vbox->pack_start($MenuBar, false, false); $vbox->pack_start($this->content, true, true); parent::show_all(); }
public function __construct() { parent::__construct(); $this->texto = new TLabel(''); parent::add($this->texto); if (!isset($_REQUEST['method'])) { TApplication::executeMethod("PaginaAjuda", "onHelp"); } }
public static function open($name) { // verifica se existe arquivo de configuração para este banco de dados $filename = TApplication::get_root_dir() . "/model/app.config/{$name}.ini"; if (file_exists($filename)) { // lê o INI e retorna um array $db = parse_ini_file($filename); } else { // se não existir, lança um erro throw new Exception("Arquivo '{$name}' não encontrado"); } // lê as informações contidas no arquivo $user = isset($db['user']) ? $db['user'] : null; $pass = isset($db['pass']) ? $db['pass'] : null; $name = isset($db['name']) ? $db['name'] : null; $host = isset($db['host']) ? $db['host'] : null; $type = isset($db['type']) ? $db['type'] : null; $port = isset($db['port']) ? $db['port'] : null; // descobre qual o tipo (driver) de banco de dados a ser utilizado switch ($type) { case 'mysql': $port = $port ? $port : '3306'; TApplication::addCurrentTime('Pré acesso'); $conn = new PDO("mysql:host={$host};port={$port};dbname={$name}", $user, $pass); TApplication::addCurrentTime('Acesso ao Banco'); break; case 'pgsql': $port = $port ? $port : '5432'; $conn = new PDO("pgsql:dbname={$name}; user={$user}; password={$pass}; host={$host};port={$port}"); break; case 'sqlite': $conn = new PDO("sqlite:{$name}"); break; case 'ibase': $conn = new PDO("firebird:dbname={$name}", $user, $pass); break; case 'oci8': $conn = new PDO("oci:dbname={$name}", $user, $pass); break; case 'mssql': $conn = new PDO("mssql:host={$host},1433;dbname={$name}", $user, $pass); break; default: throw new Exception("Banco de Dados '{$type}' não suportado"); } // define para que o PDO lance exceções na ocorrência de erros $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); // define para que o PDO substitua strings vazias por valores nulos $conn->setAttribute(PDO::ATTR_ORACLE_NULLS, PDO::NULL_EMPTY_STRING); // retorna o objeto instanciado. return $conn; }
public function prepare() { $result = array(); $class_files = glob(TApplication::get_root_dir() . '\\model\\app.control\\*.class.php'); foreach ($class_files as $path) { $classname = substr(basename($path), 0, -10); /** @var SimpleAction $obj */ $obj = new $classname('SKIP'); $result[$classname] = array("attrs" => $obj->get_input_keys(), "connRequired" => $obj->connected != null); // Atributos obrigatórios } return $result; }
/** * 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 static function run() { self::$time_start = microtime(true); $log_msg = ""; // TODO: Substituir por $_POST if (isset($_GET['class'])) { $class_name = $_GET['class']; if (class_exists($class_name)) { try { /** @var SimpleAction $action */ $action = new $class_name(); $result = $action->run(); self::$result = array_merge(self::$result, $result); TTransaction::close(); } catch (PDOException $pdo_e) { // Grava a excessão que ocorreu. $log_msg = $pdo_e->getMessage(); switch ($pdo_e->errorInfo[1]) { case 1062: case 1452: self::$result["error"] = $pdo_e->errorInfo[1]; break; default: self::$result["error"] = 101; } TTransaction::rollback(); } catch (Exception $e) { // Grava a excessão que ocorreu. $log_msg = $e->getMessage(); self::$result["error"] = 1; TTransaction::rollback(); } } else { self::$result["error"] = 2; } if (self::$result["msg"] == null) { self::$result["msg"] = Tools::get_error_msg(self::$result["error"]); } $log_msg = $log_msg ? $log_msg : self::$result["msg"]; if (isset(self::$result["error"]) && self::$result["error"] != 0) { TTransaction::log($log_msg, 'error'); } self::addCurrentTime('Fim de chamada'); self::$result['time'] = self::$times; echo json_encode(self::$result); } }
function class_autoloader($classname) { if (class_exists("TApplication")) { $root = TApplication::get_root_dir(); } else { $root = dirname(__FILE__, 3); } $folders = array('model/app.ado', 'model/app.control'); foreach ($folders as $folder) { $path = "{$root}/{$folder}/{$classname}.class.php"; if (file_exists($path)) { include_once $path; return true; } } return false; }
/** * Class Constructor * @param $label The menu label * @param $action The menu action * @param $image The menu image */ public function __construct($label, $action, $image = NULL) { parent::__construct(utf8_decode($label)); // converts into ISO parent::set_image(null); if (OS == 'WIN') { parent::set_border_width(3); } $this->label = $label; $this->action = $action; $this->image = $image; if (file_exists($image)) { parent::set_image(GtkImage::new_from_file($image)); } $inst = TApplication::getInstance(); if ($inst instanceof TApplication) { parent::connect_simple('activate', array($inst, 'run'), $action); } }
/** * método onLogout * Executado quando o usuário clicar no botão logout */ function onLogout() { TSession::setValue('logged', FALSE); TApplication::gotoPage('LoginForm', ''); }
<?php $basePath = dirname(__FILE__); $frameworkPath = '../prado-3.2.2.r3297/framework/prado.php'; $assetsPath = $basePath . "/assets"; if (!is_writable($assetsPath)) { die("Please make sure that the directory {$assetsPath} is writable by Web server process."); } require_once $frameworkPath; //include_once("analyticstracking.php") ; $application = new TApplication(); $application->run();
/** * método onLogout * Executado quando o usuário clicar no botão logout */ function onLogout() { TSession::setValue('logged', FALSE); TApplication::executeMethod('LoginForm', ''); }
<?php require_once dirname(__FILE__) . '/../../../framework/prado.php'; $app = new TApplication('protected700/application.xml'); $app->run();
/** * Execute the action * @param $action callback to be executed * @ignore-autocomplete on */ public function onExecute($action) { $callb = $action->getAction(); if (is_object($callb[0])) { $object = $callb[0]; call_user_func($callb, $action->getParameters()); //aquip, este IF estava acima do call_user_func if (method_exists($object, 'show')) { if ($object->get_child()) { $object->show(); } } } else { $class = $callb[0]; $method = $callb[1]; TApplication::executeMethod($class, $method, $action->getParameters()); } }
public static function run() { $sessao = new TSessao(true); include 'util/Validacao.php'; $flashes = null; $usuario = $sessao->getVar('usuario'); include 'app.functions/validate.php'; $valida = validate($usuario); //include 'relatorios/teste.php'; if ($valida) { if ($usuario) { $menu = new TMenu($usuario->permissoes, array('gerenciar')); TApplication::setStyle('menu'); TApplication::setStyle('controler_bar'); } if (!$_GET) { if ($usuario == null) { require "app.comuns/app.control/login.php"; TApplication::setStyle('login'); $templatePage = "app.comuns/template/login.phtml"; } else { if ($sessao->getVar('msg1') != null) { if ($sessao->getVar('msg1') == 5) { Flash::addFlash('Você não tem permissão!'); $flashes = Flash::getFlashes(); $sessao->removeVar('msg1'); } } $templatePage = "app.comuns/template/panel.phtml"; } } else { $modulo = isset($_GET['modulo']) ? $_GET['modulo'] : null; $page = isset($_GET['page']) ? $_GET['page'] : null; if (file_exists("modulos/{$modulo}/app.control/{$page}.php")) { require "modulos/{$modulo}/app.control/{$page}.php"; } if (file_exists("modulos/{$modulo}/template/{$page}.phtml")) { $templatePage = "modulos/{$modulo}/template/{$page}.phtml"; } } if (isset($validacao)) { if ($validacao !== true) { $erros = $validacao; } } if (Flash::hasFlashes()) { $flashes = Flash::getFlashes(); } if (!isset($_GET['ajax'])) { TApplication::setStyle('style'); TApplication::setStyle('principal'); TApplication::setStyle('redmond/jquery-ui-1.8.16.custom'); require 'layout/index.phtml'; } } else { header('location: index.php'); } }
/** * method onEdit() * Executed whenever the user clicks at the edit button da datagrid */ function onEdit($param) { TApplication::loadPage('DesignedFormView', 'onEdit', $param); }
/** * Simulates an save button * Show the form content */ public function onUpdate($param) { $data = $this->form->getData("TipoAtividade"); // optional parameter: active record class // pegar os dados da sessao armazenar na variavel $cotacao_items = TSession::getValue('array_items'); // inicia transacao com o banco 'pg_ceres' TTransaction::open('atividade'); // put the data back to the form $this->form->setData($data); $msg = ''; $contAdd = 0; foreach ($cotacao_items as $item) { $itemObj = new StdClass(); $itemObj->id = $item['id']; $itemObj->no = $item['nome']; foreach ($this->form->getFields() as $name => $field) { // pegando valor do combo if ($field instanceof TCombo) { if ($name === 'sistema' . $contAdd) { $itemObj->sistema = $field->getValue(); } if ($name === 'ticket' . $contAdd) { $itemObj->ticket = $field->getValue(); } } } $contAdd++; $cotacao_items_add[] = get_object_vars($itemObj); } try { if ($msg == '') { // percore o objeto e armazena foreach ($cotacao_items_add as $item) { $itemObj = new TipoAtividade($item['id']); $itemObj->nome = $item['nome']; $itemObj->sistema_id = $item['sistema']; $itemObj->ticket_id = $item['ticket']; // armazena o objeto $itemObj->store(); } $msg = 'Registro salvo com sucesso!'; // finaliza a transacao TTransaction::close(); } else { $icone = 'error'; } if ($icone == 'error') { // exibe mensagem de erro new TMessage($icone, "Erro ao Salvar o registro!"); } else { // show the message $param = array(); $param['id'] = filter_input(INPUT_GET, 'id'); //chama o formulario com o grid TApplication::gotoPage('TipoAtividadesVinculos', 'onReloadTwo', $param); // reload new TMessage("info", $msg); } } catch (Exception $e) { // em caso de exce??o // exibe a mensagem gerada pela excecao new TMessage('error', $e->getMessage()); // desfaz todas altera??es no banco de dados TTransaction::rollback(); } }
/** * Logout */ function onLogout() { TSession::freeSession(); TApplication::gotoPage('LoginForm', ''); }
/** * Logout */ public static function onLogout() { SystemAccessLog::registerLogout(); TSession::freeSession(); TApplication::gotoPage('LoginForm', ''); }
$basePath = dirname(__FILE__); //$frameworkPath='../../framework/pradolite.php'; $frameworkPath = '../../framework/prado.php'; $assetsPath = $basePath . "/assets"; $runtimePath = $basePath . "/protected/runtime"; $sqlite_dir = $basePath . "/protected/App_Data/SQLite"; $sqlite_db = $sqlite_dir . '/time-tracker.db'; if (!is_file($frameworkPath)) { die("Unable to find prado framework path {$frameworkPath}."); } if (!is_writable($assetsPath)) { die("Please make sure that the directory {$assetsPath} is writable by Web server process."); } if (!is_writable($runtimePath)) { die("Please make sure that the directory {$runtimePath} is writable by Web server process."); } if (!is_writable($sqlite_dir)) { die("Please make sure that the directory {$sqlite_dir} is writable by Web server process."); } if (!is_writable($sqlite_db)) { die("Please make sure that the sqlite database file {$sqlite_dir} is writable by Web server process."); } require_once $frameworkPath; function h($text) { $app = Prado::getApplication()->getGlobalization(); $charset = $app ? $app->getCharset() : 'UTF-8'; return htmlentities($text, ENT_QUOTES, $charset); } $application = new TApplication(); $application->run('protected', false, TApplication::CONFIG_TYPE_PHP);
/** * Go back to the catalog */ public function onGoToCatalog() { TApplication::loadPage('ProductCatalogView'); }
/** * Logout */ public static function onLogout() { if (TSession::getValue('id_login')) { try { TTransaction::open('atividade'); $registroLogin = new RegistroLogin(TSession::getValue('id_login')); $registroLogin->hora_final = date('H:i:s'); $registroLogin->store(); TTransaction::close(); } catch (Exception $e) { new TMessage('error', $e->getMessage()); } } TSession::freeSession(); TApplication::gotoPage('LoginForm', ''); }
if ($class) { $this->run($class); } } } /** * Pack a class inside the application window * @param $callback */ public function run($callback) { if (TSession::getValue('logged')) { $this->scroll->show_all(); } else { $this->scroll->hide(); } $class = is_array($callback) ? $callback[0] : $callback; if ($class == 'SetupPage') { $this->configureMenu(); } return parent::run($callback); } } $app = new TApplication(); try { Gtk::Main(); } catch (Exception $e) { $app->destroy(); new TExceptionView($e); Gtk::main(); }
<?php /** * var responsável por popular o <SELECT> */ $tipos_usuarios = Usuario::allTipos(); TApplication::setScript('jquery.sf'); if (array_key_exists('save', $_POST)) { $dados = array('nome_usuario' => array('Nome'), 'email_usuario' => array('Email', 'tipo' => 'email'), 'telefone_usuario' => array('Telefone', 'tipo' => 'inteiro'), 'dt_nascimento_usuario' => array('Data Nascimento', 'tipo' => 'data'), 'login_usuario' => array("Login", 'tipo' => 'nome'), 'senha_usuario' => array('Senha'), 'confirma_senha' => array('Repita a Senha', 'tipo' => 'igualdade', 'compara' => 'senha_usuario', 'legenda_2' => 'Senha')); $validacao = ValidaFormulario($dados); if ($validacao === true) { $usuario = new Usuario(); UsuarioMapper::map($usuario, $_POST); if ($_POST['celular_usuario'] == '') { $usuario->setCelularUsuario(null); } UsuarioMapper::insert($usuario); $sessao->addVar('msg', 2); header('location:index.php'); } }
/** * Execute the action * @param $action A TDataGridAction object * @ignore-autocomplete on */ public function onExecute(TDataGridAction $action) { $selection = $this->view->get_selection(); if ($selection) { list($model, $iter) = $selection->get_selected(); if ($iter) { $activeObject = $this->model->get_value($iter, $this->count); $field = $action->getField(); $label = $action->getLabel(); if (is_null($field)) { throw new Exception(TAdiantiCoreTranslator::translate('Field for action ^1 not defined', $label) . '.<br>' . TAdiantiCoreTranslator::translate('Use the ^1 method', 'setField' . '()') . '.'); } $array['key'] = $activeObject->{$field}; $callb = $action->getAction(); if (is_array($callb)) { if (is_object($callb[0])) { $object = $callb[0]; $window_visible = $object->is_visible(); // execute action call_user_func($callb, $array); if (method_exists($object, 'show')) { } // if the window wasn't visible before // the operation, shows it. // Forms: window wasn't visible, then show. // SeekBtns: window was visible, do nothing. // the operation itself closes the window. if (!$window_visible) { if ($object->get_child()) { $object->show(); } } } else { $class = $callb[0]; $method = $callb[1]; TApplication::executeMethod($class, $method, $array); } } else { // execute action call_user_func($callb, $array); } } } }
<?php require_once 'init.php'; // define the Home controller for breadcrumb TXMLBreadCrumb::setHomeController('WelcomeView'); class TApplication extends AdiantiCoreApplication { public static function run($debug = FALSE) { new TSession(); if ($_REQUEST) { parent::run($debug); } } } TApplication::run(TRUE);
/** * Load the previous form */ public function onBackForm() { // Load another page TApplication::loadPage('MultiStepMultiFormView', 'onLoadFromSession'); }
ob_start(); $pagina->show(); $content = ob_get_contents(); ob_end_clean(); } else { $pagina = new erro(); $pagina->codigo = 404; ob_start(); $pagina->show(); $content = ob_get_contents(); ob_end_clean(); } } else { $pagina = new home(); ob_start(); $pagina->show(); $content = ob_get_contents(); ob_end_clean(); } /* * Susbstitui a string #CONTENT# do template para a pagina principal */ $site = str_replace('#CONTENT#', $content, $template); echo $site; } } } TApplication::run(); ?>
die("Please make sure that the directory {$assetsPath} is writable by Web server process."); } if (!is_writable($runtimePath)) { die("Please make sure that the directory {$runtimePath} is writable by Web server process."); } require_once $frameworkPath; if (!file_exists('./protected/runtime/.installed')) { $app_conf = new TApplicationConfiguration(); $app_conf->loadFromFile('./protected/pages/install/application.xml'); $application = new TApplication('protected', true); $application->applyConfiguration($app_conf, true); $application->run(); } else { $session = new THttpSession(); $session->open(); $application = new TApplication('protected', true); $app_conf = new TApplicationConfiguration(); $config_file = './protected/application_p.xml'; if (SAAS) { $username = ""; if (isset($_REQUEST['username'])) { $username = $_REQUEST['username']; } else { if (isset($_REQUEST['ctl0$Main$username'])) { $username = $_REQUEST['ctl0$Main$username']; } } if ($username !== "") { if (($pos = strpos($username, '@')) !== false) { $domain = strstr($username, '@'); $user = substr($username, 0, $pos);