コード例 #1
0
ファイル: FilesPresenter.php プロジェクト: soundake/pd
 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());
 }
コード例 #2
0
 public function testCalc()
 {
     $pager = new Pager(27);
     $pager->setPageSize(4)->setCurrentPage(7);
     $this->assertEquals(4, $pager->getLimit());
     $this->assertEquals(24, $pager->getOffset());
     $this->assertEquals(7, $pager->getPageCount());
     $pager->setCurrentPage(1);
     $this->assertEquals(0, $pager->getOffset());
 }
コード例 #3
0
ファイル: PlacesPresenter.php プロジェクト: soundake/pd
 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;
 }
コード例 #4
0
ファイル: categoria.php プロジェクト: adrianosilvareis/ciddhc
            <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);
コード例 #5
0
            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"';
コード例 #6
0
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}");
コード例 #7
0
ファイル: index.php プロジェクト: adrianosilvareis/ciddhc
            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 
コード例 #8
0
"</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));
コード例 #9
0
ファイル: EventsPresenter.php プロジェクト: soundake/pd
 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');
     }
 }
コード例 #10
0
ファイル: CatalogPresenter.php プロジェクト: soundake/pd
 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());
     }
 }
コード例 #11
0
            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"';
コード例 #12
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=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;
        ?>
>
コード例 #13
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";
コード例 #14
0
 public function __toString()
 {
     $dbo =& $this->dbo;
     $meta = $dbo->meta();
     $table = $meta->getTable();
     $key = $meta->getKey();
     $sql = "{$this->type} ";
     $meat = '';
     if ($this->type == 'SELECT') {
         if ($this->fields) {
             $sql .= "{$this->fields} ";
         } else {
             $sql .= "`{$table}`.`{$key}`," . $meta->getColumnsSQL() . ' ';
         }
     } elseif ($this->fields) {
         throw new InvalidArgumentException('field specification is incompatible with non-select queries');
     } elseif ($this->pager) {
         throw new InvalidArgumentException('pager is not compatible with non-select queries');
     }
     if ($this->pager && $this->limit) {
         throw new InvalidArgumentException('pager is mutually exclusive with limit');
     }
     $meat = "FROM `{$table}` ";
     foreach ($this->joins as $join) {
         $meat .= "{$join} ";
     }
     for ($i = 0; $i < count($this->wheres); $i++) {
         $where = $this->wheres[$i];
         if (!$i) {
             $where = "WHERE {$where}";
         } else {
             $where = "AND {$where} ";
         }
         $meat .= "{$where} ";
     }
     for ($i = 0; $i < count($this->groupBys); $i++) {
         $group = $this->groupBys[$i];
         if (!$i) {
             $group = "GROUP BY {$group}";
         } else {
             $group = ",{$group}";
         }
         $meat .= "{$group} ";
     }
     if ($this->pager && null === $this->pager->results) {
         $database = Site::getModule('Database');
         $lsql = "SELECT COUNT(*) {$meat}";
         $sth = $database->query($lsql);
         $this->pager->setResults($sth->fetchColumn());
     }
     $sql .= $meat;
     for ($i = 0; $i < count($this->orders); $i++) {
         $order = $this->orders[$i];
         if (!$i) {
             $order = "ORDER BY {$order}";
         } else {
             $order = ",{$order}";
         }
         $sql .= "{$order} ";
     }
     if ($this->pager) {
         $sql .= $this->pager->getLimit();
     } elseif ($this->limit) {
         $sql .= "LIMIT {$this->limit}";
     }
     return $sql;
 }
コード例 #15
0
ファイル: index.php プロジェクト: adrianosilvareis/intranet
                    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>
コード例 #16
0
ファイル: index.php プロジェクト: adrianosilvareis/intranet
                    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>
コード例 #17
0
ファイル: CalendarPresenter.php プロジェクト: soundake/pd
 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());
     }
 }
