mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-08 03:01:43 +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
|
|
@ -24,7 +24,7 @@ class boardModel extends module
|
|||
$list_config = ModuleModel::getModulePartConfig('board', $module_srl);
|
||||
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
|
||||
|
|
@ -57,7 +57,7 @@ class boardModel extends module
|
|||
public static function getDefaultListConfig($module_srl)
|
||||
{
|
||||
// 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');
|
||||
foreach($virtual_vars as $key)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -453,8 +453,10 @@ class boardView extends board
|
|||
|
||||
$args = new stdClass();
|
||||
$args->module_srl = $this->include_modules ?: $this->module_srl;
|
||||
$notice_output = DocumentModel::getNoticeList($args, $this->columnList);
|
||||
Context::set('notice_list', $notice_output->data);
|
||||
$output = DocumentModel::getNoticeList($args, $this->columnList);
|
||||
$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
|
||||
$output = DocumentModel::getDocumentList($args, $this->except_notice, TRUE, $this->columnList);
|
||||
$this->_fillModuleTitles($output->data);
|
||||
Context::set('document_list', $output->data);
|
||||
Context::set('total_count', $output->total_count);
|
||||
Context::set('total_page', $output->total_page);
|
||||
|
|
@ -576,6 +579,46 @@ class boardView extends board
|
|||
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()
|
||||
{
|
||||
$configColumList = array_keys($this->listConfig);
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@
|
|||
<tr>
|
||||
<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=='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" 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>
|
||||
|
|
@ -46,6 +47,9 @@
|
|||
<block cond="$document_srl==$document->document_srl">»</block>
|
||||
<block cond="$document_srl!=$document->document_srl">{$lang->notice}</block>
|
||||
</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">
|
||||
<a href="{getUrl('document_srl',$document->document_srl, 'listStyle', $listStyle, 'cpage','')}">
|
||||
{$document->getTitle()}
|
||||
|
|
@ -89,6 +93,9 @@
|
|||
<block cond="$document_srl==$document->document_srl">»</block>
|
||||
<block cond="$document_srl!=$document->document_srl">{$no}</block>
|
||||
</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">
|
||||
<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>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue