replace tabs with spaces
This commit is contained in:
parent
50c38e0efa
commit
c79f0f213b
176 changed files with 27369 additions and 27364 deletions
64
.htaccess
64
.htaccess
|
@ -5,40 +5,46 @@ ErrorDocument 404 /www/error404.html
|
|||
ErrorDocument 500 /www/error500.html
|
||||
|
||||
|
||||
|
||||
<IfModule mod_authz_core.c>
|
||||
Require all granted
|
||||
|
||||
<Files ~ "\.inc$">
|
||||
Require all denied
|
||||
</Files>
|
||||
<Files ~ "\.tpl$">
|
||||
Require all denied
|
||||
</Files>
|
||||
<Files ~ "\.log$">
|
||||
Require all denied
|
||||
</Files>
|
||||
Require all granted
|
||||
|
||||
<Files ~ "\.inc$">
|
||||
Require all denied
|
||||
</Files>
|
||||
|
||||
<Files ~ "\.tpl$">
|
||||
Require all denied
|
||||
</Files>
|
||||
|
||||
<Files ~ "\.log$">
|
||||
Require all denied
|
||||
</Files>
|
||||
</IfModule>
|
||||
|
||||
<IfModule !mod_authz_core.c>
|
||||
Allow From All
|
||||
|
||||
<Files ~ "\.inc$">
|
||||
Order Deny,Allow
|
||||
Deny From All
|
||||
</Files>
|
||||
<Files ~ "\.tpl$">
|
||||
Order Deny,Allow
|
||||
Deny From All
|
||||
</Files>
|
||||
<Files ~ "\.log$">
|
||||
Order Deny,Allow
|
||||
Deny From All
|
||||
</Files>
|
||||
Allow From All
|
||||
|
||||
<Files ~ "\.inc$">
|
||||
Order Deny,Allow
|
||||
Deny From All
|
||||
</Files>
|
||||
|
||||
<Files ~ "\.tpl$">
|
||||
Order Deny,Allow
|
||||
Deny From All
|
||||
</Files>
|
||||
|
||||
<Files ~ "\.log$">
|
||||
Order Deny,Allow
|
||||
Deny From All
|
||||
</Files>
|
||||
</IfModule>
|
||||
|
||||
|
||||
<IfModule mod_rewrite.c>
|
||||
RewriteEngine On
|
||||
|
||||
RewriteBase /
|
||||
RewriteRule ^(.*)$ www/$1 [L]
|
||||
RewriteEngine On
|
||||
|
||||
RewriteBase /
|
||||
RewriteRule ^(.*)$ www/$1 [L]
|
||||
</IfModule>
|
||||
|
|
|
@ -1,38 +1,38 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
*/
|
||||
|
||||
namespace hhu\z\agents\bottomlevel;
|
||||
|
||||
|
||||
/**
|
||||
* Agent to generate a mail receiver salutation.
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
*/
|
||||
class MailreceiverAgent extends \nre\agents\BottomlevelAgent
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Action: index.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
public function index(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* The Legend of Z
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
*/
|
||||
|
||||
namespace hhu\z\agents\bottomlevel;
|
||||
|
||||
|
||||
/**
|
||||
* Agent to generate a mail receiver salutation.
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
*/
|
||||
class MailreceiverAgent extends \nre\agents\BottomlevelAgent
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Action: index.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
public function index(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -1,40 +1,40 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
*/
|
||||
|
||||
namespace hhu\z\agents\bottomlevel;
|
||||
|
||||
|
||||
/**
|
||||
* Agent to display a menu.
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
*/
|
||||
class MenuAgent extends \nre\agents\BottomlevelAgent
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Action: index.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
public function index(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
// Add Seminary menu
|
||||
$this->addSubAgent('Seminarymenu');
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* The Legend of Z
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
*/
|
||||
|
||||
namespace hhu\z\agents\bottomlevel;
|
||||
|
||||
|
||||
/**
|
||||
* Agent to display a menu.
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
*/
|
||||
class MenuAgent extends \nre\agents\BottomlevelAgent
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Action: index.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
public function index(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
// Add Seminary menu
|
||||
$this->addSubAgent('Seminarymenu');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -1,38 +1,38 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
*/
|
||||
|
||||
namespace hhu\z\agents\bottomlevel;
|
||||
|
||||
|
||||
/**
|
||||
* Agent to display the Questgroups hierarchy path.
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
*/
|
||||
class QuestgroupshierarchypathAgent extends \nre\agents\BottomlevelAgent
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Action: index.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
public function index(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* The Legend of Z
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
*/
|
||||
|
||||
namespace hhu\z\agents\bottomlevel;
|
||||
|
||||
|
||||
/**
|
||||
* Agent to display the Questgroups hierarchy path.
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
*/
|
||||
class QuestgroupshierarchypathAgent extends \nre\agents\BottomlevelAgent
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Action: index.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
public function index(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -1,38 +1,38 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
*/
|
||||
|
||||
namespace hhu\z\agents\bottomlevel;
|
||||
|
||||
|
||||
/**
|
||||
* Agent to display a sidebar with Seminary related information.
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
*/
|
||||
class SeminarybarAgent extends \nre\agents\BottomlevelAgent
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Action: index.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
public function index(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* The Legend of Z
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
*/
|
||||
|
||||
namespace hhu\z\agents\bottomlevel;
|
||||
|
||||
|
||||
/**
|
||||
* Agent to display a sidebar with Seminary related information.
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
*/
|
||||
class SeminarybarAgent extends \nre\agents\BottomlevelAgent
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Action: index.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
public function index(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -1,38 +1,38 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
*/
|
||||
|
||||
namespace hhu\z\agents\bottomlevel;
|
||||
|
||||
|
||||
/**
|
||||
* Agent to display a menu with Seminary related links.
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
*/
|
||||
class SeminarymenuAgent extends \nre\agents\BottomlevelAgent
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Action: index.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
public function index(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* The Legend of Z
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
*/
|
||||
|
||||
namespace hhu\z\agents\bottomlevel;
|
||||
|
||||
|
||||
/**
|
||||
* Agent to display a menu with Seminary related links.
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
*/
|
||||
class SeminarymenuAgent extends \nre\agents\BottomlevelAgent
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Action: index.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
public function index(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -1,38 +1,38 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
*/
|
||||
|
||||
namespace hhu\z\agents\bottomlevel;
|
||||
|
||||
|
||||
/**
|
||||
* Agent to display and manage userroles.
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
*/
|
||||
class UserrolesAgent extends \nre\agents\BottomlevelAgent
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Action: user.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
public function user(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* The Legend of Z
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
*/
|
||||
|
||||
namespace hhu\z\agents\bottomlevel;
|
||||
|
||||
|
||||
/**
|
||||
* Agent to display and manage userroles.
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
*/
|
||||
class UserrolesAgent extends \nre\agents\BottomlevelAgent
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Action: user.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
public function user(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -1,38 +1,38 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
*/
|
||||
|
||||
namespace hhu\z\agents\intermediate;
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
*/
|
||||
|
||||
/**
|
||||
* Agent to list Achievements.
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
*/
|
||||
class AchievementsAgent extends \nre\agents\IntermediateAgent
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Action: index.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
public function index(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
namespace hhu\z\agents\intermediate;
|
||||
|
||||
|
||||
/**
|
||||
* Agent to list Achievements.
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
*/
|
||||
class AchievementsAgent extends \nre\agents\IntermediateAgent
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Action: index.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
public function index(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -1,38 +1,38 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
*/
|
||||
|
||||
namespace hhu\z\agents\intermediate;
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
*/
|
||||
|
||||
/**
|
||||
* Agent to display Character groups.
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
*/
|
||||
class CharactergroupsAgent extends \nre\agents\IntermediateAgent
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Action: index.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
public function index(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
namespace hhu\z\agents\intermediate;
|
||||
|
||||
|
||||
/**
|
||||
* Agent to display Character groups.
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
*/
|
||||
class CharactergroupsAgent extends \nre\agents\IntermediateAgent
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Action: index.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
public function index(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -1,38 +1,38 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
*/
|
||||
|
||||
namespace hhu\z\agents\intermediate;
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
*/
|
||||
|
||||
/**
|
||||
* Agent to display Character groups Quests.
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
*/
|
||||
class CharactergroupsquestsAgent extends \nre\agents\IntermediateAgent
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Action: index.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
public function index(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
namespace hhu\z\agents\intermediate;
|
||||
|
||||
|
||||
/**
|
||||
* Agent to display Character groups Quests.
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
*/
|
||||
class CharactergroupsquestsAgent extends \nre\agents\IntermediateAgent
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Action: index.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
public function index(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -1,49 +1,49 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
*/
|
||||
|
||||
namespace hhu\z\agents\intermediate;
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
*/
|
||||
|
||||
/**
|
||||
* Agent to list registered Characters and their data.
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
*/
|
||||
class CharactersAgent extends \nre\agents\IntermediateAgent
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Action: index.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
public function index(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Action: character.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
public function character(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
namespace hhu\z\agents\intermediate;
|
||||
|
||||
|
||||
/**
|
||||
* Agent to list registered Characters and their data.
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
*/
|
||||
class CharactersAgent extends \nre\agents\IntermediateAgent
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Action: index.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
public function index(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Action: character.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
public function character(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -1,38 +1,38 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
*/
|
||||
|
||||
namespace hhu\z\agents\intermediate;
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
*/
|
||||
|
||||
/**
|
||||
* Agent to handle Charactertyes of a Seminary.
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
*/
|
||||
class CharactertypesAgent extends \nre\agents\IntermediateAgent
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Action: index.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
public function index(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
namespace hhu\z\agents\intermediate;
|
||||
|
||||
|
||||
/**
|
||||
* Agent to handle Charactertyes of a Seminary.
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
*/
|
||||
class CharactertypesAgent extends \nre\agents\IntermediateAgent
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Action: index.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
public function index(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -1,38 +1,38 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
*/
|
||||
|
||||
namespace hhu\z\agents\intermediate;
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
*/
|
||||
|
||||
/**
|
||||
* Agent to show an error page.
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
*/
|
||||
class ErrorAgent extends \nre\agents\IntermediateAgent
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Action: index.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
public function index(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
namespace hhu\z\agents\intermediate;
|
||||
|
||||
|
||||
/**
|
||||
* Agent to show an error page.
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
*/
|
||||
class ErrorAgent extends \nre\agents\IntermediateAgent
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Action: index.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
public function index(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -1,38 +1,38 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
*/
|
||||
|
||||
namespace hhu\z\agents\intermediate;
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
*/
|
||||
|
||||
/**
|
||||
* Agent to show an introduction page.
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
*/
|
||||
class IntroductionAgent extends \nre\agents\IntermediateAgent
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Action: index.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
public function index(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
namespace hhu\z\agents\intermediate;
|
||||
|
||||
|
||||
/**
|
||||
* Agent to show an introduction page.
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
*/
|
||||
class IntroductionAgent extends \nre\agents\IntermediateAgent
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Action: index.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
public function index(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -1,38 +1,38 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
*/
|
||||
|
||||
namespace hhu\z\agents\intermediate;
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
*/
|
||||
|
||||
/**
|
||||
* Agent to list Quest topics.
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
*/
|
||||
class LibraryAgent extends \nre\agents\IntermediateAgent
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Action: index.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
public function index(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
namespace hhu\z\agents\intermediate;
|
||||
|
||||
|
||||
/**
|
||||
* Agent to list Quest topics.
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
*/
|
||||
class LibraryAgent extends \nre\agents\IntermediateAgent
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Action: index.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
public function index(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -1,38 +1,38 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
*/
|
||||
|
||||
namespace hhu\z\agents\intermediate;
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
*/
|
||||
|
||||
/**
|
||||
* Agent to generate a mail-message.
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
*/
|
||||
class MailAgent extends \nre\agents\IntermediateAgent
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Action: index.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
public function index(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
namespace hhu\z\agents\intermediate;
|
||||
|
||||
|
||||
/**
|
||||
* Agent to generate a mail-message.
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
*/
|
||||
class MailAgent extends \nre\agents\IntermediateAgent
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Action: index.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
public function index(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -1,38 +1,38 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
*/
|
||||
|
||||
namespace hhu\z\agents\intermediate;
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
*/
|
||||
|
||||
/**
|
||||
* Agent to display a map.
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
*/
|
||||
class MapAgent extends \nre\agents\IntermediateAgent
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Action: index.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
public function index(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
namespace hhu\z\agents\intermediate;
|
||||
|
||||
|
||||
/**
|
||||
* Agent to display a map.
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
*/
|
||||
class MapAgent extends \nre\agents\IntermediateAgent
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Action: index.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
public function index(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -1,38 +1,38 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
*/
|
||||
|
||||
namespace hhu\z\agents\intermediate;
|
||||
|
||||
|
||||
/**
|
||||
* Agent to process and show media.
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
*/
|
||||
class MediaAgent extends \nre\agents\IntermediateAgent
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Action: index.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
public function index(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* The Legend of Z
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
*/
|
||||
|
||||
namespace hhu\z\agents\intermediate;
|
||||
|
||||
|
||||
/**
|
||||
* Agent to process and show media.
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
*/
|
||||
class MediaAgent extends \nre\agents\IntermediateAgent
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Action: index.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
public function index(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -1,99 +1,99 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
*/
|
||||
|
||||
namespace hhu\z\agents\intermediate;
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
*/
|
||||
|
||||
/**
|
||||
* Agent to display Questgroups.
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
*/
|
||||
class QuestgroupsAgent extends \nre\agents\IntermediateAgent
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Action: questgroup.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
public function questgroup(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
$this->addSubAgent('Questgroupshierarchypath', 'index', $request->getParam(3), $request->getParam(4));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Action: edit.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
public function edit(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
$this->addSubAgent('Questgroupshierarchypath', 'index', $request->getParam(3), $request->getParam(4));
|
||||
}
|
||||
namespace hhu\z\agents\intermediate;
|
||||
|
||||
|
||||
/**
|
||||
* Action: edittexts.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
public function edittexts(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
$this->addSubAgent('Questgroupshierarchypath', 'index', $request->getParam(3), $request->getParam(4));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Action: moveup.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
public function moveup(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
$this->addSubAgent('Questgroupshierarchypath', 'index', $request->getParam(3), $request->getParam(4));
|
||||
}
|
||||
/**
|
||||
* Agent to display Questgroups.
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
*/
|
||||
class QuestgroupsAgent extends \nre\agents\IntermediateAgent
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* Action: movedown.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
public function movedown(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
$this->addSubAgent('Questgroupshierarchypath', 'index', $request->getParam(3), $request->getParam(4));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Action: delete.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
public function delete(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
$this->addSubAgent('Questgroupshierarchypath', 'index', $request->getParam(3), $request->getParam(4));
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* Action: questgroup.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
public function questgroup(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
$this->addSubAgent('Questgroupshierarchypath', 'index', $request->getParam(3), $request->getParam(4));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Action: edit.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
public function edit(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
$this->addSubAgent('Questgroupshierarchypath', 'index', $request->getParam(3), $request->getParam(4));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Action: edittexts.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
public function edittexts(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
$this->addSubAgent('Questgroupshierarchypath', 'index', $request->getParam(3), $request->getParam(4));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Action: moveup.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
public function moveup(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
$this->addSubAgent('Questgroupshierarchypath', 'index', $request->getParam(3), $request->getParam(4));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Action: movedown.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
public function movedown(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
$this->addSubAgent('Questgroupshierarchypath', 'index', $request->getParam(3), $request->getParam(4));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Action: delete.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
public function delete(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
$this->addSubAgent('Questgroupshierarchypath', 'index', $request->getParam(3), $request->getParam(4));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -1,24 +1,24 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
*/
|
||||
|
||||
namespace hhu\z\agents\intermediate;
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
*/
|
||||
|
||||
/**
|
||||
* Agent to manage Questgroupshierarchy.
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
*/
|
||||
class QuestgroupshierarchyAgent extends \nre\agents\IntermediateAgent
|
||||
{
|
||||
}
|
||||
namespace hhu\z\agents\intermediate;
|
||||
|
||||
|
||||
/**
|
||||
* Agent to manage Questgroupshierarchy.
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
*/
|
||||
class QuestgroupshierarchyAgent extends \nre\agents\IntermediateAgent
|
||||
{
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -1,123 +1,123 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
*/
|
||||
|
||||
namespace hhu\z\agents\intermediate;
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
*/
|
||||
|
||||
/**
|
||||
* Agent to display Quests.
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
*/
|
||||
class QuestsAgent extends \nre\agents\IntermediateAgent
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Action: quest.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
public function quest(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
$this->addSubAgent('Questgroupshierarchypath', 'index', $request->getParam(3), $request->getParam(4), true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Action: submissions.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
public function submissions(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
$this->addSubAgent('Questgroupshierarchypath', 'index', $request->getParam(3), $request->getParam(4), true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Action: submission.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
public function submission(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
$this->addSubAgent('Questgroupshierarchypath', 'index', $request->getParam(3), $request->getParam(4), true);
|
||||
}
|
||||
namespace hhu\z\agents\intermediate;
|
||||
|
||||
|
||||
/**
|
||||
* Action: create.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
public function create(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
$this->addSubAgent('Questgroupshierarchypath', 'index', $request->getParam(3), $request->getParam(4), true);
|
||||
}
|
||||
/**
|
||||
* Agent to display Quests.
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
*/
|
||||
class QuestsAgent extends \nre\agents\IntermediateAgent
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* Action: edit.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
public function edit(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
$this->addSubAgent('Questgroupshierarchypath', 'index', $request->getParam(3), $request->getParam(4), true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Action: edittask.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
public function edittask(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
$this->addSubAgent('Questgroupshierarchypath', 'index', $request->getParam(3), $request->getParam(4), true);
|
||||
}
|
||||
/**
|
||||
* Action: quest.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
public function quest(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
$this->addSubAgent('Questgroupshierarchypath', 'index', $request->getParam(3), $request->getParam(4), true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Action: edittexts.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
public function edittexts(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
$this->addSubAgent('Questgroupshierarchypath', 'index', $request->getParam(3), $request->getParam(4), true);
|
||||
}
|
||||
/**
|
||||
* Action: submissions.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
public function submissions(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
$this->addSubAgent('Questgroupshierarchypath', 'index', $request->getParam(3), $request->getParam(4), true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Action: delete.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
public function delete(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
$this->addSubAgent('Questgroupshierarchypath', 'index', $request->getParam(3), $request->getParam(4), true);
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* Action: submission.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
public function submission(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
$this->addSubAgent('Questgroupshierarchypath', 'index', $request->getParam(3), $request->getParam(4), true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Action: create.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
public function create(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
$this->addSubAgent('Questgroupshierarchypath', 'index', $request->getParam(3), $request->getParam(4), true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Action: edit.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
public function edit(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
$this->addSubAgent('Questgroupshierarchypath', 'index', $request->getParam(3), $request->getParam(4), true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Action: edittask.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
public function edittask(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
$this->addSubAgent('Questgroupshierarchypath', 'index', $request->getParam(3), $request->getParam(4), true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Action: edittexts.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
public function edittexts(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
$this->addSubAgent('Questgroupshierarchypath', 'index', $request->getParam(3), $request->getParam(4), true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Action: delete.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
public function delete(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
$this->addSubAgent('Questgroupshierarchypath', 'index', $request->getParam(3), $request->getParam(4), true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -1,38 +1,38 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
*/
|
||||
|
||||
namespace hhu\z\agents\intermediate;
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
*/
|
||||
|
||||
/**
|
||||
* Agent to list registered seminaries.
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
*/
|
||||
class SeminariesAgent extends \nre\agents\IntermediateAgent
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Action: index.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
public function index(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
namespace hhu\z\agents\intermediate;
|
||||
|
||||
|
||||
/**
|
||||
* Agent to list registered seminaries.
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
*/
|
||||
class SeminariesAgent extends \nre\agents\IntermediateAgent
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Action: index.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
public function index(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -1,38 +1,38 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
*/
|
||||
|
||||
namespace hhu\z\agents\intermediate;
|
||||
|
||||
|
||||
/**
|
||||
* Agent to process and show user uploads.
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
*/
|
||||
class UploadsAgent extends \nre\agents\IntermediateAgent
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Action: index.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
public function index(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* The Legend of Z
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
*/
|
||||
|
||||
namespace hhu\z\agents\intermediate;
|
||||
|
||||
|
||||
/**
|
||||
* Agent to process and show user uploads.
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
*/
|
||||
class UploadsAgent extends \nre\agents\IntermediateAgent
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Action: index.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
public function index(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -1,50 +1,50 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
*/
|
||||
|
||||
namespace hhu\z\agents\intermediate;
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
*/
|
||||
|
||||
/**
|
||||
* Agent to list registered users and their data.
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
*/
|
||||
class UsersAgent extends \nre\agents\IntermediateAgent
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Action: index.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
public function index(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Action: user.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
public function user(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
$this->addSubAgent('Userroles', 'user');
|
||||
}
|
||||
|
||||
}
|
||||
namespace hhu\z\agents\intermediate;
|
||||
|
||||
|
||||
/**
|
||||
* Agent to list registered users and their data.
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
*/
|
||||
class UsersAgent extends \nre\agents\IntermediateAgent
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Action: index.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
public function index(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Action: user.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
public function user(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
$this->addSubAgent('Userroles', 'user');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -1,38 +1,38 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
*/
|
||||
|
||||
namespace hhu\z\agents\intermediate;
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
*/
|
||||
|
||||
/**
|
||||
* Agent to handle XP-levels of a Seminary.
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
*/
|
||||
class XplevelsAgent extends \nre\agents\IntermediateAgent
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Action: index.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
public function index(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
namespace hhu\z\agents\intermediate;
|
||||
|
||||
|
||||
/**
|
||||
* Agent to handle XP-levels of a Seminary.
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
*/
|
||||
class XplevelsAgent extends \nre\agents\IntermediateAgent
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Action: index.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
public function index(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -1,80 +1,80 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
*/
|
||||
|
||||
namespace hhu\z\agents\toplevel;
|
||||
|
||||
|
||||
/**
|
||||
* Agent to return a JSON-string used by AJAX.
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
*/
|
||||
class AjaxAgent extends \hhu\z\agents\ToplevelAgent
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Construct a new AjaxAgent.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
* @param \nre\core\Logger $log Logger instance
|
||||
*/
|
||||
protected function __construct(\nre\core\Request $request, \nre\core\Response $response, \nre\core\Logger $log=null)
|
||||
{
|
||||
parent::__construct($request, $response, $log);
|
||||
|
||||
|
||||
$this->setLanguage($request);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Action: index.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
public function index(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Set requested language.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
*/
|
||||
private function setLanguage(\nre\core\Request $request)
|
||||
{
|
||||
// Set domain
|
||||
$domain = \nre\configs\AppConfig::$app['genericname'];
|
||||
|
||||
// Get language
|
||||
$locale = $request->getGetParam('lang', 'language');
|
||||
if(is_null($locale)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Load translation
|
||||
putenv("LC_ALL=$locale");
|
||||
setlocale(LC_ALL, $locale);
|
||||
bindtextdomain($domain, ROOT.DS.\nre\configs\AppConfig::$dirs['locale']);
|
||||
textdomain($domain);
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* The Legend of Z
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
*/
|
||||
|
||||
namespace hhu\z\agents\toplevel;
|
||||
|
||||
|
||||
/**
|
||||
* Agent to return a JSON-string used by AJAX.
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
*/
|
||||
class AjaxAgent extends \hhu\z\agents\ToplevelAgent
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Construct a new AjaxAgent.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
* @param \nre\core\Logger $log Logger instance
|
||||
*/
|
||||
protected function __construct(\nre\core\Request $request, \nre\core\Response $response, \nre\core\Logger $log=null)
|
||||
{
|
||||
parent::__construct($request, $response, $log);
|
||||
|
||||
|
||||
$this->setLanguage($request);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Action: index.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
public function index(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Set requested language.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
*/
|
||||
private function setLanguage(\nre\core\Request $request)
|
||||
{
|
||||
// Set domain
|
||||
$domain = \nre\configs\AppConfig::$app['genericname'];
|
||||
|
||||
// Get language
|
||||
$locale = $request->getGetParam('lang', 'language');
|
||||
if(is_null($locale)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Load translation
|
||||
putenv("LC_ALL=$locale");
|
||||
setlocale(LC_ALL, $locale);
|
||||
bindtextdomain($domain, ROOT.DS.\nre\configs\AppConfig::$dirs['locale']);
|
||||
textdomain($domain);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -1,51 +1,51 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
*/
|
||||
|
||||
namespace hhu\z\agents\toplevel;
|
||||
|
||||
|
||||
/**
|
||||
* Agent to display binary data (e. g. images).
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
*/
|
||||
class BinaryAgent extends \hhu\z\agents\ToplevelAgent
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Construct a new BinaryAgent.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
* @param \nre\core\Logger $log Logger instance
|
||||
*/
|
||||
protected function __construct(\nre\core\Request $request, \nre\core\Response $response, \nre\core\Logger $log=null)
|
||||
{
|
||||
parent::__construct($request, $response, $log);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Action: index.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
public function index(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* The Legend of Z
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
*/
|
||||
|
||||
namespace hhu\z\agents\toplevel;
|
||||
|
||||
|
||||
/**
|
||||
* Agent to display binary data (e. g. images).
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
*/
|
||||
class BinaryAgent extends \hhu\z\agents\ToplevelAgent
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Construct a new BinaryAgent.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
* @param \nre\core\Logger $log Logger instance
|
||||
*/
|
||||
protected function __construct(\nre\core\Request $request, \nre\core\Response $response, \nre\core\Logger $log=null)
|
||||
{
|
||||
parent::__construct($request, $response, $log);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Action: index.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
public function index(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -1,38 +1,38 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
*/
|
||||
|
||||
namespace hhu\z\agents\toplevel;
|
||||
|
||||
|
||||
/**
|
||||
* Agent to display a toplevel error page.
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
*/
|
||||
class FaultAgent extends \nre\agents\ToplevelAgent
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Action: index.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
public function index(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* The Legend of Z
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
*/
|
||||
|
||||
namespace hhu\z\agents\toplevel;
|
||||
|
||||
|
||||
/**
|
||||
* Agent to display a toplevel error page.
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
*/
|
||||
class FaultAgent extends \nre\agents\ToplevelAgent
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Action: index.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
public function index(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -1,58 +1,58 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
*/
|
||||
|
||||
namespace hhu\z\agents\toplevel;
|
||||
|
||||
|
||||
/**
|
||||
* Agent to display a HTML-page.
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
*/
|
||||
class HtmlAgent extends \hhu\z\agents\ToplevelAgent
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Construct a new HtmlAgent.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
* @param \nre\core\Logger $log Logger instance
|
||||
*/
|
||||
protected function __construct(\nre\core\Request $request, \nre\core\Response $response, \nre\core\Logger $log=null)
|
||||
{
|
||||
parent::__construct($request, $response, $log);
|
||||
|
||||
|
||||
$this->setLanguage($request);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Action: index.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
public function index(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
// Add menu
|
||||
$this->addSubAgent('Menu');
|
||||
|
||||
// Add Seminary sidebar
|
||||
$this->addSubAgent('Seminarybar');
|
||||
}
|
||||
/**
|
||||
* The Legend of Z
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
*/
|
||||
|
||||
namespace hhu\z\agents\toplevel;
|
||||
|
||||
|
||||
/**
|
||||
* Agent to display a HTML-page.
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
*/
|
||||
class HtmlAgent extends \hhu\z\agents\ToplevelAgent
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Construct a new HtmlAgent.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
* @param \nre\core\Logger $log Logger instance
|
||||
*/
|
||||
protected function __construct(\nre\core\Request $request, \nre\core\Response $response, \nre\core\Logger $log=null)
|
||||
{
|
||||
parent::__construct($request, $response, $log);
|
||||
|
||||
|
||||
$this->setLanguage($request);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Action: index.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
public function index(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
// Add menu
|
||||
$this->addSubAgent('Menu');
|
||||
|
||||
// Add Seminary sidebar
|
||||
$this->addSubAgent('Seminarybar');
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,52 +1,52 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
*/
|
||||
|
||||
namespace hhu\z\agents\toplevel;
|
||||
|
||||
|
||||
/**
|
||||
* Agent for generating a HTML-mail message.
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
*/
|
||||
class HtmlmailAgent extends \hhu\z\agents\ToplevelAgent
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Construct a new HtmlmailAgent.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
* @param \nre\core\Logger $log Logger instance
|
||||
*/
|
||||
protected function __construct(\nre\core\Request $request, \nre\core\Response $response, \nre\core\Logger $log=null)
|
||||
{
|
||||
parent::__construct($request, $response, $log);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Action: index.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
public function index(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
$this->addSubagent('mailreceiver', 'index', $request->getParam(3));
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* The Legend of Z
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
*/
|
||||
|
||||
namespace hhu\z\agents\toplevel;
|
||||
|
||||
|
||||
/**
|
||||
* Agent for generating a HTML-mail message.
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
*/
|
||||
class HtmlmailAgent extends \hhu\z\agents\ToplevelAgent
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Construct a new HtmlmailAgent.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
* @param \nre\core\Logger $log Logger instance
|
||||
*/
|
||||
protected function __construct(\nre\core\Request $request, \nre\core\Response $response, \nre\core\Logger $log=null)
|
||||
{
|
||||
parent::__construct($request, $response, $log);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Action: index.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
public function index(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
$this->addSubagent('mailreceiver', 'index', $request->getParam(3));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -1,54 +1,53 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
*/
|
||||
|
||||
namespace hhu\z\agents\toplevel;
|
||||
|
||||
|
||||
/**
|
||||
* Agent for generating a simple text-mail message.
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
*/
|
||||
class TextmailAgent extends \hhu\z\agents\ToplevelAgent
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Construct a new TextmailAgent.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
* @param \nre\core\Logger $log Logger instance
|
||||
*/
|
||||
protected function __construct(\nre\core\Request $request, \nre\core\Response $response, \nre\core\Logger $log=null)
|
||||
{
|
||||
parent::__construct($request, $response, $log);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Action: index.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
public function index(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
$this->addSubagent('mailreceiver', 'index', $request->getParam(3));
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* The Legend of Z
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
*/
|
||||
|
||||
namespace hhu\z\agents\toplevel;
|
||||
|
||||
/**
|
||||
* Agent for generating a simple text-mail message.
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
*/
|
||||
class TextmailAgent extends \hhu\z\agents\ToplevelAgent
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Construct a new TextmailAgent.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
* @param \nre\core\Logger $log Logger instance
|
||||
*/
|
||||
protected function __construct(\nre\core\Request $request, \nre\core\Response $response, \nre\core\Logger $log=null)
|
||||
{
|
||||
parent::__construct($request, $response, $log);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Action: index.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
public function index(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
$this->addSubagent('mailreceiver', 'index', $request->getParam(3));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -1,134 +1,134 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
*/
|
||||
|
||||
namespace hhu\z;
|
||||
|
||||
|
||||
/**
|
||||
* Abstract class for implementing an application Controller.
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
*/
|
||||
abstract class Controller extends \nre\core\Controller
|
||||
{
|
||||
/**
|
||||
* Required components
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $components = array('auth');
|
||||
|
||||
/**
|
||||
* Logger instance
|
||||
*
|
||||
* @var \nre\core\Logger
|
||||
*/
|
||||
protected $log = null;
|
||||
/**
|
||||
* Linker instance
|
||||
*
|
||||
* @var \nre\core\Linker
|
||||
*/
|
||||
protected $linker = null;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Construct a new application Controller.
|
||||
*
|
||||
* @throws \nre\exceptions\DriverNotFoundException
|
||||
* @throws \nre\exceptions\DriverNotValidException
|
||||
* @throws \nre\exceptions\ModelNotValidException
|
||||
* @throws \nre\exceptions\ModelNotFoundException
|
||||
* @throws \nre\exceptions\ViewNotFoundException
|
||||
* @param string $layoutName Name of the current Layout
|
||||
* @param string $action Current Action
|
||||
* @param \nre\core\Agent $agent Corresponding Agent
|
||||
*/
|
||||
public function __construct($layoutName, $action, $agent)
|
||||
{
|
||||
parent::__construct($layoutName, $action, $agent);
|
||||
|
||||
// Create logger
|
||||
$this->log = new \nre\core\Logger();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Prefilter that is executed before running the Controller.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
public function preFilter(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
parent::preFilter($request, $response);
|
||||
|
||||
// Create linker
|
||||
$this->linker = new \nre\core\Linker($request);
|
||||
$this->set('linker', $this->linker);
|
||||
|
||||
// Create text formatter
|
||||
$this->set('t', new \hhu\z\TextFormatter($this->linker));
|
||||
|
||||
// Create date and time and number formatter
|
||||
$this->set('dateFormatter', new \IntlDateFormatter(
|
||||
//\nre\core\Config::getDefault('locale'),
|
||||
/**
|
||||
* The Legend of Z
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
*/
|
||||
|
||||
namespace hhu\z;
|
||||
|
||||
|
||||
/**
|
||||
* Abstract class for implementing an application Controller.
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
*/
|
||||
abstract class Controller extends \nre\core\Controller
|
||||
{
|
||||
/**
|
||||
* Required components
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $components = array('auth');
|
||||
|
||||
/**
|
||||
* Logger instance
|
||||
*
|
||||
* @var \nre\core\Logger
|
||||
*/
|
||||
protected $log = null;
|
||||
/**
|
||||
* Linker instance
|
||||
*
|
||||
* @var \nre\core\Linker
|
||||
*/
|
||||
protected $linker = null;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Construct a new application Controller.
|
||||
*
|
||||
* @throws \nre\exceptions\DriverNotFoundException
|
||||
* @throws \nre\exceptions\DriverNotValidException
|
||||
* @throws \nre\exceptions\ModelNotValidException
|
||||
* @throws \nre\exceptions\ModelNotFoundException
|
||||
* @throws \nre\exceptions\ViewNotFoundException
|
||||
* @param string $layoutName Name of the current Layout
|
||||
* @param string $action Current Action
|
||||
* @param \nre\core\Agent $agent Corresponding Agent
|
||||
*/
|
||||
public function __construct($layoutName, $action, $agent)
|
||||
{
|
||||
parent::__construct($layoutName, $action, $agent);
|
||||
|
||||
// Create logger
|
||||
$this->log = new \nre\core\Logger();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Prefilter that is executed before running the Controller.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
public function preFilter(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
parent::preFilter($request, $response);
|
||||
|
||||
// Create linker
|
||||
$this->linker = new \nre\core\Linker($request);
|
||||
$this->set('linker', $this->linker);
|
||||
|
||||
// Create text formatter
|
||||
$this->set('t', new \hhu\z\TextFormatter($this->linker));
|
||||
|
||||
// Create date and time and number formatter
|
||||
$this->set('dateFormatter', new \IntlDateFormatter(
|
||||
//\nre\core\Config::getDefault('locale'),
|
||||
\Locale::getDefault(),
|
||||
\IntlDateFormatter::MEDIUM,
|
||||
\IntlDateFormatter::NONE,
|
||||
NULL
|
||||
));
|
||||
$this->set('timeFormatter', new \IntlDateFormatter(
|
||||
//\nre\core\Config::getDefault('locale'),
|
||||
\IntlDateFormatter::MEDIUM,
|
||||
\IntlDateFormatter::NONE,
|
||||
NULL
|
||||
));
|
||||
$this->set('timeFormatter', new \IntlDateFormatter(
|
||||
//\nre\core\Config::getDefault('locale'),
|
||||
\Locale::getDefault(),
|
||||
\IntlDateFormatter::NONE,
|
||||
\IntlDateFormatter::SHORT,
|
||||
NULL
|
||||
));
|
||||
$this->set('numberFormatter', new \NumberFormatter(
|
||||
//\nre\core\Config::getDefault('locale'),
|
||||
\IntlDateFormatter::NONE,
|
||||
\IntlDateFormatter::SHORT,
|
||||
NULL
|
||||
));
|
||||
$this->set('numberFormatter', new \NumberFormatter(
|
||||
//\nre\core\Config::getDefault('locale'),
|
||||
\Locale::getDefault(),
|
||||
\NumberFormatter::DEFAULT_STYLE
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Postfilter that is executed after running the Controller.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
public function postFilter(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
parent::postFilter($request, $response);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Log an error.
|
||||
*
|
||||
* @param string $message Error message to log
|
||||
* @param int $logMode Log mode (optional)
|
||||
*/
|
||||
protected function log($message, $logMode=\nre\core\Logger::LOGMODE_AUTO)
|
||||
{
|
||||
$this->log->log($message, $logMode);
|
||||
}
|
||||
|
||||
}
|
||||
\NumberFormatter::DEFAULT_STYLE
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Postfilter that is executed after running the Controller.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
public function postFilter(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
parent::postFilter($request, $response);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Log an error.
|
||||
*
|
||||
* @param string $message Error message to log
|
||||
* @param int $logMode Log mode (optional)
|
||||
*/
|
||||
protected function log($message, $logMode=\nre\core\Logger::LOGMODE_AUTO)
|
||||
{
|
||||
$this->log->log($message, $logMode);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -1,42 +1,42 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
*/
|
||||
|
||||
namespace hhu\z;
|
||||
|
||||
|
||||
/**
|
||||
* Abstract class for implementing an application Model.
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
*/
|
||||
class Model extends \nre\models\DatabaseModel
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Construct a new application Model.
|
||||
*
|
||||
* @throws \nre\exceptions\DatamodelException
|
||||
* @throws \nre\exceptions\DriverNotFoundException
|
||||
* @throws \nre\exceptions\DriverNotValidException
|
||||
* @throws \nre\exceptions\ModelNotValidException
|
||||
* @throws \nre\exceptions\ModelNotFoundException
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct('mysqli', \nre\configs\AppConfig::$database);
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* The Legend of Z
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
*/
|
||||
|
||||
namespace hhu\z;
|
||||
|
||||
|
||||
/**
|
||||
* Abstract class for implementing an application Model.
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
*/
|
||||
class Model extends \nre\models\DatabaseModel
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Construct a new application Model.
|
||||
*
|
||||
* @throws \nre\exceptions\DatamodelException
|
||||
* @throws \nre\exceptions\DriverNotFoundException
|
||||
* @throws \nre\exceptions\DriverNotValidException
|
||||
* @throws \nre\exceptions\ModelNotValidException
|
||||
* @throws \nre\exceptions\ModelNotFoundException
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct('mysqli', \nre\configs\AppConfig::$database);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -1,149 +1,149 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
*/
|
||||
|
||||
namespace hhu\z;
|
||||
|
||||
|
||||
/**
|
||||
* Class to format text with different syntax tags.
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
*/
|
||||
class TextFormatter
|
||||
{
|
||||
/**
|
||||
* Linker to create links.
|
||||
*
|
||||
* @var \nre\core\Linker
|
||||
*/
|
||||
private $linker;
|
||||
/**
|
||||
* Media-Model to retrieve media data
|
||||
*
|
||||
* @static
|
||||
* @var \nre\core\Model
|
||||
*/
|
||||
private static $Media = null;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Create a new text formatter.
|
||||
*
|
||||
* @param \nre\core\Linker $linker Linker to create links with
|
||||
*/
|
||||
public function __construct(\nre\core\Linker $linker)
|
||||
{
|
||||
$this->linker = $linker;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Format a string.
|
||||
*
|
||||
* @param string $string String to format
|
||||
* @return string Formatted string
|
||||
*/
|
||||
public function t($string)
|
||||
{
|
||||
// Remove chars
|
||||
$string = htmlspecialchars($string, ENT_NOQUOTES);
|
||||
|
||||
// Important text
|
||||
$string = str_replace('[strong]', '<strong>', $string);
|
||||
$string = str_replace('[/strong]', '</strong>', $string);
|
||||
|
||||
// Create tables
|
||||
$string = preg_replace('/(\[table\])\s+/u', '$1', $string);
|
||||
$string = preg_replace('/\s*(\[tr\])\s*/u', '$1', $string);
|
||||
$string = preg_replace('%\s+(\[/table\])%u', '$1', $string);
|
||||
$string = preg_replace('%\s*(\[/tr\])\s*%u', '$1', $string);
|
||||
$string = str_replace('[table]', '</p><table>', $string);
|
||||
$string = str_replace('[/table]', '</table><p>', $string);
|
||||
$string = str_replace('[tr]', '<tr>', $string);
|
||||
$string = str_replace('[/tr]', '</tr>', $string);
|
||||
$string = str_replace('[th]', '<th>', $string);
|
||||
$string = str_replace('[/th]', '</th>', $string);
|
||||
$string = str_replace('[td]', '<td>', $string);
|
||||
$string = str_replace('[/td]', '</td>', $string);
|
||||
|
||||
// Create links
|
||||
$string = preg_replace('!(^|\s)"([^"]+)":(https?://[^\s]+)(\s|$)!i', '$1<a href="$3">$2</a>$4', $string);
|
||||
$string = preg_replace('!(^|\s)(https?://[^\s]+)(\s|$)!i', '$1<a href="$2">$2</a>$3', $string);
|
||||
|
||||
// Handle Seminarymedia
|
||||
$seminarymedia = array();
|
||||
preg_match_all('/\[seminarymedia:(\d+)\]/iu', $string, $matches); //, PREG_SET_ORDER | PREG_OFFSET_CAPTURE);
|
||||
$seminarymediaIds = array_unique($matches[1]);
|
||||
foreach($seminarymediaIds as &$seminarymediaId)
|
||||
{
|
||||
$replacement = null;
|
||||
if(!is_null(\hhu\z\controllers\SeminaryController::$seminary) && $this->loadMediaModel())
|
||||
{
|
||||
try {
|
||||
$medium = self::$Media->getSeminaryMediaById($seminarymediaId);
|
||||
$replacement = sprintf(
|
||||
'<img src="%s" alt="%s" />',
|
||||
$this->linker->link(array('media','seminary', \hhu\z\controllers\SeminaryController::$seminary['url'],$medium['url'])),
|
||||
$medium['description']
|
||||
);
|
||||
}
|
||||
catch(\nre\exceptions\IdNotFoundException $e) {
|
||||
}
|
||||
}
|
||||
|
||||
$seminarymedia[$seminarymediaId] = $replacement;
|
||||
}
|
||||
foreach($seminarymedia as $seminarymediaId => $replacement) {
|
||||
$string = str_replace("[seminarymedia:$seminarymediaId]", $replacement, $string);
|
||||
}
|
||||
|
||||
|
||||
// Return processed string
|
||||
return nl2br($string);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Load the Media-Model if it is not loaded
|
||||
*
|
||||
* @return boolean Whether the Media-Model has been loaded or not
|
||||
*/
|
||||
private function loadMediaModel()
|
||||
{
|
||||
// Do not load Model if it has already been loaded
|
||||
if(!is_null(self::$Media)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
try {
|
||||
// Load class
|
||||
Model::load('media');
|
||||
|
||||
// Construct Model
|
||||
self::$Media = Model::factory('media');
|
||||
}
|
||||
catch(\Exception $e) {
|
||||
}
|
||||
|
||||
|
||||
// Return whether Media-Model has been loaded or not
|
||||
return !is_null(self::$Media);
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* The Legend of Z
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
*/
|
||||
|
||||
namespace hhu\z;
|
||||
|
||||
|
||||
/**
|
||||
* Class to format text with different syntax tags.
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
*/
|
||||
class TextFormatter
|
||||
{
|
||||
/**
|
||||
* Linker to create links.
|
||||
*
|
||||
* @var \nre\core\Linker
|
||||
*/
|
||||
private $linker;
|
||||
/**
|
||||
* Media-Model to retrieve media data
|
||||
*
|
||||
* @static
|
||||
* @var \nre\core\Model
|
||||
*/
|
||||
private static $Media = null;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Create a new text formatter.
|
||||
*
|
||||
* @param \nre\core\Linker $linker Linker to create links with
|
||||
*/
|
||||
public function __construct(\nre\core\Linker $linker)
|
||||
{
|
||||
$this->linker = $linker;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Format a string.
|
||||
*
|
||||
* @param string $string String to format
|
||||
* @return string Formatted string
|
||||
*/
|
||||
public function t($string)
|
||||
{
|
||||
// Remove chars
|
||||
$string = htmlspecialchars($string, ENT_NOQUOTES);
|
||||
|
||||
// Important text
|
||||
$string = str_replace('[strong]', '<strong>', $string);
|
||||
$string = str_replace('[/strong]', '</strong>', $string);
|
||||
|
||||
// Create tables
|
||||
$string = preg_replace('/(\[table\])\s+/u', '$1', $string);
|
||||
$string = preg_replace('/\s*(\[tr\])\s*/u', '$1', $string);
|
||||
$string = preg_replace('%\s+(\[/table\])%u', '$1', $string);
|
||||
$string = preg_replace('%\s*(\[/tr\])\s*%u', '$1', $string);
|
||||
$string = str_replace('[table]', '</p><table>', $string);
|
||||
$string = str_replace('[/table]', '</table><p>', $string);
|
||||
$string = str_replace('[tr]', '<tr>', $string);
|
||||
$string = str_replace('[/tr]', '</tr>', $string);
|
||||
$string = str_replace('[th]', '<th>', $string);
|
||||
$string = str_replace('[/th]', '</th>', $string);
|
||||
$string = str_replace('[td]', '<td>', $string);
|
||||
$string = str_replace('[/td]', '</td>', $string);
|
||||
|
||||
// Create links
|
||||
$string = preg_replace('!(^|\s)"([^"]+)":(https?://[^\s]+)(\s|$)!i', '$1<a href="$3">$2</a>$4', $string);
|
||||
$string = preg_replace('!(^|\s)(https?://[^\s]+)(\s|$)!i', '$1<a href="$2">$2</a>$3', $string);
|
||||
|
||||
// Handle Seminarymedia
|
||||
$seminarymedia = array();
|
||||
preg_match_all('/\[seminarymedia:(\d+)\]/iu', $string, $matches); //, PREG_SET_ORDER | PREG_OFFSET_CAPTURE);
|
||||
$seminarymediaIds = array_unique($matches[1]);
|
||||
foreach($seminarymediaIds as &$seminarymediaId)
|
||||
{
|
||||
$replacement = null;
|
||||
if(!is_null(\hhu\z\controllers\SeminaryController::$seminary) && $this->loadMediaModel())
|
||||
{
|
||||
try {
|
||||
$medium = self::$Media->getSeminaryMediaById($seminarymediaId);
|
||||
$replacement = sprintf(
|
||||
'<img src="%s" alt="%s" />',
|
||||
$this->linker->link(array('media','seminary', \hhu\z\controllers\SeminaryController::$seminary['url'],$medium['url'])),
|
||||
$medium['description']
|
||||
);
|
||||
}
|
||||
catch(\nre\exceptions\IdNotFoundException $e) {
|
||||
}
|
||||
}
|
||||
|
||||
$seminarymedia[$seminarymediaId] = $replacement;
|
||||
}
|
||||
foreach($seminarymedia as $seminarymediaId => $replacement) {
|
||||
$string = str_replace("[seminarymedia:$seminarymediaId]", $replacement, $string);
|
||||
}
|
||||
|
||||
|
||||
// Return processed string
|
||||
return nl2br($string);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Load the Media-Model if it is not loaded
|
||||
*
|
||||
* @return boolean Whether the Media-Model has been loaded or not
|
||||
*/
|
||||
private function loadMediaModel()
|
||||
{
|
||||
// Do not load Model if it has already been loaded
|
||||
if(!is_null(self::$Media)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
try {
|
||||
// Load class
|
||||
Model::load('media');
|
||||
|
||||
// Construct Model
|
||||
self::$Media = Model::factory('media');
|
||||
}
|
||||
catch(\Exception $e) {
|
||||
}
|
||||
|
||||
|
||||
// Return whether Media-Model has been loaded or not
|
||||
return !is_null(self::$Media);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
420
app/Utils.inc
420
app/Utils.inc
|
@ -1,214 +1,214 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
*/
|
||||
|
||||
namespace hhu\z;
|
||||
|
||||
|
||||
/**
|
||||
* Class for implementing utility methods.
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
*/
|
||||
class Utils
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* Mask HTML-chars for save output.
|
||||
*
|
||||
* @static
|
||||
* @param string $string String to be masked
|
||||
* @return string Masked string
|
||||
*/
|
||||
public static function t($string)
|
||||
{
|
||||
return nl2br(htmlspecialchars($string));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* ‚htmlspecialchars‘ with support for UTF-8.
|
||||
*
|
||||
* @static
|
||||
* @param string $string String to be masked
|
||||
* @return string Masked string
|
||||
*/
|
||||
public static function htmlspecialchars_utf8($string)
|
||||
{
|
||||
return htmlspecialchars($string, ENT_COMPAT, 'UTF-8');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Cut a string to the given length but only word boundaries.
|
||||
*
|
||||
* @static
|
||||
* @param string $string String to cut
|
||||
* @param int $length Length to cut string
|
||||
* @param int $scope Maximum length to cut string regardless word boundaries
|
||||
* @return string Cutted string
|
||||
*/
|
||||
public static function shortenString($string, $length, $scope)
|
||||
{
|
||||
// Determine length
|
||||
$length = min($length, strlen($string));
|
||||
|
||||
// Look for word boundary
|
||||
if(($pos = strpos($string, ' ', $length)) !== false)
|
||||
{
|
||||
// Check if boundary is outside of scope
|
||||
if($pos > $length + $scope) {
|
||||
$pos = strrpos(substr($string, 0, $pos), ' ');
|
||||
}
|
||||
}
|
||||
else {
|
||||
$pos = strlen($string);
|
||||
}
|
||||
|
||||
|
||||
// Cut string and return it
|
||||
return substr($string, 0, $pos);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Send an e‑mail.
|
||||
*
|
||||
* @throws \hhu\z\exceptions\MailingException
|
||||
* @param mixed $to One (string) or many (array) receivers
|
||||
* @param string $messageAction Message Action
|
||||
* @param boolean $html Whether mail should be formatted as HTML or not
|
||||
* @param array $params Parameters to pass
|
||||
* @param \nre\core\Linker $linker Linker instance
|
||||
*/
|
||||
public static function sendMail($to, $messageAction, $html=false, $params=null, $linker=null)
|
||||
{
|
||||
// Check configuration
|
||||
if(
|
||||
empty(\nre\configs\AppConfig::$mail['host']) ||
|
||||
empty(\nre\configs\AppConfig::$mail['port']) ||
|
||||
empty(\nre\configs\AppConfig::$mail['username'])
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Load classes
|
||||
\hhu\z\lib\PHPMailerAutoload::load();
|
||||
\hhu\z\lib\PHPMailer::load();
|
||||
\hhu\z\lib\SMTP::load();
|
||||
|
||||
// Create mailer
|
||||
$mail = new \PHPMailer();
|
||||
|
||||
// Configure mailer
|
||||
$mail->isSMTP();
|
||||
$mail->Host = \nre\configs\AppConfig::$mail['host'];
|
||||
$mail->Port = \nre\configs\AppConfig::$mail['port'];
|
||||
$mail->SMTPAuth = true;
|
||||
$mail->Username = \nre\configs\AppConfig::$mail['username'];
|
||||
$mail->Password = \nre\configs\AppConfig::$mail['password'];
|
||||
$mail->SMTPSecure = \nre\configs\AppConfig::$mail['secure'];
|
||||
|
||||
// Set properties
|
||||
$mail->CharSet = 'UTF-8';
|
||||
$mail->From = \nre\configs\AppConfig::$app['mailsender'];
|
||||
$mail->FromName = \nre\configs\AppConfig::$app['name'];
|
||||
if(!is_array($to)) {
|
||||
$to = array($to);
|
||||
}
|
||||
foreach($to as &$receiver) {
|
||||
$mail->addAddress($receiver);
|
||||
}
|
||||
if($html) {
|
||||
$mail->isHTML(true);
|
||||
}
|
||||
|
||||
// Create message
|
||||
try {
|
||||
// Create MailApi
|
||||
$mailApi = new \hhu\z\apis\MailApi();
|
||||
if(!is_null($linker)) {
|
||||
$mailApi->setLinker($linker);
|
||||
}
|
||||
$mailApi->setMessage($messageAction);
|
||||
$mailApi->setParams($params);
|
||||
if($html) {
|
||||
$mailApi->setHTML();
|
||||
}
|
||||
|
||||
// Render message
|
||||
$exception = $mailApi->run();
|
||||
if(!is_null($exception)) {
|
||||
return $exception;
|
||||
}
|
||||
$mail->Subject = $mailApi->getSubject();
|
||||
$mail->Body = $mailApi->render();
|
||||
|
||||
// Try to render alternativ plaintext message
|
||||
if($html)
|
||||
{
|
||||
$mailApi->setHTML(false);
|
||||
|
||||
// Render message
|
||||
$exception = $mailApi->run();
|
||||
if(is_null($exception))
|
||||
{
|
||||
try {
|
||||
$mail->AltBody = $mailApi->render();
|
||||
}
|
||||
catch(\nre\core\Exception $e) {
|
||||
// No alternative plaintext available
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch(\nre\core\Exception $e) {
|
||||
throw new \hhu\z\exceptions\MailingException($e->getMessage());
|
||||
}
|
||||
|
||||
|
||||
// Return status
|
||||
if(!$mail->send()) {
|
||||
throw new \hhu\z\exceptions\MailingException($mail->ErrorInfo);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Detect Mimetype of a file.
|
||||
*
|
||||
* @param string $filename Name of file to detect Mimetype of
|
||||
* @param string $defaultMimetype Default Mimetype to use
|
||||
* @return string Detected Mimetype of file
|
||||
*/
|
||||
public static function getMimetype($filename, $defaultMimetype=null)
|
||||
{
|
||||
$mimetype = (!is_null($defaultMimetype)) ? $defaultMimetype : 'application/octet-stream';
|
||||
// Use Fileinfo
|
||||
if(class_exists('\finfo'))
|
||||
{
|
||||
$finfo = new \finfo(FILEINFO_MIME_TYPE);
|
||||
if(!is_null($finfo)) {
|
||||
$mimetype = $finfo->file($filename);
|
||||
}
|
||||
}
|
||||
// Use deprecated mime_content_type()
|
||||
elseif(function_exists('mime_content_type')) {
|
||||
$mimetype = mime_content_type($filename);
|
||||
}
|
||||
|
||||
|
||||
return $mimetype;
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* The Legend of Z
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
*/
|
||||
|
||||
namespace hhu\z;
|
||||
|
||||
|
||||
/**
|
||||
* Class for implementing utility methods.
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
*/
|
||||
class Utils
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* Mask HTML-chars for save output.
|
||||
*
|
||||
* @static
|
||||
* @param string $string String to be masked
|
||||
* @return string Masked string
|
||||
*/
|
||||
public static function t($string)
|
||||
{
|
||||
return nl2br(htmlspecialchars($string));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* ‚htmlspecialchars‘ with support for UTF-8.
|
||||
*
|
||||
* @static
|
||||
* @param string $string String to be masked
|
||||
* @return string Masked string
|
||||
*/
|
||||
public static function htmlspecialchars_utf8($string)
|
||||
{
|
||||
return htmlspecialchars($string, ENT_COMPAT, 'UTF-8');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Cut a string to the given length but only word boundaries.
|
||||
*
|
||||
* @static
|
||||
* @param string $string String to cut
|
||||
* @param int $length Length to cut string
|
||||
* @param int $scope Maximum length to cut string regardless word boundaries
|
||||
* @return string Cutted string
|
||||
*/
|
||||
public static function shortenString($string, $length, $scope)
|
||||
{
|
||||
// Determine length
|
||||
$length = min($length, strlen($string));
|
||||
|
||||
// Look for word boundary
|
||||
if(($pos = strpos($string, ' ', $length)) !== false)
|
||||
{
|
||||
// Check if boundary is outside of scope
|
||||
if($pos > $length + $scope) {
|
||||
$pos = strrpos(substr($string, 0, $pos), ' ');
|
||||
}
|
||||
}
|
||||
else {
|
||||
$pos = strlen($string);
|
||||
}
|
||||
|
||||
|
||||
// Cut string and return it
|
||||
return substr($string, 0, $pos);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Send an e‑mail.
|
||||
*
|
||||
* @throws \hhu\z\exceptions\MailingException
|
||||
* @param mixed $to One (string) or many (array) receivers
|
||||
* @param string $messageAction Message Action
|
||||
* @param boolean $html Whether mail should be formatted as HTML or not
|
||||
* @param array $params Parameters to pass
|
||||
* @param \nre\core\Linker $linker Linker instance
|
||||
*/
|
||||
public static function sendMail($to, $messageAction, $html=false, $params=null, $linker=null)
|
||||
{
|
||||
// Check configuration
|
||||
if(
|
||||
empty(\nre\configs\AppConfig::$mail['host']) ||
|
||||
empty(\nre\configs\AppConfig::$mail['port']) ||
|
||||
empty(\nre\configs\AppConfig::$mail['username'])
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Load classes
|
||||
\hhu\z\lib\PHPMailerAutoload::load();
|
||||
\hhu\z\lib\PHPMailer::load();
|
||||
\hhu\z\lib\SMTP::load();
|
||||
|
||||
// Create mailer
|
||||
$mail = new \PHPMailer();
|
||||
|
||||
// Configure mailer
|
||||
$mail->isSMTP();
|
||||
$mail->Host = \nre\configs\AppConfig::$mail['host'];
|
||||
$mail->Port = \nre\configs\AppConfig::$mail['port'];
|
||||
$mail->SMTPAuth = true;
|
||||
$mail->Username = \nre\configs\AppConfig::$mail['username'];
|
||||
$mail->Password = \nre\configs\AppConfig::$mail['password'];
|
||||
$mail->SMTPSecure = \nre\configs\AppConfig::$mail['secure'];
|
||||
|
||||
// Set properties
|
||||
$mail->CharSet = 'UTF-8';
|
||||
$mail->From = \nre\configs\AppConfig::$app['mailsender'];
|
||||
$mail->FromName = \nre\configs\AppConfig::$app['name'];
|
||||
if(!is_array($to)) {
|
||||
$to = array($to);
|
||||
}
|
||||
foreach($to as &$receiver) {
|
||||
$mail->addAddress($receiver);
|
||||
}
|
||||
if($html) {
|
||||
$mail->isHTML(true);
|
||||
}
|
||||
|
||||
// Create message
|
||||
try {
|
||||
// Create MailApi
|
||||
$mailApi = new \hhu\z\apis\MailApi();
|
||||
if(!is_null($linker)) {
|
||||
$mailApi->setLinker($linker);
|
||||
}
|
||||
$mailApi->setMessage($messageAction);
|
||||
$mailApi->setParams($params);
|
||||
if($html) {
|
||||
$mailApi->setHTML();
|
||||
}
|
||||
|
||||
// Render message
|
||||
$exception = $mailApi->run();
|
||||
if(!is_null($exception)) {
|
||||
return $exception;
|
||||
}
|
||||
$mail->Subject = $mailApi->getSubject();
|
||||
$mail->Body = $mailApi->render();
|
||||
|
||||
// Try to render alternativ plaintext message
|
||||
if($html)
|
||||
{
|
||||
$mailApi->setHTML(false);
|
||||
|
||||
// Render message
|
||||
$exception = $mailApi->run();
|
||||
if(is_null($exception))
|
||||
{
|
||||
try {
|
||||
$mail->AltBody = $mailApi->render();
|
||||
}
|
||||
catch(\nre\core\Exception $e) {
|
||||
// No alternative plaintext available
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch(\nre\core\Exception $e) {
|
||||
throw new \hhu\z\exceptions\MailingException($e->getMessage());
|
||||
}
|
||||
|
||||
|
||||
// Return status
|
||||
if(!$mail->send()) {
|
||||
throw new \hhu\z\exceptions\MailingException($mail->ErrorInfo);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Detect Mimetype of a file.
|
||||
*
|
||||
* @param string $filename Name of file to detect Mimetype of
|
||||
* @param string $defaultMimetype Default Mimetype to use
|
||||
* @return string Detected Mimetype of file
|
||||
*/
|
||||
public static function getMimetype($filename, $defaultMimetype=null)
|
||||
{
|
||||
$mimetype = (!is_null($defaultMimetype)) ? $defaultMimetype : 'application/octet-stream';
|
||||
// Use Fileinfo
|
||||
if(class_exists('\finfo'))
|
||||
{
|
||||
$finfo = new \finfo(FILEINFO_MIME_TYPE);
|
||||
if(!is_null($finfo)) {
|
||||
$mimetype = $finfo->file($filename);
|
||||
}
|
||||
}
|
||||
// Use deprecated mime_content_type()
|
||||
elseif(function_exists('mime_content_type')) {
|
||||
$mimetype = mime_content_type($filename);
|
||||
}
|
||||
|
||||
|
||||
return $mimetype;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -1,268 +1,268 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
*/
|
||||
|
||||
namespace hhu\z\agents;
|
||||
|
||||
|
||||
/**
|
||||
* Abstract class for implementing a QuesttypeAgent.
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
*/
|
||||
abstract class QuesttypeAgent extends \nre\agents\BottomlevelAgent
|
||||
{
|
||||
/**
|
||||
* Current request
|
||||
*
|
||||
* @var \nre\core\Request
|
||||
*/
|
||||
private $request;
|
||||
/**
|
||||
* Current response
|
||||
*
|
||||
* @var \nre\core\Response
|
||||
*/
|
||||
private $response;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Load a QuesttypeAgent.
|
||||
*
|
||||
* @static
|
||||
* @throws \hhu\z\exceptions\QuesttypeAgentNotFoundException
|
||||
* @throws \hhu\z\exceptions\QuesttypeAgentNotValidException
|
||||
* @param string $questtypeName Name of the QuesttypeAgent to load
|
||||
*/
|
||||
public static function load($questtypeName)
|
||||
{
|
||||
// Determine full classname
|
||||
$className = self::getClassName($questtypeName);
|
||||
|
||||
try {
|
||||
// Load class
|
||||
static::loadClass($questtypeName, $className);
|
||||
|
||||
// Validate class
|
||||
static::checkClass($className, get_class());
|
||||
}
|
||||
catch(\nre\exceptions\ClassNotValidException $e) {
|
||||
throw new \hhu\z\exceptions\QuesttypeAgentNotValidException($e->getClassName());
|
||||
}
|
||||
catch(\nre\exceptions\ClassNotFoundException $e) {
|
||||
throw new \hhu\z\exceptions\QuesttypeAgentNotFoundException($e->getClassName());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Instantiate a QuesttypeAgent (Factory Pattern).
|
||||
*
|
||||
* @static
|
||||
* @throws \nre\exceptions\DatamodelException
|
||||
* @throws \nre\exceptions\DriverNotValidException
|
||||
* @throws \nre\exceptions\DriverNotFoundException
|
||||
* @throws \nre\exceptions\ViewNotFoundException
|
||||
* @throws \hhu\z\exceptions\QuesttypeModelNotValidException
|
||||
* @throws \hhu\z\exceptions\QuesttypeModelNotFoundException
|
||||
* @throws \hhu\z\exceptions\QuesttypeControllerNotValidException
|
||||
* @throws \hhu\z\exceptions\QuesttypeControllerNotFoundException
|
||||
* @param string $questtypeName Name of the QuesttypeAgent to instantiate
|
||||
* @param Request $request Current request
|
||||
* @param Response $response Current respone
|
||||
* @param Logger $log Log-system
|
||||
*/
|
||||
public static function factory($questtypeName, \nre\core\Request $request, \nre\core\Response $response, \nre\core\Logger $log=null)
|
||||
{
|
||||
// Determine full classname
|
||||
$className = self::getClassName($questtypeName);
|
||||
|
||||
// Construct and return Questmodule
|
||||
return new $className($request, $response, $log);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Determine the Agent-classname for the given Questtype-name.
|
||||
*
|
||||
* @static
|
||||
* @param string $questtypeName Questtype-name to get Agent-classname of
|
||||
* @param string $agentType Agent type of given Agent name
|
||||
* @return string Classname for the Questtype-name
|
||||
*/
|
||||
private static function getClassName($questtypeName, $agentType=null)
|
||||
{
|
||||
$className = \nre\core\ClassLoader::concatClassNames($questtypeName, \nre\core\ClassLoader::stripClassType(\nre\core\ClassLoader::stripNamespace(get_class())), 'agent');
|
||||
|
||||
|
||||
return \nre\configs\AppConfig::$app['namespace']."questtypes\\$className";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Load the class of a QuesttypeAgent.
|
||||
*
|
||||
* @static
|
||||
* @throws \nre\exceptions\ClassNotFoundException
|
||||
* @param string $questtypeName Name of the QuesttypeAgent to load
|
||||
* @param string $fullClassName Name of the class to load
|
||||
*/
|
||||
private static function loadClass($questtypeName, $fullClassName)
|
||||
{
|
||||
// Determine folder to look in
|
||||
$className = explode('\\', $fullClassName);
|
||||
$className = array_pop($className);
|
||||
|
||||
// Determine filename
|
||||
$fileName = ROOT.DS.\nre\configs\AppConfig::$dirs['questtypes'].DS.strtolower($questtypeName).DS.$className.\nre\configs\CoreConfig::getFileExt('includes');
|
||||
|
||||
// Check file
|
||||
if(!file_exists($fileName))
|
||||
{
|
||||
throw new \nre\exceptions\ClassNotFoundException(
|
||||
$fullClassName
|
||||
);
|
||||
}
|
||||
|
||||
// Include file
|
||||
include_once($fileName);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check inheritance of the QuesttypeAgent-class.
|
||||
*
|
||||
* @static
|
||||
* @throws \nre\exceptions\ClassNotValidException
|
||||
* @param string $className Name of the class to check
|
||||
* @param string $parentClassName Name of the parent class
|
||||
*/
|
||||
public static function checkClass($className, $parentClassName)
|
||||
{
|
||||
// Check if class is subclass of parent class
|
||||
if(!is_subclass_of($className, $parentClassName)) {
|
||||
throw new \nre\exceptions\ClassNotValidException(
|
||||
$className
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Construct a new QuesttypeAgent.
|
||||
*
|
||||
* @throws \nre\exceptions\DatamodelException
|
||||
* @throws \nre\exceptions\DriverNotValidException
|
||||
* @throws \nre\exceptions\DriverNotFoundException
|
||||
* @throws \nre\exceptions\ViewNotFoundException
|
||||
* @throws \nre\exceptions\ModelNotValidException
|
||||
* @throws \nre\exceptions\ModelNotFoundException
|
||||
* @throws \hhu\z\exceptions\QuesttypeModelNotValidException
|
||||
* @throws \hhu\z\exceptions\QuesttypeModelNotFoundException
|
||||
* @throws \hhu\z\exceptions\QuesttypeControllerNotValidException
|
||||
* @throws \hhu\z\exceptions\QuesttypeControllerNotFoundException
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
* @param \nre\core\Logger $log Log-system
|
||||
*/
|
||||
protected function __construct(\nre\core\Request $request, \nre\core\Response $response, \nre\core\Logger $log=null)
|
||||
{
|
||||
// Store values
|
||||
$this->request = $request;
|
||||
$this->response = $response;
|
||||
|
||||
|
||||
// Call parent constructor
|
||||
parent::__construct($request, $response, $log);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Save the answers of a Character for a Quest.
|
||||
*
|
||||
* @param array $seminary Current Seminary data
|
||||
* @param array $questgroup Current Questgroup data
|
||||
* @param array $quest Current Quest data
|
||||
* @param array $character Current Character data
|
||||
* @param array $answers Character answers for the Quest
|
||||
*/
|
||||
public function saveAnswersOfCharacter($seminary, $questgroup, $quest, $character, $answers)
|
||||
{
|
||||
$this->controller->saveAnswersOfCharacter($seminary, $questgroup, $quest, $character, $answers);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check if answers of a Character for a Quest match the correct ones.
|
||||
*
|
||||
* @param array $seminary Current Seminary data
|
||||
* @param array $questgroup Current Questgroup data
|
||||
* @param array $quest Current Quest data
|
||||
* @param array $character Current Character data
|
||||
* @param array $answers Character answers for the Quest
|
||||
*/
|
||||
public function matchAnswersOfCharacter($seminary, $questgroup, $quest, $character, $answers)
|
||||
{
|
||||
return $this->controller->matchAnswersOfCharacter($seminary, $questgroup, $quest, $character, $answers);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Load the Controller of this Agent.
|
||||
*
|
||||
* @throws \nre\exceptions\DatamodelException
|
||||
* @throws \nre\exceptions\DriverNotValidException
|
||||
* @throws \nre\exceptions\DriverNotFoundException
|
||||
* @throws \nre\exceptions\ViewNotFoundException
|
||||
* @throws \nre\exceptions\ModelNotValidException
|
||||
* @throws \nre\exceptions\ModelNotFoundException
|
||||
* @throws \hhu\z\exceptions\QuesttypeModelNotValidException
|
||||
* @throws \hhu\z\exceptions\QuesttypeModelNotFoundException
|
||||
* @throws \hhu\z\exceptions\QuesttypeControllerNotValidException
|
||||
* @throws \hhu\z\exceptions\QuesttypeControllerNotFoundException
|
||||
*/
|
||||
protected function loadController()
|
||||
{
|
||||
// Determine Controller name
|
||||
$controllerName = \nre\core\ClassLoader::stripClassType(\nre\core\ClassLoader::getClassName(get_class($this)));
|
||||
|
||||
// Determine ToplevelAgent
|
||||
$toplevelAgentName = $this->response->getParam(0);
|
||||
if(is_null($toplevelAgentName)) {
|
||||
$toplevelAgentName = $this->request->getParam(0, 'toplevel');
|
||||
$this->response->addParam($toplevelAgentName);
|
||||
}
|
||||
|
||||
// Determine Action
|
||||
$action = $this->response->getParam(2);
|
||||
if(is_null($action)) {
|
||||
$action = $this->request->getParam(2, 'action');
|
||||
$this->response->addParam($action);
|
||||
}
|
||||
|
||||
|
||||
// Load Controller
|
||||
\hhu\z\controllers\QuesttypeController::load($controllerName);
|
||||
|
||||
// Construct Controller
|
||||
$this->controller = \hhu\z\controllers\QuesttypeController::factory($controllerName, $toplevelAgentName, $action, $this);
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* The Legend of Z
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
*/
|
||||
|
||||
namespace hhu\z\agents;
|
||||
|
||||
|
||||
/**
|
||||
* Abstract class for implementing a QuesttypeAgent.
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
*/
|
||||
abstract class QuesttypeAgent extends \nre\agents\BottomlevelAgent
|
||||
{
|
||||
/**
|
||||
* Current request
|
||||
*
|
||||
* @var \nre\core\Request
|
||||
*/
|
||||
private $request;
|
||||
/**
|
||||
* Current response
|
||||
*
|
||||
* @var \nre\core\Response
|
||||
*/
|
||||
private $response;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Load a QuesttypeAgent.
|
||||
*
|
||||
* @static
|
||||
* @throws \hhu\z\exceptions\QuesttypeAgentNotFoundException
|
||||
* @throws \hhu\z\exceptions\QuesttypeAgentNotValidException
|
||||
* @param string $questtypeName Name of the QuesttypeAgent to load
|
||||
*/
|
||||
public static function load($questtypeName)
|
||||
{
|
||||
// Determine full classname
|
||||
$className = self::getClassName($questtypeName);
|
||||
|
||||
try {
|
||||
// Load class
|
||||
static::loadClass($questtypeName, $className);
|
||||
|
||||
// Validate class
|
||||
static::checkClass($className, get_class());
|
||||
}
|
||||
catch(\nre\exceptions\ClassNotValidException $e) {
|
||||
throw new \hhu\z\exceptions\QuesttypeAgentNotValidException($e->getClassName());
|
||||
}
|
||||
catch(\nre\exceptions\ClassNotFoundException $e) {
|
||||
throw new \hhu\z\exceptions\QuesttypeAgentNotFoundException($e->getClassName());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Instantiate a QuesttypeAgent (Factory Pattern).
|
||||
*
|
||||
* @static
|
||||
* @throws \nre\exceptions\DatamodelException
|
||||
* @throws \nre\exceptions\DriverNotValidException
|
||||
* @throws \nre\exceptions\DriverNotFoundException
|
||||
* @throws \nre\exceptions\ViewNotFoundException
|
||||
* @throws \hhu\z\exceptions\QuesttypeModelNotValidException
|
||||
* @throws \hhu\z\exceptions\QuesttypeModelNotFoundException
|
||||
* @throws \hhu\z\exceptions\QuesttypeControllerNotValidException
|
||||
* @throws \hhu\z\exceptions\QuesttypeControllerNotFoundException
|
||||
* @param string $questtypeName Name of the QuesttypeAgent to instantiate
|
||||
* @param Request $request Current request
|
||||
* @param Response $response Current respone
|
||||
* @param Logger $log Log-system
|
||||
*/
|
||||
public static function factory($questtypeName, \nre\core\Request $request, \nre\core\Response $response, \nre\core\Logger $log=null)
|
||||
{
|
||||
// Determine full classname
|
||||
$className = self::getClassName($questtypeName);
|
||||
|
||||
// Construct and return Questmodule
|
||||
return new $className($request, $response, $log);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Determine the Agent-classname for the given Questtype-name.
|
||||
*
|
||||
* @static
|
||||
* @param string $questtypeName Questtype-name to get Agent-classname of
|
||||
* @param string $agentType Agent type of given Agent name
|
||||
* @return string Classname for the Questtype-name
|
||||
*/
|
||||
private static function getClassName($questtypeName, $agentType=null)
|
||||
{
|
||||
$className = \nre\core\ClassLoader::concatClassNames($questtypeName, \nre\core\ClassLoader::stripClassType(\nre\core\ClassLoader::stripNamespace(get_class())), 'agent');
|
||||
|
||||
|
||||
return \nre\configs\AppConfig::$app['namespace']."questtypes\\$className";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Load the class of a QuesttypeAgent.
|
||||
*
|
||||
* @static
|
||||
* @throws \nre\exceptions\ClassNotFoundException
|
||||
* @param string $questtypeName Name of the QuesttypeAgent to load
|
||||
* @param string $fullClassName Name of the class to load
|
||||
*/
|
||||
private static function loadClass($questtypeName, $fullClassName)
|
||||
{
|
||||
// Determine folder to look in
|
||||
$className = explode('\\', $fullClassName);
|
||||
$className = array_pop($className);
|
||||
|
||||
// Determine filename
|
||||
$fileName = ROOT.DS.\nre\configs\AppConfig::$dirs['questtypes'].DS.strtolower($questtypeName).DS.$className.\nre\configs\CoreConfig::getFileExt('includes');
|
||||
|
||||
// Check file
|
||||
if(!file_exists($fileName))
|
||||
{
|
||||
throw new \nre\exceptions\ClassNotFoundException(
|
||||
$fullClassName
|
||||
);
|
||||
}
|
||||
|
||||
// Include file
|
||||
include_once($fileName);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check inheritance of the QuesttypeAgent-class.
|
||||
*
|
||||
* @static
|
||||
* @throws \nre\exceptions\ClassNotValidException
|
||||
* @param string $className Name of the class to check
|
||||
* @param string $parentClassName Name of the parent class
|
||||
*/
|
||||
public static function checkClass($className, $parentClassName)
|
||||
{
|
||||
// Check if class is subclass of parent class
|
||||
if(!is_subclass_of($className, $parentClassName)) {
|
||||
throw new \nre\exceptions\ClassNotValidException(
|
||||
$className
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Construct a new QuesttypeAgent.
|
||||
*
|
||||
* @throws \nre\exceptions\DatamodelException
|
||||
* @throws \nre\exceptions\DriverNotValidException
|
||||
* @throws \nre\exceptions\DriverNotFoundException
|
||||
* @throws \nre\exceptions\ViewNotFoundException
|
||||
* @throws \nre\exceptions\ModelNotValidException
|
||||
* @throws \nre\exceptions\ModelNotFoundException
|
||||
* @throws \hhu\z\exceptions\QuesttypeModelNotValidException
|
||||
* @throws \hhu\z\exceptions\QuesttypeModelNotFoundException
|
||||
* @throws \hhu\z\exceptions\QuesttypeControllerNotValidException
|
||||
* @throws \hhu\z\exceptions\QuesttypeControllerNotFoundException
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
* @param \nre\core\Logger $log Log-system
|
||||
*/
|
||||
protected function __construct(\nre\core\Request $request, \nre\core\Response $response, \nre\core\Logger $log=null)
|
||||
{
|
||||
// Store values
|
||||
$this->request = $request;
|
||||
$this->response = $response;
|
||||
|
||||
|
||||
// Call parent constructor
|
||||
parent::__construct($request, $response, $log);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Save the answers of a Character for a Quest.
|
||||
*
|
||||
* @param array $seminary Current Seminary data
|
||||
* @param array $questgroup Current Questgroup data
|
||||
* @param array $quest Current Quest data
|
||||
* @param array $character Current Character data
|
||||
* @param array $answers Character answers for the Quest
|
||||
*/
|
||||
public function saveAnswersOfCharacter($seminary, $questgroup, $quest, $character, $answers)
|
||||
{
|
||||
$this->controller->saveAnswersOfCharacter($seminary, $questgroup, $quest, $character, $answers);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check if answers of a Character for a Quest match the correct ones.
|
||||
*
|
||||
* @param array $seminary Current Seminary data
|
||||
* @param array $questgroup Current Questgroup data
|
||||
* @param array $quest Current Quest data
|
||||
* @param array $character Current Character data
|
||||
* @param array $answers Character answers for the Quest
|
||||
*/
|
||||
public function matchAnswersOfCharacter($seminary, $questgroup, $quest, $character, $answers)
|
||||
{
|
||||
return $this->controller->matchAnswersOfCharacter($seminary, $questgroup, $quest, $character, $answers);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Load the Controller of this Agent.
|
||||
*
|
||||
* @throws \nre\exceptions\DatamodelException
|
||||
* @throws \nre\exceptions\DriverNotValidException
|
||||
* @throws \nre\exceptions\DriverNotFoundException
|
||||
* @throws \nre\exceptions\ViewNotFoundException
|
||||
* @throws \nre\exceptions\ModelNotValidException
|
||||
* @throws \nre\exceptions\ModelNotFoundException
|
||||
* @throws \hhu\z\exceptions\QuesttypeModelNotValidException
|
||||
* @throws \hhu\z\exceptions\QuesttypeModelNotFoundException
|
||||
* @throws \hhu\z\exceptions\QuesttypeControllerNotValidException
|
||||
* @throws \hhu\z\exceptions\QuesttypeControllerNotFoundException
|
||||
*/
|
||||
protected function loadController()
|
||||
{
|
||||
// Determine Controller name
|
||||
$controllerName = \nre\core\ClassLoader::stripClassType(\nre\core\ClassLoader::getClassName(get_class($this)));
|
||||
|
||||
// Determine ToplevelAgent
|
||||
$toplevelAgentName = $this->response->getParam(0);
|
||||
if(is_null($toplevelAgentName)) {
|
||||
$toplevelAgentName = $this->request->getParam(0, 'toplevel');
|
||||
$this->response->addParam($toplevelAgentName);
|
||||
}
|
||||
|
||||
// Determine Action
|
||||
$action = $this->response->getParam(2);
|
||||
if(is_null($action)) {
|
||||
$action = $this->request->getParam(2, 'action');
|
||||
$this->response->addParam($action);
|
||||
}
|
||||
|
||||
|
||||
// Load Controller
|
||||
\hhu\z\controllers\QuesttypeController::load($controllerName);
|
||||
|
||||
// Construct Controller
|
||||
$this->controller = \hhu\z\controllers\QuesttypeController::factory($controllerName, $toplevelAgentName, $action, $this);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -1,43 +1,43 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
*/
|
||||
|
||||
namespace hhu\z\agents;
|
||||
|
||||
|
||||
/**
|
||||
* Abstract class for implementing an application Controller.
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
*/
|
||||
abstract class ToplevelAgent extends \nre\agents\ToplevelAgent
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Construct a new ToplevlAgent
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
* @param \nre\core\Logger $log Logger instance
|
||||
*/
|
||||
protected function __construct(\nre\core\Request $request, \nre\core\Response $response, \nre\core\Logger $log=null)
|
||||
{
|
||||
parent::__construct($request, $response, $log);
|
||||
|
||||
|
||||
// Set timezone
|
||||
date_default_timezone_set(\nre\configs\AppConfig::$app['timeZone']);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* The Legend of Z
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
*/
|
||||
|
||||
namespace hhu\z\agents;
|
||||
|
||||
|
||||
/**
|
||||
* Abstract class for implementing an application Controller.
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
*/
|
||||
abstract class ToplevelAgent extends \nre\agents\ToplevelAgent
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Construct a new ToplevlAgent
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
* @param \nre\core\Logger $log Logger instance
|
||||
*/
|
||||
protected function __construct(\nre\core\Request $request, \nre\core\Response $response, \nre\core\Logger $log=null)
|
||||
{
|
||||
parent::__construct($request, $response, $log);
|
||||
|
||||
|
||||
// Set timezone
|
||||
date_default_timezone_set(\nre\configs\AppConfig::$app['timeZone']);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -1,202 +1,202 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
*/
|
||||
|
||||
namespace hhu\z\apis;
|
||||
|
||||
|
||||
/**
|
||||
* MailApi-implementation.
|
||||
*
|
||||
* This class runs and renders e‑mail text and subject.
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
*/
|
||||
class MailApi extends \nre\core\Api
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Construct a new MailApi.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct(
|
||||
new \hhu\z\requests\MailRequest(),
|
||||
new \hhu\z\responses\MailResponse()
|
||||
);
|
||||
|
||||
// Set ToplevelAgent
|
||||
$this->request->addParam(\nre\configs\AppConfig::$defaults['toplevel-mail']);
|
||||
$this->request->addParam(\nre\configs\AppConfig::$defaults['intermediate-mail']);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Set linker instance for creating links.
|
||||
*
|
||||
* @param \nre\core\Linker $linker Linker instance for creating links
|
||||
*/
|
||||
public function setLinker(\nre\core\Linker $linker)
|
||||
{
|
||||
$this->request->setLinker($linker);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Use a ToplevelAgent for HTML-mail
|
||||
*
|
||||
* @param bool $html Whether to use HTML or not
|
||||
*/
|
||||
public function setHTML($html=true)
|
||||
{
|
||||
// Save params
|
||||
$params = $this->request->getParams(1);
|
||||
|
||||
// Set ToplevelAgent
|
||||
$this->request->clearParams();
|
||||
if($html) {
|
||||
$this->request->addParam(\nre\configs\AppConfig::$defaults['toplevel-htmlmail']);
|
||||
}
|
||||
else {
|
||||
$this->request->addParam(\nre\configs\AppConfig::$defaults['toplevel-mail']);
|
||||
}
|
||||
|
||||
// Restore params
|
||||
if(!empty($params)) {
|
||||
$this->addParams($params);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the Action for the message to render.
|
||||
*
|
||||
* @param string $messageAgent Agent to handle the message
|
||||
*/
|
||||
public function setMessage($messageAgent)
|
||||
{
|
||||
// Save params
|
||||
$params = $this->request->getParams(3);
|
||||
|
||||
// Set messageAgent
|
||||
$this->request->clearParams(2);
|
||||
$this->request->addParam($messageAgent);
|
||||
|
||||
// Restore params
|
||||
if(!empty($params)) {
|
||||
$this->addParams($params);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set additional params to pass to the Action.
|
||||
*
|
||||
* @param array $params Additional params to set
|
||||
*/
|
||||
public function setParams($params)
|
||||
{
|
||||
// Add placeholder params
|
||||
for($i=3; $i<count($this->request->getParams()); $i++) {
|
||||
$this->request->addParam(null);
|
||||
}
|
||||
|
||||
// Set params
|
||||
call_user_func_array(
|
||||
array(
|
||||
$this->request,
|
||||
'addParams'
|
||||
),
|
||||
$params
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return the subject set by the Controller.
|
||||
*
|
||||
* @return string Subject set by Controller
|
||||
*/
|
||||
public function getSubject()
|
||||
{
|
||||
return $this->response->getSubject();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Run mailtext generation.
|
||||
*
|
||||
* This method runs the generation of mailtext.
|
||||
*
|
||||
* @return \Exception Occured exception or null
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
// Set response
|
||||
$this->response->clearParams();
|
||||
foreach($this->request->getParams() as $param) {
|
||||
$this->response->addParam($param);
|
||||
}
|
||||
|
||||
// Run
|
||||
try {
|
||||
$exception = parent::run();
|
||||
|
||||
|
||||
return $exception;
|
||||
}
|
||||
catch(\nre\Exception $e) {
|
||||
return $e;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Render output.
|
||||
*
|
||||
* @return string Rendered output
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
// Generate output
|
||||
parent::render();
|
||||
|
||||
|
||||
// Return output
|
||||
return $this->response->getOutput();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Add multiple request params.
|
||||
*
|
||||
* @param array $params Request params to add
|
||||
*/
|
||||
private function addParams($params)
|
||||
{
|
||||
call_user_func_array(
|
||||
array(
|
||||
$this->request,
|
||||
'addParams'
|
||||
),
|
||||
$params
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* The Legend of Z
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
*/
|
||||
|
||||
namespace hhu\z\apis;
|
||||
|
||||
|
||||
/**
|
||||
* MailApi-implementation.
|
||||
*
|
||||
* This class runs and renders e‑mail text and subject.
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
*/
|
||||
class MailApi extends \nre\core\Api
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Construct a new MailApi.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct(
|
||||
new \hhu\z\requests\MailRequest(),
|
||||
new \hhu\z\responses\MailResponse()
|
||||
);
|
||||
|
||||
// Set ToplevelAgent
|
||||
$this->request->addParam(\nre\configs\AppConfig::$defaults['toplevel-mail']);
|
||||
$this->request->addParam(\nre\configs\AppConfig::$defaults['intermediate-mail']);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Set linker instance for creating links.
|
||||
*
|
||||
* @param \nre\core\Linker $linker Linker instance for creating links
|
||||
*/
|
||||
public function setLinker(\nre\core\Linker $linker)
|
||||
{
|
||||
$this->request->setLinker($linker);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Use a ToplevelAgent for HTML-mail
|
||||
*
|
||||
* @param bool $html Whether to use HTML or not
|
||||
*/
|
||||
public function setHTML($html=true)
|
||||
{
|
||||
// Save params
|
||||
$params = $this->request->getParams(1);
|
||||
|
||||
// Set ToplevelAgent
|
||||
$this->request->clearParams();
|
||||
if($html) {
|
||||
$this->request->addParam(\nre\configs\AppConfig::$defaults['toplevel-htmlmail']);
|
||||
}
|
||||
else {
|
||||
$this->request->addParam(\nre\configs\AppConfig::$defaults['toplevel-mail']);
|
||||
}
|
||||
|
||||
// Restore params
|
||||
if(!empty($params)) {
|
||||
$this->addParams($params);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the Action for the message to render.
|
||||
*
|
||||
* @param string $messageAgent Agent to handle the message
|
||||
*/
|
||||
public function setMessage($messageAgent)
|
||||
{
|
||||
// Save params
|
||||
$params = $this->request->getParams(3);
|
||||
|
||||
// Set messageAgent
|
||||
$this->request->clearParams(2);
|
||||
$this->request->addParam($messageAgent);
|
||||
|
||||
// Restore params
|
||||
if(!empty($params)) {
|
||||
$this->addParams($params);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set additional params to pass to the Action.
|
||||
*
|
||||
* @param array $params Additional params to set
|
||||
*/
|
||||
public function setParams($params)
|
||||
{
|
||||
// Add placeholder params
|
||||
for($i=3; $i<count($this->request->getParams()); $i++) {
|
||||
$this->request->addParam(null);
|
||||
}
|
||||
|
||||
// Set params
|
||||
call_user_func_array(
|
||||
array(
|
||||
$this->request,
|
||||
'addParams'
|
||||
),
|
||||
$params
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return the subject set by the Controller.
|
||||
*
|
||||
* @return string Subject set by Controller
|
||||
*/
|
||||
public function getSubject()
|
||||
{
|
||||
return $this->response->getSubject();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Run mailtext generation.
|
||||
*
|
||||
* This method runs the generation of mailtext.
|
||||
*
|
||||
* @return \Exception Occured exception or null
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
// Set response
|
||||
$this->response->clearParams();
|
||||
foreach($this->request->getParams() as $param) {
|
||||
$this->response->addParam($param);
|
||||
}
|
||||
|
||||
// Run
|
||||
try {
|
||||
$exception = parent::run();
|
||||
|
||||
|
||||
return $exception;
|
||||
}
|
||||
catch(\nre\Exception $e) {
|
||||
return $e;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Render output.
|
||||
*
|
||||
* @return string Rendered output
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
// Generate output
|
||||
parent::render();
|
||||
|
||||
|
||||
// Return output
|
||||
return $this->response->getOutput();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Add multiple request params.
|
||||
*
|
||||
* @param array $params Request params to add
|
||||
*/
|
||||
private function addParams($params)
|
||||
{
|
||||
call_user_func_array(
|
||||
array(
|
||||
$this->request,
|
||||
'addParams'
|
||||
),
|
||||
$params
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -1,197 +1,197 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
*/
|
||||
|
||||
namespace hhu\z\controllers;
|
||||
|
||||
|
||||
/**
|
||||
* Abstract class for implementing a Controller of an IntermediateAgent.
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
*/
|
||||
abstract class IntermediateController extends \hhu\z\Controller
|
||||
{
|
||||
/**
|
||||
* Required models
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $models = array('users', 'userroles', 'seminaries', 'characters');
|
||||
/**
|
||||
* Current user
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $user = null;
|
||||
/**
|
||||
* Title information
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $title = array();
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Construct a new IntermediateController.
|
||||
*
|
||||
* @throws \nre\exceptions\DriverNotFoundException
|
||||
* @throws \nre\exceptions\DriverNotValidException
|
||||
* @throws \nre\exceptions\ModelNotValidException
|
||||
* @throws \nre\exceptions\ModelNotFoundException
|
||||
* @throws \nre\exceptions\ViewNotFoundException
|
||||
* @param string $layoutName Name of the current Layout
|
||||
* @param string $action Current Action
|
||||
* @param \nre\core\Agent $agent Corresponding Agent
|
||||
*/
|
||||
public function __construct($layoutName, $action, $agent)
|
||||
{
|
||||
parent::__construct($layoutName, $action, $agent);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Prefilter that is executed before running the Controller.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
public function preFilter(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
parent::preFilter($request, $response);
|
||||
|
||||
// Get userdata
|
||||
try {
|
||||
self::$user = $this->Users->getUserById($this->Auth->getUserId());
|
||||
self::$user['roles'] = array_map(function($r) { return $r['name']; }, $this->Userroles->getUserrolesForUserById(self::$user['id']));
|
||||
}
|
||||
catch(\nre\exceptions\IdNotFoundException $e) {
|
||||
}
|
||||
|
||||
// Check permissions
|
||||
$this->checkPermission($request, $response);
|
||||
|
||||
// Set userdata
|
||||
$this->set('loggedUser', self::$user);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Postfilter that is executed after running the Controller.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
public function postFilter(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
parent::postFilter($request, $response);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return current title information.
|
||||
*
|
||||
* @return string Title information
|
||||
*/
|
||||
public function getTitle()
|
||||
{
|
||||
return $this->title;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Add a piece of information to the current title.
|
||||
*
|
||||
* @param string $title Title information
|
||||
*/
|
||||
protected function addTitle($title)
|
||||
{
|
||||
$this->title[] = $title;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add a piece of information to the current title and localize
|
||||
* it.
|
||||
*
|
||||
* @param string $title Title information
|
||||
*/
|
||||
protected function addTitleLocalized($title)
|
||||
{
|
||||
$title = gettext($title);
|
||||
|
||||
$args = func_get_args();
|
||||
if(count($args) > 0) {
|
||||
$title = call_user_func_array(
|
||||
'sprintf',
|
||||
array_merge(
|
||||
array($title),
|
||||
array_slice($args, 1)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
$this->title[] = $title;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Check user permissions.
|
||||
*
|
||||
* @throws \nre\exceptions\AccessDeniedException
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
private function checkPermission(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
// Determine user
|
||||
$userRoles = array('guest');
|
||||
if(!is_null(self::$user)) {
|
||||
$userRoles = self::$user['roles'];
|
||||
}
|
||||
|
||||
|
||||
// Do not check error pages
|
||||
if($response->getParam(0, 'toplevel') == \nre\core\Config::getDefault('toplevel-error')) {
|
||||
return;
|
||||
}
|
||||
if($response->getParam(1, 'intermediate') == \nre\core\Config::getDefault('intermediate-error')) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Determine permissions of Intermediate Controller for current action
|
||||
$controller = $this->agent->controller;
|
||||
$action = $this->request->getParam(2, 'action');
|
||||
if(!property_exists($controller, 'permissions')) {
|
||||
return; // Allow if nothing is specified
|
||||
}
|
||||
if(!array_key_exists($action, $controller->permissions)) {
|
||||
return; // Allow if Action is not specified
|
||||
}
|
||||
$permissions = $controller->permissions[$action];
|
||||
|
||||
|
||||
// Check permissions
|
||||
if(count(array_intersect($userRoles, $permissions)) == 0) {
|
||||
throw new \nre\exceptions\AccessDeniedException();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* The Legend of Z
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
*/
|
||||
|
||||
namespace hhu\z\controllers;
|
||||
|
||||
|
||||
/**
|
||||
* Abstract class for implementing a Controller of an IntermediateAgent.
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
*/
|
||||
abstract class IntermediateController extends \hhu\z\Controller
|
||||
{
|
||||
/**
|
||||
* Required models
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $models = array('users', 'userroles', 'seminaries', 'characters');
|
||||
/**
|
||||
* Current user
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $user = null;
|
||||
/**
|
||||
* Title information
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $title = array();
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Construct a new IntermediateController.
|
||||
*
|
||||
* @throws \nre\exceptions\DriverNotFoundException
|
||||
* @throws \nre\exceptions\DriverNotValidException
|
||||
* @throws \nre\exceptions\ModelNotValidException
|
||||
* @throws \nre\exceptions\ModelNotFoundException
|
||||
* @throws \nre\exceptions\ViewNotFoundException
|
||||
* @param string $layoutName Name of the current Layout
|
||||
* @param string $action Current Action
|
||||
* @param \nre\core\Agent $agent Corresponding Agent
|
||||
*/
|
||||
public function __construct($layoutName, $action, $agent)
|
||||
{
|
||||
parent::__construct($layoutName, $action, $agent);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Prefilter that is executed before running the Controller.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
public function preFilter(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
parent::preFilter($request, $response);
|
||||
|
||||
// Get userdata
|
||||
try {
|
||||
self::$user = $this->Users->getUserById($this->Auth->getUserId());
|
||||
self::$user['roles'] = array_map(function($r) { return $r['name']; }, $this->Userroles->getUserrolesForUserById(self::$user['id']));
|
||||
}
|
||||
catch(\nre\exceptions\IdNotFoundException $e) {
|
||||
}
|
||||
|
||||
// Check permissions
|
||||
$this->checkPermission($request, $response);
|
||||
|
||||
// Set userdata
|
||||
$this->set('loggedUser', self::$user);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Postfilter that is executed after running the Controller.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
public function postFilter(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
parent::postFilter($request, $response);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return current title information.
|
||||
*
|
||||
* @return string Title information
|
||||
*/
|
||||
public function getTitle()
|
||||
{
|
||||
return $this->title;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Add a piece of information to the current title.
|
||||
*
|
||||
* @param string $title Title information
|
||||
*/
|
||||
protected function addTitle($title)
|
||||
{
|
||||
$this->title[] = $title;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add a piece of information to the current title and localize
|
||||
* it.
|
||||
*
|
||||
* @param string $title Title information
|
||||
*/
|
||||
protected function addTitleLocalized($title)
|
||||
{
|
||||
$title = gettext($title);
|
||||
|
||||
$args = func_get_args();
|
||||
if(count($args) > 0) {
|
||||
$title = call_user_func_array(
|
||||
'sprintf',
|
||||
array_merge(
|
||||
array($title),
|
||||
array_slice($args, 1)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
$this->title[] = $title;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Check user permissions.
|
||||
*
|
||||
* @throws \nre\exceptions\AccessDeniedException
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
private function checkPermission(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
// Determine user
|
||||
$userRoles = array('guest');
|
||||
if(!is_null(self::$user)) {
|
||||
$userRoles = self::$user['roles'];
|
||||
}
|
||||
|
||||
|
||||
// Do not check error pages
|
||||
if($response->getParam(0, 'toplevel') == \nre\core\Config::getDefault('toplevel-error')) {
|
||||
return;
|
||||
}
|
||||
if($response->getParam(1, 'intermediate') == \nre\core\Config::getDefault('intermediate-error')) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Determine permissions of Intermediate Controller for current action
|
||||
$controller = $this->agent->controller;
|
||||
$action = $this->request->getParam(2, 'action');
|
||||
if(!property_exists($controller, 'permissions')) {
|
||||
return; // Allow if nothing is specified
|
||||
}
|
||||
if(!array_key_exists($action, $controller->permissions)) {
|
||||
return; // Allow if Action is not specified
|
||||
}
|
||||
$permissions = $controller->permissions[$action];
|
||||
|
||||
|
||||
// Check permissions
|
||||
if(count(array_intersect($userRoles, $permissions)) == 0) {
|
||||
throw new \nre\exceptions\AccessDeniedException();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -1,320 +1,320 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
*/
|
||||
|
||||
namespace hhu\z\controllers;
|
||||
|
||||
|
||||
/**
|
||||
* Abstract class for implementing a QuesttypeController.
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
*/
|
||||
abstract class QuesttypeController extends \hhu\z\Controller
|
||||
{
|
||||
/**
|
||||
* Required models
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $models = array('seminaries', 'questgroups', 'quests', 'characters');
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Save the answers of a Character for a Quest.
|
||||
*
|
||||
* @param array $seminary Current Seminary data
|
||||
* @param array $questgroup Current Questgroup data
|
||||
* @param array $quest Current Quest data
|
||||
* @param array $character Current Character data
|
||||
* @param array $answers Character answers for the Quest
|
||||
*/
|
||||
public abstract function saveAnswersOfCharacter($seminary, $questgroup, $quest, $character, $answers);
|
||||
|
||||
|
||||
/**
|
||||
* Save additional data for the answers of a Character for a Quest.
|
||||
*
|
||||
* @param array $seminary Current Seminary data
|
||||
* @param array $questgroup Current Questgroup data
|
||||
* @param array $quest Current Quest data
|
||||
* @param array $character Current Character data
|
||||
* @param array $data Additional (POST-) data
|
||||
*/
|
||||
public abstract function saveDataForCharacterAnswers($seminary, $questgroup, $quest, $character, $data);
|
||||
|
||||
|
||||
/**
|
||||
* Check if answers of a Character for a Quest match the correct ones.
|
||||
*
|
||||
* @param array $seminary Current Seminary data
|
||||
* @param array $questgroup Current Questgroup data
|
||||
* @param array $quest Current Quest data
|
||||
* @param array $character Current Character data
|
||||
* @param array $answers Character answers for the Quest
|
||||
* @return boolean True/false for a right/wrong answer or null for moderator evaluation
|
||||
*/
|
||||
public abstract function matchAnswersOfCharacter($seminary, $questgroup, $quest, $character, $answers);
|
||||
|
||||
|
||||
/**
|
||||
* Action: quest.
|
||||
*
|
||||
* Show the task of a Quest.
|
||||
*
|
||||
* @param array $seminary Current Seminary data
|
||||
* @param array $questgroup Current Questgroup data
|
||||
* @param array $quest Current Quest data
|
||||
* @param array $character Current Character data
|
||||
* @param \Exception $exception Character submission exception
|
||||
*/
|
||||
public abstract function quest($seminary, $questgroup, $quest, $character, $exception);
|
||||
|
||||
|
||||
/**
|
||||
* Action: submission.
|
||||
*
|
||||
* Show the submission of a Character for a Quest.
|
||||
*
|
||||
* @param array $seminary Current Seminary data
|
||||
* @param array $questgroup Current Questgroup data
|
||||
* @param array $quest Current Quest data
|
||||
* @param array $character Current Character data
|
||||
*/
|
||||
public abstract function submission($seminary, $questgroup, $quest, $character);
|
||||
/**
|
||||
* The Legend of Z
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
*/
|
||||
|
||||
namespace hhu\z\controllers;
|
||||
|
||||
|
||||
/**
|
||||
* Action: edittask.
|
||||
*
|
||||
* Edit the task of a Quest.
|
||||
*
|
||||
* @param array $seminary Current Seminary data
|
||||
* @param array $questgroup Current Questgroup data
|
||||
* @param array $quest Current Quest data
|
||||
*/
|
||||
public abstract function edittask($seminary, $questgroup, $quest);
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Load a QuesttypeController.
|
||||
*
|
||||
* @static
|
||||
* @throws \hhu\z\exceptions\QuesttypeControllerNotFoundException
|
||||
* @throws \hhu\z\exceptions\QuesttypeControllerNotValidException
|
||||
* @param string $controllerName Name of the QuesttypeController to load
|
||||
*/
|
||||
public static function load($controllerName)
|
||||
{
|
||||
// Determine full classname
|
||||
$className = self::getClassName($controllerName);
|
||||
|
||||
try {
|
||||
// Load class
|
||||
static::loadClass($controllerName, $className);
|
||||
|
||||
// Validate class
|
||||
static::checkClass($className, get_class());
|
||||
}
|
||||
catch(\nre\exceptions\ClassNotValidException $e) {
|
||||
throw new \hhu\z\exceptions\QuesttypeControllerNotValidException($e->getClassName());
|
||||
}
|
||||
catch(\nre\exceptions\ClassNotFoundException $e) {
|
||||
throw new \hhu\z\exceptions\QuesttypeControllerNotFoundException($e->getClassName());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Instantiate a QuesttypeController (Factory Pattern).
|
||||
*
|
||||
* @static
|
||||
* @throws \nre\exceptions\DatamodelException
|
||||
* @throws \nre\exceptions\DriverNotFoundException
|
||||
* @throws \nre\exceptions\DriverNotValidException
|
||||
* @throws \nre\exceptions\ModelNotValidException
|
||||
* @throws \nre\exceptions\ModelNotFoundException
|
||||
* @throws \nre\exceptions\ViewNotFoundException
|
||||
* @throws \hhu\z\exceptions\QuesttypeModelNotValidException
|
||||
* @throws \hhu\z\exceptions\QuesttypeModelNotFoundException
|
||||
* @param string $controllerName Name of the QuesttypeController to instantiate
|
||||
* @param string $layoutName Name of the current Layout
|
||||
* @param string $action Current Action
|
||||
* @param \nre\core\Agent $agent Corresponding Agent
|
||||
*/
|
||||
public static function factory($controllerName, $layoutName, $action, $agent)
|
||||
{
|
||||
// Determine full classname
|
||||
$className = self::getClassName($controllerName);
|
||||
|
||||
// Construct and return Controller
|
||||
return new $className($layoutName, $action, $agent);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Determine the Controller-classname for the given Questtype-name.
|
||||
*
|
||||
* @static
|
||||
* @param string $questtypeName Questtype-name to get Controller-classname of
|
||||
* @return string Classname for the Questtype-name
|
||||
*/
|
||||
private static function getClassName($questtypeName)
|
||||
{
|
||||
$className = \nre\core\ClassLoader::concatClassNames($questtypeName, \nre\core\ClassLoader::stripClassType(\nre\core\ClassLoader::stripNamespace(get_class())), 'controller');
|
||||
|
||||
|
||||
return \nre\configs\AppConfig::$app['namespace']."questtypes\\$className";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Load the class of a QuesttypeController
|
||||
*
|
||||
* @static
|
||||
* @throws \nre\exceptions\ClassNotFoundException
|
||||
* @param string $questtypeName Name of the QuesttypeController to load
|
||||
* @param string $fullClassName Name of the class to load
|
||||
*/
|
||||
private static function loadClass($questtypeName, $fullClassName)
|
||||
{
|
||||
// Determine folder to look in
|
||||
$className = explode('\\', $fullClassName);
|
||||
$className = array_pop($className);
|
||||
|
||||
// Determine filename
|
||||
$fileName = ROOT.DS.\nre\configs\AppConfig::$dirs['questtypes'].DS.strtolower($questtypeName).DS.$className.\nre\configs\CoreConfig::getFileExt('includes');
|
||||
|
||||
// Check file
|
||||
if(!file_exists($fileName))
|
||||
{
|
||||
throw new \nre\exceptions\ClassNotFoundException(
|
||||
$fullClassName
|
||||
);
|
||||
}
|
||||
|
||||
// Include file
|
||||
include_once($fileName);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check inheritance of the QuesttypeController-class.
|
||||
*
|
||||
* @static
|
||||
* @throws \nre\exceptions\ClassNotValidException
|
||||
* @param string $className Name of the class to check
|
||||
* @param string $parentClassName Name of the parent class
|
||||
*/
|
||||
public static function checkClass($className, $parentClassName)
|
||||
{
|
||||
// Check if class is subclass of parent class
|
||||
if(!is_subclass_of($className, $parentClassName)) {
|
||||
throw new \nre\exceptions\ClassNotValidException(
|
||||
$className
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Construct a new application Controller.
|
||||
*
|
||||
* @throws \nre\exceptions\DriverNotFoundException
|
||||
* @throws \nre\exceptions\DriverNotValidException
|
||||
* @throws \nre\exceptions\ModelNotValidException
|
||||
* @throws \nre\exceptions\ModelNotFoundException
|
||||
* @throws \nre\exceptions\ViewNotFoundException
|
||||
* @throws \hhu\z\exceptions\QuesttypeModelNotValidException
|
||||
* @throws \hhu\z\exceptions\QuesttypeModelNotFoundException
|
||||
* @param string $layoutName Name of the current Layout
|
||||
* @param string $action Current Action
|
||||
* @param Agent $agent Corresponding Agent
|
||||
*/
|
||||
public function __construct($layoutName, $action, $agent)
|
||||
{
|
||||
parent::__construct($layoutName, $action, $agent);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Load the Models of this Controller.
|
||||
*
|
||||
* @throws \nre\exceptions\DatamodelException
|
||||
* @throws \nre\exceptions\DriverNotFoundException
|
||||
* @throws \nre\exceptions\DriverNotValidException
|
||||
* @throws \nre\exceptions\ModelNotValidException
|
||||
* @throws \nre\exceptions\ModelNotFoundException
|
||||
* @throws \hhu\z\exceptions\QuesttypeModelNotValidException
|
||||
* @throws \hhu\z\exceptions\QuesttypeModelNotFoundException
|
||||
*/
|
||||
protected function loadModels()
|
||||
{
|
||||
// Load default models
|
||||
parent::loadModels();
|
||||
|
||||
// Load QuesttypeModel
|
||||
$this->loadModel();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Load the Model of the Questtype.
|
||||
*
|
||||
* @throws \hhu\z\exceptions\QuesttypeModelNotValidException
|
||||
* @throws \hhu\z\exceptions\QuesttypeModelNotFoundException
|
||||
*/
|
||||
private function loadModel()
|
||||
{
|
||||
// Determine Model
|
||||
$model = \nre\core\ClassLoader::stripClassType(\nre\core\ClassLoader::stripClassType(\nre\core\ClassLoader::stripNamespace(get_class($this))));
|
||||
|
||||
// Load class
|
||||
\hhu\z\models\QuesttypeModel::load($model);
|
||||
|
||||
// Construct Model
|
||||
$modelName = ucfirst(strtolower($model));
|
||||
$this->$modelName = \hhu\z\models\QuesttypeModel::factory($model);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Load the View of this QuesttypeController.
|
||||
*
|
||||
* @throws \nre\exceptions\ViewNotFoundException
|
||||
* @param string $layoutName Name of the current Layout
|
||||
* @param string $action Current Action
|
||||
*/
|
||||
protected function loadView($layoutName, $action)
|
||||
{
|
||||
// Check Layout name
|
||||
if(is_null($layoutName)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Determine controller name
|
||||
$controllerName = \nre\core\ClassLoader::stripClassType(\nre\core\ClassLoader::getClassName(get_class($this)));
|
||||
|
||||
|
||||
// Load view
|
||||
$this->view = \hhu\z\views\QuesttypeView::loadAndFactory($layoutName, $controllerName, $action);
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* Abstract class for implementing a QuesttypeController.
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
*/
|
||||
abstract class QuesttypeController extends \hhu\z\Controller
|
||||
{
|
||||
/**
|
||||
* Required models
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $models = array('seminaries', 'questgroups', 'quests', 'characters');
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Save the answers of a Character for a Quest.
|
||||
*
|
||||
* @param array $seminary Current Seminary data
|
||||
* @param array $questgroup Current Questgroup data
|
||||
* @param array $quest Current Quest data
|
||||
* @param array $character Current Character data
|
||||
* @param array $answers Character answers for the Quest
|
||||
*/
|
||||
public abstract function saveAnswersOfCharacter($seminary, $questgroup, $quest, $character, $answers);
|
||||
|
||||
|
||||
/**
|
||||
* Save additional data for the answers of a Character for a Quest.
|
||||
*
|
||||
* @param array $seminary Current Seminary data
|
||||
* @param array $questgroup Current Questgroup data
|
||||
* @param array $quest Current Quest data
|
||||
* @param array $character Current Character data
|
||||
* @param array $data Additional (POST-) data
|
||||
*/
|
||||
public abstract function saveDataForCharacterAnswers($seminary, $questgroup, $quest, $character, $data);
|
||||
|
||||
|
||||
/**
|
||||
* Check if answers of a Character for a Quest match the correct ones.
|
||||
*
|
||||
* @param array $seminary Current Seminary data
|
||||
* @param array $questgroup Current Questgroup data
|
||||
* @param array $quest Current Quest data
|
||||
* @param array $character Current Character data
|
||||
* @param array $answers Character answers for the Quest
|
||||
* @return boolean True/false for a right/wrong answer or null for moderator evaluation
|
||||
*/
|
||||
public abstract function matchAnswersOfCharacter($seminary, $questgroup, $quest, $character, $answers);
|
||||
|
||||
|
||||
/**
|
||||
* Action: quest.
|
||||
*
|
||||
* Show the task of a Quest.
|
||||
*
|
||||
* @param array $seminary Current Seminary data
|
||||
* @param array $questgroup Current Questgroup data
|
||||
* @param array $quest Current Quest data
|
||||
* @param array $character Current Character data
|
||||
* @param \Exception $exception Character submission exception
|
||||
*/
|
||||
public abstract function quest($seminary, $questgroup, $quest, $character, $exception);
|
||||
|
||||
|
||||
/**
|
||||
* Action: submission.
|
||||
*
|
||||
* Show the submission of a Character for a Quest.
|
||||
*
|
||||
* @param array $seminary Current Seminary data
|
||||
* @param array $questgroup Current Questgroup data
|
||||
* @param array $quest Current Quest data
|
||||
* @param array $character Current Character data
|
||||
*/
|
||||
public abstract function submission($seminary, $questgroup, $quest, $character);
|
||||
|
||||
|
||||
/**
|
||||
* Action: edittask.
|
||||
*
|
||||
* Edit the task of a Quest.
|
||||
*
|
||||
* @param array $seminary Current Seminary data
|
||||
* @param array $questgroup Current Questgroup data
|
||||
* @param array $quest Current Quest data
|
||||
*/
|
||||
public abstract function edittask($seminary, $questgroup, $quest);
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Load a QuesttypeController.
|
||||
*
|
||||
* @static
|
||||
* @throws \hhu\z\exceptions\QuesttypeControllerNotFoundException
|
||||
* @throws \hhu\z\exceptions\QuesttypeControllerNotValidException
|
||||
* @param string $controllerName Name of the QuesttypeController to load
|
||||
*/
|
||||
public static function load($controllerName)
|
||||
{
|
||||
// Determine full classname
|
||||
$className = self::getClassName($controllerName);
|
||||
|
||||
try {
|
||||
// Load class
|
||||
static::loadClass($controllerName, $className);
|
||||
|
||||
// Validate class
|
||||
static::checkClass($className, get_class());
|
||||
}
|
||||
catch(\nre\exceptions\ClassNotValidException $e) {
|
||||
throw new \hhu\z\exceptions\QuesttypeControllerNotValidException($e->getClassName());
|
||||
}
|
||||
catch(\nre\exceptions\ClassNotFoundException $e) {
|
||||
throw new \hhu\z\exceptions\QuesttypeControllerNotFoundException($e->getClassName());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Instantiate a QuesttypeController (Factory Pattern).
|
||||
*
|
||||
* @static
|
||||
* @throws \nre\exceptions\DatamodelException
|
||||
* @throws \nre\exceptions\DriverNotFoundException
|
||||
* @throws \nre\exceptions\DriverNotValidException
|
||||
* @throws \nre\exceptions\ModelNotValidException
|
||||
* @throws \nre\exceptions\ModelNotFoundException
|
||||
* @throws \nre\exceptions\ViewNotFoundException
|
||||
* @throws \hhu\z\exceptions\QuesttypeModelNotValidException
|
||||
* @throws \hhu\z\exceptions\QuesttypeModelNotFoundException
|
||||
* @param string $controllerName Name of the QuesttypeController to instantiate
|
||||
* @param string $layoutName Name of the current Layout
|
||||
* @param string $action Current Action
|
||||
* @param \nre\core\Agent $agent Corresponding Agent
|
||||
*/
|
||||
public static function factory($controllerName, $layoutName, $action, $agent)
|
||||
{
|
||||
// Determine full classname
|
||||
$className = self::getClassName($controllerName);
|
||||
|
||||
// Construct and return Controller
|
||||
return new $className($layoutName, $action, $agent);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Determine the Controller-classname for the given Questtype-name.
|
||||
*
|
||||
* @static
|
||||
* @param string $questtypeName Questtype-name to get Controller-classname of
|
||||
* @return string Classname for the Questtype-name
|
||||
*/
|
||||
private static function getClassName($questtypeName)
|
||||
{
|
||||
$className = \nre\core\ClassLoader::concatClassNames($questtypeName, \nre\core\ClassLoader::stripClassType(\nre\core\ClassLoader::stripNamespace(get_class())), 'controller');
|
||||
|
||||
|
||||
return \nre\configs\AppConfig::$app['namespace']."questtypes\\$className";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Load the class of a QuesttypeController
|
||||
*
|
||||
* @static
|
||||
* @throws \nre\exceptions\ClassNotFoundException
|
||||
* @param string $questtypeName Name of the QuesttypeController to load
|
||||
* @param string $fullClassName Name of the class to load
|
||||
*/
|
||||
private static function loadClass($questtypeName, $fullClassName)
|
||||
{
|
||||
// Determine folder to look in
|
||||
$className = explode('\\', $fullClassName);
|
||||
$className = array_pop($className);
|
||||
|
||||
// Determine filename
|
||||
$fileName = ROOT.DS.\nre\configs\AppConfig::$dirs['questtypes'].DS.strtolower($questtypeName).DS.$className.\nre\configs\CoreConfig::getFileExt('includes');
|
||||
|
||||
// Check file
|
||||
if(!file_exists($fileName))
|
||||
{
|
||||
throw new \nre\exceptions\ClassNotFoundException(
|
||||
$fullClassName
|
||||
);
|
||||
}
|
||||
|
||||
// Include file
|
||||
include_once($fileName);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check inheritance of the QuesttypeController-class.
|
||||
*
|
||||
* @static
|
||||
* @throws \nre\exceptions\ClassNotValidException
|
||||
* @param string $className Name of the class to check
|
||||
* @param string $parentClassName Name of the parent class
|
||||
*/
|
||||
public static function checkClass($className, $parentClassName)
|
||||
{
|
||||
// Check if class is subclass of parent class
|
||||
if(!is_subclass_of($className, $parentClassName)) {
|
||||
throw new \nre\exceptions\ClassNotValidException(
|
||||
$className
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Construct a new application Controller.
|
||||
*
|
||||
* @throws \nre\exceptions\DriverNotFoundException
|
||||
* @throws \nre\exceptions\DriverNotValidException
|
||||
* @throws \nre\exceptions\ModelNotValidException
|
||||
* @throws \nre\exceptions\ModelNotFoundException
|
||||
* @throws \nre\exceptions\ViewNotFoundException
|
||||
* @throws \hhu\z\exceptions\QuesttypeModelNotValidException
|
||||
* @throws \hhu\z\exceptions\QuesttypeModelNotFoundException
|
||||
* @param string $layoutName Name of the current Layout
|
||||
* @param string $action Current Action
|
||||
* @param Agent $agent Corresponding Agent
|
||||
*/
|
||||
public function __construct($layoutName, $action, $agent)
|
||||
{
|
||||
parent::__construct($layoutName, $action, $agent);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Load the Models of this Controller.
|
||||
*
|
||||
* @throws \nre\exceptions\DatamodelException
|
||||
* @throws \nre\exceptions\DriverNotFoundException
|
||||
* @throws \nre\exceptions\DriverNotValidException
|
||||
* @throws \nre\exceptions\ModelNotValidException
|
||||
* @throws \nre\exceptions\ModelNotFoundException
|
||||
* @throws \hhu\z\exceptions\QuesttypeModelNotValidException
|
||||
* @throws \hhu\z\exceptions\QuesttypeModelNotFoundException
|
||||
*/
|
||||
protected function loadModels()
|
||||
{
|
||||
// Load default models
|
||||
parent::loadModels();
|
||||
|
||||
// Load QuesttypeModel
|
||||
$this->loadModel();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Load the Model of the Questtype.
|
||||
*
|
||||
* @throws \hhu\z\exceptions\QuesttypeModelNotValidException
|
||||
* @throws \hhu\z\exceptions\QuesttypeModelNotFoundException
|
||||
*/
|
||||
private function loadModel()
|
||||
{
|
||||
// Determine Model
|
||||
$model = \nre\core\ClassLoader::stripClassType(\nre\core\ClassLoader::stripClassType(\nre\core\ClassLoader::stripNamespace(get_class($this))));
|
||||
|
||||
// Load class
|
||||
\hhu\z\models\QuesttypeModel::load($model);
|
||||
|
||||
// Construct Model
|
||||
$modelName = ucfirst(strtolower($model));
|
||||
$this->$modelName = \hhu\z\models\QuesttypeModel::factory($model);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Load the View of this QuesttypeController.
|
||||
*
|
||||
* @throws \nre\exceptions\ViewNotFoundException
|
||||
* @param string $layoutName Name of the current Layout
|
||||
* @param string $action Current Action
|
||||
*/
|
||||
protected function loadView($layoutName, $action)
|
||||
{
|
||||
// Check Layout name
|
||||
if(is_null($layoutName)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Determine controller name
|
||||
$controllerName = \nre\core\ClassLoader::stripClassType(\nre\core\ClassLoader::getClassName(get_class($this)));
|
||||
|
||||
|
||||
// Load view
|
||||
$this->view = \hhu\z\views\QuesttypeView::loadAndFactory($layoutName, $controllerName, $action);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -1,328 +1,328 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
*/
|
||||
|
||||
namespace hhu\z\controllers;
|
||||
|
||||
|
||||
/**
|
||||
* Abstract class for implementing a Controller for a Seminary and its
|
||||
* concepts.
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
*/
|
||||
abstract class SeminaryController extends \hhu\z\controllers\IntermediateController
|
||||
{
|
||||
/**
|
||||
* Required components
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $components = array('achievement', 'auth', 'notification');
|
||||
/**
|
||||
* Required models
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $models = array('seminaries', 'characters', 'characterroles', 'xplevels', 'avatars', 'achievements');
|
||||
/**
|
||||
* Current Seminary
|
||||
*
|
||||
* var array
|
||||
*/
|
||||
public static $seminary = null;
|
||||
/**
|
||||
* Character of current user and Seminary
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $character = null;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Construct a new Seminary Controller.
|
||||
*
|
||||
* @throws \nre\exceptions\DriverNotFoundException
|
||||
* @throws \nre\exceptions\DriverNotValidException
|
||||
* @throws \nre\exceptions\ModelNotValidException
|
||||
* @throws \nre\exceptions\ModelNotFoundException
|
||||
* @throws \nre\exceptions\ViewNotFoundException
|
||||
* @param string $layoutName Name of the current Layout
|
||||
* @param string $action Current Action
|
||||
* @param \nre\core\Agent $agent Corresponding Agent
|
||||
*/
|
||||
public function __construct($layoutName, $action, $agent)
|
||||
{
|
||||
parent::__construct($layoutName, $action, $agent);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Prefilter that is executed before running the Controller.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
public function preFilter(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
parent::preFilter($request, $response);
|
||||
|
||||
// Get Seminary and Character data
|
||||
try {
|
||||
self::$seminary = $this->Seminaries->getSeminaryByUrl($this->request->getParam(3));
|
||||
if(!is_null(self::$user))
|
||||
{
|
||||
self::$character = $this->Characters->getCharacterForUserAndSeminary(self::$user['id'], self::$seminary['id']);
|
||||
self::$character['characterroles'] = array_map(function($r) { return $r['name']; }, $this->Characterroles->getCharacterrolesForCharacterById(self::$character['id']));
|
||||
try {
|
||||
self::$character['xplevel'] = $this->Xplevels->getXPLevelById(self::$character['xplevel_id']);
|
||||
self::$character['avatar'] = $this->Avatars->getAvatarByTypeAndLevel(self::$seminary['id'], self::$character['charactertype_url'], self::$character['xplevel']['level']);
|
||||
}
|
||||
catch(\nre\exceptions\IdNotFoundException $e) {
|
||||
// No Avatar available
|
||||
}
|
||||
}
|
||||
}
|
||||
catch(\nre\exceptions\IdNotFoundException $e) {
|
||||
}
|
||||
|
||||
// Check permissions
|
||||
$this->checkPermission($request, $response);
|
||||
|
||||
// Check achievements
|
||||
$this->checkAchievements($request, $response, 'date');
|
||||
$this->checkAchievements($request, $response, 'achievement');
|
||||
|
||||
// Set Seminary and Character data
|
||||
$this->set('loggedSeminary', self::$seminary);
|
||||
$this->set('loggedCharacter', self::$character);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Postfilter that is executed after running the Controller.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
public function postFilter(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
parent::postFilter($request, $response);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Check user permissions.
|
||||
*
|
||||
* @throws AccessDeniedException
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
private function checkPermission(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
// Do not check index page
|
||||
if(is_null($request->getParam(3))) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Determine permissions for current action
|
||||
$action = $this->request->getParam(2, 'action');
|
||||
if(!property_exists($this, 'seminaryPermissions')) {
|
||||
return; // Allow if nothing is specified
|
||||
}
|
||||
if(!array_key_exists($action, $this->seminaryPermissions)) {
|
||||
return; // Allow if Action is not specified
|
||||
}
|
||||
$permissions = $this->seminaryPermissions[$action];
|
||||
|
||||
|
||||
// Check permissions
|
||||
if(is_null(self::$character) || !array_key_exists('characterroles', self::$character) || count(array_intersect(self::$character['characterroles'], $permissions)) == 0) {
|
||||
throw new \nre\exceptions\AccessDeniedException();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check for newly achieved Achievements.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
* @param array $checkConditions Conditions to check
|
||||
*/
|
||||
protected function checkAchievements(\nre\core\Request $request, \nre\core\Response $response, $checkConditions=null)
|
||||
{
|
||||
// Do not check MediaController
|
||||
if($this->request->getParam(0, 'toplevel') != \nre\configs\AppConfig::$defaults['toplevel']) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if Character is present
|
||||
if(is_null(self::$character)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Set conditions to check
|
||||
if(!is_null($checkConditions) && !is_array($checkConditions)) {
|
||||
$checkConditions = array($checkConditions);
|
||||
}
|
||||
|
||||
// Get unachieved Achievments
|
||||
$achievements = $this->Achievements->getUnachhievedAchievementsForCharacter(self::$seminary['id'], self::$character['id']);
|
||||
if(in_array('user', self::$character['characterroles'])) {
|
||||
$achievements = array_merge($achievements, $this->Achievements->getUnachievedOnlyOnceAchievementsForSeminary(self::$seminary['id']));
|
||||
}
|
||||
|
||||
// Check conditions
|
||||
foreach($achievements as &$achievement)
|
||||
{
|
||||
// Check condition to test
|
||||
if(!is_null($checkConditions) && !in_array($achievement['condition'], $checkConditions)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Check deadline
|
||||
if(!is_null($achievement['deadline']) && $achievement['deadline'] < date('Y-m-d H:i:s')) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Get conditions
|
||||
$conditions = array();
|
||||
$progress = 0;
|
||||
switch($achievement['condition'])
|
||||
{
|
||||
// Date conditions
|
||||
case 'date':
|
||||
$conditionsDate = $this->Achievements->getAchievementConditionsDate($achievement['id']);
|
||||
foreach($conditionsDate as &$condition)
|
||||
{
|
||||
$conditions[] = array(
|
||||
'func' => 'checkAchievementConditionDate',
|
||||
'params' => array(
|
||||
$condition['select']
|
||||
)
|
||||
);
|
||||
}
|
||||
break;
|
||||
// Character conditions
|
||||
case 'character':
|
||||
$conditionsCharacter = $this->Achievements->getAchievementConditionsCharacter($achievement['id']);
|
||||
foreach($conditionsCharacter as &$condition)
|
||||
{
|
||||
$conditions[] = array(
|
||||
'func' => 'checkAchievementConditionCharacter',
|
||||
'params' => array(
|
||||
$condition['field'],
|
||||
$condition['value'],
|
||||
self::$character['id']
|
||||
)
|
||||
);
|
||||
}
|
||||
break;
|
||||
// Quest conditions
|
||||
case 'quest':
|
||||
$conditionsQuest = $this->Achievements->getAchievementConditionsQuest($achievement['id']);
|
||||
foreach($conditionsQuest as &$condition)
|
||||
{
|
||||
$conditions[] = array(
|
||||
'func' => 'checkAchievementConditionQuest',
|
||||
'params' => array(
|
||||
$condition['field'],
|
||||
$condition['count'],
|
||||
$condition['value'],
|
||||
$condition['status'],
|
||||
$condition['groupby'],
|
||||
$condition['quest_id'],
|
||||
self::$character['id']
|
||||
)
|
||||
);
|
||||
}
|
||||
break;
|
||||
// Achievement conditions
|
||||
case 'achievement':
|
||||
$conditionsAchievement = $this->Achievements->getAchievementConditionsAchievement($achievement['id']);
|
||||
foreach($conditionsAchievement as &$condition)
|
||||
{
|
||||
$conditions[] = array(
|
||||
'func' => 'checkAchievementConditionAchievement',
|
||||
'params' => array(
|
||||
$condition['field'],
|
||||
$condition['count'],
|
||||
$condition['value'],
|
||||
$condition['groupby'],
|
||||
$condition['meta_achievement_id'],
|
||||
self::$character['id']
|
||||
)
|
||||
);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// Do not achieve Achievements without conditions
|
||||
if(empty($conditions)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Check conditions
|
||||
$achieved = ($achievement['all_conditions'] == 1);
|
||||
foreach($conditions as &$condition)
|
||||
{
|
||||
// Calculate result of condition
|
||||
$result = call_user_func_array(
|
||||
array(
|
||||
$this->Achievements,
|
||||
$condition['func']
|
||||
),
|
||||
$condition['params']
|
||||
);
|
||||
|
||||
// The overall result and abort if possible
|
||||
if($achievement['all_conditions'])
|
||||
{
|
||||
if(!$result) {
|
||||
$achieved = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if($result) {
|
||||
$achieved = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Achievement achieved
|
||||
if($achieved)
|
||||
{
|
||||
// Set status
|
||||
$this->Achievements->setAchievementAchieved($achievement['id'], self::$character['id']);
|
||||
|
||||
// Add notification
|
||||
$this->Notification->addNotification(
|
||||
\hhu\z\controllers\components\NotificationComponent::TYPE_ACHIEVEMENT,
|
||||
$achievement['title'],
|
||||
$this->linker->link(array('achievements', 'index', self::$seminary['url']), 0, true, null, true, $achievement['url']),
|
||||
(!is_null($achievement['achieved_achievementsmedia_id']) ? $this->linker->link(array('media','achievement',self::$seminary['url'],$achievement['url'])) : null)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* The Legend of Z
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
*/
|
||||
|
||||
namespace hhu\z\controllers;
|
||||
|
||||
|
||||
/**
|
||||
* Abstract class for implementing a Controller for a Seminary and its
|
||||
* concepts.
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
*/
|
||||
abstract class SeminaryController extends \hhu\z\controllers\IntermediateController
|
||||
{
|
||||
/**
|
||||
* Required components
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $components = array('achievement', 'auth', 'notification');
|
||||
/**
|
||||
* Required models
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $models = array('seminaries', 'characters', 'characterroles', 'xplevels', 'avatars', 'achievements');
|
||||
/**
|
||||
* Current Seminary
|
||||
*
|
||||
* var array
|
||||
*/
|
||||
public static $seminary = null;
|
||||
/**
|
||||
* Character of current user and Seminary
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $character = null;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Construct a new Seminary Controller.
|
||||
*
|
||||
* @throws \nre\exceptions\DriverNotFoundException
|
||||
* @throws \nre\exceptions\DriverNotValidException
|
||||
* @throws \nre\exceptions\ModelNotValidException
|
||||
* @throws \nre\exceptions\ModelNotFoundException
|
||||
* @throws \nre\exceptions\ViewNotFoundException
|
||||
* @param string $layoutName Name of the current Layout
|
||||
* @param string $action Current Action
|
||||
* @param \nre\core\Agent $agent Corresponding Agent
|
||||
*/
|
||||
public function __construct($layoutName, $action, $agent)
|
||||
{
|
||||
parent::__construct($layoutName, $action, $agent);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Prefilter that is executed before running the Controller.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
public function preFilter(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
parent::preFilter($request, $response);
|
||||
|
||||
// Get Seminary and Character data
|
||||
try {
|
||||
self::$seminary = $this->Seminaries->getSeminaryByUrl($this->request->getParam(3));
|
||||
if(!is_null(self::$user))
|
||||
{
|
||||
self::$character = $this->Characters->getCharacterForUserAndSeminary(self::$user['id'], self::$seminary['id']);
|
||||
self::$character['characterroles'] = array_map(function($r) { return $r['name']; }, $this->Characterroles->getCharacterrolesForCharacterById(self::$character['id']));
|
||||
try {
|
||||
self::$character['xplevel'] = $this->Xplevels->getXPLevelById(self::$character['xplevel_id']);
|
||||
self::$character['avatar'] = $this->Avatars->getAvatarByTypeAndLevel(self::$seminary['id'], self::$character['charactertype_url'], self::$character['xplevel']['level']);
|
||||
}
|
||||
catch(\nre\exceptions\IdNotFoundException $e) {
|
||||
// No Avatar available
|
||||
}
|
||||
}
|
||||
}
|
||||
catch(\nre\exceptions\IdNotFoundException $e) {
|
||||
}
|
||||
|
||||
// Check permissions
|
||||
$this->checkPermission($request, $response);
|
||||
|
||||
// Check achievements
|
||||
$this->checkAchievements($request, $response, 'date');
|
||||
$this->checkAchievements($request, $response, 'achievement');
|
||||
|
||||
// Set Seminary and Character data
|
||||
$this->set('loggedSeminary', self::$seminary);
|
||||
$this->set('loggedCharacter', self::$character);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Postfilter that is executed after running the Controller.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
public function postFilter(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
parent::postFilter($request, $response);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Check user permissions.
|
||||
*
|
||||
* @throws AccessDeniedException
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
private function checkPermission(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
// Do not check index page
|
||||
if(is_null($request->getParam(3))) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Determine permissions for current action
|
||||
$action = $this->request->getParam(2, 'action');
|
||||
if(!property_exists($this, 'seminaryPermissions')) {
|
||||
return; // Allow if nothing is specified
|
||||
}
|
||||
if(!array_key_exists($action, $this->seminaryPermissions)) {
|
||||
return; // Allow if Action is not specified
|
||||
}
|
||||
$permissions = $this->seminaryPermissions[$action];
|
||||
|
||||
|
||||
// Check permissions
|
||||
if(is_null(self::$character) || !array_key_exists('characterroles', self::$character) || count(array_intersect(self::$character['characterroles'], $permissions)) == 0) {
|
||||
throw new \nre\exceptions\AccessDeniedException();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check for newly achieved Achievements.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
* @param array $checkConditions Conditions to check
|
||||
*/
|
||||
protected function checkAchievements(\nre\core\Request $request, \nre\core\Response $response, $checkConditions=null)
|
||||
{
|
||||
// Do not check MediaController
|
||||
if($this->request->getParam(0, 'toplevel') != \nre\configs\AppConfig::$defaults['toplevel']) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if Character is present
|
||||
if(is_null(self::$character)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Set conditions to check
|
||||
if(!is_null($checkConditions) && !is_array($checkConditions)) {
|
||||
$checkConditions = array($checkConditions);
|
||||
}
|
||||
|
||||
// Get unachieved Achievments
|
||||
$achievements = $this->Achievements->getUnachhievedAchievementsForCharacter(self::$seminary['id'], self::$character['id']);
|
||||
if(in_array('user', self::$character['characterroles'])) {
|
||||
$achievements = array_merge($achievements, $this->Achievements->getUnachievedOnlyOnceAchievementsForSeminary(self::$seminary['id']));
|
||||
}
|
||||
|
||||
// Check conditions
|
||||
foreach($achievements as &$achievement)
|
||||
{
|
||||
// Check condition to test
|
||||
if(!is_null($checkConditions) && !in_array($achievement['condition'], $checkConditions)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Check deadline
|
||||
if(!is_null($achievement['deadline']) && $achievement['deadline'] < date('Y-m-d H:i:s')) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Get conditions
|
||||
$conditions = array();
|
||||
$progress = 0;
|
||||
switch($achievement['condition'])
|
||||
{
|
||||
// Date conditions
|
||||
case 'date':
|
||||
$conditionsDate = $this->Achievements->getAchievementConditionsDate($achievement['id']);
|
||||
foreach($conditionsDate as &$condition)
|
||||
{
|
||||
$conditions[] = array(
|
||||
'func' => 'checkAchievementConditionDate',
|
||||
'params' => array(
|
||||
$condition['select']
|
||||
)
|
||||
);
|
||||
}
|
||||
break;
|
||||
// Character conditions
|
||||
case 'character':
|
||||
$conditionsCharacter = $this->Achievements->getAchievementConditionsCharacter($achievement['id']);
|
||||
foreach($conditionsCharacter as &$condition)
|
||||
{
|
||||
$conditions[] = array(
|
||||
'func' => 'checkAchievementConditionCharacter',
|
||||
'params' => array(
|
||||
$condition['field'],
|
||||
$condition['value'],
|
||||
self::$character['id']
|
||||
)
|
||||
);
|
||||
}
|
||||
break;
|
||||
// Quest conditions
|
||||
case 'quest':
|
||||
$conditionsQuest = $this->Achievements->getAchievementConditionsQuest($achievement['id']);
|
||||
foreach($conditionsQuest as &$condition)
|
||||
{
|
||||
$conditions[] = array(
|
||||
'func' => 'checkAchievementConditionQuest',
|
||||
'params' => array(
|
||||
$condition['field'],
|
||||
$condition['count'],
|
||||
$condition['value'],
|
||||
$condition['status'],
|
||||
$condition['groupby'],
|
||||
$condition['quest_id'],
|
||||
self::$character['id']
|
||||
)
|
||||
);
|
||||
}
|
||||
break;
|
||||
// Achievement conditions
|
||||
case 'achievement':
|
||||
$conditionsAchievement = $this->Achievements->getAchievementConditionsAchievement($achievement['id']);
|
||||
foreach($conditionsAchievement as &$condition)
|
||||
{
|
||||
$conditions[] = array(
|
||||
'func' => 'checkAchievementConditionAchievement',
|
||||
'params' => array(
|
||||
$condition['field'],
|
||||
$condition['count'],
|
||||
$condition['value'],
|
||||
$condition['groupby'],
|
||||
$condition['meta_achievement_id'],
|
||||
self::$character['id']
|
||||
)
|
||||
);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// Do not achieve Achievements without conditions
|
||||
if(empty($conditions)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Check conditions
|
||||
$achieved = ($achievement['all_conditions'] == 1);
|
||||
foreach($conditions as &$condition)
|
||||
{
|
||||
// Calculate result of condition
|
||||
$result = call_user_func_array(
|
||||
array(
|
||||
$this->Achievements,
|
||||
$condition['func']
|
||||
),
|
||||
$condition['params']
|
||||
);
|
||||
|
||||
// The overall result and abort if possible
|
||||
if($achievement['all_conditions'])
|
||||
{
|
||||
if(!$result) {
|
||||
$achieved = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if($result) {
|
||||
$achieved = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Achievement achieved
|
||||
if($achieved)
|
||||
{
|
||||
// Set status
|
||||
$this->Achievements->setAchievementAchieved($achievement['id'], self::$character['id']);
|
||||
|
||||
// Add notification
|
||||
$this->Notification->addNotification(
|
||||
\hhu\z\controllers\components\NotificationComponent::TYPE_ACHIEVEMENT,
|
||||
$achievement['title'],
|
||||
$this->linker->link(array('achievements', 'index', self::$seminary['url']), 0, true, null, true, $achievement['url']),
|
||||
(!is_null($achievement['achieved_achievementsmedia_id']) ? $this->linker->link(array('media','achievement',self::$seminary['url'],$achievement['url'])) : null)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -1,79 +1,79 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
*/
|
||||
|
||||
namespace hhu\z\exceptions;
|
||||
|
||||
|
||||
/**
|
||||
* Exception: File copy went wrong
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
*/
|
||||
class FileCopyException extends \nre\core\Exception
|
||||
{
|
||||
/**
|
||||
* Error code
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
const CODE = 204;
|
||||
/**
|
||||
* Error message
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
const MESSAGE = 'File copy went wrong';
|
||||
|
||||
/**
|
||||
* Nested error
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $nestedError;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Construct a new exception.
|
||||
*
|
||||
* @param array $nestedError Nested error
|
||||
* @param string $message Error message
|
||||
* @param int $code Error code
|
||||
*/
|
||||
function __construct($nestedError, $message=self::MESSAGE, $code=self::CODE)
|
||||
{
|
||||
parent::__construct(
|
||||
$message,
|
||||
/**
|
||||
* The Legend of Z
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
*/
|
||||
|
||||
namespace hhu\z\exceptions;
|
||||
|
||||
|
||||
/**
|
||||
* Exception: File copy went wrong
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
*/
|
||||
class FileCopyException extends \nre\core\Exception
|
||||
{
|
||||
/**
|
||||
* Error code
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
const CODE = 204;
|
||||
/**
|
||||
* Error message
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
const MESSAGE = 'File copy went wrong';
|
||||
|
||||
/**
|
||||
* Nested error
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $nestedError;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Construct a new exception.
|
||||
*
|
||||
* @param array $nestedError Nested error
|
||||
* @param string $message Error message
|
||||
* @param int $code Error code
|
||||
*/
|
||||
function __construct($nestedError, $message=self::MESSAGE, $code=self::CODE)
|
||||
{
|
||||
parent::__construct(
|
||||
$message,
|
||||
$code,
|
||||
$nestedError['message']
|
||||
);
|
||||
|
||||
// Store values
|
||||
$this->nestedError = $nestedError;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Get nested error.
|
||||
*
|
||||
* @return Nested error
|
||||
*/
|
||||
public function getNestedError()
|
||||
{
|
||||
return $this->nestedError;
|
||||
}
|
||||
|
||||
}
|
||||
);
|
||||
|
||||
// Store values
|
||||
$this->nestedError = $nestedError;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Get nested error.
|
||||
*
|
||||
* @return Nested error
|
||||
*/
|
||||
public function getNestedError()
|
||||
{
|
||||
return $this->nestedError;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -1,79 +1,79 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
*/
|
||||
|
||||
namespace hhu\z\exceptions;
|
||||
|
||||
|
||||
/**
|
||||
* Exception: File upload went wrong
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
*/
|
||||
class FileUploadException extends \nre\core\Exception
|
||||
{
|
||||
/**
|
||||
* Error code
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
const CODE = 203;
|
||||
/**
|
||||
* Error message
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
const MESSAGE = 'File upload went wrong';
|
||||
|
||||
/**
|
||||
* Nested message
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $nestedMessage;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Construct a new exception.
|
||||
*
|
||||
* @param string $nestedMessage Nested message
|
||||
* @param string $message Error message
|
||||
* @param int $code Error code
|
||||
*/
|
||||
function __construct($nestedMessage=null, $message=self::MESSAGE, $code=self::CODE)
|
||||
{
|
||||
parent::__construct(
|
||||
$message,
|
||||
$code,
|
||||
$nestedMessage
|
||||
);
|
||||
|
||||
// Store values
|
||||
$this->nestedMessage = $nestedMessage;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Get nested message.
|
||||
*
|
||||
* @return Nested message
|
||||
*/
|
||||
public function getNestedMessage()
|
||||
{
|
||||
return $this->nestedMessage;
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* The Legend of Z
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
*/
|
||||
|
||||
namespace hhu\z\exceptions;
|
||||
|
||||
|
||||
/**
|
||||
* Exception: File upload went wrong
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
*/
|
||||
class FileUploadException extends \nre\core\Exception
|
||||
{
|
||||
/**
|
||||
* Error code
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
const CODE = 203;
|
||||
/**
|
||||
* Error message
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
const MESSAGE = 'File upload went wrong';
|
||||
|
||||
/**
|
||||
* Nested message
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $nestedMessage;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Construct a new exception.
|
||||
*
|
||||
* @param string $nestedMessage Nested message
|
||||
* @param string $message Error message
|
||||
* @param int $code Error code
|
||||
*/
|
||||
function __construct($nestedMessage=null, $message=self::MESSAGE, $code=self::CODE)
|
||||
{
|
||||
parent::__construct(
|
||||
$message,
|
||||
$code,
|
||||
$nestedMessage
|
||||
);
|
||||
|
||||
// Store values
|
||||
$this->nestedMessage = $nestedMessage;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Get nested message.
|
||||
*
|
||||
* @return Nested message
|
||||
*/
|
||||
public function getNestedMessage()
|
||||
{
|
||||
return $this->nestedMessage;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -1,79 +1,79 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
*/
|
||||
|
||||
namespace hhu\z\exceptions;
|
||||
|
||||
|
||||
/**
|
||||
* Exception during sending of an e‑mail.
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
*/
|
||||
class MailingException extends \nre\core\Exception
|
||||
{
|
||||
/**
|
||||
* Error code
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
const CODE = 300;
|
||||
/**
|
||||
* Error message
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
const MESSAGE = 'Error sending e‑mail';
|
||||
|
||||
/**
|
||||
* Nested error message
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $error;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Construct a new exception.
|
||||
*
|
||||
* @param int $error Nested error message
|
||||
* @param string $message Error message
|
||||
* @param int $code Error code
|
||||
*/
|
||||
function __construct($error, $message=self::MESSAGE, $code=self::CODE)
|
||||
{
|
||||
parent::__construct(
|
||||
$message,
|
||||
$code,
|
||||
$error
|
||||
);
|
||||
|
||||
// Store values
|
||||
$this->error = $error;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Get nested error message.
|
||||
*
|
||||
* @return string Nested error message
|
||||
*/
|
||||
public function getError()
|
||||
{
|
||||
return $this->error;
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* The Legend of Z
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
*/
|
||||
|
||||
namespace hhu\z\exceptions;
|
||||
|
||||
|
||||
/**
|
||||
* Exception during sending of an e‑mail.
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
*/
|
||||
class MailingException extends \nre\core\Exception
|
||||
{
|
||||
/**
|
||||
* Error code
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
const CODE = 300;
|
||||
/**
|
||||
* Error message
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
const MESSAGE = 'Error sending e‑mail';
|
||||
|
||||
/**
|
||||
* Nested error message
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $error;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Construct a new exception.
|
||||
*
|
||||
* @param int $error Nested error message
|
||||
* @param string $message Error message
|
||||
* @param int $code Error code
|
||||
*/
|
||||
function __construct($error, $message=self::MESSAGE, $code=self::CODE)
|
||||
{
|
||||
parent::__construct(
|
||||
$message,
|
||||
$code,
|
||||
$error
|
||||
);
|
||||
|
||||
// Store values
|
||||
$this->error = $error;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Get nested error message.
|
||||
*
|
||||
* @return string Nested error message
|
||||
*/
|
||||
public function getError()
|
||||
{
|
||||
return $this->error;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -1,54 +1,54 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
*/
|
||||
|
||||
namespace hhu\z\exceptions;
|
||||
|
||||
|
||||
/**
|
||||
* Exception: File exceeds size maximum.
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
*/
|
||||
class MaxFilesizeException extends \nre\core\Exception
|
||||
{
|
||||
/**
|
||||
* Error code
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
const CODE = 202;
|
||||
/**
|
||||
* Error message
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
const MESSAGE = 'File exceeds size maximum';
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Construct a new exception.
|
||||
*
|
||||
* @param string $message Error message
|
||||
* @param int $code Error code
|
||||
*/
|
||||
function __construct($message=self::MESSAGE, $code=self::CODE)
|
||||
{
|
||||
parent::__construct(
|
||||
$message,
|
||||
$code
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* The Legend of Z
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
*/
|
||||
|
||||
namespace hhu\z\exceptions;
|
||||
|
||||
|
||||
/**
|
||||
* Exception: File exceeds size maximum.
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
*/
|
||||
class MaxFilesizeException extends \nre\core\Exception
|
||||
{
|
||||
/**
|
||||
* Error code
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
const CODE = 202;
|
||||
/**
|
||||
* Error message
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
const MESSAGE = 'File exceeds size maximum';
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Construct a new exception.
|
||||
*
|
||||
* @param string $message Error message
|
||||
* @param int $code Error code
|
||||
*/
|
||||
function __construct($message=self::MESSAGE, $code=self::CODE)
|
||||
{
|
||||
parent::__construct(
|
||||
$message,
|
||||
$code
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -1,79 +1,79 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
*/
|
||||
|
||||
namespace hhu\z\exceptions;
|
||||
|
||||
|
||||
/**
|
||||
* Exception: QuesttypeAgent not found.
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
*/
|
||||
class QuesttypeAgentNotFoundException extends \nre\core\Exception
|
||||
{
|
||||
/**
|
||||
* Error code
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
const CODE = 101;
|
||||
/**
|
||||
* Error message
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
const MESSAGE = 'QuesttypeAgent not found';
|
||||
|
||||
/**
|
||||
* Name of the class that was not found
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $questtypeName;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Construct a new exception.
|
||||
*
|
||||
* @param string $questtypeName Name of the QuesttypeAgent that was not found
|
||||
* @param string $message Error message
|
||||
* @param int $code Error code
|
||||
*/
|
||||
function __construct($questtypeName, $message=self::MESSAGE, $code=self::CODE)
|
||||
{
|
||||
parent::__construct(
|
||||
$message,
|
||||
$code,
|
||||
$questtypeName
|
||||
);
|
||||
|
||||
// Store values
|
||||
$this->questtypeName = $questtypeName;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Get the name of the QuesttypeAgent that was not found.
|
||||
*
|
||||
* @return string Name of the QuesttypeAgent that was not found
|
||||
*/
|
||||
public function getClassName()
|
||||
{
|
||||
return $this->questtypeName;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
*/
|
||||
|
||||
namespace hhu\z\exceptions;
|
||||
|
||||
|
||||
/**
|
||||
* Exception: QuesttypeAgent not found.
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
*/
|
||||
class QuesttypeAgentNotFoundException extends \nre\core\Exception
|
||||
{
|
||||
/**
|
||||
* Error code
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
const CODE = 101;
|
||||
/**
|
||||
* Error message
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
const MESSAGE = 'QuesttypeAgent not found';
|
||||
|
||||
/**
|
||||
* Name of the class that was not found
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $questtypeName;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Construct a new exception.
|
||||
*
|
||||
* @param string $questtypeName Name of the QuesttypeAgent that was not found
|
||||
* @param string $message Error message
|
||||
* @param int $code Error code
|
||||
*/
|
||||
function __construct($questtypeName, $message=self::MESSAGE, $code=self::CODE)
|
||||
{
|
||||
parent::__construct(
|
||||
$message,
|
||||
$code,
|
||||
$questtypeName
|
||||
);
|
||||
|
||||
// Store values
|
||||
$this->questtypeName = $questtypeName;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Get the name of the QuesttypeAgent that was not found.
|
||||
*
|
||||
* @return string Name of the QuesttypeAgent that was not found
|
||||
*/
|
||||
public function getClassName()
|
||||
{
|
||||
return $this->questtypeName;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -1,79 +1,79 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
*/
|
||||
|
||||
namespace hhu\z\exceptions;
|
||||
|
||||
|
||||
/**
|
||||
* Exception: QuesttypeAgent not valid.
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
*/
|
||||
class QuesttypeAgentNotValidException extends \nre\core\Exception
|
||||
{
|
||||
/**
|
||||
* Error code
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
const CODE = 102;
|
||||
/**
|
||||
* Error message
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
const MESSAGE = 'QuesttypeAgent not valid';
|
||||
|
||||
/**
|
||||
* Name of the invalid class
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $questtypeName;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Construct a new exception.
|
||||
*
|
||||
* @param string $questtypeName Name of the invalid QuesttypeAgent
|
||||
* @param string $message Error message
|
||||
* @param int $code Error code
|
||||
*/
|
||||
function __construct($questtypeName, $message=self::MESSAGE, $code=self::CODE)
|
||||
{
|
||||
parent::__construct(
|
||||
$message,
|
||||
$code,
|
||||
$questtypeName
|
||||
);
|
||||
|
||||
// Store value
|
||||
$this->questtypeName = $questtypeName;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Get the name of the invalid QuesttypeAgent.
|
||||
*
|
||||
* @return string Name of the invalid QuesttypeAgent
|
||||
*/
|
||||
public function getClassName()
|
||||
{
|
||||
return $this->questtypeName;
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
* The Legend of Z
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
*/
|
||||
|
||||
namespace hhu\z\exceptions;
|
||||
|
||||
|
||||
/**
|
||||
* Exception: QuesttypeAgent not valid.
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
*/
|
||||
class QuesttypeAgentNotValidException extends \nre\core\Exception
|
||||
{
|
||||
/**
|
||||
* Error code
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
const CODE = 102;
|
||||
/**
|
||||
* Error message
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
const MESSAGE = 'QuesttypeAgent not valid';
|
||||
|
||||
/**
|
||||
* Name of the invalid class
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $questtypeName;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Construct a new exception.
|
||||
*
|
||||
* @param string $questtypeName Name of the invalid QuesttypeAgent
|
||||
* @param string $message Error message
|
||||
* @param int $code Error code
|
||||
*/
|
||||
function __construct($questtypeName, $message=self::MESSAGE, $code=self::CODE)
|
||||
{
|
||||
parent::__construct(
|
||||
$message,
|
||||
$code,
|
||||
$questtypeName
|
||||
);
|
||||
|
||||
// Store value
|
||||
$this->questtypeName = $questtypeName;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Get the name of the invalid QuesttypeAgent.
|
||||
*
|
||||
* @return string Name of the invalid QuesttypeAgent
|
||||
*/
|
||||
public function getClassName()
|
||||
{
|
||||
return $this->questtypeName;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -1,79 +1,79 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
*/
|
||||
|
||||
namespace hhu\z\exceptions;
|
||||
|
||||
|
||||
/**
|
||||
* Exception: QuesttypeController not found.
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
*/
|
||||
class QuesttypeControllerNotFoundException extends \nre\core\Exception
|
||||
{
|
||||
/**
|
||||
* Error code
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
const CODE = 103;
|
||||
/**
|
||||
* Error message
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
const MESSAGE = 'QuesttypeController not found';
|
||||
|
||||
/**
|
||||
* Name of the class that was not found
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $questtypeName;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Construct a new exception.
|
||||
*
|
||||
* @param string $questtypeName Name of the QuesttypeController that was not found
|
||||
* @param string $message Error message
|
||||
* @param int $code Error code
|
||||
*/
|
||||
function __construct($questtypeName, $message=self::MESSAGE, $code=self::CODE)
|
||||
{
|
||||
parent::__construct(
|
||||
$message,
|
||||
$code,
|
||||
$questtypeName
|
||||
);
|
||||
|
||||
// Store values
|
||||
$this->questtypeName = $questtypeName;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Get the name of the QuesttypeController that was not found.
|
||||
*
|
||||
* @return string Name of the QuesttypeController that was not found
|
||||
*/
|
||||
public function getClassName()
|
||||
{
|
||||
return $this->questtypeName;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
*
|
||||
* @author Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
*/
|
||||
|
||||
namespace hhu\z\exceptions;
|
||||
|
||||
|
||||
/**
|
||||
* Exception: QuesttypeController not found.
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
*/
|
||||
class QuesttypeControllerNotFoundException extends \nre\core\Exception
|
||||
{
|
||||
/**
|
||||
* Error code
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
const CODE = 103;
|
||||
/**
|
||||
* Error message
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
const MESSAGE = 'QuesttypeController not found';
|
||||
|
||||
/**
|
||||
* Name of the class that was not found
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $questtypeName;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Construct a new exception.
|
||||
*
|
||||
* @param string $questtypeName Name of the QuesttypeController that was not found
|
||||
* @param string $message Error message
|
||||
* @param int $code Error code
|
||||
*/
|
||||
function __construct($questtypeName, $message=self::MESSAGE, $code=self::CODE)
|
||||
{
|
||||
parent::__construct(
|
||||
$message,
|
||||
$code,
|
||||
$questtypeName
|
||||
);
|
||||
|
||||
// Store values
|
||||
$this->questtypeName = $questtypeName;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Get the name of the QuesttypeController that was not found.
|
||||
*
|
||||
* @return string Name of the QuesttypeController that was not found
|
||||
*/
|
||||
public function getClassName()
|
||||
{
|
||||
return $this->questtypeName;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -1,79 +1,79 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
*/
|
||||
|
||||
namespace hhu\z\exceptions;
|
||||
|
||||
|
||||
/**
|
||||
* Exception: QuesttypeController not valid.
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
*/
|
||||
class QuesttypeControllerNotValidException extends \nre\core\Exception
|
||||
{
|
||||
/**
|
||||
* Error code
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
const CODE = 104;
|
||||
/**
|
||||
* Error message
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
const MESSAGE = 'QuesttypeController not valid';
|
||||
|
||||
/**
|
||||
* Name of the invalid class
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $questtypeName;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Construct a new exception.
|
||||
*
|
||||
* @param string $questtypeName Name of the invalid QuesttypeController
|
||||
* @param string $message Error message
|
||||
* @param int $code Error code
|
||||
*/
|
||||
function __construct($questtypeName, $message=self::MESSAGE, $code=self::CODE)
|
||||
{
|
||||
parent::__construct(
|
||||
$message,
|
||||
$code,
|
||||
$questtypeName
|
||||
);
|
||||
|
||||
// Store value
|
||||
$this->questtypeName = $questtypeName;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Get the name of the invalid QuesttypeController.
|
||||
*
|
||||
* @return string Name of the invalid QuesttypeController
|
||||
*/
|
||||
public function getClassName()
|
||||
{
|
||||
return $this->questtypeName;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
*/
|