public function index()
 {
     $data = array();
     $blogCollection = new BlogCollection();
     $page = isset($_GET['page']) ? (int) $_GET['page'] : 1;
     $perPage = 5;
     $offset = $page ? ($page - 1) * $perPage : 0;
     $rows = count($blogCollection->getAll());
     $pagination = new Pagination();
     $pagination->setPerPage($perPage);
     $pagination->setTotalRows($rows);
     $pagination->setBaseUrl("http://localhost/Lectures/Lek15/softacadTours/index.php?c=blog&m=index");
     $blogs = $blogCollection->getAll(array(), $offset, $perPage);
     $data['blogs'] = $blogs;
     $data['pagination'] = $pagination;
     $this->loadFrontView('blog/listing', $data);
 }
 public function index()
 {
     $data = array();
     //last 3 blog posts
     $blogCollection = new BlogCollection();
     $lastBlogposts = $blogCollection->getAll(array(), 3, 0, array('id', 'DESC'));
     //random 6 tours
     $toursCollection = new ToursCollection();
     $randomTours = $toursCollection->getAll(array(), 6, 0, array('id', 'desc'), array(), 1);
     $data['lastBlogPosts'] = $lastBlogposts;
     $data['randomTours'] = $randomTours;
     $this->loadFrontView('landingPage', $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);
 }