Example #1
0
 /**
  * ブロックIDからカウンタデータ取得
  *
  * @access	public
  */
 function getCounter()
 {
     $params = array($this->_request->getParameter("block_id"));
     $result = $this->_db->execute("SELECT " . " block_id," . " counter_digit," . " counter_num," . " show_type, " . " show_char_before," . " show_char_after," . " comment " . " FROM {counter} " . " WHERE block_id=?", $params);
     if (!$result) {
         return false;
     }
     return $result[0];
 }
 /**
  * カウンターをインクリメントする
  *
  * @return boolean true or false
  * @access	public
  */
 function incrementCounter()
 {
     $container =& DIContainerFactory::getContainer();
     $session =& $container->getComponent("Session");
     $params = array(timezone_date(), $session->getParameter("_site_id"), $session->getParameter("_user_id"), $session->getParameter("_handle"), $this->_request->getParameter("block_id"));
     $sql = "UPDATE {counter} SET " . "counter_num = counter_num + 1, " . "update_time = ?, " . "update_site_id = ?, " . "update_user_id = ?, " . "update_user_name = ? " . " WHERE block_id = ?";
     if (!$this->_db->execute($sql, $params)) {
         $this->_db->addError();
         return false;
     }
     return true;
 }
Example #3
0
 /**
  *
  * 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 or false
  * @access	public
  */
 function applyReceiverFiltering($receiver_user_id, $receiver_user_name, $receiver_auth_id, $receiver_id, $sender_id, $subject, $body)
 {
     $this->_request->setParameter("insert_user_id", $receiver_user_id);
     $filters = $this->_pmView->getFiltersInfoByInsertUserId();
     $options = array("receiver_user_id" => $receiver_user_id, "receiver_user_name" => $receiver_user_name, "receiver_auth_id" => $receiver_auth_id);
     $result = array();
     if (is_array($filters) && sizeof($filters) > 0) {
         $receivers = array($receiver_id);
         foreach ($filters as $filter) {
             if ($this->_checkFilterMatched($sender_id, $subject, $body, $filter)) {
                 for ($i = 0; $i < sizeof($filter["actions"]); $i++) {
                     $handle_func = $filter["actions"][$i]["func"];
                     $ret = $this->_pmFilterOperation->{$handle_func}($receivers, $filter["actions"][$i]["param"], $options);
                     if (is_array($ret)) {
                         $result = array_merge($result, $ret);
                     }
                 }
             }
         }
     }
     if (sizeof($result) > 0) {
         return $result;
     } else {
         return true;
     }
 }
Example #5
0
 /**
  * カテゴリリンクデータ配列を生成する
  *
  * @param	array	$recordSet	リンクADORecordSet
  * @param	array	$categories	カテゴリ配列
  * @return array	カテゴリリンクデータ配列
  * @access	private
  */
 function &_makeCategoryLinkArray(&$recordSet, &$categories)
 {
     $linklist = $this->_request->getParameter("linklist");
     $entry = $this->_request->getParameter("entry");
     if ($entry == _ON) {
         $categoryLinks = $categories;
     } else {
         $categoryLinks = array();
     }
     $container =& DIContainerFactory::getContainer();
     $actionChain =& $container->getComponent("ActionChain");
     $actionName = $actionChain->getCurActionName();
     $session =& $container->getComponent("Session");
     $authID = $session->getParameter("_auth_id");
     while ($row = $recordSet->fetchRow()) {
         $row["edit_authority"] = false;
         if ($linklist["link_authority"] && $this->_hasEditAuthority($row["insert_user_id"])) {
             $row["edit_authority"] = true;
         }
         $categoryID = $row["category_id"];
         if ($actionName != "linklist_view_main_search_result" && empty($categoryLinks[$categoryID])) {
             $categoryLinks[$categoryID] = $categories[$categoryID];
         }
         if ($authID < _AUTH_CHIEF) {
             $categoryLinks[$categoryID]["delete_authority"] = false;
         }
         $categoryLinks[$categoryID]["links"][] = $row;
     }
     return $categoryLinks;
 }
