|
From: <gem...@li...> - 2012-11-21 15:10:42
|
Revision: 1024
http://gemstracker.svn.sourceforge.net/gemstracker/?rev=1024&view=rev
Author: matijsdejong
Date: 2012-11-21 15:10:31 +0000 (Wed, 21 Nov 2012)
Log Message:
-----------
When there are no answers the answer headers are shown in OnlyAnswered.php
FixBugfixes in maintenance actions
Modified Paths:
--------------
trunk/library/classes/Gems/Default/SurveyMaintenanceAction.php
trunk/library/classes/Gems/Default/TrackMaintenanceAction.php
trunk/library/classes/Gems/Event/Survey/Display/OnlyAnswered.php
trunk/library/classes/Gems/Event/SurveyAnswerFilterAbstract.php
Modified: trunk/library/classes/Gems/Default/SurveyMaintenanceAction.php
===================================================================
--- trunk/library/classes/Gems/Default/SurveyMaintenanceAction.php 2012-11-16 16:47:15 UTC (rev 1023)
+++ trunk/library/classes/Gems/Default/SurveyMaintenanceAction.php 2012-11-21 15:10:31 UTC (rev 1024)
@@ -248,7 +248,7 @@
*/
public function afterSave(array $data, $isNew)
{
- $this->cache->clean('matchTags', array('surveys', 'tracks'));
+ $this->cache->clean(Zend_Cache::CLEANING_MODE_MATCHING_ANY_TAG, array('surveys', 'tracks'));
return true;
}
Modified: trunk/library/classes/Gems/Default/TrackMaintenanceAction.php
===================================================================
--- trunk/library/classes/Gems/Default/TrackMaintenanceAction.php 2012-11-16 16:47:15 UTC (rev 1023)
+++ trunk/library/classes/Gems/Default/TrackMaintenanceAction.php 2012-11-21 15:10:31 UTC (rev 1024)
@@ -161,7 +161,7 @@
*/
public function afterSave(array $data, $isNew)
{
- $this->cache->clean('matchTags', array('surveys', 'tracks'));
+ $this->cache->clean(Zend_Cache::CLEANING_MODE_MATCHING_ANY_TAG, array('surveys', 'tracks'));
return true;
}
Modified: trunk/library/classes/Gems/Event/Survey/Display/OnlyAnswered.php
===================================================================
--- trunk/library/classes/Gems/Event/Survey/Display/OnlyAnswered.php 2012-11-16 16:47:15 UTC (rev 1023)
+++ trunk/library/classes/Gems/Event/Survey/Display/OnlyAnswered.php 2012-11-21 15:10:31 UTC (rev 1024)
@@ -74,10 +74,16 @@
$keys += array_filter($row->getArrayCopy());
}
- $results = array_intersect($currentNames, array_keys($keys));
+ $results = array_intersect($currentNames, array_keys($keys), array_keys($this->token->getRawAnswers()));
// MUtil_Echo::track($results);
- return $this->restoreHeaderPositions($model, $results);
+ $results = $this->restoreHeaderPositions($model, $results);
+
+ if ($results) {
+ return $results;
+ }
+
+ return $this->getHeaders($model, $currentNames);
}
/**
Modified: trunk/library/classes/Gems/Event/SurveyAnswerFilterAbstract.php
===================================================================
--- trunk/library/classes/Gems/Event/SurveyAnswerFilterAbstract.php 2012-11-16 16:47:15 UTC (rev 1023)
+++ trunk/library/classes/Gems/Event/SurveyAnswerFilterAbstract.php 2012-11-21 15:10:31 UTC (rev 1024)
@@ -87,6 +87,30 @@
// public function getEventName()
/**
+ * Returns only the headers
+ *
+ * @param MUtil_Model_ModelAbstract $model
+ * @param array $currentNames The current names in use (allows chaining)
+ * @return array Of the names of labels that should be shown
+ */
+ protected function getHeaders(MUtil_Model_ModelAbstract $model, array $currentNames)
+ {
+ $lastParent = null;
+ $results = array();
+ foreach ($currentNames as $name) {
+ if ($model->is($name, 'type', MUtil_Model::TYPE_NOVALUE)) {
+ $results[$name] = $name;
+
+ } elseif ($parent = $model->get($name, 'parent_question')) {
+ // Insert parent header on name if it was not shown before
+ $results[$parent] = $parent;
+ }
+ }
+
+ return $results;
+ }
+
+ /**
* Restores the header position of question before their corresponding question_sub
*
* When sub-questions with the same parent are shown continuous the parent is shown
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|