/**
  * Construct.
  *
  */
 public function __construct()
 {
     parent::__construct();
     // Add CDatabase to framework
     $this->setShared('db', function () {
         $db = new \Mos\Database\CDatabaseBasic();
         // LOCALp
         $db->setOptions(require ANAX_APP_PATH . 'config/config_mysql.php');
         // BTH
         // $db->setOptions(require ANAX_APP_PATH . 'config/config_mysql_bth.php');
         $db->connect();
         return $db;
     });
     // Add CForm to framework
     $this->set('form', '\\Mos\\HTMLForm\\CForm');
     // Create extra navbar for top menu
     $this->setShared('topnav', function () {
         $navbar = new \Anax\Navigation\CNavbar();
         $navbar->setDI($this);
         $navbar->configure(ANAX_APP_PATH . 'config/topnav.php');
         return $navbar;
     });
     // Add UserController to framework
     $this->set('UserController', function () {
         $controller = new \Anax\User\UserController();
         $controller->setDI($this);
         return $controller;
     });
     // Add QuestionsController to framework
     $this->set('QuestionsController', function () {
         $controller = new \Anax\Questions\QuestionsController();
         $controller->setDI($this);
         $controller->setup();
         return $controller;
     });
     // Add AnswersController to framework
     $this->set('AnswersController', function () {
         $controller = new \Anax\Answers\AnswersController();
         $controller->setDI($this);
         $controller->setup();
         return $controller;
     });
     // Add CommentsController to framework
     $this->set('CommentsController', function () {
         $controller = new \Anax\Comments\CommentsController();
         $controller->setDI($this);
         $controller->setup();
         return $controller;
     });
     // Add TagsController to framework
     $this->set('TagsController', function () {
         $controller = new \Anax\Tags\TagsController();
         $controller->setDI($this);
         $controller->setup();
         return $controller;
     });
 }
Beispiel #2
0
<?php

require __DIR__ . '/config_with_app.php';
$app->url->setUrlType(\Anax\Url\CUrl::URL_CLEAN);
$app->theme->configure(ANAX_APP_PATH . 'config/theme-grid.php');
$app->navbar->configure(ANAX_APP_PATH . 'config/navbar_me.php');
// Set the comment controller
/*$di->set('CommentController', function() use ($di) {
	$controller = new Phpmvc\Comment\CommentController();
	$controller->setDI($di);
	return $controller;
});*/
$di->set('CommentsController', function () use($di) {
    $controller = new \Anax\Comments\CommentsController();
    $controller->setDI($di);
    return $controller;
});
$di->set('FormController', function () use($di) {
    $controller = new \Anax\HTMLForm\FormSmallController();
    $controller->setDI($di);
    return $controller;
});
$di->setShared('db', function () {
    $db = new \Mos\Database\CDatabaseBasic();
    $db->setOptions(require ANAX_APP_PATH . 'config/config_mysql.php');
    $db->connect();
    return $db;
});
$di->set('UsersController', function () use($di) {
    $controller = new \Anax\Users\UsersController();
    $controller->setDI($di);