Beispiel #1
0
 public function addData($title, $data, $region, $file)
 {
     $setValue = iteraxcontroller::Instance();
     //if file is null then we just add the value sent to the correct region
     if (is_null($file)) {
         $contents = $data;
     } else {
         //if file exist then we include it and get the content after the file has been executed
         if (file_exists($file)) {
             $contents = $this->IncludeFileAndGetContentAsString($file, $data);
         } else {
             $setValue->it->data['theme']['data']['primary'][] = 'The view file doesnt exist :' . $file;
         }
     }
     //add contents to the big data array
     //set title if its not null
     if (!is_null($title)) {
         $setValue->it->data['theme']['data']['data']['browser-title'][] = $title;
     }
     if (isset($setValue->it->data['theme']['data']['regions'][$region])) {
         $setValue->it->data['theme']['data']['regions'][$region][] = $contents;
     } elseif (!is_null($region)) {
         $errorRegion = $setValue->it->data['theme']['data']['data']['error-region'];
         $setValue->it->data['theme']['data']['regions'][$errorRegion][] = '<p class="error">region : ' . $region . ' does not exist</p>';
         $setValue->it->data['theme']['data']['data']['error'][] = 'Region : ' . $region . ' does not exist';
     }
     //debug purpose only
     $setValue->it->data['debug']['including-contents'][$region][] = $contents;
 }
Beispiel #2
0
 public function index()
 {
     //either just adddata to the region or use a view file
     //set file to null if not use view file
     //using array as first arg will need a view file
     $images = array('http://westernchaos.com/site/data/images/uploads/slider/slider/3.jpg', 'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTicICqbGuTr6-UT7QVUIotlECmO05eJ7yAggTdcowxW_eM9903yw');
     $thumbs = array('http://westernchaos.com/site/data/images/uploads/slider/thumb/3-tn.jpg', 'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTicICqbGuTr6-UT7QVUIotlECmO05eJ7yAggTdcowxW_eM9903yw');
     $data = iteraxcontroller::Instance()->GetData('slider', $images, $thumbs, 940);
     //ex 1
     $this->set->addData('Kött och Fisk', array('data' => $data), 'flash', __DIR__ . '/views/dynamic.php');
     //ex 2
     $this->set->addData(null, 'Data in sidebar section', 'sidebar', null);
 }
 public function __construct($controller = null, $method = null, $arguments = array())
 {
     /**
      *
      * Get default routing from project config file
      *
      */
     $routing = iteraxcontroller::Instance()->it->data['config']['routing'];
     $controller = isset($routing['controller']) && $controller == 'not-selected' ? $routing['controller'] : $controller;
     $method = isset($routing['method']) && $method == 'not-selected' ? $routing['method'] : $method;
     /**
      *
      * Include the controller if exists, else include the index controller of the current project
      *
      */
     $controllerEnabled = isset(iteraxcontroller::Instance()->it->data['config']['controllers'][$controller]['enabled']) ? iteraxcontroller::Instance()->it->data['config']['controllers'][$controller]['controller'] : false;
     $controllerDir = isset(iteraxcontroller::Instance()->it->data['config']['controllers'][$controller]['dir']) ? iteraxcontroller::Instance()->it->data['config']['controllers'][$controller]['dir'] : false;
     $path = $controllerDir . '/' . $controllerEnabled . '/' . $controllerEnabled . '.php';
     if (file_exists($path)) {
         include_once $path;
         $classExists = $controller != false ? class_exists($controllerEnabled) : null;
         if ($controllerEnabled != null && $classExists != null) {
             if (!is_null($controllerEnabled)) {
                 $reflect = new ReflectionClass($controllerEnabled);
                 //check if method exists and is callable
                 if ($reflect->hasMethod($method)) {
                     $controllerObj = $reflect->newInstance();
                     $methodObj = $reflect->getMethod($method);
                     if ($methodObj->isPublic()) {
                         $methodObj->invokeArgs($controllerObj, $arguments);
                     } else {
                         //Controller method not public
                     }
                 } else {
                     //method not public
                 }
             } else {
                 //class does not exist or is not enabled
             }
         } else {
             //page not found
         }
     } else {
         //file does not exist and could not be included
     }
 }
Beispiel #4
0
 public function GetSlider($images = array(), $thumbs = array(), $width)
 {
     $it = iteraxcontroller::Instance()->it;
     $it->data['theme']['javascript']['url']['bottom'][] = $it->request->base_url() . 'core/lib/data/slider/includes/amazingslider.js';
     $it->data['theme']['javascript']['url']['bottom'][] = $it->request->base_url() . 'core/lib/data/slider/includes/initslider-1.js';
     $it->data['theme']['javascript']['url']['bottom'][] = $it->request->base_url() . 'core/lib/data/slider/includes/modernizr.js';
     $it->data['theme']['javascript']['inline']['bottom'][] = '
     var left = ((document.getElementById("amazingslider-1").parentNode.parentNode.offsetWidth)-' . $width . ')/2;
     document.getElementById("amazingslider-1").parentNode.setAttribute("style","width:' . $width . 'px; margin-left:"+left+"px;");
     ';
     $data = '';
     $data .= '<div id="amazingslider-1" style="display:block;position:relative;margin:16px auto 56px;">
                 <ul class="amazingslider-slides" style="display:none;">';
     foreach ($images as $image) {
         $data .= '<li><img src="' . $image . '" alt="" /></li>';
     }
     $data .= '</ul>';
     $data .= '<ul class="amazingslider-thumbnails" style="display:none;">';
     foreach ($thumbs as $thumb) {
         $data .= '<li><img src="' . $thumb . '" alt="" /></li>';
     }
     $data .= '</ul></div>';
     return $data;
 }
Beispiel #5
0
define('ROOTPROJECT', 'base');
define('PROJECTROOT', ROOT . 'project/');
define('THEMEPATH', ROOT . 'theme/');
/**
 * Constant PROJECT will be created later on and will be available
 */
/**
 *
 * Include boot.php and functions.php in core folder to initiate some functions
 *
 */
require_once CORE . 'boot/boot.php';
require_once CORE . 'boot/functions.php';
require_once CORE . 'iteraxcontroller.php';
/**
 *
 * Start the iterax core controller
 *
 * Set the project,controller,method and args
 *
 * Include the config file from project folder
 *
 * everything will be handled through iteraxcontroller from this point
 *
 */
$iterax = iteraxcontroller::Instance();
$iterax->ReadRequest();
$iterax->IncludeConfigFiles();
$iterax->Session('init');
$iterax->Include_Request_Controller('init');
$iterax->RenderTheme('render');
Beispiel #6
0
 public function __construct()
 {
     $set = iteraxcontroller::Instance();
     $this->db = $set->db();
     $this->set = $set;
 }
Beispiel #7
0
 public function base_url()
 {
     $url = 'http';
     $url .= @$_SERVER["HTTPS"] == "on" ? 's' : '';
     $url .= "://";
     $url .= $_SERVER["SERVER_NAME"];
     $url .= '/';
     $url .= iteraxcontroller::Instance()->it->data['config']['base_url'];
     return $url;
 }
function PrintDebug()
{
    return iteraxcontroller::Instance()->Debug();
}
 /**
  * Get the instance of the latest created object or create a new one.
  */
 public static function Instance()
 {
     return is_null(self::$instance) ? self::$instance = new static() : self::$instance;
 }