shoppingmallv2 init...
This commit is contained in:
parent
967680977f
commit
98d7404c09
@ -39,9 +39,9 @@ $routes->get('/login', 'AuthController::login');
|
|||||||
$routes->post('/signup', 'AuthController::signup/local');
|
$routes->post('/signup', 'AuthController::signup/local');
|
||||||
$routes->get('/signup/(:alpha)', 'AuthController::signup/$1');
|
$routes->get('/signup/(:alpha)', 'AuthController::signup/$1');
|
||||||
$routes->get('/logout', 'AuthController::logout');
|
$routes->get('/logout', 'AuthController::logout');
|
||||||
$routes->group('cart', ['namespace' => 'App\Controllers'], static function ($routes) {
|
$routes->group('ecommerce', ['namespace' => 'App\Controllers'], static function ($routes) {
|
||||||
$routes->post('addCart', 'CartController::addCart');
|
$routes->post('addCart', 'EcommerceController::addCart');
|
||||||
$routes->get('cancelCart/(:uuid)', 'CartController::cancelCart/$1');
|
$routes->get('cancelCart/(:uuid)', 'EcommerceController::cancelCart/$1');
|
||||||
});;
|
});;
|
||||||
$routes->group('cli', ['namespace' => 'App\Controllers\CLI'], function ($routes) {
|
$routes->group('cli', ['namespace' => 'App\Controllers\CLI'], function ($routes) {
|
||||||
});
|
});
|
||||||
@ -93,7 +93,41 @@ $routes->group('admin', ['namespace' => 'App\Controllers\Admin', 'filter' => 'au
|
|||||||
$routes->get('delete/(:num)', 'BoardController::delete/$1', ['filter' => 'authFilter:master']);
|
$routes->get('delete/(:num)', 'BoardController::delete/$1', ['filter' => 'authFilter:master']);
|
||||||
$routes->get('toggle/(:num)/(:hash)', 'BoardController::toggle/$1/$2');
|
$routes->get('toggle/(:num)/(:hash)', 'BoardController::toggle/$1/$2');
|
||||||
$routes->post('batchjob', 'BoardController::batchjob');
|
$routes->post('batchjob', 'BoardController::batchjob');
|
||||||
$routes->get('download/(:any)/(:num)', 'BoardController::download/$1/$2');
|
$routes->get('download/(:any)/(:uuid)', 'ProductController::download/$1/$2');
|
||||||
|
});
|
||||||
|
$routes->group('category', static function ($routes) {
|
||||||
|
$routes->get('', 'CategoryController::index');
|
||||||
|
$routes->get('excel', 'CategoryController::excel/$1');
|
||||||
|
$routes->get('insert', 'CategoryController::insert_form');
|
||||||
|
$routes->post('insert', 'CategoryController::insert');
|
||||||
|
$routes->get('update/(:num)', 'CategoryController::update_form/$1');
|
||||||
|
$routes->post('update/(:num)', 'CategoryController::update/$1');
|
||||||
|
$routes->get('view/(:num)', 'CategoryController::view/$1');
|
||||||
|
$routes->get('reply/(:num)', 'CategoryController::reply_form/$1');
|
||||||
|
$routes->post('reply/(:num)', 'CategoryController::reply/$1');
|
||||||
|
$routes->get('delete/(:num)', 'CategoryController::delete/$1', ['filter' => 'authFilter:master']);
|
||||||
|
$routes->get('toggle/(:num)/(:hash)', 'CategoryController::toggle/$1/$2');
|
||||||
|
$routes->post('batchjob', 'CategoryController::batchjob');
|
||||||
|
});
|
||||||
|
$routes->group('product', static function ($routes) {
|
||||||
|
$routes->get('', 'ProductController::index');
|
||||||
|
$routes->get('excel', 'ProductController::excel/$1');
|
||||||
|
$routes->get('insert', 'ProductController::insert_form');
|
||||||
|
$routes->post('insert', 'ProductController::insert');
|
||||||
|
$routes->get('update/(:uuid)', 'ProductController::update_form/$1');
|
||||||
|
$routes->post('update/(:uuid)', 'ProductController::update/$1');
|
||||||
|
$routes->get('view/(:uuid)', 'ProductController::view/$1');
|
||||||
|
$routes->get('delete/(:uuid)', 'ProductController::delete/$1', ['filter' => 'authFilter:master']);
|
||||||
|
$routes->get('toggle/(:uuid)/(:hash)', 'ProductController::toggle/$1/$2');
|
||||||
|
$routes->post('batchjob', 'ProductController::batchjob');
|
||||||
|
$routes->get('download/(:any)/(:uuid)', 'ProductController::download/$1/$2');
|
||||||
|
});
|
||||||
|
$routes->group('order', static function ($routes) {
|
||||||
|
$routes->get('', 'OrderController::index');
|
||||||
|
$routes->get('view/(:uuid)', 'OrderController::view/$1');
|
||||||
|
$routes->get('delete/(:uuid)', 'OrderController::delete/$1', ['filter' => 'authFilter:master']);
|
||||||
|
$routes->get('toggle/(:uuid)/(:hash)', 'OrderController::toggle/$1/$2');
|
||||||
|
$routes->post('batchjob', 'OrderController::batchjob`');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
$routes->group('front', ['namespace' => 'App\Controllers\Front'], function ($routes) {
|
$routes->group('front', ['namespace' => 'App\Controllers\Front'], function ($routes) {
|
||||||
@ -115,6 +149,15 @@ $routes->group('front', ['namespace' => 'App\Controllers\Front'], function ($rou
|
|||||||
$routes->get('delete/(:num)', 'BoardController::delete/$1', ['filter' => 'authFilter:master']);
|
$routes->get('delete/(:num)', 'BoardController::delete/$1', ['filter' => 'authFilter:master']);
|
||||||
$routes->get('download/(:any)/(:num)', 'BoardController::download/$1/$2');
|
$routes->get('download/(:any)/(:num)', 'BoardController::download/$1/$2');
|
||||||
});
|
});
|
||||||
|
$routes->group('product', static function ($routes) {
|
||||||
|
$routes->get('', 'ProductController::index');
|
||||||
|
$routes->get('excel', 'ProductController::excel/$1');
|
||||||
|
$routes->get('view/(:uuid)', 'ProductController::view/$1');
|
||||||
|
});
|
||||||
|
$routes->group('order', static function ($routes) {
|
||||||
|
$routes->get('', 'OrderController::index');
|
||||||
|
$routes->get('view/(:uuid)', 'OrderController::view/$1');
|
||||||
|
});;
|
||||||
});
|
});
|
||||||
/*
|
/*
|
||||||
* --------------------------------------------------------------------
|
* --------------------------------------------------------------------
|
||||||
|
|||||||
@ -120,6 +120,7 @@ $routes->group('admin', ['namespace' => 'App\Controllers\Admin', 'filter' => 'au
|
|||||||
$routes->get('delete/(:uuid)', 'ProductController::delete/$1', ['filter' => 'authFilter:master']);
|
$routes->get('delete/(:uuid)', 'ProductController::delete/$1', ['filter' => 'authFilter:master']);
|
||||||
$routes->get('toggle/(:uuid)/(:hash)', 'ProductController::toggle/$1/$2');
|
$routes->get('toggle/(:uuid)/(:hash)', 'ProductController::toggle/$1/$2');
|
||||||
$routes->post('batchjob', 'ProductController::batchjob');
|
$routes->post('batchjob', 'ProductController::batchjob');
|
||||||
|
$routes->get('download/(:any)/(:uuid)', 'ProductController::download/$1/$2');
|
||||||
});
|
});
|
||||||
$routes->group('order', static function ($routes) {
|
$routes->group('order', static function ($routes) {
|
||||||
$routes->get('', 'OrderController::index');
|
$routes->get('', 'OrderController::index');
|
||||||
|
|||||||
@ -7,7 +7,7 @@ CREATE TABLE servermgr.tw_user (
|
|||||||
passwd varchar(100) NOT NULL,
|
passwd varchar(100) NOT NULL,
|
||||||
name varchar(20) NOT NULL COMMENT "사용자명",
|
name varchar(20) NOT NULL COMMENT "사용자명",
|
||||||
email varchar(50) NOT NULL,
|
email varchar(50) NOT NULL,
|
||||||
role varchar(30) NOT NULL DEFAULT 'user' COMMENT '사용자등급',
|
role varchar(255) NOT NULL DEFAULT 'user' COMMENT '사용자등급',
|
||||||
status varchar(10) NOT NULL DEFAULT 'use' COMMENT 'use: 사용,unuse: 사용않함',
|
status varchar(10) NOT NULL DEFAULT 'use' COMMENT 'use: 사용,unuse: 사용않함',
|
||||||
updated_at timestamp NULL DEFAULT NULL,
|
updated_at timestamp NULL DEFAULT NULL,
|
||||||
created_at timestamp NOT NULL DEFAULT current_timestamp(),
|
created_at timestamp NOT NULL DEFAULT current_timestamp(),
|
||||||
|
|||||||
@ -23,16 +23,16 @@ function getFieldForm_BoardConfigHelper($field, $value, array $fieldFormOptions,
|
|||||||
case 'isupload':
|
case 'isupload':
|
||||||
case 'isdownload':
|
case 'isdownload':
|
||||||
$fieldFormOptions[$field] = [DEFAULTS['EMPTY'] => lang("BoardConfig.label.{$field}") . " 선택", ...$fieldFormOptions[$field]];
|
$fieldFormOptions[$field] = [DEFAULTS['EMPTY'] => lang("BoardConfig.label.{$field}") . " 선택", ...$fieldFormOptions[$field]];
|
||||||
return form_dropdown($field, $fieldFormOptions[$field], is_array($value) ? [...$value] : [$value], [...$attributes, 'class' => "select-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) {
|
// 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;
|
// $checkboxs[] = form_checkbox("{$field}[]", $key, in_array($key, is_array($value) ? [...$value] : explode(DEFAULTS['DELIMITER_ROLE'], $value)), $attributes) . $label;
|
||||||
// }
|
// }
|
||||||
// return implode(" ", $checkboxs);
|
// return implode(" ", $checkboxs);
|
||||||
// return form_multiselect($field, $fieldFormOptions[$field], is_array($value) ? [...$value] : [$value], [...$attributes]);
|
|
||||||
break;
|
break;
|
||||||
case "status":
|
case "status":
|
||||||
$fieldFormOptions[$field] = [DEFAULTS['EMPTY'] => lang("BoardConfig.label.{$field}") . " 선택", ...$fieldFormOptions[$field]];
|
$fieldFormOptions[$field] = [DEFAULTS['EMPTY'] => lang("BoardConfig.label.{$field}") . " 선택", ...$fieldFormOptions[$field]];
|
||||||
return form_dropdown($field, $fieldFormOptions[$field], is_array($value) ? [...$value] : [$value], $attributes);
|
return form_dropdown($field, $fieldFormOptions[$field], $value, $attributes);
|
||||||
break;
|
break;
|
||||||
case 'updated_at':
|
case 'updated_at':
|
||||||
case 'created_at':
|
case 'created_at':
|
||||||
@ -90,6 +90,15 @@ function getFieldFilter_BoardConfigHelper($field, $value, array $fieldFormOption
|
|||||||
{
|
{
|
||||||
$value = $value ?: DEFAULTS['EMPTY'];
|
$value = $value ?: DEFAULTS['EMPTY'];
|
||||||
switch ($field) {
|
switch ($field) {
|
||||||
|
case 'isaccess':
|
||||||
|
case 'isread':
|
||||||
|
case 'iswrite':
|
||||||
|
case 'isreply':
|
||||||
|
case 'isupload':
|
||||||
|
case 'isdownload':
|
||||||
|
$fieldFormOptions[$field] = [DEFAULTS['EMPTY'] => lang("BoardConfig.label.{$field}") . " 선택", ...$fieldFormOptions[$field]];
|
||||||
|
return form_dropdown($field, $fieldFormOptions[$field], $value, [...$attributes, 'class' => "select-field"]);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
return getFieldForm_BoardConfigHelper($field, $value, $fieldFormOptions, $attributes);
|
return getFieldForm_BoardConfigHelper($field, $value, $fieldFormOptions, $attributes);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@ -18,11 +18,11 @@ function getFieldForm_BoardHelper($field, $value, array $fieldFormOptions, array
|
|||||||
case "board_config_uid":
|
case "board_config_uid":
|
||||||
case "user_uid":
|
case "user_uid":
|
||||||
$fieldFormOptions[$field] = [DEFAULTS['EMPTY'] => lang("Board.label.{$field}") . " 선택", ...$fieldFormOptions[$field]];
|
$fieldFormOptions[$field] = [DEFAULTS['EMPTY'] => lang("Board.label.{$field}") . " 선택", ...$fieldFormOptions[$field]];
|
||||||
return form_dropdown($field, $fieldFormOptions[$field], is_array($value) ? [...$value] : [$value], [...$attributes, 'class' => "select-field"]);
|
return form_dropdown($field, $fieldFormOptions[$field], $value, [...$attributes, 'class' => "select-field"]);
|
||||||
break;
|
break;
|
||||||
case "status":
|
case "status":
|
||||||
$fieldFormOptions[$field] = [DEFAULTS['EMPTY'] => lang("Board.label.{$field}") . " 선택", ...$fieldFormOptions[$field]];
|
$fieldFormOptions[$field] = [DEFAULTS['EMPTY'] => lang("Board.label.{$field}") . " 선택", ...$fieldFormOptions[$field]];
|
||||||
return form_dropdown($field, $fieldFormOptions[$field], is_array($value) ? [...$value] : [$value], $attributes);
|
return form_dropdown($field, $fieldFormOptions[$field], $value, $attributes);
|
||||||
break;
|
break;
|
||||||
case 'updated_at':
|
case 'updated_at':
|
||||||
case 'created_at':
|
case 'created_at':
|
||||||
|
|||||||
@ -17,16 +17,11 @@ function getFieldForm_CategoryHelper($field, $value, array $fieldFormOptions, ar
|
|||||||
switch ($field) {
|
switch ($field) {
|
||||||
case "user_uid":
|
case "user_uid":
|
||||||
$fieldFormOptions[$field] = [DEFAULTS['EMPTY'] => lang("Category.label.{$field}") . " 선택", ...$fieldFormOptions[$field]];
|
$fieldFormOptions[$field] = [DEFAULTS['EMPTY'] => lang("Category.label.{$field}") . " 선택", ...$fieldFormOptions[$field]];
|
||||||
return form_dropdown($field, $fieldFormOptions[$field], is_array($value) ? [...$value] : [$value], [...$attributes, 'class' => "select-field"]);
|
return form_dropdown($field, $fieldFormOptions[$field], $value, [...$attributes, 'class' => "select-field"]);
|
||||||
// foreach ($fieldFormOptions[$field] as $key => $label) {
|
|
||||||
// $checkboxs[] = form_checkbox("{$field}[]", $key, in_array($key, is_array($value) ? [...$value] : [$value]), $attributes) . $label;
|
|
||||||
// }
|
|
||||||
// return implode(" ", $checkboxs);
|
|
||||||
// return form_multiselect($field, $fieldFormOptions[$field], is_array($value) ? [...$value] : [$value], [...$attributes]);
|
|
||||||
break;
|
break;
|
||||||
case "status":
|
case "status":
|
||||||
$fieldFormOptions[$field] = [DEFAULTS['EMPTY'] => lang("Category.label.{$field}") . " 선택", ...$fieldFormOptions[$field]];
|
$fieldFormOptions[$field] = [DEFAULTS['EMPTY'] => lang("Category.label.{$field}") . " 선택", ...$fieldFormOptions[$field]];
|
||||||
return form_dropdown($field, $fieldFormOptions[$field], is_array($value) ? [...$value] : [$value], $attributes);
|
return form_dropdown($field, $fieldFormOptions[$field], $value, $attributes);
|
||||||
break;
|
break;
|
||||||
case 'updated_at':
|
case 'updated_at':
|
||||||
case 'created_at':
|
case 'created_at':
|
||||||
@ -83,7 +78,7 @@ function getFieldView_CategoryHelper($field, $entity, array $fieldFilters, array
|
|||||||
return html_entity_decode($value);
|
return html_entity_decode($value);
|
||||||
break;
|
break;
|
||||||
case 'upload_file':
|
case 'upload_file':
|
||||||
return $value == DEFAULTS['EMPTY'] ? DEFAULTS['EMPTY'] : anchor(current_url() . '/download/' . $entity->getPrimaryKey(), ICONS['IMAGE_FILE'] . explode(DEFAULTS['FILE_DLIMITER'], $value)[0], [...$attributes, "target" => "_self"]);
|
return $value == DEFAULTS['EMPTY'] ? DEFAULTS['EMPTY'] : anchor(current_url() . '/download/' . $entity->getPrimaryKey(), ICONS['IMAGE_FILE'] . explode(DEFAULTS['DELLIMITER_FILE'], $value)[0], [...$attributes, "target" => "_self"]);
|
||||||
break;
|
break;
|
||||||
case 'updated_at':
|
case 'updated_at':
|
||||||
case 'created_at':
|
case 'created_at':
|
||||||
|
|||||||
@ -152,3 +152,77 @@ function imageSubmit_CommonHelper(string $src, array $attributes = [])
|
|||||||
...$attributes,
|
...$attributes,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// STATUS가 use가 아닐때 option을 disabled되게 하기위함 (override form_dropdown)
|
||||||
|
function form_dropdown($data = '', $options = [], $selected = [], $extra = ''): string
|
||||||
|
{
|
||||||
|
$defaults = [];
|
||||||
|
if (is_array($data)) {
|
||||||
|
if (isset($data['selected'])) {
|
||||||
|
$selected = $data['selected'];
|
||||||
|
unset($data['selected']); // select tags don't have a selected attribute
|
||||||
|
}
|
||||||
|
if (isset($data['options'])) {
|
||||||
|
$options = $data['options'];
|
||||||
|
unset($data['options']); // select tags don't use an options attribute
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$defaults = ['name' => $data];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!is_array($selected)) {
|
||||||
|
$selected = [$selected];
|
||||||
|
}
|
||||||
|
if (!is_array($options)) {
|
||||||
|
$options = [$options];
|
||||||
|
}
|
||||||
|
|
||||||
|
// If no selected state was submitted we will attempt to set it automatically
|
||||||
|
if (empty($selected)) {
|
||||||
|
if (is_array($data)) {
|
||||||
|
if (isset($data['name'], $_POST[$data['name']])) {
|
||||||
|
$selected = [$_POST[$data['name']]];
|
||||||
|
}
|
||||||
|
} elseif (isset($_POST[$data])) {
|
||||||
|
$selected = [$_POST[$data]];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Standardize selected as strings, like the option keys will be
|
||||||
|
foreach ($selected as $key => $item) {
|
||||||
|
$selected[$key] = (string) $item;
|
||||||
|
}
|
||||||
|
|
||||||
|
$extra = stringify_attributes($extra);
|
||||||
|
$multiple = (count($selected) > 1 && stripos($extra, 'multiple') === false) ? ' multiple="multiple"' : '';
|
||||||
|
$form = '<select ' . rtrim(parse_form_attributes($data, $defaults)) . $extra . $multiple . ">\n";
|
||||||
|
|
||||||
|
foreach ($options as $key => $val) {
|
||||||
|
// Keys should always be strings for strict comparison
|
||||||
|
$key = (string) $key;
|
||||||
|
|
||||||
|
if (is_array($val)) {
|
||||||
|
if (empty($val)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$form .= '<optgroup label="' . $key . "\">\n";
|
||||||
|
|
||||||
|
foreach ($val as $optgroupKey => $optgroupVal) {
|
||||||
|
// Keys should always be strings for strict comparison
|
||||||
|
$optgroupKey = (string) $optgroupKey;
|
||||||
|
|
||||||
|
$sel = in_array($optgroupKey, $selected, true) ? ' selected="selected"' : '';
|
||||||
|
$form .= '<option value="' . $optgroupKey . '"' . $sel . '>' . $optgroupVal . "</option>\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
$form .= "</optgroup>\n";
|
||||||
|
} else {
|
||||||
|
$form .= '<option value="' . $key . '"'
|
||||||
|
. (in_array($key, $selected, true) ? ' selected="selected"' : '') . '>'
|
||||||
|
. $val . "</option>\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $form . "</select>\n";
|
||||||
|
}
|
||||||
|
|||||||
@ -18,16 +18,11 @@ function getFieldForm_OrderHelper($field, $value, array $fieldFormOptions, array
|
|||||||
case "product_uid":
|
case "product_uid":
|
||||||
case "user_uid":
|
case "user_uid":
|
||||||
$fieldFormOptions[$field] = [DEFAULTS['EMPTY'] => lang("Order.label.{$field}") . " 선택", ...$fieldFormOptions[$field]];
|
$fieldFormOptions[$field] = [DEFAULTS['EMPTY'] => lang("Order.label.{$field}") . " 선택", ...$fieldFormOptions[$field]];
|
||||||
return form_dropdown($field, $fieldFormOptions[$field], is_array($value) ? [...$value] : [$value], [...$attributes, 'class' => "select-field"]);
|
return form_dropdown($field, $fieldFormOptions[$field], $value, [...$attributes, 'class' => "select-field"]);
|
||||||
// foreach ($fieldFormOptions[$field] as $key => $label) {
|
|
||||||
// $checkboxs[] = form_checkbox("{$field}[]", $key, in_array($key, is_array($value) ? [...$value] : [$value]), $attributes) . $label;
|
|
||||||
// }
|
|
||||||
// return implode(" ", $checkboxs);
|
|
||||||
// return form_multiselect($field, $fieldFormOptions[$field], is_array($value) ? [...$value] : [$value], [...$attributes]);
|
|
||||||
break;
|
break;
|
||||||
case "status":
|
case "status":
|
||||||
$fieldFormOptions[$field] = [DEFAULTS['EMPTY'] => lang("Order.label.{$field}") . " 선택", ...$fieldFormOptions[$field]];
|
$fieldFormOptions[$field] = [DEFAULTS['EMPTY'] => lang("Order.label.{$field}") . " 선택", ...$fieldFormOptions[$field]];
|
||||||
return form_dropdown($field, $fieldFormOptions[$field], is_array($value) ? [...$value] : [$value], $attributes);
|
return form_dropdown($field, $fieldFormOptions[$field], $value, $attributes);
|
||||||
break;
|
break;
|
||||||
case 'updated_at':
|
case 'updated_at':
|
||||||
case 'created_at':
|
case 'created_at':
|
||||||
|
|||||||
@ -18,16 +18,11 @@ function getFieldForm_ProductHelper($field, $value, array $fieldFormOptions, arr
|
|||||||
case "category_uid":
|
case "category_uid":
|
||||||
case "user_uid":
|
case "user_uid":
|
||||||
$fieldFormOptions[$field] = [DEFAULTS['EMPTY'] => lang("Product.label.{$field}") . " 선택", ...$fieldFormOptions[$field]];
|
$fieldFormOptions[$field] = [DEFAULTS['EMPTY'] => lang("Product.label.{$field}") . " 선택", ...$fieldFormOptions[$field]];
|
||||||
return form_dropdown($field, $fieldFormOptions[$field], is_array($value) ? [...$value] : [$value], [...$attributes, 'class' => "select-field"]);
|
return form_dropdown($field, $fieldFormOptions[$field], $value, [...$attributes, 'class' => "select-field"]);
|
||||||
// foreach ($fieldFormOptions[$field] as $key => $label) {
|
|
||||||
// $checkboxs[] = form_checkbox("{$field}[]", $key, in_array($key, is_array($value) ? [...$value] : [$value]), $attributes) . $label;
|
|
||||||
// }
|
|
||||||
// return implode(" ", $checkboxs);
|
|
||||||
// return form_multiselect($field, $fieldFormOptions[$field], is_array($value) ? [...$value] : [$value], [...$attributes]);
|
|
||||||
break;
|
break;
|
||||||
case "status":
|
case "status":
|
||||||
$fieldFormOptions[$field] = [DEFAULTS['EMPTY'] => lang("Product.label.{$field}") . " 선택", ...$fieldFormOptions[$field]];
|
$fieldFormOptions[$field] = [DEFAULTS['EMPTY'] => lang("Product.label.{$field}") . " 선택", ...$fieldFormOptions[$field]];
|
||||||
return form_dropdown($field, $fieldFormOptions[$field], is_array($value) ? [...$value] : [$value], $attributes);
|
return form_dropdown($field, $fieldFormOptions[$field], $value, [...$attributes]);
|
||||||
break;
|
break;
|
||||||
case 'updated_at':
|
case 'updated_at':
|
||||||
case 'created_at':
|
case 'created_at':
|
||||||
@ -86,7 +81,7 @@ function getFieldView_ProductHelper($field, $entity, array $fieldFilters, array
|
|||||||
break;
|
break;
|
||||||
case 'photo':
|
case 'photo':
|
||||||
case 'upload_file':
|
case 'upload_file':
|
||||||
return $value == DEFAULTS['EMPTY'] ? DEFAULTS['EMPTY'] : anchor(current_url() . "/download/{$field}/{$entity->getPrimaryKey()}", ICONS['IMAGE_FILE'] . explode(DEFAULTS['FILE_DLIMITER'], $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], [...$attributes, "target" => "_self"]);
|
||||||
break;
|
break;
|
||||||
case 'cost':
|
case 'cost':
|
||||||
case 'price':
|
case 'price':
|
||||||
|
|||||||
@ -18,11 +18,11 @@ function getFieldForm_UserSNSHelper($field, $value, array $fieldFormOptions, arr
|
|||||||
switch ($field) {
|
switch ($field) {
|
||||||
case "user_uid":
|
case "user_uid":
|
||||||
$fieldFormOptions[$field] = [DEFAULTS['EMPTY'] => lang("UserSNS.label.{$field}") . " 선택", ...$fieldFormOptions[$field]];
|
$fieldFormOptions[$field] = [DEFAULTS['EMPTY'] => lang("UserSNS.label.{$field}") . " 선택", ...$fieldFormOptions[$field]];
|
||||||
return form_dropdown($field, $fieldFormOptions[$field], is_array($value) ? [...$value] : [$value], [...$attributes, 'class' => "select-field"]);
|
return form_dropdown($field, $fieldFormOptions[$field], $value, [...$attributes, 'class' => "select-field"]);
|
||||||
break;
|
break;
|
||||||
case "status":
|
case "status":
|
||||||
$fieldFormOptions[$field] = [DEFAULTS['EMPTY'] => lang("UserSNS.label.{$field}") . " 선택", ...$fieldFormOptions[$field]];
|
$fieldFormOptions[$field] = [DEFAULTS['EMPTY'] => lang("UserSNS.label.{$field}") . " 선택", ...$fieldFormOptions[$field]];
|
||||||
return form_dropdown($field, $fieldFormOptions[$field], is_array($value) ? [...$value] : [$value], $attributes);
|
return form_dropdown($field, $fieldFormOptions[$field], $value, $attributes);
|
||||||
break;
|
break;
|
||||||
case 'updated_at':
|
case 'updated_at':
|
||||||
case 'created_at':
|
case 'created_at':
|
||||||
|
|||||||
@ -18,16 +18,16 @@ function getFieldForm_UserHelper($field, $value, array $fieldFormOptions, array
|
|||||||
switch ($field) {
|
switch ($field) {
|
||||||
case 'role':
|
case 'role':
|
||||||
// $fieldFormOptions[$field] = [DEFAULTS['EMPTY'] => lang("User.label.{$field}") . " 선택", ...$fieldFormOptions[$field]];
|
// $fieldFormOptions[$field] = [DEFAULTS['EMPTY'] => lang("User.label.{$field}") . " 선택", ...$fieldFormOptions[$field]];
|
||||||
// return form_dropdown($field, $fieldFormOptions[$field], is_array($value) ? [...$value] : [$value], [...$attributes, 'class' => "select-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) {
|
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;
|
$checkboxs[] = form_checkbox("{$field}[]", $key, in_array($key, is_array($value) ? [...$value] : explode(DEFAULTS['DELIMITER_ROLE'], $value)), $attributes) . $label;
|
||||||
}
|
}
|
||||||
return implode(" ", $checkboxs);
|
return implode(" ", $checkboxs);
|
||||||
// return form_multiselect($field, $fieldFormOptions[$field], is_array($value) ? [...$value] : [$value], [...$attributes]);
|
|
||||||
break;
|
break;
|
||||||
case "status":
|
case "status":
|
||||||
$fieldFormOptions[$field] = [DEFAULTS['EMPTY'] => lang("User.label.{$field}") . " 선택", ...$fieldFormOptions[$field]];
|
$fieldFormOptions[$field] = [DEFAULTS['EMPTY'] => lang("User.label.{$field}") . " 선택", ...$fieldFormOptions[$field]];
|
||||||
return form_dropdown($field, $fieldFormOptions[$field], is_array($value) ? [...$value] : [$value], $attributes);
|
return form_dropdown($field, $fieldFormOptions[$field], $value, $attributes);
|
||||||
break;
|
break;
|
||||||
case 'updated_at':
|
case 'updated_at':
|
||||||
case 'created_at':
|
case 'created_at':
|
||||||
@ -88,7 +88,7 @@ function getFieldFilter_UserHelper($field, $value, array $fieldFormOptions, arra
|
|||||||
switch ($field) {
|
switch ($field) {
|
||||||
case 'role':
|
case 'role':
|
||||||
$fieldFormOptions[$field] = [DEFAULTS['EMPTY'] => lang("User.label.{$field}") . " 선택", ...$fieldFormOptions[$field]];
|
$fieldFormOptions[$field] = [DEFAULTS['EMPTY'] => lang("User.label.{$field}") . " 선택", ...$fieldFormOptions[$field]];
|
||||||
return form_dropdown($field, $fieldFormOptions[$field], is_array($value) ? [...$value] : [$value], [...$attributes, 'class' => "select-field"]);
|
return form_dropdown($field, $fieldFormOptions[$field], $value, [...$attributes, 'class' => "select-field"]);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return getFieldForm_UserHelper($field, $value, $fieldFormOptions, $attributes);
|
return getFieldForm_UserHelper($field, $value, $fieldFormOptions, $attributes);
|
||||||
|
|||||||
@ -142,7 +142,7 @@ abstract class BaseModel extends Model
|
|||||||
switch ($field) {
|
switch ($field) {
|
||||||
case 'user_uid':
|
case 'user_uid':
|
||||||
if (is_null($this->_user_options)) {
|
if (is_null($this->_user_options)) {
|
||||||
$userModel = new UserModel([$this->getPrimaryKey(), $this->getTitleField()]);
|
$userModel = new UserModel();
|
||||||
$this->_user_options = $userModel->getOptions();
|
$this->_user_options = $userModel->getOptions();
|
||||||
}
|
}
|
||||||
$options = $this->_user_options;
|
$options = $this->_user_options;
|
||||||
|
|||||||
@ -42,6 +42,7 @@ class BoardConfigModel extends BaseModel
|
|||||||
case "isdownload":
|
case "isdownload":
|
||||||
//아래 Rule은 입력시에는 되는데 수정시에는 않됨 이유를 ?
|
//아래 Rule은 입력시에는 되는데 수정시에는 않됨 이유를 ?
|
||||||
// $rules[$field] = "required|in_list[master,director,cloudflare,manager,gold,silver,brone,vip,user,guest]";
|
// $rules[$field] = "required|in_list[master,director,cloudflare,manager,gold,silver,brone,vip,user,guest]";
|
||||||
|
//아래 Rule은 checkbox를 사용시에는 required만 우선 써야 수정시 validate문제없음
|
||||||
$rules[$field] = "required";
|
$rules[$field] = "required";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|||||||
@ -56,7 +56,7 @@ class BoardModel extends BaseHierarchyModel
|
|||||||
switch ($field) {
|
switch ($field) {
|
||||||
case 'board_config_uid':
|
case 'board_config_uid':
|
||||||
if (is_null($this->_boardconfig_options)) {
|
if (is_null($this->_boardconfig_options)) {
|
||||||
$boardConfigModel = new BoardConfigModel([$this->getPrimaryKey(), $this->getTitleField()]);
|
$boardConfigModel = new BoardConfigModel();
|
||||||
$this->_boardconfig_options = $boardConfigModel->getOptions();
|
$this->_boardconfig_options = $boardConfigModel->getOptions();
|
||||||
}
|
}
|
||||||
$options = $this->_boardconfig_options;
|
$options = $this->_boardconfig_options;
|
||||||
|
|||||||
@ -47,6 +47,7 @@ class CategoryModel extends BaseHierarchyModel
|
|||||||
|
|
||||||
public function getOptions(array $conditions = array(), $options = array()): array
|
public function getOptions(array $conditions = array(), $options = array()): array
|
||||||
{
|
{
|
||||||
|
//대분류 부분은 선택이 되지 않게 하기위해 따로 만듬 (form_dropdown의 optgroup 기능)
|
||||||
$old_title = "";
|
$old_title = "";
|
||||||
foreach ($this->where($conditions)->orderby("grpno DESC, grporder ASC")->findAll() as $entity) {
|
foreach ($this->where($conditions)->orderby("grpno DESC, grporder ASC")->findAll() as $entity) {
|
||||||
if ($entity->getPrimaryKey() == $entity->getHierarchy_No()) {
|
if ($entity->getPrimaryKey() == $entity->getHierarchy_No()) {
|
||||||
|
|||||||
@ -46,7 +46,7 @@ class OrderModel extends BaseModel
|
|||||||
switch ($field) {
|
switch ($field) {
|
||||||
case 'product_uid':
|
case 'product_uid':
|
||||||
if (is_null($this->_product_options)) {
|
if (is_null($this->_product_options)) {
|
||||||
$productModel = new productModel([$this->getPrimaryKey(), 'product_uid']);
|
$productModel = new productModel();
|
||||||
$this->_product_options = $productModel->getOptions();
|
$this->_product_options = $productModel->getOptions();
|
||||||
}
|
}
|
||||||
$options = $this->_product_options;
|
$options = $this->_product_options;
|
||||||
|
|||||||
@ -67,7 +67,7 @@ class ProductModel extends BaseModel
|
|||||||
switch ($field) {
|
switch ($field) {
|
||||||
case 'category_uid':
|
case 'category_uid':
|
||||||
if (is_null($this->_category_options)) {
|
if (is_null($this->_category_options)) {
|
||||||
$categoryModel = new CategoryModel([$this->getPrimaryKey(), $this->getTitleField()]);
|
$categoryModel = new CategoryModel();
|
||||||
$this->_category_options = $categoryModel->getOptions();
|
$this->_category_options = $categoryModel->getOptions();
|
||||||
}
|
}
|
||||||
$options = $this->_category_options;
|
$options = $this->_category_options;
|
||||||
|
|||||||
@ -45,6 +45,7 @@ class UserModel extends BaseModel
|
|||||||
case "role":
|
case "role":
|
||||||
//아래 Rule은 입력시에는 되는데 수정시에는 않됨 이유를 ?
|
//아래 Rule은 입력시에는 되는데 수정시에는 않됨 이유를 ?
|
||||||
// $rules[$field] = "required|in_list[master,director,cloudflare,manager,gold,silver,brone,vip,user]";
|
// $rules[$field] = "required|in_list[master,director,cloudflare,manager,gold,silver,brone,vip,user]";
|
||||||
|
//아래 Rule은 checkbox를 사용시에는 required만 우선 써야 수정시 validate문제없음
|
||||||
$rules[$field] = "required";
|
$rules[$field] = "required";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -57,6 +58,18 @@ class UserModel extends BaseModel
|
|||||||
{
|
{
|
||||||
return parent::getEntity($conditions);
|
return parent::getEntity($conditions);
|
||||||
}
|
}
|
||||||
|
public function getOptions(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;
|
||||||
|
}
|
||||||
protected function changeFormData(string $action, string $field, array $formDatas, $entity)
|
protected function changeFormData(string $action, string $field, array $formDatas, $entity)
|
||||||
{
|
{
|
||||||
switch ($field) {
|
switch ($field) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user