Example #6
0
 /**
  * CSVデータを設定する
  *
  * @param	array	$recordSet	ADORecordSet
  * @return boolean	true:正常、false:異常
  * @access	private
  */
 function _makeCSV(&$recordSet)
 {
     $container =& DIContainerFactory::getContainer();
     $filterChain =& $container->getComponent("FilterChain");
     $smartyAssign =& $filterChain->getFilterByName("SmartyAssign");
     $csvMain =& $container->getComponent("csvMain");
     $items = $this->_request->getParameter("items");
     $data = array();
     $data[] = $smartyAssign->getLang('registration_data_id');
     foreach ($items as $item) {
         $data[] = $item["item_name"];
     }
     $data[] = $smartyAssign->getLang("registration_entry_date");
     $csvMain->add($data);
     $datas = array();
     $fileDataFormat = $smartyAssign->getLang("registration_file_data_format");
     while ($row = $recordSet->fetchRow()) {
         $data = array();
         $data[] = $row['data_id'];
         foreach ($items as $item) {
             $key = "item_data_value" . $item["item_id"];
             $value = $row[$key];
             if (!empty($value) && $item["item_type"] == REGISTRATION_TYPE_FILE) {
                 $key = "file_name" . $item["item_id"];
                 $value = $row[$key] . sprintf($fileDataFormat, $value);
             }
             $data[] = $value;
         }
         $data[] = timezone_date_format($row["insert_time"], _FULL_DATE_FORMAT);
         $csvMain->add($data);
     }
     return $datas;
 }
 /**
  * 投票データを登録する
  *
  * @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;
 }
Example #8
0
 /**
  * 個人情報データを取得する
  *
  * @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;
 }
 /**
  * 解凍のデータベースに登録処理
  *
  * @return boolean
  * @access private
  */
 function execDecompress($params, $file_path = "")
 {
     if ($params["file_type"] == CABINET_FILETYPE_FILE) {
         $upload_params = array("room_id" => $this->_request->getParameter("room_id"), "module_id" => $this->_request->getParameter("module_id"), "unique_id" => $this->_request->getParameter("cabinet_id"), "file_name" => $params["file_name"] . "." . $params["extension"], "physical_file_name" => "", "file_path" => "cabinet/", "action_name" => "common_download_main", "file_size" => $params["size"], "mimetype" => $this->_uploadsView->mimeinfo("type", $params["file_name"] . "." . $params["extension"]), "extension" => $params['extension'], "garbage_flag" => _OFF);
         $upload_id = $this->_uploadsAction->insUploads($upload_params);
         if ($upload_id === false) {
             return false;
         }
         $result = $this->_uploadsView->getUploadById($upload_id);
         if ($result === false) {
             return false;
         }
         copy($file_path, FILEUPLOADS_DIR . $result[0]["file_path"] . $result[0]["physical_file_name"]);
         chmod(FILEUPLOADS_DIR . $result[0]["file_path"] . $result[0]["physical_file_name"], 0666);
         $params["upload_id"] = $upload_id;
     }
     $file_params = array("cabinet_id" => $this->_request->getParameter("cabinet_id"), "upload_id" => $params["upload_id"], "parent_id" => $params["parent_id"], "file_name" => $params["file_name"], "extension" => $params["extension"], "depth" => $params["depth"], "size" => $params["size"], "download_num" => 0, "file_type" => $params["file_type"], "display_sequence" => 0);
     $file_id = $this->_db->insertExecute("cabinet_file", $file_params, true, "file_id");
     if ($file_id === false) {
         return false;
     }
     $file_params = array("file_id" => $file_id, "comment" => "");
     $result = $this->_db->insertExecute("cabinet_comment", $file_params, true);
     if ($result === false) {
         return false;
     }
     return $file_id;
 }
Example #10
0
 /**
  * 入力データを削除する
  *
  * @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;
 }
Example #11
0
 /**
  * 新着データを登録する
  *
  * @return boolean	true or false
  * @access	public
  */
 function setWhatsnew()
 {
     $assignment = $this->_request->getParameter("assignment");
     if (empty($assignment)) {
         $assignmentView =& $this->_container->getComponent("assignmentView");
         $assignment = $assignmentView->getAssignment();
         if (empty($assignment)) {
             return false;
         }
     }
     $activity = intval($this->_request->getParameter("activity"));
     if ($activity == _ON) {
         $whatsnew_lang = ASSIGNMENT_START_WHATSNEW;
     } else {
         return true;
     }
     $whatsnewAction =& $this->_container->getComponent("whatsnewAction");
     $assignment_name = mb_substr($assignment["assignment_name"], 0, ASSIGNMENT_WHATSNEW_TITLE, INTERNAL_CODE);
     if ($assignment_name != $assignment["assignment_name"]) {
         $assignment_name .= _SEARCH_MORE;
     }
     $whatsnew = array("unique_id" => $assignment["assignment_id"], "title" => sprintf($whatsnew_lang, $assignment_name), "description" => "", "action_name" => "assignment_view_main_whatsnew", "parameters" => "assignment_id=" . $assignment["assignment_id"]);
     $result = $whatsnewAction->insert($whatsnew);
     if ($result === false) {
         return false;
     }
     return true;
 }