コード例 #18
0
ファイル: index.php プロジェクト: adrianosilvareis/intranet
            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 
コード例 #19
0
ファイル: index.php プロジェクト: adrianosilvareis/intranet
            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 
コード例 #20
0
ファイル: index.php プロジェクト: adrianosilvareis/ciddhc
            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;
        ?>
>
コード例 #21
0
ファイル: admin.template.php プロジェクト: razagilani/srrs
/**
* Prints out list of current additional resources
* @param Pager $pager pager object
* @param mixed $resources array of resource data
* @param string $err last database error
*/
function print_manage_additional_resources($pager, $resources, $err)
{
    global $link;
    $util = new Utility();
    ?>

<form name="manageAdditionalResource" method="post" action="admin_update.php" onsubmit="return checkAdminForm();">
<table width="100%" border="0" cellspacing="0" cellpadding="1" align="center">
  <tr>
    <td class="tableBorder">
      <table width="100%" border="0" cellspacing="1" cellpadding="0">
        <tr>
          <td colspan="4" class="tableTitle">&#8250; <?php 
    echo translate('All Accessories');
    ?>
</td>
        </tr>
		<?php 
    echo "\r\n        <tr class=\"rowHeaders\">\r\n          <td>" . $link->getLink($_SERVER['PHP_SELF'] . $util->getSortingUrl($_SERVER['QUERY_STRING'], 'name'), translate('Accessory Name')) . "</td>\r\n          <td width=\"15%\">" . translate('Number Available') . "</td>\r\n          <td width=\"7%\">" . translate('Edit') . "</td>\r\n\t\t  <td width=\"7%\">" . translate('Delete') . "</td>\r\n        </tr>";
    if (!$resources) {
        echo '<tr class="cellColor0"><td colspan="4" style="text-align: center;">' . $err . '</td></tr>' . "\n";
    }
    for ($i = 0; is_array($resources) && $i < count($resources); $i++) {
        $cur = $resources[$i];
        if ($cur['number_available'] == -1) {
            $cur['number_available'] = translate('Unlimited');
        }
        echo "<tr class=\"cellColor" . $i % 2 . "\" align=\"center\" id=\"tr{$i}\">\n" . '<td style="text-align:left">' . $cur['name'] . "</td>\n" . '<td>' . $cur['number_available'] . "</td>\n" . "</td>\n" . '<td>' . $link->getLink($_SERVER['PHP_SELF'] . '?' . preg_replace("/&resourceid=[\\d\\w]*/", "", $_SERVER['QUERY_STRING']) . '&amp;resourceid=' . $cur['resourceid'] . (strpos($_SERVER['QUERY_STRING'], $pager->getLimitVar()) === false ? '&amp;' . $pager->getLimitVar() . '=' . $pager->getLimit() : ''), translate('Edit'), '', '', translate('Edit data for', array($cur['name']))) . "</td>\n" . "<td><input type=\"checkbox\" name=\"resourceid[]\" value=\"" . $cur['resourceid'] . "\" onclick=\"adminRowClick(this,'tr{$i}',{$i});\" /></td>\n" . "</tr>\n";
    }
    // Close table
    ?>
      </table>
    </td>
  </tr>
</table>
<br />
<?php 
    echo submit_button(translate('Delete'), 'resourceid') . hidden_fn('delAddResource') . '</form>';
}
コード例 #22
0
ファイル: index.php プロジェクト: adrianosilvareis/intranet
                    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>
コード例 #23
0
ファイル: index.php プロジェクト: adrianosilvareis/intranet
                    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 
コード例 #24
0
ファイル: index.php プロジェクト: adrianosilvareis/intranet
                    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 
コード例 #25
0
ファイル: index.php プロジェクト: adrianosilvareis/intranet
            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 
コード例 #26
0
ファイル: noticias.php プロジェクト: adrianosilvareis/ciddhc
            <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));