<?php
defined('BASEPATH') OR exit('No direct script access allowed');

class Modeller extends MY_Controller {


    public function __construct()
    {
        parent::__construct();
        $this->load->model("imageupload_model");
        $this->load->model("file_model");
        $this->load->model('products_model');
        $this->load->model('galeri_model');
    }


	public function index()
	{
        redirect(base_url("anasayfa"));
	}


    public function urungruplari()
    {
        $viewData = new stdClass();

        $this->load->model('products_model');

        $urunler = $this->products_model->get_all
        (
            array
            (
                "isActive"   => 1
            ),  "rank ASC"
        );

        $viewData->urunler = $urunler;
        $viewData->sayfa    = "anasayfa";
        $viewData->nerdengeliyorum = true;
        $viewData->urunler_footer = $this->urunler_footer;
        $viewData->hizmetler_footer = $this->hizmetler_footer;

        $this->load->view('urun_gruplari', $viewData);
    }



    public function urundetay($urunid, $urunadi)
    {

        $viewData = new StdClass();


        $this->load->model('products_model');

        $urunler = $this->products_model->get
        (
            array
            (
               "id" => $urunid,
               "isActive"   => 1
            ), "rank ASC"
        );



        $this->load->model('imageupload_model');
        $digergorsel = $this->imageupload_model->get_all
        (
            array
            (
               "kind" => "products",
               "urunid" => $urunler->id,
               "isCover" => 0,
               "isActive"   => 1
            ), "rank ASC"
        );

        $viewData->urun         = $urunler;
        $viewData->ayar_detay   = $urunler;
        $viewData->dgorsel      = $digergorsel;
        $viewData->galeri      = $digergorsel;
        $viewData->sayfa        = "urun_detay";
        $viewData->folder_name  = "products_v";
        $viewData->img_tur_name = "products";
        $viewData->nerdengeliyorum = "";
        $viewData->urunler_footer = $this->urunler_footer;
        $viewData->hizmetler_footer = $this->hizmetler_footer;


        $this->load->view('urun_detay', $viewData);
    }

}


