/** * 項目データを削除する * * @return boolean true or false * @access public */ function deleteItem() { $params = array("item_id" => $this->_request->getParameter("item_id")); $sql = $this->_getFileSQL() . "WHERE ID.item_id = ?"; $files = $this->_db->execute($sql, $params); if ($files === false) { $this->_db->addError(); return false; } if (!$this->deleteFile($files)) { return false; } if (!$this->_db->deleteExecute("registration_item_data", $params)) { return false; } $sql = "SELECT item_sequence " . "FROM {registration_item} " . "WHERE item_id = ?"; $sequences = $this->_db->execute($sql, $params, 1, null, false); if ($sequences === false) { $this->_db->addError(); return false; } $sequence = $sequences[0][0]; if (!$this->_db->deleteExecute("registration_item", $params)) { return false; } $params = array("registration_id" => $this->_request->getParameter("registration_id")); $sequenceParam = array("item_sequence" => $sequence); if (!$this->_db->seqExecute("registration_item", $params, $sequenceParam)) { return false; } return true; }
/** * タスクデータを削除する * * @return boolean true or false * @access public */ function deleteTask() { $calendarAction =& $this->_container->getComponent("calendarAction"); $task = $this->_request->getParameter("task"); if (!empty($task["calendar_id"]) && !$calendarAction->deletePlan($task["calendar_id"], CALENDAR_PLAN_EDIT_THIS)) { return false; } $params = array("task_id" => $task["task_id"]); $sql = "SELECT task_sequence " . "FROM {todo_task} " . "WHERE task_id = ?"; $sequences = $this->_db->execute($sql, $params, 1, null, false); if ($sequences === false) { $this->_db->addError(); return false; } $sequence = $sequences[0][0]; if (!$this->_db->deleteExecute("todo_task", $params)) { return false; } $params = array("todo_id" => $task["todo_id"]); $sequenceParam = array("task_sequence" => $sequence); if (!$this->_db->seqExecute("todo_task", $params, $sequenceParam)) { return false; } // -- 新着情報関連 Start -- $whatsnewAction =& $this->_container->getComponent("whatsnewAction"); $result = $whatsnewAction->delete($task["task_id"]); if ($result === false) { return false; } // -- 新着情報関連 End -- return true; }
/** * 写真データを削除する * * @return boolean true or false * @access public */ function deletePhoto() { $params = array("photo_id" => $this->_request->getParameter("photo_id")); if (!$this->_db->deleteExecute("photoalbum_comment", $params)) { return false; } $sql = "SELECT photo_id, album_id, upload_id, photo_sequence " . "FROM {photoalbum_photo} " . "WHERE photo_id = ?"; $photos = $this->_db->execute($sql, $params); if ($photos === false) { $this->_db->addError(); return false; } if (!$this->deletePhotoFile($photos)) { return false; } if (!$this->_db->deleteExecute("photoalbum_photo", $params)) { return false; } $params = array("album_id" => $photos[0]["album_id"]); $sequenceParam = array("photo_sequence" => $photos[0]["photo_sequence"]); if (!$this->_db->seqExecute("photoalbum_photo", $params, $sequenceParam)) { return false; } $sql = "UPDATE {photoalbum_album} " . "SET photo_count = photo_count - 1 " . "WHERE album_id = ?"; $result = $this->_db->execute($sql, $params); if ($result === false) { $this->_db->addError(); return false; } //--新着情報関連 Start-- // 新着にあれば、更新、なければそのまま $params = array("unique_id" => $this->_request->getParameter("album_id"), "module_id" => $this->_request->getParameter("module_id")); $whatsnew = $this->_db->selectExecute("whatsnew", $params, null, 1); if (isset($whatsnew[0])) { // データあり $container =& DIContainerFactory::getContainer(); $whatsnewAction =& $container->getComponent("whatsnewAction"); $whatsnew[0]['count_num'] = intval($whatsnew[0]['count_num']) - 1; if ($whatsnew[0]['count_num'] == 0) { $result = $whatsnewAction->delete($this->_request->getParameter("album_id")); } else { $result = $whatsnewAction->update($whatsnew[0]); } if ($result === false) { return false; } } //--新着情報関連 End-- return true; }
/** * 問題データを削除する * * @return boolean true or false * @access public */ function deleteQuestion() { $quiz = $this->_request->getParameter("quiz"); if ($quiz["status"] != QUIZ_STATUS_INACTIVE_VALUE) { return false; } $params = array("question_id" => $this->_request->getParameter("question_id")); $sql = "SELECT DISTINCT summary_id " . "FROM {quiz_answer} " . "WHERE question_id = ?"; $summaryIDs = $this->_db->execute($sql, $params, 1, null, false); if ($summaryIDs === false) { $this->_db->addError(); return false; } if (!$this->_db->deleteExecute("quiz_answer", $params)) { return false; } foreach ($summaryIDs as $summaryID) { $result = $this->updateSummary($summaryID); if ($result === false) { return false; } } if (!$this->_db->deleteExecute("quiz_choice", $params)) { return false; } $sql = "SELECT question_sequence " . "FROM {quiz_question} " . "WHERE question_id = ?"; $sequences = $this->_db->execute($sql, $params, 1, null, false); if ($sequences === false) { $this->_db->addError(); return false; } $sequence = $sequences[0][0]; if (!$this->_db->deleteExecute("quiz_question", $params)) { return false; } if ($quiz["status"] == QUIZ_STATUS_INACTIVE_VALUE && !$this->updatePerfectScore()) { return false; } $params = array("quiz_id" => $this->_request->getParameter("quiz_id")); $sequenceParam = array("question_sequence" => $sequence); if (!$this->_db->seqExecute("quiz_question", $params, $sequenceParam)) { return false; } return true; }
/** * リンクデータを削除する * * @return boolean true or false * @access public */ function deleteLink() { $params = array("link_id" => $this->_request->getParameter("link_id")); $sql = "SELECT category_id, link_sequence " . "FROM {linklist_link} " . "WHERE link_id = ?"; $sequences = $this->_db->execute($sql, $params, 1, null, false); if ($sequences === false) { $this->_db->addError(); return false; } $categoryID = $sequences[0][0]; $sequence = $sequences[0][1]; if (!$this->_db->deleteExecute("linklist_link", $params)) { return false; } $params = array("linklist_id" => $this->_request->getParameter("linklist_id"), "category_id" => $categoryID); $sequenceParam = array("link_sequence" => $sequence); if (!$this->_db->seqExecute("linklist_link", $params, $sequenceParam)) { return false; } return true; }
/** * 施設を登録する * * @access public */ function setLocationSequence() { $site_id = $this->_session->getParameter("_site_id"); $user_id = $this->_session->getParameter("_user_id"); $user_name = $this->_session->getParameter("_handle"); $time = timezone_date(); //データ取得 $position = $this->_request->getParameter("position"); $drag_location = $this->_request->getParameter("drag_location"); $drop_category = $this->_request->getParameter("drop_category"); $drop_location = $this->_request->getParameter("drop_location"); $drag_category_id = $drag_location["category_id"]; if ($position == "inside") { $drop_category_id = $drop_category["category_id"]; } else { $drop_category_id = $drop_location["category_id"]; } //移動元デクリメント //前詰め処理 $params = array("category_id" => $drag_category_id); $sequence_param = array("display_sequence" => $drag_location["display_sequence"]); $result = $this->_db->seqExecute("reservation_location", $params, $sequence_param); if ($result === false) { return false; } if ($position == "inside") { $drop_display_sequence = $this->_reservationView->getLocationSequence($drop_category_id); if ($drop_display_sequence === false) { return false; } if ($drag_category_id != $drop_category_id) { $drop_display_sequence = $drop_display_sequence + 1; } } else { if ($drag_category_id == $drop_category_id) { if ($drag_location["display_sequence"] > $drop_location["display_sequence"]) { if ($position == "top") { $drop_display_sequence = $drop_location["display_sequence"]; } else { $drop_display_sequence = $drop_location["display_sequence"] + 1; } } else { if ($position == "top") { $drop_display_sequence = $drop_location["display_sequence"] - 1; } else { $drop_display_sequence = $drop_location["display_sequence"]; } } } else { if ($position == "top") { $drop_display_sequence = $drop_location["display_sequence"]; } else { $drop_display_sequence = $drop_location["display_sequence"] + 1; } } if ($drop_display_sequence == 0) { $drop_display_sequence = 1; } //移動先インクリメント $params = array("category_id" => $drop_category_id); $sequence_param = array("display_sequence" => $drop_display_sequence); $result = $this->_db->seqExecute("reservation_location", $params, $sequence_param, 1); if ($result === false) { return false; } } //更新 $params = array("category_id" => $drop_category_id, "display_sequence" => $drop_display_sequence); $where_params = array("location_id" => $drag_location["location_id"]); $result = $this->_db->updateExecute("reservation_location", $params, $where_params, true); if ($result === false) { return false; } return true; }