Example #12
0
 /**
  * タスクデータを削除する
  *
  * @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;
 }
Example #13
0
 /**
  * 投票データを登録する
  *
  * @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;
 }
Example #14
0
 /**
  * 権限判断用のSQLを取得する
  *
  * @return array array($from_sql, $where_sql), 権限判断用のSQL文
  * @access	private
  */
 function getAuthoritySQL()
 {
     $usersView =& $this->_container->getComponent('usersView');
     $from_sql = " FROM ({authorities},{users})" . " INNER JOIN {authorities_modules_link}" . " ON {authorities_modules_link}.module_id = " . $this->_request->getParameter("module_id") . " AND {authorities}.role_authority_id = {authorities_modules_link}.role_authority_id";
     $where_sql = " WHERE {users}.role_authority_id = {authorities}.role_authority_id";
     $where_sql .= " AND {authorities}.user_authority_id > " . _AUTH_GUEST;
     $where_sql .= $usersView->createSearchWhereString();
     $where_sql .= " AND {users}.active_flag = " . _USER_ACTIVE_FLAG_ON;
     return array($from_sql, $where_sql);
 }
Example #15
0
 /**
  * コメントデータを取得する
  *
  * @return array	コメントデータ配列
  * @access	public
  */
 function &getComment()
 {
     $params = array($this->_request->getParameter("comment_id"));
     $sql = "SELECT comment_id, photo_id, album_id, photoalbum_id, comment_value, insert_user_id " . "FROM {photoalbum_comment} " . "WHERE comment_id = ?";
     $comments = $this->_db->execute($sql, $params, 1, null, true, array($this, "_makeCommentArray"));
     if ($comments === false) {
         $this->_db->addError();
     }
     $comment = $comments[0];
     return $comment;
 }
Example #16
0
 /**
  * リンク番号データを変更する
  *
  * @return boolean	true or false
  * @access	public
  */
 function updateLinkSequence()
 {
     $drag = $this->_request->getParameter("drag");
     $drop = $this->_request->getParameter("drop");
     if ($drag["category_id"] == $drop["category_id"]) {
         $params = array($this->_request->getParameter("linklist_id"), $drag["category_id"], $drag["link_sequence"], $drop["link_sequence"]);
         if ($drag["link_sequence"] > $drop["link_sequence"]) {
             $sql = "UPDATE {linklist_link} " . "SET link_sequence = link_sequence + 1 " . "WHERE linklist_id = ? " . "AND category_id = ? " . "AND link_sequence < ? " . "AND link_sequence > ?";
         } else {
             $sql = "UPDATE {linklist_link} " . "SET link_sequence = link_sequence - 1 " . "WHERE linklist_id = ? " . "AND category_id = ? " . "AND link_sequence > ? " . "AND link_sequence <= ?";
         }
         $result = $this->_db->execute($sql, $params);
         if ($result === false) {
             $this->_db->addError();
             return false;
         }
         if ($drag["link_sequence"] > $drop["link_sequence"]) {
             $drop["link_sequence"]++;
         }
         $params = array($drop["link_sequence"], $drag["link_id"]);
         $sql = "UPDATE {linklist_link} " . "SET link_sequence = ? " . "WHERE link_id = ?";
         $result = $this->_db->execute($sql, $params);
         if ($result === false) {
             $this->_db->addError();
             return false;
         }
     } else {
         $params = array($this->_request->getParameter("linklist_id"), $drop["category_id"], $drop["link_sequence"]);
         $sql = "UPDATE {linklist_link} " . "SET link_sequence = link_sequence + 1 " . "WHERE linklist_id = ? " . "AND category_id = ? " . "AND link_sequence > ?";
         $result = $this->_db->execute($sql, $params);
         if ($result === false) {
             $this->_db->addError();
             return false;
         }
         $params = array($this->_request->getParameter("linklist_id"), $drag["category_id"], $drag["link_sequence"]);
         $sql = "UPDATE {linklist_link} " . "SET link_sequence = link_sequence - 1 " . "WHERE linklist_id = ? " . "AND category_id = ? " . "AND link_sequence > ?";
         $result = $this->_db->execute($sql, $params);
         if ($result === false) {
             $this->_db->addError();
             return false;
         }
         $drop["link_sequence"]++;
         $params = array($drop["link_sequence"], $drop["category_id"], $drag["link_id"]);
         $sql = "UPDATE {linklist_link} " . "SET link_sequence = ?, " . "category_id = ? " . "WHERE link_id = ?";
         $result = $this->_db->execute($sql, $params);
         if ($result === false) {
             $this->_db->addError();
             return false;
         }
     }
     return true;
 }
Example #17
0
 /**
  * 親記事ID、子記事ID、前記事ID、後記事IDを取得する
  *
  * @return array	親記事ID、子記事ID、前記事ID、後記事IDの配列
  * @access	public
  */
 function &getMoveData()
 {
     $postID = $this->_request->getParameter("post_id");
     $params = array($postID);
     $postIDArray = array(0, 0, 0, 0);
     $authorityFromSQL = $this->_getAuthorityFromSQL();
     $authorityWhereSQL = $this->_getAuthorityWhereSQL($params);
     // 親記事IDの取得
     $sql = "SELECT parent_id " . "FROM {bbs_post} P " . $authorityFromSQL . "WHERE post_id = ? " . $authorityWhereSQL;
     $result = $this->_db->execute($sql, $params, null, null, false);
     if (!$result) {
         $this->_db->addError();
         return $result;
     }
     $postIDArray[0] = $result[0][0];
     // 子記事IDの取得
     $sql = "SELECT post_id " . "FROM {bbs_post} P " . $authorityFromSQL . "WHERE parent_id = ? " . $authorityWhereSQL . "ORDER BY post_id";
     $result = $this->_db->execute($sql, $params, 1, null, false);
     if ($result === false) {
         $this->_db->addError();
         return $result;
     }
     if (count($result) > 0) {
         $postIDArray[1] = $result[0][0];
     }
     if (empty($postIDArray[0])) {
         return $postIDArray;
     }
     $params = array($postIDArray[0], $postID);
     $authorityWhereSQL = $this->_getAuthorityWhereSQL($params);
     // 前記事IDの取得
     $sql = "SELECT post_id " . "FROM {bbs_post} P " . $authorityFromSQL . "WHERE parent_id = ? " . "AND post_id < ? " . $authorityWhereSQL . "ORDER BY post_id DESC";
     $result = $this->_db->execute($sql, $params, 1, null, false);
     if ($result === false) {
         $this->_db->addError();
         return $result;
     }
     if (count($result) > 0) {
         $postIDArray[2] = $result[0][0];
     }
     // 後記事IDの取得
     $sql = "SELECT post_id " . "FROM {bbs_post} P " . $authorityFromSQL . "WHERE parent_id = ?" . "AND post_id > ? " . $authorityWhereSQL . "ORDER BY post_id";
     $result = $this->_db->execute($sql, $params, 1, null, false);
     if ($result === false) {
         $this->_db->addError();
         return $result;
     }
     if (count($result) > 0) {
         $postIDArray[3] = $result[0][0];
     }
     return $postIDArray;
 }
Example #18
0
 /**
  * 編集権限チェック
  *
  * @access	public
  */
 function _hasEditAuthority(&$file)
 {
     $_user_id = $this->_session->getParameter("_user_id");
     $_auth_id = $this->_session->getParameter("_auth_id");
     $_hierarchy = $this->_session->getParameter("_hierarchy");
     if ($_auth_id >= _AUTH_CHIEF) {
         return true;
     }
     if ($file["file_type"] == CABINET_FILETYPE_FOLDER && $this->childExists($file["file_id"])) {
         return false;
     }
     $authCheck =& $this->_container->getComponent("authCheck");
     $file_hierarchy = $authCheck->getPageHierarchy($file["insert_user_id"], $this->_request->getParameter("room_id"));
     if ($file["insert_user_id"] == $_user_id || $_hierarchy > $file_hierarchy) {
         return true;
     } else {
         return false;
     }
 }
Example #19
0
 /**
  * 集計データを登録する
  *
  * @return string	登録した集計ID
  * @access	public
  */
 function insertSummary()
 {
     $container =& DIContainerFactory::getContainer();
     $session =& $container->getComponent("Session");
     $questionnaireID = $this->_request->getParameter("questionnaire_id");
     $params = array($questionnaireID, $session->getParameter("_user_id"));
     $sql = "SELECT COUNT(summary_id) " . "FROM {questionnaire_summary} " . "WHERE questionnaire_id = ? " . "AND insert_user_id = ?";
     $counts = $this->_db->execute($sql, $params, 1, 0, false);
     if ($counts === false) {
         $this->_db->addError();
         return false;
     }
     $answerNumber = $counts[0][0] + 1;
     $params = array("questionnaire_id" => $questionnaireID, "answer_flag" => QUESTIONNAIRE_ANSWER_NONE_VALUE, "answer_number" => $answerNumber, "answer_time" => timezone_date());
     $summaryID = $this->_db->insertExecute("questionnaire_summary", $params, true, "summary_id");
     if ($summaryID === false) {
         return false;
     }
     return $summaryID;
 }
Example #20
0
 /**
  * 新着情報の削除
  *
  * @access	public
  */
 function delete($unique_id, $child_flag = 0)
 {
     $module_id = $this->_request->getParameter("module_id");
     $module_whatsnew =& $this->_modulesView->getModuleByDirname("whatsnew");
     if (!$module_whatsnew) {
         return true;
     }
     $sql = "SELECT whatsnew_id, insert_time FROM {whatsnew}" . " WHERE module_id=?" . " AND unique_id=?";
     $params = array("module_id" => $module_id, "unique_id" => $unique_id);
     $result = $this->_db->execute($sql, $params, null, null, true, array($this, "_deleteUser"));
     if ($result === false) {
         return false;
     }
     if ($child_flag == _OFF) {
         $result = $this->_db->deleteExecute("whatsnew", array("module_id" => $module_id, "unique_id" => $unique_id));
     } elseif (isset($result[0])) {
         $result = $this->_db->updateExecute("whatsnew", array("child_update_time" => $result[0]['insert_time'], "count_num" => 0), array("module_id" => $module_id, "unique_id" => $unique_id));
     }
     return true;
 }
Example #21
0
 /**
  * 個人情報データを取得する
  *
  * @return array	個人情報データ配列
  * @access	public
  */
 function &getPersonalAssignments()
 {
     $ownUserID = $this->_session->getParameter("_user_id");
     $otherUserID = $this->_request->getParameter("user_id");
     $pagesView =& $this->_container->getComponent("pagesView");
     if ($ownUserID != $otherUserID) {
         $ownRoomIDs = $pagesView->getRoomIdByUserId($ownUserID);
         $otherRoomIDs = $pagesView->getRoomIdByUserId($otherUserID, _AUTH_GENERAL);
         $roomIDs = array_intersect($otherRoomIDs, $ownRoomIDs);
     } else {
         $roomIDs = $pagesView->getRoomIdByUserId($ownUserID, _AUTH_GENERAL);
     }
     if (empty($roomIDs)) {
         return $roomIDs;
     }
     $sql = "SELECT Assign.room_id, Assign.assignment_name, Assign.icon_name, " . "Assign.activity, Assign.period, Assign.grade_authority, " . "Assign.insert_time, Assign.insert_user_id, " . "Submitter.submit_flag, Submitter.grade_value, " . "Submitter.insert_user_id AS submit_user_id, Submitter.update_time AS submit_update_time," . "Page.page_name, AssignBlock.block_id" . " FROM {assignment_block} AssignBlock" . " INNER JOIN {blocks} Block ON (AssignBlock.block_id = Block.block_id)" . " INNER JOIN {assignment} Assign ON (AssignBlock.assignment_id = Assign.assignment_id)" . " INNER JOIN {pages} Page ON (Assign.room_id = Page.page_id)" . " LEFT JOIN {assignment_submitter} Submitter" . " ON (Assign.assignment_id = Submitter.assignment_id AND Submitter.insert_user_id = ?)" . " WHERE Assign.room_id IN (" . implode(",", $roomIDs) . ")" . " GROUP BY Assign.assignment_id" . " ORDER BY Assign.room_id, Assign.assignment_id DESC";
     $params = array("insert_user_id" => $otherUserID);
     $personalAssignments = $this->_db->execute($sql, $params, null, null, true, array($this, "_makePersonalAssignments"), $roomIDs);
     if ($personalAssignments === false) {
         $this->_db->addError();
         return $personalAssignments;
     }
     return $personalAssignments;
 }
Example #22
0
 /**
  * CSVデータを設定する
  *
  * @param	array	$recordSet	ADORecordSet
  * @param	array	$params[0]	質問データ配列
  * @param	array	$params[1]	集計データ配列
  * @return boolean	true:正常、false:異常
  * @access	private
  */
 function _makeCSV(&$recordSet, &$params)
 {
     $container =& DIContainerFactory::getContainer();
     $filterChain =& $container->getComponent("FilterChain");
     $smartyAssign =& $filterChain->getFilterByName("SmartyAssign");
     $csvMain =& $container->getComponent("csvMain");
     $data = array($smartyAssign->getLang("questionnaire_answerer"), $smartyAssign->getLang("questionnaire_answer_date"), $smartyAssign->getLang("questionnaire_answer_number"), $smartyAssign->getLang("questionnaire_question_number"), $smartyAssign->getLang("questionnaire_question_title"), $smartyAssign->getLang("questionnaire_answer_title"));
     $csvMain->add($data);
     $questions = $params[0];
     $summaries = $params[1];
     $questionnaire = $this->_request->getParameter("questionnaire");
     $anonymity = $questionnaire["anonymity_flag"];
     while ($row = $recordSet->fetchRow()) {
         $questionID = $row["question_id"];
         $question = $questions[$questionID];
         $summaryID = $row["summary_id"];
         $summary = $summaries[$summaryID];
         if ($question["question_type"] != QUESTIONNAIRE_QUESTION_TYPE_TEXTAREA_VALUE) {
             $choiceValues = array();
             $answerValues = $this->getAnswerValues($row["answer_value"], $question["choices"]);
             foreach (array_keys($answerValues) as $choiceID) {
                 if ($answerValues[$choiceID] == _ON) {
                     $choiceValues[] = $question["choices"][$choiceID]["choice_value"];
                 }
             }
             $row["answer_value"] = implode(",", $choiceValues);
         }
         if ($anonymity == _ON) {
             $summary["insert_user_name"] = $smartyAssign->getLang("questionnaire_anonymity_name");
             $summary["answer_number"] = "";
         }
         $data = array($summary["insert_user_name"], timezone_date_format($summary["answer_time"], _FULL_DATE_FORMAT), $summary["answer_number"], $question["question_sequence"], $question["question_value"], $row["answer_value"]);
         $csvMain->add($data);
     }
     return true;
 }
