Beispiel #1
0
 /**
  * Export Dialog
  */
 function exportdialog($iSurveyId)
 {
     // CHECK TO SEE IF A TOKEN TABLE EXISTS FOR THIS SURVEY
     $clang = $this->getController()->lang;
     $iSurveyId = sanitize_int($iSurveyId);
     if (!Permission::model()->hasSurveyPermission($iSurveyId, 'tokens', 'export')) {
         Yii::app()->session['flashmessage'] = $clang->gT("You do not have sufficient rights to access this page.");
         $this->getController()->redirect(array("/admin/survey/sa/view/surveyid/{$iSurveyId}"));
     }
     $bTokenExists = tableExists('{{tokens_' . $iSurveyId . '}}');
     if (!$bTokenExists) {
         self::_newtokentable($iSurveyId);
     }
     if (Yii::app()->request->getPost('submit')) {
         Yii::app()->loadHelper("export");
         tokensExport($iSurveyId);
     } else {
         $aData['resultr'] = Token::model($iSurveyId)->findAll(array('select' => 'language', 'group' => 'language'));
         $aData['thissurvey'] = getSurveyInfo($iSurveyId);
         $aData['surveyid'] = $iSurveyId;
         $this->_renderWrappedTemplate('token', array('tokenbar', 'exportdialog'), $aData);
     }
 }
Beispiel #2
0
 /**
  * Export Dialog
  */
 function exportdialog($iSurveyId)
 {
     // CHECK TO SEE IF A TOKEN TABLE EXISTS FOR THIS SURVEY
     $bTokenExists = tableExists('{{tokens_' . $iSurveyId . '}}');
     if (!$bTokenExists) {
         self::_newtokentable($iSurveyId);
     }
     $clang = $this->getController()->lang;
     $iSurveyId = sanitize_int($iSurveyId);
     if (!hasSurveyPermission($iSurveyId, 'tokens', 'export')) {
         die;
     }
     if (Yii::app()->request->getPost('submit')) {
         Yii::app()->loadHelper("export");
         tokensExport($iSurveyId);
     } else {
         $aData['resultr'] = Tokens_dynamic::model($iSurveyId)->find(array('select' => 'language', 'group' => 'language'));
         $aData['thissurvey'] = getSurveyInfo($iSurveyId);
         $aData['surveyid'] = $iSurveyId;
         $this->_renderWrappedTemplate('token', array('tokenbar', 'exportdialog'), $aData);
     }
 }
Beispiel #3
0
 /**
  * Export Dialog
  *
  */
 public function exportdialog($iSurveyId)
 {
     $surveyinfo = Survey::model()->findByPk($iSurveyId)->surveyinfo;
     $aData = array();
     $aData["surveyinfo"] = $surveyinfo;
     $aData['title_bar']['title'] = $surveyinfo['surveyls_title'] . "(" . gT("ID") . ":" . $iSurveyId . ")";
     $aData['sidemenu']["token_menu"] = true;
     $aData['sidemenu']['state'] = false;
     $aData['token_bar']['exportbutton']['form'] = true;
     $aData['token_bar']['closebutton']['url'] = 'admin/tokens/sa/index/surveyid/' . $iSurveyId;
     // Close button
     // CHECK TO SEE IF A TOKEN TABLE EXISTS FOR THIS SURVEY
     $iSurveyId = sanitize_int($iSurveyId);
     if (!Permission::model()->hasSurveyPermission($iSurveyId, 'tokens', 'export')) {
         Yii::app()->session['flashmessage'] = gT("You do not have permission to access this page.");
         $this->getController()->redirect(array("/admin/survey/sa/view/surveyid/{$iSurveyId}"));
     }
     $bTokenExists = tableExists('{{tokens_' . $iSurveyId . '}}');
     if (!$bTokenExists) {
         self::_newtokentable($iSurveyId);
     }
     if (!is_null(Yii::app()->request->getPost('submit'))) {
         Yii::app()->loadHelper("export");
         tokensExport($iSurveyId);
     } else {
         //$aData['resultr'] = Token::model($iSurveyId)->findAll(array('select' => 'language', 'group' => 'language'));
         $aData['surveyid'] = $iSurveyId;
         $aData['thissurvey'] = getSurveyInfo($iSurveyId);
         // For tokenbar view
         $aData['sAction'] = App()->createUrl("admin/tokens", array("sa" => "exportdialog", "surveyid" => $iSurveyId));
         $aData['aButtons'] = array(gT('Export tokens') => array('type' => 'submit', 'name' => 'submit'));
         $oSurvey = Survey::model()->findByPk($iSurveyId);
         $aOptionsStatus = array('0' => gT('All tokens'), '1' => gT('Completed'), '2' => gT('Not completed'));
         if ($oSurvey->anonymized == 'N' && $oSurvey->active == 'Y') {
             $aOptionsStatus['3'] = gT('Not started');
             $aOptionsStatus['4'] = gT('Started but not yet completed');
         }
         $oTokenLanguages = Token::model($iSurveyId)->findAll(array('select' => 'language', 'group' => 'language'));
         $aFilterByLanguage = array('' => gT('All'));
         foreach ($oTokenLanguages as $oTokenLanguage) {
             $sLanguageCode = sanitize_languagecode($oTokenLanguage->language);
             $aFilterByLanguage[$sLanguageCode] = getLanguageNameFromCode($sLanguageCode, false);
         }
         $aData['aSettings'] = array('tokenstatus' => array('type' => 'select', 'label' => gT('Survey status:'), 'options' => $aOptionsStatus), 'invitationstatus' => array('type' => 'select', 'label' => gT('Invitation status:'), 'options' => array('0' => gT('All'), '1' => gT('Invited'), '2' => gT('Not invited'))), 'reminderstatus' => array('type' => 'select', 'label' => gT('Reminder status:'), 'options' => array('0' => gT('All'), '1' => gT('Reminder(s) sent'), '2' => gT('No reminder(s) sent'))), 'tokenlanguage' => array('type' => 'select', 'label' => gT('Filter by language:'), 'options' => $aFilterByLanguage), 'filteremail' => array('type' => 'string', 'label' => gT('Filter by email address:'), 'help' => gT('Only export entries which contain this string in the email address.')), 'tokendeleteexported' => array('type' => 'checkbox', 'label' => gT('Delete exported tokens:'), 'help' => 'Attention: If selected the exported tokens are deleted permanently from the token table.'));
         $this->_renderWrappedTemplate('token', array('exportdialog'), $aData);
     }
 }
