本文整理汇总了PHP中getRadixPointData函数的典型用法代码示例。如果您正苦于以下问题:PHP getRadixPointData函数的具体用法?PHP getRadixPointData怎么用?PHP getRadixPointData使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getRadixPointData函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: run
public function run()
{
/*
* Instead of manually rendering scripts after this function returns we
* use the callback. This ensures that scripts are always rendered, even
* if we call exit at some point in the code. (Which we shouldn't, but
* it happens.)
*/
// Ensure to set some var, but script are replaced in SurveyRuntimeHelper
$aLSJavascriptVar = array();
$aLSJavascriptVar['bFixNumAuto'] = (int) (bool) Yii::app()->getConfig('bFixNumAuto', 1);
$aLSJavascriptVar['bNumRealValue'] = (int) (bool) Yii::app()->getConfig('bNumRealValue', 0);
$aLangData = getLanguageData();
$aRadix = getRadixPointData($aLangData[Yii::app()->getConfig('defaultlang')]['radixpoint']);
$aLSJavascriptVar['sLEMradix'] = $aRadix['separator'];
$sLSJavascriptVar = "LSvar=" . json_encode($aLSJavascriptVar) . ';';
App()->clientScript->registerScript('sLSJavascriptVar', $sLSJavascriptVar, CClientScript::POS_HEAD);
App()->clientScript->registerScript('setJsVar', "setJsVar();", CClientScript::POS_BEGIN);
// Ensure all js var is set before rendering the page (User can click before $.ready)
App()->getClientScript()->registerPackage('jqueryui');
App()->getClientScript()->registerPackage('jquery-touch-punch');
App()->getClientScript()->registerScriptFile(Yii::app()->getConfig('generalscripts') . "survey_runtime.js");
useFirebug();
ob_start(function ($buffer, $phase) {
App()->getClientScript()->render($buffer);
App()->getClientScript()->reset();
return $buffer;
});
ob_implicit_flush(false);
$this->action();
ob_flush();
}
开发者ID:rouben,项目名称:LimeSurvey,代码行数:32,代码来源:index.php
示例2: run
public function run()
{
/*
* Instead of manually rendering scripts after this function returns we
* use the callback. This ensures that scripts are always rendered, even
* if we call exit at some point in the code. (Which we shouldn't, but
* it happens.)
*/
// Ensure to set some var, but script are replaced in SurveyRuntimeHelper
$aLSJavascriptVar = array();
$aLSJavascriptVar['bFixNumAuto'] = (int) (bool) Yii::app()->getConfig('bFixNumAuto', 1);
$aLSJavascriptVar['bNumRealValue'] = (int) (bool) Yii::app()->getConfig('bNumRealValue', 0);
$aLangData = getLanguageData();
$aRadix = getRadixPointData($aLangData[Yii::app()->getConfig('defaultlang')]['radixpoint']);
$aLSJavascriptVar['sLEMradix'] = $aRadix['separator'];
$sLSJavascriptVar = "LSvar=" . json_encode($aLSJavascriptVar) . ';';
// Template configuration
$param = $this->_getParameters(func_get_args(), $_POST);
$surveyid = $param['sid'];
// Font awesome
if (!YII_DEBUG) {
App()->getClientScript()->registerCssFile(App()->getAssetManager()->publish(dirname(Yii::app()->request->scriptFile) . '/styles-public/font-awesome-43.min.css'));
} else {
App()->getClientScript()->registerCssFile(Yii::app()->getBaseUrl(true) . '/styles-public/font-awesome-43-debugmode.min.css');
}
global $oTemplate;
$oTemplate = Template::model()->getTemplateConfiguration('', $surveyid);
$this->oTemplate = $oTemplate;
App()->clientScript->registerScript('sLSJavascriptVar', $sLSJavascriptVar, CClientScript::POS_HEAD);
App()->clientScript->registerScript('setJsVar', "setJsVar();", CClientScript::POS_BEGIN);
// Ensure all js var is set before rendering the page (User can click before $.ready)
foreach ($oTemplate->packages as $package) {
App()->getClientScript()->registerPackage($package);
}
App()->getClientScript()->registerScriptFile(Yii::app()->getConfig('generalscripts') . "survey_runtime.js");
if ($oTemplate->cssFramework == 'bootstrap') {
App()->bootstrap->register();
}
useFirebug();
ob_start(function ($buffer, $phase) {
App()->getClientScript()->render($buffer);
App()->getClientScript()->reset();
return $buffer;
});
ob_implicit_flush(false);
$this->action();
ob_flush();
}
开发者ID:kochichi,项目名称:LimeSurvey,代码行数:48,代码来源:index.php
示例3: run
public function run()
{
/*
* Instead of manually rendering scripts after this function returns we
* use the callback. This ensures that scripts are always rendered, even
* if we call exit at some point in the code. (Which we shouldn't, but
* it happens.)
*/
// Ensure to set some var, but script are replaced in SurveyRuntimeHelper
$aLSJavascriptVar = array();
$aLSJavascriptVar['bFixNumAuto'] = (int) (bool) Yii::app()->getConfig('bFixNumAuto', 1);
$aLSJavascriptVar['bNumRealValue'] = (int) (bool) Yii::app()->getConfig('bNumRealValue', 0);
$aLangData = getLanguageData();
$aRadix = getRadixPointData($aLangData[Yii::app()->getConfig('defaultlang')]['radixpoint']);
$aLSJavascriptVar['sLEMradix'] = $aRadix['separator'];
$sLSJavascriptVar = "LSvar=" . json_encode($aLSJavascriptVar) . ';';
// Template configuration
$param = $this->_getParameters(func_get_args(), $_POST);
$surveyid = $param['sid'];
$oTemplate = Template::model()->getInstance('', $surveyid);
$this->oTemplate = $oTemplate;
App()->clientScript->registerScript('sLSJavascriptVar', $sLSJavascriptVar, CClientScript::POS_HEAD);
App()->clientScript->registerScript('setJsVar', "setJsVar();", CClientScript::POS_BEGIN);
// Ensure all js var is set before rendering the page (User can click before $.ready)
foreach ($oTemplate->packages as $package) {
App()->getClientScript()->registerPackage((string) $package);
}
App()->getClientScript()->registerScriptFile(Yii::app()->getConfig('generalscripts') . "survey_runtime.js");
if ($oTemplate->cssFramework == 'bootstrap') {
// We now use the bootstrap package isntead of the Yiistrap TbApi::register() method
// Then instead of using the composer dependency system for templates
// We can use the package dependency system
Yii::app()->getClientScript()->registerMetaTag('width=device-width, initial-scale=1.0', 'viewport');
App()->bootstrap->registerAllScripts();
}
useFirebug();
ob_start(function ($buffer, $phase) {
App()->getClientScript()->render($buffer);
App()->getClientScript()->reset();
return $buffer;
});
ob_implicit_flush(false);
$this->action();
ob_flush();
}
开发者ID:mfavetti,项目名称:LimeSurvey,代码行数:45,代码来源:index.php
示例4: run
/**
* Main function
*
* @param mixed $surveyid
* @param mixed $args
*/
function run($surveyid, $args)
{
global $errormsg;
extract($args);
$LEMsessid = 'survey_' . $surveyid;
$sTemplatePath = getTemplatePath(Yii::app()->getConfig("defaulttemplate")) . DIRECTORY_SEPARATOR;
if (isset($_SESSION['survey_' . $surveyid]['templatepath'])) {
$sTemplatePath = $_SESSION['survey_' . $surveyid]['templatepath'];
}
// $LEMdebugLevel - customizable debugging for Lime Expression Manager
$LEMdebugLevel = 0;
// LEM_DEBUG_TIMING; // (LEM_DEBUG_TIMING + LEM_DEBUG_VALIDATION_SUMMARY + LEM_DEBUG_VALIDATION_DETAIL);
$LEMskipReprocessing = false;
// true if used GetLastMoveResult to avoid generation of unneeded extra JavaScript
switch ($thissurvey['format']) {
case "A":
//All in one
$surveyMode = 'survey';
break;
default:
case "S":
//One at a time
$surveyMode = 'question';
break;
case "G":
//Group at a time
$surveyMode = 'group';
break;
}
$radix = getRadixPointData($thissurvey['surveyls_numberformat']);
$radix = $radix['seperator'];
$surveyOptions = array('active' => $thissurvey['active'] == 'Y', 'allowsave' => $thissurvey['allowsave'] == 'Y', 'anonymized' => $thissurvey['anonymized'] != 'N', 'assessments' => $thissurvey['assessments'] == 'Y', 'datestamp' => $thissurvey['datestamp'] == 'Y', 'hyperlinkSyntaxHighlighting' => ($LEMdebugLevel & LEM_DEBUG_VALIDATION_SUMMARY) == LEM_DEBUG_VALIDATION_SUMMARY, 'ipaddr' => $thissurvey['ipaddr'] == 'Y', 'radix' => $radix, 'refurl' => $thissurvey['refurl'] == "Y" ? $_SESSION[$LEMsessid]['refurl'] : NULL, 'savetimings' => $thissurvey['savetimings'] == "Y", 'surveyls_dateformat' => isset($thissurvey['surveyls_dateformat']) ? $thissurvey['surveyls_dateformat'] : 1, 'startlanguage' => isset($clang->langcode) ? $clang->langcode : $thissurvey['language'], 'target' => Yii::app()->getConfig('uploaddir') . DIRECTORY_SEPARATOR . 'surveys' . DIRECTORY_SEPARATOR . $thissurvey['sid'] . DIRECTORY_SEPARATOR . 'files' . DIRECTORY_SEPARATOR, 'tempdir' => Yii::app()->getConfig('tempdir') . DIRECTORY_SEPARATOR, 'timeadjust' => isset($timeadjust) ? $timeadjust : 0, 'token' => isset($clienttoken) ? $clienttoken : NULL);
//Security Checked: POST, GET, SESSION, REQUEST, returnGlobal, DB
$previewgrp = false;
if ($surveyMode == 'group' && isset($param['action']) && $param['action'] == 'previewgroup') {
$previewgrp = true;
}
$previewquestion = false;
if ($surveyMode == 'question' && isset($param['action']) && $param['action'] == 'previewquestion') {
$previewquestion = true;
}
// if (isset($param['newtest']) && $param['newtest'] == "Y")
// setcookie("limesurvey_timers", "0"); //@todo fix - sometimes results in headers already sent error
$show_empty_group = false;
if ($previewgrp || $previewquestion) {
$_SESSION[$LEMsessid]['prevstep'] = 1;
$_SESSION[$LEMsessid]['maxstep'] = 0;
} else {
//RUN THIS IF THIS IS THE FIRST TIME , OR THE FIRST PAGE ########################################
if (!isset($_SESSION[$LEMsessid]['step'])) {
buildsurveysession($surveyid);
$sTemplatePath = $_SESSION[$LEMsessid]['templatepath'];
if ($surveyid != LimeExpressionManager::getLEMsurveyId()) {
LimeExpressionManager::SetDirtyFlag();
}
LimeExpressionManager::StartSurvey($surveyid, $surveyMode, $surveyOptions, false, $LEMdebugLevel);
$_SESSION[$LEMsessid]['step'] = 0;
if ($surveyMode == 'survey') {
$move = "movenext";
// to force a call to NavigateForwards()
} elseif (isset($thissurvey['showwelcome']) && $thissurvey['showwelcome'] == 'N') {
$move = "movenext";
$_SESSION[$LEMsessid]['step'] = 1;
}
} else {
if ($surveyid != LimeExpressionManager::getLEMsurveyId()) {
LimeExpressionManager::StartSurvey($surveyid, $surveyMode, $surveyOptions, false, $LEMdebugLevel);
LimeExpressionManager::JumpTo($_SESSION[$LEMsessid]['step'], false, false);
}
}
$totalquestions = $_SESSION['survey_' . $surveyid]['totalquestions'];
if (!isset($_SESSION[$LEMsessid]['totalsteps'])) {
$_SESSION[$LEMsessid]['totalsteps'] = 0;
}
if (!isset($_SESSION[$LEMsessid]['maxstep'])) {
$_SESSION[$LEMsessid]['maxstep'] = 0;
}
if (isset($_SESSION[$LEMsessid]['LEMpostKey']) && isset($_POST['LEMpostKey']) && $_POST['LEMpostKey'] != $_SESSION[$LEMsessid]['LEMpostKey']) {
// then trying to resubmit (e.g. Next, Previous, Submit) from a cached copy of the page
// Does not try to save anything from the page to the database
$moveResult = LimeExpressionManager::GetLastMoveResult(true);
if (isset($_POST['thisstep']) && isset($moveResult['seq']) && $_POST['thisstep'] == $moveResult['seq']) {
// then pressing F5 or otherwise refreshing the current page, which is OK
$LEMskipReprocessing = true;
$move = "movenext";
// so will re-display the survey
} else {
// trying to use browser back buttons, which may be disallowed if no 'previous' button is present
$LEMskipReprocessing = true;
$move = "movenext";
// so will re-display the survey
$invalidLastPage = true;
$vpopup = "<script type=\"text/javascript\">\n\n <!--\n \$(document).ready(function(){\n alert(\"" . $clang->gT("Please use the LimeSurvey navigation buttons or index. It appears you attempted to use the browser back button to re-submit a page.", "js") . "\");});\n //-->\n\n </script>\n";
}
//.........这里部分代码省略.........
开发者ID:ryu1inaba,项目名称:LimeSurvey,代码行数:101,代码来源:SurveyRuntimeHelper.php
示例5: do_array_multiflexi
//.........这里部分代码省略.........
if (isset($sessionao[$iParentQID])) {
foreach ($sessionao[$iParentQID] as $aOrigRow) {
$sCode = $aOrigRow['title'];
foreach ($ansresult as $aRow) {
if ($sCode == $aRow['title']) {
$aResult[] = $aRow;
}
}
}
$ansresult = $aResult;
}
}
$anscount = count($ansresult);
$fn = 1;
$sAnswerRows = '';
foreach ($ansresult as $j => $ansrow) {
if (isset($repeatheadings) && $repeatheadings > 0 && $fn - 1 > 0 && ($fn - 1) % $repeatheadings == 0) {
if ($anscount - $fn + 1 >= $minrepeatheadings) {
$sAnswerRows .= doRender('/survey/questions/arrays/multiflexi/rows/repeat_header', array('labelans' => $labelans, 'right_exists' => $right_exists, 'cellwidth' => $cellwidth, 'answerwidth' => $answerwidth, 'textAlignment' => $textAlignment), true);
}
}
$myfname = $ia[1] . $ansrow['title'];
$answertext = $ansrow['question'];
$answertextsave = $answertext;
/* Check the sub Q mandatory violation */
$error = false;
if ($ia[6] == 'Y' && !empty($aMandatoryViolationSubQ)) {
//Go through each labelcode and check for a missing answer! Default :If any are found, highlight this line, checkbox : if one is not found : don't highlight
// PS : we really need a better system : event for EM !
$emptyresult = $aQuestionAttributes['multiflexible_checkbox'] != 0 ? 1 : 0;
foreach ($labelcode as $ld) {
$myfname2 = $myfname . '_' . $ld;
if ($aQuestionAttributes['multiflexible_checkbox'] != 0) {
if (!in_array($myfname2, $aMandatoryViolationSubQ)) {
$emptyresult = 0;
}
} else {
if (in_array($myfname2, $aMandatoryViolationSubQ)) {
$emptyresult = 1;
}
}
}
$error = $emptyresult == 1 ? true : false;
}
$sSeparator = getRadixPointData($thissurvey['surveyls_numberformat']);
$sSeparator = $sSeparator['separator'];
// Get array_filter stuff
$sDisplayStyle = return_display_style($ia, $aQuestionAttributes, $thissurvey, $myfname);
if (strpos($answertext, '|')) {
$answertext = substr($answertext, 0, strpos($answertext, '|'));
}
$row_value = isset($_SESSION['survey_' . Yii::app()->getConfig('surveyID')][$myfname]) ? $_SESSION['survey_' . Yii::app()->getConfig('surveyID')][$myfname] : '';
$first_hidden_field = '';
$thiskey = 0;
$answer_tds = '';
foreach ($labelcode as $i => $ld) {
$myfname2 = $myfname . "_{$ld}";
$value = isset($_SESSION['survey_' . Yii::app()->getConfig('surveyID')][$myfname2]) ? $_SESSION['survey_' . Yii::app()->getConfig('surveyID')][$myfname2] : '';
// Possibly replace '.' with ','
$surveyId = Yii::app()->getConfig('surveyID');
$surveyLabel = 'survey_' . $surveyId;
$fieldnameIsNumeric = isset($_SESSION[$surveyLabel][$myfname2]) && is_numeric($_SESSION[$surveyLabel][$myfname2]);
if ($fieldnameIsNumeric) {
$value = str_replace('.', $sSeparator, $_SESSION[$surveyLabel][$myfname2]);
}
if ($checkboxlayout == false) {
$answer_tds .= doRender('/survey/questions/arrays/multiflexi/rows/cells/answer_td', array('dataTitle' => $labelans[$i], 'ld' => $ld, 'answertypeclass' => $answertypeclass, 'answertext' => $answertext, 'stepvalue' => $stepvalue, 'extraclass' => $extraclass, 'myfname2' => $myfname2, 'error' => $error, 'inputboxlayout' => $inputboxlayout, 'checkconditionFunction' => $checkconditionFunction, 'minvalue' => $minvalue, 'maxvalue' => $maxvalue, 'reverse' => $reverse, 'value' => $value, 'sSeparator' => $sSeparator, 'kpclass' => $kpclass, 'maxlength' => $maxlength), true);
$inputnames[] = $myfname2;
$thiskey++;
} else {
if (isset($_SESSION['survey_' . Yii::app()->getConfig('surveyID')][$myfname2]) && $_SESSION['survey_' . Yii::app()->getConfig('surveyID')][$myfname2] == '1') {
$myvalue = '1';
$setmyvalue = CHECKED;
} else {
$myvalue = '';
$setmyvalue = '';
}
$answer_tds .= doRender('/survey/questions/arrays/multiflexi/rows/cells/answer_td_checkboxes', array('dataTitle' => $labelans[$i], 'ld' => $ld, 'answertypeclass' => $answertypeclass, 'value' => $myvalue, 'setmyvalue' => $setmyvalue, 'myfname2' => $myfname2, 'checkconditionFunction' => $checkconditionFunction, 'extraclass' => $extraclass), true);
$inputnames[] = $myfname2;
$thiskey++;
}
}
$rightTd = false;
$answertextright = '';
if (strpos($answertextsave, '|')) {
$answertextright = substr($answertextsave, strpos($answertextsave, '|') + 1);
$rightTd = true;
} elseif ($right_exists) {
$rightTd = true;
}
$sAnswerRows .= doRender('/survey/questions/arrays/multiflexi/rows/answer_row', array('sDisplayStyle' => $sDisplayStyle, 'useAnswerWidth' => $useAnswerWidth, 'answerwidth' => $answerwidth, 'myfname' => $myfname, 'error' => $error, 'row_value' => $row_value, 'answertext' => $answertext, 'answertextright' => $answertextright, 'answer_tds' => $answer_tds, 'rightTd' => $rightTd, 'zebra' => 2 - $j % 2), true);
$fn++;
}
$answer = doRender('/survey/questions/arrays/multiflexi/answer', array('answertypeclass' => $answertypeclass, 'extraclass' => $extraclass, 'answerwidth' => $answerwidth, 'labelans' => $labelans, 'cellwidth' => $cellwidth, 'right_exists' => $right_exists, 'sAnswerRows' => $sAnswerRows, 'textAlignment' => $textAlignment), true);
} else {
$answer = doRender('/survey/questions/arrays/multiflexi/empty_error', array(), true);
$inputnames = '';
}
return array($answer, $inputnames);
}
开发者ID:mfavetti,项目名称:LimeSurvey,代码行数:101,代码来源:qanda_helper.php
示例6: submittokens
/**
* Marks a tokens as completed and sends a confirmation email to the participiant.
* If $quotaexit is set to true then the user exited the survey due to a quota
* restriction and the according token is only marked as 'Q'
*
* @param mixed $quotaexit
*/
function submittokens($quotaexit = false)
{
global $thissurvey, $timeadjust, $emailcharset;
global $dbprefix, $surveyid, $connect;
global $sitename, $thistpl, $clang, $clienttoken;
// Shift the date due to global timeadjust setting
$today = date_shift(date("Y-m-d H:i:s"), "Y-m-d H:i", $timeadjust);
// check how many uses the token has left
$usesquery = "SELECT usesleft FROM {$dbprefix}tokens_{$surveyid} WHERE token='" . db_quote($clienttoken) . "'";
$usesresult = db_execute_assoc($usesquery);
$usesrow = $usesresult->FetchRow();
if (isset($usesrow)) {
$usesleft = $usesrow['usesleft'];
}
$utquery = "UPDATE {$dbprefix}tokens_{$surveyid}\n";
if ($quotaexit == true) {
$utquery .= "SET completed='Q', usesleft=usesleft-1\n";
} elseif (bIsTokenCompletedDatestamped($thissurvey)) {
if (isset($usesleft) && $usesleft <= 1) {
$utquery .= "SET usesleft=usesleft-1, completed='{$today}'\n";
} else {
$utquery .= "SET usesleft=usesleft-1\n";
}
} else {
if (isset($usesleft) && $usesleft <= 1) {
$utquery .= "SET usesleft=usesleft-1, completed='Y'\n";
} else {
$utquery .= "SET usesleft=usesleft-1\n";
}
}
$utquery .= "WHERE token='" . db_quote($clienttoken) . "'";
$utresult = $connect->Execute($utquery) or safe_die("Couldn't update tokens table!<br />\n{$utquery}<br />\n" . $connect->ErrorMsg());
//Checked
if ($quotaexit == false) {
// TLR change to put date into sent and completed
$cnfquery = "SELECT * FROM " . db_table_name("tokens_{$surveyid}") . " WHERE token='" . db_quote($clienttoken) . "' AND completed!='N' AND completed!=''";
$cnfresult = db_execute_assoc($cnfquery);
//Checked
$cnfrow = $cnfresult->FetchRow();
if (isset($cnfrow)) {
$from = "{$thissurvey['adminname']} <{$thissurvey['adminemail']}>";
$to = $cnfrow['email'];
$subject = $thissurvey['email_confirm_subj'];
$fieldsarray["{ADMINNAME}"] = $thissurvey['adminname'];
$fieldsarray["{ADMINEMAIL}"] = $thissurvey['adminemail'];
$fieldsarray["{SURVEYNAME}"] = $thissurvey['name'];
$fieldsarray["{SURVEYDESCRIPTION}"] = $thissurvey['description'];
$fieldsarray["{FIRSTNAME}"] = $cnfrow['firstname'];
$fieldsarray["{LASTNAME}"] = $cnfrow['lastname'];
$fieldsarray["{TOKEN}"] = $clienttoken;
$attrfieldnames = GetAttributeFieldnames($surveyid);
foreach ($attrfieldnames as $attr_name) {
$fieldsarray["{" . strtoupper($attr_name) . "}"] = $cnfrow[$attr_name];
}
$dateformatdatat = getDateFormatData($thissurvey['surveyls_dateformat']);
$numberformatdatat = getRadixPointData($thissurvey['surveyls_numberformat']);
$fieldsarray["{EXPIRY}"] = convertDateTimeFormat($thissurvey["expiry"], 'Y-m-d H:i:s', $dateformatdatat['phpdate']);
$subject = ReplaceFields($subject, $fieldsarray, true);
if ($thissurvey['anonymized'] == "N") {
// Survey is not anonymous, we can translate insertAns placeholder
$subject = dTexts::run($subject);
}
$subject = html_entity_decode($subject, ENT_QUOTES, $emailcharset);
if (getEmailFormat($surveyid) == 'html') {
$ishtml = true;
} else {
$ishtml = false;
}
if (trim(strip_tags($thissurvey['email_confirm'])) != "") {
$message = $thissurvey['email_confirm'];
$message = ReplaceFields($message, $fieldsarray, true);
if ($thissurvey['anonymized'] == "N") {
// Survey is not anonymous, we can translate insertAns placeholder
$message = dTexts::run($message);
}
if (!$ishtml) {
$message = strip_tags(br2nl(html_entity_decode($message, ENT_QUOTES, $emailcharset)));
} else {
$message = html_entity_decode($message, ENT_QUOTES, $emailcharset);
}
//Only send confirmation email if there is a valid email address
if (validate_email($cnfrow['email'])) {
SendEmailMessage(null, $message, $subject, $to, $from, $sitename, $ishtml);
}
} else {
//There is nothing in the message, so don't send a confirmation email
//This section only here as placeholder to indicate new feature :-)
}
}
}
}
开发者ID:karime7gezly,项目名称:OpenConextApps-LimeSurvey,代码行数:98,代码来源:index.php
示例7: setJavascriptVar
/**
* setJavascriptVar
*
* @return @void
* @param integer $iSurveyId : the survey id for the script
*/
public function setJavascriptVar($iSurveyId)
{
$aSurveyinfo = getSurveyInfo($iSurveyId, App()->getLanguage());
if (isset($aSurveyinfo['surveyls_numberformat'])) {
$aLSJavascriptVar = array();
$aLSJavascriptVar['bFixNumAuto'] = (int) (bool) Yii::app()->getConfig('bFixNumAuto', 1);
$aLSJavascriptVar['bNumRealValue'] = (int) (bool) Yii::app()->getConfig('bNumRealValue', 0);
$aRadix = getRadixPointData($aSurveyinfo['surveyls_numberformat']);
$aLSJavascriptVar['sLEMradix'] = $aRadix['separator'];
$sLSJavascriptVar = "LSvar=" . json_encode($aLSJavascriptVar) . ';';
App()->clientScript->registerScript('sLSJavascriptVar', $sLSJavascriptVar, CClientScript::POS_HEAD);
}
// Maybe remove one from index and allow empty $surveyid here.
}
开发者ID:BertHankes,项目名称:LimeSurvey,代码行数:20,代码来源:SurveyRuntimeHelper.php
示例8: submittokens
/**
* Marks a tokens as completed and sends a confirmation email to the participiant.
* If $quotaexit is set to true then the user exited the survey due to a quota
* restriction and the according token is only marked as 'Q'
*
* @param mixed $quotaexit
*/
function submittokens($quotaexit = false)
{
$surveyid = Yii::app()->getConfig('surveyID');
if (isset($_SESSION['survey_' . $surveyid]['s_lang'])) {
$thissurvey = getSurveyInfo($surveyid, $_SESSION['survey_' . $surveyid]['s_lang']);
} else {
$thissurvey = getSurveyInfo($surveyid);
}
$clienttoken = $_SESSION['survey_' . $surveyid]['token'];
$sitename = Yii::app()->getConfig("sitename");
$emailcharset = Yii::app()->getConfig("emailcharset");
// Shift the date due to global timeadjust setting
$today = dateShift(date("Y-m-d H:i:s"), "Y-m-d H:i", Yii::app()->getConfig("timeadjust"));
// check how many uses the token has left
$token = Token::model($surveyid)->findByAttributes(array('token' => $clienttoken));
if ($quotaexit == true) {
$token->completed = 'Q';
$token->usesleft--;
} else {
if ($token->usesleft <= 1) {
// Finish the token
if (isTokenCompletedDatestamped($thissurvey)) {
$token->completed = $today;
} else {
$token->completed = 'Y';
}
if (isset($token->participant_id)) {
$slquery = SurveyLink::model()->find('participant_id = :pid AND survey_id = :sid AND token_id = :tid', array(':pid' => $token->participant_id, ':sid' => $surveyid, ':tid' => $token->tid));
if ($slquery) {
if (isTokenCompletedDatestamped($thissurvey)) {
$slquery->date_completed = $today;
} else {
// Update the survey_links table if necessary, to protect anonymity, use the date_created field date
$slquery->date_completed = $slquery->date_created;
}
$slquery->save();
}
}
}
$token->usesleft--;
}
$token->save();
if ($quotaexit == false) {
if ($token && trim(strip_tags($thissurvey['email_confirm'])) != "" && $thissurvey['sendconfirmation'] == "Y") {
// if($token->completed == "Y" || $token->completed == $today)
// {
$from = "{$thissurvey['adminname']} <{$thissurvey['adminemail']}>";
$subject = $thissurvey['email_confirm_subj'];
$aReplacementVars = array();
$aReplacementVars["ADMINNAME"] = $thissurvey['admin'];
$aReplacementVars["ADMINEMAIL"] = $thissurvey['adminemail'];
$aReplacementVars['ADMINEMAIL'] = $thissurvey['adminemail'];
//Fill with token info, because user can have his information with anonimity control
$aReplacementVars["FIRSTNAME"] = $token->firstname;
$aReplacementVars["LASTNAME"] = $token->lastname;
$aReplacementVars["TOKEN"] = $token->token;
// added survey url in replacement vars
$surveylink = Yii::app()->createAbsoluteUrl("/survey/index/sid/{$surveyid}", array('lang' => $_SESSION['survey_' . $surveyid]['s_lang'], 'token' => $token->token));
$aReplacementVars['SURVEYURL'] = $surveylink;
$attrfieldnames = getAttributeFieldNames($surveyid);
foreach ($attrfieldnames as $attr_name) {
$aReplacementVars[strtoupper($attr_name)] = $token->{$attr_name};
}
$dateformatdatat = getDateFormatData($thissurvey['surveyls_dateformat']);
$numberformatdatat = getRadixPointData($thissurvey['surveyls_numberformat']);
$redata = array('thissurvey' => $thissurvey);
$subject = templatereplace($subject, $aReplacementVars, $redata, '', false, null, array(), true);
$subject = html_entity_decode($subject, ENT_QUOTES, $emailcharset);
if (getEmailFormat($surveyid) == 'html') {
$ishtml = true;
} else {
$ishtml = false;
}
$message = $thissurvey['email_confirm'];
//$message=ReplaceFields($message, $fieldsarray, true);
$message = templatereplace($message, $aReplacementVars, $redata, '', false, null, array(), true);
if (!$ishtml) {
$message = strip_tags(breakToNewline(html_entity_decode($message, ENT_QUOTES, $emailcharset)));
} else {
$message = html_entity_decode($message, ENT_QUOTES, $emailcharset);
}
//Only send confirmation email if there is a valid email address
$sToAddress = validateEmailAddresses($token->email);
if ($sToAddress) {
$aAttachments = unserialize($thissurvey['attachments']);
$aRelevantAttachments = array();
/*
* Iterate through attachments and check them for relevance.
*/
if (isset($aAttachments['confirmation'])) {
foreach ($aAttachments['confirmation'] as $aAttachment) {
$relevance = $aAttachment['relevance'];
// If the attachment is relevant it will be added to the mail.
//.........这里部分代码省略.........
开发者ID:elcharlygraf,项目名称:Encuesta-YiiFramework,代码行数:101,代码来源:frontend_helper.php
示例9: doQuestion
public function doQuestion($ia)
{
global $thissurvey;
if ($thissurvey['nokeyboard'] == 'Y') {
includeKeypad();
$kpclass = "text-keypad";
} else {
$kpclass = "";
}
$checkconditionFunction = "checkconditions";
$aQuestionAttributes = getQuestionAttributeValues($ia[0]);
$query = "SELECT other FROM {{questions}} WHERE qid=" . $ia[0] . " AND language='" . $_SESSION['survey_' . Yii::app()->getConfig('surveyID')]['s_lang'] . "' ";
$result = Yii::app()->db->createCommand($query)->query();
foreach ($result->readAll() as $row) {
$other = $row['other'];
}
//question attribute random order set?
if ($aQuestionAttributes['random_order'] == 1) {
$ansquery = "SELECT * FROM {{answers}} WHERE qid={$ia['0']} AND language='" . $_SESSION['survey_' . Yii::app()->getConfig('surveyID')]['s_lang'] . "' and scale_id=0 ORDER BY " . dbRandom();
} elseif ($aQuestionAttributes['alphasort'] == 1) {
$ansquery = "SELECT * FROM {{answers}} WHERE qid={$ia['0']} AND language='" . $_SESSION['survey_' . Yii::app()->getConfig('surveyID')]['s_lang'] . "' and scale_id=0 ORDER BY answer";
} else {
$ansquery = "SELECT * FROM {{answers}} WHERE qid={$ia['0']} AND language='" . $_SESSION['survey_' . Yii::app()->getConfig('surveyID')]['s_lang'] . "' and scale_id=0 ORDER BY sortorder, answer";
}
$ansresult = dbExecuteAssoc($ansquery)->readAll();
//Checked
$anscount = count($ansresult);
if (trim($aQuestionAttributes['display_columns']) != '') {
$dcols = $aQuestionAttributes['display_columns'];
} else {
$dcols = 1;
}
if (trim($aQuestionAttributes['other_replace_text'][$_SESSION['survey_' . Yii::app()->getConfig('surveyID')]['s_lang']]) != '') {
$othertext = $aQuestionAttributes['other_replace_text'][$_SESSION['survey_' . Yii::app()->getConfig('surveyID')]['s_lang']];
} else {
$othertext = gT('Other:');
}
if (isset($other) && $other == 'Y') {
$anscount++;
}
//Count up for the Other answer
if ($ia[6] != 'Y' && SHOW_NO_ANSWER == 1) {
$anscount++;
}
//Count up if "No answer" is showing
$wrapper = setupColumns($dcols, $anscount, "answers-list radio-list", "answer-item radio-item");
$iBootCols = round(12 / $dcols);
$ansByCol = round($anscount / $dcols);
$ansByCol = $ansByCol > 0 ? $ansByCol : 1;
//$answer = 'IKI: '.$iBootCols.' '.$ansByCol.' '.$wrapper['whole-start'];
$answer = '<div class="row">';
$answer .= ' <div class="col-xs-' . $iBootCols . '">AAAAAAAAAAAAAA';
//Time Limit Code
if (trim($aQuestionAttributes['time_limit']) != '') {
$answer .= return_timer_script($aQuestionAttributes, $ia);
}
//End Time Limit Code
// Get array_filter stuff
$rowcounter = 0;
$colcounter = 1;
$trbc = '';
foreach ($ansresult as $key => $ansrow) {
$myfname = $ia[1] . $ansrow['code'];
$check_ans = '';
if ($_SESSION['survey_' . Yii::app()->getConfig('surveyID')][$ia[1]] == $ansrow['code']) {
$check_ans = CHECKED;
}
list($htmltbody2, $hiddenfield) = return_array_filter_strings($ia, $aQuestionAttributes, $thissurvey, $ansrow, $myfname, '', $myfname, "div", "form-group answer-item radio-item");
/* if(substr($wrapper['item-start'],0,4) == "\t<li")
{
$startitem = "\t$htmltbody2\n";
} else {
$startitem = $wrapper['item-start'];
}
$answer .= $startitem;*/
$answer .= "\t{$hiddenfield}\n";
$answer .= '<div class="form-group">';
$answer .= ' <label for="answer' . $ia[1] . $ansrow['code'] . '" class="answertext control-label">' . $ansrow['answer'] . '</label>';
$answer .= ' <input class="radio" type="radio" value="' . $ansrow['code'] . '" name="' . $ia[1] . '" id="answer' . $ia[1] . $ansrow['code'] . '"' . $check_ans . ' onclick="if (document.getElementById(\'answer' . $ia[1] . 'othertext\') != null) document.getElementById(\'answer' . $ia[1] . 'othertext\').value=\'\';' . $checkconditionFunction . '(this.value, this.name, this.type)" />';
$answer .= $wrapper['item-end'];
$answer .= '</div>';
++$rowcounter;
//if ($rowcounter == $wrapper['maxrows'] && $colcounter < $wrapper['cols'] || (count($ansresult)-$key)==$wrapper['cols']-$colcounter)
if ($rowcounter == $ansByCol && $colcounter < $wrapper['cols']) {
if ($colcounter == $wrapper['cols']) {
//$answer .= 'là '.$wrapper['col-devide-last'];
$answer .= ' </div><!-- last -->';
} else {
//$answer .= 'et là '.$wrapper['col-devide'];
$answer .= ' </div><!-- devide --> ';
$answer .= ' <div class="col-xs-' . $iBootCols . '">';
}
$rowcounter = 0;
++$colcounter;
}
}
if (isset($other) && $other == 'Y') {
$sSeparator = getRadixPointData($thissurvey['surveyls_numberformat']);
$sSeparator = $sSeparator['separator'];
//.........这里部分代码省略.........
开发者ID:sickpig,项目名称:LimeSurvey,代码行数:101,代码来源:listRadio.php
示例10: intval
}
if (intval(trim($qidattributes['maximum_chars'])) > 0 && intval(trim($qidattributes['maximum_chars'])) < 4000) {
// Limit to 4000 to maintain compatibility
$maximum_chars = intval(trim($qidattributes['maximum_chars']));
$maxlength = "maxlength='{$maximum_chars}' ";
} else {
$maxlength = "maxlength='4000' ";
// Default to 4000 chars if not set within limits
}
if (trim($qidattributes['text_input_width']) != '') {
$tiwidth = $qidattributes['text_input_width'];
} else {
$tiwidth = 50;
}
if ($qidattributes['numbers_only'] == 1) {
$sSeparator = getRadixPointData($thissurvey['surveyls_numberformat']);
$sSeparator = $sSeparator['separator'];
$numbersonly = 'onkeypress="return goodchars(event,\'-0123456789' . $sSeparator . '\')"';
} else {
$numbersonly = '';
}
if (trim($qidattributes['display_rows']) != '') {
//question attribute "display_rows" is set -> we need a textarea to be able to show several rows
$drows = $qidattributes['display_rows'];
//if a textarea should be displayed we make it equal width to the long text question
//this looks nicer and more continuous
if ($tiwidth == 50) {
$tiwidth = 40;
}
echo $prefix;
?>
开发者ID:withhope,项目名称:HIT-Survey,代码行数:31,代码来源:content_view.php
示例11: submittokens
/**
* Marks a tokens as completed and sends a confirmation email to the participiant.
* If $quotaexit is set to true then the user exited the survey due to a quota
* restriction and the according token is only marked as 'Q'
*
* @param mixed $quotaexit
*/
function submittokens($quotaexit = false)
{
global $thissurvey;
global $surveyid;
global $clienttoken;
$clang = Yii::app()->lang;
$sitename = Yii::app()->getConfig("sitename");
$emailcharset = Yii::app()->getConfig("emailcharset");
// Shift the date due to global timeadjust setting
$today = dateShift(date("Y-m-d H:i:s"), "Y-m-d H:i", Yii::app()->getConfig("timeadjust"));
// check how many uses the token has left
$usesquery = "SELECT usesleft, participant_id, tid FROM {{tokens_{$surveyid}}} WHERE token='" . $clienttoken . "'";
$usesresult = dbExecuteAssoc($usesquery);
$usesrow = $usesresult->read();
if (isset($usesrow)) {
$usesleft = $usesrow['usesleft'];
$participant_id = $usesrow['participant_id'];
$token_id = $usesrow['tid'];
}
$utquery = "UPDATE {{tokens_{$surveyid}}}\n";
if ($quotaexit == true) {
$utquery .= "SET completed='Q', usesleft=usesleft-1\n";
} elseif (isTokenCompletedDatestamped($thissurvey)) {
if (isset($usesleft) && $usesleft <= 1) {
$utquery .= "SET usesleft=usesleft-1, completed='{$today}'\n";
if (!empty($participant_id)) {
//Update the survey_links table if necessary
$slquery = Survey_links::model()->find('participant_id = "' . $participant_id . '" AND survey_id = ' . $surveyid . ' AND token_id = ' . $token_id);
$slquery->date_completed = $today;
$slquery->save();
}
} else {
$utquery .= "SET usesleft=usesleft-1\n";
}
} else {
if (isset($usesleft) && $usesleft <= 1) {
$utquery .= "SET usesleft=usesleft-1, completed='Y'\n";
if (!empty($participant_id)) {
//Update the survey_links table if necessary, to protect anonymity, use the date_created field date
$slquery = Survey_links::model()->find('participant_id = "' . $participant_id . '" AND survey_id = ' . $surveyid . ' AND token_id = ' . $token_id);
$slquery->date_completed = $slquery->date_created;
$slquery->save();
}
} else {
$utquery .= "SET usesleft=usesleft-1\n";
}
}
$utquery .= "WHERE token='" . $clienttoken . "'";
$utresult = dbExecuteAssoc($utquery) or safeDie("Couldn't update tokens table!<br />\n{$utquery}<br />\n");
//Checked
if ($quotaexit == false) {
// TLR change to put date into sent and completed
$cnfquery = "SELECT * FROM {{tokens_{$surveyid}}} WHERE token='" . $clienttoken . "' AND completed!='N' AND completed!=''";
$cnfresult = dbExecuteAssoc($cnfquery);
//Checked
$cnfrow = $cnfresult->read();
if (isset($cnfrow)) {
$from = "{$thissurvey['adminname']} <{$thissurvey['adminemail']}>";
$to = $cnfrow['email'];
$subject = $thissurvey['email_confirm_subj'];
$fieldsarray["{ADMINNAME}"] = $thissurvey['adminname'];
$fieldsarray["{ADMINEMAIL}"] = $thissurvey['adminemail'];
$fieldsarray["{SURVEYNAME}"] = $thissurvey['name'];
$fieldsarray["{SURVEYDESCRIPTION}"] = $thissurvey['description'];
$fieldsarray["{FIRSTNAME}"] = $cnfrow['firstname'];
$fieldsarray["{LASTNAME}"] = $cnfrow['lastname'];
$fieldsarray["{TOKEN}"] = $clienttoken;
$attrfieldnames = getAttributeFieldNames($surveyid);
foreach ($attrfieldnames as $attr_name) {
$fieldsarray["{" . strtoupper($attr_name) . "}"] = $cnfrow[$attr_name];
}
$dateformatdatat = getDateFormatData($thissurvey['surveyls_dateformat']);
$numberformatdatat = getRadixPointData($thissurvey['surveyls_numberformat']);
$fieldsarray["{EXPIRY}"] = convertDateTimeFormat($thissurvey["expiry"], 'Y-m-d H:i:s', $dateformatdatat['phpdate']);
$subject = ReplaceFields($subject, $fieldsarray, true);
$subject = html_entity_decode($subject, ENT_QUOTES, $emailcharset);
if (getEmailFormat($surveyid) == 'html') {
$ishtml = true;
} else {
$ishtml = false;
}
if (trim(strip_tags($thissurvey['email_confirm'])) != "" && $thissurvey['sendconfirmation'] == "Y") {
$message = $thissurvey['email_confirm'];
$message = ReplaceFields($message, $fieldsarray, true);
if (!$ishtml) {
$message = strip_tags(breakToNewline(html_entity_decode($message, ENT_QUOTES, $emailcharset)));
} else {
$message = html_entity_decode($message, ENT_QUOTES, $emailcharset);
}
//Only send confirmation email if there is a valid email address
if (validateEmailAddress($cnfrow['email'])) {
SendEmailMessage($message, $subject, $to, $from, $sitename, $ishtml);
}
//.........这里部分代码省略.........
开发者ID:rawaludin,项目名称:LimeSurvey,代码行数:101,代码来源:frontend_helper.php
示例12: setJavascriptVar
/**
* setJavascriptVar
*
*
* @return @void
* @param integer $iSurveyId : the survey id for the script
* @param string $sLanguage : the actual language for the survey
*/
public function setJavascriptVar($iSurveyId, $sLanguage)
{
$aSurveyinfo = getSurveyInfo($iSurveyId, $sLanguage);
if (isset($aSurveyinfo['surveyls_numberformat'])) {
$aLSJavascriptVar = array();
$aLSJavascriptVar['bFixNumAuto'] = (int) (bool) Yii::app()->getConfig('bFixNumAuto', 1);
$aLSJavascriptVar['bNumRealValue'] = (int) (bool) Yii::app()->getConfig('bNumRealValue', 0);
$aRadix = getRadixPointData($aSurveyinfo['surveyls_numberformat']);
$aLSJavascriptVar['sLEMradix'] = $aRadix['separator'];
$sLSJavascriptVar = "LSvar=" . json_encode($aLSJavascriptVar) . ';';
App()->clientScript->registerScript('sLSJavascriptVar', $sLSJavascriptVar, CClientScript::POS_HEAD);
}
// Don't update, because already set in index/run
}
开发者ID:rouben,项目名称:LimeSurvey,代码行数:22,代码来源:SurveyRuntimeHelper.php
示例13: do_array_multiflexi
|
请发表评论