public function index()
 {
     if (!$this->loggedIn()) {
         header('Location: index.php?c=login&m=login');
     }
     $data = array();
     $clientsCollection = new ClientsCollection();
     $page = isset($_GET['page']) ? (int) $_GET['page'] : 1;
     $perPage = 5;
     $offset = $page ? ($page - 1) * $perPage : 0;
     $rows = count($clientsCollection->getAll());
     $pagination = new Pagination();
     $pagination->setPerPage($perPage);
     $pagination->setTotalRows($rows);
     $pagination->setBaseUrl("http://localhost/Lectures/Lek15/softacadTours/admin/index.php?c=client&m=index");
     $users = $clientsCollection->getAll(array(), $offset, $perPage);
     $data['users'] = $users;
     $data['pagination'] = $pagination;
     $this->loadView('clients/listing', $data);
 }
 public function index()
 {
     if (!$this->loggedIn()) {
         header('Location: index.php?c=login&m=login');
     }
     $data = array();
     //users
     $userCollection = new UserCollection();
     $users = count($userCollection->getAll());
     //customers
     $clientCollection = new ClientsCollection();
     $client = count($clientCollection->getAll());
     //tours
     $toursCollection = new ToursCollection();
     $tours = count($toursCollection->getAll());
     //blog posts
     $blogpostCollection = new BlogCollection();
     $blogs = count($blogpostCollection->getAll());
     $data['users'] = $users;
     $data['client'] = $client;
     $data['tours'] = $tours;
     $data['blogs'] = $blogs;
     $this->loadView('dashboard', $data);
 }
Esempio n. 3
0
require_once 'header.php';
?>

<?php 
require_once 'nav.php';
?>
<!-- Header Carousel -->

<?php 
$errors = array();
if (isset($_POST['username']) && isset($_POST['password']) && strlen($_POST['username']) > 3 && strlen($_POST['password']) > 3) {
    $password = sha1($_POST['password']);
    $clientsCollection = new ClientsCollection();
    $username = htmlspecialchars(trim($_POST['username']));
    $where = array('username' => $username);
    $result = $clientsCollection->getAll($where);
    if ($result != null && $result[0]->getPassword() == $password) {
        $_SESSION['client'] = $result[0];
        header('Location: index.php');
    } else {
        $errors['login'] = '******';
    }
}
?>


<!-- Page Content -->
<div class="container">

    <!-- Page Heading/Breadcrumbs -->
    <div class="row">