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


PHP LimeExpressionManager::ProcessString方法代码示例

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


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

示例1:

            </td>
        </tr>
        <?php 
}
?>
    <?php 
if (trim($qrrow['relevance']) != '') {
    ?>
        <tr>
            <td><?php 
    $clang->eT("Relevance equation:");
    ?>
</td>
            <td>
                <?php 
    LimeExpressionManager::ProcessString("{" . $qrrow['relevance'] . "}", $qid);
    // tests Relevance equation so can pretty-print it
    echo LimeExpressionManager::GetLastPrettyPrintExpression();
    ?>
            </td>
        </tr>
        <?php 
}
?>
    <?php 
$sCurrentCategory = '';
foreach ($advancedsettings as $aAdvancedSetting) {
    ?>
        <tr>
            <td><?php 
    echo $aAdvancedSetting['caption'];
开发者ID:pmaonline,项目名称:limesurvey-quickstart,代码行数:31,代码来源:questionbar_view.php

示例2: EMevaluateExpression

 /**
  * Evaluates an expression via Expression Manager
  * Uses the current context.
  * @param string $expression
  * @return string
  */
 public function EMevaluateExpression($expression)
 {
     $result = LimeExpressionManager::ProcessString($expression);
     return $result;
 }
开发者ID:jdbaltazar,项目名称:survey-office,代码行数:11,代码来源:LimesurveyApi.php

示例3: run


//.........这里部分代码省略.........
            }
            if ($surveyMode == 'question') {
                echo "<input type='hidden' name='lastanswer' value='{$lastanswer}' id='lastanswer' />\n";
            }
            echo "\n\n<!-- END THE GROUP -->\n";
            echo templatereplace(file_get_contents($sTemplatePath . "endgroup.pstpl"), array(), $redata);
            echo "\n\n</div>\n";
        }
        LimeExpressionManager::FinishProcessingGroup($LEMskipReprocessing);
        echo LimeExpressionManager::GetRelevanceAndTailoringJavaScript();
        LimeExpressionManager::FinishProcessingPage();
        if (!$previewgrp && !$previewquestion) {
            $navigator = surveymover();
            //This gets globalised in the templatereplace function
            $redata = compact(array_keys(get_defined_vars()));
            echo "\n\n<!-- PRESENT THE NAVIGATOR -->\n";
            echo templatereplace(file_get_contents($sTemplatePath . "navigator.pstpl"), array(), $redata);
            echo "\n";
            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";
            }
            if ($surveyMode != 'survey' && $thissurvey['allowjumps'] == 'Y') {
                echo "\n\n<!-- PRESENT THE INDEX -->\n";
                echo '<div id="index"><div class="container"><h2>' . $clang->gT("Question index") . '</h2>';
                $stepIndex = LimeExpressionManager::GetStepIndexInfo();
                $lastGseq = -1;
                $gseq = -1;
                $grel = true;
                for ($v = 0, $n = 0; $n != $_SESSION[$LEMsessid]['maxstep']; ++$n) {
                    if (!isset($stepIndex[$n])) {
                        continue;
                        // this is an invalid group - skip it
                    }
                    $stepInfo = $stepIndex[$n];
                    if ($surveyMode == 'question') {
                        if ($lastGseq != $stepInfo['gseq']) {
                            // show the group label
                            ++$gseq;
                            $g = $_SESSION[$LEMsessid]['grouplist'][$gseq];
                            $grel = !LimeExpressionManager::GroupIsIrrelevantOrHidden($gseq);
                            if ($grel) {
                                $gtitle = LimeExpressionManager::ProcessString($g[1]);
                                echo '<h3>' . flattenText($gtitle) . "</h3>";
                            }
                            $lastGseq = $stepInfo['gseq'];
                        }
                        if (!$grel || !$stepInfo['show']) {
                            continue;
                        }
                        $q = $_SESSION[$LEMsessid]['fieldarray'][$n];
                    } else {
                        ++$gseq;
                        if (!$stepInfo['show']) {
                            continue;
                        }
                        $g = $_SESSION[$LEMsessid]['grouplist'][$gseq];
                    }
                    if ($surveyMode == 'group') {
                        $indexlabel = LimeExpressionManager::ProcessString($g[1]);
                    } else {
                        $indexlabel = LimeExpressionManager::ProcessString($q[3]);
                    }
                    $sText = $surveyMode == 'group' ? flattenText($indexlabel) : flattenText($indexlabel);
                    $bGAnsw = !$stepInfo['anyUnanswered'];
                    ++$v;
                    $class = $n == $_SESSION[$LEMsessid]['step'] - 1 ? 'current' : ($bGAnsw ? 'answer' : 'missing');
                    if ($v % 2) {
                        $class .= " odd";
                    }
                    $s = $n + 1;
                    echo "<div class=\"row {$class}\" onclick=\"javascript:document.limesurvey.move.value = '{$s}'; document.limesurvey.submit();\"><span class=\"hdr\">{$v}</span><span title=\"{$sText}\">{$sText}</span></div>";
                }
                if ($_SESSION[$LEMsessid]['maxstep'] == $_SESSION[$LEMsessid]['totalsteps']) {
                    echo "<input class='submit' type='submit' accesskey='l' onclick=\"javascript:document.limesurvey.move.value = 'movesubmit';\" value=' " . $clang->gT("Submit") . " ' name='move2' />\n";
                }
                echo '</div></div>';
                /* Can be replaced by php or in global js */
                echo "<script type=\"text/javascript\">\n" . "  \$(\".outerframe\").addClass(\"withindex\");\n" . "  var idx = \$(\"#index\");\n" . "  var row = \$(\"#index .row.current\");\n" . "  idx.scrollTop(row.position().top - idx.height() / 2 - row.height() / 2);\n" . "</script>\n";
                echo "\n";
            }
            echo "<input type='hidden' name='thisstep' value='{$_SESSION[$LEMsessid]['step']}' id='thisstep' />\n";
            echo "<input type='hidden' name='sid' value='{$surveyid}' id='sid' />\n";
            echo "<input type='hidden' name='start_time' value='" . time() . "' id='start_time' />\n";
            $_SESSION[$LEMsessid]['LEMpostKey'] = mt_rand();
            echo "<input type='hidden' name='LEMpostKey' value='{$_SESSION[$LEMsessid]['LEMpostKey']}' id='LEMpostKey' />\n";
            if (isset($token) && !empty($token)) {
                echo "\n<input type='hidden' name='token' value='{$token}' id='token' />\n";
            }
        }
        if (($LEMdebugLevel & LEM_DEBUG_TIMING) == LEM_DEBUG_TIMING) {
            echo LimeExpressionManager::GetDebugTimingMessage();
        }
        if (($LEMdebugLevel & LEM_DEBUG_VALIDATION_SUMMARY) == LEM_DEBUG_VALIDATION_SUMMARY) {
            echo "<table><tr><td align='left'><b>Group/Question Validation Results:</b>" . $moveResult['message'] . "</td></tr></table>\n";
        }
        echo "</form>\n";
        echo templatereplace(file_get_contents($sTemplatePath . "endpage.pstpl"), array(), $redata);
        echo "\n";
        doFooter();
    }
开发者ID:ryu1inaba,项目名称:LimeSurvey,代码行数:101,代码来源:SurveyRuntimeHelper.php

