Beispiel #1
0
//Set the Template root, and set the header and footer
$tmpl = new fTemplating($root_path . '/views/');

$tmpl->enableMinification('development', dirname(__FILE__) . '/../js_cache/',dirname(__FILE__) . '/..');

$tmpl->add('css','/bootstrap/bootstrap.min.css'); 
$tmpl->add('css','/assets/css/jquery-ui.css');

$tmpl->add('js','/assets/js/jquery.min.js'); 
$tmpl->add('js','/assets/js/jquery-ui.min.js'); 
$tmpl->add('js','/assets/js/jquery.collapsible.js'); 
$tmpl->add('js','/assets/js/jquery.graphite.js');

$tmpl->add('js','/bootstrap/js/bootstrap-modal.js');
$tmpl->add('js','/bootstrap/js/bootstrap-twipsy.js');
$tmpl->add('js','/bootstrap/js/bootstrap-popover.js');


$tmpl->set('header', 'header.php');
$tmpl->set('footer', 'footer.php');

//Set DB connection (using flourish it isn't actually connected to until the first use)
$mysql_db  = new fDatabase('mysql', $database_name, $database_user, $database_password);

//Connect the db to the ORM functions
fORMDatabase::attach($mysql_db);

//Start the Flourish Session
fSession::open();
Beispiel #2
0
<?php

include dirname(__FILE__) . '/config.php';
/**
 * Template Initialization
 */
$tmpl = new fTemplating(DOC_ROOT . '/resources/templates/');
$tmpl->set('title', $config["title"]);
$tmpl->set('version', $config['version']);
$tmpl->set('header', 'header.php');
$tmpl->set('menu', 'menu.php');
$tmpl->set('menuInventory', 'inventory-menu.php');
$tmpl->set('menuAdmin', 'admin-menu.php');
$tmpl->set('menuDocument', 'document-menu.php');
$tmpl->set('menuReport', 'report-menu.php');
$tmpl->set('footer', 'footer.php');
$tmpl->add('js', './resources/library/jquery/js/jquery-1.3.2.min.js');
$tmpl->add('js', './resources/library/jquery/js/jquery-ui-1.7.2.custom.min.js');
$tmpl->add('js', './resources/templates/main.js');
$tmpl->add('js', './resources/library/datejs/date.js');
$tmpl->add('css', array('path' => './resources/library/blueprint/screen.css', 'media' => 'screen, projection'));
$tmpl->add('css', array('path' => './resources/library/blueprint/print.css', 'media' => 'print'));
$tmpl->add('css', './resources/library/jquery/css/cupertino/jquery-ui-1.7.2.custom.css');
$tmpl->add('css', './css/style.css');
// Connecting to a MySQL database on the server
$db = new fDatabase('mysql', $config['db']['dbName'], $config['db']['dbUsername'], $config['db']['password'], $config['db']['dbHost']);
fORMDatabase::attach($db);
fSession::open();
Beispiel #3
0
if ($lang != NULL) {
    fCookie::set('safecast_lang', $lang, '+1 year', '/', '.safecast.org');
}
if ($lang == NULL) {
    $lang = fCookie::get('safecast_lang', 'en');
}
// get language file
$lang_file = DOC_ROOT . '/lang/' . $lang . '.json';
if (!file_exists($lang_file)) {
    $lang_file = DOC_ROOT . '/lang/en.json';
}
$file = new fFile($lang_file);
$lang_file_content = $file->read();
//print_r("file content: ".$lang_file_content);
$translations = json_decode($lang_file_content);
//print_r('file: '.$lang_file);
//print_r('************'.$translations.'^^^^^^^^^^^^^^^');
//die;
$tmpl = new fTemplating(DOC_ROOT . '/views/');
$tmpl->set('header', 'header.php');
$tmpl->set('header_headless', 'header_headless.php');
$tmpl->set('info_header', 'info_header.php');
$tmpl->set('footer', 'footer.php');
$tmpl->set('lang', $lang);
require_once DOC_ROOT . '/Browser.php';
$mobile = mobile_device_detect(true, false, true, true, true, true, true, false, false);
if ($mobile) {
    $tmpl->add('css', 'style/mobile.css');
} else {
    $tmpl->add('css', 'style/base.css');
}
Beispiel #4
0
 $config->features = new Config();
 // Include base config file
 require_once dirname(__FILE__) . '/config/config.default.php';
 // Include custom config file
 if (file_exists(DOC_ROOT . '/inc/config/config.php')) {
     require_once dirname(__FILE__) . '/config/config.php';
 }
 // Debugging assistance
 fCore::enableDebugging(config_item('debug', FALSE));
 //fCore::enableErrorHandling(DOC_ROOT . '/error.log');
 //fCore::enableExceptionHandling(DOC_ROOT . '/exceptions.log');
 fCore::enableErrorHandling('html');
 fCore::enableExceptionHandling('html');
 // Set page template
 $tpl = new fTemplating(DOC_ROOT . '/views/template');
 $tpl->set('header', 'header.php');
 $tpl->set('footer', 'footer.php');
 $tpl->set('menu', 'menu.php');
 // @TODO remove these when the thresholds become configurable.
 global $status;
 $status[3] = array('OK', '73D216');
 // 3+ OK
 $status[2] = array('Low', 'EDD400');
 // 2+ Warning
 $status[0] = array('Critical', 'CC0000');
 // 0: Empty - bad.
 // Set up database connection
 $db = new fDatabase('mysql', config_item('db_name'), config_item('db_user'), config_item('db_pass'), config_item('db_host'), config_item('db_port'));
 fORMDatabase::attach($db);
 // Configure session
 fSession::setPath(config_item('session_path'));
 public function testPlaceSubTemplate()
 {
     $tmpl = new fTemplating();
     $tmpl2 = new fTemplating($_SERVER['DOCUMENT_ROOT'], './resources/php/main.php');
     $tmpl->set('foo', $tmpl2);
     ob_start();
     $tmpl->place('foo');
     $output = ob_get_clean();
     $this->assertEquals('file path: ' . $_SERVER['DOCUMENT_ROOT'] . str_replace('/', DIRECTORY_SEPARATOR, '/resources/php/main.php'), $output);
 }