Example #23
0
 /**
  * 新着情報の更新
  *
  * @access	public
  */
 function setWhatsnew()
 {
     //--新着情報関連 Start--
     $whatsnewAction =& $this->_container->getComponent("whatsnewAction");
     $user_id = $this->_session->getParameter("_user_id");
     $user_name = $this->_session->getParameter("_handle");
     $block_id = $this->_reservationView->getBlockIdByWhatsnew();
     $reserve_id = $this->_request->getParameter("reserve_id");
     $reserve = $this->_reservationView->getReserve($reserve_id);
     if ($reserve === false) {
         return false;
     }
     $location = $this->_request->getParameter("location");
     $result = $whatsnewAction->delete($reserve["reserve_details_id"]);
     if ($result === false) {
         return false;
     }
     $whatsnew_description = "";
     $whatsnew_description .= sprintf(RESERVATION_WHATSNEW_LOCATION, $location["location_name"]);
     if ($reserve["start_date_view"] == $reserve["end_date_view"]) {
         $whatsnew_description .= sprintf(RESERVATION_WHATSNEW_TIME_FMTO, $reserve["start_date_str"] . " " . $reserve["start_time_str"], $reserve["end_time_str"]);
     } else {
         $whatsnew_description .= sprintf(RESERVATION_WHATSNEW_TIME_FMTO, $reserve["start_date_str"] . " " . $reserve["start_time_str"], $reserve["end_date_str"] . " " . $reserve["end_time_str"]);
     }
     if (!empty($reserve["contact"])) {
         $whatsnew_description .= sprintf(RESERVATION_WHATSNEW_CONTACT, $reserve["contact"]);
     }
     if (!empty($reserve["description"])) {
         $whatsnew_description .= sprintf(RESERVATION_WHATSNEW_DESCRIPTION, $reserve["description"]);
     }
     if (!empty($reserve["rrule_str"])) {
         $whatsnew_description .= sprintf(RESERVATION_WHATSNEW_RRULE, $reserve["rrule_str"]);
     }
     $whatsnew = array("room_id" => $reserve["room_id"], "unique_id" => $reserve["reserve_details_id"], "title" => $reserve["title"] . " ", "description" => $whatsnew_description, "action_name" => "reservation_view_main_init", "parameters" => "reserve_details_id=" . $reserve["reserve_details_id"] . "&block_id=" . $block_id . "#_" . $block_id);
     $actionChain =& $this->_container->getComponent("ActionChain");
     $actionName = $actionChain->getCurActionName();
     if ($actionName == "reservation_action_main_reserve_modify") {
         $whatsnew["insert_time"] = $reserve["insert_time"];
         $whatsnew["insert_user_id"] = $reserve["insert_user_id"];
         $whatsnew["insert_user_name"] = $reserve["insert_user_name"];
     }
     if ($reserve["room_id"] == 0 && $location["allroom_flag"] == _OFF) {
         if ($location["use_private_flag"] == _ON) {
             $whatsnew["user_id"] = $user_id;
             $whatsnew["authority_id"] = _AUTH_ADMIN;
             $result = $whatsnewAction->insert($whatsnew, _ON);
             if ($result === false) {
                 return false;
             }
         }
         $whatsnew["authority_id"] = _AUTH_GUEST;
         $select_rooms = $this->_reservationView->getLocationRoom($location["location_id"]);
         if (empty($select_rooms)) {
             $select_rooms = array();
         }
         $whatsnew["user_id"] = 0;
         $whatsnew["room_id"] = $select_rooms;
     }
     $result = $whatsnewAction->insert($whatsnew, _ON);
     if ($result === false) {
         return false;
     }
     //--新着情報関連 End--
     return true;
 }
Example #24
0
 /**
  * 検索を取得
  *
  * @access	public
  */
 function _getSearchSQL($sql, $search_where)
 {
     $location_list = $this->_request->getParameter("location_list");
     $sql .= " FROM {reservation_reserve} reserve" . " INNER JOIN {reservation_location} location ON (reserve.location_id=location.location_id)" . " LEFT JOIN {reservation_reserve_details} details ON (reserve.reserve_details_id=details.reserve_details_id)" . " LEFT JOIN {pages} page ON (reserve.room_id=page.page_id)" . " WHERE 1=1" . " " . $search_where . " AND reserve.location_id IN (" . implode(",", $location_list) . ") ";
     return $sql;
 }
Example #25
0
 /**
  * タスクデータ配列を生成する
  *
  * @param	array	$recordSet	タスクADORecordSet
  * @param	string	$format		日付フォーマット文字列
  * @return array	タスクデータ配列
  * @access	private
  */
 function &_makeTaskArray(&$recordSet, $funcParams = array())
 {
     $todo = $this->_request->getParameter("todo");
     if (!empty($funcParams["format"])) {
         $format = $funcParams["format"];
     } else {
         $format = _DATE_FORMAT;
     }
     if (!empty($funcParams["array_key"])) {
         $array_key = $funcParams["array_key"];
     } else {
         $array_key = "";
     }
     $tasks = array();
     while ($row = $recordSet->fetchRow()) {
         $row["category_id"] = isset($row["category_id"]) ? intval($row["category_id"]) : 0;
         $row["edit_authority"] = false;
         if ($todo["task_authority"] && $this->_hasEditAuthority($row["insert_user_id"])) {
             $row["edit_authority"] = true;
         }
         if (!empty($row["period"])) {
             $period = timezone_date_format($row["period"], null);
             if (substr($period, 8) == "000000") {
                 $previousDay = -1;
                 $format = str_replace("H", "24", $format);
                 $timeFormat = str_replace("H", "24", _SHORT_TIME_FORMAT);
             } else {
                 $previousDay = 0;
                 $timeFormat = _SHORT_TIME_FORMAT;
             }
             $date = mktime(intval(substr($period, 8, 2)), intval(substr($period, 10, 2)), intval(substr($period, 12, 2)), intval(substr($period, 4, 2)), intval(substr($period, 6, 2)) + $previousDay, intval(substr($period, 0, 4)));
             $row["display_period_date"] = date($format, $date);
             $row["display_period_time"] = date($timeFormat, $date);
             if ($this->_mobile_flag == _ON) {
                 $row["year"] = date("Y", $date);
                 $row["month"] = date("m", $date);
                 $row["day"] = date("d", $date);
             }
             if (!isset($thisDate)) {
                 $thisDate = timezone_date_format(null, null);
                 $soonDate = mktime(0, 0, 0, intval(substr($thisDate, 4, 2)), intval(substr($thisDate, 6, 2)) + $todo["soon_period"], intval(substr($thisDate, 0, 4)));
                 $thisDate = timezone_date_format(null, $format);
                 $soonDate = date($format, $soonDate);
             }
             if ($thisDate > $row["display_period_date"]) {
                 $row["period_class_name"] = TODO_PERIOD_CLASS_NAME_OVER;
             } elseif ($soonDate >= $row["display_period_date"]) {
                 $row["period_class_name"] = TODO_PERIOD_CLASS_NAME_SOON;
             }
         }
         if ($array_key == "category") {
             if (!isset($tasks[$row["category_id"]])) {
                 $tasks[$row["category_id"]] = array();
             }
             $tasks[$row["category_id"]][] = $row;
         } else {
             $tasks[] = $row;
         }
     }
     return $tasks;
 }