示例4: afterSurveyComplete

 /**
  * This event is fired by when a response is submitted
  * available for a survey.
  * @param PluginEvent $event
  */
 public function afterSurveyComplete()
 {
     // This method will send a notification email
     $event = $this->getEvent();
     $surveyId = $event->get('surveyId');
     // Only process the afterSurveyComplete if the plugin is Enabled for this survey and if the survey is Active
     if ($this->get('emailCount', 'Survey', $surveyId) < 1 || Survey::model()->findByPk($surveyId)->active != "Y") {
         // leave gracefully
         return true;
     }
     // Retrieve response and survey properties
     $responseId = $event->get('responseId');
     $response = $this->pluginManager->getAPI()->getResponse($surveyId, $responseId);
     $sitename = $this->pluginManager->getAPI()->getConfigKey('sitename');
     $surveyInfo = getSurveyInfo($surveyId);
     $adminemail = $surveyInfo['adminemail'];
     $bounce_email = $surveyInfo['bounce_email'];
     $isHtmlEmail = $surveyInfo['htmlemail'] == 'Y';
     $baseLang = $surveyInfo['language'];
     for ($i = 1; $i <= $this->get('emailCount', 'Survey', $surveyId); $i++) {
         // Let's check if there is at least a valid destination email address
         $aTo = array();
         $aAttachTo = array();
         $aDestEmail = explode(';', $this->pluginManager->getAPI()->EMevaluateExpression($this->get('emailDestinations_' . $i, 'Survey', $surveyId)));
         $aDestEmail = array_map('trim', $aDestEmail);
         $aUploadQuestions = explode(';', $this->pluginManager->getAPI()->EMevaluateExpression($this->get('emailAttachFiles_' . $i, 'Survey', $surveyId)));
         $aUploadQuestions = array_map('trim', $aUploadQuestions);
         // prepare an array of valid destination email addresses
         foreach ($aDestEmail as $destemail) {
             if (validateEmailAddress($destemail)) {
                 $aTo[] = $destemail;
             }
         }
         // prepare an array of valid attached files from upload-questions
         foreach ($aUploadQuestions as $uploadQuestion) {
             $sgqa = 0;
             $qtype = '';
             if (isset($response[$uploadQuestion])) {
                 // get SGQA code from question-code. Ther might be a better way to do this though...
                 $sgqa = $this->pluginManager->getAPI()->EMevaluateExpression('{' . $uploadQuestion . '.sgqa}');
                 $qtype = $this->pluginManager->getAPI()->EMevaluateExpression('{' . $uploadQuestion . '.type}');
             }
             // Only add the file if question is relevant
             if ($sgqa != 0 && $qtype == "|" && \LimeExpressionManager::QuestionIsRelevant($sgqa)) {
                 $aFiles = json_decode($response[$uploadQuestion]);
                 if (!is_null($aFiles) && is_array($aFiles)) {
                     foreach ($aFiles as $file) {
                         if (property_exists($file, 'name') && property_exists($file, 'filename')) {
                             $name = $file->name;
                             $filename = $file->filename;
                             $aAttachTo[] = array(0 => $this->pluginManager->getAPI()->getConfigKey('uploaddir') . "/surveys/{$surveyId}/files/" . $filename, 1 => $name);
                         }
                     }
                 }
             }
         }
         if (count($aTo) >= 1) {
             // Retrieve the language to use for the notification email
             $emailLang = $this->get('emailLang_' . $i, 'Survey', $surveyId);
             if ($emailLang == '--') {
                 // in this case let's select the language used when submitting the response
                 $emailLang = $response['startlanguage'];
             }
             $subjectTemplate = $this->get("emailSubject_{$i}_{$emailLang}", 'Survey', $surveyId);
             if ($subjectTemplate == "") {
                 // If subject is not translated, use subject and body from the baseLang
                 $emailLang = $baseLang;
                 $subjectTemplate = $this->get("emailSubject_{$i}_{$emailLang}", 'Survey', $surveyId);
             }
             // Process the email subject and body through ExpressionManager
             $subject = $this->pluginManager->getAPI()->EMevaluateExpression($subjectTemplate);
             // Prepare an {ANSWERTABLE} variable
             if ($surveyInfo['datestamp'] == 'N') {
                 //$aFilteredFields=array('id', 'submitdate', 'lastpage', 'startlanguage');
                 // Let's filter submitdate if survey is not datestampped
                 $aFilteredFields = array('submitdate');
             } else {
                 //$aFilteredFields=array('id', 'lastpage', 'startlanguage');
                 $aFilteredFields = array();
             }
             $replacementfields = array('ANSWERTABLE' => $this->translateAnswerTable($surveyId, $responseId, $emailLang, $isHtmlEmail, $aFilteredFields));
             // Process emailBody through EM and replace {ANSWERTABLE}
             $body = \LimeExpressionManager::ProcessString($this->get("emailBody_{$i}_{$emailLang}", 'Survey', $surveyId), NULL, $replacementfields);
             // At last it's time to send the email
             SendEmailMessage($body, $subject, $aTo, $adminemail, $sitename, $isHtmlEmail, $bounce_email, $aAttachTo);
         }
         // END BLOCK 'if' aTo[] not emtpy
     }
     // END BLOCK 'for' emailCount
 }
开发者ID:lemeur,项目名称:Limesurvey-Plugin-ConfirmByEmail,代码行数:95,代码来源:ConfirmByEmail.php

示例5: ReplaceFields

function ReplaceFields($text, $fieldsarray, $bReplaceInsertans = true, $staticReplace = true)
{
    if ($bReplaceInsertans) {
        $replacements = array();
        foreach ($fieldsarray as $key => $value) {
            $replacements[substr($key, 1, -1)] = $value;
        }
        $text = LimeExpressionManager::ProcessString($text, NULL, $replacements, false, 2, 1, false, false, $staticReplace);
    } else {
        foreach ($fieldsarray as $key => $value) {
            $text = str_replace($key, $value, $text);
        }
    }
    return $text;
}
开发者ID:rawaludin,项目名称:LimeSurvey,代码行数:15,代码来源:replacements_helper.php

示例6: do_ranking

function do_ranking($ia)
{
    global $dbprefix, $imageurl, $clang, $thissurvey, $showpopups;
    $checkconditionFunction = "checkconditions";
    $qidattributes = getQuestionAttributes($ia[0], $ia[4]);
    $answer = "";
    if ($qidattributes['random_order'] == 1) {
        $ansquery = "SELECT * FROM {$dbprefix}answers WHERE qid={$ia['0']} AND language='" . $_SESSION['s_lang'] . "' and scale_id=0 ORDER BY " . db_random();
    } else {
        $ansquery = "SELECT * FROM {$dbprefix}answers WHERE qid={$ia['0']} AND language='" . $_SESSION['s_lang'] . "' and scale_id=0 ORDER BY sortorder, answer";
    }
    $ansresult = db_execute_assoc($ansquery);
    //Checked
    $anscount = $ansresult->RecordCount();
    if (trim($qidattributes["max_answers"]) != '') {
        $max_answers = trim($qidattributes["max_answers"]);
        $max_ans_val = LimeExpressionManager::ProcessString('{' . $max_answers . '}', $ia[0]);
        if (!is_numeric($max_ans_val)) {
            $max_ans_val = $anscount;
        }
    } else {
        $max_answers = $anscount;
        $max_ans_val = $anscount;
    }
    if (trim($qidattributes["min_answers"]) != '') {
        $min_answers = trim($qidattributes["min_answers"]);
    } else {
        $min_answers = 0;
    }
    $answer .= "\t<script type='text/javascript'>\n" . "\t<!--\n" . "function rankthis_{$ia[0]}(\$code, \$value)\n" . "\t{\n" . "\t\$index=document.getElementById('CHOICES_{$ia[0]}').selectedIndex;\n" . "\tvar _maxans = \$.trim(LEMstrip_tags(\$('#RANK_{$ia[0]}_maxans').html()));\n" . "\tvar _minans = \$.trim(LEMstrip_tags(\$('#RANK_{$ia[0]}_minans').html()));\n" . "\tvar maxval = (LEMempty(_maxans) ? {$anscount} : Math.floor(_maxans));\n" . "\tif (({$anscount} - document.getElementById('CHOICES_{$ia[0]}').options.length) >= maxval) {\n" . "\t\tdocument.getElementById('CHOICES_{$ia[0]}').disabled=true;\n" . "\t\tdocument.getElementById('CHOICES_{$ia[0]}').selectedIndex=-1;\n" . "\t\treturn true;\n" . "\t}\n" . "\tfor (i=1; i<=maxval; i++)\n" . "{\n" . "\$b=i;\n" . "\$b += '';\n" . "\$inputname=\"RANK_{$ia[0]}\"+\$b;\n" . "\$hiddenname=\"fvalue_{$ia[0]}\"+\$b;\n" . "\$cutname=\"cut_{$ia[0]}\"+i;\n" . "document.getElementById(\$cutname).style.display='none';\n" . "if (!document.getElementById(\$inputname).value)\n" . "\t{\n" . "\t\t\t\t\t\t\tdocument.getElementById(\$inputname).value=\$value;\n" . "\t\t\t\t\t\t\tdocument.getElementById(\$hiddenname).value=\$code;\n" . "\t\t\t\t\t\t\tdocument.getElementById(\$cutname).style.display='';\n" . "\t\t\t\t\t\t\tfor (var b=document.getElementById('CHOICES_{$ia[0]}').options.length-1; b>=0; b--)\n" . "\t\t\t\t\t\t\t\t{\n" . "\t\t\t\t\t\t\t\tif (document.getElementById('CHOICES_{$ia[0]}').options[b].value == \$code)\n" . "\t\t\t\t\t\t\t\t\t{\n" . "\t\t\t\t\t\t\t\t\tdocument.getElementById('CHOICES_{$ia[0]}').options[b] = null;\n" . "\t\t\t\t\t\t\t\t\t}\n" . "\t\t\t\t\t\t\t\t}\n" . "\t\t\t\t\t\t\ti=maxval;\n" . "\t\t\t\t\t\t\t}\n" . "\t\t\t\t\t\t}\n" . "\t\t\t\t\tif (document.getElementById('CHOICES_{$ia[0]}').options.length == ({$anscount} - maxval))\n" . "\t\t\t\t\t\t{\n" . "\t\t\t\t\t\tdocument.getElementById('CHOICES_{$ia[0]}').disabled=true;\n" . "\t\t\t\t\t\t}\n" . "\t\t\t\t\tdocument.getElementById('CHOICES_{$ia[0]}').selectedIndex=-1;\n" . "\t\t\t\t\t{$checkconditionFunction}(\$code);\n" . "\t\t\t\t\t}\n" . "\t\t\t\tfunction deletethis_{$ia[0]}(\$text, \$value, \$name, \$thisname)\n" . "\t\t\t\t\t{\n" . "\t\t\t\t\tvar qid='{$ia[0]}';\n" . "\t\t\t\t\tvar lngth=qid.length+4;\n" . "\t\t\t\t\tvar cutindex=\$thisname.substring(lngth, \$thisname.length);\n" . "\t\t\t\t\tcutindex=parseFloat(cutindex);\n" . "\t\t\t\t\tdocument.getElementById(\$name).value='';\n" . "\t\t\t\t\tdocument.getElementById(\$thisname).style.display='none';\n" . "\t\t\t\t\tif (cutindex > 1)\n" . "\t\t\t\t\t\t{\n" . "\t\t\t\t\t\t\$cut1name=\"cut_{$ia[0]}\"+(cutindex-1);\n" . "\t\t\t\t\t\t\$cut2name=\"fvalue_{$ia[0]}\"+(cutindex);\n" . "\t\t\t\t\t\tdocument.getElementById(\$cut1name).style.display='';\n" . "\t\t\t\t\t\tdocument.getElementById(\$cut2name).value='';\n" . "\t\t\t\t\t\t}\n" . "\t\t\t\t\telse\n" . "\t\t\t\t\t\t{\n" . "\t\t\t\t\t\t\$cut2name=\"fvalue_{$ia[0]}\"+(cutindex);\n" . "\t\t\t\t\t\tdocument.getElementById(\$cut2name).value='';\n" . "\t\t\t\t\t\t}\n" . "\t\t\t\t\tvar i=document.getElementById('CHOICES_{$ia[0]}').options.length;\n" . "\t\t\t\t\tdocument.getElementById('CHOICES_{$ia[0]}').options[i] = new Option(\$text, \$value);\n" . "\t\t\t\t\tif (document.getElementById('CHOICES_{$ia[0]}').options.length > 0)\n" . "\t\t\t\t\t\t{\n" . "\t\t\t\t\t\tdocument.getElementById('CHOICES_{$ia[0]}').disabled=false;\n" . "\t\t\t\t\t\t}\n" . "\t\t\t\t\t{$checkconditionFunction}('');\n" . "\t\t\t\t\t}\n" . "\t\t\t//-->\n" . "\t\t\t</script>\n";
    unset($answers);
    //unset($inputnames);
    unset($chosen);
    $ranklist = "";
    while ($ansrow = $ansresult->FetchRow()) {
        $answers[] = array($ansrow['code'], $ansrow['answer']);
    }
    $existing = 0;
    for ($i = 1; $i <= $anscount; $i++) {
        $myfname = $ia[1] . $i;
        if (isset($_SESSION[$myfname]) && $_SESSION[$myfname]) {
            $existing++;
        }
    }
    for ($i = 1; $i <= floor($max_ans_val); $i++) {
        $myfname = $ia[1] . $i;
        if (isset($_SESSION[$myfname]) && $_SESSION[$myfname]) {
            foreach ($answers as $ans) {
                if ($ans[0] == $_SESSION[$myfname]) {
                    $thiscode = $ans[0];
                    $thistext = $ans[1];
                }
            }
        }
        $ranklist .= "\t<tr><td class=\"position\">&nbsp;<label for='RANK_{$ia[0]}{$i}'>" . "{$i}:&nbsp;</label></td><td class=\"item\"><input class=\"text\" type=\"text\" name=\"RANK_{$ia[0]}{$i}\" id=\"RANK_{$ia[0]}{$i}\"";
        if (isset($_SESSION[$myfname]) && $_SESSION[$myfname]) {
            $ranklist .= " value='";
            $ranklist .= htmlspecialchars($thistext, ENT_QUOTES);
            $ranklist .= "'";
        }
        $ranklist .= " onfocus=\"this.blur()\" />\n";
        $ranklist .= "<input type=\"hidden\" name=\"{$myfname}\" id=\"fvalue_{$ia[0]}{$i}\" value='";
        $chosen[] = "";
        //create array
        if (isset($_SESSION[$myfname]) && $_SESSION[$myfname]) {
            $ranklist .= $thiscode;
            $chosen[] = array($thiscode, $thistext);
        }
        $ranklist .= "' />\n";
        $ranklist .= "<img src=\"{$imageurl}/cut.gif\" alt=\"" . $clang->gT("Remove this item") . "\" title=\"" . $clang->gT("Remove this item") . "\" ";
        if ($i != $existing) {
            $ranklist .= "style=\"display:none\"";
        }
        $ranklist .= " id=\"cut_{$ia[0]}{$i}\" onclick=\"deletethis_{$ia[0]}(document.getElementById('RANK_{$ia[0]}{$i}').value, document.getElementById('fvalue_{$ia[0]}{$i}').value, document.getElementById('RANK_{$ia[0]}{$i}').name, this.id)\" /><br />\n";
        $inputnames[] = $myfname;
        $ranklist .= "</td></tr>\n";
    }
    $maxselectlength = 0;
    $choicelist = "<select size=\"{$anscount}\" name=\"CHOICES_{$ia[0]}\" ";
    if (isset($choicewidth)) {
        $choicelist .= $choicewidth;
    }
    $choicelist .= " id=\"CHOICES_{$ia[0]}\" onchange=\"if (this.options.length>0 && this.selectedIndex<0) { this.options[this.options.length-1].selected=true; }; rankthis_{$ia[0]}(this.options[this.selectedIndex].value, this.options[this.selectedIndex].text)\" class=\"select\">\n";
    foreach ($answers as $ans) {
        if (!in_array($ans, $chosen)) {
            $choicelist .= "\t\t\t\t\t\t\t<option id='javatbd{$ia[1]}{$ans[0]}' value='{$ans[0]}'>{$ans[1]}</option>\n";
        }
        if (strlen($ans[1]) > $maxselectlength) {
            $maxselectlength = strlen($ans[1]);
        }
    }
    $choicelist .= "</select>\n";
    $answer .= "\t<table border='0' cellspacing='0' class='rank'>\n" . "<tr>\n" . "\t<td align='left' valign='top' class='rank label'>\n" . "<strong>&nbsp;&nbsp;<label for='CHOICES_{$ia[0]}'>" . $clang->gT("Your Choices") . ":</label></strong><br />\n" . "&nbsp;" . $choicelist . "\t&nbsp;</td>\n";
    $maxselectlength = $maxselectlength + 2;
    if ($maxselectlength > 60) {
        $maxselectlength = 60;
    }
    $ranklist = str_replace("<input class=\"text\"", "<input size='{$maxselectlength}' class='text'", $ranklist);
    $answer .= "\t<td style=\"text-align:left; white-space:nowrap;\" class='rank output'>\n" . "\t<table border='0' cellspacing='1' cellpadding='0'>\n" . "\t<tr><td></td><td><strong>" . $clang->gT("Your Ranking") . ":</strong>" . "<div style='display:none' id='RANK_{$ia[0]}_maxans'>{" . $max_answers . "}</div>" . "<div style='display:none' id='RANK_{$ia[0]}_minans'>{" . $min_answers . "}</div>" . "</td></tr>\n";
    $answer .= $ranklist . "\t</table>\n" . "\t</td>\n" . "</tr>\n" . "<tr>\n" . "\t<td colspan='2' class='rank helptext'><font size='1'>\n" . "" . $clang->gT("Click on the scissors next to each item on the right to remove the last entry in your ranked list") . "\t</font size='1'></td>\n" . "</tr>\n" . "\t</table>\n";
//.........这里部分代码省略.........
开发者ID:ddrmoscow,项目名称:queXS,代码行数:101,代码来源:qanda.php

示例7: do_multiplenumeric

function do_multiplenumeric($ia)
{
    global $thissurvey;
    $extraclass = "";
    $checkconditionFunction = "fixnum_checkconditions";
    $aQuestionAttributes = QuestionAttribute::model()->getQuestionAttributes($ia[0]);
    $answer = '';
    $sSeparator = getRadixPointData($thissurvey['surveyls_numberformat']);
    $sSeparator = $sSeparator['separator'];
    //Must turn on the "numbers only javascript"
    $extraclass .= " numberonly";
    if ($aQuestionAttributes['thousands_separator'] == 1) {
        App()->clientScript->registerPackage('jquery-price-format');
        App()->clientScript->registerScriptFile(Yii::app()->getConfig('generalscripts') . 'numerical_input.js');
        $extraclass .= " thousandsseparator";
    }
    if (intval(trim($aQuestionAttributes['maximum_chars'])) > 0) {
        // Only maxlength attribute, use textarea[maxlength] jquery selector for textarea
        $maximum_chars = intval(trim($aQuestionAttributes['maximum_chars']));
        $maxlength = "maxlength='{$maximum_chars}' ";
        $extraclass .= " maxchars maxchars-" . $maximum_chars;
    } else {
        $maxlength = " maxlength='25' ";
    }
    if (trim($aQuestionAttributes['prefix'][$_SESSION['survey_' . Yii::app()->getConfig('surveyID')]['s_lang']]) != '') {
        $prefix = $aQuestionAttributes['prefix'][$_SESSION['survey_' . Yii::app()->getConfig('surveyID')]['s_lang']];
        $extraclass .= " withprefix";
    } else {
        $prefix = '';
    }
    if (trim($aQuestionAttributes['suffix'][$_SESSION['survey_' . Yii::app()->getConfig('surveyID')]['s_lang']]) != '') {
        $suffix = $aQuestionAttributes['suffix'][$_SESSION['survey_' . Yii::app()->getConfig('surveyID')]['s_lang']];
        $extraclass .= " withsuffix";
    } else {
        $suffix = '';
    }
    if ($thissurvey['nokeyboard'] == 'Y') {
        includeKeypad();
        $kpclass = "num-keypad";
        $extraclass .= " keypad";
    } else {
        $kpclass = "";
    }
    $numbersonly_slider = '';
    // DEPRECATED
    if (trim($aQuestionAttributes['text_input_width']) != '') {
        $tiwidth = $aQuestionAttributes['text_input_width'];
        //$extraclass .=" inputwidth".trim($aQuestionAttributes['text_input_width']);
        $col = $aQuestionAttributes['text_input_width'] <= 12 ? $aQuestionAttributes['text_input_width'] : 12;
        $extraclass .= " col-sm-" . trim($col);
    } else {
        $tiwidth = 10;
    }
    $prefixclass = "numeric";
    if ($aQuestionAttributes['slider_layout'] == 1) {
        $prefixclass = "slider";
        $slider_layout = true;
        $extraclass .= " withslider";
        $slider_step = trim(LimeExpressionManager::ProcessString("{{$aQuestionAttributes['slider_accuracy']}}", $ia[0], array(), false, 1, 1, false, false, true));
        $slider_step = is_numeric($slider_step) ? $slider_step : 1;
        $slider_min = trim(LimeExpressionManager::ProcessString("{{$aQuestionAttributes['slider_min']}}", $ia[0], array(), false, 1, 1, false, false, true));
        $slider_mintext = $slider_min = is_numeric($slider_min) ? $slider_min : 0;
        $slider_max = trim(LimeExpressionManager::ProcessString("{{$aQuestionAttributes['slider_max']}}", $ia[0], array(), false, 1, 1, false, false, true));
        $slider_maxtext = $slider_max = is_numeric($slider_max) ? $slider_max : 100;
        $slider_default = trim(LimeExpressionManager::ProcessString("{{$aQuestionAttributes['slider_default']}}", $ia[0], array(), false, 1, 1, false, false, true));
        $slider_default = is_numeric($slider_default) ? $slider_default : "";
        $slider_orientation = trim($aQuestionAttributes['slider_orientation']) == 0 ? 'horizontal' : 'vertical';
        $slider_custom_handle = trim($aQuestionAttributes['slider_custom_handle']);
        switch (trim($aQuestionAttributes['slider_handle'])) {
            case 0:
                $slider_handle = 'round';
                break;
            case 1:
                $slider_handle = 'square';
                break;
            case 2:
                $slider_handle = 'triangle';
                break;
            case 3:
                $slider_handle = 'custom';
                break;
        }
        if ($slider_default == '' && $aQuestionAttributes['slider_middlestart'] == 1) {
            $slider_middlestart = intval(($slider_max + $slider_min) / 2);
        } else {
            $slider_middlestart = '';
        }
        $slider_separator = trim($aQuestionAttributes['slider_separator']) != '' ? $aQuestionAttributes['slider_separator'] : "";
        $slider_reset = $aQuestionAttributes['slider_reset'] ? 1 : 0;
    } else {
        $slider_layout = false;
        $slider_step = '';
        $slider_step = '';
        $slider_min = '';
        $slider_mintext = '';
        $slider_max = '';
        $slider_maxtext = '';
        $slider_default = '';
        $slider_default = '';
        $slider_orientation = '';
//.........这里部分代码省略.........
开发者ID:BertHankes,项目名称:LimeSurvey,代码行数:101,代码来源:qanda_helper.php

示例8: createIncrementalQuestionIndex

 protected function createIncrementalQuestionIndex($LEMsessid, $surveyMode)
 {
     echo "\n\n<!-- PRESENT THE INDEX -->\n";
     echo '<div id="index"><div class="container" id="indexcontainer"><h2>' . gT("Question index") . '</h2>';
     $stepIndex = LimeExpressionManager::GetStepIndexInfo();
     $lastGseq = -1;
     $gseq = -1;
     $grel = true;
     for ($v = 0, $n = 0; $n != $_SESSION[$LEMsessid]['maxstep']; ++$n) {
         if (!isset($stepIndex[$n])) {
             continue;
             // this is an invalid group - skip it
         }
         $stepInfo = $stepIndex[$n];
         if ($surveyMode == 'question') {
             if ($lastGseq != $stepInfo['gseq']) {
                 // show the group label
                 ++$gseq;
                 $g = $_SESSION[$LEMsessid]['grouplist'][$gseq];
                 $grel = !LimeExpressionManager::GroupIsIrrelevantOrHidden($gseq);
                 if ($grel) {
                     $gtitle = LimeExpressionManager::ProcessString($g['group_name']);
                     echo '<h3>' . flattenText($gtitle) . "</h3>";
                 }
                 $lastGseq = $stepInfo['gseq'];
             }
             if (!$grel || !$stepInfo['show']) {
                 continue;
             }
             $q = $_SESSION[$LEMsessid]['fieldarray'][$n];
         } else {
             ++$gseq;
             if (!$stepInfo['show']) {
                 continue;
             }
             $g = $_SESSION[$LEMsessid]['grouplist'][$gseq];
         }
         if ($surveyMode == 'group') {
             $indexlabel = LimeExpressionManager::ProcessString($g['group_name']);
             $sButtonText = gT('Go to this group');
         } else {
             $indexlabel = LimeExpressionManager::ProcessString($q[3]);
             $sButtonText = gT('Go to this question');
         }
         $sText = $surveyMode == 'group' ? flattenText($indexlabel) : flattenText($indexlabel);
         $bGAnsw = !$stepInfo['anyUnanswered'];
         ++$v;
         $class = $n == $_SESSION[$LEMsessid]['step'] - 1 ? 'current' : ($bGAnsw ? 'answer' : 'missing');
         if ($v % 2) {
             $class .= " odd";
         }
         $s = $n + 1;
         echo "<div class=\"row {$class}\">";
         echo "<span class=\"hdr\">{$v}</span>";
         echo "<span title=\"{$sText}\">{$sText}</span>";
         echo CHtml::htmlButton($sButtonText, array('type' => 'submit', 'value' => $s, 'name' => 'move', 'class' => 'jshide'));
         echo "</div>";
     }
     if ($_SESSION[$LEMsessid]['maxstep'] == $_SESSION[$LEMsessid]['totalsteps']) {
         echo CHtml::htmlButton(gT('Submit'), array('type' => 'submit', 'value' => 'movesubmit', 'name' => 'move', 'class' => 'submit button'));
     }
     echo '</div></div>';
     App()->getClientScript()->registerScript('manageIndex', "manageIndex()\n", CClientScript::POS_END);
 }
开发者ID:BertHankes,项目名称:LimeSurvey,代码行数:64,代码来源:SurveyRuntimeHelper.php

示例9: _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

示例10: view


//.........这里部分代码省略.........
                         break;
                     case ":":
                         //ARRAY (Multi Flexi)
                         //                            $qidattributes=getQuestionAttributeValues($deqrow['qid']);
                         $minvalue = 1;
                         $maxvalue = 10;
                         if (trim($qidattributes['multiflexible_max']) != '' && trim($qidattributes['multiflexible_min']) == '') {
                             $maxvalue = $qidattributes['multiflexible_max'];
                             $minvalue = 1;
                         }
                         if (trim($qidattributes['multiflexible_min']) != '' && trim($qidattributes['multiflexible_max']) == '') {
                             $minvalue = $qidattributes['multiflexible_min'];
                             $maxvalue = $qidattributes['multiflexible_min'] + 10;
                         }
                         if (trim($qidattributes['multiflexible_min']) != '' && trim($qidattributes['multiflexible_max']) != '') {
                             if ($qidattributes['multiflexible_min'] < $qidattributes['multiflexible_max']) {
                                 $minvalue = $qidattributes['multiflexible_min'];
                                 $maxvalue = $qidattributes['multiflexible_max'];
                             }
                         }
                         if (trim($qidattributes['multiflexible_step']) != '') {
                             $stepvalue = $qidattributes['multiflexible_step'];
                         } else {
                             $stepvalue = 1;
                         }
                         if ($qidattributes['multiflexible_checkbox'] != 0) {
                             $minvalue = 0;
                             $maxvalue = 1;
                             $stepvalue = 1;
                         }
                         $cdata['minvalue'] = $minvalue;
                         $cdata['maxvalue'] = $maxvalue;
                         $cdata['stepvalue'] = $stepvalue;
                         $lquery = "SELECT question, title FROM {{questions}} WHERE parent_qid={$deqrow['qid']} and scale_id=1 and language='{$sDataEntryLanguage}' ORDER BY question_order";
                         $lresult = dbExecuteAssoc($lquery) or die("Couldn't get labels, Type \":\"<br />{$lquery}<br />");
                         $lresult = dbExecuteAssoc($lquery);
                         if (!$lresult) {
                             $eMessage = "Couldn't get labels, Type \":\"<br />{$lquery}<br />";
                             Yii::app()->setFlashMessage($eMessage);
                             $this->getController()->redirect($this->getController()->createUrl("/admin/"));
                         }
                         $cdata['lresult'] = $lresult->readAll();
                         $meaquery = "SELECT question, title FROM {{questions}} WHERE parent_qid={$deqrow['qid']} and scale_id=0 and language='{$sDataEntryLanguage}' ORDER BY question_order";
                         $mearesult = dbExecuteAssoc($meaquery);
                         if (!$mearesult) {
                             $eMessage = "Couldn't get answers, Type \":\"<br />{$meaquery}<br />";
                             Yii::app()->setFlashMessage($eMessage);
                             $this->getController()->redirect($this->getController()->createUrl("/admin/"));
                         }
                         $cdata['mearesult'] = $mearesult->readAll();
                         break;
                     case ";":
                         //ARRAY (Multi Flexi)
                         $lquery = "SELECT * FROM {{questions}} WHERE scale_id=1 and parent_qid={$deqrow['qid']} and language='{$sDataEntryLanguage}' ORDER BY question_order";
                         $lresult = dbExecuteAssoc($lquery) or die("Couldn't get labels, Type \":\"<br />{$lquery}<br />");
                         $cdata['lresult'] = $lresult->readAll();
                         $meaquery = "SELECT * FROM {{questions}} WHERE scale_id=0 and parent_qid={$deqrow['qid']} and language='{$sDataEntryLanguage}' ORDER BY question_order";
                         $mearesult = dbExecuteAssoc($meaquery) or die("Couldn't get answers, Type \":\"<br />{$meaquery}<br />");
                         $cdata['mearesult'] = $mearesult->readAll();
                         break;
                     case "F":
                         //ARRAY (Flexible Labels)
                     //ARRAY (Flexible Labels)
                     case "H":
                         $meaquery = "SELECT * FROM {{questions}} WHERE parent_qid={$deqrow['qid']} and language='{$sDataEntryLanguage}' ORDER BY question_order";
                         $mearesult = dbExecuteAssoc($meaquery) or safeDie("Couldn't get answers, Type \"E\"<br />{$meaquery}<br />");
                         $cdata['mearesult'] = $mearesult->readAll();
                         $fquery = "SELECT * FROM {{answers}} WHERE qid={$deqrow['qid']} and language='{$sDataEntryLanguage}' ORDER BY sortorder, code";
                         $fresult = dbExecuteAssoc($fquery);
                         $cdata['fresult'] = $fresult->readAll();
                         break;
                 }
                 $cdata['sDataEntryLanguage'] = $sDataEntryLanguage;
                 $viewdata = $this->getController()->renderPartial("/admin/dataentry/content_view", $cdata, TRUE);
                 $viewdata_em = LimeExpressionManager::ProcessString($viewdata, $deqrow['qid'], NULL, false, 1, 1);
                 $aDataentryoutput .= $viewdata_em;
             }
             LimeExpressionManager::FinishProcessingGroup();
         }
         LimeExpressionManager::FinishProcessingPage();
         $aDataentryoutput .= LimeExpressionManager::GetRelevanceAndTailoringJavaScript();
         $aViewUrls['output'] = $aDataentryoutput;
         $aData['thissurvey'] = $thissurvey;
         $aData['surveyid'] = $surveyid;
         $aData['sDataEntryLanguage'] = $sDataEntryLanguage;
         if ($thissurvey['active'] == "Y" && $thissurvey['allowsave'] == "Y") {
             $slangs = Survey::model()->findByPk($surveyid)->additionalLanguages;
             $sbaselang = Survey::model()->findByPk($surveyid)->language;
             array_unshift($slangs, $sbaselang);
             $aData['slangs'] = $slangs;
             $aData['baselang'] = $baselang;
         }
         $aViewUrls[] = 'active_html_view';
         $aData['sidemenu']['state'] = false;
         $aData['menu']['edition'] = true;
         $aData['menu']['save'] = true;
         $aData['menu']['close'] = true;
         $this->_renderWrappedTemplate('dataentry', $aViewUrls, $aData);
     }
 }
