shoppingmallv2 init...

This commit is contained in:
최준흠 2023-08-03 15:47:01 +09:00
parent 735d66b925
commit f361560279
19 changed files with 26 additions and 31 deletions

View File

@ -61,6 +61,9 @@ abstract class BaseController extends Controller
$this->_session = \Config\Services::session(); $this->_session = \Config\Services::session();
$this->_viewDatas['layout'] = LAYOUTS['empty']; $this->_viewDatas['layout'] = LAYOUTS['empty'];
$this->_viewDatas['session'] = $this->_session; $this->_viewDatas['session'] = $this->_session;
$this->_viewDatas['title'] = lang($this->_model->getClassName() . '.title');
$this->_viewDatas['class_icon'] = CLASS_ICONS[strtoupper($this->_model->getClassName())];
helper($this->_model->getClassName());
} }
abstract public function getFields(string $action): array; abstract public function getFields(string $action): array;

View File

@ -13,9 +13,7 @@ class ProductController extends FrontController
{ {
$this->_model = new ProductModel(); $this->_model = new ProductModel();
parent::initController($request, $response, $logger); parent::initController($request, $response, $logger);
$this->_viewDatas['title'] = lang($this->_model->getClassName() . '.title');
$this->_viewPath .= strtolower($this->_model->getClassName()); $this->_viewPath .= strtolower($this->_model->getClassName());
helper($this->_model->getClassName());
} }
public function getFields(string $action = ""): array public function getFields(string $action = ""): array

View File

@ -117,7 +117,7 @@ function getFieldIndex_Row_BoardConfigHelper($field, $entity, array $fieldFilter
{ {
switch ($field) { switch ($field) {
default: default:
return getFieldView_BoardConfigHelper($field, $entity, $fieldFormOptions, $attributes); return getFieldView_BoardConfigHelper($field, $entity, $fieldFilters, $fieldFormOptions, $attributes);
break; break;
} }
} // } //
@ -130,7 +130,7 @@ function getFieldIndex_Row_BoardConfigHelper_Admin($field, $entity, array $field
$attributes["onChange"] = sprintf('location.href="%s/toggle/%s/%s?%s="+this.options[this.selectedIndex].value', current_url(), $entity->getPrimaryKey(), $field, $field); $attributes["onChange"] = sprintf('location.href="%s/toggle/%s/%s?%s="+this.options[this.selectedIndex].value', current_url(), $entity->getPrimaryKey(), $field, $field);
return getFieldForm_BoardConfigHelper($field, $entity->$field, $fieldFormOptions, $attributes); return getFieldForm_BoardConfigHelper($field, $entity->$field, $fieldFormOptions, $attributes);
} }
return getFieldIndex_Row_BoardConfigHelper($field, $entity, $fieldFormOptions, $attributes); return getFieldIndex_Row_BoardConfigHelper($field, $entity, $fieldFilters, $fieldFormOptions, $attributes);
break; break;
} }
} // } //

View File

@ -120,7 +120,7 @@ function getFieldIndex_Row_BoardHelper($field, $entity, array $fieldFilters, $fi
{ {
switch ($field) { switch ($field) {
default: default:
return getFieldView_BoardHelper($field, $entity, $fieldFormOptions, $attributes); return getFieldView_BoardHelper($field, $entity, $fieldFilters, $fieldFormOptions, $attributes);
break; break;
} }
} // } //
@ -133,7 +133,7 @@ function getFieldIndex_Row_BoardHelper_Admin($field, $entity, array $fieldFilter
$attributes["onChange"] = sprintf('location.href="%s/toggle/%s/%s?%s="+this.options[this.selectedIndex].value', current_url(), $entity->getPrimaryKey(), $field, $field); $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); return getFieldForm_BoardHelper($field, $entity->$field, $fieldFormOptions, $attributes);
} }
return getFieldIndex_Row_BoardHelper($field, $entity, $fieldFormOptions, $attributes); return getFieldIndex_Row_BoardHelper($field, $entity, $fieldFilters, $fieldFormOptions, $attributes);
break; break;
} }
} // } //

