Skip to content

Commit

Permalink
Dev WIP More refactoring / fixing in EM.
Browse files Browse the repository at this point in the history
  • Loading branch information
SamMousa committed Jul 28, 2015
1 parent 2af9e60 commit a86efea
Show file tree
Hide file tree
Showing 6 changed files with 121 additions and 480 deletions.
2 changes: 1 addition & 1 deletion application/components/SurveySession.php
Expand Up @@ -316,7 +316,7 @@ public function getGroupByIndex($index) {
if (!is_numeric($index)) {
throw new \InvalidArgumentException("\$index must of type integer");
}
return $this->getGroups()[$index - 1];
return $this->getGroups()[$index];

}

Expand Down
5 changes: 1 addition & 4 deletions application/helpers/SurveyRuntimeHelper.php
Expand Up @@ -663,17 +663,14 @@ function run($surveyid,$args) {
$qnumber = 0;

if (isset($stepInfo) && !isset($stepInfo['gid'])) {
var_dump($stepInfo); die();
throw new \Exception(print_r($stepInfo, true));
}
if ($session->format != Survey::FORMAT_ALL_IN_ONE
&& isset($stepInfo)
&& $stepInfo['gid'] != $gid) {
continue;
}

// TMSW - could iterate through LEM::currentQset instead
// var_dump($ssm->current->getFieldArray());
// die();
foreach ($session->fieldArray as $key => $ia)
{
++$qnumber;
Expand Down
24 changes: 24 additions & 0 deletions application/helpers/common_helper.php
Expand Up @@ -12,6 +12,30 @@
*/
Yii::import('application.helpers.sanitize_helper', true);

/**
* Helperfunction for debugging.
*/
function vd($arg) {
if (defined('YII_DEBUG') && YII_DEBUG) {
$trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 3);
if ($trace[1]['function'] == 'vdd') {
$details = $trace[2];
} else {
$details = $trace[1];

}
$class = \TbArray::getValue('class', $details, 'Global function');
$token = "{$class}::{$details['function']}";

echo TbHtml::well("Dumped from: " . $token . '<br>'. CVarDumper::dumpAsString($arg, 10, true), [
'style' => 'text-align: left;'
]);
}
}

function vdd($arg) {
vd($arg); die();
}
/**
* Helper function for profiling.
* @param string $key The key to be appended.
Expand Down

0 comments on commit a86efea

Please sign in to comment.