This commit is contained in:
최준흠 2023-07-26 09:14:15 +09:00
commit 8f7b59c624
30 changed files with 275 additions and 272 deletions

View File

@ -93,21 +93,6 @@ $routes->group('admin', ['namespace' => 'App\Controllers\Admin', 'filter' => 'au
$routes->post('batchjob', 'BoardController::batchjob');
$routes->get('download/(:num)', 'BoardController::download/$1');
});
$routes->group('hpilo', static function ($routes) {
$routes->get('', 'HPILOController::index');
$routes->get('excel', 'HPILOController::excel');
$routes->get('insert', 'HPILOController::insert_form');
$routes->post('insert', 'HPILOController::insert');
$routes->get('update/(:num)', 'HPILOController::update_form/$1');
$routes->post('update/(:num)', 'HPILOController::update/$1');
$routes->get('view/(:num)', 'HPILOController::view/$1');
$routes->get('delete/(:num)', 'HPILOController::delete/$1', ['filter' => 'authFilter:master']);
$routes->get('toggle/(:num)/(:hash)', 'HPILOController::toggle/$1/$2');
$routes->post('batchjob', 'HPILOController::batchjob');
$routes->get('console/(:num)', 'HPILOController::console/$1');
$routes->get('reset/(:num)/(:alpha)', 'HPILOController::reset/$1/$2');
$routes->get('reload/(:num)', 'HPILOController::reload/$1');
});
});
/*
* --------------------------------------------------------------------

View File

@ -21,5 +21,5 @@ class Home extends AdminController
public function index()
{
return view($this->_viewPath . '/welcome_message', $this->_viewDatas);
}
}
}

View File

@ -228,7 +228,7 @@ abstract class BaseController extends Controller
final public function update_form($uid)
{
try {
$entity = $this->_model->getEntity([$this->_model->getPrimaryKey() => $uid]);
$entity = $entity = $this->_model->getEntity([$this->_model->getPrimaryKey() => $uid]);
$this->_viewDatas['fields'] = $this->_model->getFields('update');
$this->_viewDatas['fieldRules'] = $this->_model->getFieldRules($this->_viewDatas['fields'], 'update');
$this->_viewDatas['fieldFilters'] = $this->_model->getFieldFilters();
@ -263,7 +263,7 @@ abstract class BaseController extends Controller
{
$message = "";
try {
$entity = $this->_model->getEntity([$this->_model->getPrimaryKey() => $uid]);
$entity = $entity = $this->_model->getEntity([$this->_model->getPrimaryKey() => $uid]);
$this->_viewDatas['fields'] = $this->_model->getFields('update');
$this->_viewDatas['fieldRules'] = $this->_model->getFieldRules($this->_viewDatas['fields'], 'update');
$this->_viewDatas['fieldFilters'] = $this->_model->getFieldFilters();
@ -295,7 +295,7 @@ abstract class BaseController extends Controller
{
$message = "";
try {
$entity = $this->_model->getEntity([$this->_model->getPrimaryKey() => $uid]);
$entity = $entity = $this->_model->getEntity([$this->_model->getPrimaryKey() => $uid]);
$this->_viewDatas['fields'] = [$field];
$this->_viewDatas['fieldRules'] = $this->_model->getFieldRules($this->_viewDatas['fields'], 'toggle');
$this->_viewDatas['fieldFilters'] = $this->_model->getFieldFilters();
@ -345,7 +345,7 @@ abstract class BaseController extends Controller
$this->_viewDatas['fieldFilters'] = $this->_model->getFieldFilters();
$entitys = array();
foreach ($uids as $uid) {
$entity = $this->_model->getEntity([$this->_model->getPrimaryKey() => $uid]);
$entity = $entity = $this->_model->getEntity([$this->_model->getPrimaryKey() => $uid]);
try {
$entity = $this->batchjob_validate($entity);
array_push($entitys, $this->batchjob_process($entity));
@ -379,7 +379,7 @@ abstract class BaseController extends Controller
{
$message = "";
try {
$entity = $this->_model->getEntity([$this->_model->getPrimaryKey() => $uid]);
$entity = $entity = $this->_model->getEntity([$this->_model->getPrimaryKey() => $uid]);
$this->delete_process($entity);
$message = "{$entity->getTitle()} " . __FUNCTION__ . " 완료하였습니다.";
log_message("info", "{$this->_viewDatas['title']} {$message}");
@ -434,7 +434,7 @@ abstract class BaseController extends Controller
$this->_model->setIndexDateFilter($start, $end);
}
}
protected function index_getRows(int $page = 0, int $per_page = 0): array
protected function index_getEntitys(int $page = 0, int $per_page = 0): array
{
//Totalcount 처리
$this->index_setCondition();
@ -446,9 +446,9 @@ abstract class BaseController extends Controller
$order_value = $this->request->getVar('order_value') ?: 'DESC';
$this->_model->setIndexOrderBy($order_field, $order_value);
//Limit
$rows = $per_page ? $this->_model->findAll($per_page, $page * $per_page - $per_page) : $this->_model->findAll();
$entitys = $per_page ? $this->_model->findAll($per_page, $page * $per_page - $per_page) : $this->_model->findAll();
// log_message("debug", __METHOD__ . "에서 호출[{$per_page}:{$page}=>{$page}*{$per_page}-{$per_page}]\n" . $this->_model->getLastQuery());
return $rows;
return $entitys;
}
private function index_getPagination($pager_group = 'default', int $segment = 0, $template = 'bootstrap_full'): string
{
@ -472,7 +472,7 @@ abstract class BaseController extends Controller
protected function index_process()
{
//모델 처리
$this->_viewDatas['rows'] = $this->index_getRows((int)$this->_viewDatas['page'], (int)$this->_viewDatas['per_page']);
$this->_viewDatas['entitys'] = $this->index_getEntitys((int)$this->_viewDatas['page'], (int)$this->_viewDatas['per_page']);
//줄수 처리용
$this->_viewDatas['pageOptions'] = array("" => "줄수선택");
for ($i = 10; $i <= $this->_viewDatas['total_count'] + $this->_viewDatas['per_page']; $i += 10) {
@ -523,11 +523,10 @@ abstract class BaseController extends Controller
}
//본문용
$line = 2;
foreach ($this->index_getRows() as $row) {
foreach ($this->index_getEntitys() as $entity) {
$column = 'A';
foreach ($this->_viewDatas['fields'] as $field) {
// echo "\n<BR>".var_export($this->_fieldFilters,true)."\n<BR>".var_export($fieldFormOptions,true);exit;
$value = in_array($field, $this->_viewDatas['fieldFilters']) ? $this->_viewDatas['fieldFormOptions'][$field][$row[$field]] : $row[$field];
$value = in_array($field, $this->_viewDatas['fieldFilters']) ? $this->_viewDatas['fieldFormOptions'][$field][$entity->$field] : $entity->$field;
$sheet->setCellValue($column . $line, $value);
$column++;
}

View File

@ -8,4 +8,5 @@ abstract class BaseEntity extends Entity
{
abstract public function getPrimaryKey();
abstract public function getTitle();
abstract public function getStatus();
}

View File

@ -10,6 +10,7 @@ class BoardConfigEntity extends BaseEntity
protected $dates = ['created_at', 'updated_at', 'deleted_at'];
protected $casts = [];
//기본기능
public function getPrimaryKey()
{
return $this->attributes['uid'];
@ -18,6 +19,12 @@ class BoardConfigEntity extends BaseEntity
{
return $this->attributes['name'];
}
public function getStatus()
{
return $this->attributes['status'];
}
//추가기능
public function getHead()
{
return $this->attributes['head'];

View File

@ -10,6 +10,7 @@ class BoardEntity extends BaseEntity
protected $dates = ['created_at', 'updated_at', 'deleted_at'];
protected $casts = [];
//기본기능
public function getPrimaryKey()
{
return $this->attributes['uid'];
@ -18,6 +19,12 @@ class BoardEntity extends BaseEntity
{
return $this->attributes['title'];
}
public function getStatus()
{
return $this->attributes['status'];
}
//추가기능
public function getPassword()
{
return $this->attributes['passwd'];

View File

@ -10,6 +10,7 @@ class UserEntity extends BaseEntity
protected $dates = ['created_at', 'updated_at', 'deleted_at'];
protected $casts = [];
//기본기능
public function getPrimaryKey()
{
return $this->attributes['uid'];
@ -18,6 +19,12 @@ class UserEntity extends BaseEntity
{
return $this->attributes['name'];
}
public function getStatus()
{
return $this->attributes['status'];
}
//추가기능
public function getRole()
{
return $this->attributes['role'];

View File

@ -10,6 +10,7 @@ class UserSNSEntity extends BaseEntity
protected $dates = ['created_at', 'updated_at', 'deleted_at'];
protected $casts = [];
//기본기능
public function getPrimaryKey()
{
return $this->attributes['uid'];
@ -18,4 +19,10 @@ class UserSNSEntity extends BaseEntity
{
return $this->attributes['name'];
}
public function getStatus()
{
return $this->attributes['status'];
}
//추가기능
}

View File

@ -6,7 +6,7 @@ function getFieldLabel_BoardConfigHelper($field, array $fieldRules, array $attri
if (strpos($fieldRules[$field], 'required') !== false) {
array_push($attributes, 'style="color:red";');
}
return sprintf("<span %s>%s</span>", implode(" ", $attributes), lang("Admin/BoardConfig.label.{$field}"));
return sprintf("<span %s>%s</span>", implode(" ", [...$attributes]), lang("Admin/BoardConfig.label.{$field}"));
break;
}
}
@ -22,56 +22,56 @@ function getFieldForm_BoardConfigHelper($field, $value, array $fieldFormOptions,
case 'isreply':
case 'isupload':
case 'isdownload':
$fieldFormOptions[$field] = [DEFAULTS['EMPTY'] => lang("Admin/BoardConfig.label.{$field}") . " 선택", ...$fieldFormOptions[$field]];
return form_dropdown($field, $fieldFormOptions[$field], is_array($value) ? [...$value] : [$value], [...$attributes, 'class' => "select-field"]);
// foreach ($fieldFormOptions[$field] as $key => $label) {
// $checkboxs[] = form_checkbox("{$field}[]", $key, in_array($key, is_array($value) ? $value : explode("|", $value)), $attributes) . $label;
// $checkboxs[] = form_checkbox("{$field}[]", $key, in_array($key, is_array($value) ? [...$value] : [$value]), $attributes) . $label;
// }
// return implode("&nbsp;", $checkboxs);
// break;
// return form_multiselect($field, $fieldFormOptions[$field], is_array($value) ? [...$value] : [$value], [...$attributes]);
break;
case 'status':
$fieldFormOptions[$field] = [DEFAULTS['EMPTY'] => lang("Admin/BoardConfig.label.{$field}") . " 선택", ...$fieldFormOptions[$field]];
return form_dropdown($field, $fieldFormOptions[$field], $value, $attributes);
$fieldFormOptions[$field] = [DEFAULTS['EMPTY'] => lang("Admin/Board.label.{$field}") . " 선택", ...$fieldFormOptions[$field]];
return form_dropdown($field, $fieldFormOptions[$field], is_array($value) ? [...$value] : [$value], $attributes);
break;
case 'updated_at':
case 'created_at':
return form_input($field, $value, [...$attributes, 'class' => 'calender']);
break;
case 'passwd':
case 'confirmpassword':
return form_password($field, DEFAULTS['EMPTY'], $attributes);
return sprintf(
"%s %s %s",
form_password($field, DEFAULTS['EMPTY'], [...$attributes]),
lang("Admin/BoardConfig.label.confirmpassword"),
form_password('confirmpassword', DEFAULTS['EMPTY'], [...$attributes]),
);
break;
case 'head':
case 'tail':
return form_textarea($field, html_entity_decode($value), [...$attributes, 'class' => 'editor', 'rows' => '20', 'cols' => '100']);
break;
case 'upload_file':
return form_upload($field);
break;
default:
return form_input($field, $value, $attributes);
return form_input($field, $value, [...$attributes]);
break;
}
} //
function getFieldView_BoardConfigHelper($field, $entity, array $fieldFilters, array $fieldFormOptions, array $attributes = array())
{
$value = $entity->$field ?: DEFAULTS['EMPTY'];
switch ($field) {
case 'isaccess':
case 'isread':
case 'iswrite':
case 'isreply':
case 'isupload':
case 'isdownload':
foreach ($fieldFormOptions[$field] as $key => $label) {
$checkboxs[] = form_checkbox("{$field}[]", $key, in_array($key, explode("|", $entity->$field)), $attributes) . $label;
}
return implode("&nbsp;", $checkboxs);
case 'upload_file':
return $value == DEFAULTS['EMPTY'] ? DEFAULTS['EMPTY'] : anchor(current_url() . '/download/' . $entity->getPrimaryKey(), ICONS['IMAGE_FILE'] . explode("||", $value)[0], [...$attributes, "target" => "_self"]);
break;
case 'head':
case 'tail':
return html_entity_decode($entity->$field);
return html_entity_decode($value);
break;
default:
if (in_array($field, $fieldFilters)) {
return getFieldForm_BoardConfigHelper($field, $entity->$field, $fieldFormOptions, $attributes);
}
return $entity->$field ?: DEFAULTS['EMPTY'];
return in_array($field, $fieldFilters) ? $fieldFormOptions[$field][$value] : $value;
break;
}
} //
@ -80,15 +80,6 @@ function getFieldFilter_BoardConfigHelper($field, $value, array $fieldFormOption
{
$value = $value ?: DEFAULTS['EMPTY'];
switch ($field) {
// case 'isaccess':
// case 'isread':
// case 'iswrite':
// case 'isreply':
// case 'isupload':
// case 'isdownload':
// $fieldFormOptions[$field] = [DEFAULTS['EMPTY'] => lang("Admin/BoardConfig.label.{$field}") . " 선택", ...$fieldFormOptions[$field]];
// return form_dropdown($field, $fieldFormOptions[$field], $value, $attributes);
// break;
default:
return getFieldForm_BoardConfigHelper($field, $value, $fieldFormOptions, $attributes);
break;
@ -100,36 +91,29 @@ function getFieldIndex_Column_BoardConfigHelper($field, $order_field, $order_val
$label = lang("Admin/BoardConfig.label.{$field}");
$label = $field == $order_field ? sprintf('%s <i class="fa fa-arrow-%s"></i>', $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);
return anchor(current_url() . "?order_field={$field}&order_value={$order_value}", $label, [...$attributes]);
} //
function getFieldIndex_Row_BoardConfigHelper($field, array $row, array $fieldFilters, $fieldFormOptions, $attributes = array()): string
function getFieldIndex_Row_BoardConfigHelper($field, $entity, array $fieldFilters, $fieldFormOptions, $attributes = array()): string
{
$value = $entity->$field ?: DEFAULTS['EMPTY'];
switch ($field) {
case 'name':
return anchor(current_url() . '/view/' . $row['uid'], $row[$field], [...$attributes, "target" => "_self"]);
return anchor(current_url() . '/view/' . $entity->getPrimaryKey(), $value, [...$attributes, "target" => "_self"]);
break;
case 'upload_file':
return $value == DEFAULTS['EMPTY'] ? DEFAULTS['EMPTY'] : anchor(current_url() . '/download/' . $entity->getPrimaryKey(), ICONS['IMAGE_FILE'] . explode("||", $value)[0], [...$attributes, "target" => "_self"]);
break;
// case 'isaccess':
// case 'isread':
// case 'iswrite':
// case 'isreply':
// case 'isupload':
// case 'isdownload':
// foreach ($fieldFormOptions[$field] as $key => $label) {
// $checkboxs[] = form_checkbox($field, $key, in_array($key, explode("|", $row[$field])), $attributes) . $label;
// }
// return '<div style="text-align:left; padding-left:%spx;">' . implode("<BR>", $checkboxs) . '</div>';
// break;
case 'updated_at':
case 'created_at':
return isset($row[$field]) ? str_split($row[$field], 10)[0] : "";
return isset($value) ? str_split($value, 10)[0] : "";
break;
default:
if (in_array($field, $fieldFilters)) {
$attributes["onChange"] = sprintf('location.href="%s/toggle/%s/%s?%s="+this.options[this.selectedIndex].value', current_url(), $row['uid'], $field, $field);
return getFieldFilter_BoardConfigHelper($field, $row[$field], $fieldFormOptions, $attributes);
$attributes["onChange"] = sprintf('location.href="%s/toggle/%s/%s?%s="+this.options[this.selectedIndex].value', current_url(), $entity->getPrimaryKey(), $field, $field);
return getFieldFilter_BoardConfigHelper($field, $value, $fieldFormOptions, [...$attributes]);
}
return $row[$field] ?: DEFAULTS['EMPTY'];
return $value;
break;
}
} //

View File

@ -6,7 +6,7 @@ function getFieldLabel_BoardHelper($field, array $fieldRules, array $attributes
if (strpos($fieldRules[$field], 'required') !== false) {
array_push($attributes, 'style="color:red";');
}
return sprintf("<span %s>%s</span>", implode(" ", $attributes), lang("Admin/Board.label.{$field}"));
return sprintf("<span %s>%s</span>", implode(" ", [...$attributes]), lang("Admin/Board.label.{$field}"));
break;
}
}
@ -14,13 +14,20 @@ function getFieldLabel_BoardHelper($field, array $fieldRules, array $attributes
//header.php에서 getFieldForm_Helper사용
function getFieldForm_BoardHelper($field, $value, array $fieldFormOptions, array $attributes = array())
{
$value = $value ?: DEFAULTS['EMPTY'];
switch ($field) {
case 'board_config_uid':
case 'user_uid':
case "board_config_uid":
case "user_uid":
$fieldFormOptions[$field] = [DEFAULTS['EMPTY'] => lang("Admin/Board.label.{$field}") . " 선택", ...$fieldFormOptions[$field]];
return form_dropdown($field, $fieldFormOptions[$field], is_array($value) ? [...$value] : [$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("&nbsp;", $checkboxs);
// return form_multiselect($field, $fieldFormOptions[$field], is_array($value) ? [...$value] : [$value], [...$attributes]);
break;
case 'status':
$fieldFormOptions[$field] = [DEFAULTS['EMPTY'] => lang("Admin/Board.label.{$field}") . " 선택", ...$fieldFormOptions[$field]];
return form_dropdown($field, $fieldFormOptions[$field], $value, $attributes);
return form_dropdown($field, $fieldFormOptions[$field], is_array($value) ? [...$value] : [$value], $attributes);
break;
case 'updated_at':
case 'created_at':
@ -29,41 +36,37 @@ function getFieldForm_BoardHelper($field, $value, array $fieldFormOptions, array
case 'passwd':
return sprintf(
"%s %s %s",
form_password($field, DEFAULTS['EMPTY'], $attributes),
form_password($field, DEFAULTS['EMPTY'], [...$attributes]),
lang("Admin/Board.label.confirmpassword"),
form_password('confirmpassword', DEFAULTS['EMPTY'], $attributes),
form_password('confirmpassword', DEFAULTS['EMPTY'], [...$attributes]),
);
break;
case 'content':
return form_textarea($field, html_entity_decode($value), [...$attributes, 'class' => 'editor', 'rows' => '20', 'cols' => '100']);
break;
case 'upload_file':
case 'board_file':
return form_upload($field);
break;
default:
return form_input($field, $value, [...$attributes, 'size' => '80']);
return form_input($field, $value, [...$attributes]);
break;
}
} //
function getFieldView_BoardHelper($field, $entity, array $fieldFilters, array $fieldFormOptions, array $attributes = array())
{
$value = $entity->$field ?: DEFAULTS['EMPTY'];
switch ($field) {
case 'board_file':
list($origin_filename, $filename) = explode("||", $entity->getFile());
if (is_file(WRITEPATH . PATHS['UPLOAD'] . "/" . $origin_filename)) {
return "파일이 확인되지 않습니다.";
}
return $entity->$field ? anchor(current_url() . '/download/' . $entity->getPrimaryKey(), ICONS['IMAGE_FILE'] . explode("||", $entity->$field)[0], [...$attributes, "target" => "_self"]) : "";
case 'upload_file':
return $value == DEFAULTS['EMPTY'] ? DEFAULTS['EMPTY'] : anchor(current_url() . '/download/' . $entity->getPrimaryKey(), ICONS['IMAGE_FILE'] . explode("||", $value)[0], [...$attributes, "target" => "_self"]);
break;
case 'content':
return html_entity_decode($entity->$field);
return html_entity_decode($value);
break;
default:
if (in_array($field, $fieldFilters)) {
return getFieldForm_BoardHelper($field, $entity->$field, $fieldFormOptions, $attributes);
}
return $entity->$field ?: DEFAULTS['EMPTY'];
return in_array($field, $fieldFilters) ? $fieldFormOptions[$field][$value] : $value;
break;
}
} //
@ -83,33 +86,30 @@ function getFieldIndex_Column_BoardHelper($field, $order_field, $order_value, ar
$label = lang("Admin/Board.label.{$field}");
$label = $field == $order_field ? sprintf('%s <i class="fa fa-arrow-%s"></i>', $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);
return anchor(current_url() . "?order_field={$field}&order_value={$order_value}", $label, [...$attributes]);
} //
function getFieldIndex_Row_BoardHelper($field, array $row, array $fieldFilters, $fieldFormOptions, $attributes = array()): string
function getFieldIndex_Row_BoardHelper($field, $entity, array $fieldFilters, $fieldFormOptions, $attributes = array()): string
{
$value = $entity->$field ?: DEFAULTS['EMPTY'];
switch ($field) {
case 'title':
return sprintf(
'<div style="text-align:left; padding-left:%spx;">%s&nbsp;&nbsp;%s</div>',
$row['grpdepth'] * DEFAULTS['HIERARCHY_GRPDEPTH'],
anchor(current_url() . '/view/' . $row['uid'], $row[$field], [...$attributes, "target" => "_self"]),
anchor(current_url() . '/reply/' . $row['uid'], ICONS['REPLY'], [...$attributes, "target" => "_self"])
);
return anchor(current_url() . '/view/' . $entity->getPrimaryKey(), $value, [...$attributes, "target" => "_self"]);
break;
case 'board_file':
return $row[$field] ? anchor(current_url() . '/download/' . $row['uid'], ICONS['IMAGE_FILE'] . explode("||", $row[$field])[0], [...$attributes, "target" => "_self"]) : "";
case 'upload_file':
return $value == DEFAULTS['EMPTY'] ? DEFAULTS['EMPTY'] : anchor(current_url() . '/download/' . $entity->getPrimaryKey(), ICONS['IMAGE_FILE'] . explode("||", $value)[0], [...$attributes, "target" => "_self"]);
break;
case 'updated_at':
case 'created_at':
return isset($row[$field]) ? str_split($row[$field], 10)[0] : "";
return isset($value) ? str_split($value, 10)[0] : "";
break;
default:
if (in_array($field, $fieldFilters)) {
$attributes["onChange"] = sprintf('location.href="%s/toggle/%s/%s?%s="+this.options[this.selectedIndex].value', current_url(), $row['uid'], $field, $field);
return getFieldFilter_BoardHelper($field, $row[$field], $fieldFormOptions, $attributes);
$attributes["onChange"] = sprintf('location.href="%s/toggle/%s/%s?%s="+this.options[this.selectedIndex].value', current_url(), $entity->getPrimaryKey(), $field, $field);
return getFieldFilter_BoardHelper($field, $value, $fieldFormOptions, [...$attributes]);
}
return $row[$field] ?: DEFAULTS['EMPTY'];
return $value;
break;
}
} //

View File

@ -6,7 +6,7 @@ function getFieldLabel_UserSNSHelper($field, array $fieldRules, array $attribute
if (strpos($fieldRules[$field], 'required') !== false) {
array_push($attributes, 'style="color:red";');
}
return sprintf("<span %s>%s</span>", implode(" ", $attributes), lang("Admin/UserSNS.label.{$field}"));
return sprintf("<span %s>%s</span>", implode(" ", [...$attributes]), lang("Admin/UserSNS.label.{$field}"));
break;
}
}
@ -16,29 +16,55 @@ function getFieldForm_UserSNSHelper($field, $value, array $fieldFormOptions, arr
{
$value = $value ?: DEFAULTS['EMPTY'];
switch ($field) {
case 'user_uid':
case 'status':
case "user_uid":
$fieldFormOptions[$field] = [DEFAULTS['EMPTY'] => lang("Admin/UserSNS.label.{$field}") . " 선택", ...$fieldFormOptions[$field]];
return form_dropdown($field, $fieldFormOptions[$field], $value, $attributes);
return form_dropdown($field, $fieldFormOptions[$field], is_array($value) ? [...$value] : [$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("&nbsp;", $checkboxs);
// return form_multiselect($field, $fieldFormOptions[$field], is_array($value) ? [...$value] : [$value], [...$attributes]);
break;
case 'status':
$fieldFormOptions[$field] = [DEFAULTS['EMPTY'] => lang("Admin/Board.label.{$field}") . " 선택", ...$fieldFormOptions[$field]];
return form_dropdown($field, $fieldFormOptions[$field], is_array($value) ? [...$value] : [$value], $attributes);
break;
case 'updated_at':
case 'created_at':
return form_input($field, $value, [...$attributes, 'class' => 'calender']);
break;
case 'passwd':
return sprintf(
"%s %s %s",
form_password($field, DEFAULTS['EMPTY'], [...$attributes]),
lang("Admin/UserSNS.label.confirmpassword"),
form_password('confirmpassword', DEFAULTS['EMPTY'], [...$attributes]),
);
break;
case 'content':
return form_textarea($field, html_entity_decode($value), [...$attributes, 'class' => 'editor', 'rows' => '20', 'cols' => '100']);
break;
case 'upload_file':
return form_upload($field);
break;
default:
return form_input($field, $value, $attributes);
return form_input($field, $value, [...$attributes]);
break;
}
} //
function getFieldView_UserSNSHelper($field, $entity, array $fieldFilters, array $fieldFormOptions, array $attributes = array())
{
$value = $entity->$field ?: DEFAULTS['EMPTY'];
switch ($field) {
case 'upload_file':
return $value == DEFAULTS['EMPTY'] ? DEFAULTS['EMPTY'] : anchor(current_url() . '/download/' . $entity->getPrimaryKey(), ICONS['IMAGE_FILE'] . explode("||", $value)[0], [...$attributes, "target" => "_self"]);
break;
case 'content':
return html_entity_decode($value);
break;
default:
if (in_array($field, $fieldFilters)) {
return getFieldForm_UserSNSHelper($field, $entity->$field, $fieldFormOptions, $attributes);
}
return $entity->$field ?: DEFAULTS['EMPTY'];
return in_array($field, $fieldFilters) ? $fieldFormOptions[$field][$value] : $value;
break;
}
} //
@ -58,25 +84,29 @@ function getFieldIndex_Column_UserSNSHelper($field, $order_field, $order_value,
$label = lang("Admin/UserSNS.label.{$field}");
$label = $field == $order_field ? sprintf('%s <i class="fa fa-arrow-%s"></i>', $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);
return anchor(current_url() . "?order_field={$field}&order_value={$order_value}", $label, [...$attributes]);
} //
function getFieldIndex_Row_UserSNSHelper($field, array $row, array $fieldFilters, $fieldFormOptions, $attributes = array()): string
function getFieldIndex_Row_UserSNSHelper($field, $entity, array $fieldFilters, $fieldFormOptions, $attributes = array()): string
{
$value = $entity->$field ?: DEFAULTS['EMPTY'];
switch ($field) {
case 'name':
return anchor(current_url() . '/view/' . $row['uid'], $row[$field], [...$attributes, "target" => "_self"]);
case 'id':
return anchor(current_url() . '/view/' . $entity->getPrimaryKey(), $value, [...$attributes, "target" => "_self"]);
break;
case 'upload_file':
return $value == DEFAULTS['EMPTY'] ? DEFAULTS['EMPTY'] : anchor(current_url() . '/download/' . $entity->getPrimaryKey(), ICONS['IMAGE_FILE'] . explode("||", $value)[0], [...$attributes, "target" => "_self"]);
break;
case 'updated_at':
case 'created_at':
return isset($row[$field]) ? str_split($row[$field], 10)[0] : "";
return isset($value) ? str_split($value, 10)[0] : "";
break;
default:
if (in_array($field, $fieldFilters)) {
$attributes["onChange"] = sprintf('location.href="%s/toggle/%s/%s?%s="+this.options[this.selectedIndex].value', current_url(), $row['uid'], $field, $field);
return getFieldFilter_UserSNSHelper($field, $row[$field], $fieldFormOptions, $attributes);
$attributes["onChange"] = sprintf('location.href="%s/toggle/%s/%s?%s="+this.options[this.selectedIndex].value', current_url(), $entity->getPrimaryKey(), $field, $field);
return getFieldFilter_UserSNSHelper($field, $value, $fieldFormOptions, [...$attributes]);
}
return $row[$field] ?: DEFAULTS['EMPTY'];
return $value;
break;
}
} //

View File

@ -6,7 +6,7 @@ function getFieldLabel_UserHelper($field, array $fieldRules, array $attributes =
if (strpos($fieldRules[$field], 'required') !== false) {
array_push($attributes, 'style="color:red";');
}
return sprintf("<span %s>%s</span>", implode(" ", $attributes), lang("Admin/User.label.{$field}"));
return sprintf("<span %s>%s</span>", implode(" ", [...$attributes]), lang("Admin/User.label.{$field}"));
break;
}
}
@ -17,14 +17,17 @@ function getFieldForm_UserHelper($field, $value, array $fieldFormOptions, array
$value = $value ?: DEFAULTS['EMPTY'];
switch ($field) {
case 'role':
$fieldFormOptions[$field] = [DEFAULTS['EMPTY'] => lang("Admin/User.label.{$field}") . " 선택", ...$fieldFormOptions[$field]];
return form_dropdown($field, $fieldFormOptions[$field], is_array($value) ? [...$value] : [$value], [...$attributes, 'class' => "select-field"]);
// foreach ($fieldFormOptions[$field] as $key => $label) {
// $checkboxs[] = form_checkbox("{$field}[]", $key, in_array($key, is_array($value) ? $value : explode("|", $value)), $attributes) . $label;
// $checkboxs[] = form_checkbox("{$field}[]", $key, in_array($key, is_array($value) ? [...$value] : [$value]), $attributes) . $label;
// }
// return implode("&nbsp;", $checkboxs);
// break;
// return form_multiselect($field, $fieldFormOptions[$field], is_array($value) ? [...$value] : [$value], [...$attributes]);
break;
case 'status':
$fieldFormOptions[$field] = [DEFAULTS['EMPTY'] => lang("Admin/User.label.{$field}") . " 선택", ...$fieldFormOptions[$field]];
return form_dropdown($field, $fieldFormOptions[$field], $value, $attributes);
$fieldFormOptions[$field] = [DEFAULTS['EMPTY'] => lang("Admin/Board.label.{$field}") . " 선택", ...$fieldFormOptions[$field]];
return form_dropdown($field, $fieldFormOptions[$field], is_array($value) ? [...$value] : [$value], $attributes);
break;
case 'updated_at':
case 'created_at':
@ -33,31 +36,35 @@ function getFieldForm_UserHelper($field, $value, array $fieldFormOptions, array
case 'passwd':
return sprintf(
"%s %s %s",
form_password($field, DEFAULTS['EMPTY'], $attributes),
form_password($field, DEFAULTS['EMPTY'], [...$attributes]),
lang("Admin/User.label.confirmpassword"),
form_password('confirmpassword', DEFAULTS['EMPTY'], $attributes),
form_password('confirmpassword', DEFAULTS['EMPTY'], [...$attributes]),
);
break;
case 'content':
return form_textarea($field, html_entity_decode($value), [...$attributes, 'class' => 'editor', 'rows' => '20', 'cols' => '100']);
break;
case 'upload_file':
return form_upload($field);
break;
default:
return form_input($field, $value, $attributes);
return form_input($field, $value, [...$attributes]);
break;
}
} //
function getFieldView_UserHelper($field, $entity, array $fieldFilters, array $fieldFormOptions, array $attributes = array())
{
$value = $entity->$field ?: DEFAULTS['EMPTY'];
switch ($field) {
// case 'role':
// foreach ($fieldFormOptions[$field] as $key => $label) {
// $checkboxs[] = form_checkbox("{$field}[]", $key, in_array($key, explode("|", $entity->$field)), $attributes) . $label;
// }
// return implode("&nbsp;", $checkboxs);
// break;
case 'upload_file':
return $value == DEFAULTS['EMPTY'] ? DEFAULTS['EMPTY'] : anchor(current_url() . '/download/' . $entity->getPrimaryKey(), ICONS['IMAGE_FILE'] . explode("||", $value)[0], [...$attributes, "target" => "_self"]);
break;
case 'content':
return html_entity_decode($value);
break;
default:
if (in_array($field, $fieldFilters)) {
return getFieldForm_UserHelper($field, $entity->$field, $fieldFormOptions, $attributes);
}
return $entity->$field ?: DEFAULTS['EMPTY'];
return in_array($field, $fieldFilters) ? $fieldFormOptions[$field][$value] : $value;
break;
}
} //
@ -66,10 +73,6 @@ function getFieldFilter_UserHelper($field, $value, array $fieldFormOptions, arra
{
$value = $value ?: DEFAULTS['EMPTY'];
switch ($field) {
// case 'role':
// $fieldFormOptions[$field] = [DEFAULTS['EMPTY'] => lang("Admin/User.label.{$field}") . " 선택", ...$fieldFormOptions[$field]];
// return form_dropdown($field, $fieldFormOptions[$field], $value, $attributes);
// break;
default:
return getFieldForm_UserHelper($field, $value, $fieldFormOptions, $attributes);
break;
@ -81,31 +84,29 @@ function getFieldIndex_Column_UserHelper($field, $order_field, $order_value, arr
$label = lang("Admin/User.label.{$field}");
$label = $field == $order_field ? sprintf('%s <i class="fa fa-arrow-%s"></i>', $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);
return anchor(current_url() . "?order_field={$field}&order_value={$order_value}", $label, [...$attributes]);
} //
function getFieldIndex_Row_UserHelper($field, array $row, array $fieldFilters, $fieldFormOptions, $attributes = array()): string
function getFieldIndex_Row_UserHelper($field, $entity, array $fieldFilters, $fieldFormOptions, $attributes = array()): string
{
$value = $entity->$field ?: DEFAULTS['EMPTY'];
switch ($field) {
case 'id':
return anchor(current_url() . '/view/' . $row['uid'], $row[$field], [...$attributes, "target" => "_self"]);
return anchor(current_url() . '/view/' . $entity->getPrimaryKey(), $value, [...$attributes, "target" => "_self"]);
break;
case 'upload_file':
return $value == DEFAULTS['EMPTY'] ? DEFAULTS['EMPTY'] : anchor(current_url() . '/download/' . $entity->getPrimaryKey(), ICONS['IMAGE_FILE'] . explode("||", $value)[0], [...$attributes, "target" => "_self"]);
break;
// case 'role':
// foreach ($fieldFormOptions[$field] as $key => $label) {
// $checkboxs[] = form_checkbox($field, $key, in_array($key, explode("|", $row[$field])), $attributes) . $label;
// }
// return '<div style="text-align:left; padding-left:%spx;">' . implode("<BR>", $checkboxs) . '</div>';
// break;
case 'updated_at':
case 'created_at':
return isset($row[$field]) ? str_split($row[$field], 10)[0] : "";
return isset($value) ? str_split($value, 10)[0] : "";
break;
default:
if (in_array($field, $fieldFilters)) {
$attributes["onChange"] = sprintf('location.href="%s/toggle/%s/%s?%s="+this.options[this.selectedIndex].value', current_url(), $row['uid'], $field, $field);
return getFieldFilter_UserHelper($field, $row[$field], $fieldFormOptions, $attributes);
$attributes["onChange"] = sprintf('location.href="%s/toggle/%s/%s?%s="+this.options[this.selectedIndex].value', current_url(), $entity->getPrimaryKey(), $field, $field);
return getFieldFilter_UserHelper($field, $value, $fieldFormOptions, $attributes);
}
return $row[$field] ?: DEFAULTS['EMPTY'];
return $value;
break;
}
} //

View File

@ -3,6 +3,7 @@
namespace App\Models;
use CodeIgniter\Model;
use App\Libraries\Log\Log;
use App\Entities\BaseEntity;
abstract class BaseModel extends Model

View File

@ -8,6 +8,7 @@ class BoardConfigModel extends BaseModel
{
protected $table = "tw_board_config";
protected $useAutoIncrement = false;
protected $returnType = BoardConfigEntity::class;
public function __construct()
{
parent::__construct();
@ -72,12 +73,12 @@ class BoardConfigModel extends BaseModel
}
public function getEntity($conditions): BoardConfigEntity
{
$entity = $this->asObject(BoardConfigEntity::class)->where($conditions)->first();
return $entity ?: throw new \Exception("해당 데이터가 없습니다.\n" . var_export($conditions, true));
$entity = $this->where($conditions)->first();
return $entity ?: throw new \Exception("{$conditions}해당 데이터가 없습니다.\n ");
}
public function getEntitys($conditions): array
{
return $this->asObject(BoardConfigEntity::class)->where($conditions)->findAll();
return $this->where($conditions)->findAll();
}
protected function changeFormData(string $field, array $formDatas, $entity)

View File

@ -7,6 +7,7 @@ use App\Entities\BoardEntity;
class BoardModel extends BaseHierarchyModel
{
protected $table = "tw_board";
protected $returnType = BoardEntity::class;
public function __construct()
{
parent::__construct();
@ -58,12 +59,12 @@ class BoardModel extends BaseHierarchyModel
public function getEntity($conditions): BoardEntity
{
$entity = $this->asObject(BoardEntity::class)->where($conditions)->first();
return $entity ?: throw new \Exception("해당 데이터가 없습니다.\n" . var_export($conditions, true));
$entity = $this->where($conditions)->first();
return $entity ?: throw new \Exception("{$conditions}해당 데이터가 없습니다.\n ");
}
public function getEntitys($conditions): array
{
return $this->asObject(BoardEntity::class)->where($conditions)->findAll();
return $this->where($conditions)->findAll();
}
public function create(array $formDatas): BoardEntity
{

View File

@ -8,6 +8,7 @@ class UserModel extends BaseModel
{
protected $table = "tw_user";
protected $useAutoIncrement = false;
protected $returnType = UserEntity::class;
public function __construct()
{
parent::__construct();
@ -66,12 +67,12 @@ class UserModel extends BaseModel
}
public function getEntity($conditions): UserEntity
{
$entity = $this->asObject(UserEntity::class)->where($conditions)->first();
return $entity ?: throw new \Exception("해당 데이터가 없습니다.\n" . var_export($conditions, true));
$entity = $this->where($conditions)->first();
return $entity ?: throw new \Exception("{$conditions}의 해당 사용자가 없습니다.\n ");
}
public function getEntitys($conditions): array
{
return $this->asObject(UserEntity::class)->where($conditions)->findAll();
return $this->where($conditions)->findAll();
}
protected function changeFormData(string $field, array $formDatas, $entity)

View File

@ -7,6 +7,7 @@ use App\Entities\UserSNSEntity;
class UserSNSModel extends BaseModel
{
protected $table = "tw_user_sns";
protected $returnType = UserSNSEntity::class;
public function __construct()
{
parent::__construct();
@ -31,7 +32,7 @@ class UserSNSModel extends BaseModel
}
public function getFieldFilters(array $fields = array()): array
{
return ["status", ...$fields];
return ["user_uid", "status", ...$fields];
}
protected function getFieldRule(string $field, array $rules, string $action = ""): array
{
@ -60,12 +61,12 @@ class UserSNSModel extends BaseModel
}
public function getEntity($conditions): UserSNSEntity
{
$entity = $this->asObject(UserSNSEntity::class)->where($conditions)->first();
return $entity ?: throw new \Exception("해당 데이터가 없습니다.\n" . var_export($conditions, true));
$entity = $this->where($conditions)->first();
return $entity ?: throw new \Exception("{$conditions}해당 데이터가 없습니다.\n ");
}
public function getEntitys($conditions): array
{
return $this->asObject(UserSNSEntity::class)->where($conditions)->findAll();
return $this->where($conditions)->findAll();
}
public function create(array $formDatas): UserSNSEntity

View File

@ -19,16 +19,16 @@
<td>작업</td>
</tr>
<?php $i = 0; ?>
<?php foreach ($rows as $row) : ?>
<tr id="<?= $row['uid'] ?>" <?= $row['status'] != 'use' ? 'class="table-danger" rowcolor="red"' : 'rowcolor="red"' ?> onClick="indexRowCheckBoxToggle(this);">
<?php foreach ($entitys as $entity) : ?>
<tr id="<?= $entity->getPrimaryKey() ?>" <?= $entity->getStatus() != 'use' ? 'class="table-danger" rowcolor="red"' : 'rowcolor="red"' ?> onClick="indexRowCheckBoxToggle(this);">
<td>
<?= form_checkbox(["id" => "checkbox_uid_{$row['uid']}", "name" => "batchjob_uids[]", "value" => $row['uid'], "class" => "batchjobuids_checkboxs"]); ?>
<?= anchor(current_url() . '/update/' . $row['uid'], $total_count - (($page - 1) * $per_page + $i), ["target" => "_self"]) ?>
<?= form_checkbox(["id" => "checkbox_uid_{$entity->getPrimaryKey()}", "name" => "batchjob_uids[]", "value" => $entity->getPrimaryKey(), "class" => "batchjobuids_checkboxs"]); ?>
<?= anchor(current_url() . '/update/' . $entity->getPrimaryKey(), $total_count - (($page - 1) * $per_page + $i), ["target" => "_self"]) ?>
</td>
<?php foreach ($fields as $field) : ?>
<td nowrap><?= getFieldIndex_Row_BoardHelper($field, $row, $fieldFilters, $fieldFormOptions) ?></td>
<td nowrap><?= getFieldIndex_Row_BoardHelper($field, $entity, $fieldFilters, $fieldFormOptions) ?></td>
<?php endforeach; ?>
<td><?= anchor(current_url() . '/delete/' . $row['uid'], ICONS['DELETE'], ["class" => "btn btn-sm btn-danger btn-circle", "target" => "_self"]) ?></td>
<td><?= anchor(current_url() . '/delete/' . $entity->getPrimaryKey(), ICONS['DELETE'], ["class" => "btn btn-sm btn-danger btn-circle", "target" => "_self"]) ?></td>
</tr>
<?php $i++; ?>
<?php endforeach; ?>

View File

@ -9,7 +9,7 @@
<?= getFieldLabel_BoardHelper($field, $fieldRules) ?>
</td>
<td style="text-align:left; padding-left:20px;">
<?= getFieldForm_BoardHelper($field, is_null(old($field)) ? DEFAULTS['EMPTY'] : old($field), $fieldFormOptions) ?>
<?= getFieldForm_BoardHelper($field, old($field) ?: DEFAULTS['EMPTY'], $fieldFormOptions) ?>
<?= validation_show_error($field); ?>
</td>
</tr>
@ -20,12 +20,5 @@
</table>
<?= form_close(); ?>
<?php if (session()->getFlashdata('error')) : ?><?= session()->getFlashdata('error') ?><?php endif ?>
<script src="<?= base_url() ?>vendors/tinymce/tinymce/tinymce.min.js" referrerpolicy="origin"></script>
<script>
tinymce.init({
selector: '.editor',
theme: 'silver',
height: 500
});
</script>
<?= $this->include('templates/admin/footer'); ?>
<?= $this->endSection() ?>

View File

@ -9,7 +9,7 @@
<?= getFieldLabel_BoardHelper($field, $fieldRules) ?>
</td>
<td style="text-align:left; padding-left:20px;">
<?= getFieldForm_BoardHelper($field, is_null(old($field)) ? $entity->$field : old($field), $fieldFormOptions) ?>
<?= getFieldForm_BoardHelper($field, old($field) ?: $entity->$field, $fieldFormOptions) ?>
<?= validation_show_error($field); ?>
</td>
</tr>
@ -20,13 +20,5 @@
</table>
<?= form_close(); ?>
<?php if (session()->getFlashdata('error')) : ?><?= session()->getFlashdata('error') ?><?php endif ?>
<script src="<?= base_url() ?>vendors/tinymce/tinymce/tinymce.min.js" referrerpolicy="origin"></script>
<script>
tinymce.init({
selector: '.editor',
theme: 'silver',
height: 500
});
</script>
<?= $this->include('templates/admin/footer'); ?>
<?= $this->endSection() ?>

View File

@ -9,7 +9,7 @@
<?= getFieldLabel_BoardHelper($field, $fieldRules) ?>
</td>
<td style="text-align:left; padding-left:20px;">
<?= getFieldForm_BoardHelper($field, is_null(old($field)) ? $entity->$field : old($field), $fieldFormOptions) ?>
<?= getFieldForm_BoardHelper($field, old($field) ?: $entity->$field, $fieldFormOptions) ?>
<?= validation_show_error($field); ?>
</td>
</tr>
@ -20,13 +20,5 @@
</table>
<?= form_close(); ?>
<?php if (session()->getFlashdata('error')) : ?><?= session()->getFlashdata('error') ?><?php endif ?>
<script src="<?= base_url() ?>vendors/tinymce/tinymce/tinymce.min.js" referrerpolicy="origin"></script>
<script>
tinymce.init({
selector: '.editor',
theme: 'silver',
height: 500
});
</script>
<?= $this->include('templates/admin/footer'); ?>
<?= $this->endSection() ?>

View File

@ -19,16 +19,16 @@
<td>작업</td>
</tr>
<?php $i = 0; ?>
<?php foreach ($rows as $row) : ?>
<tr id="<?= $row['uid'] ?>" <?= $row['status'] != 'use' ? 'class="table-danger" rowcolor="red"' : 'rowcolor="red"' ?> onClick="indexRowCheckBoxToggle(this);">
<?php foreach ($entitys as $entity) : ?>
<tr id="<?= $entity->getPrimaryKey() ?>" <?= $entity->getStatus() != 'use' ? 'class="table-danger" rowcolor="red"' : 'rowcolor="red"' ?> onClick="indexRowCheckBoxToggle(this);">
<td>
<?= form_checkbox(["id" => "checkbox_uid_{$row['uid']}", "name" => "batchjob_uids[]", "value" => $row['uid'], "class" => "batchjobuids_checkboxs"]); ?>
<?= anchor(current_url() . '/update/' . $row['uid'], $total_count - (($page - 1) * $per_page + $i), ["target" => "_self"]) ?>
<?= form_checkbox(["id" => "checkbox_uid_{$entity->getPrimaryKey()}", "name" => "batchjob_uids[]", "value" => $entity->getPrimaryKey(), "class" => "batchjobuids_checkboxs"]); ?>
<?= anchor(current_url() . '/update/' . $entity->getPrimaryKey(), $total_count - (($page - 1) * $per_page + $i), ["target" => "_self"]) ?>
</td>
<?php foreach ($fields as $field) : ?>
<td nowrap><?= getFieldIndex_Row_BoardConfigHelper($field, $row, $fieldFilters, $fieldFormOptions) ?></td>
<td nowrap><?= getFieldIndex_Row_BoardConfigHelper($field, $entity, $fieldFilters, $fieldFormOptions) ?></td>
<?php endforeach; ?>
<td><?= anchor(current_url() . '/delete/' . $row['uid'], ICONS['DELETE'], ["class" => "btn btn-sm btn-danger btn-circle", "target" => "_self"]) ?></td>
<td><?= anchor(current_url() . '/delete/' . $entity->getPrimaryKey(), ICONS['DELETE'], ["class" => "btn btn-sm btn-danger btn-circle", "target" => "_self"]) ?></td>
</tr>
<?php $i++; ?>
<?php endforeach; ?>

View File

@ -9,7 +9,7 @@
<?= getFieldLabel_BoardConfigHelper($field, $fieldRules) ?>
</td>
<td style="text-align:left; padding-left:20px;">
<?= getFieldForm_BoardConfigHelper($field, is_null(old($field)) ? DEFAULTS['EMPTY'] : old($field), $fieldFormOptions) ?>
<?= getFieldForm_BoardConfigHelper($field, old($field) ?: DEFAULTS['EMPTY'], $fieldFormOptions) ?>
<?= validation_show_error($field); ?>
</td>
</tr>
@ -20,13 +20,6 @@
</table>
<?= form_close(); ?>
<?php if (session()->getFlashdata('error')) : ?><?= session()->getFlashdata('error') ?><?php endif ?>
<script src="<?= base_url() ?>vendors/tinymce/tinymce/tinymce.min.js" referrerpolicy="origin"></script>
<script>
tinymce.init({
selector: '.editor',
theme: 'silver',
height: 500
});
</script>
<?= $this->include('templates/admin/footer'); ?>
<?= $this->endSection() ?>

View File

@ -9,7 +9,7 @@
<?= getFieldLabel_BoardConfigHelper($field, $fieldRules) ?>
</td>
<td style="text-align:left; padding-left:20px;">
<?= getFieldForm_BoardConfigHelper($field, is_null(old($field)) ? $entity->$field : old($field), $fieldFormOptions) ?>
<?= getFieldForm_BoardConfigHelper($field, old($field) ? $entity->$field : old($field), $fieldFormOptions) ?>
<?= validation_show_error($field); ?>
</td>
</tr>
@ -20,13 +20,5 @@
</table>
<?= form_close(); ?>
<?php if (session()->getFlashdata('error')) : ?><?= session()->getFlashdata('error') ?><?php endif ?>
<script src="<?= base_url() ?>vendors/tinymce/tinymce/tinymce.min.js" referrerpolicy="origin"></script>
<script>
tinymce.init({
selector: '.editor',
theme: 'silver',
height: 500
});
</script>
<?= $this->include('templates/admin/footer'); ?>
<?= $this->endSection() ?>

View File

@ -19,16 +19,16 @@
<td>작업</td>
</tr>
<?php $i = 0; ?>
<?php foreach ($rows as $row) : ?>
<tr id="<?= $row['uid'] ?>" <?= $row['status'] != 'use' ? 'class="table-danger" rowcolor="red"' : 'rowcolor="red"' ?> onClick="indexRowCheckBoxToggle(this);">
<?php foreach ($entitys as $entity) : ?>
<tr id="<?= $entity->getPrimaryKey() ?>" <?= $entity->getStatus() != 'use' ? 'class="table-danger" rowcolor="red"' : 'rowcolor="red"' ?> onClick="indexRowCheckBoxToggle(this);">
<td>
<?= form_checkbox(["id" => "checkbox_uid_{$row['uid']}", "name" => "batchjob_uids[]", "value" => $row['uid'], "class" => "batchjobuids_checkboxs"]); ?>
<?= anchor(current_url() . '/update/' . $row['uid'], $total_count - (($page - 1) * $per_page + $i), ["target" => "_self"]) ?>
<?= form_checkbox(["id" => "checkbox_uid_{$entity->getPrimaryKey()}", "name" => "batchjob_uids[]", "value" => $entity->getPrimaryKey(), "class" => "batchjobuids_checkboxs"]); ?>
<?= anchor(current_url() . '/update/' . $entity->getPrimaryKey(), $total_count - (($page - 1) * $per_page + $i), ["target" => "_self"]) ?>
</td>
<?php foreach ($fields as $field) : ?>
<td nowrap><?= getFieldIndex_Row_UserHelper($field, $row, $fieldFilters, $fieldFormOptions) ?></td>
<td nowrap><?= getFieldIndex_Row_UserHelper($field, $entity, $fieldFilters, $fieldFormOptions) ?></td>
<?php endforeach; ?>
<td><?= anchor(current_url() . '/delete/' . $row['uid'], ICONS['DELETE'], ["class" => "btn btn-sm btn-danger btn-circle", "target" => "_self"]) ?></td>
<td><?= anchor(current_url() . '/delete/' . $entity->getPrimaryKey(), ICONS['DELETE'], ["class" => "btn btn-sm btn-danger btn-circle", "target" => "_self"]) ?></td>
</tr>
<?php $i++; ?>
<?php endforeach; ?>

View File

@ -9,7 +9,7 @@
<?= getFieldLabel_UserHelper($field, $fieldRules) ?>
</td>
<td style="text-align:left; padding-left:20px;">
<?= getFieldForm_UserHelper($field, is_null(old($field)) ? DEFAULTS['EMPTY'] : old($field), $fieldFormOptions) ?>
<?= getFieldForm_UserHelper($field, old($field) ?: DEFAULTS['EMPTY'], $fieldFormOptions) ?>
<?= validation_show_error($field); ?>
</td>
</tr>

View File

@ -6,17 +6,19 @@
<?php foreach ($fields as $field) : ?>
<tr>
<td nowrap style="background-color:#e8ebe9; width:10%; text-align:right; padding-right:20px;">
<?= getFieldLabel_UserHelper($field,$fieldRules) ?>
<?= getFieldLabel_UserHelper($field, $fieldRules) ?>
</td>
<td style="text-align:left; padding-left:20px;">
<?= getFieldForm_UserHelper($field,is_null(old($field))?$entity->$field:old($field),$fieldFormOptions) ?>
<?= getFieldForm_UserHelper($field, old($field) ?: $entity->$field, $fieldFormOptions) ?>
<?= validation_show_error($field); ?>
</td>
</tr>
<?php endforeach; ?>
<tr><td valign="bottom" colspan="2" style="text-align:center;"><?= form_submit('', '수정', array("class" => "btn btn-outline btn-primary")); ?></td></tr>
<tr>
<td valign="bottom" colspan="2" style="text-align:center;"><?= form_submit('', '수정', array("class" => "btn btn-outline btn-primary")); ?></td>
</tr>
</table>
<?= form_close(); ?>
<?php if(session()->getFlashdata('error')):?><?= session()->getFlashdata('error') ?><?php endif?>
<?php if (session()->getFlashdata('error')) : ?><?= session()->getFlashdata('error') ?><?php endif ?>
<?= $this->include('templates/admin/footer'); ?>
<?= $this->endSection() ?>

View File

@ -19,16 +19,16 @@
<td>작업</td>
</tr>
<?php $i = 0; ?>
<?php foreach ($rows as $row) : ?>
<tr id="<?= $row['uid'] ?>" onClick="indexRowCheckBoxToggle(this);">
<?php foreach ($entitys as $entity) : ?>
<tr id="<?= $entity->getPrimaryKey() ?>" onClick="indexRowCheckBoxToggle(this);">
<td>
<?= form_checkbox(["id" => "checkbox_uid_{$row['uid']}", "name" => "batchjob_uids[]", "value" => $row['uid'], "class" => "batchjobuids_checkboxs"]); ?>
<?= form_checkbox(["id" => "checkbox_uid_{$entity->getPrimaryKey()}", "name" => "batchjob_uids[]", "value" => $entity->getPrimaryKey(), "class" => "batchjobuids_checkboxs"]); ?>
<?= $total_count - (($page - 1) * $per_page + $i) ?>
</td>
<?php foreach ($fields as $field) : ?>
<td nowrap><?= getFieldIndex_Row_UserSNSHelper($field, $row, $fieldFilters, $fieldFormOptions) ?></td>
<td nowrap><?= getFieldIndex_Row_UserSNSHelper($field, $entity, $fieldFilters, $fieldFormOptions) ?></td>
<?php endforeach; ?>
<td><?= anchor(current_url() . '/delete/' . $row['uid'], ICONS['DELETE'], ["class" => "btn btn-sm btn-danger btn-circle", "target" => "_self"]) ?></td>
<td><?= anchor(current_url() . '/delete/' . $entity->getPrimaryKey(), ICONS['DELETE'], ["class" => "btn btn-sm btn-danger btn-circle", "target" => "_self"]) ?></td>
</tr>
<?php $i++; ?>
<?php endforeach; ?>

View File

@ -5,7 +5,6 @@
<div id="menu_button">메뉴열기</div>
<div class="accordion">
<?= $this->include($layout['path'] . '/left_menu/base'); ?>
<?= $this->include($layout['path'] . '/left_menu/hpilo'); ?>
<?= $this->include($layout['path'] . '/left_menu/board'); ?>
</div>
</div>

View File

@ -1,28 +1,35 @@
</div>
<!-- panel-body -->
</div>
<!-- panel panel-default -->
<script type="text/javascript">
//날짜field용
$(document).ready(function() {
//class calender인 inputbox용
$(".calender").datepicker({
changeYear: true,
changeMonth: true,
yearRange: "-10:+0",
dateFormat: "yy-mm-dd"
</div>
<!-- panel panel-default -->
<script src="/vendors/tinymce/tinymce/tinymce.min.js" referrerpolicy="origin"></script>
<script type="text/javascript">
//날짜field용
$(document).ready(function() {
//class calender인 inputbox용
$(".calender").datepicker({
changeYear: true,
changeMonth: true,
yearRange: "-10:+0",
dateFormat: "yy-mm-dd"
});
//id가 batchjobuids_checkbox인 버튼을 클릭시 class가 batchjobuids_checkboxs인 checkbox용
$('#batchjobuids_checkbox').click(function(event) {
if (this.checked) {
$('.batchjobuids_checkboxs').each(function() { //loop checkbox
$(this).prop('checked', true); //check
});
} else {
$('.batchjobuids_checkboxs').each(function() { //loop checkbox
$(this).prop('checked', false); //uncheck
});
}
});
//class가 editor인 textarea용
tinymce.init({
selector: '.editor',
theme: 'silver',
height: 500
});
});
//checkbox용
$('#batchjobuids_checkbox').click(function(event) {
if (this.checked) {
$('.batchjobuids_checkboxs').each(function() { //loop through each checkbox
$(this).prop('checked', true); //check
});
} else {
$('.batchjobuids_checkboxs').each(function() { //loop through each checkbox
$(this).prop('checked', false); //uncheck
});
}
});
});
</script>
</script>