Beispiel #1
0
 /**
  * Load edit email template screen.
  * @param mixed $iSurveyId
  * @return
  */
 function index($iSurveyId)
 {
     $iSurveyId = sanitize_int($iSurveyId);
     Yii::app()->loadHelper('admin.htmleditor');
     Yii::app()->loadHelper('surveytranslator');
     Yii::app()->session['FileManagerContext'] = "edit:emailsettings:{$iSurveyId}";
     initKcfinder();
     if (isset($iSurveyId) && getEmailFormat($iSurveyId) == 'html') {
         $ishtml = true;
     } else {
         $ishtml = false;
     }
     $grplangs = Survey::model()->findByPk($iSurveyId)->additionalLanguages;
     $baselang = Survey::model()->findByPk($iSurveyId)->language;
     array_unshift($grplangs, $baselang);
     $sEditScript = PrepareEditorScript(false, $this->getController());
     $aData['attrib'] = array();
     $aData['bplangs'] = array();
     $aData['defaulttexts'] = array();
     if ($ishtml) {
         $sEscapeMode = 'html';
     } else {
         $sEscapeMode = 'unescaped';
     }
     foreach ($grplangs as $key => $grouplang) {
         $aData['bplangs'][$key] = $grouplang;
         $aData['attrib'][$key] = SurveyLanguageSetting::model()->find('surveyls_survey_id = :ssid AND surveyls_language = :ls', array(':ssid' => $iSurveyId, ':ls' => $grouplang));
         $aData['attrib'][$key]['attachments'] = unserialize($aData['attrib'][$key]['attachments']);
         $aData['defaulttexts'][$key] = templateDefaultTexts($aData['bplangs'][$key], $sEscapeMode);
     }
     $aData['sidemenu']['state'] = false;
     $surveyinfo = Survey::model()->findByPk($iSurveyId)->surveyinfo;
     $aData['title_bar']['title'] = $surveyinfo['surveyls_title'] . "(" . gT("ID") . ":" . $iSurveyId . ")";
     $aData['surveybar']['savebutton']['form'] = 'frmeditgroup';
     $aData['surveybar']['saveandclosebutton']['form'] = 'frmeditgroup';
     if (!Permission::model()->hasSurveyPermission($iSurveyId, 'surveycontent', 'update')) {
         unset($aData['surveybar']['savebutton']);
         unset($aData['surveybar']['saveandclosebutton']);
     }
     $aData['surveybar']['closebutton']['url'] = 'admin/survey/sa/view/surveyid/' . $iSurveyId;
     // Close button
     $aData['surveyid'] = $iSurveyId;
     $aData['ishtml'] = $ishtml;
     $aData['grplangs'] = $grplangs;
     $this->_renderWrappedTemplate('emailtemplates', array('output' => $sEditScript, 'emailtemplates_view'), $aData);
 }
Beispiel #2
0
 /**
  * Load edit email template screen.
  * @param mixed $iSurveyId
  * @return
  */
 function index($iSurveyId)
 {
     $clang = $this->getController()->lang;
     $iSurveyId = sanitize_int($iSurveyId);
     App()->getClientScript()->registerPackage('jquery-superfish');
     Yii::app()->loadHelper('admin.htmleditor');
     Yii::app()->loadHelper('surveytranslator');
     Yii::app()->session['FileManagerContext'] = "edit:emailsettings:{$iSurveyId}";
     initKcfinder();
     if (isset($iSurveyId) && getEmailFormat($iSurveyId) == 'html') {
         $ishtml = true;
     } else {
         $ishtml = false;
     }
     $grplangs = Survey::model()->findByPk($iSurveyId)->additionalLanguages;
     $baselang = Survey::model()->findByPk($iSurveyId)->language;
     array_unshift($grplangs, $baselang);
     $sEditScript = PrepareEditorScript(false, $this->getController());
     $aData['attrib'] = array();
     $aData['bplangs'] = array();
     $aData['defaulttexts'] = array();
     if ($ishtml) {
         $sEscapeMode = 'html';
     } else {
         $sEscapeMode = 'unescaped';
     }
     foreach ($grplangs as $key => $grouplang) {
         $aData['bplangs'][$key] = new limesurvey_lang($grouplang);
         $aData['attrib'][$key] = SurveyLanguageSetting::model()->find('surveyls_survey_id = :ssid AND surveyls_language = :ls', array(':ssid' => $iSurveyId, ':ls' => $grouplang));
         $aData['attrib'][$key]['attachments'] = unserialize($aData['attrib'][$key]['attachments']);
         $aData['defaulttexts'][$key] = templateDefaultTexts($aData['bplangs'][$key], $sEscapeMode);
     }
     $aData['surveyid'] = $iSurveyId;
     $aData['ishtml'] = $ishtml;
     $aData['grplangs'] = $grplangs;
     $this->_renderWrappedTemplate('emailtemplates', array('output' => $sEditScript, 'emailtemplates_view'), $aData);
 }
