Exemplo n.º 1
0
 public function __construct()
 {
     parent::__construct();
     // Creating a controller service for comments
     $this->set('CommentController', function () {
         $controller = new \Phpmvc\Comment\CommentController();
         $controller->setDI($this);
         return $controller;
     });
     // Creating a model service for comments
     $this->set('comments', function () {
         //            $comments = new \Phpmvc\Comment\CommentsInSession();
         $comments = new \Phpmvc\Comment\Comment();
         $comments->setDI($this);
         return $comments;
     });
     // Database service (from mos vendor)
     $this->set('db', function () {
         $db = new \Mos\Database\CDatabaseBasic();
         $db->setOptions(require ANAX_APP_PATH . 'config/database_sqlite.php');
         $db->connect();
         return $db;
     });
     // Form service (from mos vendor)
     $this->set('form', '\\Mos\\HTMLForm\\CForm');
     // Controller for forms
     $this->set('FormController', function () {
         $controller = new \Anax\HTMLForm\FormController();
         $controller->setDI($this);
         return $controller;
     });
     // Controller for User-actions
     $this->set('UsersController', function () {
         $controller = new \Anax\Users\UsersController();
         $controller->setDI($this);
         return $controller;
     });
     // Request-recorder service
     $this->set('recorder', function () {
         $dbh = new \Kajja\Recorder\RequestDatabase();
         $dbh->setOptions(['dsn' => 'sqlite:' . ANAX_APP_PATH . '.htphpmvc.sqlite', 'fetch_mode' => \PDO::FETCH_ASSOC]);
         $dbh->connect();
         $formatter = new \Kajja\Recorder\HTMLFormatter();
         $recorder = new \Kajja\Recorder\RequestRecordAnax($dbh, $formatter, $this);
         return $recorder;
     });
 }
Exemplo n.º 2
0
 /**
  * Construct.
  *
  */
 public function __construct()
 {
     parent::__construct();
     $this->setShared('db', function () {
         $db = new \Mos\Database\CDatabaseBasic();
         if (isset($_SERVER['HTTP-HOST'])) {
             if ($_SERVER['HTTP-HOST'] == 'localhost') {
                 $db->setOptions(require ANAX_APP_PATH . 'config/config_mysql.php');
             }
         } else {
             $db->setOptions(require ANAX_APP_PATH . 'config/config_mysql_bth.php');
         }
         $db->connect();
         return $db;
     });
     $this->setShared('form', function () {
         $form = new \Mos\HTMLForm\CForm();
         $this->session;
         //$form->saveInSession = true;
         return $form;
     });
     // Set controllers
     $this->set('CommentController', function () {
         $controller = new \Phpmvc\Comment\CommentController();
         $controller->setDI($this);
         return $controller;
     });
     $this->set('UsersController', function () {
         $controller = new \Anax\Users\UsersController();
         $controller->setDI($this);
         return $controller;
     });
     $this->set('FormController', function () {
         $controller = new \Anax\HTMLForm\FormController();
         $controller->setDI($this);
         return $controller;
     });
     $this->set('logger', function () {
         $logger = new \Eden\Log\Clog();
         //$controller->setDI($logger);
         return $logger;
     });
 }
 /**
  * Construct.
  *
  */
 public function __construct()
 {
     parent::__construct();
     $this->setShared('theme', function () {
         $themeEngine = new \Anax\ThemeEngine\CThemeExtended();
         $themeEngine->setDI($this);
         $themeEngine->configure(ANAX_APP_PATH . 'config/theme.php');
         return $themeEngine;
     });
     // Forms service
     $this->set('form', '\\Mos\\HTMLForm\\CForm');
     // Database service for Anax
     $this->setShared('db', function () {
         $db = new \Mos\Database\CDatabaseBasic();
         $db->setOptions(require ANAX_APP_PATH . 'config/config_sqlite.php');
         $db->connect();
         return $db;
     });
     // Flash messages
     $this->setShared('flashmessage', function () {
         $flashmessages = new \helikopterspark\FlashMsg\FlashMsg();
         $flashmessages->setDI($this);
         return $flashmessages;
     });
     // Comments
     $this->set('CommentsController', function () {
         $commentscontroller = new \CR\Comment\CommentsController();
         $commentscontroller->setDI($this);
         return $commentscontroller;
     });
     // Users
     $this->set('UsersController', function () {
         $userscontroller = new \Anax\Users\UsersController();
         $userscontroller->setDI($this);
         return $userscontroller;
     });
     $this->setShared('logger', function () {
         $logger = new \Toeswade\Log\Clog();
         return $logger;
     });
 }
Exemplo n.º 4
0
    $controller = new Phpmvc\Comment\CommentController();
    $controller->setDI($di);
    return $controller;
});
$di->set('QuestionController', function () use($di) {
    $controller = new Anax\Question\QuestionController();
    $controller->setDI($di);
    return $controller;
});
$di->set('AnswerController', function () use($di) {
    $controller = new Anax\Answer\AnswerController();
    $controller->setDI($di);
    return $controller;
});
$di->set('UsersController', function () use($di) {
    $controller = new \Anax\Users\UsersController();
    $controller->setDI($di);
    return $controller;
});
$di->set('RssController', function () use($di) {
    $controller = new \Anax\Rss\RssFeedController();
    $controller->setDI($di);
    return $controller;
});
/**
 * Start the session.
 *
 */
session_name(preg_replace('/[^a-z\\d]/i', '', __DIR__));
session_start();
$app = new \Anax\Kernel\CAnax($di);