Skip to content

Commit

Permalink
Fixed issue #6779: Detailed Summary of surveys not shown if a survey …
Browse files Browse the repository at this point in the history
…owner was deleted

Fixed issue: Token information in survey list incorrect
  • Loading branch information
c-schmitz committed Nov 2, 2012
1 parent d2c8d67 commit 658f835
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 21 deletions.
4 changes: 3 additions & 1 deletion application/controllers/admin/surveyadmin.php
Expand Up @@ -595,9 +595,11 @@ public function getSurveys_json()
$surveys = $surveys->with(array('languagesettings'=>array('condition'=>'surveyls_language=language'), 'owner'))->findAll();
$aSurveyEntries = new stdClass();
$aSurveyEntries->page = 1;

foreach ($surveys as $rows)
{
$rows = array_merge($rows->attributes, $rows->languagesettings[0]->attributes, $rows->owner->attributes);
if (!isset($rows->owner->attributes)) $aOwner=array('users_name'=>$clang->gT('(None)')); else $aOwner=$rows->owner->attributes;
$rows = array_merge($rows->attributes, $rows->languagesettings[0]->attributes, $aOwner);
if($rows['users_name'] == Yii::app()->session['user'] || Yii::app()->session['USER_RIGHT_SUPERADMIN'] == 1)//If is owner or superadmin show survey.
{
$aSurveyEntry = array();
Expand Down
46 changes: 26 additions & 20 deletions application/models/Tokens_dynamic.php
Expand Up @@ -10,25 +10,11 @@
* other free or open source software licenses.
* See COPYRIGHT.php for copyright notices and details.
*
* $Id$
* Files Purpose: lots of common functions
*/

class Tokens_dynamic extends LSActiveRecord
{ protected static $sid = 0;

/**
* Sets the survey ID for the next model
*
* @static
* @access public
* @param int $sid
* @return void
*/
public static function sid($sid)
{
self::$sid = (int) $sid;
}
{
protected static $sid = 0;

/**
* Returns the static model of Settings table
Expand All @@ -38,12 +24,32 @@ public static function sid($sid)
* @param int $surveyid
* @return Tokens_dynamic
*/
public static function model($sid = null)
public static function model($sid = NULL)
{
if (!is_null($sid))
$refresh = false;
if (!is_null($sid)) {
self::sid($sid);

return parent::model(__CLASS__);
$refresh = true;
}

$model = parent::model(__CLASS__);

//We need to refresh if we changed sid
if ($refresh === true) $model->refreshMetaData();
return $model;
}

/**
* Sets the survey ID for the next model
*
* @static
* @access public
* @param int $sid
* @return void
*/
public static function sid($sid)
{
self::$sid = (int) $sid;
}

/**
Expand Down

0 comments on commit 658f835

Please sign in to comment.