Page
[ class tree: Page ] [ index: Page ] [ all elements ]

Source for file LC_Page_Admin_System_Delete.php

Documentation is available at LC_Page_Admin_System_Delete.php

  1. <?php
  2. /*
  3.  * This file is part of EC-CUBE
  4.  *
  5.  * Copyright(c) 2000-2011 LOCKON CO.,LTD. All Rights Reserved.
  6.  *
  7.  * http://www.lockon.co.jp/
  8.  *
  9.  * This program is free software; you can redistribute it and/or
  10.  * modify it under the terms of the GNU General Public License
  11.  * as published by the Free Software Foundation; either version 2
  12.  * of the License, or (at your option) any later version.
  13.  *
  14.  * This program is distributed in the hope that it will be useful,
  15.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  17.  * GNU General Public License for more details.
  18.  *
  19.  * You should have received a copy of the GNU General Public License
  20.  * along with this program; if not, write to the Free Software
  21.  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  22.  */
  23.  
  24. // {{{ requires
  25. require_once CLASS_EX_REALDIR 'page_extends/admin/LC_Page_Admin_Ex.php';
  26.  
  27. /**
  28.  * メンバー削除 のページクラス.
  29.  *
  30.  * @package Page
  31.  * @author LOCKON CO.,LTD.
  32.  * @version $Id: LC_Page_Admin_System_Delete.php 20970 2011-06-10 10:27:24Z Seasoft $
  33.  */
  34. class LC_Page_Admin_System_Delete extends LC_Page_Admin_Ex {
  35.  
  36.     // }}}
  37.     // {{{ functions
  38.  
  39.     /**
  40.      * Page を初期化する.
  41.      *
  42.      * @return void 
  43.      */
  44.     function init({
  45.         parent::init();
  46.     }
  47.  
  48.     /**
  49.      * Page のプロセス.
  50.      *
  51.      * @return void 
  52.      */
  53.     function process({
  54.         $this->action();
  55.         $this->sendResponse();
  56.     }
  57.  
  58.     /**
  59.      * Page のアクション.
  60.      *
  61.      * @return void 
  62.      */
  63.     function action({
  64.         $objFormParam new SC_FormParam;
  65.  
  66.         // パラメーターの初期化
  67.         $this->initParam($objFormParam$_GET);
  68.  
  69.         // パラメーターの検証
  70.         if ($objFormParam->checkError()
  71.             || !SC_Utils_ex::sfIsInt($id $objFormParam->getValue('id'))) {
  72.  
  73.             GC_Utils_Ex::gfPrintLog("error id=$id");
  74.             SC_Utils_Ex::sfDispError(INVALID_MOVE_ERRORR);
  75.         }
  76.  
  77.         $id $objFormParam->getValue('id');
  78.  
  79.         // レコードの削除
  80.         $this->deleteMember($id);
  81.  
  82.         // リダイレクト
  83.         $url $this->getLocation(ADMIN_SYSTEM_URLPATH)
  84.              . '?pageno=' $objFormParam->getValue('pageno');
  85.         SC_Response_Ex::sendRedirect($url);
  86.     }
  87.  
  88.     /**
  89.      * デストラクタ.
  90.      *
  91.      * @return void 
  92.      */
  93.     function destroy({
  94.         parent::destroy();
  95.     }
  96.  
  97.     /**
  98.      * パラメーター初期化.
  99.      *
  100.      * @param object $objFormParam 
  101.      * @param array  $arrParams  $_GET値
  102.      * @return void 
  103.      */
  104.     function initParam(&$objFormParam&$arrParams{
  105.  
  106.         $objFormParam->addParam('pageno''pageno'INT_LEN''array('NUM_CHECK''MAX_LENGTH_CHECK''EXIST_CHECK'));
  107.         $objFormParam->addParam('id''id'INT_LEN''array('NUM_CHECK''MAX_LENGTH_CHECK'));
  108.         $objFormParam->setParam($arrParams);
  109.  
  110.     }
  111.  
  112.     /**
  113.      * メンバー情報削除の為の制御.
  114.      *
  115.      * @param integer $id 削除対象のmember_id
  116.      * @return void 
  117.      */
  118.     function deleteMember($id{
  119.         $objQuery =SC_Query_Ex::getSingletonInstance();
  120.         $objQuery->begin();
  121.  
  122.         $this->renumberRank($objQuery$id);
  123.         $this->deleteRecode($objQuery$id);
  124.  
  125.         $objQuery->commit();
  126.     }
  127.  
  128.     /**
  129.      * ランキングの振り直し.
  130.      *
  131.      * @param object $objQuery 
  132.      * @param integer $id 削除対象のmember_id
  133.      * @return void|UPDATEの結果フラグ
  134.      */
  135.     function renumberRank(&$objQuery$id{
  136.  
  137.         // ランクの取得
  138.         $where1 "member_id = ?";
  139.         $rank $objQuery->get('rank'"dtb_member"$where1array($id));
  140.  
  141.         // Updateする値を作成する.
  142.         $where2 "rank > ? AND del_flg <> 1";
  143.  
  144.         // UPDATEの実行 - 削除したレコードより上のランキングを下げてRANKの空きを埋める。
  145.         return $objQuery->update("dtb_member"array()$where2array($rank)array('rank' => 'rank-1'));
  146.     }
  147.  
  148.     /**
  149.      * レコードの削除(削除フラグをONにする).
  150.      *
  151.      * @param object $objQuery 
  152.      * @param integer $id 削除対象のmember_id
  153.      * @return void|UPDATEの結果フラグ
  154.      */
  155.     function deleteRecode(&$objQuery$id{
  156.  
  157.         // Updateする値を作成する.
  158.         $sqlVal array();
  159.         $sqlVal['rank'0;
  160.         $sqlVal['del_flg'1;
  161.         $where "member_id = ?";
  162.  
  163.         // UPDATEの実行 - ランクを最下位にする、DELフラグON
  164.         return $objQuery->update("dtb_member"$sqlVal$wherearray($id));
  165.     }
  166. }
  167. ?>

Documentation generated on Fri, 24 Feb 2012 14:01:48 +0900 by Seasoft