当前位置: 首页>>代码示例>>PHP>>正文


PHP LimeExpressionManager::StartProcessingPage方法代码示例

本文整理汇总了PHP中LimeExpressionManager::StartProcessingPage方法的典型用法代码示例。如果您正苦于以下问题:PHP LimeExpressionManager::StartProcessingPage方法的具体用法?PHP LimeExpressionManager::StartProcessingPage怎么用?PHP LimeExpressionManager::StartProcessingPage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在LimeExpressionManager的用法示例。


在下文中一共展示了LimeExpressionManager::StartProcessingPage方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _showReorderForm

 private function _showReorderForm($iSurveyID)
 {
     // Prepare data for the view
     $sBaseLanguage = Survey::model()->findByPk($iSurveyID)->language;
     LimeExpressionManager::StartSurvey($iSurveyID, 'survey');
     LimeExpressionManager::StartProcessingPage(true, Yii::app()->baseUrl);
     $aGrouplist = QuestionGroup::model()->getGroups($iSurveyID);
     $initializedReplacementFields = false;
     foreach ($aGrouplist as $iGID => $aGroup) {
         LimeExpressionManager::StartProcessingGroup($aGroup['gid'], false, $iSurveyID);
         if (!$initializedReplacementFields) {
             templatereplace("{SITENAME}");
             // Hack to ensure the EM sets values of LimeReplacementFields
             $initializedReplacementFields = true;
         }
         $oQuestionData = Question::model()->getQuestions($iSurveyID, $aGroup['gid'], $sBaseLanguage);
         $qs = array();
         $junk = array();
         foreach ($oQuestionData->readAll() as $q) {
             $relevance = $q['relevance'] == '' ? 1 : $q['relevance'];
             $question = '[{' . $relevance . '}] ' . $q['question'];
             LimeExpressionManager::ProcessString($question, $q['qid']);
             $q['question'] = LimeExpressionManager::GetLastPrettyPrintExpression();
             $q['gid'] = $aGroup['gid'];
             $qs[] = $q;
         }
         $aGrouplist[$iGID]['questions'] = $qs;
         LimeExpressionManager::FinishProcessingGroup();
     }
     LimeExpressionManager::FinishProcessingPage();
     $aData['aGroupsAndQuestions'] = $aGrouplist;
     $aData['surveyid'] = $iSurveyID;
     $this->_renderWrappedTemplate('survey', 'organizeGroupsAndQuestions_view', $aData);
 }
开发者ID:nicbon,项目名称:LimeSurvey,代码行数:34,代码来源:surveyadmin.php

