コード例 #1
0
ファイル: CDIFactory.php プロジェクト: Kajja/phpmvc
 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;
     });
 }
コード例 #2
0
 public function __construct()
 {
     parent::__construct();
     // Inject the comment service into the app
     $this->set('CommentController', function () {
         $controller = new \Idun\Comment\CommentController();
         $controller->setDI($this);
         return $controller;
     });
     // Inject the form service into the app
     $this->set('form', '\\Mos\\HTMLForm\\CForm');
     // Inject the form controller into the app
     $this->set('FormController', function () {
         $controller = new \Anax\HTMLForm\FormController();
         $controller->setDI($this);
         return $controller;
     });
     // Inject the database service into the app
     $this->setShared('db', function () {
         $db = new \Mos\Database\CDatabaseBasic();
         $db->setOptions(require ANAX_APP_PATH . 'config/database_mysql.php');
         $db->connect();
         return $db;
     });
     // Inject the user and admin controller into the app
     $this->set('UsersController', function () {
         $controller = new \Idun\Users\UsersController();
         $controller->setDI($this);
         return $controller;
     });
     // Inject the forum controller into the app
     $this->set('ForumController', function () {
         $controller = new \Idun\Forum\ForumController();
         $controller->setDI($this);
         return $controller;
     });
     // Inject the forum controller into the app
     $this->set('sessionmodel', function () {
         $sessionmodel = new \Idun\Session\CSessionModel();
         $sessionmodel->setDI($this);
         return $sessionmodel;
     });
 }
コード例 #3
0
 /**
  * Construct.
  *
  */
 public function __construct()
 {
     parent::__construct();
     $this->setShared('theme', function () {
         $themeEngine = new \CR\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_mysql_wgtotw.php');
         $db->connect();
         return $db;
     });
     // Flash messages
     $this->setShared('flashmessage', function () {
         $flashmessages = new \helikopterspark\FlashMsg\FlashMsg();
         $flashmessages->setDI($this);
         return $flashmessages;
     });
     // Questions
     $this->setShared('QuestionController', function () {
         $questions = new \CR\Question\QuestionController();
         $questions->setDI($this);
         return $questions;
     });
     // Answers
     $this->setShared('AnswerController', function () {
         $answers = new \CR\Answer\AnswerController();
         $answers->setDI($this);
         return $answers;
     });
     // Tags
     $this->setShared('TagController', function () {
         $tags = new \CR\Tag\TagController();
         $tags->setDI($this);
         return $tags;
     });
     // Comments
     $this->set('CommentsController', function () {
         $commentscontroller = new \CR\Comment\CommentsController();
         $commentscontroller->setDI($this);
         return $commentscontroller;
     });
     // Users
     $this->set('UsersController', function () {
         $userscontroller = new \CR\Users\UsersController();
         $userscontroller->setDI($this);
         return $userscontroller;
     });
     // User login
     $this->set('UserloginController', function () {
         $userlogincontroller = new \CR\Users\UserloginController();
         $userlogincontroller->setDI($this);
         return $userlogincontroller;
     });
     // Paginator
     $this->setShared('paginator', function () {
         $paginate = new \CR\Paginator\CPaginator();
         $paginate->setDI($this);
         return $paginate;
     });
     // Vote service
     $this->setShared('vote', function () {
         $votes = new \CR\Vote\Vote();
         $votes->setDI($this);
         return $votes;
     });
     // Topbar
     $this->setShared('topbar', function () {
         $topbar = new \CR\Topbar\CTopbar();
         $topbar->setDI($this);
         //$topbar->configure(ANAX_APP_PATH . 'config/navbar.php');
         return $topbar;
     });
 }
コード例 #4
0
 /**
  * Construct.
  *
  */
 public function __construct()
 {
     parent::__construct();
     $this->setShared('theme', function () {
         $themeEngine = new \CR\ThemeEngine\CThemeExtended();
         $themeEngine->setDI($this);
         $themeEngine->configure(ANAX_APP_PATH . 'config/theme-grid.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_mysql_wgtotw.php');
         $db->connect();
         return $db;
     });
     // Flash messages
     $this->setShared('flashmessage', function () {
         $flashmessages = new \helikopterspark\FlashMsg\FlashMsg();
         $flashmessages->setDI($this);
         return $flashmessages;
     });
     // Paginator
     $this->setShared('paginator', function () {
         $paginate = new \CR\Paginator\CPaginator();
         $paginate->setDI($this);
         return $paginate;
     });
     // Topbar
     $this->setShared('topbar', function () {
         $topbar = new \CR\Topbar\CTopbar();
         $topbar->setDI($this);
         //$topbar->configure(ANAX_APP_PATH . 'config/navbar.php');
         return $topbar;
     });
     // Shop
     $this->setShared('ShopController', function () {
         $shop = new \CR\JSShop\ShopController();
         $shop->setDI($this);
         return $shop;
     });
     // Checkout
     $this->setShared('CheckoutController', function () {
         $checkout = new \CR\JSShop\CheckoutController();
         $checkout->setDI($this);
         return $checkout;
     });
     // Playgrounds
     $this->setShared('CkmomController', function () {
         $kmom = new \CR\CKmom\CkmomController();
         $kmom->setDI($this);
         return $kmom;
     });
     // Websockets
     $this->setShared('WebsocketsController', function () {
         $ws = new \CR\Websockets\WebsocketsController();
         $ws->setDI($this);
         return $ws;
     });
 }