Example #26
0
 function &pager($query = array(), $display_count = 20, $count_key = '*', $page_holder = 'page')
 {
     $this->display_count = $display_count;
     $this->count_key = $count_key;
     $this->page_holder = $page_holder;
     $pager = array();
     $sql = $query['sql'];
     $params = $query['params'];
     $page = $this->_request->getParameter($this->page_holder);
     if (empty($page) || !is_numeric($page)) {
         $page = 1;
     }
     $this->current_page = $page;
     $pos_to = strlen($sql);
     $pos_from = strpos($sql, ' FROM', 0);
     $pos_group_by = strpos($sql, ' GROUP BY', $pos_from);
     if ($pos_group_by < $pos_to && $pos_group_by != false) {
         $pos_to = $pos_group_by;
     }
     $pos_having = strpos($sql, ' HAVING', $pos_from);
     if ($pos_having < $pos_to && $pos_having != false) {
         $pos_to = $pos_having;
     }
     $pos_order_by = strpos($sql, ' ORDER BY', $pos_from);
     if ($pos_order_by < $pos_to && $pos_order_by != false) {
         $pos_to = $pos_order_by;
     }
     if (strpos(strtoupper($sql), 'DISTINCT') || strpos(strtoupper($sql), 'GROUP BY')) {
         $count_string = 'DISTINCT ' . trim($this->count_key);
     } else {
         $count_string = trim($this->count_key);
     }
     $sql = "SELECT count(" . $count_string . ") as cnt " . substr($sql, $pos_from, $pos_to - $pos_from);
     $counts = $this->_db->execute($sql, $params);
     if (!$counts) {
         $this->_db->addError();
         return $pager;
     }
     $this->total_rows = $counts[0]['cnt'];
     $this->total_pages = ceil($this->total_rows / $this->display_count);
     if ($this->current_page > $this->total_pages) {
         $this->current_page = $this->total_pages;
     }
     $this->prev_page = $this->current_page - 1;
     if ($this->prev_page <= 0) {
         $this->prev_page = 0;
     }
     $this->next_page = $this->current_page + 1;
     if ($this->next_page > $this->total_pages) {
         $this->next_page = 0;
     }
     if ($this->total_rows > 0) {
         $this->display_from = ($this->current_page - 1) * $this->display_count + 1;
         if ($this->current_page < $this->total_pages) {
             $this->display_rows = $this->display_count;
         } else {
             $this->display_rows = $this->total_rows - ($this->current_page - 1) * $this->display_count;
         }
         $this->display_to = $this->display_from + $this->display_rows - 1;
     } else {
         $this->display_rows = 0;
         $this->display_from = 0;
         $this->display_to = 0;
     }
     $pager = array('prev_page' => $this->prev_page, 'next_page' => $this->next_page, 'current_page' => $this->current_page, 'total_rows' => $this->total_rows, 'total_pages' => $this->total_pages, 'display_count' => $this->display_count, 'display_rows' => $this->display_rows, 'display_from' => $this->display_from, 'display_to' => $this->display_to);
     return $pager;
 }