Example #1
0
 function render($template)
 {
     if (isset($this->_controller->title)) {
         $this->set('title', $this->_controller->title);
     }
     $controller = strtolower(str_replace('controllers\\', '', get_class($this->_controller)));
     $tpl = '/views/' . $controller . '/' . $template . '.tpl';
     if (file_exists(\lib\Configure::read('root_dir') . $tpl)) {
         $rendered = $this->_template->render(\lib\Configure::read('root_dir') . $tpl);
     } elseif (file_exists(\lib\Configure::read('locus_dir') . $tpl)) {
         $rendered = $this->_template->render(\lib\Configure::read('locus_dir') . $tpl);
     } else {
         throw new \Exception("FATAL ERROR");
     }
     if (strlen($this->_controller->use_layout) > 0) {
         if ($this->_controller->auto_render == true) {
             return $this->layout($rendered);
         } else {
             print $this->layout($rendered);
         }
     } else {
         if ($this->_controller->auto_render == true) {
             return $rendered;
         } else {
             print $rendered;
         }
     }
 }
Example #2
0
 function __construct()
 {
     spl_autoload_unregister('\\App\\locus_autoload');
     include_once \lib\Configure::read('locus_dir') . DIRECTORY_SEPARATOR . 'lib/external/dwoo/dwooAutoload.php';
     $this->_dwoo = new \Dwoo();
     $locus = \lib\Configure::read('locus_dir') . '/app/dwoo/plugins';
     $root = \lib\Configure::read('root_dir') . '/app/dwoo/plugins';
     if (file_exists($locus)) {
         $this->_dwoo->getLoader()->addDirectory($locus);
     }
     if (file_exists($root)) {
         $this->_dwoo->getLoader()->addDirectory($root);
     }
     spl_autoload_register('\\App\\locus_autoload');
     $this->set('Locus', true);
 }
Example #3
0
<?php

namespace app;

use lib\Configure;
chdir('..');
$root_dir = getcwd();
$locus_dir = 'C:/var/www/vhosts/locus';
require $locus_dir . '/conf/init.php';
require $root_dir . '/conf/conf.php';
require $root_dir . '/conf/routes.php';
Configure::write('root_dir', $root_dir);
Configure::write('locus_dir', $locus_dir);
try {
    $routes->path();
} catch (Exception $e) {
    include 'errors/fatal_error.php';
}
Example #4
0
<?php

namespace app;

use lib\Configure;
Configure::getInstance();
Configure::write('version', '0.1.3');
Configure::write('database', array('connect' => 'mongodb://localhost:27017', 'database' => 'timesheet'));
Configure::write('template_engine', 'dwoo');
use lib\db\Mongo;
Mongo::getInstance();
Mongo::init(Configure::read('database'));
Example #5
0
 public function index()
 {
     $version = Configure::read('version');
     $this->set('database', $this->Page->can_connect());
     $this->set(compact('version'));
 }