/** * RSS用ブロックデータを登録する * * @param array $params 登録するRSS用ブロックデータ配列 * @return boolean true or false * @access public */ function insert($params = array()) { $params = $this->_serializeXml($params); $result = $this->_db->insertExecute("rss_block", $params, true); if (!$result) { $this->_db->addError(); return false; } return true; }
/** * itemを取得する * * @param int $item_id 項目ID * @return array * @access public */ function &getItems($where_params = null, $order_params = null, $limit = null, $offset = null, $func = null, $func_param = null) { $sql = "SELECT {items}.*, {items_options}.options,{items_options}.default_selected" . " FROM {items} " . " LEFT JOIN {items_options} ON ({items}.item_id={items_options}.item_id)"; $sql .= $this->_db->getWhereSQL($params, $where_params); $sql .= $this->_db->getOrderSQL($order_params); $result = $this->_db->execute($sql, $params, $limit, $offset, true, $func, $func_param); if ($result === false) { // エラーが発生した場合、エラーリストに追加 $this->_db->addError(); return $result; } return $result; }
/** * * RSS用ブロックデータが存在するかチェック * * @return boolean true:存在する,false:存在しない * @access public */ function rssExists() { $params = array($this->_request->getParameter("block_id")); $sql = "SELECT block_id " . "FROM {rss_block} " . "WHERE block_id = ?"; $result = $this->_db->execute($sql, $params, 1); if ($result === false) { $this->_db->addError(); return $result; } if (count($result) > 0) { return true; } return false; }
/** * カウンタが存在するか判断する * * @return boolean true:存在する、false:存在しない * @access public */ function counterExists() { $params = array($this->_request->getParameter("block_id")); $sql = "SELECT block_id " . "FROM {counter} " . "WHERE block_id = ?"; $blockIDs = $this->_db->execute($sql, $params); if ($blockIDs === false) { $this->_db->addError(); return $blockIDs; } if (count($blockIDs) > 0) { return true; } return false; }
/** * languageリストを取得する * * @param array $where_params Whereパラメータ引数 * @param array $order_params Orderパラメータ引数 * @param array $func 関数 * @param array $func_params Funcパラメータ引数 * @return array * @access public */ function &getLanguages($where_params = null, $order_params = null, $func = null, $func_param = null) { if (!isset($order_params)) { $order_params = array("{language}.display_sequence" => "ASC"); } $db_params = array(); $sql = $this->_db->getSelectSQL("language", $db_params, $where_params, $order_params); $result = $this->_db->execute($sql, $db_params, null, null, true, $func, $func_param); if (!$result) { $this->_db->addError(); return $result; } return $result; }
/** * 圧縮処理 * * @return boolean * @access private */ function _compressFile($parent_id, $folder_path = "") { $sql = "SELECT F.file_id, F.parent_id, F.file_type, F.file_name, F.extension, U.file_path, U.physical_file_name " . "FROM {cabinet_file} F " . "LEFT JOIN {uploads} U ON (F.upload_id=U.upload_id) "; $sql .= "WHERE F.cabinet_id = ? "; $sql .= "AND F.parent_id = ? "; $params = array("cabinet_id" => $this->_request->getParameter("cabinet_id"), "parent_id" => $parent_id); $files = $this->_db->execute($sql, $params); if ($files === false) { $this->_db->addError(); return false; } if (empty($files)) { return true; } foreach ($files as $i => $db_file) { if ($db_file["file_type"] == CABINET_FILETYPE_FOLDER) { $result = $this->_compressFile($db_file["file_id"], $folder_path . mb_convert_encoding($db_file["file_name"], $this->encode, "auto") . "/"); if ($result === false) { return $result; } } else { $physical_file = FILEUPLOADS_DIR . $db_file["file_path"] . $db_file["physical_file_name"]; $target_file = $folder_path . mb_convert_encoding($db_file["file_name"], $this->encode, "auto") . "." . $db_file["extension"]; if (file_exists($physical_file)) { $this->_source[] = File_Archive::read($physical_file, $target_file); //File_Archive::extract(File_Archive::read($physical_file, $target_file), $this->archive_full_path); } $cabinet = $this->_request->getParameter("cabinet"); if ($cabinet["compress_download"] == _ON) { $this->setDownload($db_file["file_id"]); } } } 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 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 array 個人情報データ配列 * @access public */ function &getPersonalSummaries() { $container =& DIContainerFactory::getContainer(); $session =& $container->getComponent("Session"); $ownUserID = $session->getParameter("_user_id"); $otherUserID = $this->_request->getParameter("user_id"); $pagesView =& $container->getComponent("pagesView"); if ($ownUserID != $otherUserID) { $ownRoomIDs = $pagesView->getRoomIdByUserId($ownUserID); $otherRoomIDs = $pagesView->getRoomIdByUserId($otherUserID, _AUTH_GUEST); $roomIDs = array_intersect($otherRoomIDs, $ownRoomIDs); } else { $roomIDs = $pagesView->getRoomIdByUserId($ownUserID, _AUTH_GUEST); } if (empty($roomIDs)) { return $roomIDs; } $params = array($this->_request->getParameter("user_id")); $sql = "SELECT Q.quiz_id, Q.room_id, Q.quiz_name, Q.perfect_score, " . "S.summary_id, S.answer_flag, S.answer_number, S.summary_score, S.answer_time, " . "P.page_name " . "FROM {quiz} Q " . "LEFT JOIN {quiz_summary} S " . "ON Q.quiz_id = S.quiz_id " . "AND S.insert_user_id = ? " . "INNER JOIN {pages} P " . "ON Q.room_id = P.page_id " . "WHERE Q.room_id IN (" . implode(",", $roomIDs) . ") " . "ORDER BY Q.room_id, Q.quiz_id DESC, S.answer_number"; $personalSummaries = $this->_db->execute($sql, $params, null, null, true, array($this, "_makePersonalSummaries"), $roomIDs); if ($personalSummaries === false) { $this->_db->addError(); return $personalSummaries; } return $personalSummaries; }
/** * アドレス切り替え取得 * * @access public */ function switchFolder() { $address = $this->_request->getParameter("address"); if ($address == "") { return "0"; } $addressArr = explode("/", $address); if (count($addressArr) == 1) { return "0"; } $sql = "SELECT file_id, parent_id, depth" . " FROM {cabinet_file}" . " WHERE cabinet_id = ?" . " AND file_type = ?"; $params = array("cabinet_id" => $this->_request->getParameter("cabinet_id"), "file_type" => CABINET_FILETYPE_FOLDER); $sql_where = array(); foreach ($addressArr as $i => $file_name) { if ($i == 0) { continue; } $sql_where[] = "(depth = ? AND file_name = ?)"; $params["depth" . $i] = $i; $params["file_name" . $i] = $file_name; } $sql .= " AND (" . implode(" OR ", $sql_where) . ")"; $result = $this->_db->execute($sql, $params, null, null, true, array($this, "_switchFolder")); if ($result === false) { $this->_db->addError(); return $result; } return $result; }
/** * module_object(authority_module_link_object)の一覧を取得する * @return object module_object(authority_module_link_object) * @access public */ function &getAuthoritiesModulesLinkByAuthorityId($role_authority_id, $where_params = null, $order_params = null, $func = null, $func_param = null) { $db_params = array(); $sql_where = ""; if (isset($role_authority_id)) { $db_params[] = $role_authority_id; } if (!empty($where_params)) { foreach ($where_params as $key => $item) { $db_params[] = $item; $sql_where .= " AND " . $key . "=?"; } } $sql_order = ""; if (!isset($order_params)) { $order_params = array("{modules}.display_sequence" => "ASC"); } if (!empty($order_params)) { foreach ($order_params as $key => $item) { $sql_order .= "," . $key . " " . (empty($item) ? "ASC" : $item); } } $sql = ""; $sql .= "SELECT {modules}.*,{authorities_modules_link}.authority_id" . " FROM {modules}" . " LEFT JOIN {authorities_modules_link} ON ({modules}.module_id={authorities_modules_link}.module_id" . (isset($role_authority_id) ? " AND {authorities_modules_link}.role_authority_id=?)" : ")"); $sql .= " WHERE {modules}.disposition_flag=" . _ON; $sql .= $sql_where ? " AND " . substr($sql_where, 5) : ""; $sql .= $sql_order ? " ORDER BY " . substr($sql_order, 1) : ""; $result = $this->_db->execute($sql, $db_params, null, null, true, $func, $func_param); if ($result === false) { $this->_db->addError(); return $result; } return $result; }
/** * メールアドレスからユーザーIDを取得する * * @param string $mail メールアドレス * @param boolean $isActive 利用可能ユーザー対象フラグ * @return ユーザーID * @access private */ function &getUserIdByMail($mail, $isActive = false) { $userId = null; if (empty($mail)) { return $userId; } $sql = "SELECT UI.user_id " . "FROM {items} I " . "INNER JOIN {users_items_link} UI " . "ON I.item_id = UI.item_id "; if ($isActive) { $sql .= "INNER JOIN {users} U " . "ON UI.user_id = U.user_id "; } $sql .= "WHERE (I.type = ? " . "OR I.type = ?) " . "AND UI.content = ? "; $bindValues = array(USER_TYPE_EMAIL, USER_TYPE_MOBILE_EMAIL, $mail); if ($isActive) { $sql .= "AND U.active_flag = ? "; $bindValues[] = _USER_ACTIVE_FLAG_ON; } $users = $this->_db->execute($sql, $bindValues); if ($users === false) { $this->_db->addError(); } if (!empty($users)) { $userId = $users[0]['user_id']; } return $userId; }
/** * 投票データを登録する * * @return boolean true or false * @access public */ function vote() { $photoID = $this->_request->getParameter("photo_id"); $container =& DIContainerFactory::getContainer(); $session =& $container->getComponent("Session"); $userID = $session->getParameter("_user_id"); if (empty($userID)) { $votes = $session->getParameter("photoalbum_votes"); $votes[] = $photoID; $session->setParameter("photoalbum_votes", $votes); } else { $params = array("user_id" => $userID, "photo_id" => $photoID, "vote_flag" => _ON); if (!$this->_db->insertExecute("photoalbum_user_photo", $params, true)) { return false; } } $params = array($photoID); $sql = "UPDATE {photoalbum_photo} " . "SET photo_vote_count = photo_vote_count + 1 " . "WHERE photo_id = ?"; $result = $this->_db->execute($sql, $params); if ($result === false) { $this->_db->addError(); return false; } $params = array($this->_request->getParameter("album_id")); $sql = "UPDATE {photoalbum_album} " . "SET album_vote_count = album_vote_count + 1 " . "WHERE album_id = ?"; $result = $this->_db->execute($sql, $params); if ($result === false) { $this->_db->addError(); return false; } return true; }
/** * conf_nameよりConfig情報取得 * * @param int $conf_modid モジュールID * @param string $conf_name conf名 * @return array * @access public */ function &getConfigByConfname($conf_modid, $conf_name) { if (!$this->isMultiLanguage) { $where_params = array("conf_modid" => $conf_modid, "conf_name" => $conf_name); $configs =& $this->_db->selectExecute("config", $where_params); if ($configs === false) { return $configs; } } else { $params = array($this->_session->getParameter('_lang'), $conf_modid, $conf_name); $sql = $this->_getConfigSQL() . "AND C.conf_name = ?"; $configs = $this->_db->execute($sql, $params); if ($configs === false) { $this->_db->addError(); return $configs; } } if (empty($configs)) { $configs = null; return $configs; } $config = $configs[0]; if (isset($config['CLValue'])) { $config['conf_value'] = $config['CLValue']; } return $config; }
/** * 集計データを変更する * * @param string $summaryID 集計ID * @return boolean true or false * @access public */ function updateSummary($summaryID) { $params = array($summaryID); $updateParams["summary_id"] = $summaryID; $sql = "SELECT insert_time " . "FROM {questionnaire_answer} " . "WHERE summary_id = ? " . "ORDER BY answer_id DESC"; $insertTimes = $this->_db->execute($sql, $params, 1, null, false); if ($insertTimes === false) { $this->_db->addError(); return false; } $updateParams["answer_time"] = $insertTimes[0][0]; $sql = "SELECT MIN(questionnaire_id), COUNT(answer_id) " . "FROM {questionnaire_answer} " . "WHERE summary_id = ?"; $answers = $this->_db->execute($sql, $params, 1, null, false); if ($answers === false) { $this->_db->addError(); return false; } list($questionnaireID, $answerCount) = $answers[0]; $params = array("questionnaire_id" => $questionnaireID); $questionCount = $this->_db->countExecute("questionnaire_question", $params); $updateParams["answer_flag"] = QUESTIONNAIRE_ANSWER_DONE_VALUE; if ($answerCount < $questionCount) { $updateParams["answer_flag"] = QUESTIONNAIRE_ANSWER_NONE_VALUE; } if (!$this->_db->updateExecute("questionnaire_summary", $updateParams, "summary_id", true)) { return false; } return true; }
/** * 集計データを変更する * * @param string $summaryID 集計ID * @return boolean true or false * @access public */ function updateSummary($summaryID) { $params = array($summaryID); $updateParams["summary_id"] = $summaryID; $sql = "SELECT insert_time " . "FROM {quiz_answer} " . "WHERE summary_id = ? " . "ORDER BY answer_id DESC"; $insertTimes = $this->_db->execute($sql, $params, 1, null, false); if ($insertTimes === false) { $this->_db->addError(); return $insertTimes; } $updateParams["answer_time"] = $insertTimes[0][0]; $sql = "SELECT MIN(quiz_id), COUNT(answer_id), MIN(answer_flag), SUM(score) " . "FROM {quiz_answer} " . "WHERE summary_id = ?"; $answers = $this->_db->execute($sql, $params, 1, null, false); if ($answers === false) { $this->_db->addError(); return $answers; } list($quizID, $answerCount, $answerFlag, $updateParams["summary_score"]) = $answers[0]; $params = array("quiz_id" => $quizID); $questionCount = $this->_db->countExecute("quiz_question", $params); $updateParams["answer_flag"] = QUIZ_ANSWER_NOT_MARK_VALUE; if ($answerCount < $questionCount) { $updateParams["answer_flag"] = QUIZ_ANSWER_NONE_VALUE; } elseif ($answerFlag > QUIZ_ANSWER_SCORED_VALUE) { $updateParams["answer_flag"] = QUIZ_ANSWER_SCORED_VALUE; } if (!$this->_db->updateExecute("quiz_summary", $updateParams, "summary_id", true)) { return false; } return true; }
/** * 投票データを登録する * * @return boolean true or false * @access public */ function vote() { $postID = $this->_request->getParameter("post_id"); $container =& DIContainerFactory::getContainer(); $session =& $container->getComponent("Session"); $userID = $session->getParameter("_user_id"); if (empty($userID)) { $votes = $session->getParameter("bbs_votes"); $votes[] = $postID; $session->setParameter("bbs_votes", $votes); } else { $where = array("user_id" => $userID, "post_id" => $postID); $params = array("vote_flag" => _ON); $result = $this->_db->updateExecute("bbs_user_post", $params, $where); if ($result === false) { return false; } } $params = array($postID); $sql = "UPDATE {bbs_post} " . "SET vote_num = vote_num + 1 " . "WHERE post_id = ?"; $result = $this->_db->execute($sql, $params); if ($result === false) { $this->_db->addError(); return false; } return true; }
/** * カテゴリリンクデータ配列を取得する * * @return array カテゴリリンクデータ配列 * @access public */ function &getCategoryLinks() { $categories = $this->getCategories(); if (empty($categories)) { return $categories; } $linklist = $this->_request->getParameter("linklist"); $entry = $this->_request->getParameter("entry"); $search = $this->_request->getParameter("search"); $params = array($this->_request->getParameter("linklist_id")); $sql = "SELECT L.link_id, L.linklist_id, L.category_id, L.link_sequence, L.title, L.url, L.insert_user_id"; if ($entry == _ON || $linklist["display"] != LINKLIST_DISPLAY_DROPDOWN) { $sql .= ", " . "L.description"; } if ($linklist["view_count_flag"] == _ON) { $sql .= ", " . "L.view_count"; } $sql .= " " . "FROM {linklist_link} L " . "INNER JOIN {linklist_category} C " . "ON L.category_id = C.category_id " . "WHERE L.linklist_id = ? "; if (!empty($search)) { $sql .= "AND (L.title LIKE ? " . "OR L.description LIKE ?) "; $params[] = "%" . $search . "%"; $params[] = "%" . $search . "%"; } $sql .= "ORDER BY C.category_sequence, L.link_sequence"; $categoryLinks = $this->_db->execute($sql, $params, null, null, true, array($this, "_makeCategoryLinkArray"), $categories); if ($categoryLinks === false) { $this->_db->addError(); } return $categoryLinks; }
/** * 権限モジュールリンクテーブル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; }
/** * 条件に該当する短縮URLデータを削除する。 * * @param string $whereClause where句文字列 * @param array $bindValues バインド値配列 * @return boolean true or false * @access public */ function deleteByWhereClause($whereClause, $bindValues) { $sql = "DELETE FROM {abbreviate_url} " . "WHERE " . $whereClause; if (!$this->_db->execute($sql, $bindValues)) { $this->_db->addError(); return false; } return true; }
/** * sitesの一覧を取得する * * @param array $where_params Whereパラメータ引数 * @param array $order_params Orderパラメータ引数 * @param int $limit * @param int $start * @return array サイトリスト * @access public */ function &getSites($where_params = null, $order_params = array("{sites}.self_flag" => "DESC", "{sites}.url" => "ASC"), $limit = null, $offset = null) { $result = $this->_db->selectExecute("sites", $where_params, $order_params, $limit, $offset, array($this, "_getSites")); if ($result === false) { $this->_db->addError(); return $result; } return $result; }
/** * block_idによるMenuDetail削除処理 * * @return boolean true or false * @access public */ function delMenuDetailByPageId($page_id, $visibility_flag = _OFF) { $params = array("page_id" => $page_id, "visibility_flag" => $visibility_flag); $result = $this->_db->execute("DELETE FROM {mobile_menu_detail} WHERE page_id=? AND visibility_flag = ?" . " ", $params); if ($result === false) { $this->_db->addError(); return false; } return true; }
/** * 過去のMonthlynumberデータ削除処理 * 指定年より以前のデータを削除 * @param int year * @return boolean true or false * @access public */ function delMonthlynumberByYear($year) { $params = array("year" => $year); $result = $this->_db->execute("DELETE FROM {monthly_number} WHERE year<=?" . " ", $params); if ($result === false) { $this->_db->addError(); return $result; } return true; }
/** * block_idによるMenuDetail削除処理 * * @return boolean true or false * @access public */ function delMobileMenuDetailByPageId($page_id) { $params = array("page_id" => $page_id); $result = $this->_db->execute("DELETE FROM {mobile_menu_detail} WHERE page_id=? " . " ", $params); if ($result === false) { $this->_db->addError(); return false; } return true; }
/** * mobile_menu_detailリストを取得する * * @param array $where_params Whereパラメータ引数 * @param array $order_params Orderパラメータ引数 * @param array $func 関数 * @param array $func_params Funcパラメータ引数 * @return array * @access public */ function &getMenuDetail($where_params = null, $order_params = null, $func = null, $func_param = null) { $db_params = array(); $sql = $this->_db->getSelectSQL("mobile_menu_detail", $db_params, $where_params, $order_params); $result = $this->_db->execute($sql, $db_params, null, null, true, $func, $func_param); if ($result === false) { $this->_db->addError(); return $result; } return $result; }
/** * 予約の繰り返しのID取得 * * @access public */ function getRepeatReserveId($reserve_details_id) { $sql = "SELECT reserve_id" . " FROM {reservation_reserve}" . " WHERE reserve_details_id = ?"; $params = array("reserve_details_id" => $reserve_details_id); $result = $this->_db->execute($sql, $params, null, null, true, array($this, "_getRepeatReserveId")); if ($result === false) { $this->_db->addError(); return $result; } return $result; }
/** * 会員のルームアクセス状況一覧を取得する * @param int user_id * @return array key:room_id last_access_time * @access public */ function &getUserAccessTime($user_id) { $params = array("user_id" => $user_id); $sql = "SELECT {monthly_number}.user_id, {monthly_number}.room_id, {monthly_number}.update_time AS last_access_time " . " FROM {monthly_number} " . " WHERE {monthly_number}.user_id=? "; $result = $this->_db->execute($sql, $params, null, null, true, array($this, "_fetchcallbackUserAccessTime")); if ($result === false) { $this->_db->addError(); return $result; } return $result; }
/** * メール送信データを取得する * * @param string $summary_id 集計ID * @return array メール送信データ配列 * @access public */ function &getMail($summary_id) { $params[] = $summary_id; $sql = "SELECT S.summary_id, S.questionnaire_id, S.insert_user_name, S.answer_time, " . "Q.questionnaire_name, Q.mail_subject, Q.mail_body " . "FROM {questionnaire_summary} S " . "INNER JOIN {questionnaire} Q " . "ON S.questionnaire_id = Q.questionnaire_id " . "WHERE S.summary_id = ?"; $mails = $this->_db->execute($sql, $params); if ($mails === false) { $this->_db->addError(); return $mails; } return $mails[0]; }
/** * 期限切れ課題を終了に変更する * * @return boolean true or false * @access public */ function setPeriodOver() { $params = array("period" => timezone_date()); $sql = "UPDATE {assignment} SET activity = " . _OFF . " WHERE period != ''" . " AND activity = " . _ON . " AND period < ?"; $result = $this->_db->execute($sql, $params); if ($result === false) { $this->_db->addError(); return $result; } return true; }
/** * 携帯用ブロックデータを取得 * * @access public */ function getBlocksForMobile($room_id, $block_id_arr) { $sql = "SELECT regist.registration_id" . " FROM {registration} regist" . " INNER JOIN {registration_item} item ON (regist.registration_id=item.registration_id)" . " WHERE regist.room_id = ?" . " AND regist.active_flag = ?" . " AND item.item_type = ?" . " GROUP BY regist.registration_id"; $reg_no_list = $this->_db->execute($sql, array($room_id, _ON, REGISTRATION_TYPE_FILE), null, null, true, array($this, "_getNoListForMobile")); if ($reg_no_list === false) { $this->_db->addError(); return false; } $sql = "SELECT regist.*, block.block_id" . " FROM {registration} regist" . " INNER JOIN {registration_block} block ON (regist.registration_id=block.registration_id)" . " WHERE block.block_id IN (" . implode(",", $block_id_arr) . ")" . " AND regist.active_flag = " . _ON . (!empty($reg_no_list) ? " AND regist.registration_id NOT IN (" . implode(",", $reg_no_list) . ")" : "") . " GROUP BY regist.registration_id, block.block_id" . " ORDER BY block.insert_time DESC, block.registration_id DESC"; return $this->_db->execute($sql, null); }