diff --git a/agents/intermediate/CharactergroupsqueststationsAgent.inc b/agents/intermediate/CharactergroupsqueststationsAgent.inc
index 5799d070..9de435b3 100644
--- a/agents/intermediate/CharactergroupsqueststationsAgent.inc
+++ b/agents/intermediate/CharactergroupsqueststationsAgent.inc
@@ -73,6 +73,19 @@
}
+ /**
+ * 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.
*
diff --git a/app/controllers/StationtypeController.inc b/app/controllers/StationtypeController.inc
index ee9df722..8f0728a5 100644
--- a/app/controllers/StationtypeController.inc
+++ b/app/controllers/StationtypeController.inc
@@ -71,6 +71,19 @@
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);
+
+
/**
diff --git a/configs/AppConfig.inc b/configs/AppConfig.inc
index 28326f18..585f6723 100644
--- a/configs/AppConfig.inc
+++ b/configs/AppConfig.inc
@@ -305,10 +305,10 @@
array('^charactergroupsquests/([^/]+)/([^/]+)/create/?$', 'charactergroupsquests/create/$1/$2', true),
array('^charactergroupsquests/([^/]+)/([^/]+)/([^/]+)/?$', 'charactergroupsquests/quest/$1/$2/$3', true),
array('^charactergroupsquests/([^/]+)/([^/]+)/([^/]+)/(edit|delete|manage)/?$', 'charactergroupsquests/$4/$1/$2/$3', true),
- array('^charactergroupsqueststations/([^/]+)/([^/]+)/([^/]+)/?$', 'charactergroupsqueststations/index/$1/$2/$3?layout=ajax', true),
- array('^charactergroupsqueststations/([^/]+)/([^/]+)/([^/]+)/create/?$', 'charactergroupsqueststations/create/$1/$2/$3', true),
- array('^charactergroupsqueststations/([^/]+)/([^/]+)/([^/]+)/([^/]+)/(edit|delete)/?$', 'charactergroupsqueststations/$5/$1/$2/$3/$4', true),
- array('^charactergroupsqueststations/([^/]+)/([^/]+)/([^/]+)/([^/]+)/?$', 'charactergroupsqueststations/station/$1/$2/$3/$4', true),
+ array('^charactergroupsqueststations/([^/]+)/([^/]+)/([^/]+)/?$', 'charactergroupsqueststations/index/$1/$2/$3?layout=ajax', true),
+ array('^charactergroupsqueststations/([^/]+)/([^/]+)/([^/]+)/create/?$', 'charactergroupsqueststations/create/$1/$2/$3', true),
+ array('^charactergroupsqueststations/([^/]+)/([^/]+)/([^/]+)/([^/]+)/(edit|edittask|delete)/?$', 'charactergroupsqueststations/$5/$1/$2/$3/$4', true),
+ array('^charactergroupsqueststations/([^/]+)/([^/]+)/([^/]+)/([^/]+)/?$', 'charactergroupsqueststations/station/$1/$2/$3/$4', true),
array('^achievements/([^/]+)/(create|manage)/?$', 'achievements/$2/$1', true),
array('^achievements/([^/]+)/([^/]+)/(edit|conditions|moveup|movedown|delete)/?$', 'achievements/$3/$1/$2', true),
array('^achievements/([^/]+)/?$', 'achievements/index/$1', true),
@@ -364,9 +364,9 @@
array('^charactergroupsquests/create/([^/]+)/([^/]+)/?$', 'charactergroupsquests/$1/$2/create', true),
array('^charactergroupsquests/quest/(.*)$', 'charactergroupsquests/$1', true),
array('^charactergroupsquests/(edit|delete|manage)/([^/]+)/([^/]+)/([^/]+)$', 'charactergroupsquests/$2/$3/$4/$1', true),
- array('^charactergroupsqueststations/index/(.*)$', 'charactergroupsqueststations/$1', true),
- array('^charactergroupsqueststations/station/(.*)$', 'charactergroupsqueststations/$1', true),
- array('^charactergroupsqueststations/(create|edit|delete)/(.*)$', 'charactergroupsqueststations/$2/$1', true),
+ array('^charactergroupsqueststations/index/(.*)$', 'charactergroupsqueststations/$1', true),
+ array('^charactergroupsqueststations/station/(.*)$', 'charactergroupsqueststations/$1', true),
+ array('^charactergroupsqueststations/(create|edit|edittask|delete)/(.*)$', 'charactergroupsqueststations/$2/$1', true),
array('^achievements/index/(.*)$', 'achievements/$1', true),
array('^achievements/(create|manage)/(.*)$', 'achievements/$2/$1', true),
array('^achievements/(edit|conditions|moveup|movedown|delete)/(.*)$', 'achievements/$2/$1', true),
diff --git a/controllers/CharactergroupsqueststationsController.inc b/controllers/CharactergroupsqueststationsController.inc
index 6300524d..79b98f1d 100644
--- a/controllers/CharactergroupsqueststationsController.inc
+++ b/controllers/CharactergroupsqueststationsController.inc
@@ -394,7 +394,7 @@
// Get Quest types
$stationtypes = $this->Stationtypes->getStationtypes();
foreach($stationtypes as &$stationtype) {
- $stationtype['selected'] = false;
+ $stationtype['selected'] = ($stationtype['id'] == $station['stationtype_id']);
}
// Get allowed mimetypes
@@ -497,19 +497,37 @@
}
}
- // Redirect to Station page
- $this->redirect(
- $this->linker->link(
- array(
- 'station',
- $seminary['url'],
- $groupsgroup['url'],
- $quest['url'],
- $station['url']
- ),
- 1
- )
- );
+ // Redirect
+ if(!is_null($this->request->getPostParam('edit-task'))) {
+ // To task editing
+ $this->redirect(
+ $this->linker->link(
+ array(
+ 'edittask',
+ $seminary['url'],
+ $groupsgroup['url'],
+ $quest['url'],
+ $station['url']
+ ),
+ 1
+ )
+ );
+ }
+ else {
+ // To Station page
+ $this->redirect(
+ $this->linker->link(
+ array(
+ 'station',
+ $seminary['url'],
+ $groupsgroup['url'],
+ $quest['url'],
+ $station['url']
+ ),
+ 1
+ )
+ );
+ }
}
}
@@ -537,6 +555,54 @@
}
+ /**
+ * TODO Action: edittask.
+ *
+ * Edit the task of a Character groups Quest Station.
+ *
+ * @throws \nre\exceptions\IdNotFoundException
+ * @param string $seminaryUrl URL-Title of a Seminary
+ * @param string $groupsgroupUrl URL-Title of a Character groups-group
+ * @param string $questUrl URL-Title of a Character groups Quest
+ * @param string $stationUrl URL of station
+ */
+ public function edittask($seminaryUrl, $groupsgroupUrl, $questUrl, $stationUrl)
+ {
+ // Get seminary
+ $seminary = $this->Seminaries->getSeminaryByUrl($seminaryUrl);
+
+ // Get Character groups-group
+ $groupsgroup = $this->Charactergroups->getGroupsgroupByUrl($seminary['id'], $groupsgroupUrl);
+
+ // Get Character groups-group Quests
+ $quest = $this->Charactergroupsquests->getQuestByUrl($groupsgroup['id'], $questUrl);
+
+ // Get Station
+ $station = $this->Charactergroupsqueststations->getStationByUrl($quest['id'], $stationUrl);
+
+ // Render editing task
+ $task = null;
+ $stationtype = $this->Stationtypes->getStationtypeById($station['stationtype_id']);
+ if(!is_null($stationtype['classname'])) {
+ $task = $this->renderTaskEditing($stationtype['classname'], $seminary, $groupsgroup, $quest, $station);
+ }
+
+
+ // Set title
+ $this->addTitleLocalized('Edit Station task');
+ $this->addTitle($station['title']);
+ $this->addTitle($quest['title']);
+ $this->addTitle($groupsgroup['name']);
+ $this->addTitle($seminary['title']);
+
+ // Pass data to view
+ $this->set('seminary', $seminary);
+ $this->set('groupsgroup', $groupsgroup);
+ $this->set('quest', $quest);
+ $this->set('task', $task);
+ }
+
+
/**
* Action: delete.
*
@@ -735,6 +801,61 @@
}
+ /**
+ * Render editing of a Station task.
+ *
+ * @param string $stationtypeClassname Name of the class for the Stationtype of a Station
+ * @param array $seminary Seminary data
+ * @param array $groupsgroup Groupsgroup data
+ * @param array $quest Quest data
+ * @param array $station Station data
+ * @return string Rendered output
+ */
+ private function renderTaskEditing($stationtypeClassname, $seminary, $groupsgroup, $quest, $station)
+ {
+ $task = null;
+ try {
+ // Generate request and response
+ $request = clone $this->request;
+ $response = $this->createStationtypeResponse('edittask', $seminary, $groupsgroup, $quest, $station);
+
+ // Load Stationtype Agent
+ $stationtypeAgent = $this->loadStationtypeAgent($stationtypeClassname, $request, $response);
+
+ // Render Task
+ $task = $this->runStationtypeAgent($stationtypeAgent, $request, $response);
+ }
+ catch(\nre\exceptions\ViewNotFoundException $e) {
+ $task = $e->getMessage();
+ }
+ catch(\nre\exceptions\ActionNotFoundException $e) {
+ $task = $e->getMessage();
+ }
+ catch(\hhu\z\exceptions\StationtypeModelNotValidException $e) {
+ $task = $e->getMessage();
+ }
+ catch(\hhu\z\exceptions\StationtypeModelNotFoundException $e) {
+ $task = $e->getMessage();
+ }
+ catch(\hhu\z\exceptions\StationtypeControllerNotValidException $e) {
+ $task = $e->getMessage();
+ }
+ catch(\hhu\z\exceptions\StationtypeControllerNotFoundException $e) {
+ $task = $e->getMessage();
+ }
+ catch(\hhu\z\exceptions\StationtypeAgentNotValidException $e) {
+ $task = $e->getMessage();
+ }
+ catch(\hhu\z\exceptions\stationtypeAgentNotFoundException $e) {
+ $task = $e->getMessage();
+ }
+
+
+ // Return rendered output
+ return $task;
+ }
+
+
/**
* Create a response for the Stationtype rendering.
*
diff --git a/views/html/charactergroupsqueststations/edit.tpl b/views/html/charactergroupsqueststations/edit.tpl
index 6796ace1..c2f9be7c 100644
--- a/views/html/charactergroupsqueststations/edit.tpl
+++ b/views/html/charactergroupsqueststations/edit.tpl
@@ -91,7 +91,10 @@
-
+
+
+
+