/** * Setup * * @return void */ public function setUp() { $this->message = new \helikopterspark\FlashMsg\FlashMsg(); $this->di = new \Anax\DI\CDIFactoryDefault(); $this->message->setDI($this->di); $this->di->setShared('session', function () { $session = new \Anax\Session\CSession(); $session->configure(ANAX_APP_PATH . 'config/session.php'); $session->name(); //$session->start(); return $session; }); $this->di->setShared('flashmessage', function () { $flashMessages = new \helikopterspark\FlashMsg\FlashMsg(); $flashMessages->setDI($this->di); return $flashMessages; }); }
/** * 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; }); }
/** * 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; }); }
<?php /** * This is an Anax pagecontroller. * */ // Get environment & autoloader and the $app-object. require __DIR__ . '/config_with_app.php'; $app->theme->configure(ANAX_APP_PATH . 'config/theme.php'); $di->setShared('flashmessage', function () use($di) { $flashMessages = new \helikopterspark\FlashMsg\FlashMsg(); $flashMessages->setDI($di); return $flashMessages; }); // Prepare the page content $app->theme->addStylesheet('css/flashmsg.css'); $app->flashmessage->alert('Alert flash message'); $app->flashmessage->error('Error flash message'); $app->flashmessage->info('Info flash message'); $app->flashmessage->notice('Notice flash message'); $app->flashmessage->success('Success flash message'); $app->flashmessage->warning('Warning flash message'); $app->theme->setVariable('title', "Flash messages")->setVariable('main', $app->flashmessage->outputMsgs()); $app->flashmessage->clearMessages(); // Render the response using theme engine. $app->theme->render();
/** * 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; }); }