57 require_once(
"../config.php");
58 require_once(
"../inc/user.class.php");
59 require_once(
"../inc/tools.php");
62 require_once(
"../inc/check_login.php");
65 require_once(
"../inc/db.class.php");
66 require_once(
"../inc/config.class.php");
68 require_once(
"../inc/html.class.php");
69 require_once(
"../inc/poll.class.php");
70 require_once(
"../inc/messages.class.php");
72 $db=
new db( DB_USER, DB_PASS, DB_DATABASE, DB_HOST );
82 if( (isset($_POST[
"pollID"])) AND ($_POST[
"pollID"] !=
"") AND ( is_numeric($_POST[
"pollID"]) ) ){
83 $pollID = intval($_POST[
"pollID"]);
85 if( !$poll->load_from_id(
$db,$pollID) ){
91 if( (isset($_POST[
"wID"])) AND ($_POST[
"wID"] !=
"") AND ( is_numeric($_POST[
"wID"]) ) AND (isset($poll) ) ){
92 $wID = intval($_POST[
"wID"]);
93 $widget = $poll->get_widget_by_id($wID);
95 $messages->add_message(
new errorMessage(
"Die angeforderte Frage in dieser Umfrage existiert leider nicht ... ") );
99 if( (isset($_POST[
"oID"])) AND ($_POST[
"oID"] !=
"") AND ( is_numeric($_POST[
"oID"]) ) AND (isset(
$widget) ) ){
100 $oID = intval($_POST[
"oID"]);
101 $option =
$widget->get_widget_by_id($oID);
102 if( !isset($option) ){
103 $messages->add_message(
new errorMessage(
"Die angeforderte Option in dieser Frage, dieser Umfrage existiert leider nicht ... ") );
109 if( (intval($_SESSION[
"user"]->ID) !== intval($poll->owner) ) AND
110 ( !in_array(
"{$_SESSION["user"]->ID}",explode(
",",SUPER_ADMIN) )) ){
111 die(
"Umfrage Bearbeiten nicht erlaubt.");
116 foreach(
$keys as $key){
117 $actions = array(
"add",
"rm",
"mvup",
"mvdwn",
"addq",
"rmq",
"mvupq",
"mvdwnq",
"editq");
118 foreach($actions as $act){
120 (substr($key, 0, strlen(
"{$act}_option_ID") ) ==
"{$act}_option_ID" )
121 AND ( is_numeric(substr($key,strlen(
"{$act}_option_ID"))) )
122 AND ( !isset($add_option) )
124 $tmp = intval( substr($key,strlen(
"{$act}_option_ID")) );
131 $option_action_ID =
$tmp;
132 $option_action = $act;
144 if ( ((isset($_POST[
"save"])) AND ($_POST[
"save"] !=
"")) OR ((isset($_POST[
"apply"])) AND ($_POST[
"apply"] !=
"")) ){
145 if( (isset($option)) AND (isset(
$widget)) AND (isset($poll)) ){
146 if( $option instanceof
label ){
147 include(
INCLUDE_DIR.
"/backend/handle/edit.label.child.handle.php");
151 }
else if( (isset(
$widget)) AND (isset($poll)) ){
158 }
else if( (isset($_POST[
"save_poll"])) OR (isset($_POST[
"apply_poll"])) ){
159 include(
INCLUDE_DIR.
"/backend/handle/edit.poll.handle.php");
162 }
else if( (isset($option_action_ID)) AND (isset($option_action)) AND (isset($poll)) AND (isset(
$widget)) ){
163 if(
$widget->typ ==
"radioButtonList" ){
164 include(
INCLUDE_DIR.
"/backend/handle/edit.radioButtonList.handle.php");
165 $add_type =
"radioButton";
166 }
else if(
$widget->typ ==
"checkBoxList" ){
167 include(
INCLUDE_DIR.
"/backend/handle/edit.checkBoxList.handle.php");
168 $add_type =
"checkBox";
169 }
else if(
$widget->typ ==
"matrix" ){
170 include(
INCLUDE_DIR.
"/backend/handle/edit.matrix.handle.php");
171 $add_type =
"matrixOption";
172 if( $add_action ==
"addq"){
173 $add_type =
"matrixQuestion";
175 }
else if(
$widget->typ ==
"textExt" ){
176 include(
INCLUDE_DIR.
"/backend/handle/edit.textExt.handle.php");
177 $add_type =
$widget->handle_add_widget_edit();
178 }
else if(
$widget->typ ==
"label" ){
179 include(
INCLUDE_DIR.
"/backend/handle/edit.label.handle.php");
181 }
else if(
$widget->typ ==
"schedule" ){
182 include(
INCLUDE_DIR.
"/backend/handle/edit.schedule.handle.php");
183 $add_type =
"scheduleDate";
187 if( (
$widget instanceof
label) AND ($option_action ==
"editq") ){
188 header(
"Location: edit.php?pollID={$poll->ID}&widgetID={$widget->ID}&optionID={$option_action_ID}");
191 header(
"Location: action.option.php?pollID={$poll->ID}&widgetID={$widget->ID}&optionID={$option_action_ID}&action=$option_action&type=$add_type");
197 header(
"Location: edit.php?pollID={$poll->ID}&widgetID={$widget->ID}");
214 if( (isset($_POST[
"apply"])) AND (isset($option)) ){
215 header(
"Location: edit.php?pollID=$pollID&widgetID=$wID&optionID={$option->ID}");
216 }
else if( (isset($_POST[
"save"])) AND (isset($option)) ){
217 header(
"Location: edit.php?pollID=$pollID&widgetID=$wID");
219 }
else if( isset($_POST[
"apply"]) ){
220 header(
"Location: edit.php?pollID=$pollID&widgetID=$wID");
221 }
else if( (!isset($_POST[
"save_poll"])) AND (!isset($_POST[
"apply_poll"])) ){
222 $_SESSION[
"last_widget_edit"] =
$widget->ID;
223 header(
"Location: edit.php?pollID=$pollID#widget{$widget->ID}");
226 if( isset($_POST[
"save_poll"]) ){
227 $_SESSION[
"last_poll_edit"] = $poll->ID;
228 header(
"Location: index.php");
229 }
else if( isset($_POST[
"apply_poll"]) ){
230 header(
"Location: edit.php?pollID=$pollID#poll_settings");
235 if( isset($option) ){
236 header(
"Location: edit.php?pollID=$pollID&widgetID=$wID&optionID={$option->ID}");
237 }
else if( (!isset($_POST[
"save_poll"])) AND (!isset($_POST[
"apply_poll"])) ){
238 header(
"Location: edit.php?pollID=$pollID&widgetID=$wID");
241 header(
"Location: edit.php?pollID=$pollID");