本文整理汇总了PHP中Poll::save_current方法的典型用法代码示例。如果您正苦于以下问题:PHP Poll::save_current方法的具体用法?PHP Poll::save_current怎么用?PHP Poll::save_current使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Poll
的用法示例。
在下文中一共展示了Poll::save_current方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handlePOST
public function handlePOST($request_data)
{
if (!empty($request_data['submit'])) {
$obj = new Poll();
$obj->poll_id = $request_data['poll'];
$obj->prev_changed = $request_data['prev_poll_changed'];
$obj->prev_poll_id = $request_data['prev_poll_id'];
$obj->save_current();
$this->message = __('Poll has been saved successfully.');
if ($this->gid != 0) {
$this->redirect2 = PA::$url . "/group_poll.php?gid=" . $this->gid . "&type=select";
} else {
$this->redirect2 = NULL;
}
$this->queryString = NULL;
$this->isError = FALSE;
$this->setWebPageMessage();
}
if (!empty($request_data['create'])) {
$poll_topic = $request_data['topic'];
$cnt = $request_data['num_option'];
$poll_option = array();
for ($i = 1; $i <= $cnt; $i++) {
$poll_option['option' . $i] = $request_data['option' . $i];
}
$option = serialize($poll_option);
$obj = new Poll();
$obj->author_id = PA::$login_uid;
$obj->type = POLL;
$obj->title = $poll_topic;
$obj->body = $option;
$obj->parent_collection_id = 0;
$obj->user_id = PA::$login_uid;
$obj->group_id = $this->gid;
$obj->options = $option;
$obj->is_active = INACTIVE;
$obj->save_poll();
$this->message = __('Poll has been created successfully.');
if ($obj->group_id != 0) {
$this->redirect2 = PA::$url . "/group_poll.php?gid=" . $obj->group_id . "&type=select";
} else {
$this->redirect2 = PA::$url . PA_ROUTE_CONFIG_POLL . "?type=select";
}
$this->queryString = NULL;
$this->isError = FALSE;
$this->setWebPageMessage();
}
}
示例2: htmlspecialchars
require_once "api/Validation/Validation.php";
require_once "api/Poll/Poll.php";
$error = FALSE;
$authorization_required = TRUE;
$message = @$_REQUEST['msg'];
global $flag, $type;
if (!$error) {
if (!empty($_GET['type'])) {
$type = htmlspecialchars($_GET['type']);
}
if (!empty($_POST['submit'])) {
$obj = new Poll();
$obj->poll_id = $_POST['poll'];
$obj->prev_changed = $_POST['prev_poll_changed'];
$obj->prev_poll_id = $_POST['prev_poll_id'];
$obj->save_current();
header("Location: " . PA::$url . PA_ROUTE_HOME_PAGE);
}
if (!empty($_GET['action']) && $_GET['action'] == "delete") {
$obj = new poll();
$p_id = $_GET['id'];
$c_id = $_GET['cid'];
$obj->delete_poll($p_id, $c_id);
header("Location: " . PA::$url . "/poll.php?type=select");
}
if (!empty($_POST['create'])) {
$poll_topic = $_POST['topic'];
$cnt = $_POST['num_option'];
$poll_option = array();
for ($i = 1; $i <= $cnt; $i++) {
$poll_option['option' . $i] = $_POST['option' . $i];