Ejemplo n.º 1
0
 /**
  * Shows admin menu for surveys
  * @param int Survey id
  */
 function _surveybar($iSurveyID, $gid = null)
 {
     //$this->load->helper('surveytranslator');
     $clang = $this->getController()->lang;
     //echo Yii::app()->getConfig('gid');
     $baselang = Survey::model()->findByPk($iSurveyID)->language;
     $condition = array('sid' => $iSurveyID, 'language' => $baselang);
     //$sumquery1 = "SELECT * FROM ".db_table_name('surveys')." inner join ".db_table_name('surveys_languagesettings')." on (surveyls_survey_id=sid and surveyls_language=language) WHERE sid=$iSurveyID"; //Getting data for this survey
     $sumresult1 = Survey::model()->with(array('languagesettings' => array('condition' => 'surveyls_language=language')))->findByPk($iSurveyID);
     //$sumquery1, 1) ; //Checked
     if (is_null($sumresult1)) {
         Yii::app()->session['flashmessage'] = $clang->gT("Invalid survey ID");
         $this->getController()->redirect($this->getController()->createUrl("admin/index"));
     }
     //  if surveyid is invalid then die to prevent errors at a later time
     $surveyinfo = $sumresult1->attributes;
     $surveyinfo = array_merge($surveyinfo, $sumresult1->languagesettings[0]->attributes);
     $surveyinfo = array_map('flattenText', $surveyinfo);
     //$surveyinfo = array_map('htmlspecialchars', $surveyinfo);
     $activated = $surveyinfo['active'] == 'Y';
     $js_admin_includes[] = Yii::app()->getConfig('generalscripts') . 'jquery/jquery.coookie.js';
     $js_admin_includes[] = Yii::app()->getConfig('generalscripts') . 'jquery/superfish.js';
     $js_admin_includes[] = Yii::app()->getConfig('generalscripts') . 'jquery/hoverIntent.js';
     $js_admin_includes[] = Yii::app()->getConfig('adminscripts') . 'surveytoolbar.js';
     $this->getController()->_js_admin_includes($js_admin_includes);
     //Parse data to send to view
     $aData['clang'] = $clang;
     $aData['surveyinfo'] = $surveyinfo;
     $aData['surveyid'] = $iSurveyID;
     // ACTIVATE SURVEY BUTTON
     $aData['activated'] = $activated;
     $condition = array('sid' => $iSurveyID, 'parent_qid' => 0, 'language' => $baselang);
     //$sumquery3 =  "SELECT * FROM ".db_table_name('questions')." WHERE sid={$iSurveyID} AND parent_qid=0 AND language='".$baselang."'"; //Getting a count of questions for this survey
     $sumresult3 = Questions::model()->findAllByAttributes($condition);
     //Checked
     $sumcount3 = count($sumresult3);
     $aData['canactivate'] = $sumcount3 > 0 && hasSurveyPermission($iSurveyID, 'surveyactivation', 'update');
     $aData['candeactivate'] = hasSurveyPermission($iSurveyID, 'surveyactivation', 'update');
     $aData['expired'] = $surveyinfo['expires'] != '' && $surveyinfo['expires'] < dateShift(date("Y-m-d H:i:s"), "Y-m-d H:i", Yii::app()->getConfig('timeadjust'));
     $aData['notstarted'] = $surveyinfo['startdate'] != '' && $surveyinfo['startdate'] > dateShift(date("Y-m-d H:i:s"), "Y-m-d H:i", Yii::app()->getConfig('timeadjust'));
     // Start of suckerfish menu
     // TEST BUTTON
     if (!$activated) {
         $aData['icontext'] = $clang->gT("Test this survey");
     } else {
         $aData['icontext'] = $clang->gT("Execute this survey");
     }
     $aData['baselang'] = Survey::model()->findByPk($iSurveyID)->language;
     $tmp_survlangs = Survey::model()->findByPk($iSurveyID)->getAdditionalLanguages();
     $aData['onelanguage'] = count($tmp_survlangs) == 0;
     $aData['additionallanguages'] = $tmp_survlangs;
     $tmp_survlangs[] = $aData['baselang'];
     rsort($tmp_survlangs);
     $aData['languagelist'] = $tmp_survlangs;
     $aData['hasadditionallanguages'] = count($aData['additionallanguages']) > 0;
     // EDIT SURVEY TEXT ELEMENTS BUTTON
     $aData['surveylocale'] = hasSurveyPermission($iSurveyID, 'surveylocale', 'read');
     // EDIT SURVEY SETTINGS BUTTON
     $aData['surveysettings'] = hasSurveyPermission($iSurveyID, 'surveysettings', 'read');
     // Survey permission item
     $aData['surveysecurity'] = Yii::app()->session['USER_RIGHT_SUPERADMIN'] == 1 || $surveyinfo['owner_id'] == Yii::app()->session['loginID'] || hasSurveyPermission($iSurveyID, 'surveysecurity', 'read');
     // CHANGE QUESTION GROUP ORDER BUTTON
     $aData['surveycontent'] = hasSurveyPermission($iSurveyID, 'surveycontent', 'read');
     $aData['groupsum'] = getGroupSum($iSurveyID, $surveyinfo['language']) > 1;
     // SET SURVEY QUOTAS BUTTON
     $aData['quotas'] = hasSurveyPermission($iSurveyID, 'quotas', 'read');
     // Assessment menu item
     $aData['assessments'] = hasSurveyPermission($iSurveyID, 'assessments', 'read');
     // EDIT SURVEY TEXT ELEMENTS BUTTON
     // End if survey properties
     // Tools menu item
     // Delete survey item
     $aData['surveydelete'] = hasSurveyPermission($iSurveyID, 'survey', 'delete');
     // Translate survey item
     $aData['surveytranslate'] = hasSurveyPermission($iSurveyID, 'translations', 'read');
     // RESET SURVEY LOGIC BUTTON
     //$sumquery6 = "SELECT count(*) FROM ".db_table_name('conditions')." as c, ".db_table_name('questions')." as q WHERE c.qid = q.qid AND q.sid=$iSurveyID"; //Getting a count of conditions for this survey
     // TMSW Conditions->Relevance:  How is conditionscount used?  Should Relevance do the same?
     $iConditionCount = Conditions::model()->with(array('questions' => array('condition' => 'sid =' . $iSurveyID)))->count();
     $aData['surveycontent'] = hasSurveyPermission($iSurveyID, 'surveycontent', 'update');
     $aData['conditionscount'] = $iConditionCount > 0;
     // Eport menu item
     $aData['surveyexport'] = hasSurveyPermission($iSurveyID, 'surveycontent', 'export');
     // PRINTABLE VERSION OF SURVEY BUTTON
     // SHOW PRINTABLE AND SCANNABLE VERSION OF SURVEY BUTTON
     //browse responses menu item
     $aData['respstatsread'] = hasSurveyPermission($iSurveyID, 'responses', 'read') || hasSurveyPermission($iSurveyID, 'statistics', 'read') || hasSurveyPermission($iSurveyID, 'responses', 'export');
     // Data entry screen menu item
     $aData['responsescreate'] = hasSurveyPermission($iSurveyID, 'responses', 'create');
     $aData['responsesread'] = hasSurveyPermission($iSurveyID, 'responses', 'read');
     // TOKEN MANAGEMENT BUTTON
     $aData['tokenmanagement'] = hasSurveyPermission($iSurveyID, 'surveysettings', 'update') || hasSurveyPermission($iSurveyID, 'tokens', 'read');
     $aData['gid'] = $gid;
     // = $this->input->post('gid');
     if (hasSurveyPermission($iSurveyID, 'surveycontent', 'read')) {
         $aData['permission'] = true;
     } else {
         $aData['gid'] = $gid = null;
         $qid = null;
         $aData['permission'] = false;
     }
     if (getGroupListLang($gid, $baselang, $iSurveyID)) {
         $aData['groups'] = getGroupListLang($gid, $baselang, $iSurveyID);
     } else {
         $aData['groups'] = "<option>" . $clang->gT("None") . "</option>";
     }
     $aData['GidPrev'] = $GidPrev = getGidPrevious($iSurveyID, $gid);
     $aData['GidNext'] = $GidNext = getGidNext($iSurveyID, $gid);
     $aData['iIconSize'] = Yii::app()->getConfig('adminthemeiconsize');
     $aData['sImageURL'] = Yii::app()->getConfig('adminimageurl');
     $this->getController()->render("/admin/survey/surveybar_view", $aData);
 }
 /**
  * Shows admin menu for surveys
  * @param int Survey id
  */
 function _surveybar($aData)
 {
     if (isset($aData['surveybar'])) {
         $iSurveyID = $aData['surveyid'];
         $oSurvey = $aData['oSurvey'];
         $gid = isset($aData['gid']) ? $aData['gid'] : null;
         $surveyinfo = isset($aData['surveyinfo']) ? $aData['surveyinfo'] : $oSurvey->surveyinfo;
         $baselang = $surveyinfo['language'];
         $activated = $surveyinfo['active'] == 'Y';
         App()->getClientScript()->registerPackage('jquery-cookie');
         App()->getClientScript()->registerScriptFile(Yii::app()->getConfig('adminscripts') . 'surveytoolbar.js');
         //Parse data to send to view
         $aData['surveyinfo'] = $surveyinfo;
         // ACTIVATE SURVEY BUTTON
         $aData['activated'] = $activated;
         $condition = array('sid' => $iSurveyID, 'parent_qid' => 0, 'language' => $baselang);
         //$sumquery3 =  "SELECT * FROM ".db_table_name('questions')." WHERE sid={$iSurveyID} AND parent_qid=0 AND language='".$baselang."'"; //Getting a count of questions for this survey
         $sumresult3 = Question::model()->findAllByAttributes($condition);
         //Checked
         $sumcount3 = count($sumresult3);
         $aData['canactivate'] = $sumcount3 > 0 && Permission::model()->hasSurveyPermission($iSurveyID, 'surveyactivation', 'update');
         $aData['candeactivate'] = Permission::model()->hasSurveyPermission($iSurveyID, 'surveyactivation', 'update');
         $aData['expired'] = $surveyinfo['expires'] != '' && $surveyinfo['expires'] < dateShift(date("Y-m-d H:i:s"), "Y-m-d H:i", Yii::app()->getConfig('timeadjust'));
         $aData['notstarted'] = $surveyinfo['startdate'] != '' && $surveyinfo['startdate'] > dateShift(date("Y-m-d H:i:s"), "Y-m-d H:i", Yii::app()->getConfig('timeadjust'));
         // Start of suckerfish menu
         // TEST BUTTON
         if (!$activated) {
             $aData['icontext'] = gT("Test this survey");
         } else {
             $aData['icontext'] = gT("Execute this survey");
         }
         $aData['baselang'] = $oSurvey->language;
         $aData['additionallanguages'] = $oSurvey->getAdditionalLanguages();
         $aData['languagelist'] = $oSurvey->getAllLanguages();
         $aData['onelanguage'] = count($aData['languagelist']) == 1;
         $aData['hasadditionallanguages'] = count($aData['additionallanguages']) > 0;
         // EDIT SURVEY TEXT ELEMENTS BUTTON
         $aData['surveylocale'] = Permission::model()->hasSurveyPermission($iSurveyID, 'surveylocale', 'read');
         // EDIT SURVEY SETTINGS BUTTON
         $aData['surveysettings'] = Permission::model()->hasSurveyPermission($iSurveyID, 'surveysettings', 'read');
         // Survey permission item
         $aData['surveysecurity'] = Permission::model()->hasSurveyPermission($iSurveyID, 'surveysecurity', 'read');
         // CHANGE QUESTION GROUP ORDER BUTTON
         $aData['surveycontent'] = Permission::model()->hasSurveyPermission($iSurveyID, 'surveycontent', 'read');
         $aData['groupsum'] = getGroupSum($iSurveyID, $surveyinfo['language']) > 1;
         // SET SURVEY QUOTAS BUTTON
         $aData['quotas'] = Permission::model()->hasSurveyPermission($iSurveyID, 'quotas', 'read');
         // Assessment menu item
         $aData['assessments'] = Permission::model()->hasSurveyPermission($iSurveyID, 'assessments', 'read');
         // EDIT SURVEY TEXT ELEMENTS BUTTON
         // End if survey properties
         // Tools menu item
         // Delete survey item
         $aData['surveydelete'] = Permission::model()->hasSurveyPermission($iSurveyID, 'survey', 'delete');
         // Translate survey item
         $aData['surveytranslate'] = Permission::model()->hasSurveyPermission($iSurveyID, 'translations', 'read');
         // RESET SURVEY LOGIC BUTTON
         //$sumquery6 = "SELECT count(*) FROM ".db_table_name('conditions')." as c, ".db_table_name('questions')."
         // as q WHERE c.qid = q.qid AND q.sid=$iSurveyID"; //Getting a count of conditions for this survey
         // TMSW Condition->Relevance:  How is conditionscount used?  Should Relevance do the same?
         $iConditionCount = Condition::model()->with(array('questions' => array('condition' => 'sid =' . $iSurveyID)))->count();
         $aData['surveycontent'] = Permission::model()->hasSurveyPermission($iSurveyID, 'surveycontent', 'update');
         $aData['conditionscount'] = $iConditionCount > 0;
         // Eport menu item
         $aData['surveyexport'] = Permission::model()->hasSurveyPermission($iSurveyID, 'surveycontent', 'export');
         // PRINTABLE VERSION OF SURVEY BUTTON
         // SHOW PRINTABLE AND SCANNABLE VERSION OF SURVEY BUTTON
         //browse responses menu item
         $aData['respstatsread'] = Permission::model()->hasSurveyPermission($iSurveyID, 'responses', 'read') || Permission::model()->hasSurveyPermission($iSurveyID, 'statistics', 'read') || Permission::model()->hasSurveyPermission($iSurveyID, 'responses', 'export');
         // Data entry screen menu item
         $aData['responsescreate'] = Permission::model()->hasSurveyPermission($iSurveyID, 'responses', 'create');
         $aData['responsesread'] = Permission::model()->hasSurveyPermission($iSurveyID, 'responses', 'read');
         // TOKEN MANAGEMENT BUTTON
         $bTokenExists = tableExists('{{tokens_' . $iSurveyID . '}}');
         if (!$bTokenExists) {
             $aData['tokenmanagement'] = Permission::model()->hasSurveyPermission($iSurveyID, 'surveysettings', 'update') || Permission::model()->hasSurveyPermission($iSurveyID, 'tokens', 'create');
         } else {
             $aData['tokenmanagement'] = Permission::model()->hasSurveyPermission($iSurveyID, 'surveysettings', 'update') || Permission::model()->hasSurveyPermission($iSurveyID, 'tokens', 'create') || Permission::model()->hasSurveyPermission($iSurveyID, 'tokens', 'read') || Permission::model()->hasSurveyPermission($iSurveyID, 'tokens', 'export') || Permission::model()->hasSurveyPermission($iSurveyID, 'tokens', 'import');
             // and export / import ?
         }
         $aData['gid'] = $gid;
         // = $this->input->post('gid');
         if (Permission::model()->hasSurveyPermission($iSurveyID, 'surveycontent', 'read')) {
             $aData['permission'] = true;
         } else {
             $aData['gid'] = $gid = null;
             $qid = null;
             $aData['permission'] = false;
         }
         if (getGroupListLang($gid, $baselang, $iSurveyID)) {
             $aData['groups'] = getGroupListLang($gid, $baselang, $iSurveyID);
         } else {
             $aData['groups'] = "<option>" . gT("None") . "</option>";
         }
         $aData['GidPrev'] = $GidPrev = getGidPrevious($iSurveyID, $gid);
         $aData['GidNext'] = $GidNext = getGidNext($iSurveyID, $gid);
         $aData['iIconSize'] = Yii::app()->getConfig('adminthemeiconsize');
         if ($aData['gid'] == null) {
             $this->getController()->renderPartial("/admin/survey/surveybar_view", $aData);
         }
     }
 }
