/** * 自動番号の取得 * * @access public */ function getAutoNumber($metadata_id) { $params = array("metadata_id" => $metadata_id); $number = $this->_db->maxExecute("multidatabase_metadata_content", "content", $params); if ($number === false) { return 0; } return sprintf(MULTIDATABASE_META_AUTONUM_FORMAT, intval($number) + 1); }
/** * 施設取得 * * @access public */ function getLocationSequence($category_id) { $max_sequence = $this->_db->maxExecute("reservation_location", "display_sequence", array("category_id" => $category_id)); if ($max_sequence === false) { return false; } if (empty($max_sequence)) { $max_sequence = 0; } return $max_sequence; }
/** * 新着情報にセットする * * @return bool * @access public */ function setWhatsnew($post_id) { $params = array("post_id" => $post_id); $posts = $this->_db->selectExecute("journal_post", $params); if (empty($posts)) { return false; } $whatsnewAction =& $this->_container->getComponent("whatsnewAction"); if ($posts[0]["status"] == JOURNAL_POST_STATUS_REREASED_VALUE && $posts[0]["agree_flag"] == JOURNAL_STATUS_AGREE_VALUE) { $whatsnew = array("unique_id" => $post_id, "title" => $posts[0]["title"], "description" => $posts[0]["content"] . "<br /><br />" . $posts[0]["more_content"], "action_name" => "journal_view_main_detail", "parameters" => "post_id=" . $post_id . "&comment_flag=1", "insert_time" => $posts[0]["journal_date"], "insert_user_id" => $posts[0]["insert_user_id"], "insert_user_name" => $posts[0]["insert_user_name"], "update_time" => $posts[0]["journal_date"], "child_update_time" => $posts[0]["journal_date"]); $result = $whatsnewAction->auto($whatsnew); if ($result === false) { return false; } // journal_dateが、未来かどうかを判断し、 // 未来ならば、コメントの新着も未来に書き換え // 未来でなければ、コメントのデータのMAXをとり、 // その日付に更新 $where_params = array("root_id" => $post_id); $insert_time = $this->_db->maxExecute("journal_post", "insert_time", $where_params); if (isset($insert_time)) { // コメントあり $time = timezone_date(); $journal_date = $posts[0]["journal_date"]; $whatsnew['child_flag'] = _ON; if (intval($journal_date) < intval($time)) { // 過去 $whatsnew['insert_time'] = $journal_date; $whatsnew['child_update_time'] = $insert_time; } $result = $whatsnewAction->auto($whatsnew, _OFF); if ($result === false) { return false; } } } else { $result = $whatsnewAction->delete($post_id); if ($result === false) { return false; } } return true; }
/** * アップロードされた写真データを登録する * * @return boolean true or false * @access public */ function upload() { $albumID = $this->_request->getParameter("album_id"); $photoalbumID = $this->_request->getParameter("photoalbum_id"); $photoSequence = 0; $container =& DIContainerFactory::getContainer(); $commonMain =& $container->getComponent("commonMain"); $uploadsAction =& $commonMain->registerClass(WEBAPP_DIR . '/components/uploads/Action.class.php', "Uploads_Action", "uploadsAction"); $files = $uploadsAction->uploads(); $params = array("album_id" => $this->_request->getParameter("album_id")); $maxPhotoID = $this->_db->maxExecute("photoalbum_photo", "photo_id", $params); foreach ($files as $file) { if ($file['error_mes'] != "") { continue; } $imageSize = getimagesize(FILEUPLOADS_DIR . "photoalbum/" . $file["physical_file_name"]); if (empty($imageSize)) { return false; } $photoSequence++; $params = array("album_id" => $albumID, "photoalbum_id" => $photoalbumID, "photo_name" => str_replace("." . $file["extension"], "", $file["file_name"]), "photo_sequence" => $photoSequence, "upload_id" => $file["upload_id"], "photo_path" => "?" . ACTION_KEY . "=" . $file["action_name"] . "&upload_id=" . $file["upload_id"], "width" => $imageSize[0], "height" => $imageSize[1]); if (!$this->_db->insertExecute("photoalbum_photo", $params, true, "photo_id")) { $uploadsAction->delUploadsById($file["upload_id"]); return false; } } $params = array($albumID, $maxPhotoID); $sql = "UPDATE {photoalbum_photo} " . "SET photo_sequence = photo_sequence + " . $photoSequence . " " . "WHERE album_id = ? " . "AND photo_id <= ?"; $result = $this->_db->execute($sql, $params); if ($result === false) { $this->_db->addError(); return false; } $params = array("album_id" => $this->_request->getParameter("album_id")); $photoSequence = $this->_db->maxExecute("photoalbum_photo", "photo_sequence", $params); if (empty($photoSequence)) { return false; } $params = array("album_id" => $albumID, "photo_count" => $photoSequence, "photo_upload_time" => timezone_date()); if (!$this->_db->updateExecute("photoalbum_album", $params, "album_id", true)) { return false; } //--新着情報関連 Start-- $whatsnewAction =& $container->getComponent("whatsnewAction"); $commonMain =& $container->getComponent("commonMain"); $photoalbum_block = $this->_db->selectExecute("photoalbum_block", array("photoalbum_id" => $photoalbumID), null, 1); if (isset($photoalbum_block[0])) { $album_id = $this->_request->getParameter("album_id"); $photoalbum_album = $this->_db->selectExecute("photoalbum_album", array("album_id" => $album_id)); if (!isset($photoalbum_album[0])) { return false; } if ($photoalbum_album[0]['public_flag'] == _ON) { $id = $commonMain->getTopId($photoalbum_block[0]['block_id'], $this->_request->getParameter("module_id"), ""); $whatsnew = array("unique_id" => $album_id, "title" => $photoalbum_album[0]['album_name'], "description" => $photoalbum_album[0]['album_description'], "action_name" => "photoalbum_view_main_init", "parameters" => "album_id=" . $albumID . "&block_id=" . $photoalbum_block[0]['block_id'] . "#photoalbum_album" . $id . "_" . $album_id, "count_num" => $photoSequence, "insert_time" => timezone_date()); $result = $whatsnewAction->auto($whatsnew, _ON); if ($result === false) { return false; } } } //--新着情報関連 End-- return true; }