Exemplo n.º 1
0
    /**
     * Формирует и возвращает HTML-код строки навигации.
     *
     * @param void
     * @return string
     */
    public function getHtml()
    {
        ob_start();
        $self_uri = $this->createRequestUri();
        $qs = $this->createQueryString();
        ?>
    <?php 
        if ($this->view_first_page_label && $this->manager->getCurrentSeparator() && $this->manager->getCurrentSeparator() != 1) {
            ?>
        &nbsp;<a<?php 
            echo $this->createInlineCssClassDeclaration('first_page_class', 'normal_link_class');
            ?>
 title="<?php 
            echo $this->html['first_page_title'];
            ?>
" href="<?php 
            echo $self_uri;
            ?>
?<?php 
            echo $qs;
            echo $this->manager->getPageName();
            ?>
=1&amp;<?php 
            echo $this->manager->getSeparatorName();
            ?>
=1<?php 
            echo $this->createFragmentIdentifier();
            ?>
"><?php 
            echo $this->html['first_page_anchor'];
            ?>
</a>&nbsp;
    <?php 
        }
        ?>

    <?php 
        if ($this->view_previous_block_label && $this->manager->getPreviousBlockSeparator()) {
            ?>
        <a<?php 
            echo $this->createInlineCssClassDeclaration('previous_block_class', 'normal_link_class');
            ?>
 title="<?php 
            echo $this->html['previous_block_title'];
            ?>
" href="<?php 
            echo $self_uri;
            ?>
?<?php 
            echo $qs;
            echo $this->manager->getPageName();
            ?>
=<?php 
            echo $this->manager->getPageForPreviousBlock();
            ?>
&amp;<?php 
            echo $this->manager->getSeparatorName();
            ?>
=<?php 
            echo $this->manager->getPreviousBlockSeparator();
            echo $this->createFragmentIdentifier();
            ?>
"><?php 
            echo $this->html['previous_block_anchor'];
            ?>
</a>&nbsp;
    <?php 
        }
        ?>

    <?php 
        if ($this->manager->getPreviousPageSeparator() && $this->manager->getPreviousPage()) {
            ?>
        <a<?php 
            echo $this->createInlineCssClassDeclaration('previous_page_class', 'normal_link_class');
            ?>
 title="<?php 
            echo $this->html['previous_page_title'];
            ?>
" href="<?php 
            echo $self_uri;
            ?>
?<?php 
            echo $qs;
            echo $this->manager->getPageName();
            ?>
=<?php 
            echo $this->manager->getPreviousPage();
            ?>
&amp;<?php 
            echo $this->manager->getSeparatorName();
            ?>
=<?php 
            echo $this->manager->getPreviousPageSeparator();
            echo $this->createFragmentIdentifier();
            ?>
"><?php 
            echo $this->html['previous_page_anchor'];
            ?>
</a>&nbsp;
    <?php 
        }
        ?>

    <?php 
        foreach ($this->manager->getTemplateData() as $row) {
            ?>
        <?php 
            if ($this->manager->getCurrentPage() == $row["page"]) {
                ?>
            <span<?php 
                echo $this->createInlineCssClassDeclaration('active_link_class');
                ?>
><?php 
                echo $this->createHyperlinkAnchor($row);
                ?>
</span>
        <?php 
            } else {
                ?>
            <a<?php 
                echo $this->createInlineCssClassDeclaration('normal_link_class');
                ?>
 href="<?php 
                echo $self_uri;
                ?>
?<?php 
                echo $qs;
                echo $this->manager->getSeparatorName();
                ?>
=<?php 
                echo $row["separator"];
                ?>
&amp;<?php 
                echo $this->manager->getPageName();
                ?>
=<?php 
                echo $row["page"];
                echo $this->createFragmentIdentifier();
                ?>
"><?php 
                echo $this->createHyperlinkAnchor($row);
                ?>
</a>
        <?php 
            }
            ?>
    <?php 
        }
        ?>

    <?php 
        if ($this->manager->getNextPageSeparator() && $this->manager->getNextPage()) {
            ?>
        &nbsp;<a<?php 
            echo $this->createInlineCssClassDeclaration('next_page_class', 'normal_link_class');
            ?>
 title="<?php 
            echo $this->html['next_page_title'];
            ?>
" href="<?php 
            echo $self_uri;
            ?>
?<?php 
            echo $qs;
            echo $this->manager->getPageName();
            ?>
=<?php 
            echo $this->manager->getNextPage();
            ?>
&amp;<?php 
            echo $this->manager->getSeparatorName();
            ?>
=<?php 
            echo $this->manager->getNextPageSeparator();
            echo $this->createFragmentIdentifier();
            ?>
"><?php 
            echo $this->html['next_page_anchor'];
            ?>
</a>
    <?php 
        }
        ?>

    <?php 
        if ($this->view_next_block_label && $this->manager->getNextBlockSeparator()) {
            ?>
        &nbsp;<a<?php 
            echo $this->createInlineCssClassDeclaration('next_block_class', 'normal_link_class');
            ?>
 title="<?php 
            echo $this->html['next_block_title'];
            ?>
" href="<?php 
            echo $self_uri;
            ?>
?<?php 
            echo $qs;
            echo $this->manager->getSeparatorName();
            ?>
=<?php 
            echo $this->manager->getNextBlockSeparator();
            echo $this->createFragmentIdentifier();
            ?>
"><?php 
            echo $this->html['next_block_anchor'];
            ?>
</a>
    <?php 
        }
        ?>

    <?php 
        if ($this->view_last_page_label && $this->manager->getLastSeparator() && $this->manager->getCurrentSeparator() != $this->manager->getLastSeparator()) {
            ?>
        &nbsp;<a<?php 
            echo $this->createInlineCssClassDeclaration('last_page_class', 'normal_link_class');
            ?>
 title="<?php 
            echo $this->html['last_page_title'];
            ?>
" href="<?php 
            echo $self_uri;
            ?>
?<?php 
            echo $qs;
            echo $this->manager->getPageName();
            ?>
=<?php 
            echo $this->manager->getLastPage();
            ?>
&amp;<?php 
            echo $this->manager->getSeparatorName();
            ?>
=<?php 
            echo $this->manager->getLastSeparator();
            echo $this->createFragmentIdentifier();
            ?>
"><?php 
            echo $this->html['last_page_anchor'];
            ?>
</a>
    <?php 
        }
        $str = ob_get_contents();
        ob_end_clean();
        return $str;
    }
Exemplo n.º 2
0
function reviews($mysqli)
{
    if ($_SESSION['status'] == 'superadmin') {
        $selConditionString = "";
    } elseif ($_SESSION['status'] == 'admin') {
        $selConditionString = " WHERE Passengers.idCity = " . $_SESSION['idCity'] . " ";
    }
    $paginationManager = new Krugozor_Pagination_Manager(15, 5, $_REQUEST);
    $result = $mysqli->query("SELECT SQL_CALC_FOUND_ROWS idReview,  \n\t\t\t\t\t\t\t\t\t\ttextReview, \n\t\t\t\t\t\t\t\t\t\ttimeReview, \n\t\t\t\t\t\t\t\t\t\trating, \n\t\t\t\t\t\t\t\t\t\tstatus, \n\t\t\t\t\t\t\t\t\t\tDrivers.phone AS phoneDriver, \n\t\t\t\t\t\t\t\t\t\tPassengers.phone AS phonePassenger \n\t\t\t\t\t\t\t\t\tFROM Reviews \n\t\t\t\t\t\t\t\t\tINNER JOIN \n\t\t\t\t\t\t\t\t\t\tDrivers ON Drivers.idDriver = Reviews.idDriver \n\t\t\t\t\t\t\t\t\tINNER JOIN\n\t\t\t\t\t\t\t\t\t\tPassengers ON Passengers.idPassenger = Reviews.idPassenger \n\t\t\t\t\t\t\t\t\t" . $selConditionString . "ORDER BY status DESC \n\t\t\t\t\t\t\t\t\tLIMIT " . $paginationManager->getStartLimit() . "," . $paginationManager->getStopLimit());
    if ($result) {
        $data['reviews'] = db2Array($result);
        $result = $mysqli->query("SELECT FOUND_ROWS()");
        $numCity = db2Array($result);
        $paginationManager->setCount($numCity[0]['FOUND_ROWS()']);
        $data['paginationManager'] = $paginationManager;
    } else {
        $data['errors'] = $mysqli->error;
    }
    return $data;
}