initial commit
This commit is contained in:
16
src/module/Application/config/controller.config.php
Executable file
16
src/module/Application/config/controller.config.php
Executable file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace Application;
|
||||
|
||||
use Ainias\Core\Factory\Controller\ServiceActionControllerFactory;
|
||||
use Application\Controller\AuthorController;
|
||||
use Application\Controller\PwaController;
|
||||
use Application\Controller\StoryController;
|
||||
|
||||
return array(
|
||||
'controllers' => [
|
||||
'factories' => [
|
||||
Controller\IndexController::class => ServiceActionControllerFactory::class,
|
||||
],
|
||||
],
|
||||
);
|
||||
23
src/module/Application/config/doctrine.config.php
Executable file
23
src/module/Application/config/doctrine.config.php
Executable file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace Application;
|
||||
|
||||
use Ainias\Core\Connections\MyConnection;
|
||||
use Doctrine\ORM\Mapping\Driver\AnnotationDriver;
|
||||
|
||||
return array(
|
||||
'doctrine' => array(
|
||||
'driver' => array(
|
||||
'orm_default' => array(
|
||||
'drivers' => array(
|
||||
__NAMESPACE__.'\Model' => 'entities_default',
|
||||
),
|
||||
),
|
||||
'entities_default' => array(
|
||||
'paths' => array(
|
||||
__DIR__ . '/../src/Model',
|
||||
)
|
||||
)
|
||||
),
|
||||
),
|
||||
);
|
||||
16
src/module/Application/config/factories.config.php
Executable file
16
src/module/Application/config/factories.config.php
Executable file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
namespace Application;
|
||||
|
||||
use Ainias\Core\Factory\Model\Manager\DefaultManagerFactory;
|
||||
|
||||
return array(
|
||||
'service_manager' => array(
|
||||
'abstract_factories' => array(
|
||||
),
|
||||
'aliases' => array(
|
||||
'translator' => 'MvcTranslator',
|
||||
),
|
||||
'factories' => array(
|
||||
),
|
||||
),
|
||||
);
|
||||
25
src/module/Application/config/manager.config.php
Executable file
25
src/module/Application/config/manager.config.php
Executable file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
namespace Application;
|
||||
|
||||
use Zend\ServiceManager\Factory\InvokableFactory;
|
||||
|
||||
return array(
|
||||
'view_helpers' => array(
|
||||
'factories' => array(
|
||||
),
|
||||
'aliases' => [
|
||||
],
|
||||
'invokables' => [
|
||||
]
|
||||
),
|
||||
'translator' => array(
|
||||
'locale' => 'en_US',
|
||||
'translation_file_patterns' => array(
|
||||
array(
|
||||
'type' => 'gettext',
|
||||
'base_dir' => __DIR__ . '/../language',
|
||||
'pattern' => '%s.mo',
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
7
src/module/Application/config/navigation.config.php
Executable file
7
src/module/Application/config/navigation.config.php
Executable file
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
return [
|
||||
'navigation' => [
|
||||
'left' => [
|
||||
],
|
||||
],
|
||||
];
|
||||
7
src/module/Application/config/routes.config.php
Executable file
7
src/module/Application/config/routes.config.php
Executable file
@@ -0,0 +1,7 @@
|
||||
<?php
|
||||
|
||||
$config = array();
|
||||
foreach (glob(__DIR__ . '/routes/routes.*.php') as $filename) {
|
||||
$config = array_merge_recursive($config, include($filename));
|
||||
}
|
||||
return $config;
|
||||
27
src/module/Application/config/routes/routes.index.php
Executable file
27
src/module/Application/config/routes/routes.index.php
Executable file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace Application;
|
||||
|
||||
use Zend\Router\Http\Segment;
|
||||
|
||||
return array(
|
||||
'router' => [
|
||||
'routes' => [
|
||||
'data' => [
|
||||
'child_routes' => [
|
||||
'clock' => [
|
||||
'type' => Segment::class,
|
||||
'options' => [
|
||||
'route' => '/clock',
|
||||
'defaults' => [
|
||||
'controller' => Controller\IndexController::class,
|
||||
'action' => 'clock',
|
||||
'resource' => 'default',
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
],
|
||||
);
|
||||
35
src/module/Application/pwa/html/application/chat.html
Normal file
35
src/module/Application/pwa/html/application/chat.html
Normal file
@@ -0,0 +1,35 @@
|
||||
<div class='max-height'>
|
||||
<span id='chat-title' class='chat'>
|
||||
<span class='chat-img-container'><img class='chat-img'></span>
|
||||
<span class='chat-name'></span>
|
||||
</span>
|
||||
<div id='date-template'>
|
||||
<div class='date'></div>
|
||||
</div>
|
||||
|
||||
<div id='message-template' class='fill-me vertical message'>
|
||||
<div class='author-image-container'><img class='author-image'></div>
|
||||
<div class='grow'>
|
||||
<div class='bubble'>
|
||||
<div class='author'></div>
|
||||
<div class='message-text'></div>
|
||||
<div class='time'></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class='fill-me max-height'>
|
||||
<div class='grow' id='message-container'></div>
|
||||
<div>
|
||||
<div id='send-container' class='fill-me vertical'>
|
||||
<div class = 'answer-button-container'>
|
||||
<button id='previous-button' class='answer-button'><</button>
|
||||
</div>
|
||||
<div class='grow' id='answer'></div>
|
||||
<div class = 'answer-button-container'>
|
||||
<button id='next-button' class='answer-button'>></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
4
src/module/Application/pwa/html/application/clock.html
Normal file
4
src/module/Application/pwa/html/application/clock.html
Normal file
@@ -0,0 +1,4 @@
|
||||
<div class = 'row'>
|
||||
<div class = 'small-12 smedium-6 columns' data-translation="current-time">Current time:</div>
|
||||
<div class = 'small-12 smedium-6 columns' id = 'current-time'>???</div>
|
||||
</div>
|
||||
@@ -0,0 +1,3 @@
|
||||
<div>
|
||||
<div id = 'tabs'></div>
|
||||
</div>
|
||||
@@ -0,0 +1,10 @@
|
||||
<div>
|
||||
<div id='author-template' class='author-entry fill-me vertical'>
|
||||
<div class='author-image-container'><img class='author-image'></div>
|
||||
<div class='author-name grow'></div>
|
||||
<!--<div>-->
|
||||
<div class='user-flag'>1</div>
|
||||
<!--</div>-->
|
||||
</div>
|
||||
<div id='author-list'></div>
|
||||
</div>
|
||||
@@ -0,0 +1,3 @@
|
||||
<div>
|
||||
chats
|
||||
</div>
|
||||
@@ -0,0 +1,76 @@
|
||||
<div class='max-height fill-me'>
|
||||
<div class='row max-width grow flex-center'>
|
||||
<div class='columns small-centered small-12 smedium-9 medium-11 large-7'>
|
||||
<h3 data-translation="ask-settings"></h3>
|
||||
<label class='row'>
|
||||
<span class='columns small-6' data-translation="ignore-card-always"></span>
|
||||
<span class='columns small-6'><input type="checkbox" class='setting' name='ignore-card-always'
|
||||
value='true'></span>
|
||||
</label>
|
||||
|
||||
<h5 data-translation="settings-ignore-buttons-heading"></h5>
|
||||
<p data-translation="settings-ignore-buttons-explanation"></p>
|
||||
|
||||
<div class='row'>
|
||||
<div class="columns small-12 smedium-6">
|
||||
<label>
|
||||
<input type="text" class='setting' required name="ignore-button-1-text"
|
||||
data-default="ignore-card-1" data-default-translateable="1">
|
||||
<span data-translation="settings-ignore-button-1-text"></span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="columns small-12 smedium-6">
|
||||
<label>
|
||||
<input type="number" class='setting' required name="ignore-button-1-time" data-default="120">
|
||||
<span data-translation="settings-ignore-button-1-time"></span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class='row'>
|
||||
<div class="columns small-12 smedium-6">
|
||||
<label>
|
||||
<input type="text" class='setting' required name="ignore-button-2-text"
|
||||
data-default="ignore-card-2" data-default-translateable="1">
|
||||
<span data-translation="settings-ignore-button-2-text"></span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="columns small-12 smedium-6">
|
||||
<label>
|
||||
<input type="number" class='setting' required name="ignore-button-2-time" data-default="1440">
|
||||
<span data-translation="settings-ignore-button-2-time"></span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class='row'>
|
||||
<div class="columns small-12 smedium-6">
|
||||
<label>
|
||||
<input type="text" class='setting' required name="ignore-button-3-text"
|
||||
data-default="ignore-card-3" data-default-translateable="1">
|
||||
<span data-translation="settings-ignore-button-3-text"></span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="columns small-12 smedium-6">
|
||||
<label>
|
||||
<input type="number" class='setting' required name="ignore-button-3-time" data-default="7200">
|
||||
<span data-translation="settings-ignore-button-3-time"></span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class='row'>
|
||||
<div class="columns small-12 smedium-6">
|
||||
<label>
|
||||
<input type="text" class='setting' required name="ignore-button-4-text" data-default="ignore-card-4"
|
||||
data-default-translateable="1">
|
||||
<span data-translation="settings-ignore-button-4-text"></span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="columns small-12 smedium-6">
|
||||
<label>
|
||||
<input type="number" class='setting' required name="ignore-button-4-time" data-default="525600">
|
||||
<span data-translation="settings-ignore-button-4-time"></span>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,17 @@
|
||||
<div>
|
||||
<div id='chat-template' class='chat overview fill-me vertical'>
|
||||
<div class = 'chat-img-container'><img class='chat-img'></div>
|
||||
<div class='grow'>
|
||||
<div class = 'fill-me vertical'>
|
||||
<div class='chat-name grow'></div>
|
||||
<div class = 'unread-message-counter'></div>
|
||||
</div>
|
||||
<div class = 'fill-me vertical'>
|
||||
<div class='chat-last-message grow'></div>
|
||||
<div class = 'chat-last-message-timestamp'></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id='chat-container'>
|
||||
</div>
|
||||
</div>
|
||||
21
src/module/Application/pwa/js/site/ClockSite.js
Normal file
21
src/module/Application/pwa/js/site/ClockSite.js
Normal file
@@ -0,0 +1,21 @@
|
||||
import {DataManager} from "../../../../../js/lib/pwa-core";
|
||||
import {AbstractSite} from "../../../../../js/lib/pwa-lib";
|
||||
|
||||
export class ClockSite extends AbstractSite
|
||||
{
|
||||
constructor(siteManager) {
|
||||
super(siteManager, "html/application/clock.html");
|
||||
}
|
||||
|
||||
|
||||
onConstruct(args) {
|
||||
this.setTitle("clock");
|
||||
return super.onConstruct(args);
|
||||
}
|
||||
|
||||
onFirstStart(){
|
||||
DataManager.load("clock").then(function(data){
|
||||
document.getElementById("current-time").innerText = data.result.date;
|
||||
});
|
||||
}
|
||||
}
|
||||
6
src/module/Application/pwa/translations/de.json
Normal file
6
src/module/Application/pwa/translations/de.json
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"is-writing":"{0} schreibt...",
|
||||
"restart":"Story neustarten...",
|
||||
"should-restart-title":"Wirklich neustarten?",
|
||||
"should-restart-question":"Willst du wirklich neu starten? Dein bisheriger Fortschritt geht dabei verloren!"
|
||||
}
|
||||
3
src/module/Application/pwa/translations/en.json
Normal file
3
src/module/Application/pwa/translations/en.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"is-writing":"{0} is writing..."
|
||||
}
|
||||
18
src/module/Application/src/Controller/IndexController.php
Executable file
18
src/module/Application/src/Controller/IndexController.php
Executable file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
/**
|
||||
* @link http://github.com/zendframework/ZendSkeletonApplication for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2016 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
namespace Application\Controller;
|
||||
|
||||
use Ainias\Core\Controller\JsonController;
|
||||
|
||||
class IndexController extends JsonController
|
||||
{
|
||||
public function clockAction()
|
||||
{
|
||||
return ["date" => (new \DateTime())->format("H:i:s, Y-m-d")];
|
||||
}
|
||||
}
|
||||
143
src/module/Application/src/Module.php
Executable file
143
src/module/Application/src/Module.php
Executable file
@@ -0,0 +1,143 @@
|
||||
<?php
|
||||
/**
|
||||
* @link http://github.com/zendframework/ZendSkeletonApplication for the canonical source repository
|
||||
* @copyright Copyright (c) 2005-2016 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
namespace Application;
|
||||
|
||||
use Ainias\Core\Connections\MyConnection;
|
||||
use Ainias\Core\Model\Doctrine\DatabaseListener;
|
||||
use Doctrine\ORM\EntityManager;
|
||||
use Zend\EventManager\Event;
|
||||
use Zend\Http\Request;
|
||||
use Zend\Http\Response;
|
||||
use Zend\Log\Filter\Priority;
|
||||
use Zend\Log\Logger;
|
||||
use Zend\Log\Writer\ChromePhp;
|
||||
use Zend\Log\Writer\Stream;
|
||||
use Zend\Mvc\Controller\AbstractActionController;
|
||||
use Zend\Mvc\ModuleRouteListener;
|
||||
use Zend\Mvc\MvcEvent;
|
||||
use Zend\Router\Http\TreeRouteStack;
|
||||
use Zend\Session\Container;
|
||||
use Zend\Session\SessionManager;
|
||||
use Zend\View\Model\ViewModel;
|
||||
|
||||
class Module
|
||||
{
|
||||
const VERSION = '3.0.0dev';
|
||||
const LOG_DIR = __DIR__ . "/../../../../log";
|
||||
const EVENT_LOG = "log";
|
||||
|
||||
public function onBootstrap(MvcEvent $e)
|
||||
{
|
||||
$eventManager = $e->getApplication()->getEventManager();
|
||||
$moduleRouteListener = new ModuleRouteListener();
|
||||
$moduleRouteListener->attach($eventManager);
|
||||
$request = $e->getRequest();
|
||||
|
||||
$logPath = realpath(self::LOG_DIR);
|
||||
$logger = new Logger();
|
||||
$catchAllWriter = new Stream($logPath . "/log.log");
|
||||
$logger->addWriter($catchAllWriter);
|
||||
$errorWriter = new Stream($logPath . "/error.log");
|
||||
$errorWriter->addFilter(new Priority(Logger::ERR));
|
||||
$logger->addWriter($errorWriter);
|
||||
$errorLogger = new Logger();
|
||||
$phpErrorWriter = new Stream($logPath . "/php_error.log");
|
||||
$errorLogger->addWriter($catchAllWriter);
|
||||
$errorLogger->addWriter($phpErrorWriter);
|
||||
Logger::registerErrorHandler($errorLogger);
|
||||
Logger::registerFatalErrorShutdownFunction($errorLogger);
|
||||
|
||||
$exceptionLogger = new Logger();
|
||||
$exceptionWriter = new Stream($logPath . "/php_exceptions.log");
|
||||
$exceptionLogger->addWriter($catchAllWriter);
|
||||
$exceptionLogger->addWriter($exceptionWriter);
|
||||
Logger::registerExceptionHandler($exceptionLogger);
|
||||
|
||||
if (($request instanceof Request)) {
|
||||
$chromePhp = new ChromePhp();
|
||||
$errorLogger->addWriter($chromePhp);
|
||||
$exceptionLogger->addWriter($chromePhp);
|
||||
}
|
||||
|
||||
$eventManager->getSharedManager()->attach('*', self::EVENT_LOG, function (Event $e) use ($logger) {
|
||||
$params = $e->getParams();
|
||||
|
||||
if (isset($params["message"])) {
|
||||
if (isset($params["level"]) && ($params["level"] == Logger::ALERT || $params["level"] == Logger::CRIT || $params["level"] == Logger::DEBUG || $params["level"] == Logger::EMERG || $params["level"] == Logger::ERR || $params["level"] == Logger::INFO || $params["level"] == Logger::NOTICE)) {
|
||||
$logLevel = $params["level"];
|
||||
} else {
|
||||
$logLevel = Logger::INFO;
|
||||
}
|
||||
$logger->log($logLevel, $params["message"]);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public function getConfig()
|
||||
{
|
||||
$config = array();
|
||||
foreach (glob(__DIR__ . '/../config/*.config.php') as $filename) {
|
||||
$config = array_merge_recursive($config, include($filename));
|
||||
}
|
||||
return $config;
|
||||
}
|
||||
|
||||
// public function getServiceConfig()
|
||||
// {
|
||||
// return [
|
||||
// 'factories' => [
|
||||
// SessionManager::class => function ($container) {
|
||||
// $config = $container->get('config');
|
||||
// if (!isset($config['session'])) {
|
||||
// $sessionManager = new SessionManager();
|
||||
// Container::setDefaultManager($sessionManager);
|
||||
// return $sessionManager;
|
||||
// }
|
||||
//
|
||||
// $session = $config['session'];
|
||||
//
|
||||
// $sessionConfig = null;
|
||||
// if (isset($session['config'])) {
|
||||
// $class = isset($session['config']['class'])
|
||||
// ? $session['config']['class']
|
||||
// : SessionConfig::class;
|
||||
//
|
||||
// $options = isset($session['config']['options'])
|
||||
// ? $session['config']['options']
|
||||
// : [];
|
||||
//
|
||||
// $sessionConfig = new $class();
|
||||
// $sessionConfig->setOptions($options);
|
||||
// }
|
||||
//
|
||||
// $sessionStorage = null;
|
||||
// if (isset($session['storage'])) {
|
||||
// $class = $session['storage'];
|
||||
// $sessionStorage = new $class();
|
||||
// }
|
||||
//
|
||||
// $sessionSaveHandler = null;
|
||||
// if (isset($session['save_handler'])) {
|
||||
// // class should be fetched from service manager
|
||||
// // since it will require constructor arguments
|
||||
// $sessionSaveHandler = $container->get($session['save_handler']);
|
||||
// }
|
||||
//
|
||||
// $sessionManager = new SessionManager(
|
||||
// $sessionConfig,
|
||||
// $sessionStorage,
|
||||
// $sessionSaveHandler
|
||||
// );
|
||||
//
|
||||
// Container::setDefaultManager($sessionManager);
|
||||
// return $sessionManager;
|
||||
// },
|
||||
// ],
|
||||
// ];
|
||||
// }
|
||||
}
|
||||
Reference in New Issue
Block a user