8 Fakoli::usingFile(
"/cms/components/questionnaire/abstract_questionnaire_manager.inc");
26 function AbstractQuestionnaireResultsManager($item)
34 abstract function getComponentName();
39 abstract function getQuestionClass();
47 abstract function getXrefClass();
54 abstract function Responses();
67 abstract function getResponseManager(
$response);
69 abstract function getResponseClass();
76 abstract function getRespondentColumnHeading();
82 function getRespondentColumnFormat()
91 function addRespondentAdditionalColumns(
$table)
100 abstract function getRecipientCount();
107 function getAnswers()
109 return $this->item->Answers();
112 function getQuestionNamesHandler()
114 return "question_names_dialog";
117 function getResponseViewDialog()
119 return "response_view";
134 $respondent =
$mgr->getRespondent();
137 return $response->format(
"<a href='#' onclick=\"questionnaireMgr.showResponse('{$pk}', {{$pk}}); return false\">$respondent</a>");
145 function getResponseViewTitle()
147 return $this->item->prettifyClassName() .
" Response";
164 function getResponseCount()
166 return count($this->Responses());
173 function getProgressBar()
176 $total = $this->getRecipientCount();
179 $responseCount = $this->getResponseCount();
180 $percentage = round($responseCount / $total * 100, 0);
182 if(!$responseCount) $responseCount = 0;
184 $html .= $percentage .
"%";
185 $html .=
" <span style='font-size: 8pt'>($responseCount of $total)</span>";
186 $html .=
"<div class='progress_bar'>\n";
187 $html .=
"<div class='progress' style='width: $percentage%'>\n";
188 $html .=
"</div></div>\n";
192 function drawEditQuestionNamesButton()
194 $pk = $this->item->getPrimaryKey();
195 echo $this->item->format(
"<p><a class='button' href='#' onclick=\"questionnaireMgr.showQuestionNamesDialog({{$pk}});
196 return false;\">Edit Column Headings</a></p>\n");
202 function buildQuestionNamesForm()
206 $handler = $this->getQuestionNamesHandler();
207 $pk = $item->getPrimaryKey();
209 $item->filter =
new InclusionFilter();
210 $form =
new AutoForm($item,
"POST",
"/action/{$component}/{$handler}?$pk={$item->$pk}",
"QuestionNames_form");
211 $form->ajaxSubmit(
"function(result) {new questionnaireMgr.questionNamesFormResult(result);}",
"function() {document.id('{$form->id}_error').set('text','Failed to communicate with server'); }");
215 $table->column(
"Question",
"{question}")
219 $table->emptyMessage =
"There are no questions defined.";
221 $table->cssStyle =
"width: 100%";
223 $questionSelect =
new DataListFieldRenderer(
$form,
$table,
"questionnaire_questions");
224 $questionSelect->hideLabel =
true;
225 $form->submitLabel =
"Save Question Names";
226 $questionSelect->onPostProcess = array($this, saveQuestionNames);
230 $form->readOnlyForm =
true;
240 function saveQuestionNames()
243 $qClass = $this->getQuestionClass();
247 if (!strncmp(
$name,
"question_", 9))
253 $question->filter =
new InclusionFilter(
"question_name");
267 function formatIncludeInResultsLink(
$response)
269 $img =
$response->include_in_results ?
"on.png" :
"off.png";
270 $alt =
$response->include_in_results ?
"include_in_results" :
"exclude_from_results";
271 $fn =
$response->include_in_results ?
"excludeResponse" :
"includeResponse";
273 return $response->format(
"<a href='#' onclick=\"questionnaireMgr.$fn({response_id}); return false;\"><img src='/fakoli/images/$img' alt='$alt' style='display: inline-block; vertical-align: middle; border: none;'/></a>");
288 function writeScript()
290 $itemPk = $this->item->getPrimaryKey();
291 $item_id = $this->item->$itemPk;
292 $component_name = $this->getComponentName();
293 $question_names_dialog =
"question_names_dialog";
294 $response_view_dialog = $this->getResponseViewDialog();
295 $response_view_title = $this->getResponseViewTitle();
297 $response_class = $this->getResponseClass();
298 $mgr = $this->getResponseManager(
new $response_class());
299 $exclude_handler =
$mgr->getExcludeHandler();
300 $responsePk =
$mgr->item->getPrimaryKey();
304 <script type=
"text/javascript" src=
"/components/questionnaire/js/questionnaire_results.js"></script>
305 <script type=
"text/javascript">
306 var questionnaireMgr;
308 window.addEvent(
'domready',
function()
311 <?php echo $item_id ?>,
'<?php echo $component_name ?>',
312 '<?php echo $question_names_dialog ?>',
313 '<?php echo $response_view_dialog ?>',
314 '<?php echo $response_view_title ?>',
315 '<?php echo $exclude_handler ?>',
316 '<?php echo $responsePk ?>'
Questionnaire/Survey Implementation instructions.
getQuestionNumber($question)
Called by QuestionRenderers from QuestionnaireForm Given an instance of a question,...
getQuestions()
Retrieves questions through the questionnaire or survey DataItem object.
static using()
Import the datamodels, views and manifest for the specified component(s).
static usingFile()
Uses the specified framework file(s) from the framework directory.
Provides static function support for Questionnaire Manager methods that are shared among types Questi...
static getQuestionNumber($item, $questions, $question)
if(! $user) if(! $response_id) $response