View File

@ -112,7 +112,7 @@ function getFieldIndex_Row_CategoryHelper($field, $entity, array $fieldFilters,
{ {
switch ($field) { switch ($field) {
default: default:
return getFieldView_CategoryHelper($field, $entity, $fieldFormOptions, $attributes); return getFieldView_CategoryHelper($field, $entity, $fieldFilters, $fieldFormOptions, $attributes);
break; break;
} }
} // } //
@ -125,7 +125,7 @@ function getFieldIndex_Row_CategoryHelper_Admin($field, $entity, array $fieldFil
$attributes["onChange"] = sprintf('location.href="%s/toggle/%s/%s?%s="+this.options[this.selectedIndex].value', current_url(), $entity->getPrimaryKey(), $field, $field); $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); return getFieldForm_CategoryHelper($field, $entity->$field, $fieldFormOptions, $attributes);
} }
return getFieldIndex_Row_CategoryHelper($field, $entity, $fieldFormOptions, $attributes); return getFieldIndex_Row_CategoryHelper($field, $entity, $fieldFilters, $fieldFormOptions, $attributes);
break; break;
} }
} // } //

View File

@ -154,7 +154,7 @@ function imageSubmit_CommonHelper(string $src, array $attributes = [])
} }
// STATUS가 use가 아닐때 option을 disabled되게 하기위함 (override form_dropdown) // STATUS가 use가 아닐때 option을 disabled되게 하기위함 (override form_dropdown)
function form_dropdown($data = '', $options = [], $selected = [], $extra = ''): string function form_dropdown_test($data = '', $options = [], $selected = [], $extra = ''): string
{ {
$defaults = []; $defaults = [];
if (is_array($data)) { if (is_array($data)) {

View File

@ -97,7 +97,7 @@ function getFieldIndex_Row_OrderHelper_Admin($field, $entity, array $fieldFilter
$attributes["onChange"] = sprintf('location.href="%s/toggle/%s/%s?%s="+this.options[this.selectedIndex].value', current_url(), $entity->getPrimaryKey(), $field, $field); $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 getFieldForm_OrderHelper($field, $entity->$field, $fieldFormOptions, $attributes);
} }
return getFieldIndex_Row_OrderHelper($field, $entity, $fieldFormOptions, $attributes); return getFieldIndex_Row_OrderHelper($field, $entity, $fieldFilters, $fieldFormOptions, $attributes);
break; break;
} }
} // } //

View File

@ -124,7 +124,7 @@ function getFieldIndex_Row_ProductHelper($field, $entity, array $fieldFilters, $
{ {
switch ($field) { switch ($field) {
default: default:
return getFieldView_ProductHelper($field, $entity, $fieldFormOptions, $attributes); return getFieldView_ProductHelper($field, $entity, $fieldFilters, $fieldFormOptions, $attributes);
break; break;
} }
} // } //
@ -137,7 +137,7 @@ function getFieldIndex_Row_ProductHelper_Admin($field, $entity, array $fieldFilt
$attributes["onChange"] = sprintf('location.href="%s/toggle/%s/%s?%s="+this.options[this.selectedIndex].value', current_url(), $entity->getPrimaryKey(), $field, $field); $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); return getFieldForm_ProductHelper($field, $entity->$field, $fieldFormOptions, $attributes);
} }
return getFieldIndex_Row_ProductHelper($field, $entity, $fieldFormOptions, $attributes); return getFieldIndex_Row_ProductHelper($field, $entity, $fieldFilters, $fieldFormOptions, $attributes);
break; break;
} }
} // } //

View File

