<?php

/*
 * awframework from aw.inc present aw controller
 * it will help you develop easy and fast with secure tools
 * you can edit and add what you feel right
 * don't change in strucure of file
 */

require_once("imp/_imp.php");

class Controllers {

    //public vars
    public $smarty;
    public $hosturl;

    // it will run in everytime with
    // default requried
    public function __construct() {
        require_once("../public/aw_config.php");
        $this->smarty = $smarty;
        $this->hosturl = $hosturl;


        $controlname = 'client';
        $this->smarty->assign('client', 1);
        require_once("header.php");
        require_once("footer.php");
    }

    //here the frist page and
    //the frist action in this class
    public function index() {
        header::headershow($this->smarty, $this->hosturl);
        $id = (int) filter_input(INPUT_GET, 'ac');
        if (empty($id)) {
            $allClient = R::findAll("clients", "del =0 and hide = 0");

            $this->smarty->assign('allClient', $allClient);
        } else {
            $client = R::load('clients', $id);
            if ($client->id != $id) {
                header('location:' . $this->hosturl);
            }
            $this->smarty->assign('client', $client);
            //$this->smarty->assign('folder', 'page');
        }
        $this->smarty->display('templates/' . default_lang_interface . '/testemonials-page.html');
        footer::footershow($this->smarty, $this->hosturl);
    }

// at the end of class call
    public function __destruct() {
//close connection
        R::close();
    }

}
