📄 index.php
字号:
$option_tray->addElement($color_select); $option_tray->addElement($color_label); unset($color_select, $color_label, $option_id_hidden, $option_text); $i++; } $more_label = new XoopsFormLabel("", "<br /><a href='index.php?op=addmore&poll_id=".$poll->getVar("poll_id")."'>"._AM_ADDMORE."</a>"); $option_tray->addElement($more_label); $poll_form->addElement($option_tray); $op_hidden = new XoopsFormHidden("op", "update"); $poll_form->addElement($op_hidden); $poll_id_hidden = new XoopsFormHidden("poll_id", $poll->getVar("poll_id")); $poll_form->addElement($poll_id_hidden); $submit_button = new XoopsFormButton("", "poll_submit", _SUBMIT, "submit"); $poll_form->addElement($submit_button); xoops_cp_header(); echo "<h4>"._AM_POLLCONF."</h4>"; $poll_form->display(); xoops_cp_footer(); exit();}if ( $op == "update" ) { $poll = new XoopsPoll($poll_id); $poll->setVar("question", $question); $poll->setVar("description", $description); if ( !empty($end_time) ) { $end_time = userTimeToServerTime(strtotime($end_time), $xoopsUser->timezone()); $poll->setVar("end_time", $end_time); } $poll->setVar("display", $display); $poll->setVar("weight", $weight); $poll->setVar("multiple", $multiple); if ( $notify == 1 && $end_time > time() ) { // if notify, set mail status to "not mailed" $poll->setVar("mail_status", POLL_NOTMAILED); } else { // if not notify, set mail status to already "mailed" $poll->setVar("mail_status", POLL_MAILED); } if ( !$poll->store() ) { echo $poll->getHtmlErrors(); exit(); } $i = 0; foreach ( $option_id as $opid ) { $option = new XoopsPollOption($opid); $option_text[$i] = trim ($option_text[$i]); if ( $option_text[$i] != "" ) { $option->setVar("option_text", $option_text[$i]); $option->setVar("option_color", $option_color[$i]); $option->store(); } else { if ( $option->delete() != false ) { XoopsPollLog::deleteByOptionId($option->getVar("option_id")); } } $i++; } $poll->updateCount(); include_once XOOPS_ROOT_PATH.'/class/template.php'; xoops_template_clear_module_cache($xoopsModule->getVar('mid')); redirect_header("index.php",1,_AM_DBUPDATED); exit();}if ( $op == "addmore" ) { $poll = new XoopsPoll($_GET['poll_id']); $poll_form = new XoopsThemeForm(_AM_ADDMORE, "poll_form", "index.php"); $question_label = new XoopsFormLabel(_AM_POLLQUESTION, $poll->getVar("question")); $poll_form->addElement($question_label); $option_tray = new XoopsFormElementTray(_AM_POLLOPTIONS, ""); $barcolor_array =& XoopsLists::getImgListAsArray(XOOPS_ROOT_PATH."/modules/xoopspoll/images/colorbars/"); for($i = 0; $i < 10; $i++){ $current_bar = (current($barcolor_array) != "blank.gif") ? current($barcolor_array) : next($barcolor_array); $option_text = new XoopsFormText("", "option_text[]", 50, 255); $option_tray->addElement($option_text); $color_select = new XoopsFormSelect("", "option_color[".$i."]", $current_bar); $color_select->addOptionArray($barcolor_array); $color_select->setExtra("onchange='showImgSelected(\"option_color_image[".$i."]\", \"option_color[".$i."]\", \"modules/xoopspoll/images/colorbars\", \"\", \"".XOOPS_URL."\")'"); $color_label = new XoopsFormLabel("", "<img src='".XOOPS_URL."/modules/xoopspoll/images/colorbars/".$current_bar."' name='option_color_image[".$i."]' id='option_color_image[".$i."]' width='30' align='bottom' height='15' alt='' /><br />"); $option_tray->addElement($color_select); $option_tray->addElement($color_label); unset($color_select, $color_label, $option_text); if ( !next($barcolor_array) ) { reset($barcolor_array); } } $poll_form->addElement($option_tray); $submit_button = new XoopsFormButton("", "poll_submit", _SUBMIT, "submit"); $poll_form->addElement($submit_button); $op_hidden = new XoopsFormHidden("op", "savemore"); $poll_form->addElement($op_hidden); $poll_id_hidden = new XoopsFormHidden("poll_id", $poll->getVar("poll_id")); $poll_form->addElement($poll_id_hidden); xoops_cp_header(); echo "<h4>"._AM_POLLCONF."</h4>"; $poll_form->display(); xoops_cp_footer(); exit();}if ( $op == "savemore" ) { $poll = new XoopsPoll($poll_id); $i = 0; foreach ( $option_text as $optxt ) { $optxt = trim($optxt); if ( $optxt != "" ) { $option = new XoopsPollOption(); $option->setVar("option_text", $optxt); $option->setVar("poll_id", $poll->getVar("poll_id")); $option->setVar("option_color", $option_color[$i]); $option->store(); } $i++; } include_once XOOPS_ROOT_PATH.'/class/template.php'; xoops_template_clear_module_cache($xoopsModule->getVar('mid')); redirect_header("index.php",1,_AM_DBUPDATED); exit();}if ( $op == "delete" ) { xoops_cp_header(); echo "<h4>"._AM_POLLCONF."</h4>"; $poll = new XoopsPoll($_GET['poll_id']); xoops_confirm(array('op' => 'delete_ok', 'poll_id' => $poll->getVar('poll_id')), 'index.php', sprintf(_AM_RUSUREDEL,$poll->getVar("question"))); xoops_cp_footer(); exit();}if ( $op == "delete_ok" ) { $poll = new XoopsPoll($poll_id); if ( $poll->delete() != false ) { XoopsPollOption::deleteByPollId($poll->getVar("poll_id")); XoopsPollLog::deleteByPollId($poll->getVar("poll_id")); include_once XOOPS_ROOT_PATH.'/class/template.php'; xoops_template_clear_module_cache($xoopsModule->getVar('mid')); // delete comments for this poll xoops_comment_delete($xoopsModule->getVar('mid'), $poll->getVar('poll_id')); } redirect_header("index.php",1,_AM_DBUPDATED); exit();}if ( $op == "restart" ) { $poll = new XoopsPoll($_GET['poll_id']); $poll_form = new XoopsThemeForm(_AM_RESTARTPOLL, "poll_form", "index.php"); $expire_text = new XoopsFormText(_AM_EXPIRATION."<br /><small>"._AM_FORMAT."<br />".sprintf(_AM_CURRENTTIME, formatTimestamp(time(), "Y-m-d H:i:s"))."</small>", "end_time", 20, 19, formatTimestamp(time()+604800, "Y-m-d H:i:s")); $poll_form->addElement($expire_text); $notify_yn = new XoopsFormRadioYN(_AM_NOTIFY, "notify", 1); $poll_form->addElement($notify_yn); $reset_yn = new XoopsFormRadioYN(_AM_RESET, "reset", 0); $poll_form->addElement($reset_yn); $op_hidden = new XoopsFormHidden("op", "restart_ok"); $poll_form->addElement($op_hidden); $poll_id_hidden = new XoopsFormHidden("poll_id", $poll->getVar("poll_id")); $poll_form->addElement($poll_id_hidden); $submit_button = new XoopsFormButton("", "poll_submit", _AM_RESTART, "submit"); $poll_form->addElement($submit_button); xoops_cp_header(); echo "<h4>"._AM_POLLCONF."</h4>"; $poll_form->display(); xoops_cp_footer(); exit();}if ( $op == "restart_ok" ) { $poll = new XoopsPoll($poll_id); if ( !empty($end_time) ) { $end_time = userTimeToServerTime(strtotime($end_time), $xoopsUser->timezone()); $poll->setVar("end_time", $end_time); } else { $poll->setVar("end_time", time() + (86400 * 10)); } if ( $notify == 1 && $end_time > time() ) { // if notify, set mail status to "not mailed" $poll->setVar("mail_status", POLL_NOTMAILED); } else { // if not notify, set mail status to already "mailed" $poll->setVar("mail_status", POLL_MAILED); } if ( $reset == 1 ) { // reset all logs XoopsPollLog::deleteByPollId($poll->getVar("poll_id")); XoopsPollOption::resetCountByPollId($poll->getVar("poll_id")); } if (!$poll->store()) { echo $poll->getHtmlErrors(); exit(); } $poll->updateCount(); include_once XOOPS_ROOT_PATH.'/class/template.php'; xoops_template_clear_module_cache($xoopsModule->getVar('mid')); redirect_header("index.php",1,_AM_DBUPDATED); exit();}if ( $op == "log" ) { xoops_cp_header(); echo "<h4>"._AM_POLLCONF."</h4>"; echo "<br>View Log<br> Sorry, not yet. ;-)"; xoops_cp_footer(); exit();}if ( $op == "quickupdate" ) { $count = count($poll_id); for ( $i = 0; $i < $count; $i++ ) { $display[$i] = empty($display[$i]) ? 0 : 1; $weight[$i] = empty($weight[$i]) ? 0 : $weight[$i]; if ( $display[$i] != $old_display[$i] || $weight[$i] != $old_weight[$i] ) { $poll = new XoopsPoll($poll_id[$i]); $poll->setVar("display", $display[$i]); $poll->setVar("weight", intval($weight[$i])); $poll->store(); } } include_once XOOPS_ROOT_PATH.'/class/template.php'; xoops_template_clear_module_cache($xoopsModule->getVar('mid')); redirect_header("index.php",1,_AM_DBUPDATED); exit();}?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -