<?php

class Partners extends Controller
{

    private function getSEO()
    {
        $url = parse_url($_SERVER['REQUEST_URI']);
        $slug = $url['path'];
        $result = $this->loadModel("SeoModel")->retrieveAllData("WHERE `slug` =? ", array($slug));
        if($result && count($result)) {
            $seo = $result[0];
        } else {
            $seo = [
                'slug' => null,
                'title' => null,
                'keywords' => null,
                'content' => null
            ];
        }

        return $seo;
    }

    public function index()

    {
        $dataView['SEO'] = $this->getSEO();
        $dataView['current'] = "partners";
        //partners
        $dataView['partners'] = $this->loadModel("PartnersModel")->retrieveAllData("WHERE `status` =? AND `deleted` =?", array(1, 1));
        if (is_array($dataView['partners'])) {
            foreach ($dataView['partners'] as $key => $value) {
                // get ar and en Data
                $dataView['partnersLang'][$key] = $this->loadModel("PartnersEnModel")->retriveDataById("id_partners", $value['id']);

            }
        }



        // set page title
        $dataView['title'] = "Eg  | Partners ";
        // global Template Config
        global $TEMPLATE_FRONT_END;
        // set content
        $TEMPLATE_FRONT_END['files']['content'] = FRONT_END_CONTROL_PATH . "partners_view";
        // load template
        $this->loadTemplate($TEMPLATE_FRONT_END, $dataView)->render();

    }



}

?>
