public function showBackendContent($request, $response) { switch ($request->getPath(3)) { case 'dashboard': $calendarView = new \phpOMS\Views\View($this->app, $request, $response); $calendarView->setTemplate('/Modules/Calendar/Theme/Backend/calendar-dashboard'); echo $calendarView->render(); break; } }
/** * Shows module content * * @param \phpOMS\Message\RequestAbstract $request Request * @param \phpOMS\Message\ResponseAbstract $response Response * * @since 1.0.0 * @author Dennis Eichhorn <*****@*****.**> */ private function showContentBackend($request, $response) { switch ($request->getPath(3)) { case 'single': $media = new \Modules\Media\Models\Media($this->app->dbPool); $media->init($request->getData('id')); /** @noinspection PhpIncludeInspection */ include __DIR__ . '/Theme/Backend/media-single.tpl.php'; break; case 'list': $mediaList = new \phpOMS\Views\View($this->app, $request, $response); $mediaList->setTemplate('/Modules/Media/Theme/Backend/media-list'); $navigation = \Modules\Navigation\Models\Navigation::getInstance($request->getHash(), $this->app->dbPool); $mediaList->addData('nav', $navigation->nav); echo $mediaList->render(); break; case 'create': $mediaCreate = new \phpOMS\Views\View($this->app, $request, $response); $mediaCreate->setTemplate('/Modules/Media/Theme/Backend/media-create'); $navigation = \Modules\Navigation\Models\Navigation::getInstance($request->getHash(), $this->app->dbPool); $mediaCreate->addData('nav', $navigation->nav); echo $mediaCreate->render(); break; default: $response->setHeader('HTTP', 'HTTP/1.0 404 Not Found'); $response->setHeader('Status', 'Status: 404 Not Found'); include __DIR__ . '/../../Web/Backend/404.tpl.php'; return; } }
/** * Shows module content * * @param \phpOMS\Message\RequestAbstract $request Request * @param \phpOMS\Message\ResponseAbstract $response Response * * @since 1.0.0 * @author Dennis Eichhorn <*****@*****.**> */ public function showContentBackendProcess($request, $response) { $processView = new \phpOMS\Views\View($this->app, $request, $response); $processView->setTemplate('/Modules/RiskManagement/Theme/Backend/process-list'); $navigation = \Modules\Navigation\Models\Navigation::getInstance($request->getHash(), $this->app->dbPool); $processView->addData('nav', $navigation->nav); echo $processView->render(); }
/** * Shows module content * * @param \phpOMS\Message\RequestAbstract $request Request * @param \phpOMS\Message\ResponseAbstract $response Response * * @since 1.0.0 * @author Dennis Eichhorn <*****@*****.**> */ public function showContentBackendPrivate($request, $response) { switch ($request->getPath(4)) { case 'dashboard': $supportDashboardView = new \phpOMS\Views\View($this->app, $request, $response); $supportDashboardView->setTemplate('/Modules/Support/Theme/Backend/user-support-dashboard'); $navigation = \Modules\Navigation\Models\Navigation::getInstance($request->getHash(), $this->app->dbPool); $supportDashboardView->addData('nav', $navigation->nav); echo $supportDashboardView->render(); break; } }
/** * Shows module content * * @param \phpOMS\Message\RequestAbstract $request Request * @param \phpOMS\Message\ResponseAbstract $response Response * * @since 1.0.0 * @author Dennis Eichhorn <*****@*****.**> */ public function showContentBackendDepartment($request, $response) { switch ($request->getPath(4)) { case 'list': $departmentListView = new \phpOMS\Views\View($this->app, $request, $response); $departmentListView->setTemplate('/Modules/Business/Theme/Backend/department-list'); $navigation = \Modules\Navigation\Models\Navigation::getInstance($request->getHash(), $this->app->dbPool); $departmentListView->addData('nav', $navigation->nav); echo $departmentListView->render(); break; case 'create': $departmentCreateView = new \phpOMS\Views\View($this->app, $request, $response); $departmentCreateView->setTemplate('/Modules/Business/Theme/Backend/department-create'); $navigation = \Modules\Navigation\Models\Navigation::getInstance($request->getHash(), $this->app->dbPool); $departmentCreateView->addData('nav', $navigation->nav); echo $departmentCreateView->render(); break; } }
/** * Shows module content * * @param \phpOMS\Message\RequestAbstract $request Request * @param \phpOMS\Message\ResponseAbstract $response Response * * @since 1.0.0 * @author Dennis Eichhorn <*****@*****.**> */ public function showContentBackend($request, $response) { // TODO: pull abstract view creation and output out. let error be a view as well -> less code writing switch ($request->getPath(3)) { case 'dashboard': $taskDashboardView = new \phpOMS\Views\View($this->app, $request, $response); $taskDashboardView->setTemplate('/Modules/Tasks/Theme/Backend/task-dashboard'); $navigation = \Modules\Navigation\Models\Navigation::getInstance($request->getHash(), $this->app->dbPool); $taskDashboardView->addData('nav', $navigation->nav); echo $taskDashboardView->render(); break; case 'single': $taskSingleView = new \phpOMS\Views\View($this->app, $request, $response); $taskSingleView->setTemplate('/Modules/Tasks/Theme/Backend/task-single'); $navigation = \Modules\Navigation\Models\Navigation::getInstance($request->getHash(), $this->app->dbPool); $taskSingleView->addData('nav', $navigation->nav); echo $taskSingleView->render(); break; case 'create': $taskCreateView = new \phpOMS\Views\View($this->app, $request, $response); $taskCreateView->setTemplate('/Modules/Tasks/Theme/Backend/task-create'); $navigation = \Modules\Navigation\Models\Navigation::getInstance($request->getHash(), $this->app->dbPool); $taskCreateView->addData('nav', $navigation->nav); echo $taskCreateView->render(); break; case 'analysis': $taskAnalysisView = new \phpOMS\Views\View($this->app, $request, $response); $taskAnalysisView->setTemplate('/Modules/Tasks/Theme/Backend/task-analysis'); $navigation = \Modules\Navigation\Models\Navigation::getInstance($request->getHash(), $this->app->dbPool); $taskAnalysisView->addData('nav', $navigation->nav); echo $taskAnalysisView->render(); break; case 'settings': $taskSettingsView = new \phpOMS\Views\View($this->app, $request, $response); $taskSettingsView->setTemplate('/Modules/Tasks/Theme/Backend/task-settings'); $navigation = \Modules\Navigation\Models\Navigation::getInstance($request->getHash(), $this->app->dbPool); $taskSettingsView->addData('nav', $navigation->nav); echo $taskSettingsView->render(); break; } }
/** * Shows module content * * @param \phpOMS\Message\RequestAbstract $request Request * @param \phpOMS\Message\ResponseAbstract $response Response * * @since 1.0.0 * @author Dennis Eichhorn <*****@*****.**> */ public function showBackendModule($request, $response) { switch ($request->getPath(4)) { case 'list': $moduleListView = new \phpOMS\Views\View($this->app, $request, $response); $moduleListView->setTemplate('/Modules/Admin/Theme/Backend/modules-list'); echo $moduleListView->render(); break; case 'front': //$info = $this->app->modules->moduleInfoGet((int)$request->getData('id')); /** @noinspection PhpIncludeInspection */ include __DIR__ . '/Theme/Backend/modules-single.tpl.php'; break; default: $response->setHeader('HTTP', 'HTTP/1.0 404 Not Found'); $response->setHeader('Status', 'Status: 404 Not Found'); include __DIR__ . '/../../Web/Backend/404.tpl.php'; return; } }
/** * Shows module content * * @param \phpOMS\Message\RequestAbstract $request Request * @param \phpOMS\Message\ResponseAbstract $response Response * * @since 1.0.0 * @author Dennis Eichhorn <*****@*****.**> */ public function showContentBackend($request, $response) { switch ($request->getPath(3)) { case 'dashboard': $newsDashboard = new \phpOMS\Views\View($this->app, $request, $response); $newsDashboard->setTemplate('/Modules/News/Theme/Backend/news-dashboard'); $navigation = \Modules\Navigation\Models\Navigation::getInstance($request->getHash(), $this->app->dbPool); $newsDashboard->addData('nav', $navigation->nav); echo $newsDashboard->render(); break; case 'single': $article = new \Modules\News\Models\Article($this->app->dbPool); $article->init($request->getData('id')); /** @noinspection PhpIncludeInspection */ include __DIR__ . '/Theme/Backend/news-single.tpl.php'; break; case 'archive': $newArchive = new \phpOMS\Views\View($this->app, $request, $response); $newArchive->setTemplate('/Modules/News/Theme/Backend/news-archive'); $navigation = \Modules\Navigation\Models\Navigation::getInstance($request->getHash(), $this->app->dbPool); $newArchive->addData('nav', $navigation->nav); echo $newArchive->render(); break; case 'create': $newsCreate = new \phpOMS\Views\View($this->app, $request, $response); $newsCreate->setTemplate('/Modules/News/Theme/Backend/news-create'); $navigation = \Modules\Navigation\Models\Navigation::getInstance($request->getHash(), $this->app->dbPool); $newsCreate->addData('nav', $navigation->nav); echo $newsCreate->render(); break; default: $response->setHeader('HTTP', 'HTTP/1.0 404 Not Found'); $response->setHeader('Status', 'Status: 404 Not Found'); include __DIR__ . '/../../Web/Backend/404.tpl.php'; return; } }
/** * Shows module content * * @param \phpOMS\Message\RequestAbstract $request Request * @param \phpOMS\Message\ResponseAbstract $response Response * * @since 1.0.0 * @author Dennis Eichhorn <*****@*****.**> */ public function showContentBackend($request, $response) { switch ($request->getPath(3)) { case 'single': $profileSingleView = new \phpOMS\Views\View($this->app, $request, $response); $profileSingleView->setTemplate('/Modules/Profile/Theme/Backend/profile-single'); $navigation = \Modules\Navigation\Models\Navigation::getInstance($request->getHash(), $this->app->dbPool); $profileSingleView->addData('nav', $navigation->nav); echo $profileSingleView->render(); break; case 'list': $profileView = new \phpOMS\Views\View($this->app, $request, $response); $profileView->setTemplate('/Modules/Profile/Theme/Backend/profile-list'); $navigation = \Modules\Navigation\Models\Navigation::getInstance($request->getHash(), $this->app->dbPool); $profileView->addData('nav', $navigation->nav); echo $profileView->render(); break; } }
public function getBackendUserClocking($request, $response) { $clockingTimeMgmtView = new \phpOMS\Views\View($this->app, $request, $response); $clockingTimeMgmtView->setTemplate('/Modules/Clocking/Theme/Backend/user-clocking'); echo $clockingTimeMgmtView->render(); }
/** * Constructor * * @param array $config Core config * * @since 1.0.0 * @author Dennis Eichhorn <*****@*****.**> */ public function __construct(array $config) { $request = new \phpOMS\Message\Http\Request($config['page']['root']); $response = new \phpOMS\Message\Http\Response(); $this->dbPool = new \phpOMS\DataStorage\Database\Pool(); $pageView = null; $request->init(); $this->dbPool->create('core', $config['db']); switch ($request->getRequestDestination()) { case \phpOMS\Message\RequestDestination::WEBSITE: break; case \phpOMS\Message\RequestDestination::BACKEND: $response->setHeader('Content-Type', 'text/html; charset=utf-8'); $pageView = new \Web\Views\Page\GenericView($this, $request, $response); if ($request->getMethod() !== \phpOMS\Message\RequestMethod::GET) { $response->setHeader('HTTP', 'HTTP/1.0 406 Not acceptable'); $response->setHeader('Status', 'Status:406 Not acceptable'); $response->setStatusCode(406); break; } if ($this->dbPool->get()->getStatus() !== \phpOMS\DataStorage\Database\DatabaseStatus::OK) { $response->setHeader('HTTP', 'HTTP/1.0 503 Service Temporarily Unavailable'); $response->setHeader('Status', 'Status: 503 Service Temporarily Unavailable'); $response->setHeader('Retry-After', 'Retry-After: 300'); $response->setStatusCode(503); $pageView->setTemplate('/Web/Theme/Error/503'); break; } $this->cacheManager = new \phpOMS\DataStorage\Cache\CacheManager($this->dbPool); $this->appSettings = new \Model\CoreSettings($this->dbPool->get()); $this->eventManager = new \phpOMS\Event\EventManager(); $this->sessionManager = new \phpOMS\DataStorage\Session\HttpSession(36000); $this->moduleManager = new \phpOMS\Module\ModuleManager($this); $account = new \Model\Account(0, $this->dbPool->get(), $this->sessionManager, $this->cacheManager); $account->authenticate(); $aid = $this->accountManager->set($account); $request->setAccount($aid); $response->setAccount($aid); $account->getL11n()->loadCoreLanguage($request->getLanguage()); $account->getL11n()->loadThemeLanguage($request->getLanguage(), 'backend'); $head = $response->getHead(); $baseUri = $request->getUri()->getBase(); if ($account->getId() < 1) { $head->addAsset(\phpOMS\Asset\AssetType::CSS, $baseUri . 'External/fontawesome/css/font-awesome.min.css'); $head->addAsset(\phpOMS\Asset\AssetType::JS, $baseUri . 'jsOMS/oms.min.js'); $head->addAsset(\phpOMS\Asset\AssetType::JS, $baseUri . 'Web/Backend/js/backend.js'); $head->setScript('core', 'var Url = "' . $baseUri . '", assetManager = new jsOMS.AssetManager();'); $pageView->setTemplate('/Web/Backend/login'); $response->set('GLOBAL', $pageView->render()); break; } $toLoad = $this->moduleManager->getUriLoads($request); if (isset($toLoad[4])) { foreach ($toLoad[4] as $module) { $this->moduleManager->initModule($module['module_load_file']); } } $options = $this->appSettings->get([1000000009]); $head->addAsset(\phpOMS\Asset\AssetType::CSS, $baseUri . 'Web/Backend/css/backend.css'); $head->addAsset(\phpOMS\Asset\AssetType::CSS, $baseUri . 'External/fontawesome/css/font-awesome.min.css'); $head->addAsset(\phpOMS\Asset\AssetType::JS, $baseUri . 'jsOMS/oms.min.js'); $head->addAsset(\phpOMS\Asset\AssetType::JS, $baseUri . 'External/d3/d3.min.js'); $head->addAsset(\phpOMS\Asset\AssetType::JS, $baseUri . 'Web/Backend/js/backend.js'); $head->setStyle('core', file_get_contents(__DIR__ . '/Theme/Backend/css/backend-small.css')); $head->setScript('core', 'var Url = "' . $baseUri . '", assetManager = new jsOMS.AssetManager();'); $pageView->setData('Name', $options[1000000009]); $pageView->setData('Title', 'Orange Management'); $pageView->setData('Destination', $request->getRequestDestination()); $pageView->setTemplate('/Web/Backend/index'); $navigation = \Modules\Navigation\Models\Navigation::getInstance($request->getHash(), $this->dbPool); $pageView->addData('nav', $navigation->nav); $response->set('GLOBAL', $pageView->render()); break; case \phpOMS\Message\RequestDestination::API: if ($this->dbPool->get()->getStatus() !== \phpOMS\DataStorage\Database\DatabaseStatus::OK) { $response->setHeader('HTTP', 'HTTP/1.0 503 Service Temporarily Unavailable'); $response->setHeader('Status', 'Status: 503 Service Temporarily Unavailable'); $response->setHeader('Retry-After', 'Retry-After: 300'); $response->setStatusCode(503); break; } $this->cacheManager = new \phpOMS\DataStorage\Cache\CacheManager($this->dbPool); $this->appSettings = new \Model\CoreSettings($this->dbPool->get()); $this->eventManager = new \phpOMS\Event\EventManager(); $this->sessionManager = new \phpOMS\DataStorage\Session\HttpSession(36000); $this->moduleManager = new \phpOMS\Module\ModuleManager($this); $account = new \Model\Account(0, $this->dbPool->get(), $this->sessionManager, $this->cacheManager); $account->authenticate(); $aid = $this->accountManager->set($account); $request->setAccount($aid); $response->setAccount($aid); $response->setHeader('Content-Type', 'application/json; charset=utf-8'); $response->set('GLOBAL', new \phpOMS\Utils\JsonBuilder()); $response->get('GLOBAL')->add($request->__toString(), null); if (($uris = $request->getUri()->getQuery('r')) !== null) { $uris = json_decode($uris, true); foreach ($uris as $key => $uri) { $request->init($uri); $toLoad = $this->moduleManager->getUriLoads($request); if (isset($toLoad[4])) { foreach ($toLoad[4] as $module) { $this->moduleManager->initModule($module['module_load_file']); } } /** @noinspection PhpUndefinedMethodInspection */ $this->moduleManager->running['Content']->call($request, $response); } } else { if ($account->getId() < 1) { if ($request->getPath(2) === 'login') { $login = $account->login($request->getData('user'), $request->getData('pass')); if ($login === \phpOMS\Auth\LoginReturnType::OK) { //$response->get('GLOBAL')->add($request->__toString(), $this->sessionManager->getSID()); $response->get('GLOBAL')->add($request->__toString(), (new \Model\Message\Reload())->toArray()); $response->set('GLOBAL', $response->get('GLOBAL')->__toString()); } else { // TODO: create login failure msg } break; } } else { if ($request->getPath(2) === 'logout') { $this->sessionManager->remove('UID'); $this->sessionManager->save(); $response->get('GLOBAL')->add($request->__toString(), 1); $response->set('GLOBAL', $response->get('GLOBAL')->__toString()); break; } } $toLoad = $this->moduleManager->getUriLoads($request); if (isset($toLoad[4])) { foreach ($toLoad[4] as $module) { $this->moduleManager->initModule($module['module_load_file']); } } if (($module = $this->moduleManager->get('Content')) !== null) { /** @noinspection PhpUndefinedMethodInspection */ $module->call($request, $response); } } if (!is_string($response_value = $response->get('GLOBAL'))) { $response->set('GLOBAL', $response_value->__toString()); } break; case \phpOMS\Message\RequestDestination::REPORTER: $response->setHeader('Content-Type', 'text/html; charset=utf-8'); $pageView = new \Web\Views\Page\GenericView($this, $request, $response); if ($request->getMethod() !== \phpOMS\Message\RequestMethod::GET) { $response->setHeader('HTTP', 'HTTP/1.0 406 Not acceptable'); $response->setHeader('Status', 'Status:406 Not acceptable'); $response->setStatusCode(406); break; } if ($this->dbPool->get()->getStatus() !== \phpOMS\DataStorage\Database\DatabaseStatus::OK) { $response->setHeader('HTTP', 'HTTP/1.0 503 Service Temporarily Unavailable'); $response->setHeader('Status', 'Status: 503 Service Temporarily Unavailable'); $response->setHeader('Retry-After', 'Retry-After: 300'); $response->setStatusCode(503); $pageView->setTemplate('/Web/Theme/Error/503'); break; } $this->cacheManager = new \phpOMS\DataStorage\Cache\CacheManager($this->dbPool); $this->appSettings = new \Model\CoreSettings($this->dbPool->get()); $this->eventManager = new \phpOMS\Event\EventManager(); $this->sessionManager = new \phpOMS\DataStorage\Session\HttpSession(36000); $this->moduleManager = new \phpOMS\Module\ModuleManager($this); $account = new \Model\Account(0, $this->dbPool->get(), $this->sessionManager, $this->cacheManager); $account->authenticate(); $aid = $this->accountManager->set($account); $request->setAccount($aid); $response->setAccount($aid); $account->getL11n()->loadCoreLanguage($request->getLanguage()); $account->getL11n()->loadThemeLanguage($request->getLanguage(), 'reporter'); $head = $response->getHead(); $baseUri = $request->getUri()->getBase(); if ($account->getId() < 1) { $head->addAsset(\phpOMS\Asset\AssetType::CSS, $baseUri . 'External/fontawesome/css/font-awesome.min.css'); $head->addAsset(\phpOMS\Asset\AssetType::JS, $baseUri . 'jsOMS/oms.min.js'); $head->addAsset(\phpOMS\Asset\AssetType::JS, $baseUri . 'Web/Backend/js/backend.js'); $head->setScript('core', 'var Url = "' . $baseUri . '", assetManager = new jsOMS.AssetManager();'); $pageView->setTemplate('/Web/Backend/login'); $response->set('GLOBAL', $pageView->render()); break; } $toLoad = $this->moduleManager->getUriLoads($request); if (isset($toLoad[4])) { foreach ($toLoad[4] as $module) { $this->moduleManager->initModule($module['module_load_file']); } } $options = $this->appSettings->get([1000000009]); $head->addAsset(\phpOMS\Asset\AssetType::CSS, $baseUri . 'Web/Backend/css/backend.css'); $head->addAsset(\phpOMS\Asset\AssetType::CSS, $baseUri . 'External/fontawesome/css/font-awesome.min.css'); $head->addAsset(\phpOMS\Asset\AssetType::JS, $baseUri . 'jsOMS/oms.min.js'); $head->addAsset(\phpOMS\Asset\AssetType::JS, $baseUri . 'External/d3/d3.min.js'); $head->setStyle('core', file_get_contents(__DIR__ . '/Theme/Backend/css/backend-small.css')); $head->setScript('core', 'var Url = "' . $baseUri . '", assetManager = new jsOMS.AssetManager();'); $pageView->setData('Name', $options[1000000009]); $pageView->setData('Title', 'Orange Management'); $pageView->setData('Destination', $request->getRequestDestination()); $pageView->setTemplate('/Web/Theme/reporter/index'); $navigation = \Modules\Navigation\Models\Navigation::getInstance($request->getHash(), $this->dbPool); $pageView->addData('nav', $navigation->nav); $response->set('GLOBAL', $pageView->render()); break; default: $response->setHeader('HTTP', 'HTTP/1.0 404 Not Found'); $response->setHeader('Status', 'Status: 404 Not Found'); $response->setStatusCode(404); $pageView = new \phpOMS\Views\View($this, $request, $response); $pageView->setTemplate('/Web/Theme/Error/404'); $response->set('GLOBAL', $pageView->render()); } $response->pushHeader(); echo $response->render(); }
public function showContentReporter($request, $response) { switch ($request->getPath(2)) { case 'single': $this->showSingleReporter($request, $response); break; default: $reportList = new \phpOMS\Views\View($this->app, $request, $response); $reportList->setTemplate('/Modules/Reporter/Theme/reporter/reporter-list'); $navigation = \Modules\Navigation\Models\Navigation::getInstance($request->getHash(), $this->app->dbPool); $reportList->addData('nav', $navigation->nav); echo $reportList->render(); } }