Example #1
0
 public static function init($config = array())
 {
     //-- todo : load log handler here
     // load system config
     sys::import('webi.config');
     wbConfig::init();
     // load variables handler, server/request/response utilities
     sys::import('webi.server');
     sys::import('webi.nusoap');
     // load template, page handler
     sys::import('webi.template');
     sys::import('webi.htmlElementWidget');
     wbPage::init();
     // load database
     sys::import('webi.db');
     $dbConnParams = array('name' => wbConfig::get('DB.name'), 'user' => wbConfig::get('DB.user'), 'password' => wbConfig::get('DB.password'), 'host' => wbConfig::get('DB.host'), 'type' => wbConfig::get('DB.type'));
     wbDB::init($dbConnParams);
     // load session handler
     sys::import('webi.sessions');
     wbSession::init();
     //-- todo : load language system
     // load utilities function
     sys::import('webi.utils');
     // load module handler
     sys::import('webi.modules');
     sys::import('webi.crud.AbstractTable');
     //-- todo : load users and security system
     sys::import('webi.users');
     wbUser::init();
     sys::import('webi.security');
     return true;
 }
 function __construct()
 {
     $dbConnParams = array('name' => wbConfig::get('DB.name'), 'user' => wbConfig::get('DB.user'), 'password' => wbConfig::get('DB.password'), 'host' => wbConfig::get('DB.host'), 'type' => wbConfig::get('DB.type'));
     wbDB::init($dbConnParams);
     $this->dbconn =& wbDB::getConn();
     if (count($this->displayFields)) {
         if ($this->dbconn->dataProvider == 'mysql' || $this->dbconn->dataProvider == 'oci8') {
             $this->selectClause .= ", CONCAT(" . implode(", ' - ' ,", $this->displayFields) . ") AS _display_field_";
             $this->likeOperator = " LIKE ";
         } else {
             if ($this->dbconn->dataProvider == 'postgres') {
                 $this->selectClause .= ", " . implode(" || ' - ' || ", $this->displayFields) . " AS _display_field_";
                 $this->likeOperator = " ILIKE ";
             }
         }
     }
     if ($this->dbconn->dataProvider == 'mysql' || $this->dbconn->dataProvider == 'oci8') {
         $this->likeOperator = " LIKE ";
     } else {
         if ($this->dbconn->dataProvider == 'postgres') {
             $this->likeOperator = " ILIKE ";
         }
     }
 }