function getEditor($fieldtype, $fieldname, $fieldtext, $surveyID = null, $gID = null, $qID = null, $action = null)
{
    initKcfinder();
    //error_log("TIBO fieldtype=$fieldtype,fieldname=$fieldname,fieldtext=$fieldtext,surveyID=$surveyID,gID=$gID,qID=$qID,action=$action");
    $session =& Yii::app()->session;
    if ($session['htmleditormode'] && $session['htmleditormode'] == 'none') {
        return '';
    }
    if (!$session['htmleditormode'] || $session['htmleditormode'] != 'inline' && $session['htmleditormode'] != 'popup') {
        $htmleditormode = Yii::app()->getConfig('defaulthtmleditormode');
    } else {
        $htmleditormode = $session['htmleditormode'];
    }
    if (($fieldtype == 'email-inv' || $fieldtype == 'email-reg' || $fieldtype == 'email-conf' || $fieldtype == 'email-rem') && getEmailFormat($surveyID) != 'html') {
        return '';
    }
    if ($htmleditormode == 'popup' || ($fieldtype == 'editanswer' || $fieldtype == 'addanswer' || $fieldtype == 'editlabel' || $fieldtype == 'addlabel') && preg_match("/^translate/", $action) == 0) {
        return getPopupEditor($fieldtype, $fieldname, $fieldtext, $surveyID, $gID, $qID, $action);
    } elseif ($htmleditormode == 'inline') {
        return getInlineEditor($fieldtype, $fieldname, $fieldtext, $surveyID, $gID, $qID, $action);
    } else {
        return '';
    }
}
Beispiel #4
0
 /**
  * This function prepares the view for editing a survey
  *
  */
 function editsurveysettings($iSurveyID)
 {
     $iSurveyID = (int) $iSurveyID;
     if (!Permission::model()->hasSurveyPermission($iSurveyID, 'surveysettings', 'read') && !Permission::model()->hasGlobalPermission('surveys', 'read')) {
         $this->getController()->error('No permission');
     }
     if (Yii::app()->request->isPostRequest) {
         $this->update($iSurveyID);
     }
     $this->_registerScriptFiles();
     //Yii::app()->loadHelper('text');
     Yii::app()->loadHelper('surveytranslator');
     Yii::app()->session['FileManagerContext'] = "edit:survey:{$iSurveyID}";
     Yii::app()->loadHelper('/admin/htmleditor');
     initKcfinder();
     $esrow = array();
     $esrow = self::_fetchSurveyInfo('editsurvey', $iSurveyID);
     $aData['esrow'] = $esrow;
     $aData = array_merge($aData, $this->_generalTabEditSurvey($iSurveyID, $esrow));
     $aData = array_merge($aData, $this->_tabPresentationNavigation($esrow));
     $aData = array_merge($aData, $this->_tabPublicationAccess($esrow));
     $aData = array_merge($aData, $this->_tabNotificationDataManagement($esrow));
     $aData = array_merge($aData, $this->_tabTokens($esrow));
     $aData = array_merge($aData, $this->_tabPanelIntegration($esrow));
     $aData = array_merge($aData, $this->_tabResourceManagement($iSurveyID));
     $oResult = Question::model()->getQuestionsWithSubQuestions($iSurveyID, $esrow['language'], "({{questions}}.type = 'T'  OR  {{questions}}.type = 'Q'  OR  {{questions}}.type = 'T' OR {{questions}}.type = 'S')");
     $aData['questions'] = $oResult;
     $aData['display']['menu_bars']['surveysummary'] = "editsurveysettings";
     $tempData = $aData;
     $aData['data'] = $tempData;
     $this->_renderWrappedTemplate('survey', 'editSurvey_view', $aData);
 }
 /**
  * This function prepares the view for editing a survey
  *
  */
 function editsurveysettings($iSurveyID)
 {
     $iSurveyID = (int) $iSurveyID;
     if (is_null($iSurveyID) || !$iSurveyID) {
         $this->getController()->error('Invalid survey ID');
     }
     if (!Permission::model()->hasSurveyPermission($iSurveyID, 'surveysettings', 'read') && !Permission::model()->hasGlobalPermission('surveys', 'read')) {
         $this->getController()->error('No permission');
     }
     if (Yii::app()->request->isPostRequest) {
         $this->update($iSurveyID);
     }
     $this->_registerScriptFiles();
     //Yii::app()->loadHelper('text');
     Yii::app()->loadHelper('surveytranslator');
     Yii::app()->session['FileManagerContext'] = "edit:survey:{$iSurveyID}";
     Yii::app()->loadHelper('/admin/htmleditor');
     initKcfinder();
     $esrow = array();
     $esrow = self::_fetchSurveyInfo('editsurvey', $iSurveyID);
     $aData['esrow'] = $esrow;
     $aData = array_merge($aData, $this->_generalTabEditSurvey($iSurveyID, $esrow));
     $aData = array_merge($aData, $this->_tabPresentationNavigation($esrow));
     $aData = array_merge($aData, $this->_tabPublicationAccess($esrow));
     $aData = array_merge($aData, $this->_tabNotificationDataManagement($esrow));
     $aData = array_merge($aData, $this->_tabTokens($esrow));
     $aData = array_merge($aData, $this->_tabPanelIntegration($esrow));
     $aData = array_merge($aData, $this->_tabResourceManagement($iSurveyID));
     $oResult = Question::model()->getQuestionsWithSubQuestions($iSurveyID, $esrow['language'], "({{questions}}.type = 'T'  OR  {{questions}}.type = 'Q'  OR  {{questions}}.type = 'T' OR {{questions}}.type = 'S')");
     $aData['questions'] = $oResult;
     $aData['display']['menu_bars']['surveysummary'] = "editsurveysettings";
     $tempData = $aData;
     $aData['data'] = $tempData;
     $aData['sidemenu']['state'] = false;
     $surveyinfo = Survey::model()->findByPk($iSurveyID)->surveyinfo;
     $aData['title_bar']['title'] = $surveyinfo['surveyls_title'] . "(" . gT("ID") . ":" . $iSurveyID . ")";
     $aData['surveybar']['savebutton']['form'] = 'frmeditgroup';
     $aData['surveybar']['closebutton']['url'] = 'admin/survey/sa/view/surveyid/' . $iSurveyID;
     $this->_renderWrappedTemplate('survey', 'editSurvey_view', $aData);
 }