diff --git a/app/Controllers/Admin/Cloudflare/API/AccountController.php b/app/Controllers/Admin/Cloudflare/API/AccountController.php index a0f6cfd..62e5371 100644 --- a/app/Controllers/Admin/Cloudflare/API/AccountController.php +++ b/app/Controllers/Admin/Cloudflare/API/AccountController.php @@ -29,6 +29,7 @@ class AccountController extends APIController helper($this->_className); $this->_viewPath = strtolower($this->_className); $this->_viewDatas['title'] = lang($this->_className . '.title'); + $this->_viewDatas['className'] = $this->_className; } //Field별 Form Option용 diff --git a/app/Controllers/Admin/Cloudflare/API/AuthController.php b/app/Controllers/Admin/Cloudflare/API/AuthController.php index 4bce44d..01e78de 100644 --- a/app/Controllers/Admin/Cloudflare/API/AuthController.php +++ b/app/Controllers/Admin/Cloudflare/API/AuthController.php @@ -51,6 +51,7 @@ class AuthController extends APIController helper($this->_className); $this->_viewPath = strtolower($this->_className); $this->_viewDatas['title'] = lang($this->_className . '.title'); + $this->_viewDatas['className'] = $this->_className; } //Insert관련 diff --git a/app/Controllers/Admin/Cloudflare/API/FirewallController.php b/app/Controllers/Admin/Cloudflare/API/FirewallController.php index 3667dbb..cee1a1f 100644 --- a/app/Controllers/Admin/Cloudflare/API/FirewallController.php +++ b/app/Controllers/Admin/Cloudflare/API/FirewallController.php @@ -30,6 +30,7 @@ class FirewallController extends APIController helper($this->_className); $this->_viewPath = strtolower($this->_className); $this->_viewDatas['title'] = lang($this->_className . '.title'); + $this->_viewDatas['className'] = $this->_className; } //Field별 Form Option용 diff --git a/app/Controllers/Admin/Cloudflare/API/RecordController.php b/app/Controllers/Admin/Cloudflare/API/RecordController.php index de4ea4a..2bbb2c9 100644 --- a/app/Controllers/Admin/Cloudflare/API/RecordController.php +++ b/app/Controllers/Admin/Cloudflare/API/RecordController.php @@ -42,6 +42,7 @@ class RecordController extends APIController helper($this->_className); $this->_viewPath = strtolower($this->_className); $this->_viewDatas['title'] = lang($this->_className . '.title'); + $this->_viewDatas['className'] = $this->_className; } //Field별 Form Option용 diff --git a/app/Controllers/Admin/Cloudflare/API/ZoneController.php b/app/Controllers/Admin/Cloudflare/API/ZoneController.php index 71b938e..5d0d853 100644 --- a/app/Controllers/Admin/Cloudflare/API/ZoneController.php +++ b/app/Controllers/Admin/Cloudflare/API/ZoneController.php @@ -42,6 +42,7 @@ class ZoneController extends APIController helper($this->_className); $this->_viewPath = strtolower($this->_className); $this->_viewDatas['title'] = lang($this->_className . '.title'); + $this->_viewDatas['className'] = $this->_className; } //Field별 Form Option용 diff --git a/app/Controllers/Admin/LoggerController.php b/app/Controllers/Admin/LoggerController.php index 30cbf4b..978b4bf 100644 --- a/app/Controllers/Admin/LoggerController.php +++ b/app/Controllers/Admin/LoggerController.php @@ -36,6 +36,7 @@ class LoggerController extends \App\Controllers\Admin\AdminController helper($this->_className); $this->_viewPath = strtolower($this->_className); $this->_viewDatas['title'] = lang($this->_className . '.title'); + $this->_viewDatas['className'] = $this->_className; } private function getUserModel(): UserModel diff --git a/app/Controllers/Admin/MapurlController.php b/app/Controllers/Admin/MapurlController.php index 137edcd..22eaef8 100644 --- a/app/Controllers/Admin/MapurlController.php +++ b/app/Controllers/Admin/MapurlController.php @@ -51,8 +51,7 @@ class MapurlController extends \App\Controllers\Admin\AdminController helper($this->_className); $this->_viewPath = strtolower($this->_className); $this->_viewDatas['title'] = lang($this->_className . '.title'); - - //모든 필요한 FormOption등 조기화작업 필요 + $this->_viewDatas['className'] = $this->_className; } private function remapurl() diff --git a/app/Controllers/Admin/UserController.php b/app/Controllers/Admin/UserController.php index 72c3950..dcb8537 100644 --- a/app/Controllers/Admin/UserController.php +++ b/app/Controllers/Admin/UserController.php @@ -56,6 +56,7 @@ class UserController extends \App\Controllers\Admin\AdminController helper($this->_className); $this->_viewPath = strtolower($this->_className); $this->_viewDatas['title'] = lang($this->_className . '.title'); + $this->_viewDatas['className'] = $this->_className; } //Insert관련 diff --git a/app/Helpers/Admin/Cloudflare/API/Account_helper.php b/app/Helpers/Admin/Cloudflare/API/Account_helper.php index 67213b3..3a54d69 100644 --- a/app/Helpers/Admin/Cloudflare/API/Account_helper.php +++ b/app/Helpers/Admin/Cloudflare/API/Account_helper.php @@ -6,7 +6,7 @@ function getFieldLabel_AccountHelper($field, array $fieldRules, array $attribute if (strpos($fieldRules[$field], 'required') !== false) { array_push($attributes, 'style="color:red";'); } - return sprintf("%s", implode(" ", $attributes), lang('Cloudflare/Account.label.' . $field)); + return sprintf("%s", implode(" ", $attributes), lang("Admin/Cloudflare/API/Account.label.{$field}")); break; } } @@ -48,7 +48,7 @@ function getFieldView_AccountHelper($field, $entity, array $fieldFilters, $field function getFieldIndex_Column_AccountHelper($field, $order_field, $order_value, array $attributes = array()) { - $label = lang('Cloudflare/Account.label.' . $field); + $label = lang("Admin/Cloudflare/API/Account.label.{$field}"); $label = $field == $order_field ? sprintf('%s ', $label, $order_value == 'ASC' ? "up" : "down") : $label; $order_value = $order_value == 'DESC' ? "ASC" : "DESC"; return anchor(current_url() . "?order_field={$field}&order_value={$order_value}", $label, $attributes); diff --git a/app/Helpers/Admin/Cloudflare/API/Auth_helper.php b/app/Helpers/Admin/Cloudflare/API/Auth_helper.php index 050daa9..86e6fb0 100644 --- a/app/Helpers/Admin/Cloudflare/API/Auth_helper.php +++ b/app/Helpers/Admin/Cloudflare/API/Auth_helper.php @@ -1,46 +1,48 @@ %s",implode(" ",$attributes),lang('Cloudflare/Auth.label.'.$field)); + return sprintf("%s", implode(" ", $attributes), lang("Admin/Cloudflare/API/Auth.label.{$field}")); break; } } //header.php에서 getFieldForm_Helper사용 -function getFieldForm_AuthHelper($field,$value,array $formOptions,array $attributes = array()) +function getFieldForm_AuthHelper($field, $value, array $formOptions, array $attributes = array()) { - $value = is_null($value) ? DEFAULT_EMPTY:$value; - switch($field){ + $value = is_null($value) ? DEFAULT_EMPTY : $value; + switch ($field) { case 'uid': $attributes['id'] = "uid_select"; - return sprintf("%s %s", - form_dropdown($field,$formOptions[$field],$value,$attributes), - ''); + return sprintf( + "%s %s", + form_dropdown($field, $formOptions[$field], $value, $attributes), + '' + ); break; case 'status': - return form_dropdown($field,$formOptions[$field],$value,$attributes); + return form_dropdown($field, $formOptions[$field], $value, $attributes); break; case 'updated_at': case 'created_at': - $attributes["class"] = !array_key_exists("class",$attributes) ? "calender":$attributes["class"]." calender"; - return form_input($field,$value,$attributes); + $attributes["class"] = !array_key_exists("class", $attributes) ? "calender" : $attributes["class"] . " calender"; + return form_input($field, $value, $attributes); break; default: - return form_input($field,$value,$attributes); + return form_input($field, $value, $attributes); break; } } // -function getFieldView_AuthHelper($field,$entity,array $fieldFilters,$fieldFormOptions,$attributes=array()) +function getFieldView_AuthHelper($field, $entity, array $fieldFilters, $fieldFormOptions, $attributes = array()) { - switch($field){ + switch ($field) { default: - if(in_array($field,$fieldFilters)){ + if (in_array($field, $fieldFilters)) { return $fieldFormOptions[$field][$entity->$field]; } return $entity->$field; @@ -48,32 +50,33 @@ function getFieldView_AuthHelper($field,$entity,array $fieldFilters,$fieldFormOp } } // -function getFieldIndex_Column_AuthHelper($field,$order_field,$order_value,array $attributes = array()) +function getFieldIndex_Column_AuthHelper($field, $order_field, $order_value, array $attributes = array()) { - $label = lang('Cloudflare/Auth.label.'.$field); - $label = $field == $order_field ? sprintf('%s ',$label,$order_value == 'ASC' ? "up":"down"):$label; - $order_value = $order_value == 'DESC' ? "ASC":"DESC"; - return anchor(current_url()."?order_field={$field}&order_value={$order_value}",$label,$attributes); + $label = lang("Admin/Cloudflare/API/Auth.label.{$field}"); + $label = $field == $order_field ? sprintf('%s ', $label, $order_value == 'ASC' ? "up" : "down") : $label; + $order_value = $order_value == 'DESC' ? "ASC" : "DESC"; + return anchor(current_url() . "?order_field={$field}&order_value={$order_value}", $label, $attributes); } // -function getFieldIndex_Row_AuthHelper($field,array $row,array $fieldFilters,array $fieldFormOptions,array $attributes=array()): string +function getFieldIndex_Row_AuthHelper($field, array $row, array $fieldFilters, array $fieldFormOptions, array $attributes = array()): string { - switch($field){ + switch ($field) { case 'id': - return sprintf('
%s %s %s
', - anchor(base_url().'/admin/cloudflare/auth/reload/'.$row['uid'],' ',["class"=>"btn btn-sm btn-primary btn-circle fa fa-refresh","target" => "_self"]), - anchor(base_url().'/admin/cloudflare/account?auth_uid='.$row['uid'],' ',["class"=>"btn btn-sm btn-primary btn-circle fa fa-flag","target" => "_self"]), - anchor(current_url().'/view/'.$row['uid'],$row[$field],["target"=>"_self"]), + return sprintf( + '
%s %s %s
', + anchor(base_url() . '/admin/cloudflare/auth/reload/' . $row['uid'], ' ', ["class" => "btn btn-sm btn-primary btn-circle fa fa-refresh", "target" => "_self"]), + anchor(base_url() . '/admin/cloudflare/account?auth_uid=' . $row['uid'], ' ', ["class" => "btn btn-sm btn-primary btn-circle fa fa-flag", "target" => "_self"]), + anchor(current_url() . '/view/' . $row['uid'], $row[$field], ["target" => "_self"]), ); break; case 'updated_at': case 'created_at': - return str_split($row[$field],10)[0]; + return str_split($row[$field], 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 getFieldForm_AuthHelper($field,$row[$field],$fieldFormOptions,$attributes); + 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 getFieldForm_AuthHelper($field, $row[$field], $fieldFormOptions, $attributes); } return $row[$field]; break; diff --git a/app/Helpers/Admin/Cloudflare/API/Firewall_helper.php b/app/Helpers/Admin/Cloudflare/API/Firewall_helper.php index e8aca1f..595bad5 100644 --- a/app/Helpers/Admin/Cloudflare/API/Firewall_helper.php +++ b/app/Helpers/Admin/Cloudflare/API/Firewall_helper.php @@ -1,84 +1,89 @@ %s",implode(" ",$attributes),lang('Cloudflare/Firewall.label.'.$field)); + return sprintf("%s", implode(" ", $attributes), lang("Admin/Cloudflare/API/Firewall.label.{$field}")); break; } } //header.php에서 getFieldForm_Helper사용 -function getFieldForm_FirewallHelper($field,$value,array $formOptions,array $attributes = array()) +function getFieldForm_FirewallHelper($field, $value, array $formOptions, array $attributes = array()) { - $value = is_null($value) ? DEFAULT_EMPTY:$value; - switch($field){ + $value = is_null($value) ? DEFAULT_EMPTY : $value; + switch ($field) { case 'zone_uid': - return form_dropdown($field,$formOptions[$field],$value,['class'=> "select-field form-select-sm"]); + return form_dropdown($field, $formOptions[$field], $value, ['class' => "select-field form-select-sm"]); break; case 'action': case 'filter_paused': case 'paused': - return form_dropdown($field,$formOptions[$field],$value,$attributes); + return form_dropdown($field, $formOptions[$field], $value, $attributes); break; case 'updated_at': case 'created_at': - $attributes["class"] = !array_key_exists("class",$attributes) ? "calender":$attributes["class"]." calender"; - return form_input($field,$value,$attributes); + $attributes["class"] = !array_key_exists("class", $attributes) ? "calender" : $attributes["class"] . " calender"; + return form_input($field, $value, $attributes); break; default: - return form_input($field,$value,$attributes); + return form_input($field, $value, $attributes); break; } } // -function getFieldView_FirewallHelper($field,array $fieldDatas,array $fieldFilters,array $fieldFormOptions,array $attributes=array()) +function getFieldView_FirewallHelper($field, array $fieldDatas, array $fieldFilters, array $fieldFormOptions, array $attributes = array()) { - switch($field){ + switch ($field) { default: - if(in_array($field,$fieldFilters)){ - return getFieldForm_FirewallHelper($field,$fieldDatas[$field],$fieldFormOptions,$attributes); + if (in_array($field, $fieldFilters)) { + return getFieldForm_FirewallHelper($field, $fieldDatas[$field], $fieldFormOptions, $attributes); } return $fieldDatas[$field]; break; } } // -function getFieldIndex_Column_FirewallHelper($field,$order_field,$order_value,array $attributes = array()) +function getFieldIndex_Column_FirewallHelper($field, $order_field, $order_value, array $attributes = array()) { - $label = lang('Cloudflare/Firewall.label.'.$field); - $label = $field == $order_field ? sprintf('%s ',$label,$order_value == 'ASC' ? "up":"down"):$label; - $order_value = $order_value == 'DESC' ? "ASC":"DESC"; - return anchor(current_url()."?order_field={$field}&order_value={$order_value}",$label,$attributes); + $label = lang("Admin/Cloudflare/API/Firewall.label.{$field}"); + $label = $field == $order_field ? sprintf('%s ', $label, $order_value == 'ASC' ? "up" : "down") : $label; + $order_value = $order_value == 'DESC' ? "ASC" : "DESC"; + return anchor(current_url() . "?order_field={$field}&order_value={$order_value}", $label, $attributes); } // -function getFieldIndex_Row_FirewallHelper($field,array $row,array $fieldFilters,$fieldFormOptions,$attributes=array(),string $old_zone_uid=''): string +function getFieldIndex_Row_FirewallHelper($field, array $row, array $fieldFilters, $fieldFormOptions, $attributes = array(), string $old_zone_uid = ''): string { - switch($field){ + switch ($field) { case 'zone_uid': $temp = ''; - if($old_zone_uid !== $row[$field]){ - $temp = sprintf('
%s %s
', - anchor(base_url().'/admin/cloudflare/zone/firewall/'.$row['zone_uid'],' ',["class"=>"btn btn-sm btn-primary btn-circle fa fa-refresh","target" => "_self"]), - $fieldFormOptions[$field][$row[$field]]); + if ($old_zone_uid !== $row[$field]) { + $temp = sprintf( + '
%s %s
', + anchor(base_url() . '/admin/cloudflare/zone/firewall/' . $row['zone_uid'], ' ', ["class" => "btn btn-sm btn-primary btn-circle fa fa-refresh", "target" => "_self"]), + $fieldFormOptions[$field][$row[$field]] + ); } return $temp; break; case 'description': - return sprintf('', - preg_replace('/"/', "'",$row['filter_expression']),$row[$field]); + return sprintf( + '', + preg_replace('/"/', "'", $row['filter_expression']), + $row[$field] + ); break; case 'updated_at': case 'created_at': - return str_split($row[$field],10)[0]; + return str_split($row[$field], 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 getFieldForm_FirewallHelper($field,$row[$field],$fieldFormOptions,$attributes); + 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 getFieldForm_FirewallHelper($field, $row[$field], $fieldFormOptions, $attributes); } return $row[$field]; break; diff --git a/app/Helpers/Admin/Cloudflare/API/Record_helper.php b/app/Helpers/Admin/Cloudflare/API/Record_helper.php index 8002036..d1a9446 100644 --- a/app/Helpers/Admin/Cloudflare/API/Record_helper.php +++ b/app/Helpers/Admin/Cloudflare/API/Record_helper.php @@ -6,7 +6,7 @@ function getFieldLabel_RecordHelper($field, array $fieldRules, array $attributes if (strpos($fieldRules[$field], 'required') !== false) { array_push($attributes, 'style="color:red";'); } - return sprintf("%s", implode(" ", $attributes), lang('Cloudflare/Record.label.' . $field)); + return sprintf("%s", implode(" ", $attributes), lang("Admin/Cloudflare/API/Record.label.{$field}")); break; } } @@ -41,7 +41,7 @@ function getFieldView_RecordHelper($field, array $fieldDatas, array $fieldFilter { switch ($field) { case 'locked': - return lang(sprintf("Record.%s.%s", strtoupper($field), $fieldDatas[$field])); + return lang("Admin/Cloudflare/API/Record.label.{$fieldDatas[$field]}"); break; default: if (in_array($field, $fieldFilters)) { @@ -54,23 +54,21 @@ function getFieldView_RecordHelper($field, array $fieldDatas, array $fieldFilter function getFieldIndex_Column_RecordHelper($field, $order_field, $order_value, array $attributes = array()) { + $label = lang("Admin/Cloudflare/API/Record.label.{$field}"); switch ($field) { case 'zone_uid': - $label = lang('Cloudflare/Record.label.' . $field); $label = $field == $order_field ? sprintf('%s ', $label, $order_value == 'ASC' ? "up" : "down") : $label; $order_value = $order_value == 'DESC' ? "ASC" : "DESC"; return anchor(current_url() . "?order_field={$field}&order_value={$order_value}", $label, $attributes) . " - - - - - - - - -endSection() ?> \ No newline at end of file