merge branch ?charactergroupsqueststations?
This commit is contained in:
parent
476c18b6a9
commit
538e1aa8b0
75 changed files with 19305 additions and 959 deletions
|
@ -7,3 +7,4 @@ syntax: regexp
|
|||
^seminaryuploads/*
|
||||
^www/analytics/config/config.ini.php*
|
||||
^www/analytics/temp/*
|
||||
^app/lib/phpqrcode/cache/*
|
||||
|
|
103
agents/intermediate/CharactergroupsqueststationsAgent.inc
Normal file
103
agents/intermediate/CharactergroupsqueststationsAgent.inc
Normal file
|
@ -0,0 +1,103 @@
|
|||
<?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 display Character groups Quest stations.
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
*/
|
||||
class CharactergroupsqueststationsAgent 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: station.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
public function station(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
// Add Moodpic
|
||||
$this->addSubAgent('Moodpic', 'seminary', $request->getParam(3), 'charactergroups');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 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)
|
||||
{
|
||||
// Add Moodpic
|
||||
$this->addSubAgent('Moodpic', 'seminary', $request->getParam(3), 'charactergroups');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 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)
|
||||
{
|
||||
// Add Moodpic
|
||||
$this->addSubAgent('Moodpic', 'seminary', $request->getParam(3), 'charactergroups');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 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)
|
||||
{
|
||||
// Add Moodpic
|
||||
$this->addSubAgent('Moodpic', 'seminary', $request->getParam(3), 'charactergroups');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 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)
|
||||
{
|
||||
// Add Moodpic
|
||||
$this->addSubAgent('Moodpic', 'seminary', $request->getParam(3), 'charactergroups');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
38
agents/intermediate/QrAgent.inc
Normal file
38
agents/intermediate/QrAgent.inc
Normal file
|
@ -0,0 +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 redirect to a page from a (short) QR-code link.
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
*/
|
||||
class QrAgent 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)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
38
agents/intermediate/QrcodesAgent.inc
Normal file
38
agents/intermediate/QrcodesAgent.inc
Normal file
|
@ -0,0 +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 generate and show QR-codes.
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
*/
|
||||
class QrcodesAgent 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)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
298
app/agents/StationtypeAgent.inc
Normal file
298
app/agents/StationtypeAgent.inc
Normal file
|
@ -0,0 +1,298 @@
|
|||
<?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 StationtypeAgent.
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
*/
|
||||
abstract class StationtypeAgent extends \nre\agents\BottomlevelAgent
|
||||
{
|
||||
/**
|
||||
* Current request
|
||||
*
|
||||
* @var \nre\core\Request
|
||||
*/
|
||||
private $request;
|
||||
/**
|
||||
* Current response
|
||||
*
|
||||
* @var \nre\core\Response
|
||||
*/
|
||||
private $response;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Load a StationtypeAgent.
|
||||
*
|
||||
* @static
|
||||
* @throws \hhu\z\exceptions\StationtypeAgentNotFoundException
|
||||
* @throws \hhu\z\exceptions\StationtypeAgentNotValidException
|
||||
* @param string $stationtypeName Name of the StationtypeAgent to load
|
||||
*/
|
||||
public static function load($stationtypeName)
|
||||
{
|
||||
// Determine full classname
|
||||
$className = self::getClassName($stationtypeName);
|
||||
|
||||
try {
|
||||
// Load class
|
||||
static::loadClass($stationtypeName, $className);
|
||||
|
||||
// Validate class
|
||||
static::checkClass($className, get_class());
|
||||
}
|
||||
catch(\nre\exceptions\ClassNotValidException $e) {
|
||||
throw new \hhu\z\exceptions\StationtypeAgentNotValidException($e->getClassName());
|
||||
}
|
||||
catch(\nre\exceptions\ClassNotFoundException $e) {
|
||||
throw new \hhu\z\exceptions\StationtypeAgentNotFoundException($e->getClassName());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Instantiate a StationtypeAgent (Factory Pattern).
|
||||
*
|
||||
* @static
|
||||
* @throws \nre\exceptions\DatamodelException
|
||||
* @throws \nre\exceptions\DriverNotValidException
|
||||
* @throws \nre\exceptions\DriverNotFoundException
|
||||
* @throws \nre\exceptions\ViewNotFoundException
|
||||
* @throws \hhu\z\exceptions\StationtypeModelNotValidException
|
||||
* @throws \hhu\z\exceptions\StationtypeModelNotFoundException
|
||||
* @throws \hhu\z\exceptions\StationtypeControllerNotValidException
|
||||
* @throws \hhu\z\exceptions\StationtypeControllerNotFoundException
|
||||
* @param string $stationtypeName Name of the StationtypeAgent to instantiate
|
||||
* @param Request $request Current request
|
||||
* @param Response $response Current respone
|
||||
* @param Logger $log Log-system
|
||||
*/
|
||||
public static function factory($stationtypeName, \nre\core\Request $request, \nre\core\Response $response, \nre\core\Logger $log=null)
|
||||
{
|
||||
// Determine full classname
|
||||
$className = self::getClassName($stationtypeName);
|
||||
|
||||
// Construct and return Stationmodule
|
||||
return new $className($request, $response, $log);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Determine the Agent-classname for the given Stationtype-name.
|
||||
*
|
||||
* @static
|
||||
* @param string $stationtypeName Stationtype-name to get Agent-classname of
|
||||
* @param string $agentType Agent type of given Agent name
|
||||
* @return string Classname for the Stationtype-name
|
||||
*/
|
||||
private static function getClassName($stationtypeName, $agentType=null)
|
||||
{
|
||||
$className = \nre\core\ClassLoader::concatClassNames(
|
||||
$stationtypeName,
|
||||
\nre\core\ClassLoader::stripClassType(\nre\core\ClassLoader::stripNamespace(get_class())),
|
||||
'agent'
|
||||
);
|
||||
|
||||
|
||||
return \nre\configs\AppConfig::$app['namespace']."stationtypes\\$className";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Load the class of a StationtypeAgent.
|
||||
*
|
||||
* @static
|
||||
* @throws \nre\exceptions\ClassNotFoundException
|
||||
* @param string $stationtypeName Name of the StationtypeAgent to load
|
||||
* @param string $fullClassName Name of the class to load
|
||||
*/
|
||||
private static function loadClass($stationtypeName, $fullClassName)
|
||||
{
|
||||
// Determine folder to look in
|
||||
$className = explode('\\', $fullClassName);
|
||||
$className = array_pop($className);
|
||||
|
||||
// Determine filename
|
||||
$fileName = ROOT.DS.
|
||||
\nre\configs\AppConfig::$dirs['stationtypes'].DS.
|
||||
strtolower($stationtypeName).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 StationtypeAgent-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 StationtypeAgent.
|
||||
*
|
||||
* @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\StationtypeModelNotValidException
|
||||
* @throws \hhu\z\exceptions\StationtypeModelNotFoundException
|
||||
* @throws \hhu\z\exceptions\StationtypeControllerNotValidException
|
||||
* @throws \hhu\z\exceptions\StationtypeControllerNotFoundException
|
||||
* @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 answer of a Character group for a Station.
|
||||
*
|
||||
* @param array $seminary Current Seminary data
|
||||
* @param array $questgroup Current Questgroup data
|
||||
* @param array $quest Current Quest data
|
||||
* @param array $station Current Station data
|
||||
* @param array $group Current Character data
|
||||
* @param array $answers Character answers for the Quest
|
||||
*/
|
||||
public function saveAnswer($seminary, $groupsgroup, $quest, $station, $group, $answer)
|
||||
{
|
||||
$this->controller->saveAnswer(
|
||||
$seminary,
|
||||
$groupsgroup,
|
||||
$quest,
|
||||
$station,
|
||||
$group,
|
||||
$answer
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Check if the answer of a Character group for a Station matches the
|
||||
* correct one.
|
||||
*
|
||||
* @param array $seminary Current Seminary data
|
||||
* @param array $questgroup Current Questgroup data
|
||||
* @param array $quest Current Quest data
|
||||
* @param array $station Current Station data
|
||||
* @param array $group Current Character group data
|
||||
* @param array $answers Character answers for the Quest
|
||||
*/
|
||||
public function matchAnswer($seminary, $groupsgroup, $quest, $station, $group, $answer)
|
||||
{
|
||||
return $this->controller->matchAnswer(
|
||||
$seminary,
|
||||
$groupsgroup,
|
||||
$quest,
|
||||
$station,
|
||||
$group,
|
||||
$answer
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 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\StationxuesttypeModelNotValidException
|
||||
* @throws \hhu\z\exceptions\StationtypeModelNotFoundException
|
||||
* @throws \hhu\z\exceptions\StationtypeControllerNotValidException
|
||||
* @throws \hhu\z\exceptions\StationtypeControllerNotFoundException
|
||||
*/
|
||||
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\StationtypeController::load($controllerName);
|
||||
|
||||
// Construct Controller
|
||||
$this->controller = \hhu\z\controllers\StationtypeController::factory(
|
||||
$controllerName,
|
||||
$toplevelAgentName,
|
||||
$action,
|
||||
$this
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
320
app/controllers/StationtypeController.inc
Normal file
320
app/controllers/StationtypeController.inc
Normal file
|
@ -0,0 +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 StationtypeController.
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
*/
|
||||
abstract class StationtypeController extends \hhu\z\Controller
|
||||
{
|
||||
/**
|
||||
* Required models
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public $models = array('seminaries'); //, 'questgroups', 'quests', 'characters');
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Save the answer of a Character group for a Station.
|
||||
*
|
||||
* @param array $seminary Current Seminary data
|
||||
* @param array $groupsgroup Current Groups group data
|
||||
* @param array $quest Current Quest data
|
||||
* @param array $station Current Station data
|
||||
* @param array $charactergroup Current Character group data
|
||||
* @param array $answer Character group answer for the Station
|
||||
*/
|
||||
public abstract function saveAnswer($seminary, $groupsgroup, $quest, $station, $charactergroup, $answer);
|
||||
|
||||
|
||||
/**
|
||||
* Check if answer of a Character group for a Station matches the correct one.
|
||||
*
|
||||
* @param array $seminary Current Seminary data
|
||||
* @param array $groupsgroup Current Groups group data
|
||||
* @param array $quest Current Quest data
|
||||
* @param array $station Current Station data
|
||||
* @param array $charactergroup Current Character group data
|
||||
* @param array $answer Character group answer for the Station
|
||||
* @return boolean True/false for a right/wrong answer
|
||||
*/
|
||||
public abstract function matchAnswer($seminary, $groupsgroup, $quest, $station, $charactergroup, $answer);
|
||||
|
||||
|
||||
/**
|
||||
* Action: quest.
|
||||
*
|
||||
* Show the task of a Station.
|
||||
*
|
||||
* @param array $seminary Current Seminary data
|
||||
* @param array $groupsgroup Current Groups group data
|
||||
* @param array $quest Current Quest data
|
||||
* @param array $station Current Station data
|
||||
* @param array $charactergroup Current Character group data
|
||||
*/
|
||||
public abstract function quest($seminary, $groupsgroup, $quest, $station, $charactergroup);
|
||||
|
||||
|
||||
/**
|
||||
* Action: edittask.
|
||||
*
|
||||
* Edit the task of a Station.
|
||||
*
|
||||
* @param array $seminary Current Seminary data
|
||||
* @param array $groupsgroup Current Groups group data
|
||||
* @param array $quest Current Quest data
|
||||
* @param array $station Current Station data
|
||||
*/
|
||||
public abstract function edittask($seminary, $groupsgroup, $quest, $station);
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Load a StationtypeController.
|
||||
*
|
||||
* @static
|
||||
* @throws \hhu\z\exceptions\StationtypeControllerNotFoundException
|
||||
* @throws \hhu\z\exceptions\StationtypeControllerNotValidException
|
||||
* @param string $controllerName Name of the StationtypeController 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\StationtypeControllerNotValidException($e->getClassName());
|
||||
}
|
||||
catch(\nre\exceptions\ClassNotFoundException $e) {
|
||||
throw new \hhu\z\exceptions\StationtypeControllerNotFoundException($e->getClassName());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Instantiate a StationtypeController (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\StationtypeModelNotValidException
|
||||
* @throws \hhu\z\exceptions\StationtypeModelNotFoundException
|
||||
* @param string $controllerName Name of the StationtypeController 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 Stationtype-name.
|
||||
*
|
||||
* @static
|
||||
* @param string $stationtypeName Stationtype-name to get Controller-classname of
|
||||
* @return string Classname for the Stationtype-name
|
||||
*/
|
||||
private static function getClassName($stationtypeName)
|
||||
{
|
||||
$className = \nre\core\ClassLoader::concatClassNames(
|
||||
$stationtypeName,
|
||||
\nre\core\ClassLoader::stripClassType(\nre\core\ClassLoader::stripNamespace(get_class())),
|
||||
'controller'
|
||||
);
|
||||
|
||||
|
||||
return \nre\configs\AppConfig::$app['namespace']."stationtypes\\$className";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Load the class of a StationtypeController
|
||||
*
|
||||
* @static
|
||||
* @throws \nre\exceptions\ClassNotFoundException
|
||||
* @param string $stationtypeName Name of the StationtypeController to load
|
||||
* @param string $fullClassName Name of the class to load
|
||||
*/
|
||||
private static function loadClass($stationtypeName, $fullClassName)
|
||||
{
|
||||
// Determine folder to look in
|
||||
$className = explode('\\', $fullClassName);
|
||||
$className = array_pop($className);
|
||||
|
||||
// Determine filename
|
||||
$fileName = ROOT.DS.
|
||||
\nre\configs\AppConfig::$dirs['stationtypes'].DS.
|
||||
strtolower($stationtypeName).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 StationtypeController-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\StationtypeModelNotValidException
|
||||
* @throws \hhu\z\exceptions\StationtypeModelNotFoundException
|
||||
* @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\StationtypeModelNotValidException
|
||||
* @throws \hhu\z\exceptions\StationtypeModelNotFoundException
|
||||
*/
|
||||
protected function loadModels()
|
||||
{
|
||||
// Load default models
|
||||
parent::loadModels();
|
||||
|
||||
// Load StationtypeModel
|
||||
$this->loadModel();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Load the Model of the Stationtype.
|
||||
*
|
||||
* @throws \hhu\z\exceptions\StationtypeModelNotValidException
|
||||
* @throws \hhu\z\exceptions\StationtypeModelNotFoundException
|
||||
*/
|
||||
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\StationtypeModel::load($model);
|
||||
|
||||
// Construct Model
|
||||
$modelName = ucfirst(strtolower($model));
|
||||
$this->$modelName = \hhu\z\models\StationtypeModel::factory($model);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Load the View of this StationtypeController.
|
||||
*
|
||||
* @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\StationtypeView::loadAndFactory(
|
||||
$layoutName,
|
||||
$controllerName,
|
||||
$action
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
79
app/exceptions/StationtypeAgentNotFoundException.inc
Normal file
79
app/exceptions/StationtypeAgentNotFoundException.inc
Normal file
|
@ -0,0 +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: StationtypeAgent not found.
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
*/
|
||||
class StationtypeAgentNotFoundException extends \nre\core\Exception
|
||||
{
|
||||
/**
|
||||
* Error code
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
const CODE = 401;
|
||||
/**
|
||||
* Error message
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
const MESSAGE = 'StationtypeAgent not found';
|
||||
|
||||
/**
|
||||
* Name of the class that was not found
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $stationtypeName;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Construct a new exception.
|
||||
*
|
||||
* @param string $stationtypeName Name of the StationtypeAgent that was not found
|
||||
* @param string $message Error message
|
||||
* @param int $code Error code
|
||||
*/
|
||||
function __construct($stationtypeName, $message=self::MESSAGE, $code=self::CODE)
|
||||
{
|
||||
parent::__construct(
|
||||
$message,
|
||||
$code,
|
||||
$stationtypeName
|
||||
);
|
||||
|
||||
// Store values
|
||||
$this->stationtypeName = $stationtypeName;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Get the name of the StationtypeAgent that was not found.
|
||||
*
|
||||
* @return string Name of the StationtypeAgent that was not found
|
||||
*/
|
||||
public function getClassName()
|
||||
{
|
||||
return $this->stationtypeName;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
79
app/exceptions/StationtypeAgentNotValidException.inc
Normal file
79
app/exceptions/StationtypeAgentNotValidException.inc
Normal file
|
@ -0,0 +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: StationtypeAgent not valid.
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
*/
|
||||
class StationtypeAgentNotValidException extends \nre\core\Exception
|
||||
{
|
||||
/**
|
||||
* Error code
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
const CODE = 402;
|
||||
/**
|
||||
* Error message
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
const MESSAGE = 'StationtypeAgent not valid';
|
||||
|
||||
/**
|
||||
* Name of the invalid class
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $stationtypeName;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Construct a new exception.
|
||||
*
|
||||
* @param string $stationtypeName Name of the invalid StationtypeAgent
|
||||
* @param string $message Error message
|
||||
* @param int $code Error code
|
||||
*/
|
||||
function __construct($stationtypeName, $message=self::MESSAGE, $code=self::CODE)
|
||||
{
|
||||
parent::__construct(
|
||||
$message,
|
||||
$code,
|
||||
$stationtypeName
|
||||
);
|
||||
|
||||
// Store value
|
||||
$this->stationtypeName = $stationtypeName;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Get the name of the invalid StationtypeAgent.
|
||||
*
|
||||
* @return string Name of the invalid StationtypeAgent
|
||||
*/
|
||||
public function getClassName()
|
||||
{
|
||||
return $this->stationtypeName;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
79
app/exceptions/StationtypeControllerNotFoundException.inc
Normal file
79
app/exceptions/StationtypeControllerNotFoundException.inc
Normal file
|
@ -0,0 +1,79 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* 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: StationtypeController not found.
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
*/
|
||||
class StationtypeControllerNotFoundException extends \nre\core\Exception
|
||||
{
|
||||
/**
|
||||
* Error code
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
const CODE = 403;
|
||||
/**
|
||||
* Error message
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
const MESSAGE = 'StationtypeController not found';
|
||||
|
||||
/**
|
||||
* Name of the class that was not found
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $stationtypeName;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Construct a new exception.
|
||||
*
|
||||
* @param string $stationtypeName Name of the StationtypeController that was not found
|
||||
* @param string $message Error message
|
||||
* @param int $code Error code
|
||||
*/
|
||||
function __construct($stationtypeName, $message=self::MESSAGE, $code=self::CODE)
|
||||
{
|
||||
parent::__construct(
|
||||
$message,
|
||||
$code,
|
||||
$stationtypeName
|
||||
);
|
||||
|
||||
// Store values
|
||||
$this->stationtypeName = $stationtypeName;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Get the name of the StationtypeController that was not found.
|
||||
*
|
||||
* @return string Name of the StationtypeController that was not found
|
||||
*/
|
||||
public function getClassName()
|
||||
{
|
||||
return $this->stationtypeName;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
79
app/exceptions/StationtypeControllerNotValidException.inc
Normal file
79
app/exceptions/StationtypeControllerNotValidException.inc
Normal file
|
@ -0,0 +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: StationtypeController not valid.
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
*/
|
||||
class StationtypeControllerNotValidException extends \nre\core\Exception
|
||||
{
|
||||
/**
|
||||
* Error code
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
const CODE = 404;
|
||||
/**
|
||||
* Error message
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
const MESSAGE = 'StationtypeController not valid';
|
||||
|
||||
/**
|
||||
* Name of the invalid class
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $stationtypeName;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Construct a new exception.
|
||||
*
|
||||
* @param string $stationtypeName Name of the invalid StationtypeController
|
||||
* @param string $message Error message
|
||||
* @param int $code Error code
|
||||
*/
|
||||
function __construct($stationtypeName, $message=self::MESSAGE, $code=self::CODE)
|
||||
{
|
||||
parent::__construct(
|
||||
$message,
|
||||
$code,
|
||||
$stationtypeName
|
||||
);
|
||||
|
||||
// Store value
|
||||
$this->stationtypeName = $stationtypeName;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Get the name of the invalid StationtypeController.
|
||||
*
|
||||
* @return string Name of the invalid StationtypeController
|
||||
*/
|
||||
public function getClassName()
|
||||
{
|
||||
return $this->stationtypeName;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
79
app/exceptions/StationtypeModelNotFoundException.inc
Normal file
79
app/exceptions/StationtypeModelNotFoundException.inc
Normal file
|
@ -0,0 +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: StationtypeModel not found.
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
*/
|
||||
class StationtypeModelNotFoundException extends \nre\core\Exception
|
||||
{
|
||||
/**
|
||||
* Error code
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
const CODE = 405;
|
||||
/**
|
||||
* Error message
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
const MESSAGE = 'StationtypeModel not found';
|
||||
|
||||
/**
|
||||
* Name of the class that was not found
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $stationtypeName;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Construct a new exception.
|
||||
*
|
||||
* @param string $stationtypeName Name of the StationtypeModel that was not found
|
||||
* @param string $message Error message
|
||||
* @param int $code Error code
|
||||
*/
|
||||
function __construct($stationtypeName, $message=self::MESSAGE, $code=self::CODE)
|
||||
{
|
||||
parent::__construct(
|
||||
$message,
|
||||
$code,
|
||||
$stationtypeName
|
||||
);
|
||||
|
||||
// Store values
|
||||
$this->stationtypeName = $stationtypeName;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Get the name of the StationtypeModel that was not found.
|
||||
*
|
||||
* @return string Name of the StationtypeModel that was not found
|
||||
*/
|
||||
public function getClassName()
|
||||
{
|
||||
return $this->stationtypeName;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
79
app/exceptions/StationtypeModelNotValidException.inc
Normal file
79
app/exceptions/StationtypeModelNotValidException.inc
Normal file
|
@ -0,0 +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: StationxuesttypeModel not valid.
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
*/
|
||||
class StationtypeModelNotValidException extends \nre\core\Exception
|
||||
{
|
||||
/**
|
||||
* Error code
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
const CODE = 406;
|
||||
/**
|
||||
* Error message
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
const MESSAGE = 'StationtypeModel not valid';
|
||||
|
||||
/**
|
||||
* Name of the invalid class
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $stationtypeName;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Construct a new exception.
|
||||
*
|
||||
* @param string $stationtypeName Name of the invalid StationtypeModel
|
||||
* @param string $message Error message
|
||||
* @param int $code Error code
|
||||
*/
|
||||
function __construct($stationtypeName, $message=self::MESSAGE, $code=self::CODE)
|
||||
{
|
||||
parent::__construct(
|
||||
$message,
|
||||
$code,
|
||||
$stationtypeName
|
||||
);
|
||||
|
||||
// Store value
|
||||
$this->stationtypeName = $stationtypeName;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Get the name of the invalid StationtypeModel.
|
||||
*
|
||||
* @return string Name of the invalid StationtypeModel
|
||||
*/
|
||||
public function getClassName()
|
||||
{
|
||||
return $this->stationtypeName;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
33
app/lib/Phpqrcode-lib.inc
Normal file
33
app/lib/Phpqrcode-lib.inc
Normal file
|
@ -0,0 +1,33 @@
|
|||
<?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\lib;
|
||||
|
||||
|
||||
/**
|
||||
* Class to ensure that Compatibility library below is loaded.
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
*/
|
||||
class Phpqrcode
|
||||
{
|
||||
|
||||
/**
|
||||
* Call this function to load necessary files.
|
||||
*/
|
||||
public static function load()
|
||||
{
|
||||
require_once('phpqrcode'.DS.'qrlib.php');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
3346
app/lib/Phpqrcode.inc
Normal file
3346
app/lib/Phpqrcode.inc
Normal file
File diff suppressed because it is too large
Load diff
38
app/lib/phpqrcode/CHANGELOG
Normal file
38
app/lib/phpqrcode/CHANGELOG
Normal file
|
@ -0,0 +1,38 @@
|
|||
* 1.0.0 build 2010031920
|
||||
|
||||
- first public release
|
||||
- help in readme, install
|
||||
- cleanup ans separation of QRtools and QRspec
|
||||
- now TCPDF binding requires minimal changes in TCPDF, having most of job
|
||||
done in QRtools tcpdfBarcodeArray
|
||||
- nicer QRtools::timeBenchmark output
|
||||
- license and copyright notices in files
|
||||
- indent cleanup - from tab to 4spc, keep it that way please :)
|
||||
- sf project, repository, wiki
|
||||
- simple code generator in index.php
|
||||
|
||||
* 1.1.0 build 2010032113
|
||||
|
||||
- added merge tool wich generate merged version of code
|
||||
located in phpqrcode.php
|
||||
- splited qrconst.php from qrlib.php
|
||||
|
||||
* 1.1.1 build 2010032405
|
||||
|
||||
- patch by Rick Seymour allowing saving PNG and displaying it at the same time
|
||||
- added version info in VERSION file
|
||||
- modified merge tool to include version info into generated file
|
||||
- fixed e-mail in almost all head comments
|
||||
|
||||
* 1.1.2 build 2010032722
|
||||
|
||||
- full integration with TCPDF thanks to Nicola Asuni, it's author
|
||||
- fixed bug with alphanumeric encoding detection
|
||||
|
||||
* 1.1.3 build 2010081807
|
||||
|
||||
- short opening tags replaced with standard ones
|
||||
|
||||
* 1.1.4 build 2010100721
|
||||
|
||||
- added missing static keyword QRinput::check (found by Luke Brookhart, Onjax LLC)
|
67
app/lib/phpqrcode/INSTALL
Normal file
67
app/lib/phpqrcode/INSTALL
Normal file
|
@ -0,0 +1,67 @@
|
|||
== REQUIREMENTS ==
|
||||
|
||||
* PHP5
|
||||
* PHP GD2 extension with JPEG and PNG support
|
||||
|
||||
== INSTALLATION ==
|
||||
|
||||
If you want to recreate cache by yourself make sure cache directory is
|
||||
writable and you have permisions to write into it. Also make sure you are
|
||||
able to read files in it if you have cache option enabled
|
||||
|
||||
== CONFIGURATION ==
|
||||
|
||||
Feel free to modify config constants in qrconfig.php file. Read about it in
|
||||
provided comments and project wiki page (links in README file)
|
||||
|
||||
== QUICK START ==
|
||||
|
||||
Notice: probably you should'nt use all of this in same script :)
|
||||
|
||||
<?phpb
|
||||
|
||||
//include only that one, rest required files will be included from it
|
||||
include "qrlib.php"
|
||||
|
||||
//write code into file, Error corection lecer is lowest, L (one form: L,M,Q,H)
|
||||
//each code square will be 4x4 pixels (4x zoom)
|
||||
//code will have 2 code squares white boundary around
|
||||
|
||||
QRcode::png('PHP QR Code :)', 'test.png', 'L', 4, 2);
|
||||
|
||||
//same as above but outputs file directly into browser (with appr. header etc.)
|
||||
//all other settings are default
|
||||
//WARNING! it should be FIRST and ONLY output generated by script, otherwise
|
||||
//rest of output will land inside PNG binary, breaking it for sure
|
||||
QRcode::png('PHP QR Code :)');
|
||||
|
||||
//show benchmark
|
||||
QRtools::timeBenchmark();
|
||||
|
||||
//rebuild cache
|
||||
QRtools::buildCache();
|
||||
|
||||
//code generated in text mode - as a binary table
|
||||
//then displayed out as HTML using Unicode block building chars :)
|
||||
$tab = $qr->encode('PHP QR Code :)');
|
||||
QRspec::debug($tab, true);
|
||||
|
||||
== TCPDF INTEGRATION ==
|
||||
|
||||
Inside bindings/tcpdf you will find slightly modified 2dbarcodes.php.
|
||||
Instal phpqrcode liblaty inside tcpdf folder, then overwrite (or merge)
|
||||
2dbarcodes.php
|
||||
|
||||
Then use similar as example #50 from TCPDF examples:
|
||||
|
||||
<?php
|
||||
|
||||
$style = array(
|
||||
'border' => true,
|
||||
'padding' => 4,
|
||||
'fgcolor' => array(0,0,0),
|
||||
'bgcolor' => false, //array(255,255,255)
|
||||
);
|
||||
|
||||
//code name: QR, specify error correction level after semicolon (L,M,Q,H)
|
||||
$pdf->write2DBarcode('PHP QR Code :)', 'QR,L', '', '', 30, 30, $style, 'N');
|
165
app/lib/phpqrcode/LICENSE
Normal file
165
app/lib/phpqrcode/LICENSE
Normal file
|
@ -0,0 +1,165 @@
|
|||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
|
||||
This version of the GNU Lesser General Public License incorporates
|
||||
the terms and conditions of version 3 of the GNU General Public
|
||||
License, supplemented by the additional permissions listed below.
|
||||
|
||||
0. Additional Definitions.
|
||||
|
||||
As used herein, "this License" refers to version 3 of the GNU Lesser
|
||||
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
||||
General Public License.
|
||||
|
||||
"The Library" refers to a covered work governed by this License,
|
||||
other than an Application or a Combined Work as defined below.
|
||||
|
||||
An "Application" is any work that makes use of an interface provided
|
||||
by the Library, but which is not otherwise based on the Library.
|
||||
Defining a subclass of a class defined by the Library is deemed a mode
|
||||
of using an interface provided by the Library.
|
||||
|
||||
A "Combined Work" is a work produced by combining or linking an
|
||||
Application with the Library. The particular version of the Library
|
||||
with which the Combined Work was made is also called the "Linked
|
||||
Version".
|
||||
|
||||
The "Minimal Corresponding Source" for a Combined Work means the
|
||||
Corresponding Source for the Combined Work, excluding any source code
|
||||
for portions of the Combined Work that, considered in isolation, are
|
||||
based on the Application, and not on the Linked Version.
|
||||
|
||||
The "Corresponding Application Code" for a Combined Work means the
|
||||
object code and/or source code for the Application, including any data
|
||||
and utility programs needed for reproducing the Combined Work from the
|
||||
Application, but excluding the System Libraries of the Combined Work.
|
||||
|
||||
1. Exception to Section 3 of the GNU GPL.
|
||||
|
||||
You may convey a covered work under sections 3 and 4 of this License
|
||||
without being bound by section 3 of the GNU GPL.
|
||||
|
||||
2. Conveying Modified Versions.
|
||||
|
||||
If you modify a copy of the Library, and, in your modifications, a
|
||||
facility refers to a function or data to be supplied by an Application
|
||||
that uses the facility (other than as an argument passed when the
|
||||
facility is invoked), then you may convey a copy of the modified
|
||||
version:
|
||||
|
||||
a) under this License, provided that you make a good faith effort to
|
||||
ensure that, in the event an Application does not supply the
|
||||
function or data, the facility still operates, and performs
|
||||
whatever part of its purpose remains meaningful, or
|
||||
|
||||
b) under the GNU GPL, with none of the additional permissions of
|
||||
this License applicable to that copy.
|
||||
|
||||
3. Object Code Incorporating Material from Library Header Files.
|
||||
|
||||
The object code form of an Application may incorporate material from
|
||||
a header file that is part of the Library. You may convey such object
|
||||
code under terms of your choice, provided that, if the incorporated
|
||||
material is not limited to numerical parameters, data structure
|
||||
layouts and accessors, or small macros, inline functions and templates
|
||||
(ten or fewer lines in length), you do both of the following:
|
||||
|
||||
a) Give prominent notice with each copy of the object code that the
|
||||
Library is used in it and that the Library and its use are
|
||||
covered by this License.
|
||||
|
||||
b) Accompany the object code with a copy of the GNU GPL and this license
|
||||
document.
|
||||
|
||||
4. Combined Works.
|
||||
|
||||
You may convey a Combined Work under terms of your choice that,
|
||||
taken together, effectively do not restrict modification of the
|
||||
portions of the Library contained in the Combined Work and reverse
|
||||
engineering for debugging such modifications, if you also do each of
|
||||
the following:
|
||||
|
||||
a) Give prominent notice with each copy of the Combined Work that
|
||||
the Library is used in it and that the Library and its use are
|
||||
covered by this License.
|
||||
|
||||
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
||||
document.
|
||||
|
||||
c) For a Combined Work that displays copyright notices during
|
||||
execution, include the copyright notice for the Library among
|
||||
these notices, as well as a reference directing the user to the
|
||||
copies of the GNU GPL and this license document.
|
||||
|
||||
d) Do one of the following:
|
||||
|
||||
0) Convey the Minimal Corresponding Source under the terms of this
|
||||
License, and the Corresponding Application Code in a form
|
||||
suitable for, and under terms that permit, the user to
|
||||
recombine or relink the Application with a modified version of
|
||||
the Linked Version to produce a modified Combined Work, in the
|
||||
manner specified by section 6 of the GNU GPL for conveying
|
||||
Corresponding Source.
|
||||
|
||||
1) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (a) uses at run time
|
||||
a copy of the Library already present on the user's computer
|
||||
system, and (b) will operate properly with a modified version
|
||||
of the Library that is interface-compatible with the Linked
|
||||
Version.
|
||||
|
||||
e) Provide Installation Information, but only if you would otherwise
|
||||
be required to provide such information under section 6 of the
|
||||
GNU GPL, and only to the extent that such information is
|
||||
necessary to install and execute a modified version of the
|
||||
Combined Work produced by recombining or relinking the
|
||||
Application with a modified version of the Linked Version. (If
|
||||
you use option 4d0, the Installation Information must accompany
|
||||
the Minimal Corresponding Source and Corresponding Application
|
||||
Code. If you use option 4d1, you must provide the Installation
|
||||
Information in the manner specified by section 6 of the GNU GPL
|
||||
for conveying Corresponding Source.)
|
||||
|
||||
5. Combined Libraries.
|
||||
|