shoppingmallv2 init..
This commit is contained in:
parent
9e4d03315f
commit
cd4398a4f8
@ -58,12 +58,12 @@ abstract class FrontController extends BaseController
|
||||
$this->_viewDatas['category'],
|
||||
$category_field,
|
||||
)) {
|
||||
echo var_export($this->_viewDatas['currentRoles'], true);
|
||||
echo "<HR>";
|
||||
echo var_export($this->_viewDatas['category'], true);
|
||||
echo "<HR>";
|
||||
echo "field->", $action . ":" . $category_field;
|
||||
exit;
|
||||
// echo var_export($this->_viewDatas['currentRoles'], true);
|
||||
// echo "<HR>";
|
||||
// echo var_export($this->_viewDatas['category'], true);
|
||||
// echo "<HR>";
|
||||
// echo "field->", $action . ":" . $category_field;
|
||||
// exit;
|
||||
throw new \Exception("고객님은 " . lang($this->getCategoryModel()->getClassName() . ".label." . $category_field) . "이 없습니다.");
|
||||
}
|
||||
}
|
||||
|
||||
@ -8,4 +8,30 @@ abstract class BaseEntity extends Entity
|
||||
{
|
||||
abstract public function getPrimaryKey();
|
||||
abstract public function getTitle(): string;
|
||||
|
||||
//조화수관련 Field전용
|
||||
final public function getViews($field = 'view_cnt')
|
||||
{
|
||||
return $this->attributes[$field];
|
||||
}
|
||||
|
||||
//파일관련 Field전용
|
||||
|
||||
final public function getFileDownload($field = "upload_file")
|
||||
{
|
||||
return anchor(
|
||||
current_url() . "/download/{$field}/{$this->getPrimaryKey()}",
|
||||
ICONS['IMAGE_FILE'] . explode(DEFAULTS['DELIMITER_FILE'], $this->attributes[$field])[1],
|
||||
["target" => "_self"]
|
||||
);
|
||||
}
|
||||
//이미지관련 Field전용
|
||||
final public function getFileImage($field = "photo", $size = false)
|
||||
{
|
||||
return sprintf(
|
||||
"<img src=\"/upload_images/%s%s\">",
|
||||
$size ? $size . '_' : '',
|
||||
explode(DEFAULTS['DELIMITER_FILE'], $this->attributes[$field])[1]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -35,16 +35,8 @@ class BoardEntity extends BaseHierarchyEntity
|
||||
{
|
||||
return $this->attributes['passwd'];
|
||||
}
|
||||
public function getViews()
|
||||
{
|
||||
return $this->attributes['view_cnt'];
|
||||
}
|
||||
public function getBoardFile()
|
||||
{
|
||||
return $this->attributes['board_file'];
|
||||
}
|
||||
public function getBoardFileName()
|
||||
{
|
||||
return explode(DEFAULTS['DELIMITER_FILE'], $this->getBoardFile())[1];
|
||||
}
|
||||
}
|
||||
|
||||
@ -42,16 +42,4 @@ class CategoryEntity extends BaseHierarchyEntity
|
||||
{
|
||||
return $this->attributes['photo'];
|
||||
}
|
||||
public function getPhotoFileName($size = false)
|
||||
{
|
||||
$photo = $this->getPhoto();
|
||||
if (is_null($photo)) {
|
||||
return "";
|
||||
}
|
||||
return sprintf(
|
||||
"<img src=\"/upload_images/%s%s\">",
|
||||
$size ? $size . '_' : '',
|
||||
explode(DEFAULTS['DELIMITER_FILE'], $this->getPhoto())[1]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -47,26 +47,10 @@ class ProductEntity extends BaseEntity
|
||||
{
|
||||
return $this->attributes['photo'];
|
||||
}
|
||||
public function getPhotoFileName($size = false)
|
||||
{
|
||||
$photo = $this->getPhoto();
|
||||
if (is_null($photo)) {
|
||||
return "";
|
||||
}
|
||||
return sprintf(
|
||||
"<img src=\"/upload_images/%s%s\">",
|
||||
$size ? $size . '_' : '',
|
||||
explode(DEFAULTS['DELIMITER_FILE'], $this->getPhoto())[1]
|
||||
);
|
||||
}
|
||||
public function getContent()
|
||||
{
|
||||
return $this->attributes['content'];
|
||||
}
|
||||
public function getViews()
|
||||
{
|
||||
return $this->attributes['view_cnt'];
|
||||
}
|
||||
public function getStock()
|
||||
{
|
||||
return $this->attributes['stock'];
|
||||
|
||||
@ -94,7 +94,10 @@ function getFieldView_BoardHelper($field, $entity, array $viewDatas)
|
||||
break;
|
||||
case 'board_file':
|
||||
case 'upload_file':
|
||||
return $value == DEFAULTS['EMPTY'] ? DEFAULTS['EMPTY'] : anchor(current_url() . "/download/{$field}/{$entity->getPrimaryKey()}", ICONS['IMAGE_FILE'] . explode(DEFAULTS['DELIMITER_FILE'], $value)[0], ["target" => "_self"]);
|
||||
return $entity->getFileDownload($field);
|
||||
break;
|
||||
case 'photo':
|
||||
return $entity->getFileImage($field, 'middle');
|
||||
break;
|
||||
case 'view_cnt':
|
||||
return number_format(!$value ? 0 : $value);
|
||||
|
||||
@ -40,7 +40,11 @@ function getFieldForm_CategoryHelper($field, $value, array $viewDatas, array $at
|
||||
case 'content':
|
||||
case 'head':
|
||||
case 'tail':
|
||||
return form_textarea($field, html_entity_decode($value), ['class' => 'editor', 'rows' => '20', 'cols' => '100']);
|
||||
return form_textarea(
|
||||
$field,
|
||||
html_entity_decode($value),
|
||||
['class' => 'editor', 'rows' => '20', 'cols' => '100']
|
||||
);
|
||||
break;
|
||||
case 'upload_file':
|
||||
case 'board_file':
|
||||
@ -89,11 +93,10 @@ function getFieldView_CategoryHelper($field, $entity, array $viewDatas)
|
||||
break;
|
||||
case 'board_file':
|
||||
case 'upload_file':
|
||||
return $value == DEFAULTS['EMPTY'] ? DEFAULTS['EMPTY'] : anchor(current_url() . "/download/{$field}/{$entity->getPrimaryKey()}", ICONS['IMAGE_FILE'] . explode(DEFAULTS['DELIMITER_FILE'], $value)[0], ["target" => "_self"]);
|
||||
return $entity->getFileDownload($field);
|
||||
break;
|
||||
case 'photo':
|
||||
// return $entity->getPhotoFileName();
|
||||
return $entity->getPhotoFileName('middle');
|
||||
return $entity->getFileImage($field, 'middle');
|
||||
break;
|
||||
case 'view_cnt':
|
||||
return number_format(!$value ? 0 : $value);
|
||||
|
||||
@ -89,11 +89,10 @@ function getFieldView_ProductHelper($field, $entity, array $viewDatas)
|
||||
break;
|
||||
case 'board_file':
|
||||
case 'upload_file':
|
||||
return $value == DEFAULTS['EMPTY'] ? DEFAULTS['EMPTY'] : anchor(current_url() . "/download/{$field}/{$entity->getPrimaryKey()}", ICONS['IMAGE_FILE'] . explode(DEFAULTS['DELIMITER_FILE'], $value)[0], ["target" => "_self"]);
|
||||
return $entity->getFileDownload($field);
|
||||
break;
|
||||
case 'photo':
|
||||
// return $entity->getPhotoFileName();
|
||||
return $entity->getPhotoFileName('middle');
|
||||
return $entity->getFileImage($field, 'middle');
|
||||
break;
|
||||
case 'cost':
|
||||
case 'price':
|
||||
|
||||
@ -34,7 +34,7 @@
|
||||
<?= $this->include($viewDatas['layout']['path'] . '/top_navigator'); ?>
|
||||
<?= $this->include($viewDatas['layout']['path'] . '/top_menu'); ?>
|
||||
<?php if (array_key_exists('parent_category', $viewDatas) && !is_null($viewDatas['parent_category'])) : ?>
|
||||
<?= $viewDatas['parent_category']->getPhotoFileName() ?>
|
||||
<?= $viewDatas['parent_category']->getFileImage() ?>
|
||||
<?php endif ?>
|
||||
</div>
|
||||
<div class="container-fluid">
|
||||
|
||||
Loading…
Reference in New Issue
Block a user