@ -93,7 +93,7 @@ function getFieldIndex_Row_UserSNSHelper($field, $entity, array $fieldFilters, $
{ {
switch ($field) { switch ($field) {
default: default:
return getFieldView_UserSNSHelper($field, $entity, $fieldFormOptions, $attributes); return getFieldView_UserSNSHelper($field, $entity, $fieldFilters, $fieldFormOptions, $attributes);
break; break;
} }
} // } //
@ -106,7 +106,7 @@ function getFieldIndex_Row_UserSNSHelper_Admin($field, $entity, array $fieldFilt
$attributes["onChange"] = sprintf('location.href="%s/toggle/%s/%s?%s="+this.options[this.selectedIndex].value', current_url(), $entity->getPrimaryKey(), $field, $field); $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); return getFieldForm_UserSNSHelper($field, $entity->$field, $fieldFormOptions, $attributes);
} }
return getFieldIndex_Row_UserSNSHelper($field, $entity, $fieldFormOptions, $attributes); return getFieldIndex_Row_UserSNSHelper($field, $entity, $fieldFilters, $fieldFormOptions, $attributes);
break; break;
} }
} // } //

View File

@ -108,7 +108,7 @@ function getFieldIndex_Row_UserHelper($field, $entity, array $fieldFilters, $fie
{ {
switch ($field) { switch ($field) {
default: default:
return getFieldView_UserHelper($field, $entity, $fieldFormOptions, $attributes); return getFieldView_UserHelper($field, $entity, $fieldFilters, $fieldFormOptions, $attributes);
break; break;
} }
} // } //
@ -121,7 +121,7 @@ function getFieldIndex_Row_UserHelper_Admin($field, $entity, array $fieldFilters
$attributes["onChange"] = sprintf('location.href="%s/toggle/%s/%s?%s="+this.options[this.selectedIndex].value', current_url(), $entity->getPrimaryKey(), $field, $field); $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); return getFieldForm_UserHelper($field, $entity->$field, $fieldFormOptions, $attributes);
} }
return getFieldIndex_Row_UserHelper($field, $entity, $fieldFormOptions, $attributes); return getFieldIndex_Row_UserHelper($field, $entity, $fieldFilters, $fieldFormOptions, $attributes);
break; break;
} }
} // } //

View File

@ -52,7 +52,7 @@ class BoardConfigModel extends BaseModel
return $rules; return $rules;
} }
//Form 선택용 Options Data용 //Form 선택용 Options Data용
public function getOptions(array $conditions = array(), $options = array()): array public function getOptions_TEST(array $conditions = array(), $options = array()): array
{ {
foreach ($this->getEntitys($conditions) as $entity) { foreach ($this->getEntitys($conditions) as $entity) {
// STATUS가 use가 아닐때 option을 disabled되게 하기위함 // STATUS가 use가 아닐때 option을 disabled되게 하기위함

View File

@ -40,7 +40,6 @@ class CategoryModel extends BaseHierarchyModel
return $rules; return $rules;
} }
//Form 선택용 Options Data용
public function getOptions(array $conditions = array(), $options = array()): array public function getOptions(array $conditions = array(), $options = array()): array
{ {
//대분류 부분은 선택이 되지 않게 하기위해 따로 만듬 (form_dropdown의 optgroup 기능) //대분류 부분은 선택이 되지 않게 하기위해 따로 만듬 (form_dropdown의 optgroup 기능)
@ -50,12 +49,7 @@ class CategoryModel extends BaseHierarchyModel
$options[$entity->getTitle()] = []; $options[$entity->getTitle()] = [];
$old_title = $entity->getTitle(); $old_title = $entity->getTitle();
} else { } else {
// STATUS가 use가 아닐때 option을 disabled되게 하기위함 $options[$old_title][$entity->getPrimaryKey()] = $entity->getTitle();
if ($entity->getStatus() != DEFAULTS['STATUS']) {
$options[$old_title][$entity->getPrimaryKey() . "\" disabled=\"disabled"] = $entity->getTitle();
} else {
$options[$old_title][$entity->getPrimaryKey()] = $entity->getTitle();
}
} }
} }
return $options; return $options;

View File

