Example #1
0
 public function renderDefault()
 {
     $files = $this->files->order($this->order . " " . $this->sort);
     // vyhledavani
     if ($this->q) {
         $files->where("file.name LIKE ?", "%" . $this->q . "%");
         $this['search']['q']->setDefaultValue($this->q);
         $this->template->search = TRUE;
     } else {
         $this->template->search = FALSE;
     }
     $this->pagerFiles->itemCount = $files->count();
     $this->template->files = $files->limit($this->pagerFiles->getLimit(), $this->pagerFiles->getOffset());
 }
 public function testUnavailablePage()
 {
     $pager = new Pager(27);
     $pager->setPageSize(4)->setCurrentPage(10);
     $this->assertEquals(0, $pager->getOffset());
     $this->assertEquals(1, $pager->getCurrentPage());
 }
Example #3
0
 public function renderDefault()
 {
     // vyhledavani
     if ($this->q) {
         $this->places->where("subject.name LIKE ? OR user.email LIKE ?", "%" . $this->q . "%", "%" . $this->q . "%");
         $this['search']['q']->setDefaultValue($this->q);
         $this->template->search = TRUE;
     } else {
         $this->template->search = FALSE;
     }
     switch ($this->what) {
         case self::UPDATED:
             $this->places->group('subject.id')->having('DATEDIFF(NOW(), subject.changed) < ' . self::TIME_UPDATED);
             $this->template->what = self::UPDATED;
             break;
         case self::RECENT:
             $this->places->group('subject.id')->having('DATEDIFF(NOW(), subject.created) < ' . self::TIME_RECENT);
             $this->template->what = self::RECENT;
             break;
         case self::TOREVIEW:
             $this->places->group('subject.id')->having('subject.reviewed = 0 && subject.deleted = 0 ');
             $this->template->what = self::TOREVIEW;
             break;
         case self::DELETED:
             $this->template->what = self::DELETED;
             $this->places->fetchDeleted();
             break;
         default:
             $this->template->what = self::ALL;
     }
     if (!$this->what == self::DELETED) {
         $this->places->fetchUnDeleted();
     }
     if ($this->orderBy == '' && $this->user->isInRole('administrator')) {
         $this->orderBy = self::MODIFICATION;
     }
     switch ($this->orderBy) {
         case self::MODIFICATION:
             $this->places->order('changed DESC, created DESC');
             $this->template->orderBy = self::MODIFICATION;
             break;
         case self::ALPHABET:
         default:
             $this->places->order('name');
             $this->template->orderBy = self::ALPHABET;
             break;
     }
     // strankovani
     $this->pagerPlaces->itemCount = $this->places->count();
     $this->places->limit($this->pagerPlaces->getLimit(), $this->pagerPlaces->getOffset());
     // vypis
     $this->template->places = $this->places;
 }
            WSErro("O status da empresa foi atualizado para <b>inativo</b>. Empresa agora é um rascunho!", WS_ALERT);
            break;
        case 'delete':
            $empUpdate->ExeDelete($empAction);
            WSErro($empUpdate->getError()[0], $empUpdate->getError()[1]);
            break;
        default:
            WSErro("Ação não foi identifica pelo sistema, favor utilize os botões!", WS_ALERT);
    }
}
$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"';
Example #5
0
                    WSErro("Erro ao deletar", WS_ERROR);
                }
                break;
            default:
                WSErro("Opss! opção invalida.", WS_ERROR);
                break;
        }
    } else {
        WSErro("A ação informada não pode ser encontrado!", WS_INFOR);
    }
}
$getPage = filter_input(INPUT_GET, 'page', FILTER_VALIDATE_INT);
$Pager = new Pager(FAST_INCLUDE . "admin/&exe=acoes/index&page=");
$Pager->ExePager($getPage, 15);
$FeAcoes = new FeAcoes();
$FeAcoes->Execute()->FullRead("SELECT * FROM fe_acoes ORDER BY acao_status LIMIT :limit OFFSET :offset", "limit={$Pager->getLimit()}&offset={$Pager->getOffset()}", true);
if (!$FeAcoes->Execute()->getResult()) {
    $Pager->ReturnPage();
    WSErro("Nenhum ação cadastrado!", WS_INFOR);
} else {
    ?>
    <table class="table table-striped">
        <thead>
            <tr>
                <th>#</th>
                <th>Descrição</th>
                <th>Ação</th>
            </tr>
        </thead>
        <tbody>
            <?php 
echo $Cat;
?>
</h2>
            <p class="tagline">Conheça as empresas cadastradas no seu guia online. Encontre aqui empresas <?php 
echo $Cat;
?>
</p>
        </header>

        <?php 
$getPage = !empty($Link->getLocal()[2]) ? $Link->getLocal()[2] : 1;
$Pager = new Pager(HOME . '/empresas/' . $EmpLink . '/');
$Pager->ExePager($getPage, 5);
$readEmp = new Controle();
$readEmp->setTable('app_empresas');
$readEmp->Query("empresa_status = 1 AND empresa_categoria = :cat ORDER BY empresa_date DESC LIMIT :limit OFFSET :offset", "cat={$EmpLink}&limit={$Pager->getLimit()}&offset={$Pager->getOffset()}", true);
if (!$readEmp->getResult()) {
    $Pager->ReturnPage();
    WSErro("Desculpe, ainda não existem empresas cadastradas {$Cat}, favor volte depois", WS_INFOR);
} else {
    $View = new View();
    $tpl = $View->Load('empresa_list');
    foreach ($readEmp->getResult() as $emp) {
        //encontra cidade
        $readEmp->setTable('app_cidades');
        $readEmp->find("cidade_id={$emp->empresa_cidade}");
        $cidade = $readEmp->getResult()->cidade_nome;
        $emp->empresa_cidade = $cidade;
        //encontra estado
        $readEmp->setTable('app_estados');
        $readEmp->find("estado_id={$emp->empresa_uf}");
Example #7
0
            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" ';
        }
        ?>
 <?php 
"</h2>
            <p class="tagline">Sua pesquisa por <?php 
echo $search;
?>
 retornou <?php 
echo $count;
?>
 resultados:</p>
        </header>

        <?php 
$getPage = (int) (!empty($Link->getLocal()[2]) ? $Link->getLocal()[2] : 1);
$Pager = new Pager(HOME . '/pesquisa/' . $search . '/');
$Pager->ExePager($getPage, 4);
$readArt = new WsPosts();
$readArt->Execute()->Query("post_status = 1 AND (post_title LIKE '%' :link '%' OR post_content LIKE '%' :link '%') ORDER BY post_date DESC LIMIT :limit OFFSET :offset", "link={$search}&limit={$Pager->getLimit()}&offset={$Pager->getOffset()}", true);
if (!$readArt->Execute()->getResult()) {
    $Pager->ReturnPage();
    WSErro("Desculpe, sua pesquisa não retornou resultados. Você pode resulmir sua pesquisa ou tentar outros termos!", WS_INFOR);
} else {
    $cc = 0;
    foreach ($readArt->Execute()->getResult() as $cat) {
        $cc++;
        $View = new View();
        $tpl_cat = $View->Load('article_m');
        $class = $cc % 3 == 0 ? ' class="right"' : null;
        echo "<span{$class}>";
        $cat->post_title = Check::Words($cat->post_title, 8);
        $cat->post_content = Check::Words($cat->post_content, 20);
        $cat->datetime = date('Y-m-d', strtotime($cat->post_date));
        $cat->pubdate = date('d/m/Y H:i', strtotime($cat->post_date));
Example #9
0
            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 
Example #10
0
 public function renderDefault()
 {
     $httpRequest = $this->context->getService('httpRequest');
     $this->template->hash = $hash = $httpRequest->getUrl()->path;
     $cache = new \Nette\Caching\Cache($this->context->getService('cacheStorage'));
     $key = $hash . "count";
     dump($key);
     $count = $cache->load($key);
     if ($count === NULL) {
         $count = $this->context->createServiceTimes()->fetchPublic()->group('event_time.event_id')->count();
         $cache->save($key, $count, array(\Nette\Caching\Cache::EXPIRE => '2 hours', \Nette\Caching\Cache::TAGS => array('events', 'event'), \Nette\Caching\Cache::SLIDING => TRUE));
     }
     $this->template->eventsCount = $count;
     $this->template->events = $this->items;
     $this->template->page = $this->page;
     // omezeni na lokalitu
     $this->template->locality = false;
     if ($this->locality) {
         $this->items->where('event_time.event.subject.locality.code', $this->locality);
         $this->template->locality = true;
     }
     // omezeni na kraje
     if ($this->shire) {
         $this->items->where('(event_time.event.shire.code = "' . $this->shire . '") OR (event_time.event.shire_id = 99)');
     }
     // omezeni na kategorie
     if ($this->category || count($this->categories) > 0) {
         $this->items->where('event_time.event:event_x_category.category_id', array_keys($this->categories));
         if (count($this->categories) == 1) {
             $this->template->category = $this->context->createServiceCategories()->get(key($this->categories));
         } else {
             $this->template->categories = $this->context->createServiceCategories();
         }
     } else {
         //$this['categories']['category']['all']->setValue(1);
     }
     // nastavi casovy ramec
     if ($this->timeframe) {
         $this->items->setTimeframe($this->timeframe);
         $this->template->timeframe = $this->timeframe;
     }
     $this->template->dates = array();
     for ($i = 2; $i < 13; $i++) {
         $ts = time() + $i * 86400;
         if (strftime("%u", $ts) == 6 || strftime("%u", $ts) == 7) {
             $this->template->dates[date("Y-m-d", $ts)]['time'] = strftime("%a %e. %m.", $ts);
             $this->template->dates[date("Y-m-d", $ts)]['day'] = 'weekend';
             //$this->template->dates[date("Y-m-d", $ts)] = strftime("%A", $ts);
         } else {
             $this->template->dates[date("Y-m-d", $ts)]['time'] = strftime("%a %e. %m.", $ts);
             $this->template->dates[date("Y-m-d", $ts)]['day'] = 'weekday';
         }
     }
     // pocet polozek s omezenimi
     $key = $hash . $this->timeframe . "/page-" . $this->pagerPlaces->getPage() . "/" . serialize($this->categories);
     $this->template->pagingHash = $key;
     dump($key);
     $count = $cache->load($key);
     if ($count === NULL) {
         $count = $this->items->count();
         $cache->save($key, $count, array(\Nette\Caching\Cache::EXPIRE => '2 hours', \Nette\Caching\Cache::TAGS => array('events', 'event'), \Nette\Caching\Cache::SLIDING => TRUE));
     }
     $this->template->count = $count;
     if ($this->page * $this->limit > $count - $this->limit) {
         //zkontroluje, zda se jedna o posledni stranku vypisu
         $this->limit = 9999;
         // nastavi limi na hodne velky cislo, aby se vypsalo vse zbyvajici
         $this->template->limit = $this->limit;
     } elseif (($this->page + 1) * $this->limit > $count - $this->limit) {
         // zkontroluje, zda se jedna o predposledni stranku vypisu
         $this->template->limit = 9998;
     } else {
         $this->template->limit = $this->limit;
     }
     //nastavi razeni
     if ($this->order == "created DESC") {
         $this->items->order($this->order);
     } else {
         // ostatni razeni se resi v modelu dle timeframe
     }
     // strankovani
     $this->pagerPlaces->itemsPerPage = $this->limit;
     $this->pagerPlaces->itemCount = $count;
     if ($this->pagerPlaces->getOffset() == 9999 && $this->pagerPlaces->getPage() > 1) {
         $this->redirect('this', array('pagingPlaces-page' => 1));
     }
     if ($this->isAjax()) {
         $this->template->newEntry = $this->items->limit($this->pagerPlaces->getLimit(), $this->pagerPlaces->getOffset());
     } else {
         $this->template->events = $this->items->limit($this->pagerPlaces->getLimit(), $this->pagerPlaces->getOffset());
     }
 }
            break;
        case 'delete':
            $postUpdate->ExeDelete($postAction);
            WSErro($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=posts/index&page=");
$Pager->ExePager($getPage, 5);
$Read = new Read("ws_posts");
$Read->Query("ORDER by post_status ASC, post_date DESC LIMIT :limit OFFSET :offset", "limit={$Pager->getLimit()}&offset={$Pager->getOffset()}");
if ($Read->getResult()) {
    foreach ($Read->getResult() as $post) {
        $posti++;
        extract((array) $post);
        $status = !$post_status ? 'style="background: #fffed8"' : '';
        ?>
                <article<?php 
        if ($posti % 2 == 0) {
            echo ' class="right" ';
        }
        ?>
 <?php 
        echo $status;
        ?>
>
Example #12
0
 retornou <?php 
echo $count;
?>
 resultados:</p>
            </header>
        </section>

        <?php 
//
//POSTs
//
$getPage = (int) (!empty($Link->getLocal()[2]) ? $Link->getLocal()[2] : 1);
$Pager = new Pager(HOME . '/pesquisa/' . $search . '/');
$Pager->ExePager($getPage, 8);
$readArt = new WsPosts();
$readArt->Execute()->Query("post_status = 1 AND (post_title LIKE '%' :link '%' OR post_content LIKE '%' :link '%') ORDER BY post_date DESC LIMIT :limit OFFSET :offset", "link={$search}&limit={$Pager->getLimit()}&offset={$Pager->getOffset()}", true);
if (!$readArt->Execute()->getResult()) {
    $Pager->ReturnPage();
    WSErro("Desculpe, sua pesquisa não encontrou posts. Você pode resulmir sua pesquisa ou tentar outros termos!", WS_INFOR);
} else {
    $cc = 0;
    echo "<div class='row'>\n";
    foreach ($readArt->Execute()->getResult() as $cat) {
        $cat->post_title = Check::Words($cat->post_title, 8);
        $cat->post_content = Check::Words($cat->post_content, 20);
        $cat->datetime = date('Y-m-d', strtotime($cat->post_date));
        $cat->pubdate = date('d/m/Y H:i', strtotime($cat->post_date));
        echo $cc % 4 == 0 ? "<div class='row'>\n</div>\n" : "";
        echo "<div class='col-md-3'>";
        $View->Show((array) $cat, $tpl_cat);
        echo "</div>\n";
<!DOCTYPE html>
<html lang="pt-br">
    <head>
        <meta charset="UTF-8">
        <title></title>
    </head>
    <body>
        <?php 
require './_app/Config.inc.php';
$Atual = filter_input(INPUT_GET, 'atual', FILTER_VALIDATE_INT);
$Pager = new Pager('04-gestao-de-resultados.php?atual=', 'Primeira', 'Última');
$Pager->ExePager($Atual, 1);
$read = new Read();
$read->ExeRead('ws_categories', 'limit :limit offset :offset', "limit={$Pager->getLimite()}&offset={$Pager->getOffset()}");
$Pager->ExePaginator('ws_categories');
echo $Pager->getPaginator();
var_dump($Pager);
?>
    </body>
</html>
Example #14
0
                    WSErro("Erro ao deletar", WS_ERROR);
                }
                break;
            default:
                WSErro("Opss! opção invalida.", WS_ERROR);
                break;
        }
    } else {
        WSErro("O posto informado não pode ser encontrado!", WS_INFOR);
    }
}
$getPage = filter_input(INPUT_GET, 'page', FILTER_VALIDATE_INT);
$Pager = new Pager(IMP_INCLUDE . "admin/&exe=postos/index&page=");
$Pager->ExePager($getPage, 15);
$Read = new ImpPostos();
$Read->Execute()->FullRead("SELECT * FROM imp_postos ORDER BY postos_ativo LIMIT :limit OFFSET :offset", "limit={$Pager->getLimit()}&offset={$Pager->getOffset()}", true);
?>
<article>
    <?php 
if (!$Read->Execute()->getResult()) {
    $Pager->ReturnPage();
    WSErro("Desculpa, ainda não temos postos cadastrados", WS_INFOR);
} else {
    ?>
        <table class="table table-striped text-center">
            <thead>
                <tr>
                    <th class="text-center">#</th>
                    <th class="text-center">Nome</th>
                    <th class="text-center">Numero</th>
                    <th class="text-center">Impressoras</th>
Example #15
0
            <h1 class="title"><?php 
echo $category_title;
?>
</h1>
            <p><?php 
echo $category_content;
?>
</p>
        </header>

        <?php 
$getPage = (int) (!empty($Link->getLocal()[2]) ? $Link->getLocal()[2] : 1);
$Pager = new Pager(HOME . '/categoria/' . $category_name . '/');
$Pager->ExePager($getPage, 3);
$readCat = new WsPosts();
$readCat->Execute()->Query("post_status = 1 AND (post_category = :cat OR post_cat_parent = :cat) ORDER BY post_date DESC LIMIT :limit OFFSET :offset", "cat={$category_id}&limit={$Pager->getLimit()}&offset={$Pager->getOffset()}", true);
if (!$readCat->Execute()->getResult()) {
    $Pager->ReturnPage();
    WSErro("Desculpe, a categoria <b>{$category_title}</b> ainda não tem artigos publicados, favor volte mais tarde!", WS_INFOR);
} else {
    $cc = 1;
    $View = new View();
    $tpl_m = $View->Load('article_m');
    foreach ($readCat->Execute()->getResult() as $cat) {
        echo "\n<div class='col-md-4'>\n";
        $class = $cc % 3 == 0 ? ' class="right"' : null;
        $cat->post_title = Check::Words($cat->post_title, 8);
        $cat->post_content = Check::Words($cat->post_content, 20);
        $cat->datetime = date('Y-m-d', strtotime($cat->post_date));
        $cat->pubdate = date('d/m/Y H:i', strtotime($cat->post_date));
        $View->Show((array) $cat, $tpl_m);
            WSErro("O status da empresa foi atualizado para <b>inativo</b>. Empresa agora é um rascunho!", WS_ALERT);
            break;
        case 'delete':
            $empUpdate->ExeDelete($empAction);
            WSErro($empUpdate->getError()[0], $empUpdate->getError()[1]);
            break;
        default:
            WSErro("Ação não foi identifica pelo sistema, favor utilize os botões!", WS_ALERT);
    }
}
$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 Read('app_empresas');
$readEmp->Query("ORDER BY empresa_status ASC, empresa_title ASC LIMIT :limit OFFSET :offset", "limit={$Pager->getLimit()}&offset={$Pager->getOffset()}");
if ($readEmp->getResult()) {
    foreach ($readEmp->getResult() as $emp) {
        $empi++;
        extract((array) $emp);
        $status = !$empresa_status ? 'style="background: #fffed8"' : '';
        $stateObj = new Read('app_estados');
        $stateObj->Query("WHERE estado_id = :est", "est={$empresa_uf}");
        $state = $stateObj->getResult() ? $stateObj->getResult()[0]->estado_uf : 'NULL';
        $cityObj = new Read('app_cidades');
        $cityObj->Query("WHERE cidade_id = :city", "city={$empresa_cidade}");
        $city = $cityObj->getResult() ? $cityObj->getResult()[0]->cidade_nome : 'NULL';
        ?>
                <article<?php 
        if ($empi % 2 == 0) {
            echo ' class="right"';
Example #17
0
                    WSErro("Erro ao deletar", WS_ERROR);
                }
                break;
            default:
                WSErro("Opss! opção invalida.", WS_ERROR);
                break;
        }
    } else {
        WSErro("O material informada não pode ser encontrado!", WS_INFOR);
    }
}
$getPage = filter_input(INPUT_GET, 'page', FILTER_VALIDATE_INT);
$Pager = new Pager(FAST_INCLUDE . "admin/&exe=exames/index&page=");
$Pager->ExePager($getPage, 15);
$FeExames = new FeExames();
$FeExames->Execute()->FullRead("SELECT * FROM fe_exames WHERE ex_cancelado = 0 ORDER BY ex_status, ex_data_fechamento DESC LIMIT :limit OFFSET :offset", "limit={$Pager->getLimit()}&offset={$Pager->getOffset()}", true);
if (!$FeExames->Execute()->getResult()) {
    $Pager->ReturnPage();
    WSErro("Nenhum solicitação de alteraçao de exame encontrado!", WS_INFOR);
} else {
    ?>
    <table class="table table-striped text-center" id="form" style="font-size: 0.9em;">
        <thead>
            <tr>
                <th class="text-center">Descrição</th>
                <th class="text-center">Mnemônico</th>
                <th class="text-center">Setor Exec.</th>
                <th class="text-center">Ações</th>
                <th class="text-center">Solicitado em.</th>
                <th class="text-center">Concluido em.</th>
                <th class="text-center">Setor Soli.</th>
Example #18
0
 public function renderDefault()
 {
     $this->items->fetchVisible();
     $this->template->page = $this->page;
     $this->offset = $this->limit * ($this->page - 1);
     // omezeni na lokalitu
     $this->template->locality = false;
     if ($this->locality) {
         //$this->items->where('(locality.code = ? OR scope_all = 1)',$this->locality);
         $this->items->where('(locality.code = ?)', $this->locality);
         if ($this->shire === null) {
             $this->template->locality = true;
         }
     }
     // omezeni na kraje
     if ($this->shire) {
         $this->items->where('(locality.shire.code = ? OR locality.shire.id = 99 OR scope_all = 1)', $this->shire);
         $this->template->shire = $this->context->createServiceShires()->where('code', $this->shire)->fetch();
     }
     //omezeni na kategorie
     if ($this->category || count($this->categories) > 0) {
         $this->items->where(':subject_x_category.category_id', array_keys($this->categories));
         if (count($this->categories) == 1) {
             $this->template->category = $this->context->createService('categories')->get(key($this->categories));
         } else {
             $this->template->categories = $this->context->createService('categories');
         }
     } else {
         //			$this['categories']['categories']['all']->setValue(1);
     }
     //omezeni na deti
     if ($this->kids) {
         $this->items->kids($this->kids);
     }
     // omezeni na kocarek
     if ($this->stroller) {
         $this->items->where('subject.stroller', $this->stroller);
     }
     // omezeni na kocarek
     if ($this->nonsmoking) {
         $this->items->where('subject.nonsmoking', $this->nonsmoking);
     }
     // omezeni na kocarek
     if ($this->wheelchair_access) {
         $this->items->where('subject.wheelchair_access', $this->wheelchair_access);
     }
     //nastavi razeni a pripadna dalsi omezeni
     switch ($this->order) {
         case 'likes':
             $res = $this->context->database->table('subject_rating')->select('subject_id, sum(thumb_up) thumb_up, sum(thumb_down) thumb_down')->order('thumb_up DESC, thumb_down')->group('subject_id');
             $ids = array();
             foreach ($res as $key => $row) {
                 $ids[] = $row['subject_id'];
             }
             $this->items->where('subject.id', $ids);
             $this->items->order('FIND_IN_SET(subject.id,"' . implode(",", $ids) . '")');
             break;
         case 'recommended':
             $this->items->fetchAd(null, true)->order('created DESC');
             break;
         default:
             $this->items->order($this->order);
             break;
     }
     // pocet polozek s omezenimi
     $items = clone $this->items;
     $count = $items->count();
     $this->template->count = $count;
     // strankovani
     $this->pagerPlaces->itemCount = $count;
     if ($this->page * $this->limit > $count - $this->limit) {
         //zkontroluje, zda se jedna o posledni stranku vypisu
         $this->limit = 99;
         // nastavi limit na hodne velky cislo, aby se vypsalo vse zbyvajici
     } elseif (($this->page + 1) * $this->limit > $count - $this->limit) {
         // zkontroluje, zda se jedna o predposledni stranku vypisu
         $this->limit = 99;
     }
     $this->template->limit = $this->limit;
     $this->pagerPlaces->itemsPerPage = $this->limit;
     $this->template->page = $this->page;
     if ($this->isAjax()) {
         $this->template->newEntry = $this->items->limit($this->pagerPlaces->getLimit(), $this->pagerPlaces->getOffset());
         $this->redrawControl('paging');
     } else {
         $this->template->subjects = $this->items->limit($this->pagerPlaces->getLimit(), $this->pagerPlaces->getOffset());
     }
 }
Example #19
0
            break;
        case 'delete':
            $postUpdate->ExeDelete($postAction);
            WSErro($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=area_trabalho/index&page=");
$Pager->ExePager($getPage, 6);
$Read = new Controle();
$Read->FullRead("SELECT * FROM ws_area_trabalho ORDER by area_status ASC, area_date DESC LIMIT :limit OFFSET :offset", "limit={$Pager->getLimit()}&offset={$Pager->getOffset()}", true);
if (!$Read->getResult()) {
    $Pager->ReturnPage();
    WSErro("Desculpa, ainda não temos áreas cadastrados", WS_INFOR);
} else {
    foreach ($Read->getResult() as $setor) {
        $posti++;
        extract((array) $setor);
        $status = !$area_status ? 'style="background: #fffed8"' : '';
        ?>
                <article<?php 
        if ($posti % 2 == 0) {
            echo ' class="right" ';
        }
        ?>
 <?php 
Example #20
0
 public function renderDefault()
 {
     $this->template->subjects = $this->places->order('name')->where('subject.id != 1')->group('subject.id')->having('COUNT(:event.id) > 0');
     $this->template->approvedPlacesCount = $this->approvedPlacesCount;
     $this->template->subject_id = $this->subject_id;
     if ($this->subject_id != 'all') {
         $this->events->where('subject_id', $this->subject_id)->group('event.id')->having('COUNT(:event_time.id) = 0');
     }
     // vyhledavani
     if ($this->q) {
         $this->events->where("event.name LIKE ? OR subject.name LIKE ? OR user.email LIKE ?", "%" . $this->q . "%", "%" . $this->q . "%", "%" . $this->q . "%");
         $this->places->where("subject.name LIKE ?", "%" . $this->q . "%");
         $this['search']['q']->setDefaultValue($this->q);
         $this->template->search = TRUE;
     } else {
         $this->template->search = FALSE;
     }
     if ($this->order == '' && $this->user->isInRole('administrator')) {
         $this->order = 'updated DESC';
     }
     switch ($this->what) {
         case self::ANONYMOUS:
             $this->events->where('subject_id', '1');
             $this->template->what = self::ANONYMOUS;
             break;
         case self::NOTERM:
             $this->events->group('event.id')->having('COUNT(:event_time.id) = 0');
             $this->template->what = self::NOTERM;
             break;
         case self::UPDATED:
             $this->events->group('event.id')->having('DATEDIFF(NOW(), event.changed) < ' . self::TIME_UPDATED);
             $this->template->what = self::UPDATED;
             break;
         case self::RECENT:
             $this->events->group('event.id')->having('DATEDIFF(NOW(), event.created) < ' . self::TIME_RECENT);
             $this->template->what = self::UPDATED;
             break;
         case self::TOREVIEW:
             $this->events->group('event.id')->having('event.reviewed = 0');
             $this->template->what = self::TOREVIEW;
             break;
         case self::NOTAPPROVED:
             $this->events->group('event.id')->having('event.approved = 0');
             $this->template->what = self::NOTAPPROVED;
             break;
         case self::PREFERED:
             $this->events->group('event.id')->having('event.prefered = 1');
             $this->template->what = self::PREFERED;
             break;
         default:
             $this->template->what = self::ALL;
     }
     if ($this->orderBy == '' && $this->user->isInRole('administrator')) {
         $this->orderBy = self::MODIFICATION;
     }
     switch ($this->orderBy) {
         case self::MODIFICATION:
             $this->events->order('changed DESC, created DESC');
             $this->template->orderBy = self::MODIFICATION;
             break;
         case self::ALPHABET:
         default:
             $this->events->order('name');
             $this->template->orderBy = self::ALPHABET;
             break;
     }
     $this->pagerEvents->itemCount = $this->events->count();
     $this->template->events = $this->events->limit($this->pagerEvents->getLimit(), $this->pagerEvents->getOffset());
     if ($this->user->isInRole('administrator')) {
         $this->template->nonaproved = $this->context->createServiceEvents()->where('approved', '0');
     }
 }
Example #21
0
            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;
        ?>
>
Example #22
0
                    WSErro("Erro ao deletar", WS_ERROR);
                }
                break;
            default:
                WSErro("Opss! opção invalida.", WS_ERROR);
                break;
        }
    } else {
        WSErro("O material informada não pode ser encontrado!", WS_INFOR);
    }
}
$getPage = filter_input(INPUT_GET, 'page', FILTER_VALIDATE_INT);
$Pager = new Pager(FAST_INCLUDE . "admin/&exe=materiais/index&page=");
$Pager->ExePager($getPage, 15);
$FeMaterial = new FeMaterial();
$FeMaterial->Execute()->FullRead("SELECT * FROM fe_material ORDER BY mat_status LIMIT :limit OFFSET :offset", "limit={$Pager->getLimit()}&offset={$Pager->getOffset()}", true);
if (!$FeMaterial->Execute()->getResult()) {
    $Pager->ReturnPage();
    WSErro("Nenhum material cadastrado!", WS_INFOR);
} else {
    ?>
    <table class="table table-striped">
        <thead>
            <tr>
                <th>#</th>
                <th>Descrição</th>
                <th>Ação</th>
            </tr>
        </thead>
        <tbody>
            <?php 
Example #23
0
                    WSErro("Erro ao deletar", WS_ERROR);
                }
                break;
            default:
                WSErro("Opss! opção invalida.", WS_ERROR);
                break;
        }
    } else {
        WSErro("O modelo informado não pode ser encontrado!", WS_INFOR);
    }
}
$getPage = filter_input(INPUT_GET, 'page', FILTER_VALIDATE_INT);
$Pager = new Pager(IMP_INCLUDE . "admin/&exe=modelo/index&page=");
$Pager->ExePager($getPage, 15);
$Read = new ImpPostos();
$Read->Execute()->FullRead("SELECT * FROM imp_modelo ORDER BY modelo_status LIMIT :limit OFFSET :offset", "limit={$Pager->getLimit()}&offset={$Pager->getOffset()}", true);
?>
<article>
    <?php 
if (!$Read->Execute()->getResult()) {
    $Pager->ReturnPage();
    WSErro("Desculpa, ainda não temos modelo cadastrados", WS_INFOR);
} else {
    ?>
        <table class="table table-striped text-center">
            <thead>
                <tr>
                    <th class="text-center">#</th>
                    <th class="text-center">Nome</th>
                    <th class="text-center">Status</th>
                    <th>Actions</th>
Example #24
0
            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" ';
        }
        ?>
 <?php 
Example #25
0
            <div class="col-md-12">
                <h1 class="text-center title"><?php 
echo $titulo;
?>
</h1>
            </div>
        </div>
        <?php 
$View = new View();
$membro = $View->Load("noticias_m");
$getPage = (int) (!empty($Link->getLocal()[2]) ? $Link->getLocal()[2] : 1);
$Pager = new Pager(HOME . '/noticias/' . $post_type . '/');
$Pager->ExePager($getPage, 6);
$Read = new WsPosts();
$Read->setPost_type($post_type);
$Read->Execute()->Query("post_status = 1 AND post_type = :type ORDER BY post_date DESC, post_category DESC LIMIT :limit OFFSET :offset", "type={$post_type}&limit={$Pager->getLimit()}&offset={$Pager->getOffset()}", true);
if (!$Read->Execute()->getResult()) {
    $Pager->ReturnPage();
    WSErro("Desculpe não temos noticias no momento, favor volte mais tarde!", WS_INFOR);
} else {
    $i = 0;
    echo "<div class='row'>\n";
    foreach ($Read->Execute()->getResult() as $item) {
        if ($i % 3 == 0 && $i != 0) {
            echo "</div>\n";
            echo "<div class='row'>\n";
        }
        $item->post_title = Check::Words($item->post_title, 4);
        $item->post_content = Check::Words($item->post_content, 10);
        $item->datetime = date('Y-m-d', strtotime($item->post_date));
        $item->pubdate = date("d/m/Y H:i", strtotime($item->post_date));