コード例 #1
0
 /**
  * 行移動・追加処理
  * 
  * @return boolean true or false
  * @access	public
  */
 function InsertRow($page_id)
 {
     $this->page_id = $page_id;
     $time = timezone_date();
     $session =& $this->_container->getComponent("Session");
     $user_id = $session->getParameter("_user_id");
     $user_name = $session->getParameter("_handle");
     //前詰め処理(移動元)
     $result = $this->decrementRowNum();
     if (!$result) {
         return false;
     }
     if ($this->pre_row_len == 1) {
         //移動前の列が1つしかなかったので
         //列--
         $result = $this->decrementColNum();
         if (!$result) {
             return false;
         }
     }
     //前詰め処理(移動先)
     $params = array("update_time" => $time, "update_user_id" => $user_id, "update_user_name" => $user_name, "page_id" => $this->page_id, "block_id" => $this->block_id, "parent_id" => $this->parent_id, "col_num" => $this->col_num, "row_num" => $this->row_num - 1);
     $result = $this->incrementRowNum($params);
     if (!$result) {
         $this->_db->addError($this->_db->ErrorNo(), $this->_db->ErrorMsg());
         return false;
     }
     //オブジェクト取得
     $block =& $this->_container->getComponent("blocksView");
     //オブジェクト取得
     $block =& $this->_container->getComponent("blocksView");
     $main_block_obj =& $block->getBlockById($this->block_id);
     //UpdateRow
     if ($this->parent_id == 0) {
         $root_id = 0;
         $thread_num = 0;
     } else {
         $block_obj = $block->getBlockById($this->parent_id);
         if ($block_obj['root_id'] != 0) {
             $root_id = $block_obj['root_id'];
         } else {
             $root_id = $block_obj['block_id'];
         }
         $thread_num = $block_obj['thread_num'] + 1;
     }
     $params = array("col_num" => $this->col_num, "row_num" => $this->row_num, "thread_num" => $thread_num, "parent_id" => $this->parent_id, "root_id" => $root_id, "update_time" => $time, "update_user_id" => $user_id, "update_user_name" => $user_name, "block_id" => $this->block_id);
     $result = $this->_db->execute("UPDATE {blocks} SET col_num=?," . " row_num=?,thread_num=?,parent_id=?,root_id=?,update_time=?, update_user_id=?,update_user_name=?" . " WHERE block_id=?", $params);
     if ($result === false) {
         //エラーが発生した場合、エラーリストに追加
         $this->_db->addError();
         return false;
     }
     //更新したブロックの子供のroot_id更新処理
     if ($root_id == 0) {
         $root_id = $this->block_id;
     }
     if ($main_block_obj['action_name'] == "pages_view_grouping") {
         $this->_updRootIdByParentId($this->block_id, $root_id, $thread_num + 1);
     }
     //グループ化した空ブロック削除処理
     if ($this->pre_row_len == 1) {
         $this->delGroupingBlock($this->pre_parent_id);
     }
     return true;
 }