Compare commits
247 commits
questtypes
...
master
Author | SHA1 | Date | |
---|---|---|---|
1bd4541faa | |||
0a33e29e4f | |||
81e5b72f3d | |||
|
e62ca15a66 | ||
|
9e5f595d5a | ||
|
6c8abc3033 | ||
|
c2aefefb7f | ||
|
e97123bc24 | ||
|
f8c5e2376a | ||
|
0f658ad96a | ||
|
dac75a7199 | ||
|
b925064d46 | ||
|
565a82326c | ||
|
a36437e572 | ||
|
8353cfc7d9 | ||
|
16e5957854 | ||
|
63af0d0afa | ||
|
7085de8fe2 | ||
|
7b44e19569 | ||
|
e50c2bb5e6 | ||
|
74e7ff5ac6 | ||
|
794462e3e9 | ||
|
f4980652c2 | ||
|
2b801227af | ||
|
48c1f1c730 | ||
|
d8845371e6 | ||
|
9c9efafc65 | ||
|
b8de91c048 | ||
|
d885a4baa9 | ||
|
296343bf3b | ||
|
9c0b0d8d07 | ||
|
412326f69a | ||
|
814b88c787 | ||
|
1925547cf4 | ||
|
7f97d4fb2d | ||
|
59a3cba90e | ||
|
14e0e71011 | ||
|
4df159ba7e | ||
|
df14dfafc3 | ||
|
53fda5caaf | ||
|
67f92d6174 | ||
|
4e7fdd973e | ||
|
699d1aaa84 | ||
|
74b093a61f | ||
|
f876913ced | ||
|
bd29bcdd7c | ||
|
0ca2e3131f | ||
|
e5158e33d9 | ||
|
13ce3f3281 | ||
|
7061a98f5b | ||
|
d3fae2e551 | ||
|
0729c79a7d | ||
|
f886d4139d | ||
|
eddc4036cf | ||
|
40d2aa5768 | ||
|
88954cd31e | ||
|
14b09065a2 | ||
|
ac0e5a32cb | ||
|
92ce598ad1 | ||
|
4aa2a379b0 | ||
|
320a583753 | ||
|
f70587db46 | ||
|
4f544d5255 | ||
|
28c914a926 | ||
|
3939def456 | ||
|
cff72efcb4 | ||
|
e597142266 | ||
|
42e9b518d9 | ||
|
bdfd021673 | ||
|
dd2b15bbd7 | ||
|
7c2b3111c2 | ||
|
e4f98c29d1 | ||
|
73c378d9f3 | ||
|
bf0d324655 | ||
|
60036ea794 | ||
|
2c21c628ae | ||
|
cc3ad1be53 | ||
|
b6b2d40bd0 | ||
|
676c2386fd | ||
|
d1faa5b4b1 | ||
|
178361ef94 | ||
|
0cfdaf8f49 | ||
|
e4b7980500 | ||
|
b511a960c8 | ||
|
54ed53ac33 | ||
|
060282e9c0 | ||
|
6e1d1ede2a | ||
|
55dd05df3b | ||
|
da9095b89d | ||
|
ef05402b16 | ||
|
ec7787c3e0 | ||
|
f53980f057 | ||
|
3fe164209b | ||
|
a4f443d87a | ||
|
880b91d5e6 | ||
|
16f85f1006 | ||
|
14ea890c8b | ||
|
6f76c2a3dd | ||
|
f630b50027 | ||
|
011bae5cd8 | ||
|
4f0c7e2fa8 | ||
|
1b19187587 | ||
|
2e6315134f | ||
|
dce9963bdf | ||
|
dff5616da1 | ||
|
76ba31c04e | ||
|
f0ea809813 | ||
|
03cc6a475b | ||
|
e3b1fa85b5 | ||
|
877fe86f30 | ||
|
87d70f70e2 | ||
|
2904549a65 | ||
|
cf21b6c1a0 | ||
|
813152b091 | ||
|
9f8d9fa05c | ||
|
56627a5c1f | ||
|
d84789dce7 | ||
|
40a233fa7d | ||
|
ba97244b15 | ||
|
5614b6c089 | ||
|
efd304833c | ||
|
2d65b2e4b0 | ||
|
d5c68803f0 | ||
|
538e1aa8b0 | ||
|
a27352cb66 | ||
|
476c18b6a9 | ||
|
f91a24c46d | ||
|
457a382317 | ||
|
a1e46ff2aa | ||
|
112c7d0b4f | ||
|
b7ce9f09cd | ||
|
33e1c4d8b5 | ||
|
e03dea0d80 | ||
|
5f25a0a383 | ||
|
939cf7b08e | ||
|
c424cfe30c | ||
|
a31252d81b | ||
|
d7095c005a | ||
|
f779b22574 | ||
|
f31032cbb2 | ||
|
cb2865c1d5 | ||
|
08f83280f7 | ||
|
ea0a283358 | ||
|
54e36ff95c | ||
|
a57be75415 | ||
|
26c6625d72 | ||
|
267029f17d | ||
|
8c5c7e0b13 | ||
|
02e7665fb7 | ||
|
d990e08f49 | ||
|
5b68bab5d5 | ||
|
676137b956 | ||
|
88f94709d1 | ||
|
a95a948841 | ||
|
11261f0fe6 | ||
|
96ea420e7f | ||
|
f19a337efa | ||
|
331cb22caf | ||
|
48e0445acd | ||
|
5cd31ca82d | ||
|
21444a6047 | ||
|
443ddc343a | ||
|
ca6af3fe92 | ||
|
fc587be483 | ||
|
136afff5f1 | ||
|
6f3a8339f8 | ||
|
3ee63b6782 | ||
|
7cf35471aa | ||
|
b854554ed0 | ||
|
5cb60679e0 | ||
|
41f3ee0349 | ||
|
7ba9e2309f | ||
|
3557ab7e33 | ||
|
f947a7a4df | ||
|
63a17ffc67 | ||
|
a328e71613 | ||
|
94d1821f79 | ||
|
60b7f12f79 | ||
|
4dca3e8089 | ||
|
00fe33323f | ||
|
d3e54c31c0 | ||
|
4beeac80ac | ||
|
ca03de048e | ||
|
2e6aa4f6e9 | ||
|
cdc2d2aee4 | ||
|
a55b1bc887 | ||
|
d94d2270b9 | ||
|
7e7f9edff3 | ||
|
b11436b913 | ||
|
0e618b929d | ||
|
87baf8f052 | ||
|
9a072b39c3 | ||
|
5d4e50318f | ||
|
db60917439 | ||
|
a8c97c6d8b | ||
|
cf18f8b90c | ||
|
4f88edb9f2 | ||
|
8505c7b0cd | ||
|
6112da1571 | ||
|
7b27458321 | ||
|
9c3369b324 | ||
|
47331d8181 | ||
|
4fa73890d2 | ||
|
9a02dec0cd | ||
|
daf63951e0 | ||
|
1e5602fc4c | ||
|
85dc2f87ec | ||
|
324bc2fc19 | ||
|
46722d0534 | ||
|
bad67efeb9 | ||
|
bcd5a6b8da | ||
|
7d1cd83e3a | ||
|
36cb0180cf | ||
|
1f1d91850e | ||
|
d561cc78ed | ||
|
77f846c92b | ||
|
1ce1c18590 | ||
|
a796249867 | ||
|
655de39c6b | ||
|
68513e0a0a | ||
|
003bab0890 | ||
|
a4487a1028 | ||
|
a93ccec024 | ||
|
1c48c6d10a | ||
|
b8d4342926 | ||
|
bf679e9dec | ||
|
2c0f540f90 | ||
|
4ee829ca3e | ||
|
fa8b0cadcd | ||
|
32af66a3e7 | ||
|
6a5f3739cc | ||
|
200b1fe937 | ||
|
d746b62308 | ||
|
12ae8b180e | ||
|
fdb115083e | ||
|
0a45d90ba1 | ||
|
d9d85e2306 | ||
|
cc4bcac7f8 | ||
|
8508390c27 | ||
|
996a501f4f | ||
|
53d684d151 | ||
|
961c869c30 | ||
|
604e7c9bba | ||
|
23346a78b5 | ||
|
1779c38218 | ||
|
7348ca080c | ||
|
b392eb9188 |
6886 changed files with 463681 additions and 802960 deletions
9
.gitignore
vendored
Normal file
9
.gitignore
vendored
Normal file
|
@ -0,0 +1,9 @@
|
|||
/doc/
|
||||
/logs/
|
||||
/media/
|
||||
/tmp/
|
||||
/uploads/
|
||||
/seminarymedia/
|
||||
/seminaryuploads/
|
||||
/www/analytics/tmp/
|
||||
/app/lib/phpqrcode/cache/
|
|
@ -1,9 +0,0 @@
|
|||
syntax: regexp
|
||||
^logs/*
|
||||
^media/*
|
||||
^tmp/*
|
||||
^uploads/*
|
||||
^seminarymedia/*
|
||||
^seminaryuploads/*
|
||||
^www/analytics/config/config.ini.php*
|
||||
^www/analytics/temp/*
|
|
@ -4,6 +4,8 @@ ErrorDocument 403 /www/error403.html
|
|||
ErrorDocument 404 /www/error404.html
|
||||
ErrorDocument 500 /www/error500.html
|
||||
|
||||
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css application/javascript text/javascript
|
||||
|
||||
|
||||
|
||||
<IfModule mod_authz_core.c>
|
||||
|
|
13
README.md
Normal file
13
README.md
Normal file
|
@ -0,0 +1,13 @@
|
|||
# Questlab
|
||||
|
||||
Questlab is a web application that allows anyone to rework learning content in a game-based manner. For this purpose the application provides a set of game elements and game mechanics which can be configured to be suitable for a specific content. Thus an interactive learning environment will be created which engages the user’s intrinsic motivation.
|
||||
|
||||
The project was founded in 2013, supported by the promotion fund of the [Heinrich-Heine University Düsseldorf](https://www.uni-duesseldorf.de) (Germany), under the name <i>Die Legende von Zyren</i> (eng: <i>The Legend of Zyren</i>). The goal was to impart the learning content of the course <i>Wissensrepräsentation</i> (eng: <i>Knowledge Representation</i>) with game elements and game models to the students of Information Science. This innovative learning environment consisted of a virtual text-based adventure which was accessible via a web-based platform and non-virtual games in class in which the students dived into the adventure and competed in teams against each other.
|
||||
|
||||
To generalise the concept and to make it available to other faculties and courses, the project <i>Questlab</i> (working title: <i>The Legendof Z</i>) was started in 2014. Teachers are able to use the application to create their own tasks (Quests) and to embed these into a story designed by them. Furthermore, a Responsive Design has been added and provides best access from all mobile devices.
|
||||
|
||||
## Team
|
||||
|
||||
* Kathrin Knautz (project management)
|
||||
* Oliver Hanraths (implementation)
|
||||
* Daniel Miskovic (user interface)
|
|
@ -1,12 +1,12 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
* Questlab
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @copyright 2014 – 2016 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
* @link https://github.com/coderkun/questlab
|
||||
*/
|
||||
|
||||
namespace hhu\z\agents\bottomlevel;
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
* Questlab
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @copyright 2014 – 2016 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
* @link https://github.com/coderkun/questlab
|
||||
*/
|
||||
|
||||
namespace hhu\z\agents\bottomlevel;
|
||||
|
|
38
agents/bottomlevel/MoodpicAgent.inc
Normal file
38
agents/bottomlevel/MoodpicAgent.inc
Normal file
|
@ -0,0 +1,38 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Questlab
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 – 2016 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://github.com/coderkun/questlab
|
||||
*/
|
||||
|
||||
namespace hhu\z\agents\bottomlevel;
|
||||
|
||||
|
||||
/**
|
||||
* Agent to display a Moodpic.
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
*/
|
||||
class MoodpicAgent 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,12 +1,12 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
* Questlab
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @copyright 2014 – 2016 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
* @link https://github.com/coderkun/questlab
|
||||
*/
|
||||
|
||||
namespace hhu\z\agents\bottomlevel;
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
* Questlab
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @copyright 2014 – 2016 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
* @link https://github.com/coderkun/questlab
|
||||
*/
|
||||
|
||||
namespace hhu\z\agents\bottomlevel;
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
* Questlab
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @copyright 2014 – 2016 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
* @link https://github.com/coderkun/questlab
|
||||
*/
|
||||
|
||||
namespace hhu\z\agents\bottomlevel;
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
* Questlab
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @copyright 2014 – 2016 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
* @link https://github.com/coderkun/questlab
|
||||
*/
|
||||
|
||||
namespace hhu\z\agents\bottomlevel;
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
* Questlab
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @copyright 2014 – 2016 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
* @link https://github.com/coderkun/questlab
|
||||
*/
|
||||
|
||||
namespace hhu\z\agents\intermediate;
|
||||
|
@ -31,6 +31,73 @@
|
|||
*/
|
||||
public function index(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
// Add Moodpic
|
||||
$this->addSubAgent('Moodpic', 'seminary', $request->getParam(3), $request->getParam(1));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 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), $request->getParam(1));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 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), $request->getParam(1));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Action: manage.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
public function manage(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
// Add Moodpic
|
||||
$this->addSubAgent('Moodpic', 'seminary', $request->getParam(3), $request->getParam(1));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Action: conditions.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
public function conditions(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
// Add Moodpic
|
||||
$this->addSubAgent('Moodpic', 'seminary', $request->getParam(3));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 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), $request->getParam(1));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
* Questlab
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @copyright 2014 – 2016 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
* @link https://github.com/coderkun/questlab
|
||||
*/
|
||||
|
||||
namespace hhu\z\agents\intermediate;
|
||||
|
@ -14,7 +14,7 @@
|
|||
|
||||
/**
|
||||
* Agent to display Character groups.
|
||||
*
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
*/
|
||||
class CharactergroupsAgent extends \nre\agents\IntermediateAgent
|
||||
|
@ -25,12 +25,131 @@
|
|||
|
||||
/**
|
||||
* 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 Moodpic
|
||||
$this->addSubAgent('Moodpic', 'seminary', $request->getParam(3), $request->getParam(1));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Action: groupsgroup.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
public function groupsgroup(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
// Add Moodpic
|
||||
$this->addSubAgent('Moodpic', 'seminary', $request->getParam(3), $request->getParam(1));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Action: creategroupsgroups.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
public function creategroupsgroup(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
// Add Moodpic
|
||||
$this->addSubAgent('Moodpic', 'seminary', $request->getParam(3), $request->getParam(1));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Action: editgroupsgroup.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
public function editgroupsgroup(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
// Add Moodpic
|
||||
$this->addSubAgent('Moodpic', 'seminary', $request->getParam(3), $request->getParam(1));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Action: deletegroupsgroup.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
public function deletegroupsgroup(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
// Add Moodpic
|
||||
$this->addSubAgent('Moodpic', 'seminary', $request->getParam(3), $request->getParam(1));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Action: group.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
public function group(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
// Add Moodpic
|
||||
$this->addSubAgent('Moodpic', 'seminary', $request->getParam(3), $request->getParam(1));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Action: creategroup.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
public function creategroup(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
// Add Moodpic
|
||||
$this->addSubAgent('Moodpic', 'seminary', $request->getParam(3), $request->getParam(1));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Action: managegroup.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
public function managegroup(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
// Add Moodpic
|
||||
$this->addSubAgent('Moodpic', 'seminary', $request->getParam(3), $request->getParam(1));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Action: editgroup.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
public function editgroup(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
// Add Moodpic
|
||||
$this->addSubAgent('Moodpic', 'seminary', $request->getParam(3), $request->getParam(1));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Action: deletegroup.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
public function deletegroup(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
// Add Moodpic
|
||||
$this->addSubAgent('Moodpic', 'seminary', $request->getParam(3), $request->getParam(1));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
92
agents/intermediate/CharactergroupsachievementsAgent.inc
Normal file
92
agents/intermediate/CharactergroupsachievementsAgent.inc
Normal file
|
@ -0,0 +1,92 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Questlab
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 – 2016 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://github.com/coderkun/questlab
|
||||
*/
|
||||
|
||||
namespace hhu\z\agents\intermediate;
|
||||
|
||||
|
||||
/**
|
||||
* Agent to list Charactergroups Achievements.
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
*/
|
||||
class CharactergroupsachievementsAgent extends \nre\agents\IntermediateAgent
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Action: achievement.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
public function achievement(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
// Add Moodpic
|
||||
$this->addSubAgent('Moodpic', 'seminary', $request->getParam(3), $request->getParam(1));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 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), $request->getParam(1));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 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), $request->getParam(1));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Action: manage.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
public function manage(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
// Add Moodpic
|
||||
$this->addSubAgent('Moodpic', 'seminary', $request->getParam(3), $request->getParam(1));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 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), $request->getParam(1));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,12 +1,12 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
* Questlab
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @copyright 2014 – 2016 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
* @link https://github.com/coderkun/questlab
|
||||
*/
|
||||
|
||||
namespace hhu\z\agents\intermediate;
|
||||
|
@ -31,6 +31,73 @@
|
|||
*/
|
||||
public function index(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
// Add Moodpic
|
||||
$this->addSubAgent('Moodpic', 'seminary', $request->getParam(3), 'charactergroups');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 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)
|
||||
{
|
||||
// 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: manage.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
public function manage(\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: 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');
|
||||
}
|
||||
|
||||
}
|
||||
|
|
103
agents/intermediate/CharactergroupsqueststationsAgent.inc
Normal file
103
agents/intermediate/CharactergroupsqueststationsAgent.inc
Normal file
|
@ -0,0 +1,103 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Questlab
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 – 2016 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://github.com/coderkun/questlab
|
||||
*/
|
||||
|
||||
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');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,12 +1,12 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
* Questlab
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @copyright 2014 – 2016 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
* @link https://github.com/coderkun/questlab
|
||||
*/
|
||||
|
||||
namespace hhu\z\agents\intermediate;
|
||||
|
@ -31,6 +31,8 @@
|
|||
*/
|
||||
public function index(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
// Add Moodpic
|
||||
$this->addSubAgent('Moodpic', 'seminary', $request->getParam(3));
|
||||
}
|
||||
|
||||
|
||||
|
@ -42,6 +44,60 @@
|
|||
*/
|
||||
public function character(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
// Add Moodpic
|
||||
$this->addSubAgent('Moodpic', 'seminary', $request->getParam(3));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Action: register.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
public function register(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
// Add Moodpic
|
||||
$this->addSubAgent('Moodpic', 'seminary', $request->getParam(3));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Action: manage.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
public function manage(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
// Add Moodpic
|
||||
$this->addSubAgent('Moodpic', 'seminary', $request->getParam(3));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 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));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 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));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
79
agents/intermediate/CharactertitlesAgent.inc
Normal file
79
agents/intermediate/CharactertitlesAgent.inc
Normal file
|
@ -0,0 +1,79 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Questlab
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 – 2016 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://github.com/coderkun/questlab
|
||||
*/
|
||||
|
||||
namespace hhu\z\agents\intermediate;
|
||||
|
||||
|
||||
/**
|
||||
* Agent to handle Character titles of a Seminary.
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
*/
|
||||
class CharactertitlesAgent 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)
|
||||
{
|
||||
// Add Moodpic
|
||||
$this->addSubAgent('Moodpic', 'seminary', $request->getParam(3), $request->getParam(1));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 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), $request->getParam(1));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 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), $request->getParam(1));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 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), $request->getParam(1));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,12 +1,12 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
* Questlab
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @copyright 2014 – 2016 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
* @link https://github.com/coderkun/questlab
|
||||
*/
|
||||
|
||||
namespace hhu\z\agents\intermediate;
|
||||
|
@ -31,6 +31,47 @@
|
|||
*/
|
||||
public function index(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
// Add Moodpic
|
||||
$this->addSubAgent('Moodpic', 'seminary', $request->getParam(3), $request->getParam(1));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 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), $request->getParam(1));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 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), $request->getParam(1));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 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), $request->getParam(1));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
* Questlab
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @copyright 2014 – 2016 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
* @link https://github.com/coderkun/questlab
|
||||
*/
|
||||
|
||||
namespace hhu\z\agents\intermediate;
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
* Questlab
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @copyright 2014 – 2016 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
* @link https://github.com/coderkun/questlab
|
||||
*/
|
||||
|
||||
namespace hhu\z\agents\intermediate;
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
* Questlab
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @copyright 2014 – 2016 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
* @link https://github.com/coderkun/questlab
|
||||
*/
|
||||
|
||||
namespace hhu\z\agents\intermediate;
|
||||
|
@ -31,6 +31,73 @@
|
|||
*/
|
||||
public function index(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
// Add Moodpic
|
||||
$this->addSubAgent('Moodpic', 'seminary', $request->getParam(3), $request->getParam(1));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 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), $request->getParam(1));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Action: topic.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
public function topic(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
// Add Moodpic
|
||||
$this->addSubAgent('Moodpic', 'seminary', $request->getParam(3), $request->getParam(1));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Action: manage.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
public function manage(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
// Add Moodpic
|
||||
$this->addSubAgent('Moodpic', 'seminary', $request->getParam(3), $request->getParam(1));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 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), $request->getParam(1));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 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), $request->getParam(1));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
* Questlab
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @copyright 2014 – 2016 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
* @link https://github.com/coderkun/questlab
|
||||
*/
|
||||
|
||||
namespace hhu\z\agents\intermediate;
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
* Questlab
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @copyright 2014 – 2016 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
* @link https://github.com/coderkun/questlab
|
||||
*/
|
||||
|
||||
namespace hhu\z\agents\intermediate;
|
||||
|
@ -31,6 +31,21 @@
|
|||
*/
|
||||
public function index(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
// Add Moodpic
|
||||
$this->addSubAgent('Moodpic', 'seminary', $request->getParam(3), $request->getParam(1));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 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), $request->getParam(1));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
* Questlab
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @copyright 2014 – 2016 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
* @link https://github.com/coderkun/questlab
|
||||
*/
|
||||
|
||||
namespace hhu\z\agents\intermediate;
|
||||
|
|
38
agents/intermediate/PagesAgent.inc
Normal file
38
agents/intermediate/PagesAgent.inc
Normal file
|
@ -0,0 +1,38 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Questlab
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 – 2016 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://github.com/coderkun/questlab
|
||||
*/
|
||||
|
||||
namespace hhu\z\agents\intermediate;
|
||||
|
||||
|
||||
/**
|
||||
* Agent to manage additional pages.
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
*/
|
||||
class PagesAgent 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/QrAgent.inc
Normal file
38
agents/intermediate/QrAgent.inc
Normal file
|
@ -0,0 +1,38 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Questlab
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 – 2016 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://github.com/coderkun/questlab
|
||||
*/
|
||||
|
||||
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
|
||||
|
||||
/**
|
||||
* Questlab
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 – 2016 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://github.com/coderkun/questlab
|
||||
*/
|
||||
|
||||
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)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,12 +1,12 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
* Questlab
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @copyright 2014 – 2016 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
* @link https://github.com/coderkun/questlab
|
||||
*/
|
||||
|
||||
namespace hhu\z\agents\intermediate;
|
||||
|
@ -31,10 +31,27 @@
|
|||
*/
|
||||
public function questgroup(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
// Add Moodpic
|
||||
$this->addSubAgent('Moodpic', 'questgroup', $request->getParam(3), $request->getParam(4));
|
||||
|
||||
// Add Questgroups hierarchy path
|
||||
$this->addSubAgent('Questgroupshierarchypath', 'index', $request->getParam(3), $request->getParam(4));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 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));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Action: edit.
|
||||
*
|
||||
|
@ -43,6 +60,10 @@
|
|||
*/
|
||||
public function edit(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
// Add Moodpic
|
||||
$this->addSubAgent('Moodpic', 'questgroup', $request->getParam(3), $request->getParam(4));
|
||||
|
||||
// Add Questgroups hierarchy path
|
||||
$this->addSubAgent('Questgroupshierarchypath', 'index', $request->getParam(3), $request->getParam(4));
|
||||
}
|
||||
|
||||
|
@ -55,6 +76,10 @@
|
|||
*/
|
||||
public function edittexts(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
// Add Moodpic
|
||||
$this->addSubAgent('Moodpic', 'questgroup', $request->getParam(3), $request->getParam(4));
|
||||
|
||||
// Add Questgroups hierarchy path
|
||||
$this->addSubAgent('Questgroupshierarchypath', 'index', $request->getParam(3), $request->getParam(4));
|
||||
}
|
||||
|
||||
|
@ -67,6 +92,10 @@
|
|||
*/
|
||||
public function moveup(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
// Add Moodpic
|
||||
$this->addSubAgent('Moodpic', 'questgroup', $request->getParam(3), $request->getParam(4));
|
||||
|
||||
// Add Questgroups hierarchy path
|
||||
$this->addSubAgent('Questgroupshierarchypath', 'index', $request->getParam(3), $request->getParam(4));
|
||||
}
|
||||
|
||||
|
@ -79,6 +108,10 @@
|
|||
*/
|
||||
public function movedown(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
// Add Moodpic
|
||||
$this->addSubAgent('Moodpic', 'questgroup', $request->getParam(3), $request->getParam(4));
|
||||
|
||||
// Add Questgroups hierarchy path
|
||||
$this->addSubAgent('Questgroupshierarchypath', 'index', $request->getParam(3), $request->getParam(4));
|
||||
}
|
||||
|
||||
|
@ -91,6 +124,10 @@
|
|||
*/
|
||||
public function delete(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
// Add Moodpic
|
||||
$this->addSubAgent('Moodpic', 'questgroup', $request->getParam(3), $request->getParam(4));
|
||||
|
||||
// Add Questgroups hierarchy path
|
||||
$this->addSubAgent('Questgroupshierarchypath', 'index', $request->getParam(3), $request->getParam(4));
|
||||
}
|
||||
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
* Questlab
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @copyright 2014 – 2016 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
* @link https://github.com/coderkun/questlab
|
||||
*/
|
||||
|
||||
namespace hhu\z\agents\intermediate;
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
* Questlab
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @copyright 2014 – 2016 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
* @link https://github.com/coderkun/questlab
|
||||
*/
|
||||
|
||||
namespace hhu\z\agents\intermediate;
|
||||
|
@ -23,6 +23,19 @@
|
|||
|
||||
|
||||
|
||||
/**
|
||||
* 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 Moodpic
|
||||
$this->addSubAgent('Moodpic', 'seminary', $request->getParam(3));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Action: quest.
|
||||
*
|
||||
|
@ -31,6 +44,10 @@
|
|||
*/
|
||||
public function quest(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
// Add Moodpic
|
||||
$this->addSubAgent('Moodpic', 'questgroup', $request->getParam(3), $request->getParam(4));
|
||||
|
||||
// Add Questgroups hierarchy path
|
||||
$this->addSubAgent('Questgroupshierarchypath', 'index', $request->getParam(3), $request->getParam(4), true);
|
||||
}
|
||||
|
||||
|
@ -43,6 +60,10 @@
|
|||
*/
|
||||
public function submissions(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
// Add Moodpic
|
||||
$this->addSubAgent('Moodpic', 'questgroup', $request->getParam(3), $request->getParam(4));
|
||||
|
||||
// Add Questgroups hierarchy path
|
||||
$this->addSubAgent('Questgroupshierarchypath', 'index', $request->getParam(3), $request->getParam(4), true);
|
||||
}
|
||||
|
||||
|
@ -55,6 +76,10 @@
|
|||
*/
|
||||
public function submission(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
// Add Moodpic
|
||||
$this->addSubAgent('Moodpic', 'questgroup', $request->getParam(3), $request->getParam(4));
|
||||
|
||||
// Add Questgroups hierarchy path
|
||||
$this->addSubAgent('Questgroupshierarchypath', 'index', $request->getParam(3), $request->getParam(4), true);
|
||||
}
|
||||
|
||||
|
@ -67,6 +92,10 @@
|
|||
*/
|
||||
public function create(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
// Add Moodpic
|
||||
$this->addSubAgent('Moodpic', 'questgroup', $request->getParam(3), $request->getParam(4));
|
||||
|
||||
// Add Questgroups hierarchy path
|
||||
$this->addSubAgent('Questgroupshierarchypath', 'index', $request->getParam(3), $request->getParam(4), true);
|
||||
}
|
||||
|
||||
|
@ -79,6 +108,10 @@
|
|||
*/
|
||||
public function edit(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
// Add Moodpic
|
||||
$this->addSubAgent('Moodpic', 'questgroup', $request->getParam(3), $request->getParam(4));
|
||||
|
||||
// Add Questgroups hierarchy path
|
||||
$this->addSubAgent('Questgroupshierarchypath', 'index', $request->getParam(3), $request->getParam(4), true);
|
||||
}
|
||||
|
||||
|
@ -91,6 +124,10 @@
|
|||
*/
|
||||
public function edittask(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
// Add Moodpic
|
||||
$this->addSubAgent('Moodpic', 'questgroup', $request->getParam(3), $request->getParam(4));
|
||||
|
||||
// Add Questgroups hierarchy path
|
||||
$this->addSubAgent('Questgroupshierarchypath', 'index', $request->getParam(3), $request->getParam(4), true);
|
||||
}
|
||||
|
||||
|
@ -103,6 +140,10 @@
|
|||
*/
|
||||
public function edittexts(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
// Add Moodpic
|
||||
$this->addSubAgent('Moodpic', 'questgroup', $request->getParam(3), $request->getParam(4));
|
||||
|
||||
// Add Questgroups hierarchy path
|
||||
$this->addSubAgent('Questgroupshierarchypath', 'index', $request->getParam(3), $request->getParam(4), true);
|
||||
}
|
||||
|
||||
|
@ -115,6 +156,10 @@
|
|||
*/
|
||||
public function delete(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
// Add Moodpic
|
||||
$this->addSubAgent('Moodpic', 'questgroup', $request->getParam(3), $request->getParam(4));
|
||||
|
||||
// Add Questgroups hierarchy path
|
||||
$this->addSubAgent('Questgroupshierarchypath', 'index', $request->getParam(3), $request->getParam(4), true);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
* Questlab
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @copyright 2014 – 2016 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
* @link https://github.com/coderkun/questlab
|
||||
*/
|
||||
|
||||
namespace hhu\z\agents\intermediate;
|
||||
|
@ -31,6 +31,73 @@
|
|||
*/
|
||||
public function index(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
// Add Moodpic
|
||||
$this->addSubAgent('Moodpic', 'index');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Action: seminary.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
public function seminary(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
// Add Moodpic
|
||||
$this->addSubAgent('Moodpic', 'seminary', $request->getParam(3));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 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', 'index');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 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), $request->getParam(1));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Action: copy.
|
||||
*
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param \nre\core\Response $response Current response
|
||||
*/
|
||||
public function copy(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
// Add Moodpic
|
||||
$this->addSubAgent('Moodpic', 'seminary', $request->getParam(3), $request->getParam(1));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 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), $request->getParam(1));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
* Questlab
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @copyright 2014 – 2016 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
* @link https://github.com/coderkun/questlab
|
||||
*/
|
||||
|
||||
namespace hhu\z\agents\intermediate;
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
* Questlab
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @copyright 2014 – 2016 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
* @link https://github.com/coderkun/questlab
|
||||
*/
|
||||
|
||||
namespace hhu\z\agents\intermediate;
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
* Questlab
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @copyright 2014 – 2016 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
* @link https://github.com/coderkun/questlab
|
||||
*/
|
||||
|
||||
namespace hhu\z\agents\intermediate;
|
||||
|
@ -29,8 +29,10 @@
|
|||
* @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)
|
||||
public function manage(\nre\core\Request $request, \nre\core\Response $response)
|
||||
{
|
||||
// Add Moodpic
|
||||
$this->addSubAgent('Moodpic', 'seminary', $request->getParam(3));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
* Questlab
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @copyright 2014 – 2016 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
* @link https://github.com/coderkun/questlab
|
||||
*/
|
||||
|
||||
namespace hhu\z\agents\toplevel;
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
* Questlab
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @copyright 2014 – 2016 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
* @link https://github.com/coderkun/questlab
|
||||
*/
|
||||
|
||||
namespace hhu\z\agents\toplevel;
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
* Questlab
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @copyright 2014 – 2016 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
* @link https://github.com/coderkun/questlab
|
||||
*/
|
||||
|
||||
namespace hhu\z\agents\toplevel;
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
* Questlab
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @copyright 2014 – 2016 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
* @link https://github.com/coderkun/questlab
|
||||
*/
|
||||
|
||||
namespace hhu\z\agents\toplevel;
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
* Questlab
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @copyright 2014 – 2016 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
* @link https://github.com/coderkun/questlab
|
||||
*/
|
||||
|
||||
namespace hhu\z\agents\toplevel;
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
* Questlab
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @copyright 2014 – 2016 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
* @link https://github.com/coderkun/questlab
|
||||
*/
|
||||
|
||||
namespace hhu\z\agents\toplevel;
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
* Questlab
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @copyright 2014 – 2016 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
* @link https://github.com/coderkun/questlab
|
||||
*/
|
||||
|
||||
namespace hhu\z;
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
* Questlab
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @copyright 2014 – 2016 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
* @link https://github.com/coderkun/questlab
|
||||
*/
|
||||
|
||||
namespace hhu\z;
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
* Questlab
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @copyright 2014 – 2016 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
* @link https://github.com/coderkun/questlab
|
||||
*/
|
||||
|
||||
namespace hhu\z;
|
||||
|
@ -59,15 +59,12 @@
|
|||
{
|
||||
// Use Textile
|
||||
\hhu\z\lib\Textile::load();
|
||||
$textileParser = new \Netcarver\Textile\Parser();
|
||||
$textileParser = new \Netcarver\Textile\Parser('html5');
|
||||
$string = $textileParser->textileThis($string);
|
||||
|
||||
// Add link targets
|
||||
$string = $this->tLinks($string);
|
||||
|
||||
// Handle custom formatting
|
||||
$string = $this->tCustom($string);
|
||||
|
||||
// Handle Seminarymedia
|
||||
$string = $this->tSeminarymedia($string);
|
||||
|
||||
|
@ -119,12 +116,15 @@
|
|||
return $string;
|
||||
}
|
||||
try {
|
||||
$dom = new \DOMDocument();
|
||||
$dom->loadHTML('<?xml encoding="UTF-8">'.$string);
|
||||
$dom = new \DOMDocument('1.0');
|
||||
$dom->loadHTML('<!DOCTYPE html><html><head><meta charset="utf-8" /></head><body>'.$string.'</body></html>');
|
||||
foreach($dom->getElementsByTagName('a') as $link) {
|
||||
$link->setAttribute('target', '_blank');
|
||||
}
|
||||
return $dom->saveHTML();
|
||||
$body = $dom->getElementsByTagName('body')->item(0);
|
||||
$string = $dom->saveHTML($body);
|
||||
|
||||
return trim(substr($string, 6, strlen($string) - 13));
|
||||
}
|
||||
catch(\Exception $e) {
|
||||
return $string;
|
||||
|
@ -132,39 +132,6 @@
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Handle custom formatting syntax.
|
||||
*
|
||||
* @Deprecated
|
||||
* @param string $string String to format
|
||||
* @return string Formatted string
|
||||
*/
|
||||
private function tCustom($string)
|
||||
{
|
||||
// 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);
|
||||
|
||||
|
||||
// Return new string
|
||||
return $string;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Handle including Seminarymedia.
|
||||
*
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
* Questlab
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @copyright 2014 – 2016 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
* @link https://github.com/coderkun/questlab
|
||||
*/
|
||||
|
||||
namespace hhu\z;
|
||||
|
@ -19,6 +19,14 @@
|
|||
*/
|
||||
class Utils
|
||||
{
|
||||
/**
|
||||
* String length for hashes
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
const HASH_LENGTH = 10;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
@ -209,6 +217,23 @@
|
|||
return $mimetype;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Create a random hash string.
|
||||
*
|
||||
* @param int Length of string
|
||||
* @return string String with random characters
|
||||
*/
|
||||
public static function createRandomHash($length=self::HASH_LENGTH)
|
||||
{
|
||||
// Length of URL
|
||||
$length = max(0, min(32, $length));
|
||||
|
||||
|
||||
// Create and return random string
|
||||
return substr(md5(microtime()), rand(0, 32-$length), $length);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
* Questlab
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @copyright 2014 – 2016 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
* @link https://github.com/coderkun/questlab
|
||||
*/
|
||||
|
||||
namespace hhu\z\agents;
|
||||
|
|
298
app/agents/StationtypeAgent.inc
Normal file
298
app/agents/StationtypeAgent.inc
Normal file
|
@ -0,0 +1,298 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Questlab
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 – 2016 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://github.com/coderkun/questlab
|
||||
*/
|
||||
|
||||
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 $groupsgroup Current Groups group data
|
||||
* @param array $quest Current Quest data
|
||||
* @param array $station Current Station data
|
||||
* @param array $group Current Character group data
|
||||
* @param array $answer Character group answer for the Station
|
||||
*/
|
||||
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 $groupsgroup Current Groups group data
|
||||
* @param array $quest Current Quest data
|
||||
* @param array $station Current Station data
|
||||
* @param array $group Current Character group data
|
||||
* @param array $answer Character group answer for the Station
|
||||
*/
|
||||
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
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,12 +1,12 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
* Questlab
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @copyright 2014 – 2016 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
* @link https://github.com/coderkun/questlab
|
||||
*/
|
||||
|
||||
namespace hhu\z\agents;
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
* Questlab
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @copyright 2014 – 2016 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
* @link https://github.com/coderkun/questlab
|
||||
*/
|
||||
|
||||
namespace hhu\z\apis;
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
* Questlab
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @copyright 2014 – 2016 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
* @link https://github.com/coderkun/questlab
|
||||
*/
|
||||
|
||||
namespace hhu\z\controllers;
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
* Questlab
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @copyright 2014 – 2016 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
* @link https://github.com/coderkun/questlab
|
||||
*/
|
||||
|
||||
namespace hhu\z\controllers;
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
* Questlab
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @copyright 2014 – 2016 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
* @link https://github.com/coderkun/questlab
|
||||
*/
|
||||
|
||||
namespace hhu\z\controllers;
|
||||
|
@ -31,7 +31,7 @@
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
public $models = array('seminaries', 'characters', 'characterroles', 'xplevels', 'avatars', 'achievements');
|
||||
public $models = array('seminaries', 'characters', 'characterroles', 'xplevels', 'avatars', 'achievements', 'charactertitles');
|
||||
/**
|
||||
* Current Seminary
|
||||
*
|
||||
|
@ -91,6 +91,11 @@
|
|||
catch(\nre\exceptions\IdNotFoundException $e) {
|
||||
// No Avatar available
|
||||
}
|
||||
if(!is_null(self::$character['charactertitle_id']) && !is_null(self::$character['gender']))
|
||||
{
|
||||
$title = $this->Charactertitles->getTitleById(self::$character['charactertitle_id']);
|
||||
self::$character['title'] = $title[(self::$character['gender']) ? 'title_male' : 'title_female'];
|
||||
}
|
||||
}
|
||||
}
|
||||
catch(\nre\exceptions\IdNotFoundException $e) {
|
||||
|
@ -100,8 +105,8 @@
|
|||
$this->checkPermission($request, $response);
|
||||
|
||||
// Check achievements
|
||||
$this->checkAchievements($request, $response, 'date');
|
||||
$this->checkAchievements($request, $response, 'achievement');
|
||||
$this->checkAchievements($request, 'date');
|
||||
$this->checkAchievements($request, 'achievement');
|
||||
|
||||
// Set Seminary and Character data
|
||||
$this->set('loggedSeminary', self::$seminary);
|
||||
|
@ -158,14 +163,13 @@
|
|||
/**
|
||||
* 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
|
||||
* @param \nre\core\Request $request Current request
|
||||
* @param array $checkConditions Conditions to check
|
||||
*/
|
||||
protected function checkAchievements(\nre\core\Request $request, \nre\core\Response $response, $checkConditions=null)
|
||||
protected function checkAchievements(\nre\core\Request $request, $checkConditions=null)
|
||||
{
|
||||
// Do not check MediaController
|
||||
if($this->request->getParam(0, 'toplevel') != \nre\configs\AppConfig::$defaults['toplevel']) {
|
||||
if($request->getParam(0, 'toplevel') != \nre\configs\AppConfig::$defaults['toplevel']) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -174,152 +178,22 @@
|
|||
return;
|
||||
}
|
||||
|
||||
// Set conditions to check
|
||||
if(!is_null($checkConditions) && !is_array($checkConditions)) {
|
||||
$checkConditions = array($checkConditions);
|
||||
}
|
||||
// Check Achievements
|
||||
$achievements = $this->Achievement->checkAchievements(
|
||||
self::$seminary['id'],
|
||||
self::$character['id'],
|
||||
$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
|
||||
// Add notifications
|
||||
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)
|
||||
);
|
||||
}
|
||||
$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)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
320
app/controllers/StationtypeController.inc
Normal file
320
app/controllers/StationtypeController.inc
Normal file
|
@ -0,0 +1,320 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Questlab
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 – 2016 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://github.com/coderkun/questlab
|
||||
*/
|
||||
|
||||
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');
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 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
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,12 +1,12 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
* Questlab
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @copyright 2014 – 2016 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
* @link https://github.com/coderkun/questlab
|
||||
*/
|
||||
|
||||
namespace hhu\z\exceptions;
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
* Questlab
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @copyright 2014 – 2016 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
* @link https://github.com/coderkun/questlab
|
||||
*/
|
||||
|
||||
namespace hhu\z\exceptions;
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
* Questlab
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @copyright 2014 – 2016 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
* @link https://github.com/coderkun/questlab
|
||||
*/
|
||||
|
||||
namespace hhu\z\exceptions;
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
* Questlab
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @copyright 2014 – 2016 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
* @link https://github.com/coderkun/questlab
|
||||
*/
|
||||
|
||||
namespace hhu\z\exceptions;
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
* Questlab
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @copyright 2014 – 2016 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
* @link https://github.com/coderkun/questlab
|
||||
*/
|
||||
|
||||
namespace hhu\z\exceptions;
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
* Questlab
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @copyright 2014 – 2016 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
* @link https://github.com/coderkun/questlab
|
||||
*/
|
||||
|
||||
namespace hhu\z\exceptions;
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
* Questlab
|
||||
*
|
||||
* @author Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 – 2016 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
* @link https://github.com/coderkun/questlab
|
||||
*/
|
||||
|
||||
namespace hhu\z\exceptions;
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
* Questlab
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @copyright 2014 – 2016 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
* @link https://github.com/coderkun/questlab
|
||||
*/
|
||||
|
||||
namespace hhu\z\exceptions;
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
* Questlab
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @copyright 2014 – 2016 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
* @link https://github.com/coderkun/questlab
|
||||
*/
|
||||
|
||||
namespace hhu\z\exceptions;
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
* Questlab
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @copyright 2014 – 2016 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
* @link https://github.com/coderkun/questlab
|
||||
*/
|
||||
|
||||
namespace hhu\z\exceptions;
|
||||
|
|
79
app/exceptions/StationtypeAgentNotFoundException.inc
Normal file
79
app/exceptions/StationtypeAgentNotFoundException.inc
Normal file
|
@ -0,0 +1,79 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Questlab
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 – 2016 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://github.com/coderkun/questlab
|
||||
*/
|
||||
|
||||
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
|
||||
|
||||
/**
|
||||
* Questlab
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 – 2016 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://github.com/coderkun/questlab
|
||||
*/
|
||||
|
||||
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
|
||||
|
||||
/**
|
||||
* Questlab
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 – 2016 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://github.com/coderkun/questlab
|
||||
*/
|
||||
|
||||
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
|
||||
|
||||
/**
|
||||
* Questlab
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 – 2016 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://github.com/coderkun/questlab
|
||||
*/
|
||||
|
||||
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
|
||||
|
||||
/**
|
||||
* Questlab
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 – 2016 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://github.com/coderkun/questlab
|
||||
*/
|
||||
|
||||
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
|
||||
|
||||
/**
|
||||
* Questlab
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 – 2016 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://github.com/coderkun/questlab
|
||||
*/
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,12 +1,12 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
* Questlab
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @copyright 2014 – 2016 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
* @link https://github.com/coderkun/questlab
|
||||
*/
|
||||
|
||||
namespace hhu\z\exceptions;
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
* Questlab
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @copyright 2014 – 2016 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
* @link https://github.com/coderkun/questlab
|
||||
*/
|
||||
|
||||
namespace hhu\z\exceptions;
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
* Questlab
|
||||
*
|
||||
* @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
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 – 2016 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://github.com/coderkun/questlab
|
||||
*/
|
||||
|
||||
namespace hhu\z\lib
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
* Questlab
|
||||
*
|
||||
* @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
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 – 2016 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://github.com/coderkun/questlab
|
||||
*/
|
||||
|
||||
namespace hhu\z\lib
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
<?php
|
||||
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
* Questlab
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 – 2016 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://github.com/coderkun/questlab
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
*/
|
||||
|
||||
|
|
33
app/lib/Phpqrcode-lib.inc
Normal file
33
app/lib/Phpqrcode-lib.inc
Normal file
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Questlab
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 – 2016 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://github.com/coderkun/questlab
|
||||
*/
|
||||
|
||||
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
|
@ -1,12 +1,12 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
* Questlab
|
||||
*
|
||||
* @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
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 – 2016 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://github.com/coderkun/questlab
|
||||
*/
|
||||
|
||||
namespace hhu\z\lib
|
||||
|
|
228
app/lib/Similarity.inc
Normal file
228
app/lib/Similarity.inc
Normal file
|
@ -0,0 +1,228 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Questlab
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 – 2016 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://github.com/coderkun/questlab
|
||||
*/
|
||||
|
||||
namespace hhu\z\lib;
|
||||
|
||||
|
||||
/**
|
||||
* Class to calculate similarity between documents.
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
*/
|
||||
class Similarity
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* Read a file and return its text.
|
||||
*
|
||||
* Currently only PDF-files are supported and “pdftotext” needs to be
|
||||
* installed. If reading fails, false is returned.
|
||||
*
|
||||
* @param string $filename Name of file to read
|
||||
* @return mixed Text of document (string) or false (boolean)
|
||||
*/
|
||||
public static function readDocument($filename)
|
||||
{
|
||||
if(!file_exists($filename)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$text = array();
|
||||
$result = 0;
|
||||
exec(sprintf('pdftotext "%s" -', $filename), $text, $result);
|
||||
if($result != 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$text = mb_strtolower(implode('', $text));
|
||||
|
||||
|
||||
return $text;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Split a text into N-grams.
|
||||
*
|
||||
* The default N is 3.
|
||||
*
|
||||
* @param string $document Text to be splitted
|
||||
* @param int $n Size of grams to split into (N)
|
||||
* @return array List of n-grams
|
||||
*/
|
||||
public static function splitNgrams($document, $n=3)
|
||||
{
|
||||
$affix = implode(' ', array_fill(0, $n-1, ' '));
|
||||
$document = $affix.$document.$affix;
|
||||
$ngrams = array();
|
||||
for($i=0; $i<mb_strlen($document)-$n; $i++) {
|
||||
$ngrams[] = mb_substr($document, $i, $n);
|
||||
}
|
||||
|
||||
|
||||
return $ngrams;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Compare to documents, represented by there Term Frequencies (TFs)
|
||||
* values.
|
||||
*
|
||||
* $tfsA, $tfsB and $idf_n are expected to be associative arrays with
|
||||
* the term as key and the corresponding frequency as value.
|
||||
*
|
||||
* @param array $tfsA Term Frequencies of document A
|
||||
* @param array $tfsB Term Frequencies of document B
|
||||
* @param int $idf_N Total count of documents in corpus
|
||||
* @param array $idf_n Inverse Document Frequencies of all terms
|
||||
* @return float Similarity value (between 0.0 and 1.0)
|
||||
*/
|
||||
public static function compare($tfsA, $tfsB, $idf_N, $idf_n)
|
||||
{
|
||||
// Create vector A
|
||||
$vectorA = self::getVector($tfsA, $idf_N, $idf_n);
|
||||
|
||||
// Create vector B
|
||||
$vectorB = self::getVector($tfsB, $idf_N, $idf_n);
|
||||
|
||||
// Compare vectors
|
||||
$result = self::cosinus($vectorA, $vectorB);
|
||||
|
||||
|
||||
// Return result
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Calculate the vector for a document based on TF and IDF.
|
||||
*
|
||||
* $tfs and $idf_n are expected to be associative arrays with the term
|
||||
* as key and the corresponding frequency as value. The resulting
|
||||
* vector is an associative array with the terms as keys and their
|
||||
* corresponding values as value.
|
||||
*
|
||||
* @param array $tfs Term Frequencies of document
|
||||
* @param int $idf_N Total count of documents in corpus
|
||||
* @param array $idf_n Inverse Document Frequencies of all terms
|
||||
* @return array Document vector
|
||||
*/
|
||||
protected static function getVector($tfs, $idf_N, $idf_n)
|
||||
{
|
||||
// TF * IDF
|
||||
$tfidfs = self::getTFIDFs($tfs, $idf_N, $idf_n);
|
||||
|
||||
|
||||
return $tfidfs;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Calculate TF*IDF values for a document.
|
||||
*
|
||||
* $tfs and $idf_n are expected to be associative arrays with the term
|
||||
* as key and the corresponding frequency as value. The resulting
|
||||
* value is an associative array with the terms as keys and their
|
||||
* corresponding TF*IDF as values.
|
||||
*
|
||||
* @param array $tfs Term Frequencies of document
|
||||
* @param int $idf_N Total count of documents in corpus
|
||||
* @param array $idf_n Inverse Document Frequencies of all terms
|
||||
* @return array TF*IDF values
|
||||
*/
|
||||
protected static function getTFIDFs($tfs, $idf_N, $idf_n)
|
||||
{
|
||||
$tfidfs = array();
|
||||
|
||||
// Calculate TF*IDF
|
||||
foreach($tfs as $term => &$tf)
|
||||
{
|
||||
if(array_key_exists($term, $idf_n)) {
|
||||
$idf = log($idf_N / $idf_n[$term], 2);
|
||||
}
|
||||
else {
|
||||
// TODO Laplace norm: n = 1?
|
||||
$idf = log($idf_N / 1, 2);
|
||||
}
|
||||
$tfidfs[$term] = $tf * $idf;
|
||||
}
|
||||
|
||||
|
||||
return $tfidfs;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Calculate cosinus similarity between two vectors.
|
||||
*
|
||||
* sim(a, b) = (a・b) / (||a|| * ||b||)
|
||||
*
|
||||
* @param array $a Vector A
|
||||
* @param array $b Vector B
|
||||
* @return float Similarity value (between 0.0 and 1.0)
|
||||
*/
|
||||
protected static function cosinus(array $a, array $b)
|
||||
{
|
||||
$normA = self::norm($a);
|
||||
$normB = self::norm($b);
|
||||
if(($normA * $normB) != 0) {
|
||||
return self::dotProduct($a, $b) / ($normA * $normB);
|
||||
}
|
||||
else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Calculate the dot-product for two vectors.
|
||||
*
|
||||
* a・b = summation{i=1,n}(a[i] * b[i])
|
||||
*
|
||||
* @param array $a Vector A
|
||||
* @param array $b Vector B
|
||||
* @return float Dot-product
|
||||
*/
|
||||
protected static function dotProduct(array $a, array $b)
|
||||
{
|
||||
$dotProduct = 0;
|
||||
$keysA = array_keys(array_filter($a));
|
||||
$keysB = array_keys(array_filter($b));
|
||||
$uniqueKeys = array_unique(array_merge($keysA, $keysB));
|
||||
foreach($uniqueKeys as $key) {
|
||||
if(!empty($a[$key]) && !empty($b[$key])) {
|
||||
$dotProduct += ($a[$key] * $b[$key]);
|
||||
}
|
||||
}
|
||||
|
||||
return $dotProduct;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Caculate the Euclidean norm for a vector.
|
||||
*
|
||||
* ||x|| = sqrt(x・x) // ・ is a dot product
|
||||
*
|
||||
* @param array $vector Vector
|
||||
* @return float Euclidean norm
|
||||
*/
|
||||
protected static function norm(array $vector)
|
||||
{
|
||||
return sqrt(self::dotProduct($vector, $vector));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
|
@ -1,12 +1,12 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* The Legend of Z
|
||||
* Questlab
|
||||
*
|
||||
* @author Oliver Hanraths <oliver.hanraths@uni-duesseldorf.de>
|
||||
* @copyright 2014 Heinrich-Heine-Universität Düsseldorf
|
||||
* @copyright 2014 – 2016 Heinrich-Heine-Universität Düsseldorf
|
||||
* @license http://www.gnu.org/licenses/gpl.html
|
||||
* @link https://bitbucket.org/coderkun/the-legend-of-z
|
||||
* @link https://github.com/coderkun/questlab
|
||||
*/
|
||||
|
||||
namespace hhu\z\lib;
|
||||
|
|
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.
|
||||
|
||||
You may place library facilities that are a work based on the
|
||||
Library side by side in a single library together with other library
|
||||
facilities that are not Applications and are not covered by this
|
||||
License, and convey such a combined library under terms of your
|
||||
choice, if you do both of the following:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work based
|
||||
on the Library, uncombined with any other library facilities,
|
||||
conveyed under the terms of this License.
|
||||
|
||||
b) Give prominent notice with the combined library that part of it
|
||||
is a work based on the Library, and explaining where to find the
|
||||
accompanying uncombined form of the same work.
|
||||
|
||||
6. Revised Versions of the GNU Lesser General Public License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions
|
||||
of the GNU Lesser General Public License from time to time. Such new
|
||||
versions will be similar in spirit to the present version, but may
|
||||
differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Library as you received it specifies that a certain numbered version
|
||||
of the GNU Lesser General Public License "or any later version"
|
||||
applies to it, you have the option of following the terms and
|
||||
conditions either of that published version or of any later version
|
||||
published by the Free Software Foundation. If the Library as you
|
||||
received it does not specify a version number of the GNU Lesser
|
||||
General Public License, you may choose any version of the GNU Lesser
|
||||
General Public License ever published by the Free Software Foundation.
|
||||
|
||||
If the Library as you received it specifies that a proxy can decide
|
||||
whether future versions of the GNU Lesser General Public License shall
|
||||
apply, that proxy's public statement of acceptance of any version is
|
||||
permanent authorization for you to choose that version for the
|
||||
Library.
|
45
app/lib/phpqrcode/README
Normal file
45
app/lib/phpqrcode/README
Normal file
|
@ -0,0 +1,45 @@
|
|||
This is PHP implementation of QR Code 2-D barcode generator. It is pure-php
|
||||
LGPL-licensed implementation based on C libqrencode by Kentaro Fukuchi.
|
||||
|
||||
== LICENSING ==
|
||||
|
||||
Copyright (C) 2010 by Dominik Dzienia
|
||||
|
||||
This library is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU Lesser General Public License as published by the Free
|
||||
Software Foundation; either version 3 of the License, or any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. See the GNU Lesser General Public License (LICENSE file)
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License along
|
||||
with this library; if not, write to the Free Software Foundation, Inc., 51
|
||||
Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
== INSTALATION AND USAGE ==
|
||||
|
||||
* INSTALL file
|
||||
* http://sourceforge.net/apps/mediawiki/phpqrcode/index.php?title=Main_Page
|
||||
|
||||
== CONTACT ==
|
||||
|
||||
Fell free to contact me via e-mail (deltalab at poczta dot fm) or using
|
||||
folowing project pages:
|
||||
|
||||
* http://sourceforge.net/projects/phpqrcode/
|
||||
* http://phpqrcode.sourceforge.net/
|
||||
|
||||
== ACKNOWLEDGMENTS ==
|
||||
|
||||
Based on C libqrencode library (ver. 3.1.1)
|
||||
Copyright (C) 2006-2010 by Kentaro Fukuchi
|
||||
http://megaui.net/fukuchi/works/qrencode/index.en.html
|
||||
|
||||
QR Code is registered trademarks of DENSO WAVE INCORPORATED in JAPAN and other
|
||||
countries.
|
||||
|
||||
Reed-Solomon code encoder is written by Phil Karn, KA9Q.
|
||||
Copyright (C) 2002, 2003, 2004, 2006 Phil Karn, KA9Q
|
||||
|
2
app/lib/phpqrcode/VERSION
Normal file
2
app/lib/phpqrcode/VERSION
Normal file
|
@ -0,0 +1,2 @@
|
|||
1.1.4
|
||||
2010100721
|
2875
app/lib/phpqrcode/bindings/tcpdf/qrcode.php
Normal file
2875
app/lib/phpqrcode/bindings/tcpdf/qrcode.php
Normal file
File diff suppressed because it is too large
Load diff
94
app/lib/phpqrcode/index.php
Normal file
94
app/lib/phpqrcode/index.php
Normal file
|
@ -0,0 +1,94 @@
|
|||
<?php
|
||||
/*
|
||||
* PHP QR Code encoder
|
||||
*
|
||||
* Exemplatory usage
|
||||
*
|
||||
* PHP QR Code is distributed under LGPL 3
|
||||
* Copyright (C) 2010 Dominik Dzienia <deltalab at poczta dot fm>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3 of the License, or any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
echo "<h1>PHP QR Code</h1><hr/>";
|
||||
|
||||
//set it to writable location, a place for temp generated PNG files
|
||||
$PNG_TEMP_DIR = dirname(__FILE__).DIRECTORY_SEPARATOR.'temp'.DIRECTORY_SEPARATOR;
|
||||
|
||||
//html PNG location prefix
|
||||
$PNG_WEB_DIR = 'temp/';
|
||||
|
||||
include "qrlib.php";
|
||||
|
||||
//ofcourse we need rights to create temp dir
|
||||
if (!file_exists($PNG_TEMP_DIR))
|
||||
mkdir($PNG_TEMP_DIR);
|
||||
|
||||
|
||||
$filename = $PNG_TEMP_DIR.'test.png';
|
||||
|
||||
//processing form input
|
||||
//remember to sanitize user input in real-life solution !!!
|
||||
$errorCorrectionLevel = 'L';
|
||||
if (isset($_REQUEST['level']) && in_array($_REQUEST['level'], array('L','M','Q','H')))
|
||||
$errorCorrectionLevel = $_REQUEST['level'];
|
||||
|
||||
$matrixPointSize = 4;
|
||||
if (isset($_REQUEST['size']))
|
||||
$matrixPointSize = min(max((int)$_REQUEST['size'], 1), 10);
|
||||
|
||||
|
||||
if (isset($_REQUEST['data'])) {
|
||||
|
||||
//it's very important!
|
||||
if (trim($_REQUEST['data']) == '')
|
||||
die('data cannot be empty! <a href="?">back</a>');
|
||||
|
||||
// user data
|
||||
$filename = $PNG_TEMP_DIR.'test'.md5($_REQUEST['data'].'|'.$errorCorrectionLevel.'|'.$matrixPointSize).'.png';
|
||||
QRcode::png($_REQUEST['data'], $filename, $errorCorrectionLevel, $matrixPointSize, 2);
|
||||
|
||||
} else {
|
||||
|
||||
//default data
|
||||
echo 'You can provide data in GET parameter: <a href="?data=like_that">like that</a><hr/>';
|
||||
QRcode::png('PHP QR Code :)', $filename, $errorCorrectionLevel, $matrixPointSize, 2);
|
||||
|
||||
}
|
||||
|
||||
//display generated file
|
||||
echo '<img src="'.$PNG_WEB_DIR.basename($filename).'" /><hr/>';
|
||||
|
||||
//config form
|
||||
echo '<form action="index.php" method="post">
|
||||
Data: <input name="data" value="'.(isset($_REQUEST['data'])?htmlspecialchars($_REQUEST['data']):'PHP QR Code :)').'" />
|
||||
ECC: <select name="level">
|
||||
<option value="L"'.(($errorCorrectionLevel=='L')?' selected':'').'>L - smallest</option>
|
||||
<option value="M"'.(($errorCorrectionLevel=='M')?' selected':'').'>M</option>
|
||||
<option value="Q"'.(($errorCorrectionLevel=='Q')?' selected':'').'>Q</option>
|
||||
<option value="H"'.(($errorCorrectionLevel=='H')?' selected':'').'>H - best</option>
|
||||
</select>
|
||||
Size: <select name="size">';
|
||||
|
||||
for($i=1;$i<=10;$i++)
|
||||
echo '<option value="'.$i.'"'.(($matrixPointSize==$i)?' selected':'').'>'.$i.'</option>';
|
||||
|
||||
echo '</select>
|
||||
<input type="submit" value="GENERATE"></form><hr/>';
|
||||
|
||||
// benchmark
|
||||
QRtools::timeBenchmark();
|
||||
|
||||
|
3312
app/lib/phpqrcode/phpqrcode.php
Normal file
3312
app/lib/phpqrcode/phpqrcode.php
Normal file
File diff suppressed because it is too large
Load diff
180
app/lib/phpqrcode/qrbitstream.php
Normal file
180
app/lib/phpqrcode/qrbitstream.php
Normal file
|
@ -0,0 +1,180 @@
|
|||
<?php
|
||||
/*
|
||||
* PHP QR Code encoder
|
||||
*
|
||||
* Bitstream class
|
||||
*
|
||||
* Based on libqrencode C library distributed under LGPL 2.1
|
||||
* Copyright (C) 2006, 2007, 2008, 2009 Kentaro Fukuchi <fukuchi@megaui.net>
|
||||
*
|
||||
* PHP QR Code is distributed under LGPL 3
|
||||
* Copyright (C) 2010 Dominik Dzienia <deltalab at poczta dot fm>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3 of the License, or any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
class QRbitstream {
|
||||
|
||||
public $data = array();
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
public function size()
|
||||
{
|
||||
return count($this->data);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
public function allocate($setLength)
|
||||
{
|
||||
$this->data = array_fill(0, $setLength, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
public static function newFromNum($bits, $num)
|
||||
{
|
||||
$bstream = new QRbitstream();
|
||||
$bstream->allocate($bits);
|
||||
|
||||
$mask = 1 << ($bits - 1);
|
||||
for($i=0; $i<$bits; $i++) {
|
||||
if($num & $mask) {
|
||||
$bstream->data[$i] = 1;
|
||||
} else {
|
||||
$bstream->data[$i] = 0;
|
||||
}
|
||||
$mask = $mask >> 1;
|
||||
}
|
||||
|
||||
return $bstream;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
public static function newFromBytes($size, $data)
|
||||
{
|
||||
$bstream = new QRbitstream();
|
||||
$bstream->allocate($size * 8);
|
||||
$p=0;
|
||||
|
||||
for($i=0; $i<$size; $i++) {
|
||||
$mask = 0x80;
|
||||
for($j=0; $j<8; $j++) {
|
||||
if($data[$i] & $mask) {
|
||||
$bstream->data[$p] = 1;
|
||||
} else {
|
||||
$bstream->data[$p] = 0;
|
||||
}
|
||||
$p++;
|
||||
$mask = $mask >> 1;
|
||||
}
|
||||
}
|
||||
|
||||
return $bstream;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
public function append(QRbitstream $arg)
|
||||
{
|
||||
if (is_null($arg)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if($arg->size() == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if($this->size() == 0) {
|
||||
$this->data = $arg->data;
|
||||
return 0;
|
||||
}
|
||||
|
||||
$this->data = array_values(array_merge($this->data, $arg->data));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
public function appendNum($bits, $num)
|
||||
{
|
||||
if ($bits == 0)
|
||||
return 0;
|
||||
|
||||
$b = QRbitstream::newFromNum($bits, $num);
|
||||
|
||||
if(is_null($b))
|
||||
return -1;
|
||||
|
||||
$ret = $this->append($b);
|
||||
unset($b);
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
public function appendBytes($size, $data)
|
||||
{
|
||||
if ($size == 0)
|
||||
return 0;
|
||||
|
||||
$b = QRbitstream::newFromBytes($size, $data);
|
||||
|
||||
if(is_null($b))
|
||||
return -1;
|
||||
|
||||
$ret = $this->append($b);
|
||||
unset($b);
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
public function toByte()
|
||||
{
|
||||
|
||||
$size = $this->size();
|
||||
|
||||
if($size == 0) {
|
||||
return array();
|
||||
}
|
||||
|
||||
$data = array_fill(0, (int)(($size + 7) / 8), 0);
|
||||
$bytes = (int)($size / 8);
|
||||
|
||||
$p = 0;
|
||||
|
||||
for($i=0; $i<$bytes; $i++) {
|
||||
$v = 0;
|
||||
for($j=0; $j<8; $j++) {
|
||||
$v = $v << 1;
|
||||
$v |= $this->data[$p];
|
||||
$p++;
|
||||
}
|
||||
$data[$i] = $v;
|
||||
}
|
||||
|
||||
if($size & 7) {
|
||||
$v = 0;
|
||||
for($j=0; $j<($size & 7); $j++) {
|
||||
$v = $v << 1;
|
||||
$v |= $this->data[$p];
|
||||
$p++;
|
||||
}
|
||||
$data[$bytes] = $v;
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
}
|
17
app/lib/phpqrcode/qrconfig.php
Normal file
17
app/lib/phpqrcode/qrconfig.php
Normal file
|
@ -0,0 +1,17 @@
|
|||
<?php
|
||||
/*
|
||||
* PHP QR Code encoder
|
||||
*
|
||||
* Config file, feel free to modify
|
||||
*/
|
||||
|
||||
define('QR_CACHEABLE', true); // use cache - more disk reads but less CPU power, masks and format templates are stored there
|
||||
define('QR_CACHE_DIR', dirname(__FILE__).DIRECTORY_SEPARATOR.'cache'.DIRECTORY_SEPARATOR); // used when QR_CACHEABLE === true
|
||||
define('QR_LOG_DIR', dirname(__FILE__).DIRECTORY_SEPARATOR); // default error logs dir
|
||||
|
||||
define('QR_FIND_BEST_MASK', true); // if true, estimates best mask (spec. default, but extremally slow; set to false to significant performance boost but (propably) worst quality code
|
||||
define('QR_FIND_FROM_RANDOM', false); // if false, checks all masks available, otherwise value tells count of masks need to be checked, mask id are got randomly
|
||||
define('QR_DEFAULT_MASK', 2); // when QR_FIND_BEST_MASK === false
|
||||
|
||||
define('QR_PNG_MAXIMUM_SIZE', 1024); // maximum allowed png image width (in pixels), tune to make sure GD and PHP can handle such big images
|
||||
|
54
app/lib/phpqrcode/qrconst.php
Normal file
54
app/lib/phpqrcode/qrconst.php
Normal file
|
@ -0,0 +1,54 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* PHP QR Code encoder
|
||||
*
|
||||
* Common constants
|
||||
*
|
||||
* Based on libqrencode C library distributed under LGPL 2.1
|
||||
* Copyright (C) 2006, 2007, 2008, 2009 Kentaro Fukuchi <fukuchi@megaui.net>
|
||||
*
|
||||
* PHP QR Code is distributed under LGPL 3
|
||||
* Copyright (C) 2010 Dominik Dzienia <deltalab at poczta dot fm>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3 of the License, or any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
// Encoding modes
|
||||
|
||||
define('QR_MODE_NUL', -1);
|
||||
define('QR_MODE_NUM', 0);
|
||||
define('QR_MODE_AN', 1);
|
||||
define('QR_MODE_8', 2);
|
||||
define('QR_MODE_KANJI', 3);
|
||||
define('QR_MODE_STRUCTURE', 4);
|
||||
|
||||
// Levels of error correction.
|
||||
|
||||
define('QR_ECLEVEL_L', 0);
|
||||
define('QR_ECLEVEL_M', 1);
|
||||
define('QR_ECLEVEL_Q', 2);
|
||||
define('QR_ECLEVEL_H', 3);
|
||||
|
||||
// Supported output formats
|
||||
|
||||
define('QR_FORMAT_TEXT', 0);
|
||||
define('QR_FORMAT_PNG', 1);
|
||||
|
||||
class qrstr {
|
||||
public static function set(&$srctab, $x, $y, $repl, $replLen = false) {
|
||||
$srctab[$y] = substr_replace($srctab[$y], ($replLen !== false)?substr($repl,0,$replLen):$repl, $x, ($replLen !== false)?$replLen:strlen($repl));
|
||||
}
|
||||
}
|
502
app/lib/phpqrcode/qrencode.php
Normal file
502
app/lib/phpqrcode/qrencode.php
Normal file
|
@ -0,0 +1,502 @@
|
|||
<?php
|
||||
/*
|
||||
* PHP QR Code encoder
|
||||
*
|
||||
* Main encoder classes.
|
||||
*
|
||||
* Based on libqrencode C library distributed under LGPL 2.1
|
||||
* Copyright (C) 2006, 2007, 2008, 2009 Kentaro Fukuchi <fukuchi@megaui.net>
|
||||
*
|
||||
* PHP QR Code is distributed under LGPL 3
|
||||
* Copyright (C) 2010 Dominik Dzienia <deltalab at poczta dot fm>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3 of the License, or any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
class QRrsblock {
|
||||
public $dataLength;
|
||||
public $data = array();
|
||||
public $eccLength;
|
||||
public $ecc = array();
|
||||
|
||||
public function __construct($dl, $data, $el, &$ecc, QRrsItem $rs)
|
||||
{
|
||||
$rs->encode_rs_char($data, $ecc);
|
||||
|
||||
$this->dataLength = $dl;
|
||||
$this->data = $data;
|
||||
$this->eccLength = $el;
|
||||
$this->ecc = $ecc;
|
||||
}
|
||||
};
|
||||
|
||||
//##########################################################################
|
||||
|
||||
class QRrawcode {
|
||||
public $version;
|
||||
public $datacode = array();
|
||||
public $ecccode = array();
|
||||
public $blocks;
|
||||
public $rsblocks = array(); //of RSblock
|
||||
public $count;
|
||||
public $dataLength;
|
||||
public $eccLength;
|
||||
public $b1;
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
public function __construct(QRinput $input)
|
||||
{
|
||||
$spec = array(0,0,0,0,0);
|
||||
|
||||
$this->datacode = $input->getByteStream();
|
||||
if(is_null($this->datacode)) {
|
||||
throw new Exception('null imput string');
|
||||
}
|
||||
|
||||
QRspec::getEccSpec($input->getVersion(), $input->getErrorCorrectionLevel(), $spec);
|
||||
|
||||
$this->version = $input->getVersion();
|
||||
$this->b1 = QRspec::rsBlockNum1($spec);
|
||||
$this->dataLength = QRspec::rsDataLength($spec);
|
||||
$this->eccLength = QRspec::rsEccLength($spec);
|
||||
$this->ecccode = array_fill(0, $this->eccLength, 0);
|
||||
$this->blocks = QRspec::rsBlockNum($spec);
|
||||
|
||||
$ret = $this->init($spec);
|
||||
if($ret < 0) {
|
||||
throw new Exception('block alloc error');
|
||||
return null;
|
||||
}
|
||||
|
||||
$this->count = 0;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
public function init(array $spec)
|
||||
{
|
||||
$dl = QRspec::rsDataCodes1($spec);
|
||||
$el = QRspec::rsEccCodes1($spec);
|
||||
$rs = QRrs::init_rs(8, 0x11d, 0, 1, $el, 255 - $dl - $el);
|
||||
|
||||
|
||||
$blockNo = 0;
|
||||
$dataPos = 0;
|
||||
$eccPos = 0;
|
||||
for($i=0; $i<QRspec::rsBlockNum1($spec); $i++) {
|
||||
$ecc = array_slice($this->ecccode,$eccPos);
|
||||
$this->rsblocks[$blockNo] = new QRrsblock($dl, array_slice($this->datacode, $dataPos), $el, $ecc, $rs);
|
||||
$this->ecccode = array_merge(array_slice($this->ecccode,0, $eccPos), $ecc);
|
||||
|
||||
$dataPos += $dl;
|
||||
$eccPos += $el;
|
||||
$blockNo++;
|
||||
}
|
||||
|
||||
if(QRspec::rsBlockNum2($spec) == 0)
|
||||
return 0;
|
||||
|
||||
$dl = QRspec::rsDataCodes2($spec);
|
||||
$el = QRspec::rsEccCodes2($spec);
|
||||
$rs = QRrs::init_rs(8, 0x11d, 0, 1, $el, 255 - $dl - $el);
|
||||
|
||||
if($rs == NULL) return -1;
|
||||
|
||||
for($i=0; $i<QRspec::rsBlockNum2($spec); $i++) {
|
||||
$ecc = array_slice($this->ecccode,$eccPos);
|
||||
$this->rsblocks[$blockNo] = new QRrsblock($dl, array_slice($this->datacode, $dataPos), $el, $ecc, $rs);
|
||||
$this->ecccode = array_merge(array_slice($this->ecccode,0, $eccPos), $ecc);
|
||||
|
||||
$dataPos += $dl;
|
||||
$eccPos += $el;
|
||||
$blockNo++;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
public function getCode()
|
||||
{
|
||||
$ret;
|
||||
|
||||
if($this->count < $this->dataLength) {
|
||||
$row = $this->count % $this->blocks;
|
||||
$col = $this->count / $this->blocks;
|
||||
if($col >= $this->rsblocks[0]->dataLength) {
|
||||
$row += $this->b1;
|
||||
}
|
||||
$ret = $this->rsblocks[$row]->data[$col];
|
||||
} else if($this->count < $this->dataLength + $this->eccLength) {
|
||||
$row = ($this->count - $this->dataLength) % $this->blocks;
|
||||
$col = ($this->count - $this->dataLength) / $this->blocks;
|
||||
$ret = $this->rsblocks[$row]->ecc[$col];
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
$this->count++;
|
||||
|
||||
return $ret;
|
||||
}
|
||||
}
|
||||
|
||||
//##########################################################################
|
||||
|
||||
class QRcode {
|
||||
|
||||
public $version;
|
||||
public $width;
|
||||
public $data;
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
public function encodeMask(QRinput $input, $mask)
|
||||
{
|
||||
if($input->getVersion() < 0 || $input->getVersion() > QRSPEC_VERSION_MAX) {
|
||||
throw new Exception('wrong version');
|
||||
}
|
||||
if($input->getErrorCorrectionLevel() > QR_ECLEVEL_H) {
|
||||
throw new Exception('wrong level');
|
||||
}
|
||||
|
||||
$raw = new QRrawcode($input);
|
||||
|
||||
QRtools::markTime('after_raw');
|
||||
|
||||
$version = $raw->version;
|
||||
$width = QRspec::getWidth($version);
|
||||
$frame = QRspec::newFrame($version);
|
||||
|
||||
$filler = new FrameFiller($width, $frame);
|
||||
if(is_null($filler)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// inteleaved data and ecc codes
|
||||
for($i=0; $i<$raw->dataLength + $raw->eccLength; $i++) {
|
||||
$code = $raw->getCode();
|
||||
$bit = 0x80;
|
||||
for($j=0; $j<8; $j++) {
|
||||
$addr = $filler->next();
|
||||
$filler->setFrameAt($addr, 0x02 | (($bit & $code) != 0));
|
||||
$bit = $bit >> 1;
|
||||
}
|
||||
}
|
||||
|
||||
QRtools::markTime('after_filler');
|
||||
|
||||
unset($raw);
|
||||
|
||||
// remainder bits
|
||||
$j = QRspec::getRemainder($version);
|
||||
for($i=0; $i<$j; $i++) {
|
||||
$addr = $filler->next();
|
||||
$filler->setFrameAt($addr, 0x02);
|
||||
}
|
||||
|
||||
$frame = $filler->frame;
|
||||
unset($filler);
|
||||
|
||||
|
||||
// masking
|
||||
$maskObj = new QRmask();
|
||||
if($mask < 0) {
|
||||
|
||||
if (QR_FIND_BEST_MASK) {
|
||||
$masked = $maskObj->mask($width, $frame, $input->getErrorCorrectionLevel());
|
||||
} else {
|
||||
$masked = $maskObj->makeMask($width, $frame, (intval(QR_DEFAULT_MASK) % 8), $input->getErrorCorrectionLevel());
|
||||
}
|
||||
} else {
|
||||
$masked = $maskObj->makeMask($width, $frame, $mask, $input->getErrorCorrectionLevel());
|
||||
}
|
||||
|
||||
if($masked == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
QRtools::markTime('after_mask');
|
||||
|
||||
$this->version = $version;
|
||||
$this->width = $width;
|
||||
$this->data = $masked;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
public function encodeInput(QRinput $input)
|
||||
{
|
||||
return $this->encodeMask($input, -1);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
public function encodeString8bit($string, $version, $level)
|
||||
{
|
||||
if(string == NULL) {
|
||||
throw new Exception('empty string!');
|
||||
return NULL;
|
||||
}
|
||||
|
||||
$input = new QRinput($version, $level);
|
||||
if($input == NULL) return NULL;
|
||||
|
||||
$ret = $input->append($input, QR_MODE_8, strlen($string), str_split($string));
|
||||
if($ret < 0) {
|
||||
unset($input);
|
||||
return NULL;
|
||||
}
|
||||
return $this->encodeInput($input);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
public function encodeString($string, $version, $level, $hint, $casesensitive)
|
||||
{
|
||||
|
||||
if($hint != QR_MODE_8 && $hint != QR_MODE_KANJI) {
|
||||
throw new Exception('bad hint');
|
||||
return NULL;
|
||||
}
|
||||
|
||||
$input = new QRinput($version, $level);
|
||||
if($input == NULL) return NULL;
|
||||
|
||||
$ret = QRsplit::splitStringToQRinput($string, $input, $hint, $casesensitive);
|
||||
if($ret < 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return $this->encodeInput($input);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
public static function png($text, $outfile = false, $level = QR_ECLEVEL_L, $size = 3, $margin = 4, $saveandprint=false)
|
||||
{
|
||||
$enc = QRencode::factory($level, $size, $margin);
|
||||
return $enc->encodePNG($text, $outfile, $saveandprint=false);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
public static function text($text, $outfile = false, $level = QR_ECLEVEL_L, $size = 3, $margin = 4)
|
||||
{
|
||||
$enc = QRencode::factory($level, $size, $margin);
|
||||
return $enc->encode($text, $outfile);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
public static function raw($text, $outfile = false, $level = QR_ECLEVEL_L, $size = 3, $margin = 4)
|
||||
{
|
||||
$enc = QRencode::factory($level, $size, $margin);
|
||||
return $enc->encodeRAW($text, $outfile);
|
||||
}
|
||||
}
|
||||
|
||||
//##########################################################################
|
||||
|
||||
class FrameFiller {
|
||||
|
||||
public $width;
|
||||
public $frame;
|
||||
public $x;
|
||||
public $y;
|
||||
public $dir;
|
||||
public $bit;
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
public function __construct($width, &$frame)
|
||||
{
|
||||
$this->width = $width;
|
||||
$this->frame = $frame;
|
||||
$this->x = $width - 1;
|
||||
$this->y = $width - 1;
|
||||
$this->dir = -1;
|
||||
$this->bit = -1;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
public function setFrameAt($at, $val)
|
||||
{
|
||||
$this->frame[$at['y']][$at['x']] = chr($val);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
public function getFrameAt($at)
|
||||
{
|
||||
return ord($this->frame[$at['y']][$at['x']]);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
public function next()
|
||||
{
|
||||
do {
|
||||
|
||||
if($this->bit == -1) {
|
||||
$this->bit = 0;
|
||||
return array('x'=>$this->x, 'y'=>$this->y);
|
||||
}
|
||||
|
||||
$x = $this->x;
|
||||
$y = $this->y;
|
||||
$w = $this->width;
|
||||
|
||||
if($this->bit == 0) {
|
||||
$x--;
|
||||
$this->bit++;
|
||||
} else {
|
||||
$x++;
|
||||
$y += $this->dir;
|
||||
$this->bit--;
|
||||
}
|
||||
|
||||
if($this->dir < 0) {
|
||||
if($y < 0) {
|
||||
$y = 0;
|
||||
$x -= 2;
|
||||
$this->dir = 1;
|
||||
if($x == 6) {
|
||||
$x--;
|
||||
$y = 9;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if($y == $w) {
|
||||
$y = $w - 1;
|
||||
$x -= 2;
|
||||
$this->dir = -1;
|
||||
if($x == 6) {
|
||||
$x--;
|
||||
$y -= 8;
|
||||
}
|
||||
}
|
||||
}
|
||||
if($x < 0 || $y < 0) return null;
|
||||
|
||||
$this->x = $x;
|
||||
$this->y = $y;
|
||||
|
||||
} while(ord($this->frame[$y][$x]) & 0x80);
|
||||
|
||||
return array('x'=>$x, 'y'=>$y);
|
||||
}
|
||||
|
||||
} ;
|
||||
|
||||
//##########################################################################
|
||||
|
||||
class QRencode {
|
||||
|
||||
public $casesensitive = true;
|
||||
public $eightbit = false;
|
||||
|
||||
public $version = 0;
|
||||
public $size = 3;
|
||||
public $margin = 4;
|
||||
|
||||
public $structured = 0; // not supported yet
|
||||
|
||||
public $level = QR_ECLEVEL_L;
|
||||
public $hint = QR_MODE_8;
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
public static function factory($level = QR_ECLEVEL_L, $size = 3, $margin = 4)
|
||||
{
|
||||
$enc = new QRencode();
|
||||
$enc->size = $size;
|
||||
$enc->margin = $margin;
|
||||
|
||||
switch ($level.'') {
|
||||
case '0':
|
||||
case '1':
|
||||
case '2':
|
||||
case '3':
|
||||
$enc->level = $level;
|
||||
break;
|
||||
case 'l':
|
||||
case 'L':
|
||||
$enc->level = QR_ECLEVEL_L;
|
||||
break;
|
||||
case 'm':
|
||||
case 'M':
|
||||
$enc->level = QR_ECLEVEL_M;
|
||||
break;
|
||||
case 'q':
|
||||
case 'Q':
|
||||
$enc->level = QR_ECLEVEL_Q;
|
||||
break;
|
||||
case 'h':
|
||||
case 'H':
|
||||
$enc->level = QR_ECLEVEL_H;
|
||||
break;
|
||||
}
|
||||
|
||||
return $enc;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
public function encodeRAW($intext, $outfile = false)
|
||||
{
|
||||
$code = new QRcode();
|
||||
|
||||
if($this->eightbit) {
|
||||
$code->encodeString8bit($intext, $this->version, $this->level);
|
||||
} else {
|
||||
$code->encodeString($intext, $this->version, $this->level, $this->hint, $this->casesensitive);
|
||||
}
|
||||
|
||||
return $code->data;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
public function encode($intext, $outfile = false)
|
||||
{
|
||||
$code = new QRcode();
|
||||
|
||||
if($this->eightbit) {
|
||||
$code->encodeString8bit($intext, $this->version, $this->level);
|
||||
} else {
|
||||
$code->encodeString($intext, $this->version, $this->level, $this->hint, $this->casesensitive);
|
||||
}
|
||||
|
||||
QRtools::markTime('after_encode');
|
||||
|
||||
if ($outfile!== false) {
|
||||
file_put_contents($outfile, join("\n", QRtools::binarize($code->data)));
|
||||
} else {
|
||||
return QRtools::binarize($code->data);
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
public function encodePNG($intext, $outfile = false,$saveandprint=false)
|
||||
{
|
||||
try {
|
||||
|
||||
ob_start();
|
||||
$tab = $this->encode($intext);
|
||||
$err = ob_get_contents();
|
||||
ob_end_clean();
|
||||
|
||||
if ($err != '')
|
||||
QRtools::log($outfile, $err);
|
||||
|
||||
$maxSize = (int)(QR_PNG_MAXIMUM_SIZE / (count($tab)+2*$this->margin));
|
||||
|
||||
QRimage::png($tab, $outfile, min(max(1, $this->size), $maxSize), $this->margin,$saveandprint);
|
||||
|
||||
} catch (Exception $e) {
|
||||
|
||||
QRtools::log($outfile, $e->getMessage());
|
||||
|
||||
}
|
||||
}
|
||||
}
|
95
app/lib/phpqrcode/qrimage.php
Normal file
95
app/lib/phpqrcode/qrimage.php
Normal file
|
@ -0,0 +1,95 @@
|
|||
<?php
|
||||
/*
|
||||
* PHP QR Code encoder
|
||||
*
|
||||
* Image output of code using GD2
|
||||
*
|
||||
* PHP QR Code is distributed under LGPL 3
|
||||
* Copyright (C) 2010 Dominik Dzienia <deltalab at poczta dot fm>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3 of the License, or any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
define('QR_IMAGE', true);
|
||||
|
||||
class QRimage {
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
public static function png($frame, $filename = false, $pixelPerPoint = 4, $outerFrame = 4,$saveandprint=FALSE)
|
||||
{
|
||||
$image = self::image($frame, $pixelPerPoint, $outerFrame);
|
||||
|
||||
if ($filename === false) {
|
||||
Header("Content-type: image/png");
|
||||
ImagePng($image);
|
||||
} else {
|
||||
if($saveandprint===TRUE){
|
||||
ImagePng($image, $filename);
|
||||
header("Content-type: image/png");
|
||||
ImagePng($image);
|
||||
}else{
|
||||
ImagePng($image, $filename);
|
||||
}
|
||||
}
|
||||
|
||||
ImageDestroy($image);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
public static function jpg($frame, $filename = false, $pixelPerPoint = 8, $outerFrame = 4, $q = 85)
|
||||
{
|
||||
$image = self::image($frame, $pixelPerPoint, $outerFrame);
|
||||
|
||||
if ($filename === false) {
|
||||
Header("Content-type: image/jpeg");
|
||||
ImageJpeg($image, null, $q);
|
||||
} else {
|
||||
ImageJpeg($image, $filename, $q);
|
||||
}
|
||||
|
||||
ImageDestroy($image);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
private static function image($frame, $pixelPerPoint = 4, $outerFrame = 4)
|
||||
{
|
||||
$h = count($frame);
|
||||
$w = strlen($frame[0]);
|
||||
|
||||
$imgW = $w + 2*$outerFrame;
|
||||
$imgH = $h + 2*$outerFrame;
|
||||
|
||||
$base_image =ImageCreate($imgW, $imgH);
|
||||
|
||||
$col[0] = ImageColorAllocate($base_image,255,255,255);
|
||||
$col[1] = ImageColorAllocate($base_image,0,0,0);
|
||||
|
||||
imagefill($base_image, 0, 0, $col[0]);
|
||||
|
||||
for($y=0; $y<$h; $y++) {
|
||||
for($x=0; $x<$w; $x++) {
|
||||
if ($frame[$y][$x] == '1') {
|
||||
ImageSetPixel($base_image,$x+$outerFrame,$y+$outerFrame,$col[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$target_image =ImageCreate($imgW * $pixelPerPoint, $imgH * $pixelPerPoint);
|
||||
ImageCopyResized($target_image, $base_image, 0, 0, 0, 0, $imgW * $pixelPerPoint, $imgH * $pixelPerPoint, $imgW, $imgH);
|
||||
ImageDestroy($base_image);
|
||||
|
||||
return $target_image;
|
||||
}
|
||||
}
|
729
app/lib/phpqrcode/qrinput.php
Normal file
729
app/lib/phpqrcode/qrinput.php
Normal file
|
@ -0,0 +1,729 @@
|
|||
<?php
|
||||
/*
|
||||
* PHP QR Code encoder
|
||||
*
|
||||
* Input encoding class
|
||||
*
|
||||
* Based on libqrencode C library distributed under LGPL 2.1
|
||||
* Copyright (C) 2006, 2007, 2008, 2009 Kentaro Fukuchi <fukuchi@megaui.net>
|
||||
*
|
||||
* PHP QR Code is distributed under LGPL 3
|
||||
* Copyright (C) 2010 Dominik Dzienia <deltalab at poczta dot fm>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3 of the License, or any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
define('STRUCTURE_HEADER_BITS', 20);
|
||||
define('MAX_STRUCTURED_SYMBOLS', 16);
|
||||
|
||||
class QRinputItem {
|
||||
|
||||
public $mode;
|
||||
public $size;
|
||||
public $data;
|
||||
public $bstream;
|
||||
|
||||
public function __construct($mode, $size, $data, $bstream = null)
|
||||
{
|
||||
$setData = array_slice($data, 0, $size);
|
||||
|
||||
if (count($setData) < $size) {
|
||||
$setData = array_merge($setData, array_fill(0,$size-count($setData),0));
|
||||
}
|
||||
|
||||
if(!QRinput::check($mode, $size, $setData)) {
|
||||
throw new Exception('Error m:'.$mode.',s:'.$size.',d:'.join(',',$setData));
|
||||
return null;
|
||||
}
|
||||
|
||||
$this->mode = $mode;
|
||||
$this->size = $size;
|
||||
$this->data = $setData;
|
||||
$this->bstream = $bstream;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
public function encodeModeNum($version)
|
||||
{
|
||||
try {
|
||||
|
||||
$words = (int)($this->size / 3);
|
||||
$bs = new QRbitstream();
|
||||
|
||||
$val = 0x1;
|
||||
$bs->appendNum(4, $val);
|
||||
$bs->appendNum(QRspec::lengthIndicator(QR_MODE_NUM, $version), $this->size);
|
||||
|
||||
for($i=0; $i<$words; $i++) {
|
||||
$val = (ord($this->data[$i*3 ]) - ord('0')) * 100;
|
||||
$val += (ord($this->data[$i*3+1]) - ord('0')) * 10;
|
||||
$val += (ord($this->data[$i*3+2]) - ord('0'));
|
||||
$bs->appendNum(10, $val);
|
||||
}
|
||||
|
||||
if($this->size - $words * 3 == 1) {
|
||||
$val = ord($this->data[$words*3]) - ord('0');
|
||||
$bs->appendNum(4, $val);
|
||||
} else if($this->size - $words * 3 == 2) {
|
||||
$val = (ord($this->data[$words*3 ]) - ord('0')) * 10;
|
||||
$val += (ord($this->data[$words*3+1]) - ord('0'));
|
||||
$bs->appendNum(7, $val);
|
||||
}
|
||||
|
||||
$this->bstream = $bs;
|
||||
return 0;
|
||||
|
||||
} catch (Exception $e) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
public function encodeModeAn($version)
|
||||
{
|
||||
try {
|
||||
$words = (int)($this->size / 2);
|
||||
$bs = new QRbitstream();
|
||||
|
||||
$bs->appendNum(4, 0x02);
|
||||
$bs->appendNum(QRspec::lengthIndicator(QR_MODE_AN, $version), $this->size);
|
||||
|
||||
for($i=0; $i<$words; $i++) {
|
||||
$val = (int)QRinput::lookAnTable(ord($this->data[$i*2 ])) * 45;
|
||||
$val += (int)QRinput::lookAnTable(ord($this->data[$i*2+1]));
|
||||
|
||||
$bs->appendNum(11, $val);
|
||||
}
|
||||
|
||||
if($this->size & 1) {
|
||||
$val = QRinput::lookAnTable(ord($this->data[$words * 2]));
|
||||
$bs->appendNum(6, $val);
|
||||
}
|
||||
|
||||
$this->bstream = $bs;
|
||||
return 0;
|
||||
|
||||
} catch (Exception $e) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
public function encodeMode8($version)
|
||||
{
|
||||
try {
|
||||
$bs = new QRbitstream();
|
||||
|
||||
$bs->appendNum(4, 0x4);
|
||||
$bs->appendNum(QRspec::lengthIndicator(QR_MODE_8, $version), $this->size);
|
||||
|
||||
for($i=0; $i<$this->size; $i++) {
|
||||
$bs->appendNum(8, ord($this->data[$i]));
|
||||
}
|
||||
|
||||
$this->bstream = $bs;
|
||||
return 0;
|
||||
|
||||
} catch (Exception $e) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
public function encodeModeKanji($version)
|
||||
{
|
||||
try {
|
||||
|
||||
$bs = new QRbitrtream();
|
||||
|
||||
$bs->appendNum(4, 0x8);
|
||||
$bs->appendNum(QRspec::lengthIndicator(QR_MODE_KANJI, $version), (int)($this->size / 2));
|
||||
|
||||
for($i=0; $i<$this->size; $i+=2) {
|
||||
$val = (ord($this->data[$i]) << 8) | ord($this->data[$i+1]);
|
||||
if($val <= 0x9ffc) {
|
||||
$val -= 0x8140;
|
||||
} else {
|
||||
$val -= 0xc140;
|
||||
}
|
||||
|
||||
$h = ($val >> 8) * 0xc0;
|
||||
$val = ($val & 0xff) + $h;
|
||||
|
||||
$bs->appendNum(13, $val);
|
||||
}
|
||||
|
||||
$this->bstream = $bs;
|
||||
return 0;
|
||||
|
||||
} catch (Exception $e) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
public function encodeModeStructure()
|
||||
{
|
||||
try {
|
||||
$bs = new QRbitstream();
|
||||
|
||||
$bs->appendNum(4, 0x03);
|
||||
$bs->appendNum(4, ord($this->data[1]) - 1);
|
||||
$bs->appendNum(4, ord($this->data[0]) - 1);
|
||||
$bs->appendNum(8, ord($this->data[2]));
|
||||
|
||||
$this->bstream = $bs;
|
||||
return 0;
|
||||
|
||||
} catch (Exception $e) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
public function estimateBitStreamSizeOfEntry($version)
|
||||
{
|
||||
$bits = 0;
|
||||
|
||||
if($version == 0)
|
||||
$version = 1;
|
||||
|
||||
switch($this->mode) {
|
||||
case QR_MODE_NUM: $bits = QRinput::estimateBitsModeNum($this->size); break;
|
||||
case QR_MODE_AN: $bits = QRinput::estimateBitsModeAn($this->size); break;
|
||||
case QR_MODE_8: $bits = QRinput::estimateBitsMode8($this->size); break;
|
||||
case QR_MODE_KANJI: $bits = QRinput::estimateBitsModeKanji($this->size);break;
|
||||
case QR_MODE_STRUCTURE: return STRUCTURE_HEADER_BITS;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
|
||||
$l = QRspec::lengthIndicator($this->mode, $version);
|
||||
$m = 1 << $l;
|
||||
$num = (int)(($this->size + $m - 1) / $m);
|
||||
|
||||
$bits += $num * (4 + $l);
|
||||
|
||||
return $bits;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
public function encodeBitStream($version)
|
||||
{
|
||||
try {
|
||||
|
||||
unset($this->bstream);
|
||||
$words = QRspec::maximumWords($this->mode, $version);
|
||||
|
||||
if($this->size > $words) {
|
||||
|
||||
$st1 = new QRinputItem($this->mode, $words, $this->data);
|
||||
$st2 = new QRinputItem($this->mode, $this->size - $words, array_slice($this->data, $words));
|
||||
|
||||
$st1->encodeBitStream($version);
|
||||
$st2->encodeBitStream($version);
|
||||
|
||||
$this->bstream = new QRbitstream();
|
||||
$this->bstream->append($st1->bstream);
|
||||
$this->bstream->append($st2->bstream);
|
||||
|
||||
unset($st1);
|
||||
unset($st2);
|
||||
|
||||
} else {
|
||||
|
||||
$ret = 0;
|
||||
|
||||
switch($this->mode) {
|
||||
case QR_MODE_NUM: $ret = $this->encodeModeNum($version); break;
|
||||
case QR_MODE_AN: $ret = $this->encodeModeAn($version); break;
|
||||
case QR_MODE_8: $ret = $this->encodeMode8($version); break;
|
||||
case QR_MODE_KANJI: $ret = $this->encodeModeKanji($version);break;
|
||||
case QR_MODE_STRUCTURE: $ret = $this->encodeModeStructure(); break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if($ret < 0)
|
||||
return -1;
|
||||
}
|
||||
|
||||
return $this->bstream->size();
|
||||
|
||||
} catch (Exception $e) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
//##########################################################################
|
||||
|
||||
class QRinput {
|
||||
|
||||
public $items;
|
||||
|
||||
private $version;
|
||||
private $level;
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
public function __construct($version = 0, $level = QR_ECLEVEL_L)
|
||||
{
|
||||
if ($version < 0 || $version > QRSPEC_VERSION_MAX || $level > QR_ECLEVEL_H) {
|
||||
throw new Exception('Invalid version no');
|
||||
return NULL;
|
||||
}
|
||||
|
||||
$this->version = $version;
|
||||
$this->level = $level;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
public function getVersion()
|
||||
{
|
||||
return $this->version;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
public function setVersion($version)
|
||||
{
|
||||
if($version < 0 || $version > QRSPEC_VERSION_MAX) {
|
||||
throw new Exception('Invalid version no');
|
||||
return -1;
|
||||
}
|
||||
|
||||
$this->version = $version;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
public function getErrorCorrectionLevel()
|
||||
{
|
||||
return $this->level;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
public function setErrorCorrectionLevel($level)
|
||||
{
|
||||
if($level > QR_ECLEVEL_H) {
|
||||
throw new Exception('Invalid ECLEVEL');
|
||||
return -1;
|
||||
}
|
||||
|
||||
$this->level = $level;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
public function appendEntry(QRinputItem $entry)
|
||||
{
|
||||
$this->items[] = $entry;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
public function append($mode, $size, $data)
|
||||
{
|
||||
try {
|
||||
$entry = new QRinputItem($mode, $size, $data);
|
||||
$this->items[] = $entry;
|
||||
return 0;
|
||||
} catch (Exception $e) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
public function insertStructuredAppendHeader($size, $index, $parity)
|
||||
{
|
||||
if( $size > MAX_STRUCTURED_SYMBOLS ) {
|
||||
throw new Exception('insertStructuredAppendHeader wrong size');
|
||||
}
|
||||
|
||||
if( $index <= 0 || $index > MAX_STRUCTURED_SYMBOLS ) {
|
||||
throw new Exception('insertStructuredAppendHeader wrong index');
|
||||
}
|
||||
|
||||
$buf = array($size, $index, $parity);
|
||||
|
||||
try {
|
||||
$entry = new QRinputItem(QR_MODE_STRUCTURE, 3, buf);
|
||||
array_unshift($this->items, $entry);
|
||||
return 0;
|
||||
} catch (Exception $e) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
public function calcParity()
|
||||
{
|
||||
$parity = 0;
|
||||
|
||||
foreach($this->items as $item) {
|
||||
if($item->mode != QR_MODE_STRUCTURE) {
|
||||
for($i=$item->size-1; $i>=0; $i--) {
|
||||
$parity ^= $item->data[$i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $parity;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
public static function checkModeNum($size, $data)
|
||||
{
|
||||
for($i=0; $i<$size; $i++) {
|
||||
if((ord($data[$i]) < ord('0')) || (ord($data[$i]) > ord('9'))){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
public static function estimateBitsModeNum($size)
|
||||
{
|
||||
$w = (int)$size / 3;
|
||||
$bits = $w * 10;
|
||||
|
||||
switch($size - $w * 3) {
|
||||
case 1:
|
||||
$bits += 4;
|
||||
break;
|
||||
case 2:
|
||||
$bits += 7;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return $bits;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
public static $anTable = array(
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
36, -1, -1, -1, 37, 38, -1, -1, -1, -1, 39, 40, -1, 41, 42, 43,
|
||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 44, -1, -1, -1, -1, -1,
|
||||
-1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
|
||||
25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
|
||||
);
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
public static function lookAnTable($c)
|
||||
{
|
||||
return (($c > 127)?-1:self::$anTable[$c]);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
public static function checkModeAn($size, $data)
|
||||
{
|
||||
for($i=0; $i<$size; $i++) {
|
||||
if (self::lookAnTable(ord($data[$i])) == -1) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
public static function estimateBitsModeAn($size)
|
||||
{
|
||||
$w = (int)($size / 2);
|
||||
$bits = $w * 11;
|
||||
|
||||
if($size & 1) {
|
||||
$bits += 6;
|
||||
}
|
||||
|
||||
return $bits;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
public static function estimateBitsMode8($size)
|
||||
{
|
||||
return $size * 8;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
public function estimateBitsModeKanji($size)
|
||||
{
|
||||
return (int)(($size / 2) * 13);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
public static function checkModeKanji($size, $data)
|
||||
{
|
||||
if($size & 1)
|
||||
return false;
|
||||
|
||||
for($i=0; $i<$size; $i+=2) {
|
||||
$val = (ord($data[$i]) << 8) | ord($data[$i+1]);
|
||||
if( $val < 0x8140
|
||||
|| ($val > 0x9ffc && $val < 0xe040)
|
||||
|| $val > 0xebbf) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* Validation
|
||||
**********************************************************************/
|
||||
|
||||
public static function check($mode, $size, $data)
|
||||
{
|
||||
if($size <= 0)
|
||||
return false;
|
||||
|
||||
switch($mode) {
|
||||
case QR_MODE_NUM: return self::checkModeNum($size, $data); break;
|
||||
case QR_MODE_AN: return self::checkModeAn($size, $data); break;
|
||||
case QR_MODE_KANJI: return self::checkModeKanji($size, $data); break;
|
||||
case QR_MODE_8: return true; break;
|
||||
case QR_MODE_STRUCTURE: return true; break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
public function estimateBitStreamSize($version)
|
||||
{
|
||||
$bits = 0;
|
||||
|
||||
foreach($this->items as $item) {
|
||||
$bits += $item->estimateBitStreamSizeOfEntry($version);
|
||||
}
|
||||
|
||||
return $bits;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
public function estimateVersion()
|
||||
{
|
||||
$version = 0;
|
||||
$prev = 0;
|
||||
do {
|
||||
$prev = $version;
|
||||
$bits = $this->estimateBitStreamSize($prev);
|
||||
$version = QRspec::getMinimumVersion((int)(($bits + 7) / 8), $this->level);
|
||||
if ($version < 0) {
|
||||
return -1;
|
||||
}
|
||||
} while ($version > $prev);
|
||||
|
||||
return $version;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
public static function lengthOfCode($mode, $version, $bits)
|
||||
{
|
||||
$payload = $bits - 4 - QRspec::lengthIndicator($mode, $version);
|
||||
switch($mode) {
|
||||
case QR_MODE_NUM:
|
||||
$chunks = (int)($payload / 10);
|
||||
$remain = $payload - $chunks * 10;
|
||||
$size = $chunks * 3;
|
||||
if($remain >= 7) {
|
||||
$size += 2;
|
||||
} else if($remain >= 4) {
|
||||
$size += 1;
|
||||
}
|
||||
break;
|
||||
case QR_MODE_AN:
|
||||
$chunks = (int)($payload / 11);
|
||||
$remain = $payload - $chunks * 11;
|
||||
$size = $chunks * 2;
|
||||
if($remain >= 6)
|
||||
$size++;
|
||||
break;
|
||||
case QR_MODE_8:
|
||||
$size = (int)($payload / 8);
|
||||
break;
|
||||
case QR_MODE_KANJI:
|
||||
$size = (int)(($payload / 13) * 2);
|
||||
break;
|
||||
case QR_MODE_STRUCTURE:
|
||||
$size = (int)($payload / 8);
|
||||
break;
|
||||
default:
|
||||
$size = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
$maxsize = QRspec::maximumWords($mode, $version);
|
||||
if($size < 0) $size = 0;
|
||||
if($size > $maxsize) $size = $maxsize;
|
||||
|
||||
return $size;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
public function createBitStream()
|
||||
{
|
||||
$total = 0;
|
||||
|
||||
foreach($this->items as $item) {
|
||||
$bits = $item->encodeBitStream($this->version);
|
||||
|
||||
if($bits < 0)
|
||||
return -1;
|
||||
|
||||
$total += $bits;
|
||||
}
|
||||
|
||||
return $total;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
public function convertData()
|
||||
{
|
||||
$ver = $this->estimateVersion();
|
||||
if($ver > $this->getVersion()) {
|
||||
$this->setVersion($ver);
|
||||
}
|
||||
|
||||
for(;;) {
|
||||
$bits = $this->createBitStream();
|
||||
|
||||
if($bits < 0)
|
||||
return -1;
|
||||
|
||||
$ver = QRspec::getMinimumVersion((int)(($bits + 7) / 8), $this->level);
|
||||
if($ver < 0) {
|
||||
throw new Exception('WRONG VERSION');
|
||||
return -1;
|
||||
} else if($ver > $this->getVersion()) {
|
||||
$this->setVersion($ver);
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
public function appendPaddingBit(&$bstream)
|
||||
{
|
||||
$bits = $bstream->size();
|
||||
$maxwords = QRspec::getDataLength($this->version, $this->level);
|
||||
$maxbits = $maxwords * 8;
|
||||
|
||||
if ($maxbits == $bits) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ($maxbits - $bits < 5) {
|
||||
return $bstream->appendNum($maxbits - $bits, 0);
|
||||
}
|
||||
|
||||
$bits += 4;
|
||||
$words = (int)(($bits + 7) / 8);
|
||||
|
||||
$padding = new QRbitstream();
|
||||
$ret = $padding->appendNum($words * 8 - $bits + 4, 0);
|
||||
|
||||
if($ret < 0)
|
||||
return $ret;
|
||||
|
||||
$padlen = $maxwords - $words;
|
||||
|
||||
if($padlen > 0) {
|
||||
|
||||
$padbuf = array();
|
||||
for($i=0; $i<$padlen; $i++) {
|
||||
$padbuf[$i] = ($i&1)?0x11:0xec;
|
||||
}
|
||||
|
||||
$ret = $padding->appendBytes($padlen, $padbuf);
|
||||
|
||||
if($ret < 0)
|
||||
return $ret;
|
||||
|
||||
}
|
||||
|
||||
$ret = $bstream->append($padding);
|
||||
|
||||
return $ret;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
public function mergeBitStream()
|
||||
{
|
||||
if($this->convertData() < 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$bstream = new QRbitstream();
|
||||
|
||||
foreach($this->items as $item) {
|
||||
$ret = $bstream->append($item->bstream);
|
||||
if($ret < 0) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
return $bstream;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
public function getBitStream()
|
||||
{
|
||||
|
||||
$bstream = $this->mergeBitStream();
|
||||
|
||||
if($bstream == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$ret = $this->appendPaddingBit($bstream);
|
||||
if($ret < 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $bstream;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
public function getByteStream()
|
||||
{
|
||||
$bstream = $this->getBitStream();
|
||||
if($bstream == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $bstream->toByte();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
43
app/lib/phpqrcode/qrlib.php
Normal file
43
app/lib/phpqrcode/qrlib.php
Normal file
|
@ -0,0 +1,43 @@
|
|||
<?php
|
||||
/*
|
||||
* PHP QR Code encoder
|
||||
*
|
||||
* Root library file, prepares environment and includes dependencies
|
||||
*
|
||||
* Based on libqrencode C library distributed under LGPL 2.1
|
||||
* Copyright (C) 2006, 2007, 2008, 2009 Kentaro Fukuchi <fukuchi@megaui.net>
|
||||
*
|
||||
* PHP QR Code is distributed under LGPL 3
|
||||
* Copyright (C) 2010 Dominik Dzienia <deltalab at poczta dot fm>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3 of the License, or any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
$QR_BASEDIR = dirname(__FILE__).DIRECTORY_SEPARATOR;
|
||||
|
||||
// Required libs
|
||||
|
||||
include $QR_BASEDIR."qrconst.php";
|
||||
include $QR_BASEDIR."qrconfig.php";
|
||||
include $QR_BASEDIR."qrtools.php";
|
||||
include $QR_BASEDIR."qrspec.php";
|
||||
include $QR_BASEDIR."qrimage.php";
|
||||
include $QR_BASEDIR."qrinput.php";
|
||||
include $QR_BASEDIR."qrbitstream.php";
|
||||
include $QR_BASEDIR."qrsplit.php";
|
||||
include $QR_BASEDIR."qrrscode.php";
|
||||
include $QR_BASEDIR."qrmask.php";
|
||||
include $QR_BASEDIR."qrencode.php";
|
||||
|
328
app/lib/phpqrcode/qrmask.php
Normal file
328
app/lib/phpqrcode/qrmask.php
Normal file
|
@ -0,0 +1,328 @@
|
|||
<?php
|
||||
/*
|
||||
* PHP QR Code encoder
|
||||
*
|
||||
* Masking
|
||||
*
|
||||
* Based on libqrencode C library distributed under LGPL 2.1
|
||||
* Copyright (C) 2006, 2007, 2008, 2009 Kentaro Fukuchi <fukuchi@megaui.net>
|
||||
*
|
||||
* PHP QR Code is distributed under LGPL 3
|
||||
* Copyright (C) 2010 Dominik Dzienia <deltalab at poczta dot fm>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 3 of the License, or any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
define('N1', 3);
|
||||
define('N2', 3);
|
||||
define('N3', 40);
|
||||
define('N4', 10);
|
||||
|
||||
class QRmask {
|
||||
|
||||
public $runLength = array();
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
public function __construct()
|
||||
{
|
||||
$this->runLength = array_fill(0, QRSPEC_WIDTH_MAX + 1, 0);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
public function writeFormatInformation($width, &$frame, $mask, $level)
|
||||
{
|
||||
$blacks = 0;
|
||||
$format = QRspec::getFormatInfo($mask, $level);
|
||||
|
||||
for($i=0; $i<8; $i++) {
|
||||
if($format & 1) {
|
||||
$blacks += 2;
|
||||
$v = 0x85;
|
||||
} else {
|
||||
$v = 0x84;
|
||||
}
|
||||
|
||||
$frame[8][$width - 1 - $i] = chr($v);
|
||||
if($i < 6) {
|
||||
$frame[$i][8] = chr($v);
|
||||
} else {
|
||||
$frame[$i + 1][8] = chr($v);
|
||||
}
|
||||
$format = $format >> 1;
|
||||
}
|
||||
|
||||
for($i=0; $i<7; $i++) {
|
||||
if($format & 1) {
|
||||
$blacks += 2;
|
||||
$v = 0x85;
|
||||
} else {
|
||||
$v = 0x84;
|
||||
}
|
||||
|
||||
$frame[$width - 7 + $i][8] = chr($v);
|
||||
if($i == 0) {
|
||||
$frame[8][7] = chr($v);
|
||||
} else {
|
||||
$frame[8][6 - $i] = chr($v);
|
||||
}
|
||||
|
||||
$format = $format >> 1;
|
||||
}
|
||||
|
||||
return $blacks;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
public function mask0($x, $y) { return ($x+$y)&1; }
|
||||
public function mask1($x, $y) { return ($y&1); }
|
||||
public function mask2($x, $y) { return ($x%3); }
|
||||
public function mask3($x, $y) { return ($x+$y)%3; }
|
||||
public function mask4($x, $y) { return (((int)($y/2))+((int)($x/3)))&1; }
|
||||
public function mask5($x, $y) { return (($x*$y)&1)+($x*$y)%3; }
|
||||
public function mask6($x, $y) { return ((($x*$y)&1)+($x*$y)%3)&1; }
|
||||
public function mask7($x, $y) { return ((($x*$y)%3)+(($x+$y)&1))&1; }
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
private function generateMaskNo($maskNo, $width, $frame)
|
||||
{
|
||||
$bitMask = array_fill(0, $width, array_fill(0, $width, 0));
|
||||
|
||||
for($y=0; $y<$width; $y++) {
|
||||
for($x=0; $x<$width; $x++) {
|
||||
if(ord($frame[$y][$x]) & 0x80) {
|
||||
$bitMask[$y][$x] = 0;
|
||||
} else {
|
||||
$maskFunc = call_user_func(array($this, 'mask'.$maskNo), $x, $y);
|
||||
$bitMask[$y][$x] = ($maskFunc == 0)?1:0;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return $bitMask;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
public static function serial($bitFrame)
|
||||
{
|
||||
$codeArr = array();
|
||||
|
||||
foreach ($bitFrame as $line)
|
||||
$codeArr[] = join('', $line);
|
||||
|
||||
return gzcompress(join("\n", $codeArr), 9);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
public static function unserial($code)
|
||||
{
|
||||
$codeArr = array();
|
||||
|
||||
$codeLines = explode("\n", gzuncompress($code));
|
||||
foreach ($codeLines as $line)
|
||||
$codeArr[] = str_split($line);
|
||||
|
||||
return $codeArr;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
public function makeMaskNo($maskNo, $width, $s, &$d, $maskGenOnly = false)
|
||||
{
|
||||
$b = 0;
|
||||
$bitMask = array();
|
||||
|
||||
$fileName = QR_CACHE_DIR.'mask_'.$maskNo.DIRECTORY_SEPARATOR.'mask_'.$width.'_'.$maskNo.'.dat';
|
||||
|
||||
if (QR_CACHEABLE) {
|
||||
if (file_exists($fileName)) {
|
||||
$bitMask = self::unserial(file_get_contents($fileName));
|
||||
} else {
|
||||
$bitMask = $this->generateMaskNo($maskNo, $width, $s, $d);
|
||||
if (!file_exists(QR_CACHE_DIR.'mask_'.$maskNo))
|
||||
mkdir(QR_CACHE_DIR.'mask_'.$maskNo);
|
||||
file_put_contents($fileName, self::serial($bitMask));
|
||||
}
|
||||
} else {
|
||||
$bitMask = $this->generateMaskNo($maskNo, $width, $s, $d);
|
||||
}
|
||||
|
||||
if ($maskGenOnly)
|
||||
return;
|
||||
|
||||
$d = $s;
|
||||
|
||||
for($y=0; $y<$width; $y++) {
|
||||
for($x=0; $x<$width; $x++) {
|
||||
if($bitMask[$y][$x] == 1) {
|
||||
$d[$y][$x] = chr(ord($s[$y][$x]) ^ (int)$bitMask[$y][$x]);
|
||||
}
|
||||
$b += (int)(ord($d[$y][$x]) & 1);
|
||||
}
|
||||
}
|
||||
|
||||
return $b;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
public function makeMask($width, $frame, $maskNo, $level)
|
||||
{
|
||||