Ejemplo n.º 3
0
     }
     $surveysummary .= "</select>\n";
 } else {
     $gid = null;
     $qid = null;
 }
 // QUICK NAVIGATION TO PREVIOUS AND NEXT QUESTION GROUP
 // TODO: Fix functionality to previous and next question group buttons (Andrie)
 $GidPrev = getGidPrevious($surveyid, $gid);
 $surveysummary .= "<span class='arrow-wrapper'>";
 if ($GidPrev != "") {
     $surveysummary .= "" . "<a href='{$scriptname}?sid={$surveyid}&amp;gid={$GidPrev}'>" . "<img src='{$imageurl}/previous_20.png' title='' alt='" . $clang->gT("Previous question group") . "' " . "name='questiongroupprevious' " . $clang->gT("Previous question group") . "/> </a>";
 } else {
     $surveysummary .= "" . "<img src='{$imageurl}/previous_disabled_20.png' title='' alt='" . $clang->gT("No previous question group") . "' " . "name='noquestiongroupprevious' />";
 }
 $GidNext = getGidNext($surveyid, $gid);
 if ($GidNext != "") {
     $surveysummary .= "" . "<a href='{$scriptname}?sid={$surveyid}&amp;gid={$GidNext}'>" . "<img src='{$imageurl}/next_20.png' title='' alt='" . $clang->gT("Next question group") . "' " . "name='questiongroupnext' /> </a>";
 } else {
     $surveysummary .= "" . "<img src='{$imageurl}/next_disabled_20.png' title='' alt='" . $clang->gT("No next question group") . "' " . "name='noquestiongroupnext' />";
 }
 $surveysummary .= "</span>";
 // ADD NEW GROUP TO SURVEY BUTTON
 if (bHasSurveyPermission($surveyid, 'surveycontent', 'create')) {
     if ($activated == "Y") {
         $surveysummary .= "<a href='#'>" . "<img src='{$imageurl}/add_disabled.png' title='' alt='" . $clang->gT("Disabled") . ' - ' . $clang->gT("This survey is currently active.") . "' " . " name='AddNewGroup' /></a>\n";
     } else {
         $surveysummary .= "<a href=\"#\" onclick=\"window.open('{$scriptname}?action=addgroup&amp;sid={$surveyid}', '_top')\"" . " title=\"" . $clang->gTview("Add new group to survey") . "\">" . "<img src='{$imageurl}/add.png' alt='" . $clang->gT("Add new group to survey") . "' name='AddNewGroup' /></a>\n";
     }
 }
 $surveysummary .= "<img src='{$imageurl}/seperator.gif' alt='' />\n" . "<img src='{$imageurl}/blank.gif' width='15' alt='' />" . "<input type='image' src='{$imageurl}/minus.gif' title='" . $clang->gT("Hide details of this Survey") . "' " . "alt='" . $clang->gT("Hide details of this Survey") . "' name='MinimiseSurveyWindow' " . "onclick='document.getElementById(\"surveydetails\").style.display=\"none\";' />\n";
