mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-04-02 01:52:10 +09:00
Show clickable list of layout instances in "installed layout" page
This commit is contained in:
parent
59f95fe099
commit
ad1617b17c
3 changed files with 65 additions and 47 deletions
|
|
@ -22,50 +22,44 @@ class LayoutAdminView extends Layout
|
|||
*/
|
||||
function dispLayoutAdminInstalledList()
|
||||
{
|
||||
$type = Context::get('type');
|
||||
$type = ($type != 'M') ? 'P' : 'M';
|
||||
$type = Context::get('type') === 'M' ? 'M' : 'P';
|
||||
|
||||
// Set a layout list
|
||||
$oLayoutModel = getModel('layout');
|
||||
$layout_list = $oLayoutModel->getDownloadedLayoutList($type, true);
|
||||
if(!is_array($layout_list))
|
||||
// Get installed layout list
|
||||
$layout_list = LayoutModel::getDownloadedLayoutList($type, true);
|
||||
if (!is_array($layout_list))
|
||||
{
|
||||
$layout_list = array();
|
||||
$layout_list = [];
|
||||
}
|
||||
|
||||
if($type == 'P')
|
||||
// Get instance list
|
||||
$columns = ['layout_srl', 'layout', 'module_srl', 'title', 'regdate'];
|
||||
$instances = LayoutModel::getLayoutInstanceList(0, $type, null, $columns);
|
||||
$instance_list = [];
|
||||
foreach ($instances as $instance)
|
||||
{
|
||||
// get Theme layout
|
||||
$oAdminModel = getAdminModel('admin');
|
||||
$themeList = $oAdminModel->getThemeList();
|
||||
$themeLayoutList = array();
|
||||
foreach($themeList as $themeInfo)
|
||||
{
|
||||
if(strpos($themeInfo->layout_info->name, '.') === false) continue;
|
||||
$themeLayoutList[] = $oLayoutModel->getLayoutInfo($themeInfo->layout_info->name, null, 'P');
|
||||
}
|
||||
$layout_list = array_merge($layout_list, $themeLayoutList);
|
||||
$layout_list[] = $oLayoutModel->getLayoutInfo('faceoff', null, 'P');
|
||||
$instance_list[$instance->layout][] = $instance;
|
||||
}
|
||||
Context::set('instance_list', $instance_list);
|
||||
|
||||
$pcLayoutCount = $oLayoutModel->getInstalledLayoutCount('P');
|
||||
$mobileLayoutCount = $oLayoutModel->getInstalledLayoutCount('M');
|
||||
// Get installed layout count by type
|
||||
$pcLayoutCount = LayoutModel::getInstalledLayoutCount('P');
|
||||
$mobileLayoutCount = LayoutModel::getInstalledLayoutCount('M');
|
||||
Context::set('pcLayoutCount', $pcLayoutCount);
|
||||
Context::set('mobileLayoutCount', $mobileLayoutCount);
|
||||
$this->setTemplateFile('installed_layout_list');
|
||||
|
||||
// Security?
|
||||
$security = new Security($layout_list);
|
||||
$layout_list = $security->encodeHTML('..', '..author..');
|
||||
|
||||
//Security
|
||||
$security = new Security();
|
||||
$security->encodeHTML('layout_list..layout','layout_list..title');
|
||||
|
||||
foreach($layout_list as $no => $layout_info)
|
||||
$security->encodeHTML('layout_list..layout','layout_list..title','instance_list..');
|
||||
foreach ($layout_list as $no => $layout_info)
|
||||
{
|
||||
$layout_list[$no]->description = nl2br(trim($layout_info->description));
|
||||
}
|
||||
Context::set('layout_list', $layout_list);
|
||||
|
||||
// Set template file
|
||||
$this->setTemplateFile('installed_layout_list');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -74,19 +68,17 @@ class LayoutAdminView extends Layout
|
|||
*/
|
||||
function dispLayoutAdminAllInstanceList()
|
||||
{
|
||||
$type = Context::get('type');
|
||||
$type = Context::get('type') === 'M' ? 'M' : 'P';
|
||||
|
||||
if(!in_array($type, array('P', 'M'))) $type = 'P';
|
||||
|
||||
$oLayoutModel = getModel('layout');
|
||||
|
||||
$pcLayoutCount = $oLayoutModel->getInstalledLayoutCount('P');
|
||||
$mobileLayoutCount = $oLayoutModel->getInstalledLayoutCount('M');
|
||||
// Get installed layout count
|
||||
$pcLayoutCount = LayoutModel::getInstalledLayoutCount('P');
|
||||
$mobileLayoutCount = LayoutModel::getInstalledLayoutCount('M');
|
||||
Context::set('pcLayoutCount', $pcLayoutCount);
|
||||
Context::set('mobileLayoutCount', $mobileLayoutCount);
|
||||
|
||||
// Get layout instance list
|
||||
$columnList = array('layout_srl', 'layout', 'module_srl', 'title', 'regdate');
|
||||
$_layout_list = $oLayoutModel->getLayoutInstanceList(0, $type, null, $columnList);
|
||||
$_layout_list = LayoutModel::getLayoutInstanceList(0, $type, null, $columnList);
|
||||
|
||||
$layout_list = array();
|
||||
foreach($_layout_list as $item)
|
||||
|
|
@ -94,7 +86,7 @@ class LayoutAdminView extends Layout
|
|||
if(!$layout_list[$item->layout])
|
||||
{
|
||||
$layout_list[$item->layout] = array();
|
||||
$layout_info = $oLayoutModel->getLayoutInfo($item->layout, null, $type);
|
||||
$layout_info = LayoutModel::getLayoutInfo($item->layout, null, $type);
|
||||
if ($layout_info)
|
||||
{
|
||||
$layout_list[$item->layout]['title'] = $layout_info->title;
|
||||
|
|
@ -108,10 +100,10 @@ class LayoutAdminView extends Layout
|
|||
|
||||
Context::set('layout_list', $layout_list);
|
||||
|
||||
$this->setTemplateFile('layout_all_instance_list');
|
||||
|
||||
$security = new Security();
|
||||
$security->encodeHTML('layout_list..');
|
||||
|
||||
$this->setTemplateFile('layout_all_instance_list');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -17,10 +17,11 @@
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr loop="$layout_list => $key, $layout">
|
||||
<block cond="$layout->title">
|
||||
<!--@foreach($layout_list as $layout)-->
|
||||
<tr>
|
||||
<!--@if($layout->title)-->
|
||||
<td class="title">
|
||||
<p><a href="{getUrl('act', 'dispLayoutAdminInstanceList', 'type', $type, 'layout', $layout->layout)}">{$layout->title}</a></p>
|
||||
<p><a href="{getUrl('act', 'dispLayoutAdminInstanceList', 'type', $type, 'layout', $layout->layout)}" style="font-weight:bold;color:#000">{$layout->title}</a></p>
|
||||
<p>{$layout->description}</p>
|
||||
<p cond="$layout->need_update == 'Y'" class="update">
|
||||
{$lang->msg_avail_easy_update} <a href="{$layout->update_url}&return_url={urlencode(getRequestUriByServerEnviroment())}">{$lang->msg_do_you_like_update}</a>
|
||||
|
|
@ -40,9 +41,10 @@
|
|||
</block>
|
||||
</td>
|
||||
<td class="rx_detail_marks">{$layout->path}</td>
|
||||
<td class="nowr rx_detail_marks"><a cond="$layout->remove_url" class="x_btn x_btn-link" href="{$layout->remove_url}&return_url={urlencode(getRequestUriByServerEnviroment())}">{$lang->cmd_delete}</a></td>
|
||||
</block>
|
||||
<block cond="!$layout->title">
|
||||
<td class="nowr rx_detail_marks">
|
||||
<a cond="$layout->remove_url" class="x_btn x_btn-link" href="{$layout->remove_url}&return_url={urlencode(getRequestUriByServerEnviroment())}">{$lang->cmd_delete}</a>
|
||||
</td>
|
||||
<!--@else-->
|
||||
<td class="title">
|
||||
<p><a href="{getUrl('act', 'dispLayoutAdminInstanceList', 'type', $type, 'layout', $layout->layout)}">{$layout->layout}</a></p>
|
||||
<p cond="$layout->need_update == 'Y'" class="update">
|
||||
|
|
@ -52,7 +54,31 @@
|
|||
<td>-</td>
|
||||
<td>-</td>
|
||||
<td class="rx_detail_marks">{$layout->path}</td>
|
||||
</block>
|
||||
<td class="rx_detail_marks"></td>
|
||||
<!--@endif-->
|
||||
</tr>
|
||||
<!--@if(isset($instance_list[$layout->layout]))-->
|
||||
<!--@foreach($instance_list[$layout->layout] as $instance)-->
|
||||
<tr>
|
||||
<td colspan="2" style="padding-left:20px;">
|
||||
<i class="xi-reply-l" style="transform:rotate(180deg);"></i>
|
||||
<a href="{getUrl(['module' => 'admin', 'act' => 'dispLayoutAdminModify', 'layout_srl' => $instance->layout_srl])}">
|
||||
{$instance->title}
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
<!--@if($instance->is_edited)-->
|
||||
<a href="{getUrl(['module' => 'admin', 'act' => 'dispLayoutAdminEdit', 'layout_srl' => $instance->layout_srl])}">{$lang->cmd_edit}</a>
|
||||
<!--@else-->
|
||||
<span style="color:#999">편집</span>
|
||||
<!--@endif-->
|
||||
<a href="{getUrl(['module' => 'layout', 'act' => 'dispLayoutAdminCopyLayout', 'layout_srl' => $instance->layout_srl])}" onclick="popopen(this.href);return false;" title="{$lang->cmd_copy}">{$lang->cmd_copy}</a></td>
|
||||
</td>
|
||||
<td class="rx_detail_marks"></td>
|
||||
<td class="rx_detail_marks"></td>
|
||||
</tr>
|
||||
<!--@endforeach-->
|
||||
<!--@endif-->
|
||||
<!--@endforeach-->
|
||||
</tbody>
|
||||
</table>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
<ul class="x_nav x_nav-tabs">
|
||||
<li class="x_active"|cond="$type != 'M'"><a href="{getUrl('act', 'dispLayoutAdminInstalledList', 'type', 'P')}">PC({$pcLayoutCount})</a></li>
|
||||
<li class="x_active"|cond="$type == 'M'"><a href="{getUrl('act', 'dispLayoutAdminInstalledList', 'type', 'M')}">Mobile({$mobileLayoutCount})</a></li>
|
||||
<li class="x_active"|cond="$type != 'M'"><a href="{getUrl('act', 'dispLayoutAdminInstalledList', 'type', 'P')}">PC ({$pcLayoutCount})</a></li>
|
||||
<li class="x_active"|cond="$type == 'M'"><a href="{getUrl('act', 'dispLayoutAdminInstalledList', 'type', 'M')}">Mobile ({$mobileLayoutCount})</a></li>
|
||||
</ul>
|
||||
<div>
|
||||
<a class="active"|cond="$act == 'dispLayoutAdminAllInstanceList'" href="{getUrl('act', 'dispLayoutAdminAllInstanceList', 'layout_srl', '')}">{$lang->instance_layout}</a> <i>|</i>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue