<?php
class Shopware_Controllers_Backend_SITSCreditpass extends Shopware_Controllers_Backend_ExtJs {
    
	/**
     * This function add the template directory
     */
    public function init() {

        $this->View()->addTemplateDir( dirname(__FILE__) . "/../../Views/" );
        parent::init();
    }

    /**
     * index action is called if no other action is triggered
     * @return void
     */
    public function indexAction() {
        
    	$this->View()->loadTemplate("backend/sits_creditpass/app.js");
    }
    
    /**
     * 
     */
    public function getScriptDataAction() {
    	
    	$baseUrl = "//" . $_SERVER["HTTP_HOST"] . str_replace("shopware.php", "", $_SERVER["SCRIPT_NAME"]);
        $auth = Shopware()->Auth();
		$user = $auth->getIdentity();
		
		$result = array(
			"userName" => $user->username,
			"basePath" => $baseUrl,
			"adminHtml" => '<div id="sitMain"></div>',
		);
		
		$this->View()->assign(
			array('success' => true, 'data' => $result)
		);
    }  
}