mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-07 10:41:40 +09:00
Add option to display module title in board list
This commit is contained in:
parent
e8b6db01fc
commit
46ac583a83
6 changed files with 80 additions and 7 deletions
|
|
@ -167,6 +167,7 @@ $lang->regdate = 'Registered Date';
|
||||||
$lang->anonymous = 'Anonymous';
|
$lang->anonymous = 'Anonymous';
|
||||||
$lang->last_update = 'Last Update';
|
$lang->last_update = 'Last Update';
|
||||||
$lang->last_post = 'Last Comment';
|
$lang->last_post = 'Last Comment';
|
||||||
|
$lang->module_title = 'Board Name';
|
||||||
$lang->signup_date = 'Signup Date';
|
$lang->signup_date = 'Signup Date';
|
||||||
$lang->last_login = 'Last Signin';
|
$lang->last_login = 'Last Signin';
|
||||||
$lang->first_page = 'First Page';
|
$lang->first_page = 'First Page';
|
||||||
|
|
|
||||||
|
|
@ -169,6 +169,7 @@ $lang->regdate = '등록일';
|
||||||
$lang->anonymous = '익명';
|
$lang->anonymous = '익명';
|
||||||
$lang->last_update = '최근 수정일';
|
$lang->last_update = '최근 수정일';
|
||||||
$lang->last_post = '마지막 댓글';
|
$lang->last_post = '마지막 댓글';
|
||||||
|
$lang->module_title = '게시판 이름';
|
||||||
$lang->signup_date = '가입일';
|
$lang->signup_date = '가입일';
|
||||||
$lang->last_login = '최근 로그인';
|
$lang->last_login = '최근 로그인';
|
||||||
$lang->first_page = '첫 페이지';
|
$lang->first_page = '첫 페이지';
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ class boardModel extends module
|
||||||
$list_config = ModuleModel::getModulePartConfig('board', $module_srl);
|
$list_config = ModuleModel::getModulePartConfig('board', $module_srl);
|
||||||
if(!is_array($list_config) || count($list_config) <= 0)
|
if(!is_array($list_config) || count($list_config) <= 0)
|
||||||
{
|
{
|
||||||
$list_config = array('no', 'title', 'nick_name','regdate','readed_count');
|
$list_config = array('no', 'title', 'nick_name', 'regdate', 'readed_count');
|
||||||
}
|
}
|
||||||
|
|
||||||
// get the extra variables
|
// get the extra variables
|
||||||
|
|
@ -57,7 +57,7 @@ class boardModel extends module
|
||||||
public static function getDefaultListConfig($module_srl)
|
public static function getDefaultListConfig($module_srl)
|
||||||
{
|
{
|
||||||
// add virtual srl, title, registered date, update date, nickname, ID, name, readed count, voted count etc.
|
// add virtual srl, title, registered date, update date, nickname, ID, name, readed count, voted count etc.
|
||||||
$virtual_vars = array( 'no', 'title', 'regdate', 'last_update', 'last_post', 'nick_name',
|
$virtual_vars = array( 'no', 'title', 'regdate', 'last_update', 'last_post', 'module_title', 'nick_name',
|
||||||
'user_id', 'user_name', 'readed_count', 'voted_count', 'blamed_count', 'thumbnail', 'summary', 'comment_status');
|
'user_id', 'user_name', 'readed_count', 'voted_count', 'blamed_count', 'thumbnail', 'summary', 'comment_status');
|
||||||
foreach($virtual_vars as $key)
|
foreach($virtual_vars as $key)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -453,8 +453,10 @@ class boardView extends board
|
||||||
|
|
||||||
$args = new stdClass();
|
$args = new stdClass();
|
||||||
$args->module_srl = $this->include_modules ?: $this->module_srl;
|
$args->module_srl = $this->include_modules ?: $this->module_srl;
|
||||||
$notice_output = DocumentModel::getNoticeList($args, $this->columnList);
|
$output = DocumentModel::getNoticeList($args, $this->columnList);
|
||||||
Context::set('notice_list', $notice_output->data);
|
$notice_list = $output->data;
|
||||||
|
$this->_fillModuleTitles($notice_list);
|
||||||
|
Context::set('notice_list', $notice_list);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -569,6 +571,7 @@ class boardView extends board
|
||||||
|
|
||||||
// setup document list variables on context
|
// setup document list variables on context
|
||||||
$output = DocumentModel::getDocumentList($args, $this->except_notice, TRUE, $this->columnList);
|
$output = DocumentModel::getDocumentList($args, $this->except_notice, TRUE, $this->columnList);
|
||||||
|
$this->_fillModuleTitles($output->data);
|
||||||
Context::set('document_list', $output->data);
|
Context::set('document_list', $output->data);
|
||||||
Context::set('total_count', $output->total_count);
|
Context::set('total_count', $output->total_count);
|
||||||
Context::set('total_page', $output->total_page);
|
Context::set('total_page', $output->total_page);
|
||||||
|
|
@ -576,6 +579,46 @@ class boardView extends board
|
||||||
Context::set('page_navigation', $output->page_navigation);
|
Context::set('page_navigation', $output->page_navigation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function _fillModuleTitles(&$document_list)
|
||||||
|
{
|
||||||
|
static $map = null;
|
||||||
|
|
||||||
|
if ($this->include_modules)
|
||||||
|
{
|
||||||
|
if ($map === null)
|
||||||
|
{
|
||||||
|
$map = [];
|
||||||
|
$module_titles = ModuleModel::getModulesInfo($this->include_modules, ['module_srl', 'mid', 'browser_title']);
|
||||||
|
foreach ($module_titles as $module_info)
|
||||||
|
{
|
||||||
|
$map[$module_info->module_srl] = $module_info;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
foreach ($document_list as $document)
|
||||||
|
{
|
||||||
|
$module_srl = $document->get('module_srl');
|
||||||
|
if (isset($map[$module_srl]))
|
||||||
|
{
|
||||||
|
$document->add('module_title', $map[$module_srl]->browser_title);
|
||||||
|
$document->add('mid', $map[$module_srl]->mid);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$document->add('module_title', $this->module_info->browser_title);
|
||||||
|
$document->add('mid', $this->module_info->mid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
foreach ($document_list as $document)
|
||||||
|
{
|
||||||
|
$document->add('module_title', $this->module_info->browser_title);
|
||||||
|
$document->add('mid', $this->module_info->mid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function _makeListColumnList()
|
function _makeListColumnList()
|
||||||
{
|
{
|
||||||
$configColumList = array_keys($this->listConfig);
|
$configColumList = array_keys($this->listConfig);
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@
|
||||||
<tr>
|
<tr>
|
||||||
<block loop="$list_config=>$key,$val">
|
<block loop="$list_config=>$key,$val">
|
||||||
<th scope="col" cond="$val->type=='no' && $val->idx==-1"><span>{$lang->no}</span></th>
|
<th scope="col" cond="$val->type=='no' && $val->idx==-1"><span>{$lang->no}</span></th>
|
||||||
|
<th scope="col" cond="$val->type=='module_title' && $val->idx==-1"><span>{$lang->module_title}</span></th>
|
||||||
<th scope="col" class="title" cond="$val->type=='title' && $val->idx==-1"><span>{$lang->title}</span></th>
|
<th scope="col" class="title" cond="$val->type=='title' && $val->idx==-1"><span>{$lang->title}</span></th>
|
||||||
<th scope="col" cond="$val->type=='nick_name' && $val->idx==-1"><span>{$lang->writer}</span></th>
|
<th scope="col" cond="$val->type=='nick_name' && $val->idx==-1"><span>{$lang->writer}</span></th>
|
||||||
<th scope="col" cond="$val->type=='user_id' && $val->idx==-1"><span>{$lang->user_id}</span></th>
|
<th scope="col" cond="$val->type=='user_id' && $val->idx==-1"><span>{$lang->user_id}</span></th>
|
||||||
|
|
@ -46,6 +47,9 @@
|
||||||
<block cond="$document_srl==$document->document_srl">»</block>
|
<block cond="$document_srl==$document->document_srl">»</block>
|
||||||
<block cond="$document_srl!=$document->document_srl">{$lang->notice}</block>
|
<block cond="$document_srl!=$document->document_srl">{$lang->notice}</block>
|
||||||
</td>
|
</td>
|
||||||
|
<td class="module_title" cond="$val->type=='module_title' && $val->idx==-1">
|
||||||
|
<a href="{getUrl('', 'mid', $document->get('mid'))}">{$document->get('module_title')}</a>
|
||||||
|
</td>
|
||||||
<td class="title" cond="$val->type=='title' && $val->idx==-1">
|
<td class="title" cond="$val->type=='title' && $val->idx==-1">
|
||||||
<a href="{getUrl('document_srl',$document->document_srl, 'listStyle', $listStyle, 'cpage','')}">
|
<a href="{getUrl('document_srl',$document->document_srl, 'listStyle', $listStyle, 'cpage','')}">
|
||||||
{$document->getTitle()}
|
{$document->getTitle()}
|
||||||
|
|
@ -89,6 +93,9 @@
|
||||||
<block cond="$document_srl==$document->document_srl">»</block>
|
<block cond="$document_srl==$document->document_srl">»</block>
|
||||||
<block cond="$document_srl!=$document->document_srl">{$no}</block>
|
<block cond="$document_srl!=$document->document_srl">{$no}</block>
|
||||||
</td>
|
</td>
|
||||||
|
<td class="module_title" cond="$val->type=='module_title' && $val->idx==-1">
|
||||||
|
<a href="{getUrl('', 'mid', $document->get('mid'))}">{$document->get('module_title')}</a>
|
||||||
|
</td>
|
||||||
<td class="title" cond="$val->type=='title' && $val->idx==-1">
|
<td class="title" cond="$val->type=='title' && $val->idx==-1">
|
||||||
<a href="{getUrl('document_srl',$document->document_srl, 'listStyle', $listStyle, 'cpage','')}">{$document->getTitle()}</a>
|
<a href="{getUrl('document_srl',$document->document_srl, 'listStyle', $listStyle, 'cpage','')}">{$document->getTitle()}</a>
|
||||||
<a cond="$document->getCommentCount()" href="{getUrl('document_srl', $document->document_srl)}#comment" class="replyNum" title="Replies">[{$document->getCommentCount()}]</a>
|
<a cond="$document->getCommentCount()" href="{getUrl('document_srl', $document->document_srl)}#comment" class="replyNum" title="Replies">[{$document->getCommentCount()}]</a>
|
||||||
|
|
|
||||||
|
|
@ -463,12 +463,33 @@ class moduleModel extends module
|
||||||
*/
|
*/
|
||||||
public static function getModulesInfo($module_srls, $columnList = array())
|
public static function getModulesInfo($module_srls, $columnList = array())
|
||||||
{
|
{
|
||||||
if(is_array($module_srls)) $module_srls = implode(',',$module_srls);
|
if (!is_array($module_srls))
|
||||||
|
{
|
||||||
|
$module_srls = explode(',', $module_srls);
|
||||||
|
}
|
||||||
|
if (!count($module_srls))
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
$cache_key = 'site_and_module:modules_info:' . implode(',', $module_srls) . ':' . implode(',', $columnList ?: []);
|
||||||
|
$result = Rhymix\Framework\Cache::get($cache_key);
|
||||||
|
if ($result !== null)
|
||||||
|
{
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
|
|
||||||
$args = new stdClass();
|
$args = new stdClass();
|
||||||
$args->module_srls = $module_srls;
|
$args->module_srls = $module_srls;
|
||||||
$output = executeQueryArray('module.getModulesInfo', $args, $columnList);
|
$output = executeQueryArray('module.getModulesInfo', $args, $columnList);
|
||||||
if(!$output->toBool()) return;
|
$result = $output->data ?: [];
|
||||||
return self::addModuleExtraVars($output->data);
|
if (!$columnList)
|
||||||
|
{
|
||||||
|
$result = self::addModuleExtraVars($result);
|
||||||
|
}
|
||||||
|
|
||||||
|
Rhymix\Framework\Cache::set($cache_key, $result, 0, true);
|
||||||
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue