Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
form_question_type_tickbox_table_edit_fns.inc
1 <?php
18 require_once dirname(__FILE__).'/../../form_question/form_question_edit_fns.inc';
19 
20 
33 {
34 
35 
41  {
42  $this->Form_Question_Edit_Fns();
43 
44  }//end constructor
45 
46 
57  function paintQuestionInterface(&$asset, &$o, $prefix)
58  {
59  $write_access = $asset->writeAccess('attributes');
60 
61  if ($write_access) {
62  $output_type = 'editor';
63  } else {
64  $output_type = 'passive';
65  }
66 
67  echo $asset->_getOutput($output_type);
68 
69  return $write_access;
70 
71  }//end paintQuestionInterface()
72 
73 
84  function processQuestionInterface(&$asset, &$o, $prefix)
85  {
86  $safe_prefix = $asset->getSafePrefix();
87 
88  $table = array_get_index($_REQUEST, $safe_prefix, false);
89 
90  if (!$table || empty($table)) {
91  return false;
92  }
93 
94  // the last table row is an artifact, remove it
95  array_pop($table);
96  if (empty($table)) return false;
97 
98  // the last item in the first row an artifact, remove it
99  $header = array_shift($table);
100  array_pop($header);
101  array_unshift($table, $header);
102 
103  $asset->setAttrValue('question_contents', $table);
104 
105  return true;
106 
107  }//end processQuestionInterface()
108 
109 
110 }//end class
111 
112 ?>