本文整理汇总了PHP中getQuestionAttributeValues函数的典型用法代码示例。如果您正苦于以下问题:PHP getQuestionAttributeValues函数的具体用法?PHP getQuestionAttributeValues怎么用?PHP getQuestionAttributeValues使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getQuestionAttributeValues函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: view
/**
* View a single response in detail
*
* @param mixed $iSurveyID
* @param mixed $iId
* @param mixed $sBrowseLang
*/
public function view($iSurveyID, $iId, $sBrowseLang = '')
{
if (Permission::model()->hasSurveyPermission($iSurveyID, 'responses', 'read')) {
$aData = $this->_getData(array('iId' => $iId, 'iSurveyId' => $iSurveyID, 'browselang' => $sBrowseLang));
$sBrowseLanguage = $aData['language'];
extract($aData);
$aViewUrls = array();
$fieldmap = createFieldMap($iSurveyID, 'full', false, false, $aData['language']);
$bHaveToken = $aData['surveyinfo']['anonymized'] == "N" && tableExists('tokens_' . $iSurveyID);
// Boolean : show (or not) the token
if (!Permission::model()->hasSurveyPermission($iSurveyID, 'tokens', 'read')) {
unset($fieldmap['token']);
$bHaveToken = false;
}
//add token to top of list if survey is not private
if ($bHaveToken) {
$fnames[] = array("token", gT("Token ID"), 'code' => 'token');
$fnames[] = array("firstname", gT("First name"), 'code' => 'firstname');
// or token:firstname ?
$fnames[] = array("lastname", gT("Last name"), 'code' => 'lastname');
$fnames[] = array("email", gT("Email"), 'code' => 'email');
}
$fnames[] = array("submitdate", gT("Submission date"), gT("Completed"), "0", 'D', 'code' => 'submitdate');
$fnames[] = array("completed", gT("Completed"), "0");
foreach ($fieldmap as $field) {
if ($field['fieldname'] == 'lastpage' || $field['fieldname'] == 'submitdate') {
continue;
}
if ($field['type'] == 'interview_time') {
continue;
}
if ($field['type'] == 'page_time') {
continue;
}
if ($field['type'] == 'answer_time') {
continue;
}
//$question = $field['question'];
$question = viewHelper::getFieldText($field);
if ($field['type'] != "|") {
$fnames[] = array($field['fieldname'], viewHelper::getFieldText($field), 'code' => viewHelper::getFieldCode($field, array('LEMcompat' => true)));
} elseif ($field['aid'] !== 'filecount') {
$qidattributes = getQuestionAttributeValues($field['qid']);
for ($i = 0; $i < $qidattributes['max_num_of_files']; $i++) {
$filenum = sprintf(gT("File %s"), $i + 1);
if ($qidattributes['show_title'] == 1) {
$fnames[] = array($field['fieldname'], "{$filenum} - {$question} (" . gT('Title') . ")", 'code' => viewHelper::getFieldCode($field) . '(title)', "type" => "|", "metadata" => "title", "index" => $i);
}
if ($qidattributes['show_comment'] == 1) {
$fnames[] = array($field['fieldname'], "{$filenum} - {$question} (" . gT('Comment') . ")", 'code' => viewHelper::getFieldCode($field) . '(comment)', "type" => "|", "metadata" => "comment", "index" => $i);
}
$fnames[] = array($field['fieldname'], "{$filenum} - {$question} (" . gT('File name') . ")", 'code' => viewHelper::getFieldCode($field) . '(name)', "type" => "|", "metadata" => "name", "index" => $i);
$fnames[] = array($field['fieldname'], "{$filenum} - {$question} (" . gT('File size') . ")", 'code' => viewHelper::getFieldCode($field) . '(size)', "type" => "|", "metadata" => "size", "index" => $i);
//$fnames[] = array($field['fieldname'], "File ".($i+1)." - ".$field['question']." (extension)", "type"=>"|", "metadata"=>"ext", "index"=>$i);
}
} else {
$fnames[] = array($field['fieldname'], gT("File count"));
}
}
$nfncount = count($fnames) - 1;
if ($iId < 1) {
$iId = 1;
}
$exist = SurveyDynamic::model($iSurveyID)->exist($iId);
$next = SurveyDynamic::model($iSurveyID)->next($iId, true);
$previous = SurveyDynamic::model($iSurveyID)->previous($iId, true);
$aData['exist'] = $exist;
$aData['next'] = $next;
$aData['previous'] = $previous;
$aData['id'] = $iId;
$aViewUrls[] = 'browseidheader_view';
if ($exist) {
$oPurifier = new CHtmlPurifier();
//SHOW INDIVIDUAL RECORD
$oCriteria = new CDbCriteria();
if ($bHaveToken) {
$oCriteria = SurveyDynamic::model($iSurveyID)->addTokenCriteria($oCriteria);
}
$oCriteria->addCondition("id = {$iId}");
$iIdresult = SurveyDynamic::model($iSurveyID)->findAllAsArray($oCriteria);
foreach ($iIdresult as $iIdrow) {
$iId = $iIdrow['id'];
$rlanguage = $iIdrow['startlanguage'];
}
$aData['bHasFile'] = false;
if (isset($rlanguage)) {
$aData['rlanguage'] = $rlanguage;
}
foreach ($iIdresult as $iIdrow) {
$highlight = false;
for ($i = 0; $i < $nfncount + 1; $i++) {
if ($fnames[$i][0] != 'completed' && is_null($iIdrow[$fnames[$i][0]])) {
continue;
//.........这里部分代码省略.........
开发者ID:mfavetti,项目名称:LimeSurvey,代码行数:101,代码来源:responses.php
示例2: displayResults
//.........这里部分代码省略.........
$this->pdf->headTable($headPDF2, $tablePDF2);
}
}
if ($outputType == 'xls' && (isset($headXLS) || isset($tableXLS))) {
if (isset($headXLS)) {
$this->xlsRow++;
$this->xlsRow++;
foreach ($headXLS as $aRow) {
$this->xlsRow++;
$iColumn = 0;
foreach ($aRow as $sValue) {
$this->sheet->write($this->xlsRow, $iColumn, $sValue, $this->formatBold);
$iColumn++;
}
}
}
if (isset($tableXLS)) {
foreach ($tableXLS as $aRow) {
$this->xlsRow++;
$iColumn = 0;
foreach ($aRow as $sValue) {
$this->sheet->write($this->xlsRow, $iColumn, $sValue);
$iColumn++;
}
}
}
}
if ($outputType == 'html') {
$statisticsoutput .= "<tr><td colspan='4' style=\"text-align:center\" id='statzone_{$rt}'>";
}
//-------------------------- PCHART OUTPUT ----------------------------
list($qsid, $qgid, $qqid) = explode("X", $rt, 3);
$qsid = $surveyid;
$aattr = getQuestionAttributeValues($outputs['parentqid'], substr($rt, 0, 1));
//PCHART has to be enabled and we need some data
if ($usegraph == 1) {
$bShowGraph = $aattr["statistics_showgraph"] == "1";
$bAllowPieChart = $outputs['qtype'] != "M" && $outputs['qtype'] != "P";
$bAllowMap = isset($aattr["location_mapservice"]) && $aattr["location_mapservice"] == "1";
$bShowMap = $bAllowMap && $aattr["statistics_showmap"] == "1";
$bShowPieChart = $bAllowPieChart && (isset($aattr["statistics_graphtype"]) && $aattr["statistics_graphtype"] == "1");
$astatdata[$rt] = array('id' => $rt, 'sg' => $bShowGraph, 'ap' => $bAllowPieChart, 'am' => $bAllowMap, 'sm' => $bShowMap, 'sp' => $bShowPieChart);
$stats = Yii::app()->session['stats'];
$stats[$rt] = array('lbl' => $lbl, 'gdata' => $gdata, 'grawdata' => $grawdata);
Yii::app()->session['stats'] = $stats;
if ($bShowGraph == true) {
$cachefilename = createChart($qqid, $qsid, $bShowPieChart, $lbl, $gdata, $grawdata, $MyCache, $sLanguage, $outputs['qtype']);
if ($cachefilename) {
//introduce new counter
if (!isset($ci)) {
$ci = 0;
}
//increase counter, start value -> 1
$ci++;
switch ($outputType) {
case 'xls':
/**
* No Image for Excel...
*/
break;
case 'pdf':
$this->pdf->AddPage('P', 'A4');
$this->pdf->titleintopdf($pdfTitle, $titleDesc);
$this->pdf->Image($tempdir . "/" . $cachefilename, 0, 70, 180, 0, '', Yii::app()->getController()->createUrl("admin/survey/sa/view/surveyid/" . $surveyid), 'B', true, 150, 'C', false, false, 0, true);
break;
case 'html':
开发者ID:jgianpiere,项目名称:lime-survey,代码行数:67,代码来源:statistics_helper.php
示例3: do_array_dual
function do_array_dual($ia)
{
global $thissurvey;
$aLastMoveResult = LimeExpressionManager::GetLastMoveResult();
$aMandatoryViolationSubQ = $aLastMoveResult['mandViolation'] && $ia[6] == 'Y' ? explode("|", $aLastMoveResult['unansweredSQs']) : array();
$repeatheadings = Yii::app()->getConfig("repeatheadings");
$minrepeatheadings = Yii::app()->getConfig("minrepeatheadings");
$extraclass = "";
$answertypeclass = "";
// Maybe not
$caption = "";
// Just leave empty, are replaced after
$inputnames = array();
$labelans1 = array();
$labelans = array();
$aQuestionAttributes = getQuestionAttributeValues($ia[0]);
if ($aQuestionAttributes['random_order'] == 1) {
$ansquery = "SELECT * FROM {{questions}} WHERE parent_qid={$ia['0']} AND language='" . $_SESSION['survey_' . Yii::app()->getConfig('surveyID')]['s_lang'] . "' and scale_id=0 ORDER BY " . dbRandom();
} else {
$ansquery = "SELECT * FROM {{questions}} WHERE parent_qid={$ia['0']} AND language='" . $_SESSION['survey_' . Yii::app()->getConfig('surveyID')]['s_lang'] . "' and scale_id=0 ORDER BY question_order";
}
$ansresult = dbExecuteAssoc($ansquery);
//Checked
$aSubQuestions = $ansresult->readAll();
$anscount = count($aSubQuestions);
$lquery = "SELECT * FROM {{answers}} WHERE scale_id=0 AND qid={$ia[0]} AND language='" . $_SESSION['survey_' . Yii::app()->getConfig('surveyID')]['s_lang'] . "' ORDER BY sortorder, code";
$lresult = dbExecuteAssoc($lquery);
//Checked
$aAnswersScale0 = $lresult->readAll();
$lquery1 = "SELECT * FROM {{answers}} WHERE scale_id=1 AND qid={$ia[0]} AND language='" . $_SESSION['survey_' . Yii::app()->getConfig('surveyID')]['s_lang'] . "' ORDER BY sortorder, code";
$lresult1 = dbExecuteAssoc($lquery1);
//Checked
$aAnswersScale1 = $lresult1->readAll();
if ($aQuestionAttributes['use_dropdown'] == 1) {
$useDropdownLayout = true;
$extraclass .= " dropdown-list";
$answertypeclass .= " dropdown";
$doDualScaleFunction = "doDualScaleDropDown";
// javascript funtion to lauch at end of answers
$caption = gT("An array with sub-question on each line, with 2 answers to provide on each line. You have to select the answer.");
} else {
$useDropdownLayout = false;
$extraclass .= " radio-list";
$answertypeclass .= " radio";
$doDualScaleFunction = "doDualScaleRadio";
$caption = gT("An array with sub-question on each line, with 2 answers to provide on each line. The answers are contained in the table header. ");
}
if (ctype_digit(trim($aQuestionAttributes['repeat_headings'])) && trim($aQuestionAttributes['repeat_headings'] != "")) {
$repeatheadings = intval($aQuestionAttributes['repeat_headings']);
$minrepeatheadings = 0;
}
if (trim($aQuestionAttributes['dualscale_headerA'][$_SESSION['survey_' . Yii::app()->getConfig('surveyID')]['s_lang']]) != '') {
$leftheader = $aQuestionAttributes['dualscale_headerA'][$_SESSION['survey_' . Yii::app()->getConfig('surveyID')]['s_lang']];
} else {
$leftheader = '';
}
if (trim($aQuestionAttributes['dualscale_headerB'][$_SESSION['survey_' . Yii::app()->getConfig('surveyID')]['s_lang']]) != '') {
$rightheader = $aQuestionAttributes['dualscale_headerB'][$_SESSION['survey_' . Yii::app()->getConfig('surveyID')]['s_lang']];
} else {
$rightheader = '';
}
if (trim($aQuestionAttributes['answer_width']) != '') {
$answerwidth = $aQuestionAttributes['answer_width'];
} else {
$answerwidth = 20;
}
// Find if we have rigth and center text
// TODO move "|" to attribute
$sQuery = "SELECT count(question) FROM {{questions}} WHERE parent_qid=" . $ia[0] . " and scale_id=0 AND question like '%|%'";
$rigthCount = Yii::app()->db->createCommand($sQuery)->queryScalar();
$rightexists = $rigthCount > 0;
// $right_exists: flag to find out if there are any right hand answer parts. leaving right column but don't force with
$sQuery = "SELECT count(question) FROM {{questions}} WHERE parent_qid=" . $ia[0] . " and scale_id=0 AND question like '%|%|%'";
$centerCount = Yii::app()->db->createCommand($sQuery)->queryScalar();
$centerexists = $centerCount > 0;
// $center_exists: flag to find out if there are any center hand answer parts. leaving center column but don't force with
// Label and code for input
foreach ($aAnswersScale0 as $lrow) {
$labels0[] = array('code' => $lrow['code'], 'title' => $lrow['answer']);
}
foreach ($aAnswersScale1 as $lrow) {
$labels1[] = array('code' => $lrow['code'], 'title' => $lrow['answer']);
}
if (count($aAnswersScale0) > 0 && $anscount) {
$answer = "";
$fn = 1;
// Used by repeat_heading
if ($useDropdownLayout === false) {
$columnswidth = 100 - $answerwidth;
foreach ($aAnswersScale0 as $lrow) {
$labelans0[] = $lrow['answer'];
$labelcode0[] = $lrow['code'];
}
foreach ($aAnswersScale1 as $lrow) {
$labelans1[] = $lrow['answer'];
$labelcode1[] = $lrow['code'];
}
$numrows = count($labelans0) + count($labelans1);
// Add needed row and fill some boolean: shownoanswer, rightexists, centerexists
$shownoanswer = $ia[6] != "Y" && SHOW_NO_ANSWER == 1;
//.........这里部分代码省略.........
开发者ID:segfault,项目名称:LimeSurvey,代码行数:101,代码来源:qanda_helper.php
示例4: getFullResponseTable
/**
* Creates an array with details on a particular response for display purposes
* Used in Print answers, Detailed response view and Detailed admin notification email
*
* @param mixed $iSurveyID
* @param mixed $iResponseID
* @param mixed $sLanguageCode
* @param boolean $bHonorConditions Apply conditions
*/
function getFullResponseTable($iSurveyID, $iResponseID, $sLanguageCode, $bHonorConditions = true)
{
$aFieldMap = createFieldMap($iSurveyID, 'full', false, false, $sLanguageCode);
//Get response data
$idrow = SurveyDynamic::model($iSurveyID)->findByAttributes(array('id' => $iResponseID));
// Create array of non-null values - those are the relevant ones
$aRelevantFields = array();
foreach ($aFieldMap as $sKey => $fname) {
if (LimeExpressionManager::QuestionIsRelevant($fname['qid']) || $bHonorConditions == false) {
$aRelevantFields[$sKey] = $fname;
}
}
$aResultTable = array();
$oldgid = 0;
$oldqid = 0;
foreach ($aRelevantFields as $sKey => $fname) {
if (!empty($fname['qid'])) {
$attributes = getQuestionAttributeValues($fname['qid']);
if (getQuestionAttributeValue($attributes, 'hidden') == 1) {
continue;
}
}
$question = $fname['question'];
$subquestion = '';
if (isset($fname['gid']) && !empty($fname['gid'])) {
//Check to see if gid is the same as before. if not show group name
if ($oldgid !== $fname['gid']) {
$oldgid = $fname['gid'];
if (LimeExpressionManager::GroupIsRelevant($fname['gid']) || $bHonorConditions == false) {
$aResultTable['gid_' . $fname['gid']] = array($fname['group_name'], QuestionGroup::model()->getGroupDescription($fname['gid'], $sLanguageCode));
}
}
}
if (!empty($fname['qid'])) {
if ($oldqid !== $fname['qid']) {
$oldqid = $fname['qid'];
if (isset($fname['subquestion']) || isset($fname['subquestion1']) || isset($fname['subquestion2'])) {
$aResultTable['qid_' . $fname['sid'] . 'X' . $fname['gid'] . 'X' . $fname['qid']] = array($fname['question'], '', '');
} else {
$answer = getExtendedAnswer($iSurveyID, $fname['fieldname'], $idrow[$fname['fieldname']], $sLanguageCode);
$aResultTable[$fname['fieldname']] = array($question, '', $answer);
continue;
}
}
} else {
$answer = getExtendedAnswer($iSurveyID, $fname['fieldname'], $idrow[$fname['fieldname']], $sLanguageCode);
$aResultTable[$fname['fieldname']] = array($question, '', $answer);
continue;
}
if (isset($fname['subquestion'])) {
$subquestion = "[{$fname['subquestion']}]";
}
if (isset($fname['subquestion1'])) {
$subquestion = "[{$fname['subquestion1']}]";
}
if (isset($fname['subquestion2'])) {
$subquestion .= "[{$fname['subquestion2']}]";
}
$answer = getExtendedAnswer($iSurveyID, $fname['fieldname'], $idrow[$fname['fieldname']], $sLanguageCode);
$aResultTable[$fname['fieldname']] = array($question, $subquestion, $answer);
}
return $aResultTable;
}
开发者ID:GuillaumeSmaha,项目名称:LimeSurvey,代码行数:72,代码来源:common_helper.php
示例5: doAssessment
/**
* Caculate assessement scores
*
* @param mixed $surveyid
* @param mixed $returndataonly - only returns an array with data
*/
function doAssessment($surveyid, $returndataonly = false)
{
$clang = Yii::app()->lang;
$baselang = Survey::model()->findByPk($surveyid)->language;
if (Survey::model()->findByPk($surveyid)->assessments != "Y") {
return false;
}
$total = 0;
if (!isset($_SESSION['survey_' . $surveyid]['s_lang'])) {
$_SESSION['survey_' . $surveyid]['s_lang'] = $baselang;
}
$query = "SELECT * FROM {{assessments}}\n WHERE sid={$surveyid} and language='" . $_SESSION['survey_' . $surveyid]['s_lang'] . "'\n ORDER BY scope, id";
if ($result = dbExecuteAssoc($query)) {
$aResultSet = $result->readAll();
if (count($aResultSet) > 0) {
foreach ($aResultSet as $row) {
if ($row['scope'] == "G") {
$assessment['group'][$row['gid']][] = array("name" => $row['name'], "min" => $row['minimum'], "max" => $row['maximum'], "message" => $row['message']);
} else {
$assessment['total'][] = array("name" => $row['name'], "min" => $row['minimum'], "max" => $row['maximum'], "message" => $row['message']);
}
}
$fieldmap = createFieldMap($surveyid, "full", false, false, $_SESSION['survey_' . $surveyid]['s_lang']);
$i = 0;
$total = 0;
$groups = array();
foreach ($fieldmap as $field) {
if (in_array($field['type'], array('1', 'F', 'H', 'W', 'Z', 'L', '!', 'M', 'O', 'P'))) {
$fieldmap[$field['fieldname']]['assessment_value'] = 0;
if (isset($_SESSION['survey_' . $surveyid][$field['fieldname']])) {
if ($field['type'] == "M" || $field['type'] == "P") {
if ($_SESSION['survey_' . $surveyid][$field['fieldname']] == "Y") {
$aAttributes = getQuestionAttributeValues($field['qid'], $field['type']);
$fieldmap[$field['fieldname']]['assessment_value'] = (int) $aAttributes['assessment_value'];
$total = $total + (int) $aAttributes['assessment_value'];
}
} else {
$usquery = "SELECT assessment_value FROM {{answers}} where qid=" . $field['qid'] . " and language='{$baselang}' and code=" . dbQuoteAll($_SESSION['survey_' . $surveyid][$field['fieldname']]);
$usresult = dbExecuteAssoc($usquery);
//Checked
if ($usresult) {
$usrow = $usresult->read();
$fieldmap[$field['fieldname']]['assessment_value'] = $usrow['assessment_value'];
$total = $total + $usrow['assessment_value'];
}
}
}
$groups[] = $field['gid'];
}
$i++;
}
$groups = array_unique($groups);
foreach ($groups as $group) {
$grouptotal = 0;
foreach ($fieldmap as $field) {
if ($field['gid'] == $group && isset($field['assessment_value'])) {
//$grouptotal=$grouptotal+$field['answer'];
if (isset($_SESSION['survey_' . $surveyid][$field['fieldname']])) {
$grouptotal = $grouptotal + $field['assessment_value'];
}
}
}
$subtotal[$group] = $grouptotal;
}
}
$assessments = "";
if (isset($subtotal) && is_array($subtotal)) {
foreach ($subtotal as $key => $val) {
if (isset($assessment['group'][$key])) {
foreach ($assessment['group'][$key] as $assessed) {
if ($val >= $assessed['min'] && $val <= $assessed['max'] && $returndataonly === false) {
$assessments .= "\t<!-- GROUP ASSESSMENT: Score: {$val} Min: " . $assessed['min'] . " Max: " . $assessed['max'] . "-->\n <table class='assessments'>\n <tr>\n <th>" . str_replace(array("{PERC}", "{TOTAL}"), array($val, $total), $assessed['name']) . "\n </th>\n </tr>\n <tr>\n <td>" . str_replace(array("{PERC}", "{TOTAL}"), array($val, $total), $assessed['message']) . "\n </td>\n </tr>\n </table><br />\n";
}
}
}
}
}
if (isset($assessment['total'])) {
foreach ($assessment['total'] as $assessed) {
if ($total >= $assessed['min'] && $total <= $assessed['max'] && $returndataonly === false) {
$assessments .= "\t\t\t<!-- TOTAL ASSESSMENT: Score: {$total} Min: " . $assessed['min'] . " Max: " . $assessed['max'] . "-->\n <table class='assessments' align='center'>\n <tr>\n <th>" . str_replace(array("{PERC}", "{TOTAL}"), array($val, $total), stripslashes($assessed['name'])) . "\n </th>\n </tr>\n <tr>\n <td>" . str_replace(array("{PERC}", "{TOTAL}"), array($val, $total), stripslashes($assessed['message'])) . "\n </td>\n </tr>\n </table>\n";
}
}
}
if ($returndataonly == true) {
return array('total' => $total);
} else {
return $assessments;
}
}
}
开发者ID:elcharlygraf,项目名称:Encuesta-YiiFramework,代码行数:97,代码来源:frontend_helper.php
示例6: graph
function graph()
{
Yii::app()->loadHelper('admin/statistics');
Yii::app()->loadHelper("surveytranslator");
// Initialise PCHART
require_once Yii::app()->basePath . '/third_party/pchart/pchart/pChart.class';
require_once Yii::app()->basePath . '/third_party/pchart/pchart/pData.class';
require_once Yii::app()->basePath . '/third_party/pchart/pchart/pCache.class';
Yii::import('application.third_party.ar-php.Arabic', true);
$tempdir = Yii::app()->getConfig("tempdir");
$MyCache = new pCache($tempdir . '/');
$aData['success'] = 1;
$sStatisticsLanguage = sanitize_languagecode($_POST['sStatisticsLanguage']);
$oStatisticsLanguage = new Limesurvey_lang($sStatisticsLanguage);
if (isset($_POST['cmd']) && isset($_POST['id'])) {
list($qsid, $qgid, $qqid) = explode("X", substr($_POST['id'], 0), 3);
if (!is_numeric(substr($qsid, 0, 1))) {
// Strip first char when not numeric (probably T or D)
$qsid = substr($qsid, 1);
}
$aFieldmap = createFieldMap($qsid, 'full', false, false, $sStatisticsLanguage);
$qtype = $aFieldmap[$_POST['id']]['type'];
$qqid = $aFieldmap[$_POST['id']]['qid'];
$aattr = getQuestionAttributeValues($qqid);
$field = substr($_POST['id'], 1);
switch ($_POST['cmd']) {
case 'showmap':
if (isset($aattr['location_mapservice'])) {
$aData['mapdata'] = array("coord" => getQuestionMapData($field, $qsid), "zoom" => $aattr['location_mapzoom'], "width" => $aattr['location_mapwidth'], "height" => $aattr['location_mapheight']);
QuestionAttribute::model()->setQuestionAttribute($qqid, 'statistics_showmap', 1);
} else {
$aData['success'] = 0;
}
break;
case 'hidemap':
if (isset($aattr['location_mapservice'])) {
$aData['success'] = 1;
QuestionAttribute::model()->setQuestionAttribute($qqid, 'statistics_showmap', 0);
} else {
$aData['success'] = 0;
}
break;
case 'showgraph':
if (isset($aattr['location_mapservice'])) {
$aData['mapdata'] = array("coord" => getQuestionMapData($field, $qsid), "zoom" => $aattr['location_mapzoom'], "width" => $aattr['location_mapwidth'], "height" => $aattr['location_mapheight']);
}
$bChartType = $qtype != "M" && $qtype != "P" && $aattr["statistics_graphtype"] == "1";
$adata = Yii::app()->session['stats'][$_POST['id']];
$aData['chartdata'] = createChart($qqid, $qsid, $bChartType, $adata['lbl'], $adata['gdata'], $adata['grawdata'], $MyCache, $oStatisticsLanguage, $qtype);
QuestionAttribute::model()->setQuestionAttribute($qqid, 'statistics_showgraph', 1);
break;
case 'hidegraph':
QuestionAttribute::model()->setQuestionAttribute($qqid, 'statistics_showgraph', 0);
break;
case 'showbar':
if ($qtype == "M" || $qtype == "P") {
$aData['success'] = 0;
break;
}
QuestionAttribute::model()->setQuestionAttribute($qqid, 'statistics_graphtype', 0);
$adata = Yii::app()->session['stats'][$_POST['id']];
$aData['chartdata'] = createChart($qqid, $qsid, 0, $adata['lbl'], $adata['gdata'], $adata['grawdata'], $MyCache, $oStatisticsLanguage, $qtype);
break;
case 'showpie':
if ($qtype == "M" || $qtype == "P") {
$aData['success'] = 0;
break;
}
QuestionAttribute::model()->setQuestionAttribute($qqid, 'statistics_graphtype', 1);
$adata = Yii::app()->session['stats'][$_POST['id']];
$aData['chartdata'] = createChart($qqid, $qsid, 1, $adata['lbl'], $adata['gdata'], $adata['grawdata'], $MyCache, $oStatisticsLanguage, $qtype);
break;
default:
$aData['success'] = 0;
break;
}
} else {
$aData['success'] = 0;
}
//$this->_renderWrappedTemplate('export', 'statistics_graph_view', $aData);
$this->getController()->renderPartial('export/statistics_graph_view', $aData);
}
开发者ID:josetorerobueno,项目名称:test_repo,代码行数:82,代码来源:statistics.php
示例7: displayResults
//.........这里部分代码省略.........
$this->pdf->headTable($headPDF, $tablePDF);
//$this->pdf->tableintopdf($tablePDF);
// if(isset($footPDF))
// foreach($footPDF as $foot)
// {
// $footA = array($foot);
// $this->pdf->tablehead($footA);
// }
if (isset($headPDF2)) {
$this->pdf->headTable($headPDF2, $tablePDF2);
}
}
if ($outputType == 'xls' && (isset($headXLS) || isset($tableXLS))) {
if (isset($headXLS)) {
$this->xlsRow++;
$this->xlsRow++;
foreach ($headXLS as $aRow) {
$this->xlsRow++;
$iColumn = 0;
foreach ($aRow as $sValue) {
$this->sheet->write($this->xlsRow, $iColumn, $sValue, $this->formatBold);
$iColumn++;
}
}
}
if (isset($tableXLS)) {
foreach ($tableXLS as $aRow) {
$this->xlsRow++;
$iColumn = 0;
foreach ($aRow as $sValue) {
$this->sheet->write($this->xlsRow, $iColumn, $sValue);
$iColumn++;
}
}
}
}
if ($outputType == 'html') {
$statisticsoutput .= "<tr><td colspan='4' style=\"text-align:center\" id='statzone_{$rt}'>";
}
//-------------------------- PCHART OUTPUT ----------------------------
list($qsid, $qgid, $qqid) = explode("X", $rt, 3);
$qsid = $surveyid;
$aattr = getQuestionAttributeValues($outputs['parentqid'], substr($rt, 0, 1));
//PCHART has to be enabled and we need some data
if ($usegraph == 1) {
$bShowGraph = $aattr["statistics_showgraph"] == "1";
$bAllowPieChart = $outputs['qtype'] != "M" && $outputs['qtype'] != "P";
$bAllowMap = isset($aattr["location_mapservice"]) && $aattr["location_mapservice"] == "1";
$bShowMap = $bAllowMap && $aattr["statistics_showmap"] == "1";
$bShowPieChart = $bAllowPieChart && (isset($aattr["statistics_graphtype"]) && $aattr["statistics_graphtype"] == "1");
$astatdata[$rt] = array('id' => $rt, 'sg' => $bShowGraph, 'ap' => $bAllowPieChart, 'am' => $bAllowMap, 'sm' => $bShowMap, 'sp' => $bShowPieChart);
$stats = Yii::app()->session['stats'];
$stats[$rt] = array('lbl' => $lbl, 'gdata' => $gdata, 'grawdata' => $grawdata);
Yii::app()->session['stats'] = $stats;
if ($bShowGraph == true) {
$cachefilename = createChart($qqid, $qsid, $bShowPieChart, $lbl, $gdata, $grawdata, $MyCache, $sLanguage, $outputs['qtype']);
if ($cachefilename) {
//introduce new counter
if (!isset($ci)) {
$ci = 0;
}
//increase counter, start value -> 1
$ci++;
switch ($outputType) {
case 'xls':
/**
* No Image for Excel...
*/
break;
case 'pdf':
$this->pdf->AddPage('P', 'A4');
$this->pdf->titleintopdf($pdfTitle, $titleDesc);
$this->pdf->Image($tempdir . "/" . $cachefilename, 0, 70, 180, 0, '', Yii::app()->getController()->createUrl("admin/survey/sa/view/surveyid/" . $surveyid), 'B', true, 150, 'C', false, false, 0, true);
break;
case 'html':
$statisticsoutput .= "<img src=\"{$tempurl}/" . $cachefilename . "\" border='1' />";
$aattr = getQuestionAttributeValues($qqid, $firstletter);
if ($bShowMap) {
$statisticsoutput .= "<div id=\"statisticsmap_{$rt}\" class=\"statisticsmap\"></div>";
$agmapdata[$rt] = array("coord" => getQuestionMapData(substr($rt, 1), $qsid), "zoom" => $aattr['location_mapzoom'], "width" => $aattr['location_mapwidth'], "height" => $aattr['location_mapheight']);
}
break;
default:
break;
}
}
}
}
//close table/output
if ($outputType == 'html') {
// show this block only when we show graphs and are not in the public statics controller
// this is because the links don't work from that controller
if ($usegraph == 1 && get_class(Yii::app()->getController()) !== 'Statistics_userController') {
$sImgUrl = Yii::app()->getConfig('adminimageurl');
$statisticsoutput .= "</td></tr><tr><td colspan='4'><div id='stats_{$rt}' class='graphdisplay' style=\"text-align:center\">" . "<img class='stats-hidegraph' src='{$sImgUrl}/chart_disabled.png' title='" . gT("Disable chart") . "' />" . "<img class='stats-showgraph' src='{$sImgUrl}/chart.png' title='" . gT("Enable chart") . "' />" . "<img class='stats-showbar' src='{$sImgUrl}/chart_bar.png' title='" . gT("Display as bar chart") . "' />" . "<img class='stats-showpie' src='{$sImgUrl}/chart_pie.png' title='" . gT("Display as pie chart") . "' />" . "<img class='stats-showmap' src='{$sImgUrl}/map_disabled.png' title='" . gT("Disable map display") . "' />" . "<img class='stats-hidemap' src='{$sImgUrl}/map.png' title='" . gT("Enable map display") . "' />" . "</div></td></tr>";
}
$statisticsoutput .= "</td></tr></table><br /> \n";
}
return array("statisticsoutput" => $statisticsoutput, "pdf" => $this->pdf, "astatdata" => $astatdata);
}
开发者ID:krsandesh,项目名称:LimeSurvey,代码行数:101,代码来源:statistics_helper.php
示例8: run
//.........这里部分代码省略.........
$thissurvey['anonymized'] == "N" &&
isset($_SESSION[$LEMsessid]['srid']) &&
$thissurvey['active'] == "Y")
{
loadanswers();
}
*/
//******************************************************************************************************
//PRESENT SURVEY
//******************************************************************************************************
$okToShowErrors = !$previewgrp && (isset($invalidLastPage) || $_SESSION[$LEMsessid]['prevstep'] == $_SESSION[$LEMsessid]['step']);
Yii::app()->getController()->loadHelper('qanda');
setNoAnswerMode($thissurvey);
//Iterate through the questions about to be displayed:
$inputnames = array();
foreach ($_SESSION[$LEMsessid]['grouplist'] as $gl) {
$gid = $gl[0];
$qnumber = 0;
if ($surveyMode != 'survey') {
$onlyThisGID = $stepInfo['gid'];
if ($onlyThisGID != $gid) {
continue;
}
}
// TMSW - could iterate through LEM::currentQset instead
foreach ($_SESSION[$LEMsessid]['fieldarray'] as $key => $ia) {
++$qnumber;
$ia[9] = $qnumber;
// incremental question count;
if (isset($ia[10]) && $ia[10] == $gid || !isset($ia[10]) && $ia[5] == $gid) {
if ($surveyMode == 'question' && $ia[0] != $stepInfo['qid']) {
continue;
}
$qidattributes = getQuestionAttributeValues($ia[0], $ia[4]);
if ($ia[4] != '*' && ($qidattributes === false || !isset($qidattributes['hidden']) || $qidattributes['hidden'] == 1)) {
continue;
}
//Get the answers/inputnames
// TMSW - can content of retrieveAnswers() be provided by LEM? Review scope of what it provides.
// TODO - retrieveAnswers is slow - queries database separately for each question. May be fixed in _CI or _YII ports, so ignore for now
list($plus_qanda, $plus_inputnames) = retrieveAnswers($ia, $surveyid);
if ($plus_qanda) {
$plus_qanda[] = $ia[4];
$plus_qanda[] = $ia[6];
// adds madatory identifyer for adding mandatory class to question wrapping div
$qanda[] = $plus_qanda;
}
if ($plus_inputnames) {
$inputnames = addtoarray_single($inputnames, $plus_inputnames);
}
//Display the "mandatory" popup if necessary
// TMSW - get question-level error messages - don't call **_popup() directly
if ($okToShowErrors && $stepInfo['mandViolation']) {
list($mandatorypopup, $popup) = mandatory_popup($ia, $notanswered);
}
//Display the "validation" popup if necessary
if ($okToShowErrors && !$stepInfo['valid']) {
list($validationpopup, $vpopup) = validation_popup($ia, $notvalidated);
}
// Display the "file validation" popup if necessary
if ($okToShowErrors && isset($filenotvalidated)) {
list($filevalidationpopup, $fpopup) = file_validation_popup($ia, $filenotvalidated);
}
}
if ($ia[4] == "|") {
$upload_file = TRUE;
开发者ID:ryu1inaba,项目名称:LimeSurvey,代码行数:67,代码来源:SurveyRuntimeHelper.php
示例9: view
/**
* dataentry::view()
* view a dataentry
* @param mixed $surveyid
* @param mixed $lang
* @return
*/
public function view($surveyid, $lang = NULL)
{
$surveyid = sanitize_int($surveyid);
$lang = isset($_GET['lang']) ? $_GET['lang'] : NULL;
if (isset($lang)) {
$lang = sanitize_languagecode($lang);
}
$aViewUrls = array();
if (Permission::model()->hasSurveyPermission($surveyid, 'responses', 'create')) {
$sDataEntryLanguage = Survey::model()->findByPk($surveyid)->language;
$surveyinfo = getSurveyInfo($surveyid);
$slangs = Survey::model()->findByPk($surveyid)->additionalLanguages;
$baselang = Survey::model()->findByPk($surveyid)->language;
array_unshift($slangs, $baselang);
if (is_null($lang) || !in_array($lang, $slangs)) {
$sDataEntryLanguage = $baselang;
} else {
$sDataEntryLanguage = $lang;
}
$langlistbox = languageDropdown($surveyid, $sDataEntryLanguage);
$thissurvey = getSurveyInfo($surveyid);
//This is the default, presenting a blank dataentry form
LimeExpressionManager::StartSurvey($surveyid, 'survey', NULL, false, LEM_PRETTY_PRINT_ALL_SYNTAX);
$moveResult = LimeExpressionManager::NavigateForwards();
$aData['thissurvey'] = $thissurvey;
$aData['langlistbox'] = $langlistbox;
$aData['surveyid'] = $surveyid;
$aData['sDataEntryLanguage'] = $sDataEntryLanguage;
$aData['site_url'] = Yii::app()->homeUrl;
LimeExpressionManager::StartProcessingPage(true, Yii::app()->baseUrl);
// means that all variables are on the same page
$aViewUrls[] = 'caption_view';
Yii::app()->loadHelper('database');
// SURVEY NAME AND DESCRIPTION TO GO HERE
$degquery = "SELECT * FROM {{groups}} WHERE sid={$surveyid} AND language='{$sDataEntryLanguage}' ORDER BY {{groups}}.group_order";
$degresult = dbExecuteAssoc($degquery);
// GROUP NAME
$aDataentryoutput = '';
foreach ($degresult->readAll() as $degrow) {
LimeExpressionManager::StartProcessingGroup($degrow['gid'], $thissurvey['anonymized'] != "N", $surveyid);
$deqquery = "SELECT * FROM {{questions}} WHERE sid={$surveyid} AND parent_qid=0 AND gid={$degrow['gid']} AND language='{$sDataEntryLanguage}'";
$deqrows = (array) dbExecuteAssoc($deqquery)->readAll();
$aDataentryoutput .= "\t<tr class='info'>\n" . "<!-- Inside controller dataentry.php -->" . "<td colspan='3'><h4>" . flattenText($degrow['group_name'], true) . "</h4></td>\n" . "\t</tr>\n";
$gid = $degrow['gid'];
$aDataentryoutput .= "\t<tr class='data-entry-separator'><td colspan='3'></td></tr>\n";
// Perform a case insensitive natural sort on group name then question title of a multidimensional array
usort($deqrows, 'groupOrderThenQuestionOrder');
$bgc = 'odd';
foreach ($deqrows as $deqrow) {
$cdata = array();
$qidattributes = getQuestionAttributeValues($deqrow['qid']);
$cdata['qidattributes'] = $qidattributes;
$hidden = isset($qidattributes['hidden']) ? $qidattributes['hidden'] : 0;
// TODO - can questions be hidden? Are JavaScript variables names used? Consistently with everywhere else?
// LimeExpressionManager::ProcessRelevance($qidattributes['relevance'],$deqrow['qid'],NULL,$deqrow['type'],$hidden);
// TMSW Condition->Relevance: Show relevance equation instead of conditions here - better yet, have data entry use survey-at-a-time but with different view
$qinfo = LimeExpressionManager::GetQuestionStatus($deqrow['qid']);
$relevance = trim($qinfo['info']['relevance']);
$explanation = trim($qinfo['relEqn']);
$validation = trim($qinfo['prettyValidTip']);
$qidattributes = getQuestionAttributeValues($deqrow['qid']);
$array_filter_help = flattenText($this->_array_filter_help($qidattributes, $sDataEntryLanguage, $surveyid));
if ($relevance != '' && $relevance != '1' || $validation != '' || $array_filter_help != '') {
$showme = '<div class="alert alert-warning col-sm-8 col-sm-offset-2" role="alert">';
if ($bgc == "even") {
$bgc = "odd";
} else {
$bgc = "even";
}
//Do no alternate on explanation row
if ($relevance != '' && $relevance != '1') {
$showme = '<strong>' . gT("Only answer this if the following conditions are met:", 'html', $sDataEntryLanguage) . "</strong><br />{$explanation}\n";
}
if ($validation != '') {
$showme .= '<strong>' . gT("The answer(s) must meet these validation criteria:", 'html', $sDataEntryLanguage) . "</strong><br />{$validation}\n";
}
if ($showme != '' && $array_filter_help != '') {
$showme .= '<br/>';
}
if ($array_filter_help != '') {
$showme .= '<strong>' . gT("The answer(s) must meet these array_filter criteria:", 'html', $sDataEntryLanguage) . "</strong><br />{$array_filter_help}\n";
}
$showme .= '</div>';
$cdata['explanation'] = "<tr class ='data-entry-explanation'><td class='data-entry-small-text' colspan='3' align='left'>{$showme}</td></tr>\n";
}
//END OF GETTING CONDITIONS
//Alternate bgcolor for different groups
if (!isset($bgc)) {
$bgc = "even";
}
if ($bgc == "even") {
$bgc = "odd";
} else {
//.........这里部分代码省略.........
开发者ID:mfavetti,项目名称:LimeSurvey,代码行数:101,代码来源:dataentry.php
示例10: do_array_dual
function do_array_dual($ia)
{
global $thissurvey;
global $notanswered;
$repeatheadings = Yii::app()->getConfig("repeatheadings");
$minrepeatheadings = Yii::app()->getConfig("minrepeatheadings");
$extraclass = "";
$answertypeclass = "";
// Maybe not
$clang = Yii::app()->lang;
$checkconditionFunction = "checkconditions";
$inputnames = array();
$labelans1 = array();
$labelans = array();
$qquery = "SELECT other FROM {{questions}} WHERE qid=" . $ia[0] . " AND language='" . $_SESSION['survey_' . Yii::app()->getConfig('surveyID')]['s_lang'] . "'";
$other = dbExecuteAssoc($qquery)->read();
$other = reset($other);
//Checked
$lquery = "SELECT * FROM {{answers}} WHERE scale_id=0 AND qid={$ia[0]} AND language='" . $_SESSION['survey_' . Yii::app()->getConfig('surveyID')]['s_lang'] . "' ORDER BY sortorder, code";
$lquery1 = "SELECT * FROM {{answers}} WHERE scale_id=1 AND qid={$ia[0]} AND language='" . $_SESSION['survey_' . Yii::app()->getConfig('surveyID')]['s_lang'] . "' ORDER BY sortorder, code";
$aQuestionAttributes = getQuestionAttributeValues($ia[0], $ia[4]);
if ($aQuestionAttributes['use_dropdown'] == 1) {
$useDropdownLayout = true;
$extraclass .= " dropdown-list";
$answertypeclass .= " dropdown";
} else {
$useDropdownLayout = false;
$extraclass .= " radio-list";
$answertypeclass .= " radio";
}
if (ctype_digit(trim($aQuestionAttributes['repeat_headings'])) && trim($aQuestionAttributes['repeat_headings'] != "")) {
$repeatheadings = intval($aQuestionAttributes['repeat_headings']);
$minrepeatheadings = 0;
}
if (trim($aQuestionAttributes['dualscale_headerA'][$_SESSION['survey_' . Yii::app()->getConfig('surveyID')]['s_
|
请发表评论