@ -61,7 +61,7 @@ class ProductModel extends BaseModel
return $rules; return $rules;
} }
//Form 선택용 Options Data용 //Form 선택용 Options Data용
public function getOptions(array $conditions = array(), $options = array()): array public function getOptions_TEST(array $conditions = array(), $options = array()): array
{ {
foreach ($this->getEntitys($conditions) as $entity) { foreach ($this->getEntitys($conditions) as $entity) {
// STATUS가 use가 아닐때 option을 disabled되게 하기위함 // STATUS가 use가 아닐때 option을 disabled되게 하기위함

View File

@ -55,7 +55,7 @@ class UserModel extends BaseModel
return $rules; return $rules;
} }
//Form 선택용 Options Data용 //Form 선택용 Options Data용
public function getOptions(array $conditions = array(), $options = array()): array public function getOptions_TEST(array $conditions = array(), $options = array()): array
{ {
foreach ($this->getEntitys($conditions) as $entity) { foreach ($this->getEntitys($conditions) as $entity) {
// STATUS가 use가 아닐때 option을 disabled되게 하기위함 // STATUS가 use가 아닐때 option을 disabled되게 하기위함

View File

@ -25,7 +25,7 @@
<?php endif; ?> <?php endif; ?>
</td> </td>
<?php foreach ($fields as $field) : ?> <?php foreach ($fields as $field) : ?>
<td nowrap><?= getFieldView_BoardHelper($field, $entity, $fieldFilters, $fieldFormOptions) ?></td> <td nowrap><?= getFieldIndex_Row_ProductHelper($field, $entity, $fieldFilters, $fieldFormOptions) ?></td>
<?php endforeach; ?> <?php endforeach; ?>
</tr> </tr>
<?php $i++; ?> <?php $i++; ?>

View File

@ -22,7 +22,7 @@
<?= $total_count - (($page - 1) * $per_page + $i) ?> <?= $total_count - (($page - 1) * $per_page + $i) ?>
</td> </td>
<?php foreach ($fields as $field) : ?> <?php foreach ($fields as $field) : ?>
<td nowrap><?= getFieldView_OrderHelper($field, $entity, $fieldFilters, $fieldFormOptions) ?></td> <td nowrap><?= getFieldIndex_Row_ProductHelper($field, $entity, $fieldFilters, $fieldFormOptions) ?></td>
<?php endforeach; ?> <?php endforeach; ?>
<td> <td>
<?= $entity->getStatus() == DEFAULTS['STATUS'] ? anchor('ecommerce/cancelCart/' . $entity->getPrimaryKey(), ICONS['DELETE'], ["class" => "btn btn-sm btn-danger btn-circle", "target" => "_self"]) : "" ?> <?= $entity->getStatus() == DEFAULTS['STATUS'] ? anchor('ecommerce/cancelCart/' . $entity->getPrimaryKey(), ICONS['DELETE'], ["class" => "btn btn-sm btn-danger btn-circle", "target" => "_self"]) : "" ?>

View File

@ -21,7 +21,7 @@
<?= $total_count - (($page - 1) * $per_page + $i) ?> <?= $total_count - (($page - 1) * $per_page + $i) ?>
</td> </td>
<?php foreach ($fields as $field) : ?> <?php foreach ($fields as $field) : ?>
<td nowrap><?= getFieldView_ProductHelper($field, $entity, $fieldFilters, $fieldFormOptions) ?></td> <td nowrap><?= getFieldIndex_Row_ProductHelper($field, $entity, $fieldFilters, $fieldFormOptions) ?></td>
<?php endforeach; ?> <?php endforeach; ?>
</tr> </tr>
<?php $i++; ?> <?php $i++; ?>

View File

@ -1,3 +1,3 @@
<div class="header"> <div class="header">
<h4><?= CLASS_ICONS[$className] ?></i><?= $title ?></h4> <h4><?= $class_icon ?></i><?= $title ?></h4>
</div> </div>

View File

@ -1,3 +1,3 @@
<div class="header"> <div class="header">
<h4><?= CLASS_ICONS[$className] ?></i><?= $title ?></h4> <h4><?= $class_icon ?></i><?= $title ?></h4>
</div> </div>