/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate() { $model = new Produto(); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['Produto']) && isset($_POST['ProdutoControle'])) { $model->attributes = $_POST['Produto']; if ($model->save()) { // Adicionando categorias if (isset($_POST['CategoriaProduto'])) { $categorias = explode(",", $_POST['CategoriaProduto']); foreach ($categorias as $key => $categoria_id) { $CategoriaProduto = new CategoriaProduto(); $CategoriaProduto->attributes = array('categoria_id' => $categoria_id, 'produto_id' => $model->id); $CategoriaProduto->save(); } } /////// Adicionando quantidade // Salvando o Controle $Controle = new Controle(); $Controle->attributes = array("funcionario_nif" => $_POST['Controle']['funcionario_nif']); $Controle->save(); // Adicionando o Produto Controle $ProdutoControle = new ProdutoControle(); $ProdutoControle->attributes = array("produto_id" => $model->id, "controle_id" => $Controle->id, "quantidade" => $_POST['ProdutoControle']['quantidade']); $ProdutoControle->save(); Yii::app()->user->setFlash('success', "Produto cadastrado com sucesso! :) "); $model->attributes = array(); } } $this->render('create', array('model' => $model)); }
public function ExeStatus($TubeId, $TubeStatus) { $this->Tube = (int) $TubeId; $this->Data['youtube_status'] = (string) $TubeStatus; $Read = new Controle('app_youtube'); $this->Data['youtube_id'] = $this->Tube; $Read->update($this->Data, "youtube_id"); }
public function ExeStatus($PostId, $PostStatus) { $this->Post = (int) $PostId; $this->Data['post_status'] = (string) $PostStatus; $Read = new Controle('ws_posts'); $this->Data['post_id'] = $this->Post; $Read->update($this->Data, "post_id"); }
public function ExeStatus($PostId, $PostStatus) { $this->Data = null; $this->Perfil = (int) $PostId; $this->Data['perfil_status'] = (string) $PostStatus; $this->Data['perfil_id'] = $this->Perfil; $Read = new Controle('ws_perfil'); $Read->update($this->Data, "perfil_id"); }
function __construct() { parent::__construct(); //Verifica se o usuario já está logado if (!$_SESSION['usuario']) { header("Location: ?c=login"); } }
<?php require_once '../../_app/Config.inc.php'; $estado = filter_input(INPUT_POST, 'estado', FILTER_VALIDATE_INT); $readCityes = new Controle('app_cidades'); $readCityes->Query("estado_id = :uf", "uf={$estado}"); sleep(1); echo "<option value=\"\" disabled selected> Selecione a cidade </option>"; foreach ($readCityes->getResult() as $cidades) { extract((array) $cidades); echo "<option value=\"{$cidade_id}\" "; /* if($cidade_id == $_SESSION['city']): echo ' selected="seleted" '; endif; */ echo "> {$cidade_nome} </option>"; }
WSErro("O status do perfil foi atualizado para <b>inativo</b>. Perfil agora é um rascunho!", WS_ACCEPT); break; case 'delete': $perfilUpdate->ExeDelete($perfilAction); WSErro('O perfil ' . $perfilUpdate->getError()[0], $perfilUpdate->getError()[1]); break; default: WSErro("Ação não foi identificada pelo sistema, favor utilize os botões", WS_ERROR); break; } } $posti = 0; $getPage = filter_input(INPUT_GET, 'page', FILTER_VALIDATE_INT); $Pager = new Pager("painel.php?exe=perfil/index&page="); $Pager->ExePager($getPage, 6); $Read = new Controle(); $Read->FullRead("SELECT * FROM ws_perfil ORDER by perfil_status ASC, perfil_date DESC LIMIT :limit OFFSET :offset", "limit={$Pager->getLimit()}&offset={$Pager->getOffset()}", true); if (!$Read->getResult()) { $Pager->ReturnPage(); WSErro("Desculpa, ainda não temos perfis cadastrados", WS_INFOR); } else { foreach ($Read->getResult() as $post) { $posti++; extract((array) $post); $status = !$perfil_status ? 'style="background: #fffed8"' : ''; ?> <article<?php if ($posti % 2 == 0) { echo ' class="right" '; } ?>
<?php session_start(); header('Content-Type: text/html; charset=utf-8'); // ini_set('display_errors', 1); // error_reporting( E_ALL ); define('DS', DIRECTORY_SEPARATOR); define('ROOT', dirname(__FILE__)); include ROOT . DS . 'config/Config.php'; include ROOT . DS . 'src/Controle.php'; include ROOT . DS . 'src/Cliente.php'; $ctrl = new Controle(new Config()); $cliente = new Cliente(new Config()); $page = $ctrl->getPage(); $page = !empty($_SESSION['orgao']) ? 'unidade.php' : $page; $cli = !empty($_SESSION['orgao']) ? $_SESSION['orgao']['ID'] : null; $clientes = $cliente->read(); if (!empty($_SESSION['orgao']) and $cli != null) { $cliente->createSession($clientes, $cli); // var_dump($_SESSION['orgao']); } $optionClientes = $cliente->lis($clientes, $cli); // var_dump($optionClientes); if (isset($_SESSION['orgao'])) { include ROOT . DS . 'src/ListaServidores.php'; $lista = new ListaServidores(new Config()); include ROOT . DS . 'app/unidade.php'; } include ROOT . DS . 'topPage.php'; include ROOT . DS . 'view' . DS . 'navPage.php'; include ROOT . DS . 'view' . DS . $page;
WSErro("O status do membro foi atualizado para <b>inativo</b>. Membro agora é um rascunho!", WS_ACCEPT); break; case 'delete': $postUpdate->ExeDelete($postAction); WSErro('O membro ' . $postUpdate->getError()[0], $postUpdate->getError()[1]); break; default: WSErro("Ação não foi identificada pelo sistema, favor utilize os botões", WS_ERROR); break; } } $posti = 0; $getPage = filter_input(INPUT_GET, 'page', FILTER_VALIDATE_INT); $Pager = new Pager("painel.php?exe=membros/index&page="); $Pager->ExePager($getPage, 5); $Read = new Controle(); $Read->FullRead("SELECT * FROM ws_posts WHERE post_type = 'membros' ORDER by post_status ASC, post_date DESC LIMIT :limit OFFSET :offset", "limit={$Pager->getLimit()}&offset={$Pager->getOffset()}", true); if (!$Read->getResult()) { $Pager->ReturnPage(); WSErro("Desculpa, ainda não temos membros cadastrados", WS_INFOR); } else { foreach ($Read->getResult() as $post) { $posti++; extract((array) $post); $status = !$post_status ? 'style="background: #fffed8"' : ''; ?> <article<?php if ($posti % 2 == 0) { echo ' class="right" '; } ?>
</div> </li> <?php } ?> </ul> <div class="clear"></div> </section> <?php } ?> </div> <!--RELACIONADOS--> <?php $readMode = new Controle(); $readMode->setTable("ws_posts"); $readMode->Query("post_status = 1 AND post_id != :post_id AND #post_category# ORDER BY rand() LIMIT 2", "post_id={$post_id}&post_category={$post_category}"); if ($readMode->getResult()) { $View = new View(); $tpl_m = $View->Load('article_m'); ?> <footer> <nav> <h3>Veja também:</h3> <?php foreach ($readMode->getResult() as $more) { $more->datetime = date('Y-m-d', strtotime($more->post_date)); $more->pubdate = date('d/m/Y H:i', strtotime($more->post_date)); $more->post_content = Check::Words($more->post_content, 20); $View->Show((array) $more, $tpl_m);
} ?> </select> </label> <label class="label_small"> <span class="field">Cidade:</span> <select class="j_loadcity" name="empresa_cidade"> <?php if (!isset($data['empresa_cidade'])) { ?> <option value="" selected disabled> Selecione antes um estado </option> <?php } else { $City = new Controle('app_cidades'); $City->Query("estado_id = :uf ORDER BY cidade_nome ASC", "uf={$data['empresa_uf']}"); if ($City->getRowCount()) { foreach ($City->getResult() as $cidade) { extract((array) $cidade); echo "<option value=\"{$cidade_id}\" "; if (isset($data['empresa_cidade']) && $data['empresa_cidade'] == $cidade_id) { echo "selected"; } echo "> {$cidade_nome} </option>"; } } } ?> </select> </label>
<?php $Read = new Controle('ws_perfil_has_ws_acesso'); switch ($method) { case "GET": //retorna todos os itens if ($id) { $sql = "SELECT * FROM ws_perfil_has_ws_acesso pa " . "JOIN ws_perfil p ON(p.perfil_id = pa.perfil_id) " . "JOIN ws_acesso a ON(a.acesso_id = pa.acesso_id) " . "WHERE pa.perfil_id = :perfil_id"; $Read->FullRead($sql, "perfil_id={$id}", true); Check::JsonReturn($Read->getResult(), 'Perfil sem acessos cadastrados', 204); } else { $Read->findAll(); Check::JsonReturn($Read->getResult(), 'Nenhum perfil cadastrado!', 204); } break; case "POST": if ($request->id) { $message = ['message' => 'Salvo com sucesso!', 'status' => 200]; //deleta todos os dados deste pefil $Read->delete("perfil_id={$request->id}"); foreach ($request->list as $value) { $Read->insert("perfil_id={$request->id}&acesso_id={$value->acesso_id}"); } echo json_encode($message); } break; case "DELETE": //deleta arquivo break; default: break;
<?php if (!strpos($file['name'], '.csv')) { Error(501); } else { $Upload = new Upload(); $Upload->File($file); $filename = DOCUMENT_ROOT . NAME . "/uploads/" . $Upload->getResult(); if (file_exists($filename)) { $FileRead = fopen($filename, "r"); $Read = new Controle('sft_particular'); $Read->truncate(); $Erros = []; while (!feof($FileRead)) { $file = fgets($FileRead); $Linha = !empty($file) ? explode(";", utf8_encode($file)) : null; if (is_array($Linha) && count($Linha) == 12) { $Erro = null; $Objeto = array(); $Objeto['part_os'] = $Linha[0]; $Objeto['part_date'] = Check::Data($Linha[1]); $Objeto['part_nm_paciente'] = $Linha[4]; $Objeto['part_vl_liquido'] = Check::toFloat($Linha[9]); $Objeto['part_vl_pago'] = Check::toFloat($Linha[10]); $Objeto['part_vl_debito'] = Check::toFloat($Linha[11]); $Linha[2] = $Linha[2] == '0' ? "418 - Sistema" : $Linha[2]; $findUser = explode(" - ", $Linha[2])[1]; $atendente = FindUser($findUser); $findCode = explode('-', $Linha[0])[0]; $unidade = FindCod($findCode); if (!$atendente) {
WSErro("O status do video foi atualizado para <b>inativo</b>. Video agora é um rascunho!", WS_ACCEPT); break; case 'delete': $tubeUpdate->ExeDelete($tubeAction); WSErro($tubeUpdate->getError()[0], $tubeUpdate->getError()[1]); break; default: WSErro("Ação não foi identificada pelo sistema, favor utilize os botões", WS_ERROR); break; } } $posti = 0; $getPage = filter_input(INPUT_GET, 'page', FILTER_VALIDATE_INT); $Pager = new Pager("painel.php?exe=youtube/index&page="); $Pager->ExePager($getPage, 6); $Read = new Controle(); $Read->FullRead("SELECT * FROM app_youtube ORDER by youtube_status ASC, youtube_date DESC LIMIT :limit OFFSET :offset", "limit={$Pager->getLimit()}&offset={$Pager->getOffset()}", true); if ($Read->getResult()) { foreach ($Read->getResult() as $post) { $posti++; extract((array) $post); $status = !$youtube_status ? 'style="background: #fffed8"' : ''; ?> <article<?php if ($posti % 2 == 0) { echo ' class="right" '; } ?> <?php echo $status; ?>
/** * <b>Ativa/Inativa Empresa:</b> Informe o ID da empresa e o status e um status sendo 1 para ativo e 0 para * rascunho. Esse méto ativa e inativa as empresas! * @param INT $PostId = Id do post * @param STRING $PostStatus = 1 para ativo, 0 para inativo */ public function ExeStatus($EmpresaId, $EmpresaStatus) { $this->Empresa = (int) $EmpresaId; $this->Data['empresa_status'] = (string) $EmpresaStatus; $this->Data['empresa_id'] = $this->Empresa; $Update = new Controle('app_empresas'); $Update->update($this->Data, "empresa_id"); }
private function getRow() { $Read = new Controle($this->Tabela); if (!empty($this->Places)) { $Read->Query($this->Termos, $this->Places, $this->BindParam); } else { $Read->findAll(); } return $Read->getRowCount(); }
/** * Carregar o conteúdo * * Carregar o conteúdo a ser exibido de acordo com a rota identificada através da URL */ private function carregarConteudo() { $obj_r = new Roteamento($this->rotas, $this->dir_modulo, $this->modulo); $obj_c = $obj_r->obterRota(); if ($obj_c === false) { $obj_c = new Controle('home', 'WebSite', 'alterarStatus', ['status' => 404, 'pg_mestra' => 'padrao']); } // Fim if ... else $obj_c->executar($this); }
protected function salvar() { $_POST['email'] = $_POST['email2']; if ($this->modelo->verificaCpf($_POST['cpf']) && $this->modelo->verificaEmail($_POST['email'])) { $_POST['interno'] = '0'; $_POST['dataAtualizacao'] = date('Y-m-d G:i:s'); $retorna = parent::salvar(); if (empty($retorna)) { $this->uploadImgDaSessao(); $idCurriculo = $this->modelo->ultimoId(); $idUsuario = $this->salvaUsuario($idCurriculo); $this->salvaAcompanhamento($idCurriculo); $this->logar($idUsuario, $idCurriculo, $_POST['email']); } } }
<div class="content home"> <aside> <h1 class="boxtitle">Estatísticas de Acesso:</h1> <article class="sitecontent boxaside"> <h1 class="boxsubtitle">Conteúdo:</h1> <?php //Objeto READ $read = new Controle(); //VISITAS DO SITE $read->FullRead("SELECT SUM(siteviews_views) AS views FROM ws_siteviews"); $Views = $read->getResult()[0]->views; //USUÁRIOS $read->FullRead("SELECT SUM(siteviews_users) AS users FROM ws_siteviews"); $Users = $read->getResult()[0]->users; //MÉDIA DE PAGEVIEWS $read->FullRead("SELECT SUM(siteviews_pages) AS pages FROM ws_siteviews"); $ResPages = $read->getResult()[0]->pages; $Pages = substr($ResPages / ($Users == 0 ? 1 : $Users), 0, 5); //POSTS $read->setTable("ws_posts"); $read->findAll(); $Posts = $read->getRowCount(); // //EMPRESAS // $read->setTable("app_empresas"); // $read->findAll(); // $Empresas = $read->getRowCount(); ?>
<?php include "../../_app/Config.inc.php"; $Read = new Controle('app_cidades'); $Read->findAll(); echo json_encode($Read->getResult());
private function UsuariosUpdate() { $this->Usuario = new WsSiteviewsOnline(); $this->Usuario->setOnline_endview($_SESSION['useronline']['online_endview']); $this->Usuario->setOnline_url($_SESSION['useronline']['online_url']); $this->Usuario->setOnline_session($_SESSION['useronline']['online_session']); $this->Usuario->Execute()->update($this->Usuario->getThis(), 'online_session'); if (!$this->Usuario->Execute()->getRowCount()) { $Read = new Controle('ws_siteviews_online'); $Read->Query("#online_session#", "online_session={$_SESSION['useronline']['online_session']}"); if (!$Read->getResult()) { $this->setUsuarios(); } } }
WSErro("O status do setor foi atualizado para <b>inativo</b>. Setor agora é um rascunho!", WS_ACCEPT); break; case 'delete': $postUpdate->ExeDelete($postAction); WSErro('O Setor <b>' . $postUpdate->getError()[0] . "</b>, foi deletado com sucesso!", $postUpdate->getError()[1]); break; default: WSErro("Ação não foi identificada pelo sistema, favor utilize os botões", WS_ERROR); break; } } $posti = 0; $getPage = filter_input(INPUT_GET, 'page', FILTER_VALIDATE_INT); $Pager = new Pager("painel.php?exe=setor/index&page="); $Pager->ExePager($getPage, 6); $Read = new Controle(); $Read->FullRead("SELECT * FROM ws_setor ORDER by setor_status ASC, setor_date DESC LIMIT :limit OFFSET :offset", "limit={$Pager->getLimit()}&offset={$Pager->getOffset()}", true); if (!$Read->getResult()) { $Pager->ReturnPage(); WSErro("Desculpa, ainda não temos setor cadastrados", WS_INFOR); } else { foreach ($Read->getResult() as $setor) { $posti++; extract((array) $setor); $status = !$setor_status ? 'style="background: #fffed8"' : ''; ?> <article<?php if ($posti % 2 == 0) { echo ' class="right" '; } ?>
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer $id the ID of the model to be loaded * @return Controle the loaded model * @throws CHttpException */ public function loadModel($id) { $model = Controle::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
public function findAll() { $this->Result = parent::findAll(); return $this->Result; }
</div> <nav class="guia_comercial"> <h1>Guia de Empresas:</h1> <ul class="navitem"> <li id="comer" class="azul tabactive">Onde Comer</li> <li id="ficar">Onde Ficar</li> <li id="comprar" class="verde">Onde Comprar</li> <li id="divertir" class="roxo">Onde se Divertir</li> </ul> <div class="tab comer"> <?php $empcat = 'onde-comer'; $empresa = new Controle('app_empresas'); $empresa->Query("empresa_status = 1 AND #empresa_categoria# ORDER BY rand() LIMIT 4", "empresa_categoria={$empcat}"); if (!$empresa->getResult()) { WSErro("Desculpe, não existem empresas cadastradas na categoria ONDE COMER. Favor, volte depois!", WS_INFOR); } else { foreach ($empresa->getResult() as $emp) { $View->Show((array) $emp, $tpl_empresa); } } ?> </div> <div class="tab ficar none"> <?php $empcat = 'onde-ficar'; $empresa->Busca("empresa_categoria={$empcat}");
} $empi = 0; $getPage = filter_input(INPUT_GET, 'page', FILTER_VALIDATE_INT); $Pager = new Pager('painel.php?exe=empresas/index&page='); $Pager->ExePager($getPage, 10); $readEmp = new Controle(); $readEmp->FullRead("SELECT * FROM app_empresas ORDER BY empresa_status ASC, empresa_title ASC LIMIT :limit OFFSET :offset", "limit={$Pager->getLimit()}&offset={$Pager->getOffset()}", true); if ($readEmp->getResult()) { foreach ($readEmp->getResult() as $emp) { $empi++; extract((array) $emp); $status = !$empresa_status ? 'style="background: #fffed8"' : ''; $stateObj = new Controle('app_estados'); $stateObj->Query("estado_id = :est", "est={$empresa_uf}"); $state = $stateObj->getResult() ? $stateObj->getResult()[0]->estado_uf : 'NULL'; $cityObj = new Controle('app_cidades'); $cityObj->Query("cidade_id = :city", "city={$empresa_cidade}"); $city = $cityObj->getResult() ? $cityObj->getResult()[0]->cidade_nome : 'NULL'; ?> <article<?php if ($empi % 2 == 0) { echo ' class="right"'; } ?> <?php echo $status; ?> > <header> <div class="img thumb_small">
<?php $View = !empty($View) ? $View : ($View = new View()); $post_id = !empty($post_id) ? $post_id : null; $side = new Controle(); $tpl_p = $View->Load('article_p'); ?> <aside class="main-sidebar"> <article class="ads"> <header> <h1>Anúncio Patrocinado:</h1> <a href="http://www.upinside.com.br/campus" title="Campus UpInside - Treinamentos em TI 100% em Vídeo aulas"> <img src="<?php echo INCLUDE_PATH; ?> /_tmp/banner_large.png" alt="UPINSIDE TEINAMENTOS" title="UPINSIDE TEINAMENTOS" /> </a> </header> </article> <section class="widget art-list last-publish"> <h2 class="line_title"><span class="oliva">Últimas Atualizações:</span></h2> <?php $side->setTable('ws_posts'); $side->Query("post_status = 1 AND post_id != :side ORDER BY post_date DESC LIMIT 3", "side={$post_id}"); if ($side->getResult()) { foreach ($side->getResult() as $last) { $last->datetime = date('Y-m-d', strtotime($last->post_date)); $last->pubdate = date('d/m/Y H:i', strtotime($last->post_date)); $View->Show((array) $last, $tpl_p); }
// error_reporting( E_ALL ); define('DS', DIRECTORY_SEPARATOR); define('ROOT', dirname(__DIR__)); // SE NÃO HOUVER SESSAO ORGAO - EXIT / INDEX.PHP if (empty($_SESSION['orgao'])) { header('Location: ../index.php?un=clean'); exit; } include ROOT . DS . 'config/Config.php'; include ROOT . DS . 'src/Controle.php'; include ROOT . DS . 'src/Servidor.php'; // include ROOT.DS.'src/Usuarios.php'; $log = new Servidor(new Config()); $log->protege(); // Montagem do Menu do Painel $menuAdm = new Controle(new Config()); $arrMenuAdm = ['Contra-Cheque' => '?page=contracheque', 'Sair' => 'logout.php']; // $arrMenuAdm = [ 'Painel'=>'?page=painel','Contra-Cheque'=>'?page=contracheque','Sair'=>'logout.php']; $menuAdmin = $menuAdm->getMenu($arrMenuAdm); // recebe a pagina que vai ser exibida, caso não venha utiliza uma padrão $getPages = isset($_GET['page']) ? $_GET['page'] : 'contracheque'; $strAction = $getPages == 'usuarios' ? 'list' : 'painel'; $arrPages = ['contracheque', 'servidor']; if (in_array($getPages, $arrPages)) { $strPage = ucfirst($getPages) . '.php'; // Classe com metodos include ROOT . DS . 'src' . DS . $strPage; // Arquivo com função de Leitura dos dados - LIST // echo $getPages;die; include ROOT . DS . 'admin' . DS . $getPages . '.php'; $strAction = 'list';
WSErro("O status do tipo foi atualizado para <b>inativo</b>. Setor agora é um rascunho!", WS_ACCEPT); break; case 'delete': $postUpdate->ExeDelete($postAction); WSErro('O Tipo <b>' . $postUpdate->getError()[0] . "</b>, foi deletado com sucesso!", $postUpdate->getError()[1]); break; default: WSErro("Ação não foi identificada pelo sistema, favor utilize os botões", WS_ERROR); break; } } $posti = 0; $getPage = filter_input(INPUT_GET, 'page', FILTER_VALIDATE_INT); $Pager = new Pager("painel.php?exe=setor_type/index&page="); $Pager->ExePager($getPage, 6); $Read = new Controle(); $Read->FullRead("SELECT * FROM ws_setor_type ORDER by type_status ASC, type_content DESC LIMIT :limit OFFSET :offset", "limit={$Pager->getLimit()}&offset={$Pager->getOffset()}", true); if (!$Read->getResult()) { $Pager->ReturnPage(); WSErro("Desculpa, ainda não temos tipos cadastrados", WS_INFOR); } else { foreach ($Read->getResult() as $tipo) { $posti++; extract((array) $tipo); $status = !$type_status ? 'style="background: #fffed8"' : ''; ?> <article<?php if ($posti % 2 == 0) { echo ' class="right" '; } ?>
/empresa/<?php echo $empresa_name; ?> " target="_blank" rel="nofollow">Compartilhe Isso</a></h3> <!--<iframe width="578" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.com.br/maps?q=ENDERECO&ie=UTF8&hq=&hnear=ENDERECO&t=m&z=16&ll=&hl=pt-BR&iwloc=A&output=embed" style="text-align:left; margin-top: 20px;"></iframe>--> <div class="clear"></div> </div> <!--RELACIONADOS--> <footer> <nav> <h3>Veja também:</h3> <?php $readMais = new Controle('app_empresas'); $readMais->Query("empresa_status = 1 ORDER BY rand() LIMIT 4"); if ($readMais->getResult()) { $View = new View(); $tpl = $View->Load('empresa_p'); foreach ($readMais->getResult() as $mais) { $View->Show((array) $mais, $tpl); } } ?> </nav> <div class="clear"></div> </footer> <!--Comentários aqui--> </article>