- Timestamp:
- 2008/02/15 21:47:58 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/version-2/data/class/pages/mypage/LC_Page_Mypage_Delivery.php
r16582 r17062 64 64 $objView = new SC_SiteView(); 65 65 $objCustomer = new SC_Customer(); 66 $objQuery = new SC_Query();67 $objConn = new SC_DBConn();68 66 69 67 //ログイン判定 … … 81 79 $objLayout->sfGetPageLayout($this, false, "mypage/index.php"); 82 80 83 if (!isset($_POST['mode'])) $_POST['mode'] = ""; 81 $mode = isset($_POST['mode']) ? $_POST['mode'] : ''; 82 $customerId = $objCustomer->getValue('customer_id'); 84 83 85 //削除 86 if($_POST['mode'] == 'delete') { 87 //不正アクセス判定 88 $flag = $objQuery->count("dtb_other_deliv", "customer_id=? AND other_deliv_id=?", array($objCustomer->getValue('customer_id'), $_POST['other_deliv_id'])); 89 if($flag > 0) { 90 //削除 91 $objQuery->delete("dtb_other_deliv", "other_deliv_id=?", array($_POST['other_deliv_id'])); 92 } else { 84 switch($mode) { 85 86 // お届け先の削除 87 case 'delete': 88 $objForm = $this->initParam(); 89 if ($objForm->checkError()) { 93 90 SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR); 91 exit; 94 92 } 93 94 $this->deleteOtherDeliv($customerId, $objForm->getValue('other_deliv_id')); 95 break; 96 97 // お届け先の表示 98 default: 99 break; 95 100 } 96 101 97 $this->tpl_pageno = isset($_POST['pageno']) ? $_POST['pageno'] : ""; 102 //別のお届け先情報 103 $this->arrOtherDeliv = $this->getOtherDeliv($customerId); 98 104 99 $from = "dtb_other_deliv"; 100 $where = "customer_id=?"; 101 $arrval = array($objCustomer->getValue('customer_id')); 102 $order = "other_deliv_id DESC"; 103 104 //お届け先登録件数取得 105 $linemax = $objQuery->count($from, $where, $arrval); 106 107 $this->tpl_linemax = $linemax; 108 109 // 表示順序 110 $objQuery->setorder($order); 111 112 //別のお届け先情報表示 113 $this->arrOtherDeliv = $objQuery->select("*", $from, $where, $arrval); 114 115 //お届け先登録数をテンプレートに渡す 116 $objPge->deliv_cnt = count($this->arrOtherDeliv); 105 //お届け先登録数 106 $this->tpl_linemax = count($this->arrOtherDeliv);; 117 107 118 108 $objView->assignobj($this); … … 128 118 parent::destroy(); 129 119 } 120 121 /** 122 * フォームパラメータの初期化 123 * 124 * @return SC_FormParam 125 */ 126 function initParam() { 127 $objForm = new SC_FormParam(); 128 $objForm->addParam('お届け先ID', 'other_deliv_id', INT_LEN, '', array('EXIST_CHECK', 'NUM_CHECK', 'MAX_LENGTH_CHECK')); 129 $objForm->setParam($_POST); 130 $objForm->convParam(); 131 return $objForm; 132 } 133 134 /** 135 * お届け先の取得 136 * 137 * @param integer $customerId 138 * @return array 139 */ 140 function getOtherDeliv($customerId) { 141 $objQuery = new SC_Query; 142 $objQuery->setorder('other_deliv_id DESC'); 143 $arrRet = $objQuery->select('*', 'dtb_other_deliv', 'customer_id = ?', array($customerId)); 144 return empty($arrRet) ? array() : $arrRet; 145 } 146 147 /** 148 * お届け先の削除 149 * 150 * @param integer $customerId 151 * @param integer $delivId 152 */ 153 function deleteOtherDeliv($customerId, $delivId) { 154 $where = 'customer_id = ? AND other_deliv_id = ?'; 155 $objQuery = new SC_Query; 156 $objQuery->delete("dtb_other_deliv", $where, array($customerId, $delivId)); 157 } 130 158 } 131 159 ?>
Note: See TracChangeset
for help on using the changeset viewer.