Esempio n. 1
0
 public function init()
 {
     require_once 'Modela/Loader.php';
     $loader = Modela_Loader::getInstance();
     $loader->loadModels($this->_options['modelsPath']);
     $modela = Modela_Core::getInstance();
     $modela->setHostname($this->_options["hostname"]);
     $modela->setDatabase($this->_options["database"]);
     if ($this->_options['useAuthentication']) {
         $modela->setUsername($this->_options['username']);
         $modela->setPassword($this->_options['password']);
     }
     return $modela;
 }
Esempio n. 2
0
 public function run()
 {
     if ($this->_options['database']) {
         Modela_Core::getInstance()->setDatabase($this->_options['database']);
     }
     switch ($this->_action) {
         case "loadviews":
             if ($this->_options['viewspath']) {
                 $viewsPath = $this->_options['viewspath'];
             } else {
                 $viewsPath = realpath(getcwd());
             }
             Modela_View::loadViews($viewsPath);
             break;
     }
 }
Esempio n. 3
0
 public function getAttachmentUrl($attachmentFilename)
 {
     $core = Modela_Core::getInstance();
     $url = $core->getBaseUrl(true);
     $url .= '/' . $this->_id . '/' . $attachmentFilename;
     return $url;
 }
Esempio n. 4
0
 public static function reset()
 {
     self::$_instance = null;
 }