diff --git a/app/Config/Constants.php b/app/Config/Constants.php index a45e15e..c98800b 100644 --- a/app/Config/Constants.php +++ b/app/Config/Constants.php @@ -154,6 +154,15 @@ define('SESSION_NAMES', [ 'CART' => 'cart' ]); define('AUTH_FIELDS', ['ID' => 'id', 'TITLE' => 'title', 'ROLE' => 'role']); +//Category관련 Role Fields +define('CATEGORY_ROLE_FIELDS', [ + 'ACCESS' => 'isaccess', + 'READ' => 'isread', + 'WRITE' => 'iswrite', + 'REPLY' => 'isreply', + 'UPLOAD' => 'isupload', + 'DOWNLOAD' => 'isdownload', +]); //인증 관련 define('AUTH_ADAPTERS', [ @@ -212,7 +221,7 @@ define('AUDIOS', [ //Default값 정의 define('DEFAULTS', [ - 'ROLE' => getenv('default.role') ?: "user", + 'ROLE' => getenv('default.role') ?: "guest", 'STATUS' => getenv('default.status') ?: "use", 'EMPTY' => getenv('default.empty') ?: "", 'PERPAGE' => getenv('default.perpage') ?: 20, diff --git a/app/Config/Routes.php b/app/Config/Routes.php index df6d7e3..b4e086d 100644 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -42,8 +42,8 @@ $routes->get('/logout', 'AuthController::logout'); $routes->group('cli', ['namespace' => 'App\Controllers\CLI'], function ($routes) { }); $routes->group('ecommerce', ['namespace' => 'App\Controllers'], function ($routes) { - $routes->post('addCart', 'EcommerceController::addCart'); - $routes->get('cancelCart', 'EcommerceController::cancelCart'); + $routes->post('/addCart', 'EcommerceController::addCart'); + $routes->get('/cancelCart', 'EcommerceController::cancelCart'); }); // authGuard는 App\Config\Filters.php의 $aliases에 선언한 이름이어야 함 $routes->group('admin', ['namespace' => 'App\Controllers\Admin', 'filter' => 'authFilter:master,director,cloudflare,manager'], static function ($routes) { diff --git a/app/Config/Routes_Shoppinmall.php b/app/Config/Routes_Shoppinmall.php index d060c72..b4e086d 100644 --- a/app/Config/Routes_Shoppinmall.php +++ b/app/Config/Routes_Shoppinmall.php @@ -39,10 +39,12 @@ $routes->get('/login', 'AuthController::login'); $routes->post('/signup', 'AuthController::signup/local'); $routes->get('/signup/(:alpha)', 'AuthController::signup/$1'); $routes->get('/logout', 'AuthController::logout'); -$routes->post('/addCart', 'EcommerceController::addCart'); -$routes->get('/cancelCart', 'EcommerceController::cancelCart'); $routes->group('cli', ['namespace' => 'App\Controllers\CLI'], function ($routes) { }); +$routes->group('ecommerce', ['namespace' => 'App\Controllers'], function ($routes) { + $routes->post('/addCart', 'EcommerceController::addCart'); + $routes->get('/cancelCart', 'EcommerceController::cancelCart'); +}); // authGuard는 App\Config\Filters.php의 $aliases에 선언한 이름이어야 함 $routes->group('admin', ['namespace' => 'App\Controllers\Admin', 'filter' => 'authFilter:master,director,cloudflare,manager'], static function ($routes) { $routes->get('/', 'Home::index'); diff --git a/app/Controllers/Admin/BoardController.php b/app/Controllers/Admin/BoardController.php index e4c6257..7f005a2 100644 --- a/app/Controllers/Admin/BoardController.php +++ b/app/Controllers/Admin/BoardController.php @@ -13,9 +13,7 @@ class BoardController extends AdminController { $this->_model = new BoardModel(); parent::initController($request, $response, $logger); - $this->_viewDatas['title'] = lang($this->_model->getClassName() . '.title'); $this->_viewPath .= strtolower($this->_model->getClassName()); - helper($this->_model->getClassName()); } public function getFields(string $action = ""): array diff --git a/app/Controllers/Admin/CategoryController.php b/app/Controllers/Admin/CategoryController.php index 858083d..c97c942 100644 --- a/app/Controllers/Admin/CategoryController.php +++ b/app/Controllers/Admin/CategoryController.php @@ -13,9 +13,7 @@ class CategoryController extends AdminController { $this->_model = new CategoryModel(); parent::initController($request, $response, $logger); - $this->_viewDatas['title'] = lang($this->_model->getClassName() . '.title'); $this->_viewPath .= strtolower($this->_model->getClassName()); - helper($this->_model->getClassName()); } public function getFields(string $action = ""): array diff --git a/app/Controllers/Admin/OrderController.php b/app/Controllers/Admin/OrderController.php index c2f25c6..de45127 100644 --- a/app/Controllers/Admin/OrderController.php +++ b/app/Controllers/Admin/OrderController.php @@ -13,9 +13,7 @@ class OrderController extends AdminController { $this->_model = new OrderModel(); parent::initController($request, $response, $logger); - $this->_viewDatas['title'] = lang($this->_model->getClassName() . '.title'); $this->_viewPath .= strtolower($this->_model->getClassName()); - helper($this->_model->getClassName()); } final public function getFields(string $action = ""): array diff --git a/app/Controllers/Admin/ProductController.php b/app/Controllers/Admin/ProductController.php index c564a2b..5ee0ff8 100644 --- a/app/Controllers/Admin/ProductController.php +++ b/app/Controllers/Admin/ProductController.php @@ -14,9 +14,7 @@ class ProductController extends AdminController { $this->_model = new ProductModel(); parent::initController($request, $response, $logger); - $this->_viewDatas['title'] = lang($this->_model->getClassName() . '.title'); $this->_viewPath .= strtolower($this->_model->getClassName()); - helper($this->_model->getClassName()); } public function getFields(string $action = ""): array diff --git a/app/Controllers/Admin/UserController.php b/app/Controllers/Admin/UserController.php index da47dbf..e19a9cc 100644 --- a/app/Controllers/Admin/UserController.php +++ b/app/Controllers/Admin/UserController.php @@ -13,9 +13,7 @@ class UserController extends AdminController { $this->_model = new UserModel(); parent::initController($request, $response, $logger); - $this->_viewDatas['title'] = lang($this->_model->getClassName() . '.title'); $this->_viewPath .= strtolower($this->_model->getClassName()); - helper($this->_model->getClassName()); } //Field별 Form Datas 처리용 diff --git a/app/Controllers/Admin/UserSNSController.php b/app/Controllers/Admin/UserSNSController.php index 72fa184..9753f41 100644 --- a/app/Controllers/Admin/UserSNSController.php +++ b/app/Controllers/Admin/UserSNSController.php @@ -13,9 +13,7 @@ class UserSNSController extends AdminController { $this->_model = new UserSNSModel(); parent::initController($request, $response, $logger); - $this->_viewDatas['title'] = lang($this->_model->getClassName() . '.title'); $this->_viewPath .= strtolower($this->_model->getClassName()); - helper($this->_model->getClassName()); } public function getFields(string $action = ""): array { diff --git a/app/Controllers/AuthController.php b/app/Controllers/AuthController.php index aba7733..bb5cc1c 100644 --- a/app/Controllers/AuthController.php +++ b/app/Controllers/AuthController.php @@ -75,7 +75,7 @@ class AuthController extends Controller $this->_viewDatas['forms'] = ['attributes' => ['method' => "post",], 'hiddens' => []]; helper(['form']); $this->_session->keepFlashdata(SESSION_NAMES['RETURN_URL']); - return view('auth/login', $this->_viewDatas); + return view('auth/login', ['viewDatas' => $this->_viewDatas]); } public function signup(string $site) diff --git a/app/Controllers/BaseController.php b/app/Controllers/BaseController.php index cc70320..368dff3 100644 --- a/app/Controllers/BaseController.php +++ b/app/Controllers/BaseController.php @@ -37,7 +37,7 @@ abstract class BaseController extends Controller * * @var array */ - protected $helpers = ['Common']; + protected $helpers = ['Common', 'Base']; /** * Be sure to declare properties for any property fetch you initialized. @@ -62,8 +62,19 @@ abstract class BaseController extends Controller $this->_viewDatas['layout'] = LAYOUTS['empty']; $this->_viewDatas['session'] = $this->_session; $this->_viewDatas['title'] = lang($this->_model->getClassName() . '.title'); + $this->_viewDatas['className'] = $this->_model->getClassName(); $this->_viewDatas['class_icon'] = CLASS_ICONS[strtoupper($this->_model->getClassName())]; helper($this->_model->getClassName()); + + //사용자 기본 Role 지정 + $this->_viewDatas[SESSION_NAMES['ISLOGIN']] = false; + $this->_viewDatas['currentRoles'] = [DEFAULTS["ROLE"]]; + if ($this->_session->get(SESSION_NAMES['ISLOGIN'])) { + $this->_viewDatas[SESSION_NAMES['ISLOGIN']] = true; + $this->_viewDatas['auth'] = $this->_session->get(SESSION_NAMES['AUTH']); + $currentRoles = explode(DEFAULTS['DELIMITER_ROLE'], $this->_viewDatas['auth'][AUTH_FIELDS['ROLE']]); + $this->_viewDatas['currentRoles'] = is_array($currentRoles) ? $currentRoles : [DEFAULTS["ROLE"]]; + } } abstract public function getFields(string $action): array; @@ -137,17 +148,21 @@ abstract class BaseController extends Controller } //Insert관련 - final public function insert_form() + protected function insert_form_process() + { + } + public function insert_form() { try { $this->_viewDatas = $this->init(__FUNCTION__); + $this->insert_form_process(); $this->_viewDatas['forms'] = ['attributes' => ['method' => "post",], 'hiddens' => []]; helper(['form']); $this->_session->keepFlashdata(SESSION_NAMES['RETURN_URL']); - return view($this->_viewPath . '/insert', $this->_viewDatas); + return view($this->_viewPath . '/insert', ['viewDatas' => $this->_viewDatas]); } catch (\Exception $e) { log_message("error", $e->getMessage()); - return redirect()->to($this->_session->getFlashdata(SESSION_NAMES['RETURN_URL']))->with('return_message', $e->getMessage()); + return redirect()->to($this->_session->getFlashdata(SESSION_NAMES['RETURN_URL']) ?: "/")->with('return_message', $e->getMessage()); } } protected function insert_validate() @@ -180,7 +195,7 @@ abstract class BaseController extends Controller $this->insert_validate(); $entity = $this->insert_process(); $msg = "{$this->_viewDatas['title']}에서 {$entity->getTitle()}의 " . __FUNCTION__ . " 완료하였습니다."; - return redirect()->to($this->_session->getFlashdata(SESSION_NAMES['RETURN_URL'])); + return redirect()->to($this->_session->getFlashdata(SESSION_NAMES['RETURN_URL']) ?: "/"); } catch (\Exception $e) { $msg = "{$this->_viewDatas['title']}에서 " . __FUNCTION__ . " 실패하였습니다.\n" . $e->getMessage(); log_message("error", $e->getMessage()); @@ -192,18 +207,23 @@ abstract class BaseController extends Controller } //Update관련 - final public function update_form($uid) + protected function update_form_process($entity) + { + return $entity; + } + public function update_form($uid) { try { $this->_viewDatas = $this->init(__FUNCTION__); + $entity = $this->_model->getEntity([$this->_model->getPrimaryKey() => $uid]); + $this->_viewDatas['entity'] = $this->update_form_process($entity); $this->_viewDatas['forms'] = ['attributes' => ['method' => "post",], 'hiddens' => []]; helper(['form']); $this->_session->keepFlashdata(SESSION_NAMES['RETURN_URL']); - $this->_viewDatas['entity'] = $this->_model->getEntity([$this->_model->getPrimaryKey() => $uid]); - return view($this->_viewPath . '/update', $this->_viewDatas); + return view($this->_viewPath . '/update', ['viewDatas' => $this->_viewDatas]); } catch (\Exception $e) { log_message("error", $e->getMessage()); - return redirect()->to($this->_session->getFlashdata(SESSION_NAMES['RETURN_URL']))->with('return_message', $e->getMessage()); + return redirect()->to($this->_session->getFlashdata(SESSION_NAMES['RETURN_URL']) ?: "/")->with('return_message', $e->getMessage()); } } protected function update_validate($entity) @@ -240,7 +260,7 @@ abstract class BaseController extends Controller $this->update_validate($entity); $entity = $this->update_process($entity); $msg = "{$this->_viewDatas['title']}에서 {$entity->getTitle()}의 " . __FUNCTION__ . " 완료하였습니다."; - return redirect()->to($this->_session->getFlashdata(SESSION_NAMES['RETURN_URL'])); + return redirect()->to($this->_session->getFlashdata(SESSION_NAMES['RETURN_URL']) ?: "/"); } catch (\Exception $e) { $msg = "{$this->_viewDatas['title']}에서 " . __FUNCTION__ . " 실패하였습니다.\n" . $e->getMessage(); log_message("error", $e->getMessage()); @@ -252,23 +272,27 @@ abstract class BaseController extends Controller } //Reply관련 - final public function reply_form($uid) + protected function reply_form_process($entity) + { + $titleField = $this->_model->getTitleField(); + $entity->$titleField = "RE: " . $entity->$titleField; + $contentField = $this->_model->getContentField(); + $entity->$contentField .= "\n----------------------------------------------\n"; + return $entity; + } + public function reply_form($uid) { try { $this->_viewDatas = $this->init(__FUNCTION__); - $this->_viewDatas['forms'] = ['attributes' => ['method' => "post",], 'hiddens' => []]; - helper(['form']); - $this->_session->keepFlashdata(SESSION_NAMES['RETURN_URL']); $entity = $this->_model->getEntity([$this->_model->getPrimaryKey() => $uid]); - $titleField = $this->_model->getTitleField(); - $entity->$titleField = "RE: " . $entity->$titleField; - $contentField = $this->_model->getContentField(); - $entity->$contentField .= "\n----------------------------------------------\n"; - $this->_viewDatas['entity'] = $entity; - return view($this->_viewPath . '/reply', $this->_viewDatas); + $this->_viewDatas['entity'] = $this->reply_form_process($entity); + helper(['form']); + $this->_viewDatas['forms'] = ['attributes' => ['method' => "post",], 'hiddens' => []]; + $this->_session->keepFlashdata(SESSION_NAMES['RETURN_URL']); + return view($this->_viewPath . '/reply', ['viewDatas' => $this->_viewDatas]); } catch (\Exception $e) { log_message("error", $e->getMessage()); - return redirect()->to($this->_session->getFlashdata(SESSION_NAMES['RETURN_URL']))->with('return_message', $e->getMessage()); + return redirect()->to($this->_session->getFlashdata(SESSION_NAMES['RETURN_URL']) ?: "/")->with('return_message', $e->getMessage()); } } protected function reply_validate($entity) @@ -288,7 +312,7 @@ abstract class BaseController extends Controller $this->reply_validate($entity); $entity = $this->reply_process($entity); $msg = "{$this->_viewDatas['title']}에서 {$entity->getTitle()}의 " . __FUNCTION__ . " 완료하였습니다."; - return redirect()->to($this->_session->getFlashdata(SESSION_NAMES['RETURN_URL'])); + return redirect()->to($this->_session->getFlashdata(SESSION_NAMES['RETURN_URL']) ?: "/"); } catch (\Exception $e) { $msg = "{$this->_viewDatas['title']}에서 " . __FUNCTION__ . " 실패하였습니다.\n" . $e->getMessage(); log_message("error", $e->getMessage()); @@ -317,11 +341,11 @@ abstract class BaseController extends Controller $this->toggle_validate($entity); $entity = $this->toggle_process($entity); $msg = "{$this->_viewDatas['title']}에서 {$entity->getTitle()}의 " . __FUNCTION__ . " 완료하였습니다."; - return redirect()->to($this->_session->getFlashdata(SESSION_NAMES['RETURN_URL'])); + return redirect()->to($this->_session->getFlashdata(SESSION_NAMES['RETURN_URL']) ?: "/"); } catch (\Exception $e) { $msg = "{$this->_viewDatas['title']}에서 " . __FUNCTION__ . " 실패하였습니다.\n" . $e->getMessage(); log_message("error", $e->getMessage()); - return redirect()->to($this->_session->getFlashdata(SESSION_NAMES['RETURN_URL'])); + return redirect()->to($this->_session->getFlashdata(SESSION_NAMES['RETURN_URL']) ?: "/"); } finally { $this->_session->setFlashdata("return_message", $msg); } @@ -376,7 +400,7 @@ abstract class BaseController extends Controller count($entitys), __FUNCTION__ ); - return redirect()->to($this->_session->getFlashdata(SESSION_NAMES['RETURN_URL'])); + return redirect()->to($this->_session->getFlashdata(SESSION_NAMES['RETURN_URL']) ?: "/"); } catch (\Exception $e) { //Transaction Rollback $this->_model->transRollback(); @@ -389,7 +413,7 @@ abstract class BaseController extends Controller __FUNCTION__, ); log_message("error", $e->getMessage()); - return redirect()->to($this->_session->getFlashdata(SESSION_NAMES['RETURN_URL'])); + return redirect()->to($this->_session->getFlashdata(SESSION_NAMES['RETURN_URL']) ?: "/"); } finally { $this->_session->setFlashdata("return_message", $msg); } @@ -412,11 +436,11 @@ abstract class BaseController extends Controller $entity = $this->_model->getEntity([$this->_model->getPrimaryKey() => $uid]); $this->delete_process($entity); $msg = "{$this->_viewDatas['title']}에서 {$entity->getTitle()}의 " . __FUNCTION__ . " 완료하였습니다."; - return redirect()->to($this->_session->getFlashdata(SESSION_NAMES['RETURN_URL'])); + return redirect()->to($this->_session->getFlashdata(SESSION_NAMES['RETURN_URL']) ?: "/"); } catch (\Exception $e) { $msg = "{$this->_viewDatas['title']}에서 " . __FUNCTION__ . " 실패하였습니다.\n" . $e->getMessage(); log_message("error", $e->getMessage()); - return redirect()->to($this->_session->getFlashdata(SESSION_NAMES['RETURN_URL'])); + return redirect()->to($this->_session->getFlashdata(SESSION_NAMES['RETURN_URL']) ?: "/"); } finally { $this->_session->setFlashdata("return_message", $msg); } @@ -431,18 +455,21 @@ abstract class BaseController extends Controller { try { $this->_viewDatas = $this->init(__FUNCTION__); - helper(['form']); - $this->_viewDatas['forms'] = ['attributes' => ['method' => "post",], 'hiddens' => []]; $entity = $this->_model->getEntity([$this->_model->getPrimaryKey() => $uid]); $this->_viewDatas['entity'] = $this->view_process($entity); + helper(['form']); + $this->_viewDatas['forms'] = ['attributes' => ['method' => "post",], 'hiddens' => []]; $this->_session->keepFlashdata(SESSION_NAMES['RETURN_URL']); - return view($this->_viewPath . '/view', $this->_viewDatas); + return view($this->_viewPath . '/view', ['viewDatas' => $this->_viewDatas]); } catch (\Exception $e) { - return redirect()->to($this->_session->getFlashdata(SESSION_NAMES['RETURN_URL']))->with('return_message', $e->getMessage()); + return redirect()->to($this->_session->getFlashdata(SESSION_NAMES['RETURN_URL']) ?: "/")->with('return_message', $e->getMessage()); } } //Index 관련 + protected function index_process() + { + } protected function index_setCondition() { //조건절 처리 @@ -452,12 +479,19 @@ abstract class BaseController extends Controller $filterFields[$field] = $this->request->getVar($field); } } - $word = $this->request->getVar('word'); - $start = $this->request->getVar('start'); - $end = $this->request->getVar('end'); - $order_field = $this->request->getVar('order_field'); - $order_value = $this->request->getVar('order_value'); - $this->_model->setCondition($filterFields, $word, $start, $end, $order_field, $order_value); + $this->_viewDatas['word'] = $this->request->getVar('word') ?: ''; + $this->_viewDatas['start'] = $this->request->getVar('start') ?: ''; + $this->_viewDatas['end'] = $this->request->getVar('end') ?: ''; + $this->_viewDatas['order_field'] = $this->request->getVar('order_field') ?: 'uid'; + $this->_viewDatas['order_value'] = $this->request->getVar('order_value') ?: 'DESC'; + $this->_model->setCondition( + $filterFields, + $this->_viewDatas['word'], + $this->_viewDatas['start'], + $this->_viewDatas['end'], + $this->_viewDatas['order_field'], + $this->_viewDatas['order_value'] + ); } private function index_getPagination($pager_group = 'default', int $segment = 0, $template = 'bootstrap_full'): string { @@ -490,23 +524,20 @@ abstract class BaseController extends Controller { try { $this->_viewDatas = $this->init(__FUNCTION__); - helper(['form']); - $this->_viewDatas['forms'] = ['attributes' => ['method' => "post",], 'hiddens' => []]; + $this->index_process(); foreach ($this->_viewDatas['fieldFilters'] as $field) { $this->_viewDatas[$field] = $this->request->getVar($field) ?: DEFAULTS['EMPTY']; } - $this->_viewDatas['word'] = $this->request->getVar('word') ?: ''; - $this->_viewDatas['start'] = $this->request->getVar('start') ?: ''; - $this->_viewDatas['end'] = $this->request->getVar('end') ?: ''; - $this->_viewDatas['order_field'] = $this->request->getVar('order_field') ?: 'uid'; - $this->_viewDatas['order_value'] = $this->request->getVar('order_value') ?: 'DESC'; - $this->_viewDatas['page'] = (int)$this->request->getVar('page') ?: 1; - $this->_viewDatas['per_page'] = (int)$this->request->getVar('per_page') ?: DEFAULTS['PERPAGE']; - $this->_viewDatas['uri'] = $this->request->getUri(); //Totalcount 처리 $this->index_setCondition(); $this->_viewDatas['total_count'] = $this->_model->countAllResults(); + // echo $this->_model->getLastQuery(); + // echo "
"; // log_message("debug", __METHOD__ . "에서 TotalCount 호출:" . $this->_model->getLastQuery()); + //Page, Per_page필요부분 + $this->_viewDatas['page'] = (int)$this->request->getVar('page') ?: 1; + $this->_viewDatas['per_page'] = (int)$this->request->getVar('per_page') ?: DEFAULTS['PERPAGE']; + $this->_viewDatas['uri'] = $this->request->getUri(); //줄수 처리용 $this->_viewDatas['pageOptions'] = array("" => "줄수선택"); for ($i = 10; $i <= $this->_viewDatas['total_count'] + $this->_viewDatas['per_page']; $i += 10) { @@ -519,10 +550,13 @@ abstract class BaseController extends Controller // echo $this->_model->getLastQuery(); // log_message("debug", __METHOD__ . "에서 findAll 호출:" . $this->_model->getLastQuery()); //setting return_url to session flashdata + helper(['form']); + $this->_viewDatas['forms'] = ['attributes' => ['method' => "post",], 'hiddens' => []]; $this->_session->setFlashdata(SESSION_NAMES['RETURN_URL'], current_url() . '?' . $this->request->getUri()->getQuery() ?: ""); - return view($this->_viewPath . '/index', $this->_viewDatas); + return view($this->_viewPath . '/index', ['viewDatas' => $this->_viewDatas]); } catch (\Exception $e) { - return redirect()->back()->with('return_message', $e->getMessage()); + return alert_CommonHelper($e->getMessage(), "back"); + // return redirect()->back()->with('return_message', $e->getMessage()); } } @@ -569,7 +603,7 @@ abstract class BaseController extends Controller // return readfile(PATHS['EXCEL'] . '/' . $fileName); return $writer->save('php://output'); } catch (\Exception $e) { - return redirect()->to($this->_session->getFlashdata(SESSION_NAMES['RETURN_URL']))->with('return_message', $e->getMessage()); + return redirect()->to($this->_session->getFlashdata(SESSION_NAMES['RETURN_URL']) ?: "/")->with('return_message', $e->getMessage()); } } //File Download관련 @@ -586,7 +620,7 @@ abstract class BaseController extends Controller } return $this->response->download(WRITEPATH . PATHS['UPLOAD'] . "/" . $filename, null)->setFileName(date("YmdHms") . '_' . $origin_filename); } catch (\Exception $e) { - return redirect()->to($this->_session->getFlashdata(SESSION_NAMES['RETURN_URL']))->with('return_message', $e->getMessage()); + return redirect()->to($this->_session->getFlashdata(SESSION_NAMES['RETURN_URL']) ?: "/")->with('return_message', $e->getMessage()); } } } diff --git a/app/Controllers/Front/BoardController.php b/app/Controllers/Front/BoardController.php index 8898442..49154f8 100644 --- a/app/Controllers/Front/BoardController.php +++ b/app/Controllers/Front/BoardController.php @@ -3,19 +3,25 @@ namespace App\Controllers\Front; use App\Models\BoardModel; +use App\Models\CategoryModel; use CodeIgniter\HTTP\RequestInterface; use CodeIgniter\HTTP\ResponseInterface; use Psr\Log\LoggerInterface; class BoardController extends FrontController { + private $_category_uid = null; + private $_categoryModel = null; public function initController(RequestInterface $request, ResponseInterface $response, LoggerInterface $logger) { $this->_model = new BoardModel($this->getFields()); parent::initController($request, $response, $logger); - $this->_viewDatas['title'] = lang($this->_model->getClassName() . '.title'); $this->_viewPath .= strtolower($this->_model->getClassName()); - helper($this->_model->getClassName()); + } + + private function getCategoryModel(): CategoryModel + { + return $this->_categoryModel = $this->_categoryModel ?: new CategoryModel(); } public function getFields(string $action = ""): array @@ -60,10 +66,137 @@ class BoardController extends FrontController return $this->_viewDatas['fieldDatas']; } + //Insert관련 + protected function insert_form_process() + { + $this->_category_uid = $this->request->getVar('category_uid') ?: throw new \Exception("범주를 지정하지 않으셨습니다."); + $this->_viewDatas['category'] = $this->getCategoryModel()->getEntity([$this->getCategoryModel()->getPrimaryKey() => $this->_category_uid]); + //사용자가 Category에서 해당 게시판의 WRITE권한이 있는지 확인 + if (!isRole_CommonHelper( + $this->_viewDatas['currentRoles'], + $this->_viewDatas['category'], + CATEGORY_ROLE_FIELDS['WRITE'] + )) { + throw new \Exception("고객님은 쓰기권한이 없습니다."); + } + return parent::insert_form(); + } + protected function insert_process() + { + $this->_category_uid = $this->request->getVar('category_uid') ?: throw new \Exception("범주를 지정하지 않으셨습니다."); + $this->_viewDatas['category'] = $this->getCategoryModel()->getEntity([$this->getCategoryModel()->getPrimaryKey() => $this->_category_uid]); + //사용자가 Category에서 해당 게시판의 WRITE권한이 있는지 확인 + if (!isRole_CommonHelper( + $this->_viewDatas['currentRoles'], + $this->_viewDatas['category'], + CATEGORY_ROLE_FIELDS['WRITE'] + )) { + throw new \Exception("고객님은 쓰기권한이 없습니다."); + } + return parent::insert(); + } + + //Update관련 + protected function update_form_process($entity) + { + //본인이 작성한글인지 최종확인용 정상접속이 아닌 위회해서 수정을 시도방지용 + if (!$this->_viewDatas[SESSION_NAMES['ISLOGIN']] || $entity->getUser_Uid() == $this->_viewDatas['auth'][AUTH_FIELDS['ID']]) { + throw new \Exception("작성자 본인글인지 여부가 확인되지 않습니다."); + } + return parent::update_form_process($entity); + } + protected function update_process($entity) + { + //본인이 작성한글인지 최종확인용 정상접속이 아닌 위회해서 수정을 시도방지용 + if (!$this->_viewDatas[SESSION_NAMES['ISLOGIN']] || $entity->getUser_Uid() == $this->_viewDatas['auth'][AUTH_FIELDS['ID']]) { + throw new \Exception("작성자 본인글인지 여부가 확인되지 않습니다."); + } + return parent::update_process($entity); + } + //Reply관련 + protected function reply_form_process($entity) + { + $this->_viewDatas['category'] = $this->getCategoryModel()->getEntity( + [$this->getCategoryModel()->getPrimaryKey() => $entity->getCategory_Uid()] + ); + // echo var_export(isRole_CommonHelper( + // $this->_viewDatas['currentRoles'], + // $this->_viewDatas['category'], + // CATEGORY_ROLE_FIELDS['REPLY'] + // ), true); + // exit; + //사용자가 Category에서 해당 게시판의 REPLY권한이 있는지 확인 + if (!isRole_CommonHelper( + $this->_viewDatas['currentRoles'], + $this->_viewDatas['category'], + CATEGORY_ROLE_FIELDS['REPLY'] + )) { + throw new \Exception("고객님은 답변권한이 없습니다."); + } + return parent::reply_form_process($entity); + } + protected function reply_process($entity) + { + $this->_viewDatas['category'] = $this->getCategoryModel()->getEntity( + [$this->getCategoryModel()->getPrimaryKey() => $entity->getCategory_Uid()] + ); + //사용자가 Category에서 해당 게시판의 REPLY권한이 있는지 확인 + if (!isRole_CommonHelper( + $this->_viewDatas['currentRoles'], + $this->_viewDatas['category'], + CATEGORY_ROLE_FIELDS['REPLY'] + )) { + throw new \Exception("고객님은 답변권한이 없습니다."); + } + return parent::reply_process($entity); + } + //Delete 관련 + protected function delete_process($entity) + { + //본인이 작성한글인지 최종확인용 정상접속이 아닌 위회해서 삭제 시도 방지용 + if (!$this->_viewDatas[SESSION_NAMES['ISLOGIN']] || $entity->getUser_Uid() == $this->_viewDatas['auth'][AUTH_FIELDS['ID']]) { + throw new \Exception("작성자 본인글인지 여부가 확인되지 않습니다."); + } + return parent::delete_process($entity); + } //View관련 protected function view_process($entity) { - $entity = parent::view_process($entity); - return $this->_model->addViewCount($entity); + $this->_viewDatas['category'] = $this->getCategoryModel()->getEntity( + [$this->getCategoryModel()->getPrimaryKey() => $entity->getCategory_Uid()] + ); + //사용자가 Category에서 해당 게시판의 READ권한이 있는지 확인 + if (!isRole_CommonHelper( + $this->_viewDatas['currentRoles'], + $this->_viewDatas['category'], + CATEGORY_ROLE_FIELDS['READ'] + )) { + throw new \Exception("고객님은 읽기권한이 없습니다."); + } + //조회수 올리기 + $this->_model->addViewCount($entity); + return parent::view_process($entity); + } + //Index관련 + protected function index_process() + { + $this->_category_uid = $this->request->getVar('category_uid') ?: throw new \Exception("범주를 지정하지 않으셨습니다."); + $this->_viewDatas['category'] = $this->getCategoryModel()->getEntity([$this->getCategoryModel()->getPrimaryKey() => $this->_category_uid]); + //사용자가 Category에서 해당 게시판의 ACCESS권한이 있는지 확인 + if (!isRole_CommonHelper( + $this->_viewDatas['currentRoles'], + $this->_viewDatas['category'], + CATEGORY_ROLE_FIELDS['ACCESS'] + )) { + throw new \Exception("고객님은 접속권한이 없습니다."); + } + return parent::index_process(); + } + //Category 및 Status 조건추가 + protected function index_setCondition() + { + $this->_model->where("category_uid", $this->_viewDatas['category']->getPrimaryKey()); + $this->_model->where("status", DEFAULTS['STATUS']); + parent::index_setCondition(); } } diff --git a/app/Controllers/Front/OrderController.php b/app/Controllers/Front/OrderController.php index 7d2c51b..2a2f6ed 100644 --- a/app/Controllers/Front/OrderController.php +++ b/app/Controllers/Front/OrderController.php @@ -13,9 +13,7 @@ class OrderController extends FrontController { $this->_model = new OrderModel($this->getFields()); parent::initController($request, $response, $logger); - $this->_viewDatas['title'] = lang($this->_model->getClassName() . '.title'); $this->_viewPath .= strtolower($this->_model->getClassName()); - helper($this->_model->getClassName()); } final public function getFields(string $action = ""): array diff --git a/app/Controllers/Front/UserController.php b/app/Controllers/Front/UserController.php index 17f52fa..a49e403 100644 --- a/app/Controllers/Front/UserController.php +++ b/app/Controllers/Front/UserController.php @@ -13,9 +13,7 @@ class UserController extends FrontController { $this->_model = new UserModel(); parent::initController($request, $response, $logger); - $this->_viewDatas['title'] = lang($this->_model->getClassName() . '.title'); $this->_viewPath .= strtolower($this->_model->getClassName()); - helper($this->_model->getClassName()); } //Field별 Form Datas 처리용 diff --git a/app/Database/base.sql b/app/Database/base.sql index 635de37..d32f2dd 100644 --- a/app/Database/base.sql +++ b/app/Database/base.sql @@ -1,7 +1,7 @@ -DROP TABLE IF EXISTS servermgr.tw_user; +DROP TABLE IF EXISTS baseproject.tw_user; -CREATE TABLE servermgr.tw_user ( +CREATE TABLE baseproject.tw_user ( uid varchar(36) NOT NULL COMMENT "사용자 UUID", id varchar(30) NOT NULL, passwd varchar(100) NOT NULL, @@ -17,11 +17,11 @@ CREATE TABLE servermgr.tw_user ( UNIQUE KEY (email) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT ='사용자 정보'; -- insert into tw_user (uid,id,passwd,name,email,role,status) select uuid(),id,passwd,name,email,role,status from cfmgr.user; -DROP TABLE IF EXISTS servermgr.tw_user_profile; +DROP TABLE IF EXISTS baseproject.tw_user_profile; -DROP TABLE IF EXISTS servermgr.tw_user_sns; +DROP TABLE IF EXISTS baseproject.tw_user_sns; -CREATE TABLE servermgr.tw_user_sns ( +CREATE TABLE baseproject.tw_user_sns ( uid int(10) UNSIGNED NOT NULL AUTO_INCREMENT, user_uid varchar(36) NULL COMMENT '사용자 정보', site varchar(20) NOT NULL COMMENT 'Site: GOOGLE,FACEBOOK 등등', @@ -38,14 +38,14 @@ CREATE TABLE servermgr.tw_user_sns ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT ='SNS 로그인 후 정보'; -DROP TABLE IF EXISTS servermgr.tw_category; +DROP TABLE IF EXISTS baseproject.tw_category; -- 1. 게시물 추가전 grpno에 해당하는 max(grporder)+1씩증가 작업 -- update tw_category set grporder=grporder+1 where grpno=그룹번호 and grporder > 선택한 grpno -- 2. 게시물 추가시 작업 -- insert tw_category grpno=그룹번호,grporder=grporder+1,grpdepth=grpdepth+1 -- 3. 게시물 조회시 작업 -- select * from tw_category order by grpno desc,grporder asc -CREATE TABLE servermgr.tw_category ( +CREATE TABLE baseproject.tw_category ( uid int(10) UNSIGNED NOT NULL AUTO_INCREMENT, grpno int(10) UNSIGNED NOT NULL DEFAULT 1 COMMENT 'Group번호: 상위가없을시 기본 uid와 같음,항상 숫자여야함', grporder int(5) UNSIGNED NOT NULL DEFAULT 1 COMMENT 'Group순서: 상위가없을시 1부터시작', @@ -66,14 +66,14 @@ CREATE TABLE servermgr.tw_category ( PRIMARY KEY (uid) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT ='범주'; -DROP TABLE IF EXISTS servermgr.tw_board; +DROP TABLE IF EXISTS baseproject.tw_board; -- 1. 게시물 추가전 grpno에 해당하는 max(grporder)+1씩증가 작업 -- update tw_board set grporder=grporder+1 where grpno=그룹번호 and grporder > 선택한 grpno -- 2. 게시물 추가시 작업 -- insert tw_board grpno=그룹번호,grporder=grporder+1,grpdepth=grpdepth+1 -- 3. 게시물 조회시 작업 -- select * from tw_board order by grpno desc,grporder asc -CREATE TABLE servermgr.tw_board ( +CREATE TABLE baseproject.tw_board ( uid int(10) UNSIGNED NOT NULL AUTO_INCREMENT, grpno int(10) UNSIGNED NOT NULL DEFAULT 1 COMMENT 'Group번호: 상위가없을시 기본 uid와 같음,항상 숫자여야함', grporder int(5) UNSIGNED NOT NULL DEFAULT 1 COMMENT 'Group순서: 상위가없을시 1부터시작', diff --git a/app/Entities/CategoryEntity.php b/app/Entities/CategoryEntity.php index 4e90eb5..3941df8 100644 --- a/app/Entities/CategoryEntity.php +++ b/app/Entities/CategoryEntity.php @@ -31,4 +31,11 @@ class CategoryEntity extends BaseHierarchyEntity { return $this->attributes['tail']; } + public function getRole($field = 'isaccess') + { + return array_key_exists( + $field, + $this->attributes + ) ? $this->attributes[$field] : DEFAULTS['ROLE']; + } } diff --git a/app/Helpers/Board_helper.php b/app/Helpers/Board_helper.php index a740168..5e46a53 100644 --- a/app/Helpers/Board_helper.php +++ b/app/Helpers/Board_helper.php @@ -1,67 +1,71 @@ %s", implode(" ", [...$attributes]), lang("Board.label.{$field}")); + return sprintf("%s", implode(" ", $attributes), lang("{$viewDatas['className']}.label.{$field}")); break; } } - //header.php에서 getFieldForm_Helper사용 -function getFieldForm_BoardHelper($field, $value, array $fieldFormOptions, array $attributes = array()) +function getFieldForm_BoardHelper($field, $value, array $viewDatas, array $attributes = array()) { + $value = $value ?: DEFAULTS['EMPTY']; switch ($field) { case "category_uid": case "user_uid": - $fieldFormOptions[$field] = [DEFAULTS['EMPTY'] => lang("Board.label.{$field}") . " 선택", ...$fieldFormOptions[$field]]; - return form_dropdown($field, $fieldFormOptions[$field], $value, [...$attributes, 'class' => "select-field"]); + $viewDatas['fieldFormOptions'][$field] = [DEFAULTS['EMPTY'] => lang("{$viewDatas['className']}.label.{$field}") . " 선택", ...$viewDatas['fieldFormOptions'][$field]]; + return form_dropdown($field, $viewDatas['fieldFormOptions'][$field], $value, [...$attributes, 'class' => "select-field"]); break; - case "status": - $fieldFormOptions[$field] = [DEFAULTS['EMPTY'] => lang("Board.label.{$field}") . " 선택", ...$fieldFormOptions[$field]]; - return form_dropdown($field, $fieldFormOptions[$field], $value, $attributes); - break; - case 'updated_at': - case 'created_at': - return form_input($field, $value, [...$attributes, 'class' => 'calender']); + case 'title': + case 'name': + return form_input($field, $value, ["placeholder" => "예)", "style" => "width:60%; ::placeholder{ color:silver; opacity: 1; }"]); break; case 'passwd': return sprintf( "%s %s %s", - form_password($field, DEFAULTS['EMPTY'], [...$attributes]), - lang("Board.label.confirmpassword"), - form_password('confirmpassword', DEFAULTS['EMPTY'], [...$attributes]), + form_password($field, DEFAULTS['EMPTY']), + lang("{$viewDatas['className']}.label.confirmpassword"), + form_password('confirmpassword', DEFAULTS['EMPTY']), ); break; case 'content': - return form_textarea($field, html_entity_decode($value), [...$attributes, 'class' => 'editor', 'rows' => '20', 'cols' => '100']); + case 'head': + case 'tail': + return form_textarea($field, html_entity_decode($value), ['class' => 'editor', 'rows' => '20', 'cols' => '100']); break; case 'upload_file': case 'board_file': return form_upload($field); break; - case 'title': - return form_input($field, $value, [...$attributes, "placeholder" => "예)", "style" => "width:60%; ::placeholder{ color:silver; opacity: 1; }"]); - break; case 'view_cnt': - return form_input($field, $value, [...$attributes, 'type' => 'number']); + return form_input($field, $value, ['type' => 'number']); + break; + case "status": + $viewDatas['fieldFormOptions'][$field] = [DEFAULTS['EMPTY'] => lang("{$viewDatas['className']}.label.{$field}") . " 선택", ...$viewDatas['fieldFormOptions'][$field]]; + return form_dropdown($field, $viewDatas['fieldFormOptions'][$field], $value, $attributes); + break; + case 'updated_at': + case 'created_at': + return form_input($field, $value, ['class' => 'calender']); break; default: - return form_input($field, $value, [...$attributes]); + return form_input($field, $value); break; } } // -function getFieldView_BoardHelper($field, $entity, array $fieldFilters, array $fieldFormOptions, array $attributes = array()) +function getFieldView_BoardHelper($field, $entity, array $viewDatas) { $value = $entity->$field ?: DEFAULTS['EMPTY']; switch ($field) { case 'category_uid': $categorys = array(); - foreach (array_values($fieldFormOptions[$field]) as $category_2depth) { + foreach (array_values($viewDatas['fieldFormOptions'][$field]) as $category_2depth) { foreach ($category_2depth as $key => $label) { $categorys[$key] = $label; } @@ -69,27 +73,27 @@ function getFieldView_BoardHelper($field, $entity, array $fieldFilters, array $f return $categorys[$value]; break; case 'title': + case 'name': + $reply = anchor( + current_url() . '/reply/' . $entity->getPrimaryKey(), + ICONS['REPLY'], + ["target" => "_self"] + ); + $view = anchor( + current_url() . '/view/' . $entity->getPrimaryKey(), + $value, + ["target" => "_self"] + ); return sprintf( - "
%s %s
", - anchor( - current_url() . '/reply/' . $entity->getPrimaryKey(), - ICONS['REPLY'], - [ - ...$attributes, - "style" => sprintf("padding-left:%spx", $entity->getHierarchy_Depth() * DEFAULTS['HIERARCHY_GRPDEPTH']), - "target" => "_self" - ] - ), - anchor( - current_url() . '/view/' . $entity->getPrimaryKey(), - $value, - ["target" => "_self"] - ) + "
%s %s
", + $entity->getHierarchy_Depth() * DEFAULTS['HIERARCHY_GRPDEPTH'], + $reply, + $view ); break; case 'board_file': case 'upload_file': - return $value == DEFAULTS['EMPTY'] ? DEFAULTS['EMPTY'] : anchor(current_url() . "/download/{$field}/{$entity->getPrimaryKey()}", ICONS['IMAGE_FILE'] . explode(DEFAULTS['DELIMITER_FILE'], $value)[0], [...$attributes, "target" => "_self"]); + return $value == DEFAULTS['EMPTY'] ? DEFAULTS['EMPTY'] : anchor(current_url() . "/download/{$field}/{$entity->getPrimaryKey()}", ICONS['IMAGE_FILE'] . explode(DEFAULTS['DELIMITER_FILE'], $value)[0], ["target" => "_self"]); break; case 'view_cnt': return number_format(!$value ? 0 : $value); @@ -102,47 +106,48 @@ function getFieldView_BoardHelper($field, $entity, array $fieldFilters, array $f return $value ? str_split($value, 10)[0] : ""; break; default: - return in_array($field, $fieldFilters) && $value ? $fieldFormOptions[$field][$value] : $value; + return in_array($field, $viewDatas['fieldFilters']) && $value ? $viewDatas['fieldFormOptions'][$field][$value] : $value; break; } } // -function getFieldFilter_BoardHelper($field, $value, array $fieldFormOptions, array $attributes = array()) +function getFieldFilter_BoardHelper($field, $value, array $viewDatas) +{ + $viewDatas['fieldFormOptions'][$field] = [DEFAULTS['EMPTY'] => lang("{$viewDatas['className']}.label.{$field}") . " 선택", ...$viewDatas['fieldFormOptions'][$field]]; + return form_dropdown($field, $viewDatas['fieldFormOptions'][$field], $value, ['class' => "select-field"]); +} // + +function getFieldIndex_Column_BoardHelper($field, array $viewDatas) +{ + $label = lang("{$viewDatas['className']}.label.{$field}"); + $label = $field == $viewDatas['order_field'] ? sprintf('%s ', $label, $viewDatas['order_value'] == 'ASC' ? "up" : "down") : $label; + $value = $viewDatas['order_value'] == 'DESC' ? "ASC" : "DESC"; + return anchor(current_url() . "?order_field={$field}&order_value={$value}", $label); +} // + +function getFieldIndex_Row_BoardHelper($field, $entity, array $viewDatas): string { - $value = $value ?: DEFAULTS['EMPTY']; switch ($field) { default: - return getFieldForm_BoardHelper($field, $value, $fieldFormOptions, $attributes); + return getFieldView_BoardHelper($field, $entity, $viewDatas); break; } } // - -function getFieldIndex_Column_BoardHelper($field, $order_field, $order_value, array $attributes = array()) -{ - $label = lang("Board.label.{$field}"); - $label = $field == $order_field ? sprintf('%s ', $label, $order_value == 'ASC' ? "up" : "down") : $label; - $order_value = $order_value == 'DESC' ? "ASC" : "DESC"; - return anchor(current_url() . "?order_field={$field}&order_value={$order_value}", $label, [...$attributes]); -} // - -function getFieldIndex_Row_BoardHelper($field, $entity, array $fieldFilters, $fieldFormOptions, $attributes = array()): string +function getFieldIndex_Row_BoardHelper_Admin($field, $entity, array $viewDatas): string { switch ($field) { default: - return getFieldView_BoardHelper($field, $entity, $fieldFilters, $fieldFormOptions, $attributes); - break; - } -} // - -function getFieldIndex_Row_BoardHelper_Admin($field, $entity, array $fieldFilters, $fieldFormOptions, $attributes = array()): string -{ - switch ($field) { - default: - if (in_array($field, $fieldFilters)) { - $attributes["onChange"] = sprintf('location.href="%s/toggle/%s/%s?%s="+this.options[this.selectedIndex].value', current_url(), $entity->getPrimaryKey(), $field, $field); - return getFieldForm_BoardHelper($field, $entity->$field, $fieldFormOptions, $attributes); + if (in_array($field, $viewDatas['fieldFilters'])) { + $attributes["onChange"] = sprintf( + 'location.href="%s/toggle/%s/%s?%s="+this.options[this.selectedIndex].value', + current_url(), + $entity->getPrimaryKey(), + $field, + $field + ); + return getFieldForm_BoardHelper($field, $entity->$field, $viewDatas, $attributes); } - return getFieldIndex_Row_BoardHelper($field, $entity, $fieldFilters, $fieldFormOptions, $attributes); + return getFieldView_BoardHelper($field, $entity, $viewDatas); break; } } // \ No newline at end of file diff --git a/app/Helpers/Category_helper.php b/app/Helpers/Category_helper.php index ddbc04b..f4d16f9 100644 --- a/app/Helpers/Category_helper.php +++ b/app/Helpers/Category_helper.php @@ -1,18 +1,18 @@ %s", implode(" ", [...$attributes]), lang("Category.label.{$field}")); + return sprintf("%s", implode(" ", $attributes), lang("{$viewDatas['className']}.label.{$field}")); break; } } - //header.php에서 getFieldForm_Helper사용 -function getFieldForm_CategoryHelper($field, $value, array $fieldFormOptions, array $attributes = array()) +function getFieldForm_CategoryHelper($field, $value, array $viewDatas, array $attributes = array()) { $value = $value ?: DEFAULTS['EMPTY']; switch ($field) { @@ -22,131 +22,127 @@ function getFieldForm_CategoryHelper($field, $value, array $fieldFormOptions, ar case 'isreply': case 'isupload': case 'isdownload': - $fieldFormOptions[$field] = [DEFAULTS['EMPTY'] => lang("Category.label.{$field}") . " 선택", ...$fieldFormOptions[$field]]; - return form_dropdown($field, $fieldFormOptions[$field], $value, [...$attributes, 'class' => "select-field"]); - // return form_multiselect($field, $fieldFormOptions[$field], $value, [...$attributes]); - // foreach ($fieldFormOptions[$field] as $key => $label) { - // $checkboxs[] = form_checkbox("{$field}[]", $key, in_array($key, is_array($value) ? [...$value] : explode(DEFAULTS['DELIMITER_ROLE'], $value)), $attributes) . $label; - // } - // return implode(" ", $checkboxs); + $viewDatas['fieldFormOptions'][$field] = [DEFAULTS['EMPTY'] => lang("{$viewDatas['className']}.label.{$field}") . " 선택", ...$viewDatas['fieldFormOptions'][$field]]; + return form_dropdown($field, $viewDatas['fieldFormOptions'][$field], $value, [...$attributes, 'class' => "select-field"]); break; - case "status": - $fieldFormOptions[$field] = [DEFAULTS['EMPTY'] => lang("Category.label.{$field}") . " 선택", ...$fieldFormOptions[$field]]; - return form_dropdown($field, $fieldFormOptions[$field], $value, $attributes); - break; - case 'updated_at': - case 'created_at': - return form_input($field, $value, [...$attributes, 'class' => 'calender']); + case 'title': + case 'name': + return form_input($field, $value, ["placeholder" => "예)", "style" => "width:60%; ::placeholder{ color:silver; opacity: 1; }"]); break; case 'passwd': return sprintf( "%s %s %s", - form_password($field, DEFAULTS['EMPTY'], [...$attributes]), - lang("Category.label.confirmpassword"), - form_password('confirmpassword', DEFAULTS['EMPTY'], [...$attributes]), + form_password($field, DEFAULTS['EMPTY']), + lang("{$viewDatas['className']}.label.confirmpassword"), + form_password('confirmpassword', DEFAULTS['EMPTY']), ); break; + case 'content': case 'head': case 'tail': - return form_textarea($field, html_entity_decode($value), [...$attributes, 'class' => 'editor', 'rows' => '20', 'cols' => '100']); + return form_textarea($field, html_entity_decode($value), ['class' => 'editor', 'rows' => '20', 'cols' => '100']); break; case 'upload_file': + case 'board_file': return form_upload($field); break; - case 'name': - return form_input($field, $value, [...$attributes, "placeholder" => "예)", "style" => "width:60%; ::placeholder{ color:silver; opacity: 1; }"]); + case 'view_cnt': + return form_input($field, $value, ['type' => 'number']); break; - default: - return form_input($field, $value, [...$attributes]); - break; - } -} // - -function getFieldView_CategoryHelper($field, $entity, array $fieldFilters, array $fieldFormOptions, array $attributes = array()) -{ - $value = $entity->$field ?: DEFAULTS['EMPTY']; - switch ($field) { - case 'name': - return sprintf( - "
%s %s
", - anchor( - current_url() . '/reply/' . $entity->getPrimaryKey(), - ICONS['REPLY'], - [ - ...$attributes, - "style" => sprintf("padding-left:%spx", $entity->getHierarchy_Depth() * DEFAULTS['HIERARCHY_GRPDEPTH']), - "target" => "_self" - ] - ), - anchor( - current_url() . '/view/' . $entity->getPrimaryKey(), - $value, - ["target" => "_self"] - ) - ); - break; - case 'upload_file': - return $value == DEFAULTS['EMPTY'] ? DEFAULTS['EMPTY'] : anchor(current_url() . '/download/' . $entity->getPrimaryKey(), ICONS['IMAGE_FILE'] . explode(DEFAULTS['DELIMITER_FILE'], $value)[0], [...$attributes, "target" => "_self"]); + case "status": + $viewDatas['fieldFormOptions'][$field] = [DEFAULTS['EMPTY'] => lang("{$viewDatas['className']}.label.{$field}") . " 선택", ...$viewDatas['fieldFormOptions'][$field]]; + return form_dropdown($field, $viewDatas['fieldFormOptions'][$field], $value, $attributes); break; case 'updated_at': case 'created_at': - return isset($value) ? str_split($value, 10)[0] : ""; + return form_input($field, $value, ['class' => 'calender']); break; - case 'head': - case 'tail': + default: + return form_input($field, $value); + break; + } +} // + +function getFieldView_CategoryHelper($field, $entity, array $viewDatas) +{ + $value = $entity->$field ?: DEFAULTS['EMPTY']; + switch ($field) { + case 'title': + case 'name': + $reply = anchor( + current_url() . '/reply/' . $entity->getPrimaryKey(), + ICONS['REPLY'], + ["target" => "_self"] + ); + $view = anchor( + current_url() . '/view/' . $entity->getPrimaryKey(), + $value, + ["target" => "_self"] + ); + return sprintf( + "
%s %s
", + $entity->getHierarchy_Depth() * DEFAULTS['HIERARCHY_GRPDEPTH'], + $reply, + $view + ); + break; + case 'board_file': + case 'upload_file': + return $value == DEFAULTS['EMPTY'] ? DEFAULTS['EMPTY'] : anchor(current_url() . "/download/{$field}/{$entity->getPrimaryKey()}", ICONS['IMAGE_FILE'] . explode(DEFAULTS['DELIMITER_FILE'], $value)[0], ["target" => "_self"]); + break; + case 'view_cnt': + return number_format(!$value ? 0 : $value); + break; + case 'content': return html_entity_decode($value); break; + case 'updated_at': + case 'created_at': + return $value ? str_split($value, 10)[0] : ""; + break; default: - return in_array($field, $fieldFilters) && $value ? $fieldFormOptions[$field][$value] : $value; + return in_array($field, $viewDatas['fieldFilters']) && $value ? $viewDatas['fieldFormOptions'][$field][$value] : $value; break; } } // -function getFieldFilter_CategoryHelper($field, $value, array $fieldFormOptions, array $attributes = array()) +function getFieldFilter_CategoryHelper($field, $value, array $viewDatas) +{ + $viewDatas['fieldFormOptions'][$field] = [DEFAULTS['EMPTY'] => lang("{$viewDatas['className']}.label.{$field}") . " 선택", ...$viewDatas['fieldFormOptions'][$field]]; + return form_dropdown($field, $viewDatas['fieldFormOptions'][$field], $value, ['class' => "select-field"]); +} // + +function getFieldIndex_Column_CategoryHelper($field, array $viewDatas) +{ + $label = lang("{$viewDatas['className']}.label.{$field}"); + $label = $field == $viewDatas['order_field'] ? sprintf('%s ', $label, $viewDatas['order_value'] == 'ASC' ? "up" : "down") : $label; + $value = $viewDatas['order_value'] == 'DESC' ? "ASC" : "DESC"; + return anchor(current_url() . "?order_field={$field}&order_value={$value}", $label); +} // + +function getFieldIndex_Row_CategoryHelper($field, $entity, array $viewDatas): string { - $value = $value ?: DEFAULTS['EMPTY']; switch ($field) { - case 'isaccess': - case 'isread': - case 'iswrite': - case 'isreply': - case 'isupload': - case 'isdownload': - $fieldFormOptions[$field] = [DEFAULTS['EMPTY'] => lang("Category.label.{$field}") . " 선택", ...$fieldFormOptions[$field]]; - return form_dropdown($field, $fieldFormOptions[$field], $value, [...$attributes, 'class' => "select-field"]); - break; default: - return getFieldForm_CategoryHelper($field, $value, $fieldFormOptions, $attributes); + return getFieldView_CategoryHelper($field, $entity, $viewDatas); break; } } // - -function getFieldIndex_Column_CategoryHelper($field, $order_field, $order_value, array $attributes = array()) -{ - $label = lang("Category.label.{$field}"); - $label = $field == $order_field ? sprintf('%s ', $label, $order_value == 'ASC' ? "up" : "down") : $label; - $order_value = $order_value == 'DESC' ? "ASC" : "DESC"; - return anchor(current_url() . "?order_field={$field}&order_value={$order_value}", $label, [...$attributes]); -} // - -function getFieldIndex_Row_CategoryHelper($field, $entity, array $fieldFilters, $fieldFormOptions, $attributes = array()): string +function getFieldIndex_Row_CategoryHelper_Admin($field, $entity, array $viewDatas): string { switch ($field) { default: - return getFieldView_CategoryHelper($field, $entity, $fieldFilters, $fieldFormOptions, $attributes); - break; - } -} // - -function getFieldIndex_Row_CategoryHelper_Admin($field, $entity, array $fieldFilters, $fieldFormOptions, $attributes = array()): string -{ - switch ($field) { - default: - if (in_array($field, $fieldFilters)) { - $attributes["onChange"] = sprintf('location.href="%s/toggle/%s/%s?%s="+this.options[this.selectedIndex].value', current_url(), $entity->getPrimaryKey(), $field, $field); - return getFieldForm_CategoryHelper($field, $entity->$field, $fieldFormOptions, $attributes); + if (in_array($field, $viewDatas['fieldFilters'])) { + $attributes["onChange"] = sprintf( + 'location.href="%s/toggle/%s/%s?%s="+this.options[this.selectedIndex].value', + current_url(), + $entity->getPrimaryKey(), + $field, + $field + ); + return getFieldForm_CategoryHelper($field, $entity->$field, $viewDatas, $attributes); } - return getFieldIndex_Row_CategoryHelper($field, $entity, $fieldFilters, $fieldFormOptions, $attributes); + return getFieldView_CategoryHelper($field, $entity, $viewDatas); break; } } // \ No newline at end of file diff --git a/app/Helpers/Common_helper.php b/app/Helpers/Common_helper.php index a759c0f..1f03706 100644 --- a/app/Helpers/Common_helper.php +++ b/app/Helpers/Common_helper.php @@ -1,4 +1,10 @@ getRole($roleField), $userRoles); +} + function getValueByKey_CommonHelper($key, array $attributes) { $options = array(); diff --git a/app/Helpers/Order_helper.php b/app/Helpers/Order_helper.php index 0a55535..d078ef0 100644 --- a/app/Helpers/Order_helper.php +++ b/app/Helpers/Order_helper.php @@ -1,103 +1,138 @@ %s", implode(" ", [...$attributes]), lang("Order.label.{$field}")); + return sprintf("%s", implode(" ", $attributes), lang("{$viewDatas['className']}.label.{$field}")); break; } } - //header.php에서 getFieldForm_Helper사용 -function getFieldForm_OrderHelper($field, $value, array $fieldFormOptions, array $attributes = array()) -{ - switch ($field) { - case "product_uid": - case "user_uid": - $fieldFormOptions[$field] = [DEFAULTS['EMPTY'] => lang("Order.label.{$field}") . " 선택", ...$fieldFormOptions[$field]]; - return form_dropdown($field, $fieldFormOptions[$field], $value, [...$attributes, 'class' => "select-field"]); - break; - case "status": - $fieldFormOptions[$field] = [DEFAULTS['EMPTY'] => lang("Order.label.{$field}") . " 선택", ...$fieldFormOptions[$field]]; - return form_dropdown($field, $fieldFormOptions[$field], $value, $attributes); - break; - case 'updated_at': - case 'created_at': - return form_input($field, $value, [...$attributes, 'class' => 'calender']); - break; - case 'quantity': - case 'price': - return form_input($field, $value, [...$attributes, 'type' => 'number']); - break; - default: - return form_input($field, $value, [...$attributes]); - break; - } -} // - -function getFieldView_OrderHelper($field, $entity, array $fieldFilters, array $fieldFormOptions, array $attributes = array()) -{ - $value = $entity->$field ?: DEFAULTS['EMPTY']; - switch ($field) { - case 'name': - return sprintf( - "
%s
", - anchor(current_url() . '/view/' . $entity->getPrimaryKey(), $value, [...$attributes, "target" => "_self"]) - ); - break; - case 'quantity': - case 'price': - return number_format(!$value ? 0 : $value); - break; - case 'updated_at': - case 'created_at': - return $value; - break; - default: - return in_array($field, $fieldFilters) && $value ? $fieldFormOptions[$field][$value] : $value; - break; - } -} // - -function getFieldFilter_OrderHelper($field, $value, array $fieldFormOptions, array $attributes = array()) +function getFieldForm_OrderHelper($field, $value, array $viewDatas, array $attributes = array()) { $value = $value ?: DEFAULTS['EMPTY']; switch ($field) { + case 'product_uid': + case 'user_uid': + $viewDatas['fieldFormOptions'][$field] = [DEFAULTS['EMPTY'] => lang("{$viewDatas['className']}.label.{$field}") . " 선택", ...$viewDatas['fieldFormOptions'][$field]]; + return form_dropdown($field, $viewDatas['fieldFormOptions'][$field], $value, [...$attributes, 'class' => "select-field"]); + // // return form_multiselect($field, $fieldFormOptions[$field], is_array($value) ? [...$value] : [$value], [...$attributes]); + // foreach ($viewDatas['fieldFormOptions'][$field] as $key => $label) { + // $checkboxs[] = form_checkbox("{$field}[]", $key, in_array($key, explode(DEFAULTS["DELIMITER_ROLE"], $value))) . $label; + // } + // return implode(" ", $checkboxs); + break; + case 'title': + case 'name': + return form_input($field, $value, ["placeholder" => "예)", "style" => "width:60%; ::placeholder{ color:silver; opacity: 1; }"]); + break; + case 'passwd': + return sprintf( + "%s %s %s", + form_password($field, DEFAULTS['EMPTY']), + lang("{$viewDatas['className']}.label.confirmpassword"), + form_password('confirmpassword', DEFAULTS['EMPTY']), + ); + break; + case 'content': + case 'head': + case 'tail': + return form_textarea($field, html_entity_decode($value), ['class' => 'editor', 'rows' => '20', 'cols' => '100']); + break; + case 'upload_file': + case 'board_file': + return form_upload($field); + break; + case 'view_cnt': + return form_input($field, $value, ['type' => 'number']); + break; + case "status": + $viewDatas['fieldFormOptions'][$field] = [DEFAULTS['EMPTY'] => lang("{$viewDatas['className']}.label.{$field}") . " 선택", ...$viewDatas['fieldFormOptions'][$field]]; + return form_dropdown($field, $viewDatas['fieldFormOptions'][$field], $value, $attributes); + break; + case 'updated_at': + case 'created_at': + return form_input($field, $value, ['class' => 'calender']); + break; default: - return getFieldForm_OrderHelper($field, $value, $fieldFormOptions, $attributes); + return form_input($field, $value); break; } } // -function getFieldIndex_Column_OrderHelper($field, $order_field, $order_value, array $attributes = array()) -{ - $label = lang("Order.label.{$field}"); - $label = $field == $order_field ? sprintf('%s ', $label, $order_value == 'ASC' ? "up" : "down") : $label; - $order_value = $order_value == 'DESC' ? "ASC" : "DESC"; - return anchor(current_url() . "?order_field={$field}&order_value={$order_value}", $label, [...$attributes]); -} // - -function getFieldIndex_Row_OrderHelper($field, $entity, array $fieldFilters, $fieldFormOptions, $attributes = array()): string +function getFieldView_OrderHelper($field, $entity, array $viewDatas) { + $value = $entity->$field ?: DEFAULTS['EMPTY']; switch ($field) { + case 'title': + case 'name': + return anchor( + current_url() . '/view/' . $entity->getPrimaryKey(), + $value, + ["target" => "_self"] + ); + break; + case 'board_file': + case 'upload_file': + return $value == DEFAULTS['EMPTY'] ? DEFAULTS['EMPTY'] : anchor(current_url() . "/download/{$field}/{$entity->getPrimaryKey()}", ICONS['IMAGE_FILE'] . explode(DEFAULTS['DELIMITER_FILE'], $value)[0], ["target" => "_self"]); + break; + case 'view_cnt': + return number_format(!$value ? 0 : $value); + break; + case 'content': + return html_entity_decode($value); + break; + case 'updated_at': + case 'created_at': + return $value ? str_split($value, 10)[0] : ""; + break; default: - return getFieldView_OrderHelper($field, $entity, $fieldFilters, $fieldFormOptions, $attributes); + return in_array($field, $viewDatas['fieldFilters']) && $value ? $viewDatas['fieldFormOptions'][$field][$value] : $value; break; } } // -function getFieldIndex_Row_OrderHelper_Admin($field, $entity, array $fieldFilters, $fieldFormOptions, $attributes = array()): string +function getFieldFilter_OrderHelper($field, $value, array $viewDatas) +{ + $viewDatas['fieldFormOptions'][$field] = [DEFAULTS['EMPTY'] => lang("{$viewDatas['className']}.label.{$field}") . " 선택", ...$viewDatas['fieldFormOptions'][$field]]; + return form_dropdown($field, $viewDatas['fieldFormOptions'][$field], $value, ['class' => "select-field"]); +} // + +function getFieldIndex_Column_OrderHelper($field, array $viewDatas) +{ + $label = lang("{$viewDatas['className']}.label.{$field}"); + $label = $field == $viewDatas['order_field'] ? sprintf('%s ', $label, $viewDatas['order_value'] == 'ASC' ? "up" : "down") : $label; + $value = $viewDatas['order_value'] == 'DESC' ? "ASC" : "DESC"; + return anchor(current_url() . "?order_field={$field}&order_value={$value}", $label); +} // + +function getFieldIndex_Row_OrderHelper($field, $entity, array $viewDatas): string { switch ($field) { default: - if (in_array($field, $fieldFilters)) { - $attributes["onChange"] = sprintf('location.href="%s/toggle/%s/%s?%s="+this.options[this.selectedIndex].value', current_url(), $entity->getPrimaryKey(), $field, $field); - return getFieldForm_OrderHelper($field, $entity->$field, $fieldFormOptions, $attributes); + return getFieldView_OrderHelper($field, $entity, $viewDatas); + break; + } +} // +function getFieldIndex_Row_OrderHelper_Admin($field, $entity, array $viewDatas): string +{ + switch ($field) { + default: + if (in_array($field, $viewDatas['fieldFilters'])) { + $attributes["onChange"] = sprintf( + 'location.href="%s/toggle/%s/%s?%s="+this.options[this.selectedIndex].value', + current_url(), + $entity->getPrimaryKey(), + $field, + $field + ); + return getFieldForm_OrderHelper($field, $entity->field, $viewDatas, $attributes); } - return getFieldIndex_Row_OrderHelper($field, $entity, $fieldFilters, $fieldFormOptions, $attributes); + return getFieldView_OrderHelper($field, $entity, $viewDatas); break; } } // \ No newline at end of file diff --git a/app/Helpers/Product_helper.php b/app/Helpers/Product_helper.php index 545a62f..111f80d 100644 --- a/app/Helpers/Product_helper.php +++ b/app/Helpers/Product_helper.php @@ -1,92 +1,86 @@ %s", implode(" ", [...$attributes]), lang("Product.label.{$field}")); + return sprintf("%s", implode(" ", $attributes), lang("{$viewDatas['className']}.label.{$field}")); break; } } - //header.php에서 getFieldForm_Helper사용 -function getFieldForm_ProductHelper($field, $value, array $fieldFormOptions, array $attributes = array()) +function getFieldForm_ProductHelper($field, $value, array $viewDatas, array $attributes = array()) { + $value = $value ?: DEFAULTS['EMPTY']; switch ($field) { - case "category_uid": - case "user_uid": - $fieldFormOptions[$field] = [DEFAULTS['EMPTY'] => lang("Product.label.{$field}") . " 선택", ...$fieldFormOptions[$field]]; - return form_dropdown($field, $fieldFormOptions[$field], $value, [...$attributes, 'class' => "select-field"]); + case 'category_uid': + case 'user_uid': + $viewDatas['fieldFormOptions'][$field] = [DEFAULTS['EMPTY'] => lang("{$viewDatas['className']}.label.{$field}") . " 선택", ...$viewDatas['fieldFormOptions'][$field]]; + return form_dropdown($field, $viewDatas['fieldFormOptions'][$field], $value, [...$attributes, 'class' => "select-field"]); + // // return form_multiselect($field, $fieldFormOptions[$field], is_array($value) ? [...$value] : [$value], [...$attributes]); + // foreach ($viewDatas['fieldFormOptions'][$field] as $key => $label) { + // $checkboxs[] = form_checkbox("{$field}[]", $key, in_array($key, explode(DEFAULTS["DELIMITER_ROLE"], $value))) . $label; + // } + // return implode(" ", $checkboxs); break; - case "status": - $fieldFormOptions[$field] = [DEFAULTS['EMPTY'] => lang("Product.label.{$field}") . " 선택", ...$fieldFormOptions[$field]]; - return form_dropdown($field, $fieldFormOptions[$field], $value, [...$attributes]); - break; - case 'updated_at': - case 'created_at': - return form_input($field, $value, [...$attributes, 'class' => 'calender']); + case 'title': + case 'name': + return form_input($field, $value, ["placeholder" => "예)", "style" => "width:60%; ::placeholder{ color:silver; opacity: 1; }"]); break; case 'passwd': return sprintf( "%s %s %s", - form_password($field, DEFAULTS['EMPTY'], [...$attributes]), - lang("Product.label.confirmpassword"), - form_password('confirmpassword', DEFAULTS['EMPTY'], [...$attributes]), + form_password($field, DEFAULTS['EMPTY']), + lang("{$viewDatas['className']}.label.confirmpassword"), + form_password('confirmpassword', DEFAULTS['EMPTY']), ); break; + case 'content': case 'head': case 'tail': - case 'content': - return form_textarea($field, html_entity_decode($value), [...$attributes, 'class' => 'editor', 'rows' => '20', 'cols' => '100']); + return form_textarea($field, html_entity_decode($value), ['class' => 'editor', 'rows' => '20', 'cols' => '100']); break; - case 'photo': case 'upload_file': + case 'board_file': return form_upload($field); break; - case 'name': - return form_input($field, $value, [...$attributes, "placeholder" => "예) HP-DL360G6...", "style" => "width:60%; ::placeholder{ color:silver; opacity: 1; }"]); + case 'view_cnt': + return form_input($field, $value, ['type' => 'number']); break; - case 'cost': - case 'price': - case 'sale': - case 'stock': - return form_input($field, $value, [...$attributes, 'type' => 'number']); + case "status": + $viewDatas['fieldFormOptions'][$field] = [DEFAULTS['EMPTY'] => lang("{$viewDatas['className']}.label.{$field}") . " 선택", ...$viewDatas['fieldFormOptions'][$field]]; + return form_dropdown($field, $viewDatas['fieldFormOptions'][$field], $value, $attributes); + break; + case 'updated_at': + case 'created_at': + return form_input($field, $value, ['class' => 'calender']); break; default: - return form_input($field, $value, [...$attributes]); + return form_input($field, $value); break; } } // -function getFieldView_ProductHelper($field, $entity, array $fieldFilters, array $fieldFormOptions, array $attributes = array()) +function getFieldView_ProductHelper($field, $entity, array $viewDatas) { $value = $entity->$field ?: DEFAULTS['EMPTY']; switch ($field) { - case 'category_uid': - $categorys = array(); - foreach (array_values($fieldFormOptions[$field]) as $category_2depth) { - foreach ($category_2depth as $key => $label) { - $categorys[$key] = $label; - } - } - return $categorys[$value]; - break; + case 'title': case 'name': - return sprintf( - "
%s
", - anchor(current_url() . '/view/' . $entity->getPrimaryKey(), $value, [...$attributes, "target" => "_self"]) + return anchor( + current_url() . '/view/' . $entity->getPrimaryKey(), + $value, + ["target" => "_self"] ); break; - case 'photo': + case 'board_file': case 'upload_file': - return $value == DEFAULTS['EMPTY'] ? DEFAULTS['EMPTY'] : anchor(current_url() . "/download/{$field}/{$entity->getPrimaryKey()}", ICONS['IMAGE_FILE'] . explode(DEFAULTS['DELIMITER_FILE'], $value)[0], [...$attributes, "target" => "_self"]); + return $value == DEFAULTS['EMPTY'] ? DEFAULTS['EMPTY'] : anchor(current_url() . "/download/{$field}/{$entity->getPrimaryKey()}", ICONS['IMAGE_FILE'] . explode(DEFAULTS['DELIMITER_FILE'], $value)[0], ["target" => "_self"]); break; - case 'cost': - case 'price': - case 'sale': - case 'stock': + case 'view_cnt': return number_format(!$value ? 0 : $value); break; case 'content': @@ -94,50 +88,51 @@ function getFieldView_ProductHelper($field, $entity, array $fieldFilters, array break; case 'updated_at': case 'created_at': - return isset($value) ? str_split($value, 10)[0] : ""; + return $value ? str_split($value, 10)[0] : ""; break; default: - return in_array($field, $fieldFilters) && $value ? $fieldFormOptions[$field][$value] : $value; + return in_array($field, $viewDatas['fieldFilters']) && $value ? $viewDatas['fieldFormOptions'][$field][$value] : $value; break; } } // -function getFieldFilter_ProductHelper($field, $value, array $fieldFormOptions, array $attributes = array()) +function getFieldFilter_ProductHelper($field, $value, array $viewDatas) +{ + $viewDatas['fieldFormOptions'][$field] = [DEFAULTS['EMPTY'] => lang("{$viewDatas['className']}.label.{$field}") . " 선택", ...$viewDatas['fieldFormOptions'][$field]]; + return form_dropdown($field, $viewDatas['fieldFormOptions'][$field], $value, ['class' => "select-field"]); +} // + +function getFieldIndex_Column_ProductHelper($field, array $viewDatas) +{ + $label = lang("{$viewDatas['className']}.label.{$field}"); + $label = $field == $viewDatas['order_field'] ? sprintf('%s ', $label, $viewDatas['order_value'] == 'ASC' ? "up" : "down") : $label; + $value = $viewDatas['order_value'] == 'DESC' ? "ASC" : "DESC"; + return anchor(current_url() . "?order_field={$field}&order_value={$value}", $label); +} // + +function getFieldIndex_Row_ProductHelper($field, $entity, array $viewDatas): string { - $value = $value ?: DEFAULTS['EMPTY']; switch ($field) { default: - return getFieldForm_ProductHelper($field, $value, $fieldFormOptions, $attributes); + return getFieldView_ProductHelper($field, $entity, $viewDatas); break; } } // - -function getFieldIndex_Column_ProductHelper($field, $order_field, $order_value, array $attributes = array()) -{ - $label = lang("Product.label.{$field}"); - $label = $field == $order_field ? sprintf('%s ', $label, $order_value == 'ASC' ? "up" : "down") : $label; - $order_value = $order_value == 'DESC' ? "ASC" : "DESC"; - return anchor(current_url() . "?order_field={$field}&order_value={$order_value}", $label, [...$attributes]); -} // - -function getFieldIndex_Row_ProductHelper($field, $entity, array $fieldFilters, $fieldFormOptions, $attributes = array()): string +function getFieldIndex_Row_ProductHelper_Admin($field, $entity, array $viewDatas): string { switch ($field) { default: - return getFieldView_ProductHelper($field, $entity, $fieldFilters, $fieldFormOptions, $attributes); - break; - } -} // - -function getFieldIndex_Row_ProductHelper_Admin($field, $entity, array $fieldFilters, $fieldFormOptions, $attributes = array()): string -{ - switch ($field) { - default: - if (in_array($field, $fieldFilters)) { - $attributes["onChange"] = sprintf('location.href="%s/toggle/%s/%s?%s="+this.options[this.selectedIndex].value', current_url(), $entity->getPrimaryKey(), $field, $field); - return getFieldForm_ProductHelper($field, $entity->$field, $fieldFormOptions, $attributes); + if (in_array($field, $viewDatas['fieldFilters'])) { + $attributes["onChange"] = sprintf( + 'location.href="%s/toggle/%s/%s?%s="+this.options[this.selectedIndex].value', + current_url(), + $entity->getPrimaryKey(), + $field, + $field + ); + return getFieldForm_ProductHelper($field, $entity->field, $viewDatas, $attributes); } - return getFieldIndex_Row_ProductHelper($field, $entity, $fieldFilters, $fieldFormOptions, $attributes); + return getFieldView_ProductHelper($field, $entity, $viewDatas); break; } } // \ No newline at end of file diff --git a/app/Helpers/UserSNS_helper.php b/app/Helpers/UserSNS_helper.php index 5f35544..5053ccb 100644 --- a/app/Helpers/UserSNS_helper.php +++ b/app/Helpers/UserSNS_helper.php @@ -1,112 +1,141 @@ %s", implode(" ", [...$attributes]), lang("UserSNS.label.{$field}")); + return sprintf("%s", implode(" ", $attributes), lang("{$viewDatas['className']}.label.{$field}")); break; } } - //header.php에서 getFieldForm_Helper사용 -function getFieldForm_UserSNSHelper($field, $value, array $fieldFormOptions, array $attributes = array()) +function getFieldForm_UserSNSHelper($field, $value, array $viewDatas, array $attributes = array()) { $value = $value ?: DEFAULTS['EMPTY']; switch ($field) { - case "user_uid": - $fieldFormOptions[$field] = [DEFAULTS['EMPTY'] => lang("UserSNS.label.{$field}") . " 선택", ...$fieldFormOptions[$field]]; - return form_dropdown($field, $fieldFormOptions[$field], $value, [...$attributes, 'class' => "select-field"]); + case 'user_uid': + $viewDatas['fieldFormOptions'][$field] = [DEFAULTS['EMPTY'] => lang("{$viewDatas['className']}.label.{$field}") . " 선택", ...$viewDatas['fieldFormOptions'][$field]]; + return form_dropdown($field, $viewDatas['fieldFormOptions'][$field], $value, [...$attributes, 'class' => "select-field"]); break; - case "status": - $fieldFormOptions[$field] = [DEFAULTS['EMPTY'] => lang("UserSNS.label.{$field}") . " 선택", ...$fieldFormOptions[$field]]; - return form_dropdown($field, $fieldFormOptions[$field], $value, $attributes); - break; - case 'updated_at': - case 'created_at': - return form_input($field, $value, [...$attributes, 'class' => 'calender']); + case 'title': + case 'name': + return form_input($field, $value, ["placeholder" => "예)", "style" => "width:60%; ::placeholder{ color:silver; opacity: 1; }"]); break; case 'passwd': return sprintf( "%s %s %s", - form_password($field, DEFAULTS['EMPTY'], [...$attributes]), - lang("UserSNS.label.confirmpassword"), - form_password('confirmpassword', DEFAULTS['EMPTY'], [...$attributes]), + form_password($field, DEFAULTS['EMPTY']), + lang("{$viewDatas['className']}.label.confirmpassword"), + form_password('confirmpassword', DEFAULTS['EMPTY']), ); break; case 'content': - return form_textarea($field, html_entity_decode($value), [...$attributes, 'class' => 'editor', 'rows' => '20', 'cols' => '100']); + case 'head': + case 'tail': + return form_textarea($field, html_entity_decode($value), ['class' => 'editor', 'rows' => '20', 'cols' => '100']); break; case 'upload_file': + case 'board_file': return form_upload($field); break; + case 'view_cnt': + return form_input($field, $value, ['type' => 'number']); + break; + case "status": + $viewDatas['fieldFormOptions'][$field] = [DEFAULTS['EMPTY'] => lang("{$viewDatas['className']}.label.{$field}") . " 선택", ...$viewDatas['fieldFormOptions'][$field]]; + return form_dropdown($field, $viewDatas['fieldFormOptions'][$field], $value, $attributes); + break; + case 'updated_at': + case 'created_at': + return form_input($field, $value, ['class' => 'calender']); + break; default: - return form_input($field, $value, [...$attributes]); + return form_input($field, $value); break; } } // -function getFieldView_UserSNSHelper($field, $entity, array $fieldFilters, array $fieldFormOptions, array $attributes = array()) +function getFieldView_UserSNSHelper($field, $entity, array $viewDatas) { $value = $entity->$field ?: DEFAULTS['EMPTY']; switch ($field) { - case 'id': - return anchor(current_url() . '/view/' . $entity->getPrimaryKey(), $value, [...$attributes, "target" => "_self"]); + case 'user_uid': + $categorys = array(); + foreach (array_values($viewDatas['fieldFormOptions'][$field]) as $category_2depth) { + foreach ($category_2depth as $key => $label) { + $categorys[$key] = $label; + } + } + return $categorys[$value]; break; + case 'title': + case 'name': + return anchor( + current_url() . '/view/' . $entity->getPrimaryKey(), + $value, + ["target" => "_self"] + ); + break; + case 'board_file': case 'upload_file': - return $value == DEFAULTS['EMPTY'] ? DEFAULTS['EMPTY'] : anchor(current_url() . '/download/' . $entity->getPrimaryKey(), ICONS['IMAGE_FILE'] . explode(DEFAULTS['DELIMITER_FILE'], $value)[0], [...$attributes, "target" => "_self"]); + return $value == DEFAULTS['EMPTY'] ? DEFAULTS['EMPTY'] : anchor(current_url() . "/download/{$field}/{$entity->getPrimaryKey()}", ICONS['IMAGE_FILE'] . explode(DEFAULTS['DELIMITER_FILE'], $value)[0], ["target" => "_self"]); + break; + case 'view_cnt': + return number_format(!$value ? 0 : $value); break; case 'content': return html_entity_decode($value); break; case 'updated_at': case 'created_at': - return isset($value) ? str_split($value, 10)[0] : ""; + return $value ? str_split($value, 10)[0] : ""; break; default: - return in_array($field, $fieldFilters) && $value ? $fieldFormOptions[$field][$value] : $value; + return in_array($field, $viewDatas['fieldFilters']) && $value ? $viewDatas['fieldFormOptions'][$field][$value] : $value; break; } } // -function getFieldFilter_UserSNSHelper($field, $value, array $fieldFormOptions, array $attributes = array()) +function getFieldFilter_UserSNSHelper($field, $value, array $viewDatas) +{ + $viewDatas['fieldFormOptions'][$field] = [DEFAULTS['EMPTY'] => lang("{$viewDatas['className']}.label.{$field}") . " 선택", ...$viewDatas['fieldFormOptions'][$field]]; + return form_dropdown($field, $viewDatas['fieldFormOptions'][$field], $value, ['class' => "select-field"]); +} // + +function getFieldIndex_Column_UserSNSHelper($field, array $viewDatas) +{ + $label = lang("{$viewDatas['className']}.label.{$field}"); + $label = $field == $viewDatas['order_field'] ? sprintf('%s ', $label, $viewDatas['order_value'] == 'ASC' ? "up" : "down") : $label; + $value = $viewDatas['order_value'] == 'DESC' ? "ASC" : "DESC"; + return anchor(current_url() . "?order_field={$field}&order_value={$value}", $label); +} // + +function getFieldIndex_Row_UserSNSHelper($field, $entity, array $viewDatas): string { - $value = $value ?: DEFAULTS['EMPTY']; switch ($field) { default: - return getFieldForm_UserSNSHelper($field, $value, $fieldFormOptions, $attributes); + return getFieldView_UserSNSHelper($field, $entity, $viewDatas); break; } } // - -function getFieldIndex_Column_UserSNSHelper($field, $order_field, $order_value, array $attributes = array()) -{ - $label = lang("UserSNS.label.{$field}"); - $label = $field == $order_field ? sprintf('%s ', $label, $order_value == 'ASC' ? "up" : "down") : $label; - $order_value = $order_value == 'DESC' ? "ASC" : "DESC"; - return anchor(current_url() . "?order_field={$field}&order_value={$order_value}", $label, [...$attributes]); -} // - -function getFieldIndex_Row_UserSNSHelper($field, $entity, array $fieldFilters, $fieldFormOptions, $attributes = array()): string +function getFieldIndex_Row_UserSNSHelper_Admin($field, $entity, array $viewDatas): string { switch ($field) { default: - return getFieldView_UserSNSHelper($field, $entity, $fieldFilters, $fieldFormOptions, $attributes); - break; - } -} // - -function getFieldIndex_Row_UserSNSHelper_Admin($field, $entity, array $fieldFilters, $fieldFormOptions, $attributes = array()): string -{ - switch ($field) { - default: - if (in_array($field, $fieldFilters)) { - $attributes["onChange"] = sprintf('location.href="%s/toggle/%s/%s?%s="+this.options[this.selectedIndex].value', current_url(), $entity->getPrimaryKey(), $field, $field); - return getFieldForm_UserSNSHelper($field, $entity->$field, $fieldFormOptions, $attributes); + if (in_array($field, $viewDatas['fieldFilters'])) { + $attributes["onChange"] = sprintf( + 'location.href="%s/toggle/%s/%s?%s="+this.options[this.selectedIndex].value', + current_url(), + $entity->getPrimaryKey(), + $field, + $field + ); + return getFieldForm_UserSNSHelper($field, $entity->field, $viewDatas, $attributes); } - return getFieldIndex_Row_UserSNSHelper($field, $entity, $fieldFilters, $fieldFormOptions, $attributes); + return getFieldView_UserSNSHelper($field, $entity, $viewDatas); break; } } // \ No newline at end of file diff --git a/app/Helpers/User_helper.php b/app/Helpers/User_helper.php index 2bfa7fd..2771da9 100644 --- a/app/Helpers/User_helper.php +++ b/app/Helpers/User_helper.php @@ -1,127 +1,147 @@ %s", implode(" ", [...$attributes]), lang("User.label.{$field}")); + return sprintf("%s", implode(" ", $attributes), lang("{$viewDatas['className']}.label.{$field}")); break; } } - //header.php에서 getFieldForm_Helper사용 -function getFieldForm_UserHelper($field, $value, array $fieldFormOptions, array $attributes = array()) +function getFieldForm_UserHelper($field, $value, array $viewDatas, array $attributes = array()) { $value = $value ?: DEFAULTS['EMPTY']; switch ($field) { case 'role': - // $fieldFormOptions[$field] = [DEFAULTS['EMPTY'] => lang("User.label.{$field}") . " 선택", ...$fieldFormOptions[$field]]; - // return form_dropdown($field, $fieldFormOptions[$field], $value, [...$attributes, 'class' => "select-field"]); - // return form_multiselect($field, $fieldFormOptions[$field], $value, [...$attributes]); - foreach ($fieldFormOptions[$field] as $key => $label) { - $checkboxs[] = form_checkbox("{$field}[]", $key, in_array($key, is_array($value) ? [...$value] : explode(DEFAULTS['DELIMITER_ROLE'], $value)), $attributes) . $label; + // $viewDatas['fieldFormOptions'][$field] = [DEFAULTS['EMPTY'] => lang("{$viewDatas['className']}.label.{$field}") . " 선택", ...$viewDatas['fieldFormOptions'][$field]]; + // return form_dropdown($field, $viewDatas['fieldFormOptions'][$field], $value, [...$attributes, 'class' => "select-field"]); + // return form_multiselect($field, $fieldFormOptions[$field], is_array($value) ? [...$value] : [$value], [...$attributes]); + foreach ($viewDatas['fieldFormOptions'][$field] as $key => $label) { + $checkboxs[] = form_checkbox("{$field}[]", $key, in_array($key, explode(DEFAULTS["DELIMITER_ROLE"], $value))) . $label; } return implode(" ", $checkboxs); break; - case "status": - $fieldFormOptions[$field] = [DEFAULTS['EMPTY'] => lang("User.label.{$field}") . " 선택", ...$fieldFormOptions[$field]]; - return form_dropdown($field, $fieldFormOptions[$field], $value, $attributes); - break; - case 'updated_at': - case 'created_at': - return form_input($field, $value, [...$attributes, 'class' => 'calender']); + case 'title': + case 'name': + return form_input($field, $value, ["placeholder" => "예)", "style" => "width:60%; ::placeholder{ color:silver; opacity: 1; }"]); break; case 'passwd': return sprintf( "%s %s %s", - form_password($field, DEFAULTS['EMPTY'], [...$attributes]), - lang("User.label.confirmpassword"), - form_password('confirmpassword', DEFAULTS['EMPTY'], [...$attributes]), + form_password($field, DEFAULTS['EMPTY']), + lang("{$viewDatas['className']}.label.confirmpassword"), + form_password('confirmpassword', DEFAULTS['EMPTY']), ); break; case 'content': - return form_textarea($field, html_entity_decode($value), [...$attributes, 'class' => 'editor', 'rows' => '20', 'cols' => '100']); + case 'head': + case 'tail': + return form_textarea($field, html_entity_decode($value), ['class' => 'editor', 'rows' => '20', 'cols' => '100']); break; case 'upload_file': + case 'board_file': return form_upload($field); break; - case 'name': - return form_input($field, $value, [...$attributes, "placeholder" => "예)홍길동", "style" => "width:60%; ::placeholder{ color:silver; opacity: 1; }"]); + case 'view_cnt': + return form_input($field, $value, ['type' => 'number']); + break; + case "status": + $viewDatas['fieldFormOptions'][$field] = [DEFAULTS['EMPTY'] => lang("{$viewDatas['className']}.label.{$field}") . " 선택", ...$viewDatas['fieldFormOptions'][$field]]; + return form_dropdown($field, $viewDatas['fieldFormOptions'][$field], $value, $attributes); + break; + case 'updated_at': + case 'created_at': + return form_input($field, $value, ['class' => 'calender']); break; default: - return form_input($field, $value, [...$attributes]); + return form_input($field, $value); break; } } // -function getFieldView_UserHelper($field, $entity, array $fieldFilters, array $fieldFormOptions, array $attributes = array()) +function getFieldView_UserHelper($field, $entity, array $viewDatas) { $value = $entity->$field ?: DEFAULTS['EMPTY']; switch ($field) { - case 'id': - return anchor(current_url() . '/view/' . $entity->getPrimaryKey(), $value, [...$attributes, "target" => "_self"]); + case 'title': + case 'name': + return anchor( + current_url() . '/view/' . $entity->getPrimaryKey(), + $value, + ["target" => "_self"] + ); break; + case 'board_file': case 'upload_file': - return $value == DEFAULTS['EMPTY'] ? DEFAULTS['EMPTY'] : anchor(current_url() . '/download/' . $entity->getPrimaryKey(), ICONS['IMAGE_FILE'] . explode(DEFAULTS['DELIMITER_FILE'], $value)[0], [...$attributes, "target" => "_self"]); + return $value == DEFAULTS['EMPTY'] ? DEFAULTS['EMPTY'] : anchor(current_url() . "/download/{$field}/{$entity->getPrimaryKey()}", ICONS['IMAGE_FILE'] . explode(DEFAULTS['DELIMITER_FILE'], $value)[0], ["target" => "_self"]); + break; + case 'view_cnt': + return number_format(!$value ? 0 : $value); + break; + case 'content': + return html_entity_decode($value); break; case 'updated_at': case 'created_at': return $value ? str_split($value, 10)[0] : ""; break; - case 'upload_file': - return $value == DEFAULTS['EMPTY'] ? DEFAULTS['EMPTY'] : anchor(current_url() . '/download/' . $entity->getPrimaryKey(), ICONS['IMAGE_FILE'] . explode(DEFAULTS['DELIMITER_FILE'], $value)[0], [...$attributes, "target" => "_self"]); - break; - case 'content': - return html_entity_decode($value); - break; default: - return in_array($field, $fieldFilters) && $value ? $fieldFormOptions[$field][$value] : $value; + return in_array($field, $viewDatas['fieldFilters']) && $value ? $viewDatas['fieldFormOptions'][$field][$value] : $value; break; } } // -function getFieldFilter_UserHelper($field, $value, array $fieldFormOptions, array $attributes = array()) +function getFieldFilter_UserHelper($field, $value, array $viewDatas) +{ + $viewDatas['fieldFormOptions'][$field] = [DEFAULTS['EMPTY'] => lang("{$viewDatas['className']}.label.{$field}") . " 선택", ...$viewDatas['fieldFormOptions'][$field]]; + return form_dropdown($field, $viewDatas['fieldFormOptions'][$field], $value, ['class' => "select-field"]); +} // + +function getFieldIndex_Column_UserHelper($field, array $viewDatas) +{ + $label = lang("{$viewDatas['className']}.label.{$field}"); + $label = $field == $viewDatas['order_field'] ? sprintf('%s ', $label, $viewDatas['order_value'] == 'ASC' ? "up" : "down") : $label; + $value = $viewDatas['order_value'] == 'DESC' ? "ASC" : "DESC"; + return anchor(current_url() . "?order_field={$field}&order_value={$value}", $label); +} // + +function getFieldIndex_Row_UserHelper($field, $entity, array $viewDatas): string +{ + switch ($field) { + default: + return getFieldView_UserHelper($field, $entity, $viewDatas); + break; + } +} // +function getFieldIndex_Row_UserHelper_Admin($field, $entity, array $viewDatas): string { - $value = $value ?: DEFAULTS['EMPTY']; switch ($field) { case 'role': - $fieldFormOptions[$field] = [DEFAULTS['EMPTY'] => lang("User.label.{$field}") . " 선택", ...$fieldFormOptions[$field]]; - return form_dropdown($field, $fieldFormOptions[$field], $value, [...$attributes, 'class' => "select-field"]); - break; - default: - return getFieldForm_UserHelper($field, $value, $fieldFormOptions, $attributes); - break; - } -} // - -function getFieldIndex_Column_UserHelper($field, $order_field, $order_value, array $attributes = array()) -{ - $label = lang("User.label.{$field}"); - $label = $field == $order_field ? sprintf('%s ', $label, $order_value == 'ASC' ? "up" : "down") : $label; - $order_value = $order_value == 'DESC' ? "ASC" : "DESC"; - return anchor(current_url() . "?order_field={$field}&order_value={$order_value}", $label, [...$attributes]); -} // - -function getFieldIndex_Row_UserHelper($field, $entity, array $fieldFilters, $fieldFormOptions, $attributes = array()): string -{ - switch ($field) { - default: - return getFieldView_UserHelper($field, $entity, $fieldFilters, $fieldFormOptions, $attributes); - break; - } -} // - -function getFieldIndex_Row_UserHelper_Admin($field, $entity, array $fieldFilters, $fieldFormOptions, $attributes = array()): string -{ - switch ($field) { - default: - if (in_array($field, $fieldFilters)) { - $attributes["onChange"] = sprintf('location.href="%s/toggle/%s/%s?%s="+this.options[this.selectedIndex].value', current_url(), $entity->getPrimaryKey(), $field, $field); - return getFieldForm_UserHelper($field, $entity->$field, $fieldFormOptions, $attributes); + $value = $entity->$field ?: DEFAULTS['EMPTY']; + // $viewDatas['fieldFormOptions'][$field] = [DEFAULTS['EMPTY'] => lang("{$viewDatas['className']}.label.{$field}") . " 선택", ...$viewDatas['fieldFormOptions'][$field]]; + // return form_dropdown($field, $viewDatas['fieldFormOptions'][$field], $value, [...$attributes, 'class' => "select-field"]); + // return form_multiselect($field, $fieldFormOptions[$field], is_array($value) ? [...$value] : [$value], [...$attributes]); + foreach ($viewDatas['fieldFormOptions'][$field] as $key => $label) { + $checkboxs[] = form_checkbox("{$field}[]", $key, in_array($key, explode(DEFAULTS["DELIMITER_ROLE"], $value))) . $label; } - return getFieldIndex_Row_UserHelper($field, $entity, $fieldFilters, $fieldFormOptions, $attributes); + return implode(" ", $checkboxs); + break; + default: + if (in_array($field, $viewDatas['fieldFilters'])) { + $attributes["onChange"] = sprintf( + 'location.href="%s/toggle/%s/%s?%s="+this.options[this.selectedIndex].value', + current_url(), + $entity->getPrimaryKey(), + $field, + $field + ); + return getFieldForm_UserHelper($field, $entity->field, $viewDatas, $attributes); + } + return getFieldView_UserHelper($field, $entity, $viewDatas); break; } } // \ No newline at end of file diff --git a/app/Language/ko/User.php b/app/Language/ko/User.php index a66064c..0a45307 100644 --- a/app/Language/ko/User.php +++ b/app/Language/ko/User.php @@ -1,6 +1,6 @@ '일반회원', 'vip' => 'VIP회원', + 'guest' => '비회원', 'user' => '일반회원', 'vip' => 'VIP회원', 'bronze' => '일반판매자', 'silver' => '고급판매자', 'gold' => '파워리셀러', 'manager' => '관리자', 'cloudflare' => "Cloudflare관리자", 'director' => '감독자', 'master' => "마스터", ]; diff --git a/app/Models/BaseModel.php b/app/Models/BaseModel.php index 3ca3e65..c5a3cd3 100644 --- a/app/Models/BaseModel.php +++ b/app/Models/BaseModel.php @@ -272,8 +272,10 @@ abstract class BaseModel extends Model } public function setIndexDateFilter($start, $end) { - $this->where("created_at >=", $start); - $this->where("created_at <=", $end); + if ($start !== DEFAULTS['EMPTY'] && $end !== DEFAULTS['EMPTY']) { + $this->where("created_at >=", $start); + $this->where("created_at <=", $end); + } } public function setIndexOrderBy(?string $field, ?string $order) { diff --git a/app/Models/BoardModel.php b/app/Models/BoardModel.php index 12bd14d..cbf1cc6 100644 --- a/app/Models/BoardModel.php +++ b/app/Models/BoardModel.php @@ -91,9 +91,11 @@ class BoardModel extends BaseHierarchyModel //Index관련 public function setIndexWordFilter(string $word) { - parent::setIndexWordFilter($word); - $this->orLike($this->getTitleField(), $word, "both"); - $this->orLike("content", $word, "both"); //befor , after , both + if ($word !== DEFAULTS['EMPTY']) { + parent::setIndexWordFilter($word); + $this->orLike($this->getTitleField(), $word, "both"); + $this->orLike("content", $word, "both"); //befor , after , both + } } //조회수 올리기 diff --git a/app/Models/CategoryModel.php b/app/Models/CategoryModel.php index ad37038..2d7bcd1 100644 --- a/app/Models/CategoryModel.php +++ b/app/Models/CategoryModel.php @@ -75,7 +75,6 @@ class CategoryModel extends BaseHierarchyModel case "isreply": case "isupload": case "isdownload": - case "isaccess": if (array_key_exists($field, $formDatas) && !is_null($formDatas[$field])) { $entity->$field = is_array($formDatas[$field]) ? implode(DEFAULTS['DELIMITER_ROLE'], $formDatas[$field]) : $formDatas[$field]; } @@ -114,15 +113,8 @@ class CategoryModel extends BaseHierarchyModel public function setIndexWordFilter(string $word) { parent::setIndexWordFilter($word); - $this->orLike($this->getTitle(), $word, "both"); //befor , after , both - $this->orLike($word, "both"); //befor , after , both + $this->orLike($this->getTitleField(), $word, "both"); $this->orLike("head", $word, "both"); //befor , after , both $this->orLike("tail", $word, "both"); //befor , after , both - $this->orLike("isaccess", $word, "both"); //befor , after , both - $this->orLike("isread", $word, "both"); //befor , after , both - $this->orLike("iswrite", $word, "both"); //befor , after , both - $this->orLike("isreply", $word, "both"); //befor , after , both - $this->orLike("isupload", $word, "both"); //befor , after , both - $this->orLike("isdownload", $word, "both"); //befor , after , both } } diff --git a/app/Models/ProductModel.php b/app/Models/ProductModel.php index 040ae50..48c0cf2 100644 --- a/app/Models/ProductModel.php +++ b/app/Models/ProductModel.php @@ -60,19 +60,6 @@ class ProductModel extends BaseModel } return $rules; } - //Form 선택용 Options Data용 - public function getOptions_TEST(array $conditions = array(), $options = array()): array - { - foreach ($this->getEntitys($conditions) as $entity) { - // STATUS가 use가 아닐때 option을 disabled되게 하기위함 - if ($entity->getStatus() != DEFAULTS['STATUS']) { - $options[$entity->getPrimaryKey() . "\" disabled=\"disabled"] = $entity->getTitle(); - } else { - $options[$entity->getPrimaryKey()] = $entity->getTitle(); - } - } - return $options; - } //Field별 Form Option용 public function getFieldFormOption(string $field): array { diff --git a/app/Models/UserModel.php b/app/Models/UserModel.php index 0793a37..c41b5a5 100644 --- a/app/Models/UserModel.php +++ b/app/Models/UserModel.php @@ -106,7 +106,7 @@ class UserModel extends BaseModel public function setIndexWordFilter(string $word) { parent::setIndexWordFilter($word); - $this->orLike("id", $word, "both"); $this->orLike($this->getTitleField(), $word, "both"); //befor , after , both + $this->orLike("id", $word, "both"); } } diff --git a/app/Views/admin/board/index.php b/app/Views/admin/board/index.php index 0e4ec9b..92f4da4 100644 --- a/app/Views/admin/board/index.php +++ b/app/Views/admin/board/index.php @@ -4,42 +4,42 @@
"get")) ?> - +
- + - + - - - getStatus() != DEFAULTS['STATUS'] ? 'class="table-danger" rowcolor="red"' : 'rowcolor="red"' ?> onClick="indexRowCheckBoxToggle(this);"> + + + getStatus() != DEFAULTS['STATUS'] ? 'class="table-danger" rowcolor="red"' : 'rowcolor="red"' ?> onClick="indexRowCheckBoxToggle(this)"> - - - + + + - - + +
번호 작업
"checkbox_uid_{$entity->getPrimaryKey()}", "name" => "batchjob_uids[]", "value" => $entity->getPrimaryKey(), "class" => "batchjobuids_checkboxs"]); ?> - getPrimaryKey(), $total_count - (($page - 1) * $per_page + $i), ["target" => "_self"]) ?> + getPrimaryKey(), $viewDatas['total_count'] - (($viewDatas['page'] - 1) * $viewDatas['per_page'] + $cnt), ["target" => "_self"]) ?> getPrimaryKey(), ICONS['DELETE'], ["class" => "btn btn-sm btn-danger btn-circle", "target" => "_self"]) ?>
- +
- + endSection() ?> \ No newline at end of file diff --git a/app/Views/admin/board/insert.php b/app/Views/admin/board/insert.php index 4f58b75..3f6857e 100644 --- a/app/Views/admin/board/insert.php +++ b/app/Views/admin/board/insert.php @@ -1,13 +1,13 @@ extend('layouts/admin') ?> section('content') ?>
- + - + - + diff --git a/app/Views/admin/board/reply.php b/app/Views/admin/board/reply.php index 9791057..9f7367c 100644 --- a/app/Views/admin/board/reply.php +++ b/app/Views/admin/board/reply.php @@ -1,19 +1,19 @@ extend('layouts/admin') ?> section('content') ?>
- +
- +
- + - + - +
- $field), $fieldFormOptions) ?> + $field ?: DEFAULTS['EMPTY']), $viewDatas) ?>
"btn btn-outline btn-primary")); ?> "btn btn-outline btn-primary")); ?>
diff --git a/app/Views/admin/board/update.php b/app/Views/admin/board/update.php index 05d8b11..9f7367c 100644 --- a/app/Views/admin/board/update.php +++ b/app/Views/admin/board/update.php @@ -1,19 +1,19 @@ extend('layouts/admin') ?> section('content') ?>
- + - + - + - +
- $field), $fieldFormOptions) ?> + $field ?: DEFAULTS['EMPTY']), $viewDatas) ?>
"btn btn-outline btn-primary")); ?> "btn btn-outline btn-primary")); ?>
diff --git a/app/Views/admin/board/view.php b/app/Views/admin/board/view.php index c8a261a..ae949de 100644 --- a/app/Views/admin/board/view.php +++ b/app/Views/admin/board/view.php @@ -2,11 +2,11 @@ section('content') ?>
- + - + diff --git a/app/Views/admin/category/index.php b/app/Views/admin/category/index.php index b5ff33a..cda9ce7 100644 --- a/app/Views/admin/category/index.php +++ b/app/Views/admin/category/index.php @@ -4,42 +4,42 @@
"get")) ?> - +
- +
- +
- + - - - getStatus() != DEFAULTS['STATUS'] ? 'class="table-danger" rowcolor="red"' : 'rowcolor="red"' ?> onClick="indexRowCheckBoxToggle(this);"> + + + getStatus() != DEFAULTS['STATUS'] ? 'class="table-danger" rowcolor="red"' : 'rowcolor="red"' ?> onClick="indexRowCheckBoxToggle(this)"> - - - + + + - - + +
번호 작업
"checkbox_uid_{$entity->getPrimaryKey()}", "name" => "batchjob_uids[]", "value" => $entity->getPrimaryKey(), "class" => "batchjobuids_checkboxs"]); ?> - getPrimaryKey(), $total_count - (($page - 1) * $per_page + $i), ["target" => "_self"]) ?> + getPrimaryKey(), $viewDatas['total_count'] - (($viewDatas['page'] - 1) * $viewDatas['per_page'] + $cnt), ["target" => "_self"]) ?> getPrimaryKey(), ICONS['DELETE'], ["class" => "btn btn-sm btn-danger btn-circle", "target" => "_self"]) ?>
- +
- +
endSection() ?> \ No newline at end of file diff --git a/app/Views/admin/category/insert.php b/app/Views/admin/category/insert.php index 4276948..d33f387 100644 --- a/app/Views/admin/category/insert.php +++ b/app/Views/admin/category/insert.php @@ -1,13 +1,13 @@ extend('layouts/admin') ?> section('content') ?>
- + - + - + diff --git a/app/Views/admin/category/reply.php b/app/Views/admin/category/reply.php index 093edff..0a4f0fd 100644 --- a/app/Views/admin/category/reply.php +++ b/app/Views/admin/category/reply.php @@ -1,19 +1,19 @@ extend('layouts/admin') ?> section('content') ?>
- +
- +
- + - + - +
- $field), $fieldFormOptions) ?> + $field ?: DEFAULTS['EMPTY']), $viewDatas) ?>
"btn btn-outline btn-primary")); ?> "btn btn-outline btn-primary")); ?>
diff --git a/app/Views/admin/category/update.php b/app/Views/admin/category/update.php index 321a42f..0a4f0fd 100644 --- a/app/Views/admin/category/update.php +++ b/app/Views/admin/category/update.php @@ -1,19 +1,19 @@ extend('layouts/admin') ?> section('content') ?>
- + - + - + - +
- $field), $fieldFormOptions) ?> + $field ?: DEFAULTS['EMPTY']), $viewDatas) ?>
"btn btn-outline btn-primary")); ?> "btn btn-outline btn-primary")); ?>
diff --git a/app/Views/admin/category/view.php b/app/Views/admin/category/view.php index e2f7410..81193b4 100644 --- a/app/Views/admin/category/view.php +++ b/app/Views/admin/category/view.php @@ -2,11 +2,11 @@ section('content') ?>
- + - + diff --git a/app/Views/admin/order/index.php b/app/Views/admin/order/index.php index 1b677a7..857cc7f 100644 --- a/app/Views/admin/order/index.php +++ b/app/Views/admin/order/index.php @@ -4,43 +4,42 @@
"get")) ?> - +
- +
- +
- + - - - getStatus() != DEFAULTS['STATUS'] ? 'class="table-danger" rowcolor="red"' : 'rowcolor="red"' ?> onClick="indexRowCheckBoxToggle(this);"> + + + getStatus() != DEFAULTS['STATUS'] ? 'class="table-danger" rowcolor="red"' : 'rowcolor="red"' ?> onClick="indexRowCheckBoxToggle(this)"> - - - - + + + + - - + +
번호 작업
"checkbox_uid_{$entity->getPrimaryKey()}", "name" => "batchjob_uids[]", "value" => $entity->getPrimaryKey(), "class" => "batchjobuids_checkboxs"]); ?> - - - getStatus() == DEFAULTS['STATUS'] ? anchor('ecommerce/cancelCart/' . $entity->getPrimaryKey(), ICONS['DELETE'], ["class" => "btn btn-sm btn-danger btn-circle", "target" => "_self"]) : "" ?> + getPrimaryKey(), $viewDatas['total_count'] - (($viewDatas['page'] - 1) * $viewDatas['per_page'] + $cnt), ["target" => "_self"]) ?> getPrimaryKey(), ICONS['DELETE'], ["class" => "btn btn-sm btn-danger btn-circle", "target" => "_self"]) ?>
- +
- +
endSection() ?> \ No newline at end of file diff --git a/app/Views/admin/order/view.php b/app/Views/admin/order/view.php index 8221b7e..b3ae6fb 100644 --- a/app/Views/admin/order/view.php +++ b/app/Views/admin/order/view.php @@ -2,11 +2,11 @@ section('content') ?>
- + - + diff --git a/app/Views/admin/product/index.php b/app/Views/admin/product/index.php index f4cc3d1..1d3973a 100644 --- a/app/Views/admin/product/index.php +++ b/app/Views/admin/product/index.php @@ -4,42 +4,42 @@
"get")) ?> - +
- +
- +
- + - - - getStatus() != DEFAULTS['STATUS'] ? 'class="table-danger" rowcolor="red"' : 'rowcolor="red"' ?> onClick="indexRowCheckBoxToggle(this);"> + + + getStatus() != DEFAULTS['STATUS'] ? 'class="table-danger" rowcolor="red"' : 'rowcolor="red"' ?> onClick="indexRowCheckBoxToggle(this)"> - - - + + + - - + +
번호 작업
"checkbox_uid_{$entity->getPrimaryKey()}", "name" => "batchjob_uids[]", "value" => $entity->getPrimaryKey(), "class" => "batchjobuids_checkboxs"]); ?> - getPrimaryKey(), $total_count - (($page - 1) * $per_page + $i), ["target" => "_self"]) ?> + getPrimaryKey(), $viewDatas['total_count'] - (($viewDatas['page'] - 1) * $viewDatas['per_page'] + $cnt), ["target" => "_self"]) ?> getPrimaryKey(), ICONS['DELETE'], ["class" => "btn btn-sm btn-danger btn-circle", "target" => "_self"]) ?>
- +
- +
endSection() ?> \ No newline at end of file diff --git a/app/Views/admin/product/insert.php b/app/Views/admin/product/insert.php index b82ef8d..92dd634 100644 --- a/app/Views/admin/product/insert.php +++ b/app/Views/admin/product/insert.php @@ -1,13 +1,13 @@ extend('layouts/admin') ?> section('content') ?>
- + - + - + diff --git a/app/Views/admin/product/update.php b/app/Views/admin/product/update.php index d4b1674..dc11a74 100644 --- a/app/Views/admin/product/update.php +++ b/app/Views/admin/product/update.php @@ -1,19 +1,19 @@ extend('layouts/admin') ?> section('content') ?>
- +
- +
- + - + - +
- $field), $fieldFormOptions) ?> + $field ?: DEFAULTS['EMPTY']), $viewDatas) ?>
"btn btn-outline btn-primary")); ?> "btn btn-outline btn-primary")); ?>
diff --git a/app/Views/admin/product/view.php b/app/Views/admin/product/view.php index c658d85..17dfe2d 100644 --- a/app/Views/admin/product/view.php +++ b/app/Views/admin/product/view.php @@ -2,14 +2,15 @@ section('content') ?>
- + - +
- +
- endSection() ?> \ No newline at end of file +
+endSection() ?> \ No newline at end of file diff --git a/app/Views/admin/user/index.php b/app/Views/admin/user/index.php index 57e6a6a..3b0b431 100644 --- a/app/Views/admin/user/index.php +++ b/app/Views/admin/user/index.php @@ -4,42 +4,42 @@
"get")) ?> - +
- + - + - - - getStatus() != DEFAULTS['STATUS'] ? 'class="table-danger" rowcolor="red"' : 'rowcolor="red"' ?> onClick="indexRowCheckBoxToggle(this);"> + + + getStatus() != DEFAULTS['STATUS'] ? 'class="table-danger" rowcolor="red"' : 'rowcolor="red"' ?> onClick="indexRowCheckBoxToggle(this)"> - - - + + + - - + +
번호 작업
"checkbox_uid_{$entity->getPrimaryKey()}", "name" => "batchjob_uids[]", "value" => $entity->getPrimaryKey(), "class" => "batchjobuids_checkboxs"]); ?> - getPrimaryKey(), $total_count - (($page - 1) * $per_page + $i), ["target" => "_self"]) ?> + getPrimaryKey(), $viewDatas['total_count'] - (($viewDatas['page'] - 1) * $viewDatas['per_page'] + $cnt), ["target" => "_self"]) ?> getPrimaryKey(), ICONS['DELETE'], ["class" => "btn btn-sm btn-danger btn-circle", "target" => "_self"]) ?>
- +
- + endSection() ?> \ No newline at end of file diff --git a/app/Views/admin/user/insert.php b/app/Views/admin/user/insert.php index 2687319..3074c50 100644 --- a/app/Views/admin/user/insert.php +++ b/app/Views/admin/user/insert.php @@ -1,13 +1,13 @@ extend('layouts/admin') ?> section('content') ?>
- + - + - + diff --git a/app/Views/admin/user/update.php b/app/Views/admin/user/update.php index f83e3b3..62b90d4 100644 --- a/app/Views/admin/user/update.php +++ b/app/Views/admin/user/update.php @@ -1,19 +1,19 @@ extend('layouts/admin') ?> section('content') ?>
- +
- +
- + - + - +
- $field), $fieldFormOptions) ?> + $field ?: DEFAULTS['EMPTY']), $viewDatas) ?>
"btn btn-outline btn-primary")); ?> "btn btn-outline btn-primary")); ?>
diff --git a/app/Views/admin/user/view.php b/app/Views/admin/user/view.php index a812e5d..32e5ef6 100644 --- a/app/Views/admin/user/view.php +++ b/app/Views/admin/user/view.php @@ -2,11 +2,11 @@ section('content') ?>
- + - + diff --git a/app/Views/admin/usersns/index.php b/app/Views/admin/usersns/index.php index b4a08b9..5f5d99d 100644 --- a/app/Views/admin/usersns/index.php +++ b/app/Views/admin/usersns/index.php @@ -4,42 +4,42 @@
"get")) ?> - +
- +
- +
- + - - - getStatus() != DEFAULTS['STATUS'] ? 'class="table-danger" rowcolor="red"' : 'rowcolor="red"' ?> onClick="indexRowCheckBoxToggle(this);"> + + + getStatus() != DEFAULTS['STATUS'] ? 'class="table-danger" rowcolor="red"' : 'rowcolor="red"' ?> onClick="indexRowCheckBoxToggle(this)"> - - - + + + - - + +
번호 작업
"checkbox_uid_{$entity->getPrimaryKey()}", "name" => "batchjob_uids[]", "value" => $entity->getPrimaryKey(), "class" => "batchjobuids_checkboxs"]); ?> - getPrimaryKey(), $total_count - (($page - 1) * $per_page + $i), ["target" => "_self"]) ?> + getPrimaryKey(), $viewDatas['total_count'] - (($viewDatas['page'] - 1) * $viewDatas['per_page'] + $cnt), ["target" => "_self"]) ?> getPrimaryKey(), ICONS['DELETE'], ["class" => "btn btn-sm btn-danger btn-circle", "target" => "_self"]) ?>
- +
- +
endSection() ?> \ No newline at end of file diff --git a/app/Views/admin/usersns/view.php b/app/Views/admin/usersns/view.php index 261ec14..72809be 100644 --- a/app/Views/admin/usersns/view.php +++ b/app/Views/admin/usersns/view.php @@ -2,11 +2,11 @@ section('content') ?>
- + - + diff --git a/app/Views/auth/login.php b/app/Views/auth/login.php index 580cee3..1826923 100644 --- a/app/Views/auth/login.php +++ b/app/Views/auth/login.php @@ -2,7 +2,7 @@ section('content') ?>
- +
- +
@@ -11,7 +11,7 @@ diff --git a/app/Views/front/board/index.php b/app/Views/front/board/index.php index be236f7..f669bd0 100644 --- a/app/Views/front/board/index.php +++ b/app/Views/front/board/index.php @@ -4,35 +4,50 @@
"get")) ?> - +
+
계정 '57', 'height' => '60']) ?> - $login_button) : ?> + $login_button) : ?>
- + - - - getStatus() != DEFAULTS['STATUS'] ? 'class="table-danger" rowcolor="red"' : 'rowcolor="red"' ?> onClick="indexRowCheckBoxToggle(this);"> + + + getStatus() != DEFAULTS['STATUS'] ? 'class="table-danger" rowcolor="red"' : 'rowcolor="red"' ?> onClick="indexRowCheckBoxToggle(this)"> + + + + - - - - - + +
번호
- get(SESSION_NAMES['ISLOGIN']) && $entity->getUser_Uid() == $session->get(SESSION_NAMES['AUTH'])[AUTH_FIELDS['ID']]) : ?> - getPrimaryKey(), $total_count - (($page - 1) * $per_page + $i), ["target" => "_self"]) ?> + + getUser_Uid() == $viewDatas['auth'][AUTH_FIELDS['ID']]) : ?> + getPrimaryKey(), $viewDatas['total_count'] - (($viewDatas['page'] - 1) * $viewDatas['per_page'] + $cnt), ["target" => "_self"]) ?> - - + + + + + getUser_Uid() == $viewDatas['auth'][AUTH_FIELDS['ID']]) : ?> + getPrimaryKey(), ICONS['DELETE'], ["class" => "btn btn-sm btn-danger btn-circle", "target" => "_self"]) ?> +
- + +
+
endSection() ?> \ No newline at end of file diff --git a/app/Views/front/board/insert.php b/app/Views/front/board/insert.php index 8295a29..3f6857e 100644 --- a/app/Views/front/board/insert.php +++ b/app/Views/front/board/insert.php @@ -1,13 +1,13 @@ -extend('layouts/front') ?> +extend('layouts/admin') ?> section('content') ?>
- + - + - + diff --git a/app/Views/front/board/reply.php b/app/Views/front/board/reply.php index 1d55f40..9f7367c 100644 --- a/app/Views/front/board/reply.php +++ b/app/Views/front/board/reply.php @@ -1,19 +1,19 @@ -extend('layouts/front') ?> +extend('layouts/admin') ?> section('content') ?>
- +
- +
- + - + - +
- $field), $fieldFormOptions) ?> + $field ?: DEFAULTS['EMPTY']), $viewDatas) ?>
"btn btn-outline btn-primary")); ?> "btn btn-outline btn-primary")); ?>
diff --git a/app/Views/front/board/update.php b/app/Views/front/board/update.php index 45d1ec7..9f7367c 100644 --- a/app/Views/front/board/update.php +++ b/app/Views/front/board/update.php @@ -1,19 +1,19 @@ -extend('layouts/front') ?> +extend('layouts/admin') ?> section('content') ?>
- + - + - + - +
- $field), $fieldFormOptions) ?> + $field ?: DEFAULTS['EMPTY']), $viewDatas) ?>
"btn btn-outline btn-primary")); ?> "btn btn-outline btn-primary")); ?>
diff --git a/app/Views/front/board/view.php b/app/Views/front/board/view.php index 8b7bb8c..ae949de 100644 --- a/app/Views/front/board/view.php +++ b/app/Views/front/board/view.php @@ -1,12 +1,12 @@ -extend('layouts/front') ?> +extend('layouts/admin') ?> section('content') ?>
- + - + diff --git a/app/Views/front/order/index.php b/app/Views/front/order/index.php index 9d6922b..7d8f4fe 100644 --- a/app/Views/front/order/index.php +++ b/app/Views/front/order/index.php @@ -4,35 +4,37 @@
"get")) ?> - +
+
- +
- + - - - getStatus() != DEFAULTS['STATUS'] ? 'class="table-danger" rowcolor="red"' : 'rowcolor="red"' ?> onClick="indexRowCheckBoxToggle(this);"> + + + getStatus() != DEFAULTS['STATUS'] ? 'class="table-danger" rowcolor="red"' : 'rowcolor="red"' ?> onClick="indexRowCheckBoxToggle(this)"> - - - + + + - - + +
번호 작업
- + getStatus() == DEFAULTS['STATUS'] ? anchor('ecommerce/cancelCart/' . $entity->getPrimaryKey(), ICONS['DELETE'], ["class" => "btn btn-sm btn-danger btn-circle", "target" => "_self"]) : "" ?>
- +
+
endSection() ?> \ No newline at end of file diff --git a/app/Views/front/order/view.php b/app/Views/front/order/view.php index cff0668..b3ae6fb 100644 --- a/app/Views/front/order/view.php +++ b/app/Views/front/order/view.php @@ -1,12 +1,12 @@ -extend('layouts/front') ?> +extend('layouts/admin') ?> section('content') ?>
- + - + diff --git a/app/Views/front/product/index.php b/app/Views/front/product/index.php index 140705d..188f8e9 100644 --- a/app/Views/front/product/index.php +++ b/app/Views/front/product/index.php @@ -4,31 +4,33 @@
"get")) ?> - +
+
- +
- + - - - getStatus() != DEFAULTS['STATUS'] ? 'class="table-danger" rowcolor="red"' : 'rowcolor="red"' ?> onClick="indexRowCheckBoxToggle(this);"> + + + getStatus() != DEFAULTS['STATUS'] ? 'class="table-danger" rowcolor="red"' : 'rowcolor="red"' ?> onClick="indexRowCheckBoxToggle(this)"> - - - + + + - - + +
번호
- +
- +
+
endSection() ?> \ No newline at end of file diff --git a/app/Views/front/product/view.php b/app/Views/front/product/view.php index 8921ec3..5d249d5 100644 --- a/app/Views/front/product/view.php +++ b/app/Views/front/product/view.php @@ -1,12 +1,12 @@ -extend('layouts/front') ?> +extend('layouts/admin') ?> section('content') ?>
- + - + @@ -19,4 +19,5 @@ 이제품은 현재[getStatus()) ?>]입니다. - endSection() ?> \ No newline at end of file + +endSection() ?> \ No newline at end of file diff --git a/app/Views/front/user/index.php b/app/Views/front/user/index.php index 57e6a6a..d220f60 100644 --- a/app/Views/front/user/index.php +++ b/app/Views/front/user/index.php @@ -1,45 +1,51 @@ -extend('layouts/admin') ?> +extend('layouts/front') ?> section('content') ?>
"get")) ?> - +
- +
- +
- - + - - - getStatus() != DEFAULTS['STATUS'] ? 'class="table-danger" rowcolor="red"' : 'rowcolor="red"' ?> onClick="indexRowCheckBoxToggle(this);"> + + + getStatus() != DEFAULTS['STATUS'] ? 'class="table-danger" rowcolor="red"' : 'rowcolor="red"' ?> onClick="indexRowCheckBoxToggle(this)"> + + + + - - - - - - + +
번호작업
- "checkbox_uid_{$entity->getPrimaryKey()}", "name" => "batchjob_uids[]", "value" => $entity->getPrimaryKey(), "class" => "batchjobuids_checkboxs"]); ?> - getPrimaryKey(), $total_count - (($page - 1) * $per_page + $i), ["target" => "_self"]) ?> + + viewDatas[SESSION_NAMES['ISLOGIN']] && $entity->getUser_Uid() == $this->viewDatas['auth'][AUTH_FIELDS['ID']]) : ?> + getPrimaryKey(), $viewDatas['total_count'] - (($viewDatas['page'] - 1) * $viewDatas['per_page'] + $cnt), ["target" => "_self"]) ?> + + + + viewDatas[SESSION_NAMES['ISLOGIN']] && $entity->getUser_Uid() == $this->viewDatas['auth'][AUTH_FIELDS['ID']]) : ?> + getPrimaryKey(), ICONS['DELETE'], ["class" => "btn btn-sm btn-danger btn-circle", "target" => "_self"]) ?> + getPrimaryKey(), ICONS['DELETE'], ["class" => "btn btn-sm btn-danger btn-circle", "target" => "_self"]) ?>
- +
- +
endSection() ?> \ No newline at end of file diff --git a/app/Views/front/user/update.php b/app/Views/front/user/update.php index f83e3b3..62b90d4 100644 --- a/app/Views/front/user/update.php +++ b/app/Views/front/user/update.php @@ -1,19 +1,19 @@ extend('layouts/admin') ?> section('content') ?>
- + - + - + - +
- $field), $fieldFormOptions) ?> + $field ?: DEFAULTS['EMPTY']), $viewDatas) ?>
"btn btn-outline btn-primary")); ?> "btn btn-outline btn-primary")); ?>
diff --git a/app/Views/front/user/view.php b/app/Views/front/user/view.php index a812e5d..32e5ef6 100644 --- a/app/Views/front/user/view.php +++ b/app/Views/front/user/view.php @@ -2,11 +2,11 @@ section('content') ?>
- + - + diff --git a/app/Views/layouts/admin.php b/app/Views/layouts/admin.php index 4fcd268..9559b3c 100644 --- a/app/Views/layouts/admin.php +++ b/app/Views/layouts/admin.php @@ -5,32 +5,32 @@ - + - + - - + + - <?= $title ?> + <?= $viewDatas['title'] ?>
- +
- include($layout['path'] . '/left_menu'); ?> + include($viewDatas['layout']['path'] . '/left_menu'); ?> include('templates/admin/header'); ?> @@ -38,7 +38,7 @@ include('templates/admin/footer'); ?>
diff --git a/app/Views/layouts/admin/left_menu.php b/app/Views/layouts/admin/left_menu.php index 7ebd6ca..d63aba4 100644 --- a/app/Views/layouts/admin/left_menu.php +++ b/app/Views/layouts/admin/left_menu.php @@ -3,8 +3,8 @@
- include($layout['path'] . '/left_menu/base'); ?> - include($layout['path'] . '/left_menu/board'); ?> - include($layout['path'] . '/left_menu/shoppingmall'); ?> + include($viewDatas['layout']['path'] . '/left_menu/base'); ?> + include($viewDatas['layout']['path'] . '/left_menu/board'); ?> + include($viewDatas['layout']['path'] . '/left_menu/shoppingmall'); ?>
\ No newline at end of file diff --git a/app/Views/layouts/admin/member_link.php b/app/Views/layouts/admin/member_link.php index 9c462c2..e3eba47 100644 --- a/app/Views/layouts/admin/member_link.php +++ b/app/Views/layouts/admin/member_link.php @@ -1,12 +1,12 @@