示例2: index

 /**
  * Load edit/new question screen depending on $action.
  *
  * @access public
  * @param string $action
  * @param int $surveyid
  * @param int $gid
  * @param int $qid
  * @return void
  */
 public function index($sa, $surveyid, $gid, $qid = null)
 {
     $action = $sa;
     $surveyid = sanitize_int($surveyid);
     $gid = sanitize_int($gid);
     if (isset($qid)) {
         $qid = sanitize_int($qid);
     }
     $aViewUrls = array();
     $aData['surveyid'] = $surveyid;
     $aData['gid'] = $gid;
     $aData['qid'] = $qid;
     $aData['display']['menu_bars']['surveysummary'] = 'viewgroup';
     $aData['display']['menu_bars']['gid_action'] = 'addquestion';
     Yii::app()->session['FileManagerContext'] = "create:question:{$surveyid}";
     if (hasSurveyPermission($surveyid, 'surveycontent', 'read')) {
         $clang = $this->getController()->lang;
         $surveyinfo = getSurveyInfo($surveyid);
         Yii::app()->loadHelper('admin/htmleditor');
         Yii::app()->loadHelper('surveytranslator');
         if (isset($_POST['sortorder'])) {
             $postsortorder = sanitize_int($_POST['sortorder']);
         }
         $aData['adding'] = $adding = $action == 'addquestion';
         $aData['copying'] = $copying = $action == 'copyquestion';
         $questlangs = Survey::model()->findByPk($surveyid)->additionalLanguages;
         $baselang = Survey::model()->findByPk($surveyid)->language;
         $questlangs[] = $baselang;
         $questlangs = array_flip($questlangs);
         // Prepare selector Mode TODO: with and without image
         if (!$adding) {
             Yii::app()->session['FileManagerContext'] = "edit:question:{$surveyid}";
             $aData['display']['menu_bars']['qid_action'] = 'editquestion';
             $egresult = Questions::model()->findAllByAttributes(array('sid' => $surveyid, 'gid' => $gid, 'qid' => $qid));
             foreach ($egresult as $esrow) {
                 if (!array_key_exists($esrow->language, $questlangs)) {
                     // Language Exists, BUT ITS NOT ON THE SURVEY ANYMORE.
                     $esrow->delete();
                 } else {
                     $questlangs[$esrow->language] = 99;
                 }
                 if ($esrow->language == $baselang) {
                     $esrow = $esrow->attributes;
                     $basesettings = array('question_order' => $esrow['question_order'], 'other' => $esrow['other'], 'mandatory' => $esrow['mandatory'], 'type' => $esrow['type'], 'title' => $esrow['title'], 'preg' => $esrow['preg'], 'question' => $esrow['question'], 'help' => $esrow['help']);
                 }
             }
             if (!$egresult) {
                 $this->getController()->error('Invalid question id');
             }
             while (list($key, $value) = each($questlangs)) {
                 if ($value != 99) {
                     Questions::model()->insert(array('qid' => $qid, 'sid' => $surveyid, 'gid' => $gid, 'type' => $basesettings['type'], 'title' => $basesettings['title'], 'question' => $basesettings['question'], 'preg' => $basesettings['preg'], 'help' => $basesettings['help'], 'other' => $basesettings['other'], 'mandatory' => $basesettings['mandatory'], 'question_order' => $basesettings['question_order'], 'language' => $key));
                 }
             }
             $eqresult = Questions::model()->with('groups')->together()->findByAttributes(array('sid' => $surveyid, 'gid' => $gid, 'qid' => $qid, 'language' => $baselang));
         } else {
             // This is needed to properly color-code content if it contains replacements
             LimeExpressionManager::StartProcessingPage(false, Yii::app()->baseUrl, true);
             // so can click on syntax highlighting to edit questions
         }
         $qtypelist = getQuestionTypeList('', 'array');
         $qDescToCode = 'qDescToCode = {';
         $qCodeToInfo = 'qCodeToInfo = {';
         foreach ($qtypelist as $qtype => $qdesc) {
             $qDescToCode .= " '{$qdesc['description']}' : '{$qtype}', \n";
             $qCodeToInfo .= " '{$qtype}' : '" . ls_json_encode($qdesc) . "', \n";
         }
         $aData['qTypeOutput'] = "{$qDescToCode} 'null':'null' }; \n {$qCodeToInfo} 'null':'null' };";
         if (!$adding) {
             $eqrow = array_merge($eqresult->attributes, $eqresult->groups->attributes);
             // Todo: handler in case that record is not found
             if ($copying) {
                 $eqrow['title'] = '';
             }
         } else {
             $eqrow['language'] = $baselang;
             $eqrow['title'] = '';
             $eqrow['question'] = '';
             $eqrow['help'] = '';
             $eqrow['type'] = 'T';
             $eqrow['lid'] = 0;
             $eqrow['lid1'] = 0;
             $eqrow['gid'] = $gid;
             $eqrow['other'] = 'N';
             $eqrow['mandatory'] = 'N';
             $eqrow['preg'] = '';
             $eqrow['relevance'] = 1;
             $eqrow['group_name'] = '';
         }
         $aData['eqrow'] = $eqrow;
//.........这里部分代码省略.........
开发者ID:ryu1inaba,项目名称:LimeSurvey,代码行数:101,代码来源:question.php

示例3: display_first_page

/**
* Shows the welcome page, used in group by group and question by question mode
*/
function display_first_page()
{
    global $token, $surveyid, $thissurvey, $navigator;
    $totalquestions = $_SESSION['survey_' . $surveyid]['totalquestions'];
    $clang = Yii::app()->lang;
    // Fill some necessary var for template
    $navigator = surveymover();
    $sitename = Yii::app()->getConfig('sitename');
    $languagechanger = makeLanguageChangerSurvey($clang->langcode);
    sendCacheHeaders();
    doHeader();
    LimeExpressionManager::StartProcessingPage();
    LimeExpressionManager::StartProcessingGroup(-1, false, $surveyid);
    // start on welcome page
    $redata = compact(array_keys(get_defined_vars()));
    $sTemplatePath = $_SESSION['survey_' . $surveyid]['templatepath'];
    echo templatereplace(file_get_contents($sTemplatePath . "startpage.pstpl"), array(), $redata, 'frontend_helper[2757]');
    echo CHtml::form(array("/survey/index"), 'post', array('id' => 'limesurvey', 'name' => 'limesurvey', 'autocomplete' => 'off'));
    echo "\n\n<!-- START THE SURVEY -->\n";
    echo templatereplace(file_get_contents($sTemplatePath . "welcome.pstpl"), array(), $redata, 'frontend_helper[2762]') . "\n";
    if ($thissurvey['anonymized'] == "Y") {
        echo templatereplace(file_get_contents($sTemplatePath . "/privacy.pstpl"), array(), $redata, 'frontend_helper[2765]') . "\n";
    }
    echo templatereplace(file_get_contents($sTemplatePath . "navigator.pstpl"), array(), $redata, 'frontend_helper[2767]');
    if ($thissurvey['active'] != "Y") {
        echo "<p style='text-align:center' class='error'>" . $clang->gT("This survey is currently not active. You will not be able to save your responses.") . "</p>\n";
    }
    echo "\n<input type='hidden' name='sid' value='{$surveyid}' id='sid' />\n";
    if (isset($token) && !empty($token)) {
        echo "\n<input type='hidden' name='token' value='{$token}' id='token' />\n";
    }
    echo "\n<input type='hidden' name='lastgroupname' value='_WELCOME_SCREEN_' id='lastgroupname' />\n";
    //This is to ensure consistency with mandatory checks, and new group test
    $loadsecurity = returnGlobal('loadsecurity', true);
    if (isset($loadsecurity)) {
        echo "\n<input type='hidden' name='loadsecurity' value='{$loadsecurity}' id='loadsecurity' />\n";
    }
    $_SESSION['survey_' . $surveyid]['LEMpostKey'] = mt_rand();
    echo "<input type='hidden' name='LEMpostKey' value='{$_SESSION['survey_' . $surveyid]['LEMpostKey']}' id='LEMpostKey' />\n";
    echo "<input type='hidden' name='thisstep' id='thisstep' value='0' />\n";
    echo "\n</form>\n";
    echo templatereplace(file_get_contents($sTemplatePath . "endpage.pstpl"), array(), $redata, 'frontend_helper[2782]');
    echo LimeExpressionManager::GetRelevanceAndTailoringJavaScript();
    LimeExpressionManager::FinishProcessingPage();
    doFooter();
}
开发者ID:elcharlygraf,项目名称:Encuesta-YiiFramework,代码行数:49,代码来源:frontend_helper.php

示例4: _renderWrappedTemplate

 /**
  * Renders template(s) wrapped in header and footer
  *
  * Addition of parameters should be avoided if they can be added to $aData
  *
  * @param string $sAction Current action, the folder to fetch views from
  * @param string|array $aViewUrls View url(s)
  * @param array $aData Data to be passed on. Optional.
  */
 protected function _renderWrappedTemplate($sAction = '', $aViewUrls = array(), $aData = array())
 {
     // Gather the data
     $aData['clang'] = $clang = Yii::app()->lang;
     $aData['sImageURL'] = Yii::app()->getConfig('adminimageurl');
     $aData = $this->_addPseudoParams($aData);
     $aViewUrls = (array) $aViewUrls;
     $sViewPath = '/admin/';
     if (!empty($sAction)) {
         $sViewPath .= $sAction . '/';
     }
     // Header
     if (!isset($aData['display']['header']) || $aData['display']['header'] !== false) {
         // Send HTTP header
         header("Content-type: text/html; charset=UTF-8");
         // needed for correct UTF-8 encoding
         Yii::app()->getController()->_getAdminHeader();
     }
     // Menu bars
     if (!isset($aData['display']['menu_bars']) || $aData['display']['menu_bars'] !== false && (!is_array($aData['display']['menu_bars']) || !in_array('browse', array_keys($aData['display']['menu_bars'])))) {
         Yii::app()->getController()->_showadminmenu(!empty($aData['surveyid']) ? $aData['surveyid'] : null);
         if (!empty($aData['surveyid'])) {
             LimeExpressionManager::StartProcessingPage(false, Yii::app()->baseUrl, true);
             // so can click on syntax highlighting to edit questions
             $this->_surveybar($aData['surveyid'], !empty($aData['gid']) ? $aData['gid'] : null);
             if (isset($aData['display']['menu_bars']['surveysummary'])) {
                 if ((empty($aData['display']['menu_bars']['surveysummary']) || !is_string($aData['display']['menu_bars']['surveysummary'])) && !empty($aData['gid'])) {
                     $aData['display']['menu_bars']['surveysummary'] = 'viewgroup';
                 }
                 $this->_surveysummary($aData['surveyid'], !empty($aData['display']['menu_bars']['surveysummary']) ? $aData['display']['menu_bars']['surveysummary'] : null, !empty($aData['gid']) ? $aData['gid'] : null);
             }
             if (!empty($aData['gid'])) {
                 if (empty($aData['display']['menu_bars']['gid_action']) && !empty($aData['qid'])) {
                     $aData['display']['menu_bars']['gid_action'] = 'viewquestion';
                 }
                 $this->_questiongroupbar($aData['surveyid'], $aData['gid'], !empty($aData['qid']) ? $aData['qid'] : null, !empty($aData['display']['menu_bars']['gid_action']) ? $aData['display']['menu_bars']['gid_action'] : null);
                 if (!empty($aData['qid'])) {
                     $this->_questionbar($aData['surveyid'], $aData['gid'], $aData['qid'], !empty($aData['display']['menu_bars']['qid_action']) ? $aData['display']['menu_bars']['qid_action'] : null);
                 }
             }
             LimeExpressionManager::FinishProcessingPage();
         }
     }
     if (!empty($aData['display']['menu_bars']['browse']) && !empty($aData['surveyid'])) {
         $this->_browsemenubar($aData['surveyid'], $aData['display']['menu_bars']['browse']);
     }
     if (!empty($aData['display']['menu_bars']['user_group'])) {
         $this->_userGroupBar(!empty($aData['ugid']) ? $aData['ugid'] : 0);
     }
     // Load views
     foreach ($aViewUrls as $sViewKey => $viewUrl) {
         if (empty($sViewKey) || !in_array($sViewKey, array('message', 'output'))) {
             if (is_numeric($sViewKey)) {
                 Yii::app()->getController()->render($sViewPath . $viewUrl, $aData);
             } elseif (is_array($viewUrl)) {
                 foreach ($viewUrl as $aSubData) {
                     $aSubData = array_merge($aData, $aSubData);
                     Yii::app()->getController()->render($sViewPath . $sViewKey, $aSubData);
                 }
             }
         } else {
             switch ($sViewKey) {
                 // Message
                 case 'message':
                     if (empty($viewUrl['class'])) {
                         Yii::app()->getController()->_showMessageBox($viewUrl['title'], $viewUrl['message']);
                     } else {
                         Yii::app()->getController()->_showMessageBox($viewUrl['title'], $viewUrl['message'], $viewUrl['class']);
                     }
                     break;
                     // Output
                 // Output
                 case 'output':
                     echo $viewUrl;
                     break;
             }
         }
     }
     // Footer
     if (!isset($aData['display']['endscripts']) || $aData['display']['endscripts'] !== false) {
         Yii::app()->getController()->_loadEndScripts();
     }
     if (!isset($aData['display']['footer']) || $aData['display']['footer'] !== false) {
         Yii::app()->getController()->_getAdminFooter('http://docs.limesurvey.org', $clang->gT('LimeSurvey online manual'));
     }
 }
开发者ID:ryu1inaba,项目名称:LimeSurvey,代码行数:95,代码来源:Survey_Common_Action.php

示例5: display_first_page

/**
* Shows the welcome page, used in group by group and question by question mode
*/
function display_first_page()
{
    global $token, $surveyid, $thissurvey, $navigator;
    $totalquestions = $_SESSION['survey_' . $surveyid]['totalquestions'];
    // Fill some necessary var for template
    $aNavigator = surveymover();
    $moveprevbutton = $aNavigator['sMovePrevButton'];
    $movenextbutton = $aNavigator['sMoveNextButton'];
    $navigator = $moveprevbutton . ' ' . $movenextbutton;
    $sitename = Yii::app()->getConfig('sitename');
    $languagechanger = makeLanguageChangerSurvey(App()->language);
    sendCacheHeaders();
    doHeader();
    LimeExpressionManager::StartProcessingPage();
    LimeExpressionManager::StartProcessingGroup(-1, false, $surveyid);
    // start on welcome page
    $redata = compact(array_keys(get_defined_vars()));
    $oTemplate = Template::model()->getInstance('', $surveyid);
    $sTemplatePath = $oTemplate->path;
    $sTemplateViewPath = $oTemplate->viewPath;
    echo templatereplace(file_get_contents($sTemplateViewPath . "startpage.pstpl"), array(), $redata, 'frontend_helper[2757]');
    echo CHtml::form(array("/survey/index", "sid" => $surveyid), 'post', array('id' => 'limesurvey', 'name' => 'limesurvey', 'autocomplete' => 'off', 'class' => 'frontend_helper'));
    echo templatereplace(file_get_contents($sTemplateViewPath . "welcome.pstpl"), array(), $redata, 'frontend_helper[2762]') . "\n";
    if ($thissurvey['anonymized'] == "Y") {
        echo templatereplace(file_get_contents($sTemplateViewPath . "/privacy.pstpl"), array(), $redata, 'frontend_helper[2765]') . "\n";
    }
    echo templatereplace(file_get_contents($sTemplateViewPath . "navigator.pstpl"), array(), $redata, 'frontend_helper[2767]');
    echo "\n<input type='hidden' name='sid' value='{$surveyid}' id='sid' />\n";
    if (isset($token) && !empty($token)) {
        echo "\n<input type='hidden' name='token' value='{$token}' id='token' />\n";
    }
    echo "\n<input type='hidden' name='lastgroupname' value='_WELCOME_SCREEN_' id='lastgroupname' />\n";
    //This is to ensure consistency with mandatory checks, and new group test
    $loadsecurity = returnGlobal('loadsecurity', true);
    if (isset($loadsecurity)) {
        echo "\n<input type='hidden' name='loadsecurity' value='{$loadsecurity}' id='loadsecurity' />\n";
    }
    $_SESSION['survey_' . $surveyid]['LEMpostKey'] = mt_rand();
    echo "<input type='hidden' name='LEMpostKey' value='{$_SESSION['survey_' . $surveyid]['LEMpostKey']}' id='LEMpostKey' />\n";
    echo "<input type='hidden' name='thisstep' id='thisstep' value='0' />\n";
    echo "<!--frontendhelper --></form>";
    echo templatereplace(file_get_contents($sTemplateViewPath . "endpage.pstpl"), array(), $redata, 'frontend_helper[2782]');
    echo LimeExpressionManager::GetRelevanceAndTailoringJavaScript();
    LimeExpressionManager::FinishProcessingPage();
    doFooter();
    echo "<!-- end of frontend_helper /  display_first_page -->";
}
开发者ID:joaocc,项目名称:LimeSurvey--LimeSurvey,代码行数:50,代码来源:frontend_helper.php

示例6: PDF

    }
}
//OK. IF WE GOT THIS FAR, THEN THE SURVEY EXISTS AND IT IS ACTIVE, SO LETS GET TO WORK.
//SHOW HEADER
$printoutput = '';
if (isset($usepdfexport) && $usepdfexport == 1) {
    $printoutput .= "<form action='printanswers.php?printableexport=pdf&sid={$surveyid}' method='post'>\n<center><input type='submit' value='" . $clang->gT("PDF Export") . "'id=\"exportbutton\"/><input type='hidden' name='printableexport' /></center></form>";
}
if (isset($_POST['printableexport'])) {
    $pdf = new PDF($pdforientation);
    $pdf->SetFont($pdfdefaultfont, '', $pdffontsize);
    $pdf->AddPage();
    $pdf->titleintopdf($clang->gT("Survey name (ID)", 'unescaped') . ": {$surveyname} ({$surveyid})");
}
$printoutput .= "\t<div class='printouttitle'><strong>" . $clang->gT("Survey name (ID):") . "</strong> {$surveyname} ({$surveyid})</div><p>&nbsp;\n";
LimeExpressionManager::StartProcessingPage(true);
// means that all variables are on the same page
// Since all data are loaded, and don't need JavaScript, pretend all from Group -1
LimeExpressionManager::StartProcessingGroup(-1, $thissurvey['anonymized'] != "N", $surveyid);
$bHonorConditions = $printanswershonorsconditions == 1;
$aFullResponseTable = aGetFullResponseTable($surveyid, $id, $language, $bHonorConditions);
//Get the fieldmap @TODO: do we need to filter out some fields?
unset($aFullResponseTable['id']);
unset($aFullResponseTable['token']);
unset($aFullResponseTable['lastpage']);
unset($aFullResponseTable['startlanguage']);
unset($aFullResponseTable['datestamp']);
unset($aFullResponseTable['startdate']);
$printoutput .= "<table class='printouttable' >\n";
if (isset($_POST['printableexport'])) {
    $pdf->intopdf($clang->gT("Question", 'unescaped') . ": " . $clang->gT("Your answer", 'unescaped'));
开发者ID:rkaldung,项目名称:LimeSurvey,代码行数:31,代码来源:printanswers.php

示例7: UnitTestRelevance

    /**
     * Unit test Relevance using a simplified syntax to represent questions.
     */
    static function UnitTestRelevance()
    {
        // Tests:  varName~relevance~inputType~message
        $tests = <<<EOT
name~1~text~What is your name?
age~1~text~How old are you (must be 16-80)?
badage~1~expr~{badage=((age<16) || (age>80))}
agestop~!is_empty(age) && ((age<16) || (age>80))~message~Sorry, {name}, you are too {if((age<16),'young',if((age>80),'old','middle-aged'))} for this test.
kids~!((age<16) || (age>80))~yesno~Do you have children (Y/N)?
kidsO~!is_empty(kids) && !(kids=='Y' or kids=='N')~message~Please answer the question about whether you have children with 'Y' or 'N'.
wantsKids~kids=='N'~yesno~Do you hope to have kids some day (Y/N)?
wantsKidsY~wantsKids=='Y'~message~{name}, I hope you are able to have children some day!
wantsKidsN~wantsKids=='N'~message~{name}, I hope you have a wonderfully fulfilling life!
wantsKidsO~!is_empty(wantsKids) && !(wantsKids=='Y' or wantsKids=='N')~message~Please answer the question about whether you want children with 'Y' or 'N'.
parents~1~expr~{parents = (!badage && kids=='Y')}
numKids~kids=='Y'~text~How many children do you have?
numKidsValidation~parents and strlen(numKids) > 0 and numKids <= 0~message~{name}, please check your entries.  You said you do have children, {numKids} of them, which makes no sense.
kid1~numKids >= 1~text~How old is your first child?
kid2~numKids >= 2~text~How old is your second child?
kid3~numKids >= 3~text~How old is your third child?
kid4~numKids >= 4~text~How old is your fourth child?
kid5~numKids >= 5~text~How old is your fifth child?
sumage~1~expr~{sumage=sum(kid1.NAOK,kid2.NAOK,kid3.NAOK,kid4.NAOK,kid5.NAOK)}
report~numKids > 0~message~{name}, you said you are {age} and that you have {numKids} kids.  The sum of ages of your first {min(numKids,5)} kids is {sumage}.
EOT;
        $vars = array();
        $varsNAOK = array();
        $varSeq = array();
        $testArgs = array();
        $argInfo = array();
        LimeExpressionManager::SetDirtyFlag();
        $LEM =& LimeExpressionManager::singleton();
        LimeExpressionManager::StartProcessingPage(true);
        LimeExpressionManager::StartProcessingGroup(1);
        // pretending this is group 1
        // collect variables
        $i = 0;
        foreach (explode("\n", $tests) as $test) {
            $args = explode("~", $test);
            $type = $args[1] == 'expr' ? '*' : $args[1] == 'message' ? 'X' : 'S';
            $vars[$args[0]] = array('sgqa' => $args[0], 'code' => '', 'jsName' => 'java' . $args[0], 'jsName_on' => 'java' . $args[0], 'readWrite' => 'Y', 'type' => $type, 'relevanceStatus' => '1', 'gid' => 1, 'gseq' => 1, 'qseq' => $i, 'qid' => $i);
            $varSeq[] = $args[0];
            $testArgs[] = $args;
            $LEM->questionId2questionSeq[$i] = $i;
            $LEM->questionId2groupSeq[$i] = 1;
            $LEM->questionSeq2relevance[$i] = array('relevance' => htmlspecialchars(preg_replace('/[[:space:]]/', ' ', $args[1]), ENT_QUOTES), 'qid' => $i, 'qseq' => $i, 'gseq' => 1, 'jsResultVar' => 'java' . $args[0], 'type' => $type, 'hidden' => false, 'gid' => 1);
            ++$i;
        }
        $LEM->knownVars = $vars;
        $LEM->gRelInfo[1] = array('gid' => 1, 'gseq' => 1, 'eqn' => '', 'result' => 1, 'numJsVars' => 0, 'relevancejs' => '', 'relevanceVars' => '', 'prettyPrint' => '');
        $LEM->ProcessAllNeededRelevance();
        // collect relevance
        $alias2varName = array();
        $varNameAttr = array();
        for ($i = 0; $i < count($testArgs); ++$i) {
            $testArg = $testArgs[$i];
            $var = $testArg[0];
            $rel = LimeExpressionManager::QuestionIsRelevant($i);
            $question = LimeExpressionManager::ProcessString($testArg[3], $i, NULL, true, 1, 1);
            $jsVarName = 'java' . str_replace('#', '_', $testArg[0]);
            $argInfo[] = array('num' => $i, 'name' => $jsVarName, 'sgqa' => $testArg[0], 'type' => $testArg[2], 'question' => $question, 'relevance' => $testArg[1], 'relevanceStatus' => $rel);
            $alias2varName[$var] = array('jsName' => $jsVarName, 'jsPart' => "'" . $var . "':'" . $jsVarName . "'");
            $alias2varName[$jsVarName] = array('jsName' => $jsVarName, 'jsPart' => "'" . $jsVarName . "':'" . $jsVarName . "'");
            $varNameAttr[$jsVarName] = "'" . $jsVarName . "':{" . "'jsName':'" . $jsVarName . "','jsName_on':'" . $jsVarName . "','sgqa':'" . substr($jsVarName, 4) . "','qid':" . $i . ",'gid':" . 1 . "}";
        }
        $LEM->alias2varName = $alias2varName;
        $LEM->varNameAttr = $varNameAttr;
        LimeExpressionManager::FinishProcessingGroup();
        LimeExpressionManager::FinishProcessingPage();
        print <<<EOD
    <script type='text/javascript'>
    <!--
    var LEMradix='.';
    function checkconditions(value, name, type, evt_type)
    {
        if (typeof evt_type === 'undefined')
        {
            evt_type = 'onchange';
        }
        ExprMgr_process_relevance_and_tailoring(evt_type,name,type);
    }
    // -->
    </script>
EOD;
        print LimeExpressionManager::GetRelevanceAndTailoringJavaScript();
        // Print Table of questions
        print "<h3>This is a test of dynamic relevance.</h3>";
        print "Enter your name and age, and try all the permutations of answers to whether you have or want children.<br />\n";
        print "Note how the text and sum of ages changes dynamically; that prior answers are remembered; and that irrelevant values are not included in the sum of ages.<br />";
        print "<table class='table' border='1'><tr><td>";
        foreach ($argInfo as $arg) {
            $rel = LimeExpressionManager::QuestionIsRelevant($arg['num']);
            print "<div id='question" . $arg['num'] . ($rel ? "'" : "' style='display: none'") . ">\n";
            print "<input type='hidden' id='display" . $arg['num'] . "' name='" . $arg['num'] . "' value='" . ($rel ? 'on' : '') . "'/>\n";
            if ($arg['type'] == 'expr') {
                // Hack for testing purposes - rather than using LimeSurvey internals to store the results of equations, process them via a hidden <div>
                print "<div style='display: none' id='hack_" . $arg['name'] . "'>" . $arg['question'];
//.........这里部分代码省略.........
开发者ID:GuillaumeSmaha,项目名称:LimeSurvey,代码行数:101,代码来源:em_manager_helper.php

示例8: actionView

 /**
  * printanswers::view()
  * View answers at the end of a survey in one place. To export as pdf, set 'usepdfexport' = 1 in lsconfig.php and $printableexport='pdf'.
  * @param mixed $surveyid
  * @param bool $printableexport
  * @return
  */
 function actionView($surveyid, $printableexport = FALSE)
 {
     global $siteadminname, $siteadminemail;
     Yii::app()->loadHelper("frontend");
     Yii::import('application.libraries.admin.pdf');
     $surveyid = (int) $surveyid;
     Yii::app()->loadHelper('database');
     if (isset($_SESSION['survey_' . $surveyid]['sid'])) {
         $surveyid = $_SESSION['survey_' . $surveyid]['sid'];
     } else {
         die('Invalid survey/session');
     }
     //Debut session time out
     if (!isset($_SESSION['survey_' . $surveyid]['finished']) || !isset($_SESSION['survey_' . $surveyid]['srid'])) {
         //require_once($rootdir.'/classes/core/language.php');
         $baselang = Survey::model()->findByPk($surveyid)->language;
         Yii::import('application.libraries.Limesurvey_lang', true);
         $clang = new Limesurvey_lang($baselang);
         //A nice exit
         sendCacheHeaders();
         doHeader();
         echo templatereplace(file_get_contents(getTemplatePath(validateTemplateDir("default")) . "/startpage.pstpl"), array(), array());
         echo "<center><br />\n" . "\t<font color='RED'><strong>" . $clang->gT("Error") . "</strong></font><br />\n" . "\t" . $clang->gT("We are sorry but your session has expired.") . "<br />" . $clang->gT("Either you have been inactive for too long, you have cookies disabled for your browser, or there were problems with your connection.") . "<br />\n" . "\t" . sprintf($clang->gT("Please contact %s ( %s ) for further assistance."), $siteadminname, $siteadminemail) . "\n" . "</center><br />\n";
         echo templatereplace(file_get_contents(getTemplatePath(validateTemplateDir("default")) . "/endpage.pstpl"), array(), array());
         doFooter();
         exit;
     }
     //Fin session time out
     $id = $_SESSION['survey_' . $surveyid]['srid'];
     //I want to see the answers with this id
     $clang = $_SESSION['survey_' . $surveyid]['s_lang'];
     //Ensure script is not run directly, avoid path disclosure
     //if (!isset($rootdir) || isset($_REQUEST['$rootdir'])) {die( "browse - Cannot run this script directly");}
     // Set the language for dispay
     //require_once($rootdir.'/classes/core/language.php');  // has been secured
     if (isset($_SESSION['survey_' . $surveyid]['s_lang'])) {
         $clang = SetSurveyLanguage($surveyid, $_SESSION['survey_' . $surveyid]['s_lang']);
         $language = $_SESSION['survey_' . $surveyid]['s_lang'];
     } else {
         $language = Survey::model()->findByPk($surveyid)->language;
         $clang = SetSurveyLanguage($surveyid, $language);
     }
     // Get the survey inforamtion
     $thissurvey = getSurveyInfo($surveyid, $language);
     //SET THE TEMPLATE DIRECTORY
     if (!isset($thissurvey['templatedir']) || !$thissurvey['templatedir']) {
         $thistpl = validateTemplateDir("default");
     } else {
         $thistpl = validateTemplateDir($thissurvey['templatedir']);
     }
     if ($thissurvey['printanswers'] == 'N') {
         die;
         //Die quietly if print answers is not permitted
     }
     //CHECK IF SURVEY IS ACTIVATED AND EXISTS
     $surveytable = "{{survey_{$surveyid}}}";
     $surveyname = $thissurvey['surveyls_title'];
     $anonymized = $thissurvey['anonymized'];
     //OK. IF WE GOT THIS FAR, THEN THE SURVEY EXISTS AND IT IS ACTIVE, SO LETS GET TO WORK.
     //SHOW HEADER
     $printoutput = '';
     $printoutput .= "<form action='" . Yii::app()->getController()->createUrl('printanswers/view/surveyid/' . $surveyid . '/printableexport/pdf') . "' method='post'>\n<center><input type='submit' value='" . $clang->gT("PDF export") . "'id=\"exportbutton\"/><input type='hidden' name='printableexport' /></center></form>";
     if ($printableexport == 'pdf') {
         require Yii::app()->getConfig('rootdir') . '/application/config/tcpdf.php';
         Yii::import('application.libraries.admin.pdf', true);
         $pdf = new pdf();
         $pdf->setConfig($tcpdf);
         //$pdf->SetFont($pdfdefaultfont,'',$pdffontsize);
         $pdf->AddPage();
         //$pdf->titleintopdf($clang->gT("Survey name (ID)",'unescaped').": {$surveyname} ({$surveyid})");
         $pdf->SetTitle($clang->gT("Survey name (ID)", 'unescaped') . ": {$surveyname} ({$surveyid})");
     }
     $printoutput .= "\t<div class='printouttitle'><strong>" . $clang->gT("Survey name (ID):") . "</strong> {$surveyname} ({$surveyid})</div><p>&nbsp;\n";
     LimeExpressionManager::StartProcessingPage(true);
     // means that all variables are on the same page
     // Since all data are loaded, and don't need JavaScript, pretend all from Group 1
     LimeExpressionManager::StartProcessingGroup(1, $thissurvey['anonymized'] != "N", $surveyid);
     $aFullResponseTable = getFullResponseTable($surveyid, $id, $language, true);
     //Get the fieldmap @TODO: do we need to filter out some fields?
     unset($aFullResponseTable['id']);
     unset($aFullResponseTable['token']);
     unset($aFullResponseTable['lastpage']);
     unset($aFullResponseTable['startlanguage']);
     unset($aFullResponseTable['datestamp']);
     unset($aFullResponseTable['startdate']);
     $printoutput .= "<table class='printouttable' >\n";
     if ($printableexport == 'pdf') {
         $pdf->intopdf($clang->gT("Question", 'unescaped') . ": " . $clang->gT("Your answer", 'unescaped'));
     }
     $oldgid = 0;
     $oldqid = 0;
     foreach ($aFullResponseTable as $sFieldname => $fname) {
         if (substr($sFieldname, 0, 4) == 'gid_') {
//.........这里部分代码省略.........
开发者ID:rawaludin,项目名称:LimeSurvey,代码行数:101,代码来源:PrintanswersController.php

示例9: index

 /**
  * Load edit/new question screen depending on $action.
  *
  * @access public
  * @param string $sa subaction
  * @param int $surveyid
  * @param int $gid
  * @param int $qid
  * @return void
  */
 public function index($sa, $surveyid, $gid, $qid = null)
 {
     App()->getClientScript()->registerPackage('qTip2');
     $action = $sa;
     $surveyid = $iSurveyID = sanitize_int($surveyid);
     $gid = sanitize_int($gid);
     if (isset($qid)) {
         $qid = sanitize_int($qid);
     }
     $aViewUrls = array();
     $aData['surveyid'] = $surveyid;
     $aData['gid'] = $gid;
     $aData['qid'] = $qid;
     $aData['display']['menu_bars']['surveysummary'] = 'viewgroup';
     $aData['display']['menu_bars']['gid_action'] = 'addquestion';
     $surveyinfo = Survey::model()->findByPk($iSurveyID)->surveyinfo;
     $aData['title_bar']['title'] = $surveyinfo['surveyls_title'] . "(" . gT("ID") . ":" . $iSurveyID . ")";
     $aData['questiongroupbar']['savebutton']['form'] = 'frmeditgroup';
     $aData['questiongroupbar']['saveandclosebutton']['form'] = 'frmeditgroup';
     $aData['questiongroupbar']['closebutton']['url'] = 'admin/questions/sa/view/surveyid/' . $surveyid . '/gid/' . $gid . '/qid/' . $qid;
     Yii::app()->session['FileManagerContext'] = "create:question:{$surveyid}";
     if (Permission::model()->hasSurveyPermission($surveyid, 'surveycontent', 'read')) {
         $surveyinfo = getSurveyInfo($surveyid);
         Yii::app()->loadHelper('admin/htmleditor');
         Yii::app()->loadHelper('surveytranslator');
         if (isset($_POST['sortorder'])) {
             $postsortorder = sanitize_int($_POST['sortorder']);
         }
         $aData['adding'] = $adding = $action == 'addquestion';
         $aData['copying'] = $copying = $action == 'copyquestion';
         $questlangs = Survey::model()->findByPk($surveyid)->additionalLanguages;
         $baselang = Survey::model()->findByPk($surveyid)->language;
         $questlangs[] = $baselang;
         $questlangs = array_flip($questlangs);
         // Prepare selector Mode TODO: with and without image
         if (!$adding) {
             Yii::app()->session['FileManagerContext'] = "edit:question:{$surveyid}";
             $aData['display']['menu_bars']['qid_action'] = 'editquestion';
             $egresult = Question::model()->findAllByAttributes(array('sid' => $surveyid, 'gid' => $gid, 'qid' => $qid));
             foreach ($egresult as $esrow) {
                 if (!array_key_exists($esrow->language, $questlangs)) {
                     // Language Exists, BUT ITS NOT ON THE SURVEY ANYMORE.
                     $esrow->delete();
                 } else {
                     $questlangs[$esrow->language] = 99;
                 }
                 if ($esrow->language == $baselang) {
                     $esrow = $esrow->attributes;
                     $basesettings = array('question_order' => $esrow['question_order'], 'other' => $esrow['other'], 'mandatory' => $esrow['mandatory'], 'type' => $esrow['type'], 'title' => $esrow['title'], 'preg' => $esrow['preg'], 'question' => $esrow['question'], 'help' => $esrow['help']);
                 }
             }
             if (!$egresult) {
                 $this->getController()->error('Invalid question id');
             }
             while (list($key, $value) = each($questlangs)) {
                 if ($value != 99) {
                     $arQuestion = new Question();
                     $arQuestion->qid = $qid;
                     $arQuestion->sid = $surveyid;
                     $arQuestion->gid = $gid;
                     $arQuestion->type = $basesettings['type'];
                     $arQuestion->title = $basesettings['title'];
                     $arQuestion->question = $basesettings['question'];
                     $arQuestion->preg = $basesettings['preg'];
                     $arQuestion->help = $basesettings['help'];
                     $arQuestion->other = $basesettings['other'];
                     $arQuestion->mandatory = $basesettings['mandatory'];
                     $arQuestion->question_order = $basesettings['question_order'];
                     $arQuestion->language = $key;
                     $arQuestion->insert();
                 }
             }
             $eqresult = Question::model()->with('groups')->together()->findByAttributes(array('sid' => $surveyid, 'gid' => $gid, 'qid' => $qid, 'language' => $baselang));
         } else {
             // This is needed to properly color-code content if it contains replacements
             LimeExpressionManager::StartProcessingPage(false, Yii::app()->baseUrl, true);
             // so can click on syntax highlighting to edit questions
         }
         $qtypelist = getQuestionTypeList('', 'array');
         $qDescToCode = 'qDescToCode = {';
         $qCodeToInfo = 'qCodeToInfo = {';
         foreach ($qtypelist as $qtype => $qdesc) {
             $qDescToCode .= " '{$qdesc['description']}' : '{$qtype}', \n";
             $qCodeToInfo .= " '{$qtype}' : '" . ls_json_encode($qdesc) . "', \n";
         }
         $aData['qTypeOutput'] = "{$qDescToCode} 'null':'null' }; \n {$qCodeToInfo} 'null':'null' };";
         if (!$adding) {
             if (is_object($eqresult->groups)) {
                 $eqrow = array_merge($eqresult->attributes, $eqresult->groups->attributes);
             } else {
//.........这里部分代码省略.........
开发者ID:CSCI-462-01-2016,项目名称:LimeSurvey,代码行数:101,代码来源:questions.php

示例10: actionView

 /**
  * printanswers::view()
  * View answers at the end of a survey in one place. To export as pdf, set 'usepdfexport' = 1 in lsconfig.php and $printableexport='pdf'.
  * @param mixed $surveyid
  * @param bool $printableexport
  * @return
  */
 function actionView($surveyid, $printableexport = FALSE)
 {
     Yii::app()->loadHelper("frontend");
     Yii::import('application.libraries.admin.pdf');
     $iSurveyID = (int) $surveyid;
     $sExportType = $printableexport;
     Yii::app()->loadHelper('database');
     if (isset($_SESSION['survey_' . $iSurveyID]['sid'])) {
         $iSurveyID = $_SESSION['survey_' . $iSurveyID]['sid'];
     } else {
         //die('Invalid survey/session');
     }
     // Get the survey inforamtion
     // Set the language for dispay
     if (isset($_SESSION['survey_' . $iSurveyID]['s_lang'])) {
         $sLanguage = $_SESSION['survey_' . $iSurveyID]['s_lang'];
     } elseif (Survey::model()->findByPk($iSurveyID)) {
         $sLanguage = Survey::model()->findByPk($iSurveyID)->language;
     } else {
         $iSurveyID = 0;
         $sLanguage = Yii::app()->getConfig("defaultlang");
     }
     SetSurveyLanguage($iSurveyID, $sLanguage);
     $aSurveyInfo = getSurveyInfo($iSurveyID, $sLanguage);
     $oTemplate = Template::model()->getInstance(null, $iSurveyID);
     //Survey is not finished or don't exist
     if (!isset($_SESSION['survey_' . $iSurveyID]['finished']) || !isset($_SESSION['survey_' . $iSurveyID]['srid'])) {
         sendCacheHeaders();
         doHeader();
         /// $oTemplate is a global variable defined in controller/survey/index
         echo templatereplace(file_get_contents($oTemplate->viewPath . '/startpage.pstpl'), array());
         echo "<center><br />\n" . "\t<font color='RED'><strong>" . gT("Error") . "</strong></font><br />\n" . "\t" . gT("We are sorry but your session has expired.") . "<br />" . gT("Either you have been inactive for too long, you have cookies disabled for your browser, or there were problems with your connection.") . "<br />\n" . "\t" . sprintf(gT("Please contact %s ( %s ) for further assistance."), Yii::app()->getConfig("siteadminname"), Yii::app()->getConfig("siteadminemail")) . "\n" . "</center><br />\n";
         echo templatereplace(file_get_contents($oTemplate->viewPath . '/endpage.pstpl'), array());
         doFooter();
         exit;
     }
     //Fin session time out
     $sSRID = $_SESSION['survey_' . $iSurveyID]['srid'];
     //I want to see the answers with this id
     //Ensure script is not run directly, avoid path disclosure
     //if (!isset($rootdir) || isset($_REQUEST['$rootdir'])) {die( "browse - Cannot run this script directly");}
     //Ensure Participants printAnswer setting is set to true or that the logged user have read permissions over the responses.
     if ($aSurveyInfo['printanswers'] == 'N' && !Permission::model()->hasSurveyPermission($iSurveyID, 'responses', 'read')) {
         throw new CHttpException(401, 'You are not allowed to print answers.');
     }
     //CHECK IF SURVEY IS ACTIVATED AND EXISTS
     $sSurveyName = $aSurveyInfo['surveyls_title'];
     $sAnonymized = $aSurveyInfo['anonymized'];
     //OK. IF WE GOT THIS FAR, THEN THE SURVEY EXISTS AND IT IS ACTIVE, SO LETS GET TO WORK.
     //SHOW HEADER
     if ($sExportType != 'pdf') {
         $sOutput = CHtml::form(array("printanswers/view/surveyid/{$iSurveyID}/printableexport/pdf"), 'post') . "<center><input class='btn btn-default' type='submit' value='" . gT("PDF export") . "'id=\"exportbutton\"/><input type='hidden' name='printableexport' /></center></form>";
         $sOutput .= "\t<div class='printouttitle'><strong>" . gT("Survey name (ID):") . "</strong> {$sSurveyName} ({$iSurveyID})</div><p>&nbsp;\n";
         LimeExpressionManager::StartProcessingPage(true);
         // means that all variables are on the same page
         // Since all data are loaded, and don't need JavaScript, pretend all from Group 1
         LimeExpressionManager::StartProcessingGroup(1, $aSurveyInfo['anonymized'] != "N", $iSurveyID);
         $printanswershonorsconditions = Yii::app()->getConfig('printanswershonorsconditions');
         $aFullResponseTable = getFullResponseTable($iSurveyID, $sSRID, $sLanguage, $printanswershonorsconditions);
         //Get the fieldmap @TODO: do we need to filter out some fields?
         if ($aSurveyInfo['datestamp'] != "Y" || $sAnonymized == 'Y') {
             unset($aFullResponseTable['submitdate']);
         } else {
             unset($aFullResponseTable['id']);
         }
         unset($aFullResponseTable['token']);
         unset($aFullResponseTable['lastpage']);
         unset($aFullResponseTable['startlanguage']);
         unset($aFullResponseTable['datestamp']);
         unset($aFullResponseTable['startdate']);
         $sOutput .= "<table class='printouttable' >\n";
         foreach ($aFullResponseTable as $sFieldname => $fname) {
             if (substr($sFieldname, 0, 4) == 'gid_') {
                 $sOutput .= "\t<tr class='printanswersgroup'><td colspan='2'>{$fname[0]}</td></tr>\n";
                 $sOutput .= "\t<tr class='printanswersgroupdesc'><td colspan='2'>{$fname[1]}</td></tr>\n";
             } elseif ($sFieldname == 'submitdate') {
                 if ($sAnonymized != 'Y') {
                     $sOutput .= "\t<tr class='printanswersquestion'><td>{$fname[0]} {$fname[1]} {$sFieldname}</td><td class='printanswersanswertext'>{$fname[2]}</td></tr>";
                 }
             } elseif (substr($sFieldname, 0, 4) != 'qid_') {
                 $sOutput .= "\t<tr class='printanswersquestion'><td>{$fname[0]} {$fname[1]}</td><td class='printanswersanswertext'>" . flattenText($fname[2]) . "</td></tr>";
             }
         }
         $sOutput .= "</table>\n";
         $sData['thissurvey'] = $aSurveyInfo;
         $sOutput = templatereplace($sOutput, array(), $sData, '', $aSurveyInfo['anonymized'] == "Y", NULL, array(), true);
         // Do a static replacement
         ob_start(function ($buffer, $phase) {
             App()->getClientScript()->render($buffer);
             App()->getClientScript()->reset();
             return $buffer;
         });
         ob_implicit_flush(false);
//.........这里部分代码省略.........
开发者ID:GuillaumeSmaha,项目名称:LimeSurvey,代码行数:101,代码来源:PrintanswersController.php

示例11: _renderWrappedTemplate

 /**
  * Renders template(s) wrapped in header and footer
  *
  * Addition of parameters should be avoided if they can be added to $aData
  *
  * @param string $sAction Current action, the folder to fetch views from
  * @param string|array $aViewUrls View url(s)
  * @param array $aData Data to be passed on. Optional.
  */
 protected function _renderWrappedTemplate($sAction = '', $aViewUrls = array(), $aData = array())
 {
     // Gather the data
     $aData['clang'] = $clang = Yii::app()->lang;
     $aData['sImageURL'] = Yii::app()->getConfig('adminimageurl');
     $aData = $this->_addPseudoParams($aData);
     $aViewUrls = (array) $aViewUrls;
     $sViewPath = '/pl/';
     if (!empty($sAction)) {
         $sViewPath .= $sAction . '/';
     }
     // Header
     ob_start();
     if (!isset($aData['display']['header']) || $aData['display']['header'] !== false) {
         // Send HTTP header
         header("Content-type: text/html; charset=UTF-8");
         // needed for correct UTF-8 encoding
         Yii::app()->getController()->_getPLHeader();
     }
     // Menu bars
     if (!isset($aData['display']['menu_bars']) || $aData['display']['menu_bars'] !== false && (!is_array($aData['display']['menu_bars']) || !in_array('browse', array_keys($aData['display']['menu_bars'])))) {
         Yii::app()->getController()->_showPLmenu(!empty($aData['plid']) ? $aData['plid'] : null);
         if (!empty($aData['plid'])) {
             LimeExpressionManager::StartProcessingPage(false, Yii::app()->baseUrl, true);
             // so can click on syntax highlighting to edit questions
             $this->_surveybar($aData['plid'], !empty($aData['gid']) ? $aData['gid'] : null);
             LimeExpressionManager::FinishProcessingPage();
         }
     }
     // Load views
     foreach ($aViewUrls as $sViewKey => $viewUrl) {
         if (empty($sViewKey) || !in_array($sViewKey, array('message', 'output'))) {
             if (is_numeric($sViewKey)) {
                 Yii::app()->getController()->renderPartial($sViewPath . $viewUrl, $aData);
             } elseif (is_array($viewUrl)) {
                 foreach ($viewUrl as $aSubData) {
                     $aSubData = array_merge($aData, $aSubData);
                     Yii::app()->getController()->renderPartial($sViewPath . $sViewKey, $aSubData);
                 }
             }
         } else {
             switch ($sViewKey) {
                 // Message
                 case 'message':
                     if (empty($viewUrl['class'])) {
                         Yii::app()->getController()->_showMessageBox($viewUrl['title'], $viewUrl['message']);
                     } else {
                         Yii::app()->getController()->_showMessageBox($viewUrl['title'], $viewUrl['message'], $viewUrl['class']);
                     }
                     break;
                     // Output
                 // Output
                 case 'output':
                     echo $viewUrl;
                     break;
             }
         }
     }
     // Footer
     /*
     if (!isset($aData['display']['endscripts']) || $aData['display']['endscripts'] !== false)
         Yii::app()->getController()->_loadEndScripts();
     */
     if (!isset($aData['display']['footer']) || $aData['display']['footer'] !== false) {
         Yii::app()->getController()->_getPLFooter('http://docs.gowebsurvey.com', $clang->gT('GoWebSurvey Online Manual'));
     }
     $out = ob_get_contents();
     ob_clean();
     App()->getClientScript()->render($out);
     echo $out;
 }
开发者ID:jdbaltazar,项目名称:survey-office,代码行数:80,代码来源:PL_Common_Action.php

示例12: getLanguageNameFromCode

 $surveysummary .= "<tr>" . "<td align='right' valign='top'><strong>" . $clang->gT("Survey URL") . " (" . getLanguageNameFromCode($surveyinfo['language'], false) . "):</strong></td>\n";
 if ($modrewrite) {
     $tmp_url = $GLOBALS['publicurl'] . '/' . $surveyinfo['sid'];
     $surveysummary .= "<td align='left'> <a href='{$tmp_url}/lang-" . $surveyinfo['language'] . "' target='_blank'>{$tmp_url}/lang-" . $surveyinfo['language'] . "</a>";
     foreach ($aAdditionalLanguages as $langname) {
         $surveysummary .= "&nbsp;<a href='{$tmp_url}/lang-{$langname}' target='_blank'><img title='" . $clang->gT("Survey URL for language:") . " " . getLanguageNameFromCode($langname, false) . "' alt='" . getLanguageNameFromCode($langname, false) . " " . $clang->gT("Flag") . "' src='../images/flags/{$langname}.png' /></a>";
     }
 } else {
     $tmp_url = $GLOBALS['publicurl'] . '/index.php?sid=' . $surveyinfo['sid'];
     $surveysummary .= "<td align='left'> <a href='{$tmp_url}&amp;lang=" . $surveyinfo['language'] . "' target='_blank'>{$tmp_url}&amp;lang=" . $surveyinfo['language'] . "</a>";
     foreach ($aAdditionalLanguages as $langname) {
         $surveysummary .= "&nbsp;<a href='{$tmp_url}&amp;lang={$langname}' target='_blank'><img title='" . $clang->gT("Survey URL for language:") . " " . getLanguageNameFromCode($langname, false) . "' alt='" . getLanguageNameFromCode($langname, false) . " " . $clang->gT("Flag") . "' src='../images/flags/{$langname}.png' /></a>";
     }
 }
 $surveysummary .= "</td></tr>\n" . "<tr><td align='right' valign='top'><strong>" . $clang->gT("Description:") . "</strong></td>\n<td align='left'>";
 LimeExpressionManager::StartProcessingPage(false, $rooturl);
 // so can click on syntax highlighting to edit questions
 LimeExpressionManager::StartProcessingGroup($gid, false, $surveyid);
 // loads list of replacement values available for this group
 if (trim($surveyinfo['surveyls_description']) != '') {
     templatereplace($surveyinfo['surveyls_description']);
     $surveysummary .= LimeExpressionManager::GetLastPrettyPrintExpression();
 }
 $surveysummary .= "</td></tr>\n" . "<tr >\n" . "<td align='right' valign='top'><strong>" . $clang->gT("Welcome:") . "</strong></td>\n" . "<td align='left'>";
 templatereplace($surveyinfo['surveyls_welcometext']);
 $surveysummary .= LimeExpressionManager::GetLastPrettyPrintExpression();
 $surveysummary .= "</td></tr>\n" . "<tr ><td align='right' valign='top'><strong>" . $clang->gT("Administrator:") . "</strong></td>\n" . "<td align='left'> {$surveyinfo['admin']} ({$surveyinfo['adminemail']})</td></tr>\n";
 if (trim($surveyinfo['faxto']) != '') {
     $surveysummary .= "<tr><td align='right' valign='top'><strong>" . $clang->gT("Fax to:") . "</strong></td>\n<td align='left'>{$surveyinfo['faxto']}";
     $surveysummary .= "</td></tr>\n";
 }
开发者ID:rkaldung,项目名称:LimeSurvey,代码行数:31,代码来源:html.php

示例13: view

 /**
  * dataentry::view()
  * view a dataentry
  * @param mixed $surveyid
  * @param mixed $lang
  * @return
  */
 public function view($surveyid, $lang = NULL)
 {
     $surveyid = sanitize_int($surveyid);
     $lang = isset($_GET['lang']) ? $_GET['lang'] : NULL;
     if (isset($lang)) {
         $lang = sanitize_languagecode($lang);
     }
     $aViewUrls = array();
     if (Permission::model()->hasSurveyPermission($surveyid, 'responses', 'create')) {
         $sDataEntryLanguage = Survey::model()->findByPk($surveyid)->language;
         $surveyinfo = getSurveyInfo($surveyid);
         $slangs = Survey::model()->findByPk($surveyid)->additionalLanguages;
         $baselang = Survey::model()->findByPk($surveyid)->language;
         array_unshift($slangs, $baselang);
         if (is_null($lang) || !in_array($lang, $slangs)) {
             $sDataEntryLanguage = $baselang;
         } else {
             $sDataEntryLanguage = $lang;
         }
         $langlistbox = languageDropdown($surveyid, $sDataEntryLanguage);
         $thissurvey = getSurveyInfo($surveyid);
         //This is the default, presenting a blank dataentry form
         LimeExpressionManager::StartSurvey($surveyid, 'survey', NULL, false, LEM_PRETTY_PRINT_ALL_SYNTAX);
         $moveResult = LimeExpressionManager::NavigateForwards();
         $aData['thissurvey'] = $thissurvey;
         $aData['langlistbox'] = $langlistbox;
         $aData['surveyid'] = $surveyid;
         $aData['sDataEntryLanguage'] = $sDataEntryLanguage;
         $aData['site_url'] = Yii::app()->homeUrl;
         LimeExpressionManager::StartProcessingPage(true, Yii::app()->baseUrl);
         // means that all variables are on the same page
         $aViewUrls[] = 'caption_view';
         Yii::app()->loadHelper('database');
         // SURVEY NAME AND DESCRIPTION TO GO HERE
         $degquery = "SELECT * FROM {{groups}} WHERE sid={$surveyid} AND language='{$sDataEntryLanguage}' ORDER BY {{groups}}.group_order";
         $degresult = dbExecuteAssoc($degquery);
         // GROUP NAME
         $aDataentryoutput = '';
         foreach ($degresult->readAll() as $degrow) {
             LimeExpressionManager::StartProcessingGroup($degrow['gid'], $thissurvey['anonymized'] != "N", $surveyid);
             $deqquery = "SELECT * FROM {{questions}} WHERE sid={$surveyid} AND parent_qid=0 AND gid={$degrow['gid']} AND language='{$sDataEntryLanguage}'";
             $deqrows = (array) dbExecuteAssoc($deqquery)->readAll();
             $aDataentryoutput .= "\t<tr class='info'>\n" . "<!-- Inside controller dataentry.php -->" . "<td colspan='3'><h4>" . flattenText($degrow['group_name'], true) . "</h4></td>\n" . "\t</tr>\n";
             $gid = $degrow['gid'];
             $aDataentryoutput .= "\t<tr class='data-entry-separator'><td colspan='3'></td></tr>\n";
             // Perform a case insensitive natural sort on group name then question title of a multidimensional array
             usort($deqrows, 'groupOrderThenQuestionOrder');
             $bgc = 'odd';
             foreach ($deqrows as $deqrow) {
                 $cdata = array();
                 $qidattributes = getQuestionAttributeValues($deqrow['qid']);
                 $cdata['qidattributes'] = $qidattributes;
                 $hidden = isset($qidattributes['hidden']) ? $qidattributes['hidden'] : 0;
                 // TODO - can questions be hidden?  Are JavaScript variables names used?  Consistently with everywhere else?
                 //                    LimeExpressionManager::ProcessRelevance($qidattributes['relevance'],$deqrow['qid'],NULL,$deqrow['type'],$hidden);
                 // TMSW Condition->Relevance:  Show relevance equation instead of conditions here - better yet, have data entry use survey-at-a-time but with different view
                 $qinfo = LimeExpressionManager::GetQuestionStatus($deqrow['qid']);
                 $relevance = trim($qinfo['info']['relevance']);
                 $explanation = trim($qinfo['relEqn']);
                 $validation = trim($qinfo['prettyValidTip']);
                 $qidattributes = getQuestionAttributeValues($deqrow['qid']);
                 $array_filter_help = flattenText($this->_array_filter_help($qidattributes, $sDataEntryLanguage, $surveyid));
                 if ($relevance != '' && $relevance != '1' || $validation != '' || $array_filter_help != '') {
                     $showme = '<div class="alert alert-warning col-sm-8 col-sm-offset-2" role="alert">';
                     if ($bgc == "even") {
                         $bgc = "odd";
                     } else {
                         $bgc = "even";
                     }
                     //Do no alternate on explanation row
                     if ($relevance != '' && $relevance != '1') {
                         $showme = '<strong>' . gT("Only answer this if the following conditions are met:", 'html', $sDataEntryLanguage) . "</strong><br />{$explanation}\n";
                     }
                     if ($validation != '') {
                         $showme .= '<strong>' . gT("The answer(s) must meet these validation criteria:", 'html', $sDataEntryLanguage) . "</strong><br />{$validation}\n";
                     }
                     if ($showme != '' && $array_filter_help != '') {
                         $showme .= '<br/>';
                     }
                     if ($array_filter_help != '') {
                         $showme .= '<strong>' . gT("The answer(s) must meet these array_filter criteria:", 'html', $sDataEntryLanguage) . "</strong><br />{$array_filter_help}\n";
                     }
                     $showme .= '</div>';
                     $cdata['explanation'] = "<tr class ='data-entry-explanation'><td class='data-entry-small-text' colspan='3' align='left'>{$showme}</td></tr>\n";
                 }
                 //END OF GETTING CONDITIONS
                 //Alternate bgcolor for different groups
                 if (!isset($bgc)) {
                     $bgc = "even";
                 }
                 if ($bgc == "even") {
                     $bgc = "odd";
                 } else {
//.........这里部分代码省略.........
开发者ID:mfavetti,项目名称:LimeSurvey,代码行数:101,代码来源:dataentry.php

示例14: _showReorderForm

 /**
  * Show the form for Organize question groups/questions
  *
  * @todo Change function name to _showOrganizeGroupsAndQuestions?
  * @param int $iSurveyID
  * @return void
  */
 private function _showReorderForm($iSurveyID)
 {
     $surveyinfo = Survey::model()->findByPk($iSurveyID)->surveyinfo;
     $aData['title_bar']['title'] = $surveyinfo['surveyls_title'] . "(" . gT("ID") . ":" . $iSurveyID . ")";
     // Prepare data for the view
     $sBaseLanguage = Survey::model()->findByPk($iSurveyID)->language;
     LimeExpressionManager::StartSurvey($iSurveyID, 'survey');
     LimeExpressionManager::StartProcessingPage(true, Yii::app()->baseUrl);
     $aGrouplist = QuestionGroup::model()->getGroups($iSurveyID);
     $initializedReplacementFields = false;
     $aData['organizebar']['savebuttonright'] = true;
     //$aData['organizebar']['returnbutton']['url'] = $this->getController()->createUrl("admin/survey/sa/view/", array('surveyid' => $iSurveyID));
     //$aData['organizebar']['returnbutton']['text'] = gT('Return to survey summary');
     foreach ($aGrouplist as $iGID => $aGroup) {
         LimeExpressionManager::StartProcessingGroup($aGroup['gid'], false, $iSurveyID);
         if (!$initializedReplacementFields) {
             templatereplace("{SITENAME}");
             // Hack to ensure the EM sets values of LimeReplacementFields
             $initializedReplacementFields = true;
         }
         $oQuestionData = Question::model()->getQuestions($iSurveyID, $aGroup['gid'], $sBaseLanguage);
         $qs = array();
         $junk = array();
         foreach ($oQuestionData->readAll() as $q) {
             $relevance = $q['relevance'] == '' ? 1 : $q['relevance'];
             $question = '[{' . $relevance . '}] ' . $q['question'];
             LimeExpressionManager::ProcessString($question, $q['qid']);
             $q['question'] = viewHelper::stripTagsEM(LimeExpressionManager::GetLastPrettyPrintExpression());
             $q['gid'] = $aGroup['gid'];
             $qs[] = $q;
         }
         $aGrouplist[$iGID]['questions'] = $qs;
         LimeExpressionManager::FinishProcessingGroup();
     }
     LimeExpressionManager::FinishProcessingPage();
     $aData['aGroupsAndQuestions'] = $aGrouplist;
     $aData['surveyid'] = $iSurveyID;
     $this->_renderWrappedTemplate('survey', 'organizeGroupsAndQuestions_view', $aData);
 }
开发者ID:GuillaumeSmaha,项目名称:LimeSurvey,代码行数:46,代码来源:surveyadmin.php

示例15: actionView

 /**
  * printanswers::view()
  * View answers at the end of a survey in one place. To export as pdf, set 'usepdfexport' = 1 in lsconfig.php and $printableexport='pdf'.
  * @param mixed $surveyid
  * @param bool $printableexport
  * @return
  */
 function actionView($surveyid, $printableexport = FALSE)
 {
     Yii::app()->loadHelper("frontend");
     Yii::import('application.libraries.admin.pdf');
     $iSurveyID = (int) $surveyid;
     $sExportType = $printableexport;
     Yii::app()->loadHelper('database');
     if (isset($_SESSION['survey_' . $iSurveyID]['sid'])) {
         $iSurveyID = $_SESSION['survey_' . $iSurveyID]['sid'];
     } else {
         //die('Invalid survey/session');
     }
     // Get the survey inforamtion
     // Set the language for dispay
     if (isset($_SESSION['survey_' . $iSurveyID]['s_lang'])) {
         $sLanguage = $_SESSION['survey_' . $iSurveyID]['s_lang'];
     } elseif (Survey::model()->findByPk($iSurveyID)) {
         $sLanguage = Survey::model()->findByPk($iSurveyID)->language;
     } else {
         $iSurveyID = 0;
         $sLanguage = Yii::app()->getConfig("defaultlang");
     }
     $clang = SetSurveyLanguage($iSurveyID, $sLanguage);
     $aSurveyInfo = getSurveyInfo($iSurveyID, $sLanguage);
     //SET THE TEMPLATE DIRECTORY
     if (!isset($aSurveyInfo['templatedir']) || !$aSurveyInfo['templatedir']) {
         $aSurveyInfo['templatedir'] = Yii::app()->getConfig('defaulttemplate');
     }
     $sTemplate = validateTemplateDir($aSurveyInfo['templatedir']);
     //Survey is not finished or don't exist
     if (!isset($_SESSION['survey_' . $iSurveyID]['finished']) || !isset($_SESSION['survey_' . $iSurveyID]['srid'])) {
         sendCacheHeaders();
         doHeader();
         echo templatereplace(file_get_contents(getTemplatePath($sTemplate) . '/startpage.pstpl'), array());
         echo "<center><br />\n" . "\t<font color='RED'><strong>" . $clang->gT("Error") . "</strong></font><br />\n" . "\t" . $clang->gT("We are sorry but your session has expired.") . "<br />" . $clang->gT("Either you have been inactive for too long, you have cookies disabled for your browser, or there were problems with your connection.") . "<br />\n" . "\t" . sprintf($clang->gT("Please contact %s ( %s ) for further assistance."), Yii::app()->getConfig("siteadminname"), Yii::app()->getConfig("siteadminemail")) . "\n" . "</center><br />\n";
         echo templatereplace(file_get_contents(getTemplatePath($sTemplate) . '/endpage.pstpl'), array());
         doFooter();
         exit;
     }
     //Fin session time out
     $sSRID = $_SESSION['survey_' . $iSurveyID]['srid'];
     //I want to see the answers with this id
     //Ensure script is not run directly, avoid path disclosure
     //if (!isset($rootdir) || isset($_REQUEST['$rootdir'])) {die( "browse - Cannot run this script directly");}
     if ($aSurveyInfo['printanswers'] == 'N') {
         die;
         //Die quietly if print answers is not permitted
     }
     //CHECK IF SURVEY IS ACTIVATED AND EXISTS
     $sSurveyName = $aSurveyInfo['surveyls_title'];
     $sAnonymized = $aSurveyInfo['anonymized'];
     //OK. IF WE GOT THIS FAR, THEN THE SURVEY EXISTS AND IT IS ACTIVE, SO LETS GET TO WORK.
     //SHOW HEADER
     $sOutput = CHtml::form(array("printanswers/view/surveyid/{$iSurveyID}/printableexport/pdf"), 'post') . "<center><input type='submit' value='" . $clang->gT("PDF export") . "'id=\"exportbutton\"/><input type='hidden' name='printableexport' /></center></form>";
     if ($sExportType == 'pdf') {
         //require (Yii::app()->getConfig('rootdir').'/application/config/tcpdf.php');
         Yii::import('application.libraries.admin.pdf', true);
         Yii::import('application.helpers.pdfHelper');
         $aPdfLanguageSettings = pdfHelper::getPdfLanguageSettings($clang->langcode);
         $oPDF = new pdf();
         $oPDF->SetTitle($clang->gT("Survey name (ID)", 'unescaped') . ": {$sSurveyName} ({$iSurveyID})");
         $oPDF->SetSubject($sSurveyName);
         $oPDF->SetDisplayMode('fullpage', 'two');
         $oPDF->setLanguageArray($aPdfLanguageSettings['lg']);
         $oPDF->setHeaderFont(array($aPdfLanguageSettings['pdffont'], '', PDF_FONT_SIZE_MAIN));
         $oPDF->setFooterFont(array($aPdfLanguageSettings['pdffont'], '', PDF_FONT_SIZE_DATA));
         $oPDF->SetFont($aPdfLanguageSettings['pdffont'], '', $aPdfLanguageSettings['pdffontsize']);
         $oPDF->AddPage();
         $oPDF->titleintopdf($clang->gT("Survey name (ID)", 'unescaped') . ": {$sSurveyName} ({$iSurveyID})");
     }
     $sOutput .= "\t<div class='printouttitle'><strong>" . $clang->gT("Survey name (ID):") . "</strong> {$sSurveyName} ({$iSurveyID})</div><p>&nbsp;\n";
     LimeExpressionManager::StartProcessingPage(true);
     // means that all variables are on the same page
     // Since all data are loaded, and don't need JavaScript, pretend all from Group 1
     LimeExpressionManager::StartProcessingGroup(1, $aSurveyInfo['anonymized'] != "N", $iSurveyID);
     $printanswershonorsconditions = Yii::app()->getConfig('printanswershonorsconditions');
     $aFullResponseTable = getFullResponseTable($iSurveyID, $sSRID, $sLanguage, $printanswershonorsconditions);
     //Get the fieldmap @TODO: do we need to filter out some fields?
     if ($aSurveyInfo['datestamp'] != "Y" || $sAnonymized == 'Y') {
         unset($aFullResponseTable['submitdate']);
     } else {
         unset($aFullResponseTable['id']);
     }
     unset($aFullResponseTable['token']);
     unset($aFullResponseTable['lastpage']);
     unset($aFullResponseTable['startlanguage']);
     unset($aFullResponseTable['datestamp']);
     unset($aFullResponseTable['startdate']);
     $sOutput .= "<table class='printouttable' >\n";
     foreach ($aFullResponseTable as $sFieldname => $fname) {
         if (substr($sFieldname, 0, 4) == 'gid_') {
             $sOutput .= "\t<tr class='printanswersgroup'><td colspan='2'>{$fname[0]}</td></tr>\n";
         } elseif (substr($sFieldname, 0, 4) == 'qid_') {
//.........这里部分代码省略.........
开发者ID:josetorerobueno,项目名称:test_repo,代码行数:101,代码来源:PrintanswersController.php


注:本文中的LimeExpressionManager::StartProcessingPage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。