Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
page_custom_form_edit_fns.inc
1 <?php
18 require_once SQ_CORE_PACKAGE_PATH.'/page/page_edit_fns.inc';
19 
32 {
33 
34 
39  function __construct()
40  {
41  parent::__construct();
42 
43  }//end constructor
44 
45 
56  function redirectToFormContents(&$asset, &$o, $prefix)
57  {
58  // get the bodycopy attached to us
59  $form = $asset->getForm();
60 
61  if (is_null($form)) {
62  trigger_localised_error('CMS0022', E_USER_ERROR, $asset->name, $asset->id, 'Contents');
63  return FALSE;
64  }
65 
66  // redirect to the bodycopy's edit contents screen
67  $o->setRedirect($form->getBackendHref('contents'));
68 
69  // fudge the navigation history a little so when they click on the link to ger back to the
70  // page it doesnt take them to the edit contents screen and then redirect them again
71  $_SESSION['sq_nav_history'][(count($_SESSION['sq_nav_history']) - 1)]['screen'] = 'details';
72 
73  return FALSE;
74 
75  }//end redirectToFormContents()
76 
77 
88  function redirectToSubmissions(&$asset, &$o, $prefix)
89  {
90  // get the bodycopy attached to us
91  $form = $asset->getForm();
92 
93  if (is_null($form)) {
94  trigger_localised_error('CMS0022', E_USER_ERROR, $asset->name, $asset->id);
95  return FALSE;
96  }
97 
98  // redirect to the bodycopy's edit contents screen
99  $o->setRedirect($form->getBackendHref('log'));
100 
101  // fudge the navigation history a little so when they click on the link to ger back to the
102  // page it doesnt take them to the edit contents screen and then redirect them again
103  $_SESSION['sq_nav_history'][(count($_SESSION['sq_nav_history']) - 1)]['screen'] = 'details';
104 
105  return FALSE;
106 
107  }//end redirectToSubmissions()
108 
109 
120  function paintSubmissions(&$asset, &$o, $prefix)
121  {
122  $form = $asset->getForm();
123  if (is_null($form)) {
124  trigger_localised_error('CMS0022', E_USER_ERROR, $asset->name, $asset->id);
125  return FALSE;
126  }
127 
128 
129  $edit_fns = $form->getEditFns();
130  return $edit_fns->paintSubmissions($form, $o, $prefix);
131 
132  }//end paintSubmissions()
133 
134 
145  function paintDownloadDateRange(&$asset, &$o, $prefix)
146  {
147  return $this->delegateToFormEditMethod($asset, $o, $prefix, __FUNCTION__);
148 
149  }//end paintDownloadDateRange()
150 
151 
162  function paintDownloadFormat(&$asset, &$o, $prefix)
163  {
164  return $this->delegateToFormEditMethod($asset, $o, $prefix, __FUNCTION__);
165 
166  }//end paintDownloadFormat()
167 
168 
179  function paintDownloadButton(&$asset, &$o, $prefix)
180  {
181  return $this->delegateToFormEditMethod($asset, $o, $prefix, __FUNCTION__);
182 
183  }//end paintDownloadButton()
184 
185 
196  function processDownloadButton(&$asset, &$o, $prefix)
197  {
198  return $this->delegateToFormEditMethod($asset, $o, $prefix, __FUNCTION__);
199 
200  }//end processDownloadButton()
201 
202 
213  function paintSubmissionDateRange(&$asset, &$o, $prefix)
214  {
215  return $this->delegateToFormEditMethod($asset, $o, $prefix, __FUNCTION__);
216 
217  }//end paintSubmissionDateRange()
218 
219 
230  function paintSubmissionCount(&$asset, &$o, $prefix)
231  {
232  return $this->delegateToFormEditMethod($asset, $o, $prefix, __FUNCTION__);
233 
234  }//end paintSubmissionCount()
235 
236 
247  function paintSubmissionList(&$asset, &$o, $prefix)
248  {
249  return $this->delegateToFormEditMethod($asset, $o, $prefix, __FUNCTION__);
250 
251  }//end paintSubmissionList()
252 
253 
264  function processSubmissionList(&$asset, &$o, $prefix)
265  {
266  return $this->delegateToFormEditMethod($asset, $o, $prefix, __FUNCTION__);
267 
268  }//end processSubmissionList()
269 
279  function paintSendSubmissionsEmail(&$asset, &$o, $prefix)
280  {
281  return $this->delegateToFormEditMethod($asset, $o, $prefix, __FUNCTION__);
282 
283  }//end paintSendSubmissionsEmail()
284 
285 
295  public function processSendSubmissionsEmail(&$asset, &$o, $prefix)
296  {
297  return $this->delegateToFormEditMethod($asset, $o, $prefix, __FUNCTION__);
298 
299  }//end processSendSubmissionsEmail()
300 
301 
313  function delegateToFormEditMethod(&$asset, &$o, $prefix, $edit_method)
314  {
315  $form = $asset->getForm();
316  if (is_null($form)) {
317  trigger_localised_error('CMS0022', E_USER_ERROR, $asset->name, $asset->id);
318  return FALSE;
319  }
320 
321  $edit_fns = $form->getEditFns();
322  if (method_exists($edit_fns, $edit_method)) {
323  return $edit_fns->$edit_method($form, $o, $prefix);
324  } else {
325  trigger_localised_error('CMS0067', E_USER_ERROR, $form->name, $edit_method);
326  return FALSE;
327  }
328 
329  }//end delegateToFormEditMethod()
330 
331 
341  function hasAttributeWriteAccess(&$asset, &$o) {
342  return $asset->writeAccess('attributes');
343 
344  }//end hasAttributeWriteAccess()
345 
346 
347 }//end class
348 ?>