Beispiel #4
0
 /**
  * Export Dialog
  */
 function exportdialog($iSurveyId)
 {
     // CHECK TO SEE IF A TOKEN TABLE EXISTS FOR THIS SURVEY
     $iSurveyId = sanitize_int($iSurveyId);
     if (!Permission::model()->hasSurveyPermission($iSurveyId, 'tokens', 'export')) {
         Yii::app()->session['flashmessage'] = gT("You do not have sufficient rights to access this page.");
         $this->getController()->redirect(array("/admin/survey/sa/view/surveyid/{$iSurveyId}"));
     }
     $bTokenExists = tableExists('{{tokens_' . $iSurveyId . '}}');
     if (!$bTokenExists) {
         self::_newtokentable($iSurveyId);
     }
     if (!is_null(Yii::app()->request->getPost('submit'))) {
         Yii::app()->loadHelper("export");
         tokensExport($iSurveyId);
     } else {
         //$aData['resultr'] = Token::model($iSurveyId)->findAll(array('select' => 'language', 'group' => 'language'));
         $aData['surveyid'] = $iSurveyId;
         $aData['thissurvey'] = getSurveyInfo($iSurveyId);
         // For tokenbar view
         $aData['sAction'] = App()->createUrl("admin/tokens", array("sa" => "exportdialog", "surveyid" => $iSurveyId));
         $aData['aButtons'] = array(gT('Export tokens') => array('type' => 'submit', 'name' => 'submit'));
         $oSurvey = Survey::model()->findByPk($iSurveyId);
         $aOptionsStatus = array('0' => gt('All tokens'), '1' => gT('Completed'), '2' => gT('Not completed'));
         if ($oSurvey->anonymized == 'N' && $oSurvey->active == 'Y') {
             $aOptionsStatus['3'] = gT('Not started');
             $aOptionsStatus['4'] = gT('Started but not yet completed');
         }
         $oTokenLanguages = Token::model($iSurveyId)->findAll(array('select' => 'language', 'group' => 'language'));
         $aFilterByLanguage = array('' => gt('All'));
         foreach ($oTokenLanguages as $oTokenLanguage) {
             $sLanguageCode = sanitize_languagecode($oTokenLanguage->language);
             $aFilterByLanguage[$sLanguageCode] = getLanguageNameFromCode($sLanguageCode, false);
         }
         $aData['aSettings'] = array('tokenstatus' => array('type' => 'select', 'label' => gT('Survey status'), 'options' => $aOptionsStatus), 'invitationstatus' => array('type' => 'select', 'label' => gT('Invitation status'), 'options' => array('0' => gt('All'), '1' => gT('Invited'), '2' => gT('Not invited'))), 'reminderstatus' => array('type' => 'select', 'label' => gT('Reminder status'), 'options' => array('0' => gt('All'), '1' => gT('Reminder(s) sent'), '2' => gT('No reminder(s) sent'))), 'tokenlanguage' => array('type' => 'select', 'label' => gT('Filter by language'), 'options' => $aFilterByLanguage), 'filteremail' => array('type' => 'string', 'label' => gT('Filter by email address'), 'help' => gT('Email address contains the input.')), 'tokendeleteexported' => array('type' => 'checkbox', 'label' => gT('Delete exported tokens'), 'help' => 'Attention : the tokens are deleted from token table, you can not find it again.'));
         $this->_renderWrappedTemplate('token', array('tokenbar', 'exportdialog'), $aData);
     }
 }