<?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 = 'slider';

        require_once("header.php");
        require_once("footer.php");
    }

    //here the frist page and
    //the frist action in this class
    public function index() {
        $id = filter_input(INPUT_GET, 'ac');
        $services = R::load('services', $id);
        if ($services->id != $id) {
            header('location:' . $this->hosturl);
        }
        $this->smarty->assign('services', $services);
//        $this->smarty->assign('folder', 'slider');
        //productscategory
        $catproducts = R::getAll("select brandproduct.*,brandproductgallery.name
                from brandproduct
                join brandproductgallery on brandproductgallery.product_id = brandproduct.id
                join services on services.id = brandproduct.brand_id
                where brandproduct.del=0 and brandproduct.brand_id=$id");
        $this->smarty->assign('catproducts', $catproducts);

        header::headershow($this->smarty, $this->hosturl);
        $this->smarty->display('templates/' . default_lang_interface . '/brandpro.html');
        footer::footershow($this->smarty, $this->hosturl);
    }

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

}
