shoppingmallv2 init...
This commit is contained in:
parent
8b3461349c
commit
086400f04b
@ -76,11 +76,56 @@ class ProductController extends AdminController
|
||||
}
|
||||
return $this->_viewDatas['fieldDatas']['cost'] - $this->_viewDatas['fieldDatas']['sale'];
|
||||
}
|
||||
|
||||
//Insert관련
|
||||
protected function insert_validate()
|
||||
{
|
||||
$this->_validation->setRules($this->_viewDatas['fieldRules']);
|
||||
if (!$this->_validation->withRequest($this->request)->run()) {
|
||||
throw new \Exception("{$this->_viewDatas['title']}의 검증 오류발생\n" . implode("\n", $this->_validation->getErrors()));
|
||||
}
|
||||
|
||||
//fieldData 적용
|
||||
$this->_viewDatas['fieldDatas'] = array();
|
||||
foreach ($this->_viewDatas['fields'] as $field) {
|
||||
$this->_viewDatas['fieldDatas'] = $this->getFieldFormData($field);
|
||||
}
|
||||
}
|
||||
protected function insert_process()
|
||||
{
|
||||
$this->_viewDatas['fieldDatas']['price'] = $this->calculate_price();
|
||||
return parent::insert_process();
|
||||
}
|
||||
|
||||
//Update관련
|
||||
protected function update_validate($entity)
|
||||
{
|
||||
//Upload된 파일 검증(photo)때문에 먼처 체크
|
||||
$this->_validation->setRules($this->_viewDatas['fieldRules']);
|
||||
if (!$this->_validation->withRequest($this->request)->run()) {
|
||||
throw new \Exception("{$this->_viewDatas['title']}의 검증 오류발생\n" . implode("\n", $this->_validation->getErrors()));
|
||||
}
|
||||
|
||||
//fieldData 적용
|
||||
$this->_viewDatas['fieldDatas'] = array();
|
||||
foreach ($this->_viewDatas['fields'] as $field) {
|
||||
$this->_viewDatas['fieldDatas'] = $this->getFieldFormData($field, $entity);
|
||||
}
|
||||
|
||||
//변견된 데이터 Log로 남기기
|
||||
foreach ($this->_viewDatas['fieldDatas'] as $field => $value) {
|
||||
if ($field != "passwd") { //보안위험성이 있으므로 passwd는 Log에 남기지 않는다.
|
||||
log_message(
|
||||
"info",
|
||||
sprintf(
|
||||
"{$field} 변경: ---원본--\n%s\n---변경---\n%s",
|
||||
$entity->$field,
|
||||
var_export($value, true)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
protected function update_process($entity)
|
||||
{
|
||||
$this->_viewDatas['fieldDatas']['price'] = $this->calculate_price();
|
||||
|
||||
@ -47,7 +47,7 @@ abstract class BaseController extends Controller
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
private $_validation = null;
|
||||
protected $_validation = null;
|
||||
protected $_model = null;
|
||||
protected $_session = null;
|
||||
protected $_viewPath = '';
|
||||
|
||||
@ -62,7 +62,7 @@ trait UpDownloadTrait
|
||||
$this->image_resize_process($upfile, "small_" . $uploaded_filename);
|
||||
$this->image_resize_process($upfile, "middle_" . $uploaded_filename, 50, 50);
|
||||
$this->image_resize_process($upfile, "large_" . $uploaded_filename, 100, 100);
|
||||
// $upfile->move(PATHS['UPLOAD_IMAGE'], $uploaded_filename);
|
||||
$upfile->move(PATHS['UPLOAD_IMAGE'], $uploaded_filename);
|
||||
//move시 중복된파일명이 있다면 파일명이 바뀌므로 여기서 한번더 파일명 확인 필요
|
||||
$uploaded_filename = $upfile->getName();
|
||||
} else {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user