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

class CustomerScreen extends CI_Controller
{
    public function index()
    {
        $data = array(
            "mode"                => "customer_view",
            "title"               => "Selamat Berbelanja",
            "login_name"          => $this->session->login['nama']
        );
        $this->load->view("customer_view", $data);
    }
    public function bannerAds()
    {

        $arrIklan = array();

        $this->load->model("Mdls/MdlAdvertise");
        $o = new MdlAdvertise();
        $indexFieldName = "id";
        $fieldData = $o->getFields();

        $o->addFilter("status='1'");
        $arrIklan = $o->lookupAll()->result();

        $content  = "";
        if(count($arrIklan)>0){
            $content .= "<div class='' style=''>";
            foreach($arrIklan as $k=>$dataIklan){
//                $blobDataImg = blobDecode($dataIklan->image);
//                $imageAvail = base64_encode($blobDataImg['image']);
                $imageAvail = $dataIklan->image;
                $content .= "<img class='mySlides' src='$imageAvail' style='border-radius:14px;width:100%'>";
            }
            $content .= "</div>";
        }

        $data = array(
            "mode"                => "bannerAds",
            "content"             => "$content",
            "title"               => "shopping cart data",
            "login_name"          => $this->session->login['nama']
        );
        $this->load->view("customer_view", $data);
    }
    public function shoppingCart()
    {
        $data = array(
            "mode"                => "shoppingCart",
            "title"               => "customer screen",
            "subTitle"               => "bought items",
            "login_name"          => $this->session->login['nama']
        );
        $this->load->view("customer_view", $data);
    }
}