开发者ID:mfavetti,项目名称:LimeSurvey,代码行数:101,代码来源:dataentry.php

示例11: questionjavascript

            $minipos++;
        }
        $orderquestions .= "</select>\n";
        $orderquestions .= "\t<input style='float:right;";
        if ($i == 0) {
            $orderquestions .= "visibility:hidden;";
        }
        $orderquestions .= "' type='image' src='{$imageurl}/up.png' name='btnup_{$i}' onclick=\"\$('#sortorder').val('{$oqarray[$i]['question_order']}');\$('#questionordermethod').val('up');\" " . $updisabled . "/>\n";
        if ($i < $questioncount - 1) {
            // Fill the sortorder hiddenfield so we know what field is moved down
            $orderquestions .= "\t<input type='image' src='{$imageurl}/down.png' style='float:right;' name='btndown_{$i}' onclick=\"\$('#sortorder').val('{$oqarray[$i]['question_order']}');\$('#questionordermethod').val('down')\" " . $downdisabled . "/>\n";
        }
        $orderquestions .= "<a href='admin.php?sid={$surveyid}&amp;gid={$gid}&amp;qid={$oqarray[$i]['qid']}' title='" . $clang->gT("View Question") . "'>" . $oqarray[$i]['title'] . "</a>: ";
        $relevance = $oqarray[$i]['relevance'] == '' ? 1 : $oqarray[$i]['relevance'];
        $showme = '[{' . $relevance . '}] ' . $oqarray[$i]['question'];
        LimeExpressionManager::ProcessString($showme, $oqarray[$i]['qid']);
        $orderquestions .= FlattenText(LimeExpressionManager::GetLastPrettyPrintExpression(), false, 'UTF-8', true, true);
        $orderquestions .= "</li>\n";
    }
    $orderquestions .= "</ul>\n" . "<input type='hidden' name='questionmovefrom' />\n" . "<input type='hidden' name='questionordermethod' id='questionordermethod' />\n" . "<input type='hidden' name='questionmoveto' />\n" . "\t<input type='hidden' id='sortorder' name='sortorder' />" . "\t<input type='hidden' name='action' value='orderquestions' />" . "</form>";
    $orderquestions .= "<br />";
    LimeExpressionManager::FinishProcessingGroup();
    LimeExpressionManager::FinishProcessingPage();
}
function questionjavascript($type)
{
    $newquestionoutput = "<script type='text/javascript'>\n" . "if (navigator.userAgent.indexOf(\"Gecko\") != -1)\n" . "window.addEventListener(\"load\", init_gecko_select_hack, false);\n";
    $jc = 0;
    $newquestionoutput .= "\tvar qtypes = new Array();\n";
    $newquestionoutput .= "\tvar qnames = new Array();\n\n";
    $newquestionoutput .= "\tvar qhelp = new Array();\n\n";
开发者ID:ddrmoscow,项目名称:queXS,代码行数:31,代码来源:questionhandling.php

示例12: templatereplace

/**
 * This function replaces keywords in a text and is mainly intended for templates
 * If you use this functions put your replacement strings into the $replacements variable
 * instead of using global variables
 * NOTE - Don't do any embedded replacements in this function.  Create the array of replacement values and
 * they will be done in batch at the end
 *
 * @param string $line Text to search in
 * @param array $replacements Array of replacements:  Array( <stringtosearch>=><stringtoreplacewith>, where <stringtosearch> is NOT surrounded with curly braces
 * @param boolean $anonymized Determines if token data is being used or just replaced with blanks
 * @return string  Text with replaced strings
 */
function templatereplace($line, $replacements = array(), $anonymized = false, $questionNum = NULL)
{
    global $surveylist, $sitename, $clienttoken, $rooturl;
    global $thissurvey, $imageurl, $defaulttemplate;
    global $percentcomplete, $move;
    global $groupname, $groupdescription;
    global $question;
    global $showxquestions, $showgroupinfo, $showqnumcode;
    global $answer, $navigator;
    global $help, $surveyformat;
    global $completed, $register_errormsg;
    global $privacy, $surveyid;
    global $publicurl, $templatedir, $token;
    global $assessments, $s_lang;
    global $errormsg, $clang;
    global $saved_id;
    global $totalBoilerplatequestions, $relativeurl;
    global $languagechanger;
    global $captchapath, $loadname;
    // lets sanitize the survey template
    if (isset($thissurvey['templatedir'])) {
        $_templatename = $thissurvey['templatedir'];
    } else {
        $_templatename = $defaulttemplate;
    }
    #    $_templatename = validate_templatedir($_templatename); // Not needed: sGetTemplateURL and sgetTemplatePath do validation
    // create absolute template URL and template dir vars
    $_templateurl = sGetTemplateURL($_templatename) . '/';
    $templatedir = sgetTemplatePath($_templatename);
    $interviewer = returnglobal('interviewer');
    if (!empty($interviewer) || isset($_SESSION['interviewer']) && $_SESSION['interviewer'] == true) {
        $interviewer = true;
        $_SESSION['interviewer'] = true;
    } else {
        $interviewer = false;
    }
    if (stripos($line, "</head>")) {
        //queXS Addition
        $textfocus = "";
        if ($interviewer) {
            $textfocus = '<script type="text/javascript">
		$(document).ready(function()
		{
	        	$(".text").focus();
		        $(".textarea").focus();
		});
		</script>';
        }
        $line = str_ireplace("</head>", "<script type=\"text/javascript\" src=\"{$rooturl}/scripts/survey_runtime.js\"></script>\n" . "{$textfocus}\n" . use_firebug() . "\t</head>", $line);
    }
    // Get some vars : move elsewhere ?
    // surveyformat
    if (isset($thissurvey['format'])) {
        $surveyformat = str_replace(array("A", "S", "G"), array("allinone", "questionbyquestion", "groupbygroup"), $thissurvey['format']);
    } else {
        $surveyformat = "";
    }
    /*if (isset($thissurvey['allowjumps']) && $thissurvey['allowjumps']=="Y" && $surveyformat!="allinone" && (isset($_SESSION['step']) && $_SESSION['step']>0)){
          $surveyformat .= " withindex";
      }*/
    if (isset($thissurvey['showprogress']) && $thissurvey['showprogress'] == "Y") {
        $surveyformat .= " showprogress";
    }
    if (isset($thissurvey['showqnumcode'])) {
        $surveyformat .= " showqnumcode-" . $thissurvey['showqnumcode'];
    }
    // real survey contact
    if (isset($surveylist['contact'])) {
        $_surveycontact = $surveylist['contact'];
    } elseif (isset($thissurvey['admin']) && $thissurvey['admin'] != "") {
        $_surveycontact = sprintf($clang->gT("Please contact %s ( %s ) for further assistance."), $thissurvey['admin'], $thissurvey['adminemail']);
    } else {
        $_surveycontact = "";
    }
    // If there are non-bracketed replacements to be made do so above this line.
    // Only continue in this routine if there are bracketed items to replace {}
    if (strpos($line, "{") === false) {
        return LimeExpressionManager::ProcessString($line, $questionNum, NULL, false, 1, 1, true);
    }
    if ($showgroupinfo == 'both' || $showgroupinfo == 'name' || $showgroupinfo == 'choose' && !isset($thissurvey['showgroupinfo']) || $showgroupinfo == 'choose' && $thissurvey['showgroupinfo'] == 'B' || $showgroupinfo == 'choose' && $thissurvey['showgroupinfo'] == 'N') {
        $_groupname = $groupname;
    } else {
        $_groupname = '';
    }
    if ($showgroupinfo == 'both' || $showgroupinfo == 'description' || $showgroupinfo == 'choose' && !isset($thissurvey['showgroupinfo']) || $showgroupinfo == 'choose' && $thissurvey['showgroupinfo'] == 'B' || $showgroupinfo == 'choose' && $thissurvey['showgroupinfo'] == 'D') {
        $_groupdescription = $groupdescription;
    } else {
        $_groupdescription = '';
//.........这里部分代码省略.........
开发者ID:ddrmoscow,项目名称:queXS,代码行数:101,代码来源:replacements.php

示例13: do_date

function do_date($ia)
{
    global $thissurvey;
    header_includes(Yii::app()->getConfig("generalscripts") . 'date.js', 'js');
    $clang = Yii::app()->lang;
    $aQuestionAttributes = getQuestionAttributeValues($ia[0], $ia[4]);
    $checkconditionFunction = "checkconditions";
    $dateformatdetails = getDateFormatDataForQID($aQuestionAttributes, $thissurvey);
    $numberformatdatat = getRadixPointData($thissurvey['surveyls_numberformat']);
    if (trim($aQuestionAttributes['dropdown_dates']) == 1) {
        if (!empty($_SESSION['survey_' . Yii::app()->getConfig('surveyID')][$ia[1]])) {
            $datetimeobj = new Date_Time_Converter($_SESSION['survey_' . Yii::app()->getConfig('surveyID')][$ia[1]], "Y-m-d H:i:s");
            $currentyear = $datetimeobj->years;
            $currentmonth = $datetimeobj->months;
            $currentdate = $datetimeobj->days;
            $currenthour = $datetimeobj->hours;
            $currentminute = $datetimeobj->minutes;
        } else {
            $currentdate = '';
            $currentmonth = '';
            $currentyear = '';
            $currenthour = '';
            $currentminute = '';
        }
        $dateorder = preg_split('/([-\\.\\/ :])/', $dateformatdetails['phpdate'], -1, PREG_SPLIT_DELIM_CAPTURE);
        $answer = '<p class="question answer-item dropdown-item date-item">';
        foreach ($dateorder as $datepart) {
            switch ($datepart) {
                // Show day select box
                case 'j':
                case 'd':
                    $answer .= '<label for="day' . $ia[1] . '" class="hide">' . $clang->gT('Day') . '</label><select id="day' . $ia[1] . '" name="day' . $ia[1] . '" class="day">
                    <option value="">' . $clang->gT('Day') . "</option>\n";
                    for ($i = 1; $i <= 31; $i++) {
                        if ($i == $currentdate) {
                            $i_date_selected = SELECTED;
                        } else {
                            $i_date_selected = '';
                        }
                        $answer .= '<option value="' . sprintf('%02d', $i) . '"' . $i_date_selected . '>' . sprintf('%02d', $i) . "</option>\n";
                    }
                    $answer .= '</select>';
                    break;
                    // Show month select box
                // Show month select box
                case 'n':
                case 'm':
                    $answer .= '<label for="month' . $ia[1] . '" class="hide">' . $clang->gT('Month') . '</label><select id="month' . $ia[1] . '" name="month' . $ia[1] . '" class="month">
                    <option value="">' . $clang->gT('Month') . "</option>\n";
                    $montharray = array($clang->gT('Jan'), $clang->gT('Feb'), $clang->gT('Mar'), $clang->gT('Apr'), $clang->gT('May'), $clang->gT('Jun'), $clang->gT('Jul'), $clang->gT('Aug'), $clang->gT('Sep'), $clang->gT('Oct'), $clang->gT('Nov'), $clang->gT('Dec'));
                    for ($i = 1; $i <= 12; $i++) {
                        if ($i == $currentmonth) {
                            $i_date_selected = SELECTED;
                        } else {
                            $i_date_selected = '';
                        }
                        $answer .= '<option value="' . sprintf('%02d', $i) . '"' . $i_date_selected . '>' . $montharray[$i - 1] . '</option>';
                    }
                    $answer .= '</select>';
                    break;
                    // Show year select box
                // Show year select box
                case 'Y':
                    $answer .= '<label for="year' . $ia[1] . '" class="hide">' . $clang->gT('Year') . '</label><select id="year' . $ia[1] . '" name="year' . $ia[1] . '" class="year">
                    <option value="">' . $clang->gT('Year') . '</option>';
                    /*
                     *  New question attributes used only if question attribute
                     * "dropdown_dates" is used (see IF(...) above).
                     *
                     * yearmin = Minimum year value for dropdown list, if not set default is 1900
                     * yearmax = Maximum year value for dropdown list, if not set default is 2020
                     */
                    if (trim($aQuestionAttributes['dropdown_dates_year_min']) != '') {
                        $yearmin = (int) LimeExpressionManager::ProcessString($aQuestionAttributes['dropdown_dates_year_min']);
                    } else {
                        $yearmin = 1900;
                    }
                    if (trim($aQuestionAttributes['dropdown_dates_year_max']) != '') {
                        $yearmax = (int) LimeExpressionManager::ProcessString($aQuestionAttributes['dropdown_dates_year_max']);
                    } else {
                        $yearmax = 2020;
                    }
                    if ($yearmin > $yearmax) {
                        $yearmin = 1900;
                        $yearmax = 2020;
                    }
                    if ($aQuestionAttributes['reverse'] == 1) {
                        $tmp = $yearmin;
                        $yearmin = $yearmax;
                        $yearmax = $tmp;
                        $step = 1;
                        $reverse = true;
                    } else {
                        $step = -1;
                        $reverse = false;
                    }
                    for ($i = $yearmax; $reverse ? $i <= $yearmin : $i >= $yearmin; $i += $step) {
                        if ($i == $currentyear) {
                            $i_date_selected = SELECTED;
                        } else {
//.........这里部分代码省略.........
开发者ID:pmaonline,项目名称:limesurvey-quickstart,代码行数:101,代码来源:qanda_helper.php

示例14: do_date

function do_date($ia)
{
    global $thissurvey;
    $clang = Yii::app()->lang;
    $aQuestionAttributes = getQuestionAttributeValues($ia[0], $ia[4]);
    $sDateLangvarJS = " translt = {\n         alertInvalidDate: '" . $clang->gT('Date entered is invalid!', 'js') . "',\n         infoCompleteAll: '" . $clang->gT('Please complete all parts of the date!', 'js') . "'\n        };";
    App()->getClientScript()->registerScript("sDateLangvarJS", $sDateLangvarJS, CClientScript::POS_HEAD);
    App()->getClientScript()->registerScriptFile(Yii::app()->getConfig("generalscripts") . 'date.js');
    App()->getClientScript()->registerScriptFile(Yii::app()->getConfig("third_party") . '/jstoolbox/date.js');
    $checkconditionFunction = "checkconditions";
    $dateformatdetails = getDateFormatDataForQID($aQuestionAttributes, $thissurvey);
    $numberformatdatat = getRadixPointData($thissurvey['surveyls_numberformat']);
    $sMindatetailor = '';
    $sMaxdatetailor = '';
    // date_min: Determine whether we have an expression, a full date (YYYY-MM-DD) or only a year(YYYY)
    if (trim($aQuestionAttributes['date_min']) != '') {
        $date_min = $aQuestionAttributes['date_min'];
        if (preg_match("/^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])/", $date_min)) {
            $mindate = $date_min;
        } elseif (strlen($date_min) == 4 && $date_min >= 1900 && $date_min <= 2099) {
            // backward compatibility: if only a year is given, add month and day
            $mindate = $date_min . '-01-01';
        } else {
            $mindate = '{' . $aQuestionAttributes['date_min'] . '}';
            // get the LEMtailor ID, remove the span tags
            $sMindatespan = LimeExpressionManager::ProcessString($mindate, $ia[0], NULL, false, 1, 1);
            preg_match("/LEMtailor_Q_[0-9]{1,7}_[0-9]{1,3}/", $sMindatespan, $matches);
            if (isset($matches[0])) {
                $sMindatetailor = $matches[0];
            }
        }
    } else {
        $mindate = '1900-01-01';
    }
    // date_max: Determine whether we have an expression, a full date (YYYY-MM-DD) or only a year(YYYY)
    if (trim($aQuestionAttributes['date_max']) != '') {
        $date_max = $aQuestionAttributes['date_max'];
        if (preg_match("/^[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])/", $date_max)) {
            $maxdate = $date_max;
        } elseif (strlen($date_max) == 4 && $date_max >= 1900 && $date_max <= 2099) {
            // backward compatibility: if only a year is given, add month and day
            $maxdate = $date_max . '-12-31';
        } else {
            $maxdate = '{' . $aQuestionAttributes['date_max'] . '}';
            // get the LEMtailor ID, remove the span tags
            $sMaxdatespan = LimeExpressionManager::ProcessString($maxdate, $ia[0], NULL, false, 1, 1);
            preg_match("/LEMtailor_Q_[0-9]{1,7}_[0-9]{1,3}/", $sMaxdatespan, $matches);
            if (isset($matches[0])) {
                $sMaxdatetailor = $matches[0];
            }
        }
    } else {
        $maxdate = '2037-12-31';
    }
    if (trim($aQuestionAttributes['dropdown_dates']) == 1) {
        if (!empty($_SESSION['survey_' . Yii::app()->getConfig('surveyID')][$ia[1]]) & $_SESSION['survey_' . Yii::app()->getConfig('surveyID')][$ia[1]] != 'INVALID') {
            $datetimeobj = new Date_Time_Converter($_SESSION['survey_' . Yii::app()->getConfig('surveyID')][$ia[1]], "Y-m-d H:i:s");
            $currentyear = $datetimeobj->years;
            $currentmonth = $datetimeobj->months;
            $currentdate = $datetimeobj->days;
            $currenthour = $datetimeobj->hours;
            $currentminute = $datetimeobj->minutes;
        } else {
            $currentdate = '';
            $currentmonth = '';
            $currentyear = '';
            $currenthour = '';
            $currentminute = '';
        }
        $dateorder = preg_split('/([-\\.\\/ :])/', $dateformatdetails['phpdate'], -1, PREG_SPLIT_DELIM_CAPTURE);
        $answer = '<p class="question answer-item dropdown-item date-item">';
        foreach ($dateorder as $datepart) {
            switch ($datepart) {
                // Show day select box
                case 'j':
                case 'd':
                    $answer .= '<label for="day' . $ia[1] . '" class="hide">' . $clang->gT('Day') . '</label><select id="day' . $ia[1] . '" name="day' . $ia[1] . '" class="day">
                    <option value="">' . $clang->gT('Day') . "</option>\n";
                    for ($i = 1; $i <= 31; $i++) {
                        if ($i == $currentdate) {
                            $i_date_selected = SELECTED;
                        } else {
                            $i_date_selected = '';
                        }
                        $answer .= '<option value="' . sprintf('%02d', $i) . '"' . $i_date_selected . '>' . sprintf('%02d', $i) . "</option>\n";
                    }
                    $answer .= '</select>';
                    break;
                    // Show month select box
                // Show month select box
                case 'n':
                case 'm':
                    $answer .= '<label for="month' . $ia[1] . '" class="hide">' . $clang->gT('Month') . '</label><select id="month' . $ia[1] . '" name="month' . $ia[1] . '" class="month">
                    <option value="">' . $clang->gT('Month') . "</option>\n";
                    switch ((int) trim($aQuestionAttributes['dropdown_dates_month_style'])) {
                        case 0:
                            $montharray = array($clang->gT('Jan'), $clang->gT('Feb'), $clang->gT('Mar'), $clang->gT('Apr'), $clang->gT('May'), $clang->gT('Jun'), $clang->gT('Jul'), $clang->gT('Aug'), $clang->gT('Sep'), $clang->gT('Oct'), $clang->gT('Nov'), $clang->gT('Dec'));
                            break;
                        case 1:
                            $montharray = array($clang->gT('January'), $clang->gT('February'), $clang->gT('March'), $clang->gT('April'), $clang->gT('May'), $clang->gT('June'), $clang->gT('July'), $clang->gT('August'), $clang->gT('September'), $clang->gT('October'), $clang->gT('November'), $clang->gT('December'));
//.........这里部分代码省略.........
开发者ID:josetorerobueno,项目名称:test_repo,代码行数:101,代码来源:qanda_helper.php

示例15: if

                <?php if ($qrrow['mandatory'] == "Y") { ?>
                    <?php eT("Yes"); ?>
                    <?php } else
                    { ?>
                    <?php eT("No"); ?>

                    <?php } ?>
            </td>
        </tr>
        <?php } ?>
    <?php if (trim($qrrow['relevance']) != '') { ?>
        <tr>
            <td><?php eT("Relevance equation:"); ?></td>
            <td>
                <?php
                    LimeExpressionManager::ProcessString("{" . $qrrow['relevance'] . "}", $qid);    // tests Relevance equation so can pretty-print it
                    echo LimeExpressionManager::GetLastPrettyPrintExpression();
                ?>
            </td>
        </tr>
        <?php } ?>
    <?php
        $sCurrentCategory='';
        foreach ($advancedsettings as $aAdvancedSetting)
        { ?>
        <tr>
            <td><?php echo $aAdvancedSetting['caption'];?>:</td>
            <td><?php
                    if ($aAdvancedSetting['i18n']==false)  echo htmlspecialchars($aAdvancedSetting['value']); else echo htmlspecialchars($aAdvancedSetting[$baselang]['value'])?>
            </td>
        </tr>
开发者ID:krsandesh,项目名称:LimeSurvey,代码行数:31,代码来源:questionbar_view.php


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