Ejemplo n.º 4
0
 /**
  * Shows admin menu for surveys
  * @param int Survey id
  */
 function _surveybar($aData)
 {
     if (isset($aData['surveybar'])) {
         $iSurveyID = $aData['surveyid'];
         $oSurvey = $aData['oSurvey'];
         $gid = isset($aData['gid']) ? $aData['gid'] : null;
         $surveyinfo = isset($aData['surveyinfo']) ? $aData['surveyinfo'] : $oSurvey->surveyinfo;
         $baselang = $surveyinfo['language'];
         $activated = $surveyinfo['active'] == 'Y';
         App()->getClientScript()->registerPackage('jquery-cookie');
         //Parse data to send to view
         $aData['surveyinfo'] = $surveyinfo;
         // ACTIVATE SURVEY BUTTON
         $aData['activated'] = $activated;
         $condition = array('sid' => $iSurveyID, 'parent_qid' => 0, 'language' => $baselang);
         $sumcount3 = Question::model()->countByAttributes($condition);
         //Checked
         $aData['canactivate'] = $sumcount3 > 0 && Permission::model()->hasSurveyPermission($iSurveyID, 'surveyactivation', 'update');
         $aData['candeactivate'] = Permission::model()->hasSurveyPermission($iSurveyID, 'surveyactivation', 'update');
         $aData['expired'] = $surveyinfo['expires'] != '' && $surveyinfo['expires'] < dateShift(date("Y-m-d H:i:s"), "Y-m-d H:i", Yii::app()->getConfig('timeadjust'));
         $aData['notstarted'] = $surveyinfo['startdate'] != '' && $surveyinfo['startdate'] > dateShift(date("Y-m-d H:i:s"), "Y-m-d H:i", Yii::app()->getConfig('timeadjust'));
         // Start of suckerfish menu
         // TEST BUTTON
         if (!$activated) {
             $aData['icontext'] = gT("Preview survey");
         } else {
             $aData['icontext'] = gT("Execute survey");
         }
         $aData['baselang'] = $oSurvey->language;
         $aData['additionallanguages'] = $oSurvey->getAdditionalLanguages();
         $aData['languagelist'] = $oSurvey->getAllLanguages();
         $aData['onelanguage'] = count($aData['languagelist']) == 1;
         $aData['hasadditionallanguages'] = count($aData['additionallanguages']) > 0;
         // EDIT SURVEY TEXT ELEMENTS BUTTON
         $aData['surveylocale'] = Permission::model()->hasSurveyPermission($iSurveyID, 'surveylocale', 'read');
         // EDIT SURVEY SETTINGS BUTTON
         $aData['surveysettings'] = Permission::model()->hasSurveyPermission($iSurveyID, 'surveysettings', 'read');
         // Survey permission item
         $aData['surveysecurity'] = Permission::model()->hasSurveyPermission($iSurveyID, 'surveysecurity', 'read');
         // CHANGE QUESTION GROUP ORDER BUTTON
         $aData['surveycontentread'] = Permission::model()->hasSurveyPermission($iSurveyID, 'surveycontent', 'read');
         $aData['groupsum'] = getGroupSum($iSurveyID, $surveyinfo['language']) > 1;
         // SET SURVEY QUOTAS BUTTON
         $aData['quotas'] = Permission::model()->hasSurveyPermission($iSurveyID, 'quotas', 'read');
         // Assessment menu item
         $aData['assessments'] = Permission::model()->hasSurveyPermission($iSurveyID, 'assessments', 'read');
         // EDIT SURVEY TEXT ELEMENTS BUTTON
         // End if survey properties
         // Tools menu item
         // Delete survey item
         $aData['surveydelete'] = Permission::model()->hasSurveyPermission($iSurveyID, 'survey', 'delete');
         // Translate survey item
         $aData['surveytranslate'] = Permission::model()->hasSurveyPermission($iSurveyID, 'translations', 'read');
         // RESET SURVEY LOGIC BUTTON
         //$sumquery6 = "SELECT count(*) FROM ".db_table_name('conditions')." as c, ".db_table_name('questions')."
         // as q WHERE c.qid = q.qid AND q.sid=$iSurveyID"; //Getting a count of conditions for this survey
         // TMSW Condition->Relevance:  How is conditionscount used?  Should Relevance do the same?
         // Only show survey properties menu if at least one item is permitted
         $aData['showSurveyPropertiesMenu'] = $aData['surveylocale'] || $aData['surveysettings'] || $aData['surveysecurity'] || $aData['surveycontentread'] || $aData['quotas'] || $aData['assessments'];
         $event = new PluginEvent('beforeToolsMenuRender', $this);
         $event->set('surveyId', $iSurveyID);
         App()->getPluginManager()->dispatchEvent($event);
         $extraToolsMenuItems = $event->get('menuItems');
         $aData['extraToolsMenuItems'] = $extraToolsMenuItems;
         // Only show tools menu if at least one item is permitted
         $aData['showToolsMenu'] = $aData['surveydelete'] || $aData['surveytranslate'] || Permission::model()->hasSurveyPermission($iSurveyID, 'surveycontent', 'update') || !is_null($extraToolsMenuItems);
         $iConditionCount = Condition::model()->with(array('questions' => array('condition' => 'sid =' . $iSurveyID)))->count();
         $aData['surveycontent'] = Permission::model()->hasSurveyPermission($iSurveyID, 'surveycontent', 'update');
         $aData['conditionscount'] = $iConditionCount > 0;
         // Eport menu item
         $aData['surveyexport'] = Permission::model()->hasSurveyPermission($iSurveyID, 'surveycontent', 'export');
         // PRINTABLE VERSION OF SURVEY BUTTON
         // SHOW PRINTABLE AND SCANNABLE VERSION OF SURVEY BUTTON
         //browse responses menu item
         $aData['respstatsread'] = Permission::model()->hasSurveyPermission($iSurveyID, 'responses', 'read') || Permission::model()->hasSurveyPermission($iSurveyID, 'statistics', 'read') || Permission::model()->hasSurveyPermission($iSurveyID, 'responses', 'export');
         // Data entry screen menu item
         $aData['responsescreate'] = Permission::model()->hasSurveyPermission($iSurveyID, 'responses', 'create');
         $aData['responsesread'] = Permission::model()->hasSurveyPermission($iSurveyID, 'responses', 'read');
         // TOKEN MANAGEMENT BUTTON
         $bTokenExists = tableExists('{{tokens_' . $iSurveyID . '}}');
         if (!$bTokenExists) {
             $aData['tokenmanagement'] = Permission::model()->hasSurveyPermission($iSurveyID, 'surveysettings', 'update') || Permission::model()->hasSurveyPermission($iSurveyID, 'tokens', 'create');
         } else {
             $aData['tokenmanagement'] = Permission::model()->hasSurveyPermission($iSurveyID, 'surveysettings', 'update') || Permission::model()->hasSurveyPermission($iSurveyID, 'tokens', 'create') || Permission::model()->hasSurveyPermission($iSurveyID, 'tokens', 'read') || Permission::model()->hasSurveyPermission($iSurveyID, 'tokens', 'export') || Permission::model()->hasSurveyPermission($iSurveyID, 'tokens', 'import');
             // and export / import ?
         }
         $aData['gid'] = $gid;
         // = $this->input->post('gid');
         if (Permission::model()->hasSurveyPermission($iSurveyID, 'surveycontent', 'read')) {
             $aData['permission'] = true;
         } else {
             $aData['gid'] = $gid = null;
             $qid = null;
             $aData['permission'] = false;
         }
         if (getGroupListLang($gid, $baselang, $iSurveyID)) {
             $aData['groups'] = getGroupListLang($gid, $baselang, $iSurveyID);
         } else {
             $aData['groups'] = "<option>" . gT("None") . "</option>";
         }
         $aData['GidPrev'] = $GidPrev = getGidPrevious($iSurveyID, $gid);
         $aData['GidNext'] = $GidNext = getGidNext($iSurveyID, $gid);
         $aData['iIconSize'] = Yii::app()->getConfig('adminthemeiconsize');
         if (isset($aData['surveybar']['closebutton']['url'])) {
             $sAlternativeUrl = $aData['surveybar']['closebutton']['url'];
             $aForbiddenWordsInUrl = isset($aData['surveybar']['closebutton']['forbidden']) ? $aData['surveybar']['closebutton']['forbidden'] : array();
             $aForbiddenWordsInUrl[] = 'assessmentedit';
             $aForbiddenWordsInUrl[] = 'newsurvey';
             $aForbiddenWordsInUrl[] = 'editlocalsettings';
             $aForbiddenWordsInUrl[] = 'setsurveysecurity';
             $aForbiddenWordsInUrl[] = 'importsurveyresources';
             $aForbiddenWordsInUrl[] = 'newquestion';
             $aForbiddenWordsInUrl[] = 'add';
             $aData['surveybar']['closebutton']['url'] = Yii::app()->request->getUrlReferrer(Yii::app()->createUrl($sAlternativeUrl), $aForbiddenWordsInUrl);
         }
         if ($aData['gid'] == null) {
             $this->getController()->renderPartial("/admin/survey/surveybar_view", $aData);
         }
     }
 }