Show a "View Full result" within a survey

Permalink
I've searched the site, documentation, developers how to's and the forums but couldn't obtain/find the needed information.

Within the survey block in the view.php file at around line 60 there's a code that mentions the View full results:

<?php if($_GET['dontGraphPoll']){ ?>
      <div class="small right" style="margin-top:8px"><a class="arrow" href="<?php echo DIR_REL?>/?cID=<?php echo $b->getBlockCollectionID() ?>"><?php echo t('View Full Results')?></a></div>
   <?php  } ?>


I tried to add that line (without the if($_GET['dontGraphPoll'])...) to the else statement, so that IF the user didn't submit a vote he/she could see the full results. But will not work.

I searched the cms for an option and it's no where to be found.

So now I ask; Is there a way to write it so even if the user didn't submit a vote they can view the full results?

I have good knowledge of Concrete5 and PHP, you don't need to explain every steps :)

Thank you for your time and patience.

Tallfrog
 
Tallfrog replied on at Permalink Reply
Tallfrog
I was able to modify the view.php document to my needs.

The following statement:
if ($controller->hasVoted())

was moved below:

<?php  
      //available chart colors are duplicated in content/surveys.php
      $availableChartColors=array('00CCdd','cc3333','330099','FF6600','9966FF','dd7700','66DD00','6699FF','FFFF33','FFCC33','00CCdd','cc3333','330099','FF6600','9966FF','dd7700','66DD00','6699FF','FFFF33','FFCC33');
      $options = $controller->getPollOptions();
      $optionNames=array();
      $optionResults=array();
      $graphColors=array();
      $i = 1;
      $totalVotes=0;
      foreach($options as $opt) { 
         $optionNamesAbbrev[] = $i;
         $optionResults[]=$opt->getResults();
         $i++;
         $graphColors[]=array_pop($availableChartColors);
         $totalVotes+=intval($opt->getResults());


This way, I was able to add the background-color options, pie-chart and total views for the user who didn't place a vote. I also modify the number of received views so that if views = to 0, echo "No votes".

It might be a good idea to create a template folder!

This method currently works for me and PHP didn't issue errors.