Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
page_poll_edit_fns.inc
1 <?php
18 require_once SQ_CORE_PACKAGE_PATH.'/page/page_edit_fns.inc';
19 
34 {
35 
36 
41  function __construct()
42  {
43  parent::__construct();
44  $this->static_screens['details']['force_unlock'] = FALSE;
45 
46  }//end constructor
47 
48 
59  function paintNewPollQuestion(&$asset, &$o, $prefix)
60  {
61  require_once SQ_LIB_PATH.'/html_form/html_form.inc';
62  $write_access = $asset->writeAccess('menu');
63 
64  if ($write_access) {
65  text_box($prefix.'_poll_name', '', 50);
66  }
67 
68 
69  return $write_access;
70 
71  }//end paintNewPollQuestion()
72 
73 
84  function processNewPollQuestion(&$asset, &$o, $prefix)
85  {
86  // need to have write access to make any changes
87  if (!$asset->writeAccess('menu')) return FALSE;
88 
89  $poll_name = array_get_index($_POST, $prefix.'_poll_name', '');
90  $poll_name = trim($poll_name);
91 
92  if ($poll_name == '') return FALSE;
93 
94  // create a question
95  $GLOBALS['SQ_SYSTEM']->am->includeAsset('poll_question');
96  $poll_question = new Poll_Question();
97  $initial_link = Array('asset' => &$asset, 'link_type' => SQ_LINK_TYPE_2, 'value' => '', 'sort_order' => 0, 'is_dependant' => 0);
98  $poll_question->setAttrValue('name', $poll_name);
99 
100  if (!$poll_question->create($initial_link)) {
101  trigger_localised_error('CMS0021', E_USER_WARNING);
102  }
103 
104  return FALSE;
105 
106  }//end processNewPollQuestion()
107 
108 
109 }//end class
110 
111 ?>