Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
online_quiz_submission_edit_fns.inc
1 <?php
18 require_once SQ_INCLUDE_PATH.'/asset_edit/asset_edit_fns.inc';
19 
29 {
30 
31 
37  {
38  $this->Asset_Edit_Fns();
39 
40  }//end constructor
41 
42 
53  function paintSubmissionIpAddress(&$asset, &$o, $prefix)
54  {
55  echo $asset->getIP();
56 
57  }//end paintSubmissionIpAddress()
58 
59 
70  function paintSubmissionScore(&$asset, &$o, $prefix)
71  {
72  echo $asset->getScore();
73 
74  }//end paintSubmissionScore()
75 
76 
87  function paintSubmissionTime(&$asset, &$o, $prefix)
88  {
89  echo date('d M Y H:i:s',$asset->created);
90 
91  }//end paintSubmissionTime()
92 
93 
104  function paintUserDetailsAnswers(&$asset, &$o, $prefix)
105  {
106 
107  $user_details_answers = $asset->attr('user_details_answers');
108 
109  // If it is a system user's submission,(which is not required to fill in user detail form), print the user's detail
110  if(!isset($user_details_answers) || empty($user_details_answers)) {
111  $sub_user = $asset->created_userid;
112  $valid_user = FALSE;
113  $o->openField(translate('user'));
114  if (!empty($sub_user)) {
115  $sub_user_asset = $GLOBALS['SQ_SYSTEM']->am->getAsset($sub_user);
116  if (!empty($sub_user_asset)) {
117  echo get_asset_tag_line($sub_user);
118  $valid_user = TRUE;
119  }
120  }
121  if (!$valid_user) {
122  echo '<i>'.translate('online_quiz_no_logged_in_user').'</i>';
123  }
124  $o->closeField();
125  }
126  else { // if the user_details_answers is filled, print out the user's detail
127  $form_id = key($GLOBALS['SQ_SYSTEM']->am->getParents(key($user_details_answers), 'simple_form', FALSE));
128  $form = $GLOBALS['SQ_SYSTEM']->am->getAsset($form_id);
129 
130  // We're using a Simple Form, so here is where it differs from the "Form Submission" asset
131  $user_details_questions = $form->getQuestions();
132 
133  foreach ($user_details_questions as $question_id => $question) {
134  $question = $GLOBALS['SQ_SYSTEM']->am->getAsset($question_id);
135  $o->openField($question->getVal('title'), '', $question->getVal('note'));
136  $answer_details = $user_details_answers[$question_id];
137  echo $answer_details['answer'];
138  $o->closeField();
139  }
140  }
141  return TRUE;
142 
143  }//end paintUserDetailsAnswers()
144 
145 
156  function paintQuizAnswers(&$asset, &$o, $prefix)
157  {
158  $quiz_questions = $asset->attr('quiz_questions');
159  $quiz_answers = $asset->attr('quiz_answers');
160 
161  foreach ($quiz_answers as $question_id => $answer_details) {
162  $question_name = $quiz_questions[$question_id];
163  $o->openField($question_name, '', '');
164  if (isset($answer_details['summary'])) {
165  echo $answer_details['summary'];
166  }
167  $o->closeField();
168  }
169 
170  return TRUE;
171 
172  }//end paintQuizAnswers()
173 
174 
175 }//end class
176 ?>