<?php
/**
 * @link      http://github.com/zendframework/ZendSkeletonApplication for the canonical source repository
 * @copyright Copyright (c) 2005-2016 Zend Technologies USA Inc. (http://www.zend.com)
 * @license   http://framework.zend.com/license/new-bsd New BSD License
 */

namespace Application\Controller;

use Zend\Mvc\Controller\AbstractActionController;
use Zend\View\Model\ViewModel;
use Khansia\Generic\Result;

class AdminController extends \Application\Master\GlobalActionController 
{
    public function __construct($headScript)
    {
        $this->headScript = $headScript;
    }

    public function indexAction()
    {
        echo 'forbidden';die;
    }
    public function dasboardAction()
    {
		$this->isLoggedIn();
        $view   = new ViewModel();
        $result = new Result();
        
      
       $uri     = $this->getRequest()->getUri();
       $baseurl = sprintf('//%s', $uri->getHost());

       $this->headScript->appendScript(' var baseURL = "' . $baseurl . '"');        
       $this->headScript->appendFile('/action-js/antrian-js/action-dasboaard.js');
    //    $this->headScript->appendFile('/tamplateadmin/js/demo/chart-bar-demo.js');
    //    $this->headScript->appendFile('/tamplateadmin/js/demo/chart-area-demo.js');
       $this->headScript->appendFile('/tamplateadmin/js/demo/chart-pie-demo.js');

        $this->layout("layout/layoutAdmin");
        return $view;
    }
    public function antrianadminAction()
    {
		$this->isLoggedIn();
        $view   = new ViewModel();
        $result = new Result();
        
        /* get url */
        $uri     = $this->getRequest()->getUri();
        $baseurl = sprintf('//%s', $uri->getHost());
        $getpath =  explode("/",$uri->getPath()); 
        // echo "<pre>";
       
        $id = $getpath[3];
        
                
        // $curl = curl_init();

        // curl_setopt_array($curl, array(
        // CURLOPT_URL => "http://queue.indra/api/nextantrian",
        // CURLOPT_RETURNTRANSFER => true,
        // CURLOPT_ENCODING => "",
        // CURLOPT_MAXREDIRS => 10,
        // CURLOPT_TIMEOUT => 0,
        // CURLOPT_FOLLOWLOCATION => true,
        // CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
        // CURLOPT_CUSTOMREQUEST => "POST",
        // CURLOPT_POSTFIELDS => array('inoantrian' => '7','idok' => '74','istatus' => '40'),
        // ));

        // $response = curl_exec($curl);

        // curl_close($curl);
        // echo $response;

        // $data = json_decode(file_get_contents('php://input'),true);
        
        // echo $data;
        // print_r($data);
        
        $this->headScript->appendScript(' var baseURL = "' . $baseurl . '"');   
        $this->headScript->appendScript(' var id = "' . $id . '"');       
        $this->headScript->appendFile('/action-js/antrian-js/action-admin.js');

        $this->layout("layout/layoutAdmin");
        return $view;
    }
    public function registrasidokterAction()
    {
		$this->isLoggedIn();
        $view   = new ViewModel();
        $result = new Result();
        
        /* get url */
        $uri     = $this->getRequest()->getUri();
        $baseurl = sprintf('//%s', $uri->getHost());

        $this->headScript->appendScript(' var baseURL = "' . $baseurl . '"');        
        $this->headScript->appendFile('/action-js/antrian-js/action-registrasidokter.js');

        $this->layout("layout/layoutAdmin");
        return $view;
    }

 
    public function antrianterlewatAction()
    {
		$this->isLoggedIn();
        $view   = new ViewModel();
        $result = new Result();
        
        /* get url */
        $uri     = $this->getRequest()->getUri();
        $baseurl = sprintf('//%s', $uri->getHost());

        $this->headScript->appendScript(' var baseURL = "' . $baseurl . '"');        
        $this->headScript->appendFile('/action-js/antrian-js/action-kelolaantrian.js');

        $this->layout("layout/layoutAdmin");
        return $view;
    }
    public function antrianunregisterAction()
    {
		$this->isLoggedIn();
        $view   = new ViewModel();
        $result = new Result();
        
        /* get url */
        $uri     = $this->getRequest()->getUri();
        $baseurl = sprintf('//%s', $uri->getHost());

        $this->headScript->appendScript(' var baseURL = "' . $baseurl . '"');        
        $this->headScript->appendFile('/action-js/antrian-js/action-kelolaantrianunreg.js');

        $this->layout("layout/layoutAdmin");
        return $view;
    }
    public function kelolapoliAction()
    {
		$this->isLoggedIn();
        $view   = new ViewModel();
        $result = new Result();
        
        /* get url */
        $uri     = $this->getRequest()->getUri();
        $baseurl = sprintf('//%s', $uri->getHost());

        $this->headScript->appendScript(' var baseURL = "' . $baseurl . '"');        
        $this->headScript->appendFile('/action-js/antrian-js/action-kelolapoli.js');

        $this->layout("layout/layoutAdmin");
        return $view;
    }
    public function keloladokterAction()
    {
		$this->isLoggedIn();
        $view   = new ViewModel();
        $result = new Result();
        
        /* get url */
        $uri     = $this->getRequest()->getUri();
        $baseurl = sprintf('//%s', $uri->getHost());

        $this->headScript->appendScript(' var baseURL = "' . $baseurl . '"');        
        $this->headScript->appendFile('/action-js/antrian-js/action-keloladokter.js');

        $this->layout("layout/layoutAdmin");
        return $view;
    }
    public function kelolapasienAction()
    {
		$this->isLoggedIn();
        $view   = new ViewModel();
        $result = new Result();
        
        /* get url */
        $uri     = $this->getRequest()->getUri();
        $baseurl = sprintf('//%s', $uri->getHost());

        $this->headScript->appendScript(' var baseURL = "' . $baseurl . '"');        
        $this->headScript->appendFile('/action-js/antrian-js/action-kelolapasien.js');

        $this->layout("layout/layoutAdmin");
        return $view;
    }
    public function kelolaruanganAction()
    {
		$this->isLoggedIn();
        $view   = new ViewModel();
        $result = new Result();
        
        /* get url */
        $uri     = $this->getRequest()->getUri();
        $baseurl = sprintf('//%s', $uri->getHost());

        $this->headScript->appendScript(' var baseURL = "' . $baseurl . '"');        
        $this->headScript->appendFile('/action-js/antrian-js/action-kelolaruang.js');

        $this->layout("layout/layoutAdmin");
        return $view;
    }
    public function tableAction()
    {
		$this->isLoggedIn();
        $view   = new ViewModel();
       // $result = new Result();
        
        /* get url */
       // $uri     = $this->getRequest()->getUri();
       // $baseurl = sprintf('//%s', $uri->getHost());

        //$this->headScript->appendScript(' var baseURL = "' . $baseurl . '"');        
        //$this->headScript->appendFile('/action-js/index-js/action-listdata.js');

        $this->layout("layout/layoutAdmin");
        return $view;
    }

    public function tampilanumumAction()
    {
		$this->isLoggedIn();
        $view   = new ViewModel();
        $result = new Result();

        $today      = gmdate("d M Y ", time()+60*60*7);
        $view->setVariable('today', $today);
        
        /* get url */
       $uri     = $this->getRequest()->getUri();
        $baseurl = sprintf('//%s', $uri->getHost());

       $this->headScript->appendScript(' var baseURL = "' . $baseurl . '"');        
       $this->headScript->appendFile('/action-js/antrian-js/action-umum.js');

        $this->layout("layout/layoutAdmin");
        return $view;
    }
}
