XpressEngine Core  1.11.2
 All Classes Namespaces Files Functions Variables Pages
poll.admin.controller.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) NAVER <http://www.navercorp.com> */
8 class pollAdminController extends poll
9 {
13  function init()
14  {
15  }
16 
21  {
22  $config = new stdClass;
23  $config->skin = Context::get('skin');
24  $config->colorset = Context::get('colorset');
25 
27  $oModuleController->insertModuleConfig('poll', $config);
28 
29  $this->setMessage('success_updated');
30 
31  $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispPollAdminConfig');
32  $this->setRedirectUrl($returnUrl);
33  }
34 
39  {
40  // Display an error no post is selected
41  $cart = Context::get('cart');
42 
43  if(is_array($cart)) $poll_srl_list = $cart;
44  else $poll_srl_list= explode('|@|', $cart);
45 
46  $poll_count = count($poll_srl_list);
47  if(!$poll_count) return $this->stop('msg_cart_is_null');
48  // Delete the post
49  for($i=0;$i<$poll_count;$i++)
50  {
51  $poll_index_srl = trim($poll_srl_list[$i]);
52  if(!$poll_index_srl) continue;
53 
54  $output = $this->deletePollTitle($poll_index_srl, true);
55  if(!$output->toBool()) return $output;
56  }
57 
58  $this->setMessage( sprintf(Context::getLang('msg_checked_poll_is_deleted'), $poll_count) );
59 
60  $returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispPollAdminList');
61  $this->setRedirectUrl($returnUrl);
62  }
63 
65  {
66  $poll_index_srl = (int)Context::get('poll_index_srl');
67 
68  $oPollAdminModel = getAdminModel('poll');
69  //$columnList = array('comment_srl');
70  $args = new stdClass;
71  $args->pollIndexSrlList = array($poll_index_srl);
72  $args->list_count = 100;
73 
74  $output = $oPollAdminModel->getPollList($args);
75 
76  if(is_array($output->data))
77  {
78  foreach($output->data AS $key=>$value)
79  {
80  if($_SESSION['poll_management'][$value->poll_index_srl]) unset($_SESSION['poll_management'][$value->poll_index_srl]);
81  else $_SESSION['poll_management'][$value->poll_index_srl] = true;
82  }
83  }
84  }
85 
89  function deletePollTitle($poll_index_srl)
90  {
91  $args = new stdClass;
92  $dargs = new stdClass;
93 
94  $args->poll_index_srl = $poll_index_srl;
95 
96  $oDB = &DB::getInstance();
97  $oDB->begin();
98 
99  $output = executeQueryArray('poll.getPollByDeletePollTitle', $args);
100  if($output->toBool() && $output->data && $output->data[0]->count == 1)
101  {
102  $dargs->poll_srl = $output->data[0]->poll_srl;
103  }
104 
105  $output = $oDB->executeQuery('poll.deletePollTitle', $args);
106  if(!$output)
107  {
108  $oDB->rollback();
109  return $output;
110  }
111 
112  $output = $oDB->executeQuery('poll.deletePollItem', $args);
113  if(!$output)
114  {
115  $oDB->rollback();
116  return $output;
117  }
118 
119  if($dargs->poll_srl)
120  {
121  $output = executeQuery('poll.deletePoll', $dargs);
122  if(!$output)
123  {
124  $oDB->rollback();
125  return $output;
126  }
127 
128  $output = executeQuery('poll.deletePollLog', $dargs);
129  if(!$output)
130  {
131  $oDB->rollback();
132  return $output;
133  }
134  }
135  $oDB->commit();
136 
137  return new BaseObject();
138  }
139 
143  function deletePoll($poll_srl)
144  {
145  $args = new stdClass;
146  $args->poll_srl = $poll_srl;
147 
148  $oDB = &DB::getInstance();
149  $oDB->begin();
150 
151  $output = $oDB->executeQuery('poll.deletePoll', $args);
152  if(!$output)
153  {
154  $oDB->rollback();
155  return $output;
156  }
157 
158  $output = $oDB->executeQuery('poll.deletePollTitle', $args);
159  if(!$output)
160  {
161  $oDB->rollback();
162  return $output;
163  }
164 
165  $output = $oDB->executeQuery('poll.deletePollItem', $args);
166  if(!$output)
167  {
168  $oDB->rollback();
169  return $output;
170  }
171 
172  $oDB->commit();
173 
174  return new BaseObject();
175  }
176 }
177 /* End of file poll.admin.controller.php */
178 /* Location: ./modules/poll/poll.admin.controller.php */
setMessage($message= 'success', $type=NULL)
getController($module_name)
Definition: func.inc.php:90
$output
Definition: ko.install.php:193
getNotEncodedUrl()
Definition: func.inc.php:316
procPollAdminDeleteChecked()
Delete the polls selected in the administrator&#39;s page.
The admin controller class of the poll module.
deletePollTitle($poll_index_srl)
Delete the poll (when several questions are registered in one poll, delete this question) ...
procPollAdminInsertConfig()
Save the configurations.
$args
Definition: ko.install.php:185
setRedirectUrl($url= './', $output=NULL)
getAdminModel($module_name)
Definition: func.inc.php:156
getInstance($db_type=NULL)
Definition: DB.class.php:142
getLang($code)
executeQueryArray($query_id, $args=NULL, $arg_columns=NULL)
Definition: func.inc.php:219
executeQuery($query_id, $args=NULL, $arg_columns=NULL)
Definition: func.inc.php:203
$oModuleController
Definition: ko.install.php:287
deletePoll($poll_srl)
Delete the poll (delete the entire poll)
The parent class of the poll module.
Definition: poll.class.php:8