/**
  * タスクデータを削除する
  *
  * @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 setGradeValue()
 {
     $params = array("room_id" => $this->_request->getParameter("room_id"));
     $result = $this->_db->deleteExecute("assignment_grade_value", $params);
     if ($result === false) {
         return false;
     }
     $grade_values = $this->_request->getParameter("grade_value");
     if (empty($grade_values)) {
         return true;
     }
     $disp_seq = 0;
     foreach ($grade_values as $i => $grade_value) {
         if (empty($grade_value)) {
             continue;
         }
         $disp_seq++;
         $params = array("grade_value" => $grade_value, "display_sequence" => $disp_seq);
         $result = $this->_db->insertExecute("assignment_grade_value", $params, true);
         if (!$result) {
             return false;
         }
     }
     return true;
 }
 /**
  * 入力データを削除する
  *
  * @return boolean	true or false
  * @access	public
  */
 function deleteData()
 {
     $dataID = $this->_request->getParameter("data_id");
     $params = array("registration_id" => $this->_request->getParameter("registration_id"));
     $where = "WHERE ID.registration_id = ? ";
     if (!empty($dataID)) {
         $params["data_id"] = $dataID;
         $where .= "AND ID.data_id = ?";
     }
     $sql = $this->_getFileSQL() . $where;
     $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;
     }
     if (!$this->_db->deleteExecute("registration_data", $params)) {
         return false;
     }
     return true;
 }
 /**
  * コメントデータを削除する
  *
  * @return boolean	true or false
  * @access	public
  */
 function deleteComment()
 {
     $params = array("comment_id" => $this->_request->getParameter("comment_id"));
     if (!$this->_db->deleteExecute("photoalbum_comment", $params)) {
         return false;
     }
     return true;
 }
 /**
  * 権限モジュールリンクテーブルDelete
  * 
  * @param   int   $authority_id	    権限ID
  * @param   int   $module_id       モジュールID
  * @return boolean true or false
  * @access	public
  */
 function delAuthorityModuleLink($where_params)
 {
     $result = $this->_db->deleteExecute("authorities_modules_link", $where_params);
     if ($result === false) {
         $this->_db->addError();
         return $result;
     }
     return true;
 }
 /**
  * ConfigValue削除処理
  * @return boolean true or false
  * @access	public
  **/
 function delConfigValue($conf_modid, $conf_name)
 {
     $params = array("conf_modid" => $conf_modid, "conf_name" => $conf_name);
     $result = $this->_db->deleteExecute("config", $params);
     if ($result === false) {
         return $result;
     }
     return true;
 }
 /**
  * items_optionsテーブルDelete
  * 
  * @param   int   item_id       項目ID
  * @return boolean true or false
  * @access	public
  */
 function delItemOptionsById($item_id)
 {
     $params = array("item_id" => $item_id);
     $result = $this->_db->deleteExecute("items_options", $params);
     if ($result === false) {
         $this->_db->addError();
         return $result;
     }
     return true;
 }
 /**
  * 新着情報の削除
  *
  * @access	public
  */
 function _deleteUser(&$recordSet)
 {
     $ret = array();
     while ($row = $recordSet->fetchRow()) {
         $result = $this->_db->deleteExecute("whatsnew_user", array("whatsnew_id" => $row["whatsnew_id"]));
         if ($result === false) {
             return false;
         }
         $ret[] = $row;
     }
     return $ret;
 }
 /**
  * abbreviate_urlから削除処理
  *
  * @param string $dir_name
  * @param string $room_id
  *
  * @return boolean
  * @access  public
  */
 function deleteUrlByRoom($room_id, $dir_name = null)
 {
     //dir_nameが省略されている場合、実行アクションから取得
     if (!isset($dir_name)) {
         $dir_name = $this->_abbreviateurlView->getDefaultUniqueKey();
     }
     $params = array('dir_name' => $dir_name, 'room_id' => $room_id);
     $result = $this->_db->deleteExecute('abbreviate_url', $params);
     if ($result === false) {
         return $result;
     }
     return $result;
 }
 /**
  * フイルタデータを削除する
  *
  * @return boolean	true or false
  * @access	public
  */
 function deleteFilter()
 {
     $user_id = $this->_session->getParameter("_user_id");
     $filter_id = $this->_request->getParameter("filter_id");
     $params = array("filter_id" => $filter_id, "insert_user_id" => $user_id);
     if (!$this->_db->deleteExecute("pm_filter_action_link", $params)) {
         return false;
     }
     if (!$this->_db->deleteExecute("pm_filter", $params)) {
         return false;
     }
     return true;
 }
 /**
  * ファイル削除処理
  *
  * @param  int    file_id
  * @return boolean
  * @access public
  */
 function delFile($file_id)
 {
     if ($file_id == 0) {
         return false;
     }
     $sql = "SELECT file_id FROM {cabinet_file} ";
     $sql .= "WHERE parent_id = ? ";
     $params = array("parent_id" => $file_id);
     $result = $this->_db->execute($sql, $params);
     if ($result === false) {
         return false;
     }
     if (!empty($result)) {
         foreach ($result as $i => $value) {
             $result = $this->delFile($value["file_id"]);
             if (!$result) {
                 return false;
             }
         }
     }
     $params = array("file_id" => $file_id);
     $result = $this->_db->selectExecute("cabinet_file", $params);
     if ($result === false) {
         return false;
     }
     if (!empty($result)) {
         $upload_id = $result[0]["upload_id"];
         $result = $this->_db->deleteExecute("cabinet_file", $params);
         if ($result === false) {
             return false;
         }
         $result = $this->_db->deleteExecute("cabinet_comment", $params);
         if ($result === false) {
             return false;
         }
         $result = $this->_uploadsAction->delUploadsById($upload_id);
         if ($result === false) {
             return false;
         }
     }
     //--新着情報関連 Start--
     $whatsnewAction =& $this->_container->getComponent("whatsnewAction");
     $result = $whatsnewAction->delete($file_id);
     if ($result === false) {
         return false;
     }
     //--新着情報関連 End--
     return true;
 }
 /**
  * ログアウト
  *
  * @access	public
  */
 function setLogout()
 {
     $mobile_info = $this->_session->getParameter("_mobile_info");
     if ($mobile_info["autologin"] != _AUTOLOGIN_OK) {
         return true;
     }
     $result = $this->_db->deleteExecute("mobile_users", array("user_id" => $this->_session->getParameter("_user_id")));
     if ($result === false) {
         return false;
     }
     $result = $this->_db->deleteExecute("mobile_users", array("tel_id" => $mobile_info["tel_id"]));
     if ($result === false) {
         return false;
     }
     return true;
 }
 /**
  * ルーム指定
  *
  * @access	public
  */
 function setSelectRoom()
 {
     $block_id = $this->_request->getParameter("block_id");
     $select_room = intval($this->_request->getParameter("select_room"));
     if ($select_room == _ON) {
         $not_enroll_room = $this->_session->getParameter(array("whatsnew", "not_enroll_room", $block_id));
         $enroll_room = $this->_session->getParameter(array("whatsnew", "enroll_room", $block_id));
         if (!isset($not_enroll_room) && !isset($enroll_room)) {
             $enroll_room = array($this->_session->getParameter("_main_room_id"));
         }
         $whatsnewView =& $this->_container->getComponent("whatsnewView");
         $whatsnew_obj = $whatsnewView->getBlock($block_id);
         if (!$whatsnew_obj) {
             return false;
         }
         if (!empty($whatsnew_obj["select_room_list"]) && !empty($not_enroll_room)) {
             foreach ($not_enroll_room as $i => $room_id) {
                 if (in_array($room_id, $whatsnew_obj["select_room_list"])) {
                     $params = array("block_id" => $block_id, "room_id" => $room_id);
                     $result = $this->_db->deleteExecute("whatsnew_select_room", $params);
                     if (!$result) {
                         return false;
                     }
                 }
             }
         }
         if (!empty($enroll_room)) {
             foreach ($enroll_room as $i => $room_id) {
                 if (empty($whatsnew_obj["select_room_list"]) || !in_array($room_id, $whatsnew_obj["select_room_list"])) {
                     $params = array("block_id" => $block_id, "room_id" => $room_id);
                     $result = $this->_db->insertExecute("whatsnew_select_room", $params);
                     if (!$result) {
                         return false;
                     }
                 }
             }
         }
     } else {
         $params = array("block_id" => $block_id);
         $result = $this->_db->deleteExecute("whatsnew_select_room", $params);
         if (!$result) {
             return false;
         }
     }
     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;
 }
 /**
  * サブグループがないルームデータを削除する
  *
  * @param string $roomId ルームID
  * @return boolean true or false
  * @access public
  */
 function deleteLowestRoom($roomId)
 {
     $pagesView =& $this->_container->getComponent('pagesView');
     $modules =& $pagesView->getUsableModulesByRoom($roomId);
     if ($modules === false) {
         return false;
     }
     if (!$this->deleteEachModule($roomId, $modules)) {
         return false;
     }
     if (!$this->deleteRoomModule($roomId, null)) {
         return false;
     }
     $columnValues = array('room_id' => $roomId);
     if (!$this->_db->deleteExecute('pages_users_link', $columnValues)) {
         return false;
     }
     $inValue = '';
     $sql = "SELECT page_id, " . "room_id, " . "parent_id, " . "display_sequence, " . "lang_dirname, " . "private_flag " . "FROM {pages} " . "WHERE room_id = ?";
     $pages =& $this->_db->execute($sql, $roomId);
     if ($pages === false) {
         $this->_db->addError();
         return false;
     }
     foreach ($pages as $page) {
         $inValue .= $page['page_id'] . ',';
         if ($page['page_id'] == $page['room_id']) {
             $parentId = $page['parent_id'];
             $sequence = $page['display_sequence'];
             $language = $page['lang_dirname'];
             $isPrivate = $page['private_flag'];
         }
     }
     if (empty($inValue)) {
         return false;
     }
     $inValue = substr($inValue, 0, -1);
     if (!$this->deletePagesByInOperator($inValue)) {
         return false;
     }
     if (!empty($parentId) && !$this->decrementDisplaySeq($parentId, $sequence, $language)) {
         return false;
     }
     return true;
 }
 function removeTrackback($post_id, $tb_url = "", $direction = "")
 {
     $params = array("root_id" => intval($post_id));
     if ($tb_url) {
         array_merge($params, array("tb_url" => $tb_url));
     }
     if ($direction) {
         array_merge($params, array("direction_flag" => $direction));
     }
     $result = $this->_db->deleteExecute("journal_post", $params);
     if ($result) {
         $this->tb_result[$tb_url] = true;
         return true;
     } else {
         $this->tb_result[$tb_url] = false;
         return false;
     }
 }
 /**
  * 記事データを削除する
  *
  * @param	stirng	$postID	記事ID
  * @return boolean	true or false
  * @access	public
  */
 function deletePost($postID)
 {
     $params = array("post_id" => $postID);
     if (!$this->_db->deleteExecute("bbs_post", $params)) {
         return false;
     }
     if (!$this->_db->deleteExecute("bbs_post_body", $params)) {
         return false;
     }
     if (!$this->_db->deleteExecute("bbs_user_post", $params)) {
         return false;
     }
     //--新着情報関連 Start--
     $container =& DIContainerFactory::getContainer();
     $whatsnewAction =& $container->getComponent("whatsnewAction");
     $result = $whatsnewAction->delete($postID);
     if ($result === false) {
         return false;
     }
     //--新着情報関連 End--
     //--URL短縮形関連 Start--
     $container =& DIContainerFactory::getContainer();
     $abbreviateurlAction =& $container->getComponent("abbreviateurlAction");
     $result = $abbreviateurlAction->deleteUrl($postID);
     if ($result === false) {
         return false;
     }
     //--URL短縮形関連 End--
     // 子記事IDを取得
     $sql = "SELECT post_id " . "FROM {bbs_post} " . "WHERE parent_id = ?";
     $posts = $this->_db->execute($sql, $params);
     if ($posts === false) {
         $this->_db->addError();
         return $posts;
     }
     // 子記事を再帰的に削除
     foreach ($posts as $post) {
         if (!$this->deletePost($post["post_id"])) {
             return false;
         }
     }
     return true;
 }
 /**
  * コンテンツのデータ削除処理
  * @param  int    metadata_content_id
  * @return boolean
  * @access public
  */
 function deleteMetadataContent($metadata_content_id)
 {
     if (empty($metadata_content_id)) {
         return false;
     }
     $params = array("metadata_content_id" => $metadata_content_id);
     $data = $this->_db->selectExecute("multidatabase_metadata_content", $params);
     if ($data === false) {
         return false;
     }
     if (isset($data[0])) {
         $metadata = $this->_db->selectExecute("multidatabase_metadata", array("metadata_id" => $data[0]['metadata_id']));
         if ($metadata === false) {
             return false;
         }
         if (isset($metadata[0])) {
             if ($metadata[0]['type'] == MULTIDATABASE_META_TYPE_FILE || $metadata[0]['type'] == MULTIDATABASE_META_TYPE_IMAGE) {
                 $result = $this->_db->deleteExecute("multidatabase_file", $params);
                 if ($result === false) {
                     return false;
                 }
                 //画像とファイル削除
                 if (!empty($data[0]['content'])) {
                     $pathList = explode("&", $data[0]['content']);
                     if (isset($pathList[1])) {
                         $upload_id = intval(str_replace("upload_id=", "", $pathList[1]));
                         if (!empty($upload_id)) {
                             $result = $this->_uploads->delUploadsById($upload_id);
                             if ($result === false) {
                                 return false;
                             }
                         }
                     }
                 }
             }
         }
         $result = $this->_db->deleteExecute("multidatabase_metadata_content", $params);
         if ($result === false) {
             return false;
         }
     }
     return true;
 }
 /**
  * 予定の変更
  *
  * @access	public
  */
 function _updateReserveByAfter(&$reserve_details_id, $start_time_full, $details_params)
 {
     $calendarAction =& $this->_container->getComponent("calendarAction");
     $reserve = $this->_request->getParameter("reserve");
     $sql = "DELETE FROM {reservation_reserve} " . "WHERE reserve_details_id = ? " . "AND start_time_full >= ? " . "AND reserve_id <> ?";
     $params = array("reserve_details_id" => $reserve_details_id, "start_time_full" => $start_time_full, "reserve_id" => $reserve["reserve_id"]);
     $result = $this->_db->execute($sql, $params);
     if ($result === false) {
         $this->addError();
         return false;
     }
     $sql = "SELECT COUNT(*) FROM {reservation_reserve} " . "WHERE reserve_details_id = ? " . "AND reserve_id <> ?";
     $params = array("reserve_details_id" => $reserve_details_id, "reserve_id" => $reserve["reserve_id"]);
     $result = $this->_db->execute($sql, $params, null, null, false);
     if ($result === false) {
         $this->_db->addError();
         return false;
     }
     if ($result[0][0] == 0) {
         $result = $this->_db->deleteExecute("reservation_reserve_details", array("reserve_details_id" => $reserve_details_id));
         if ($result === false) {
             return false;
         }
     } else {
         $rrule_arr = $reserve["rrule_arr"];
         $freq = $rrule_arr["FREQ"];
         $rrule_arr = $rrule_arr[$freq];
         $rrule_arr["FREQ"] = $freq;
         $timestamp = mktime(0, 0, 0, substr($start_time_full, 4, 2), substr($start_time_full, 6, 2) - 1, substr($start_time_full, 0, 4));
         $rrule_arr["UNTIL"] = date("Ymd", $timestamp) . "T" . substr($start_time_full, 8);
         $rrule_before_str = $calendarAction->concatRRule($rrule_arr);
         $result = $this->_db->updateExecute("reservation_reserve_details", array("rrule" => $rrule_before_str), array("reserve_details_id" => $reserve_details_id));
         if ($result === false) {
             return false;
         }
     }
     $reserve_details_id = $this->_db->insertExecute("reservation_reserve_details", $details_params, false, "reserve_details_id");
     if ($reserve_details_id === false) {
         return false;
     }
     return true;
 }
 /**
  * 予定と新着を一度全て削除。
  *
  * @access	public
  */
 function deletePlanAll($plan_room_id)
 {
     $params = array("room_id" => $plan_room_id);
     $allplan = $this->_db->selectExecute("calendar_plan", $params);
     $result = $this->_db->deleteExecute("calendar_plan", $params);
     if (!$result) {
         return false;
     }
     $result = $this->_db->deleteExecute("calendar_plan_details", $params);
     if (!$result) {
         return false;
     }
     foreach ($allplan as $plan) {
         $result = $this->setWhatsnew($plan);
         if (!$result) {
             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 deletePlan($calendar_id, $edit_rrule = 0)
 {
     $result =& $this->_db->selectExecute("calendar_plan", array("calendar_id" => $calendar_id));
     if (empty($result)) {
         return true;
     }
     $plan_id = $result[0]["plan_id"];
     $start_time_full = $result[0]["start_time_full"];
     $link_module = $result[0]["link_module"];
     if ($link_module != "") {
         $link_params["calendar_id"] = $result[0]["calendar_id"];
         $link_params["link_module"] = $result[0]["link_module"];
         $link_params["link_id"] = $result[0]["link_id"];
         $result = $this->clearLink($link_params);
         if ($result === false) {
             return false;
         }
     }
     if (defined("CALENDAR_PLAN_EDIT_ALL") && $edit_rrule == CALENDAR_PLAN_EDIT_ALL) {
         $params = array("plan_id" => $plan_id);
         $result =& $this->_db->selectExecute("calendar_plan", $params);
         if ($result === false) {
             return false;
         }
         foreach ($result as $i => $plan_obj) {
             if ($link_module != "") {
                 $link_params["calendar_id"] = $plan_obj["calendar_id"];
                 $link_params["link_module"] = $plan_obj["link_module"];
                 $link_params["link_id"] = $plan_obj["link_id"];
                 $result = $this->clearLink($link_params);
                 if ($result === false) {
                     return false;
                 }
             }
         }
         $result = $this->_db->deleteExecute("calendar_plan", $params);
     } elseif (defined("CALENDAR_PLAN_EDIT_AFTER") && $edit_rrule == CALENDAR_PLAN_EDIT_AFTER) {
         $params = array("plan_id" => $plan_id, "start_time_full" => $start_time_full);
         $sql = "SELECT * FROM {calendar_plan} " . "WHERE plan_id = ? " . "AND start_time_full >= ? ";
         $result = $this->_db->execute($sql, $params, null, null, true);
         if ($result === false) {
             return false;
         }
         foreach ($result as $i => $plan_obj) {
             if ($link_module != "") {
                 $link_params["calendar_id"] = $plan_obj["calendar_id"];
                 $link_params["link_module"] = $plan_obj["link_module"];
                 $link_params["link_id"] = $plan_obj["link_id"];
                 $result = $this->clearLink($link_params);
                 if ($result === false) {
                     return false;
                 }
             }
         }
         $sql = "DELETE FROM {calendar_plan} " . "WHERE plan_id = ? " . "AND start_time_full >= ? ";
         $params = array("plan_id" => $plan_id, "start_time_full" => $start_time_full);
         $result = $this->_db->execute($sql, $params);
         if ($result === false) {
             $this->addError();
             return false;
         }
         $result =& $this->_db->selectExecute("calendar_plan_details", array("plan_id" => $plan_id));
         if ($result === false) {
             return false;
         }
         $rrule_arr = $this->parseRRule($result[0]["rrule"]);
         $timestamp = mktime(0, 0, 0, substr($start_time_full, 4, 2), substr($start_time_full, 6, 2), substr($start_time_full, 0, 4));
         $rrule_arr["UNTIL"] = date("Ymd", $timestamp) . "T" . substr($start_time_full, 8);
         $rrule_str = $this->concatRRule($rrule_arr);
         $result = $this->_db->updateExecute("calendar_plan_details", array("rrule" => $rrule_str), array("plan_id" => $plan_id));
     } else {
         $params = array("calendar_id" => $calendar_id);
         $result = $this->_db->deleteExecute("calendar_plan", $params);
     }
     if ($result === false) {
         return false;
     }
     return true;
 }