mirror of
https://github.com/e107inc/e107.git
synced 2025-08-03 21:27:25 +02:00
Issue #1436, Issue #2294 - New Forum Posts Menu template added. Beginnings of "New Forum Posts Main" replacement.
This commit is contained in:
@@ -27,14 +27,17 @@ class forum_menu
|
|||||||
public function config($menu='')
|
public function config($menu='')
|
||||||
{
|
{
|
||||||
|
|
||||||
|
$layouts = e107::getLayouts('forum','newforumposts_menu');
|
||||||
|
|
||||||
$fields = array();
|
$fields = array();
|
||||||
$fields['caption'] = array('title'=> LAN_FORUM_MENU_004, 'type'=>'text', 'multilan'=>true, 'writeParms'=>array('size'=>'xxlarge'));
|
$fields['caption'] = array('title'=> LAN_FORUM_MENU_004, 'type'=>'text', 'multilan'=>true, 'writeParms'=>array('size'=>'xxlarge'));
|
||||||
$fields['display'] = array('title'=> LAN_FORUM_MENU_005, 'type'=>'text', 'writeParms'=>array('size'=>'mini','pattern'=>'[0-9]*'));
|
$fields['display'] = array('title'=> LAN_FORUM_MENU_005, 'type'=>'text', 'writeParms'=>array('size'=>'mini','pattern'=>'[0-9]*'));
|
||||||
$fields['maxage'] = array('title'=> LAN_FORUM_MENU_0012, 'type'=>'text', 'help'=>LAN_FORUM_MENU_0013, 'writeParms'=>array('size'=>'mini','pattern'=>'[0-9]*'));
|
$fields['maxage'] = array('title'=> LAN_FORUM_MENU_0012, 'type'=>'text', 'help'=>LAN_FORUM_MENU_0013, 'writeParms'=>array('size'=>'mini','pattern'=>'[0-9]*'));
|
||||||
$fields['characters'] = array('title'=> LAN_FORUM_MENU_006, 'type'=>'text', 'writeParms'=>array('size'=>'mini','pattern'=>'[0-9]*'));
|
$fields['characters'] = array('title'=> LAN_FORUM_MENU_006, 'type'=>'text', 'writeParms'=>array('size'=>'mini','pattern'=>'[0-9]*'));
|
||||||
$fields['postfix'] = array('title'=> LAN_FORUM_MENU_007, 'type'=>'text', 'writeParms'=>array('size'=>'mini'));
|
$fields['postfix'] = array('title'=> LAN_FORUM_MENU_007, 'type'=>'text', 'writeParms'=>array('size'=>'mini'));
|
||||||
$fields['title'] = array('title'=> LAN_FORUM_MENU_008, 'type'=>'boolean');
|
// $fields['title'] = array('title'=> LAN_FORUM_MENU_008, 'type'=>'boolean');
|
||||||
|
$fields['layout'] = array('title'=> LAN_TEMPLATE, 'type'=>'dropdown', 'writeParms'=>array('optArray'=>$layouts[0]));
|
||||||
|
|
||||||
return $fields;
|
return $fields;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -45,7 +45,9 @@ class forum_newforumposts_menu // plugin folder + menu name (without the .php)
|
|||||||
$qry = "
|
$qry = "
|
||||||
SELECT
|
SELECT
|
||||||
p.post_user, p.post_id, p.post_datestamp, p.post_user_anon, p.post_entry,
|
p.post_user, p.post_id, p.post_datestamp, p.post_user_anon, p.post_entry,
|
||||||
t.thread_id, t.thread_datestamp, t.thread_name, u.user_id, u.user_name, u.user_image, u.user_currentvisit, f.forum_sef
|
t.*,
|
||||||
|
u.user_id, u.user_name, u.user_image, u.user_currentvisit,
|
||||||
|
f.forum_name, f.forum_sef
|
||||||
FROM `#forum_post` as p
|
FROM `#forum_post` as p
|
||||||
|
|
||||||
LEFT JOIN `#forum_thread` AS t ON t.thread_id = p.post_thread
|
LEFT JOIN `#forum_thread` AS t ON t.thread_id = p.post_thread
|
||||||
@@ -73,19 +75,54 @@ class forum_newforumposts_menu // plugin folder + menu name (without the .php)
|
|||||||
$list = null;
|
$list = null;
|
||||||
$text = null;
|
$text = null;
|
||||||
|
|
||||||
|
$layout = 'minimal';
|
||||||
|
|
||||||
|
if (!empty($this->menuPref['title']) && intval($this->menuPref['title']) === 1) // legacy pref value
|
||||||
|
{
|
||||||
|
$layout = 'default';
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!empty($this->menuPref['layout']))//@todo e_menu add 'layout' dropdown.
|
||||||
|
{
|
||||||
|
$layout = $this->menuPref['layout'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$template = e107::getTemplate('forum','newforumposts_menu',$layout);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$param = array();
|
||||||
|
|
||||||
|
foreach($this->menuPref as $k=>$v)
|
||||||
|
{
|
||||||
|
$param['nfp_'.$k] = $v;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if($results = $sql->gen($qry))
|
if($results = $sql->gen($qry))
|
||||||
{
|
{
|
||||||
|
|
||||||
if($tp->thumbWidth() > 250) // Fix for unset image size.
|
/* if($tp->thumbWidth() > 250) // Fix for unset image size.
|
||||||
{
|
{
|
||||||
$tp->setThumbSize(40,40,true);
|
$tp->setThumbSize(40,40,true);
|
||||||
}
|
}*/
|
||||||
|
|
||||||
$list = "<ul class='media-list newforumposts-menu'>";
|
$sc = e107::getScBatch('view', 'forum')->setScVar('param',$param);
|
||||||
|
|
||||||
|
$list = $tp->parseTemplate($template['start'],true);
|
||||||
|
|
||||||
while($row = $sql->fetch())
|
while($row = $sql->fetch())
|
||||||
{
|
{
|
||||||
|
$row['thread_sef'] = $this->forumObj->getThreadSef($row);
|
||||||
|
|
||||||
|
$sc->setScVar('postInfo', $row);
|
||||||
|
$sc->setVars($row);
|
||||||
|
$list .= $tp->parseTemplate($template['item'],false,$sc);
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
$datestamp = $tp->toDate($row['post_datestamp'], 'relative');
|
$datestamp = $tp->toDate($row['post_datestamp'], 'relative');
|
||||||
$id = $row['thread_id'];
|
$id = $row['thread_id'];
|
||||||
$topic = ($row['thread_datestamp'] == $row['post_datestamp'] ? '' : 'Re:');
|
$topic = ($row['thread_datestamp'] == $row['post_datestamp'] ? '' : 'Re:');
|
||||||
@@ -145,12 +182,15 @@ class forum_newforumposts_menu // plugin folder + menu name (without the .php)
|
|||||||
}
|
}
|
||||||
|
|
||||||
$list .= "</div></li>";
|
$list .= "</div></li>";
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$list .= "</ul>";
|
|
||||||
|
|
||||||
|
$list .= $tp->parseTemplate($template['end'],true);
|
||||||
|
|
||||||
|
|
||||||
$text = $list;
|
$text = $list;
|
||||||
}
|
}
|
||||||
@@ -164,7 +204,9 @@ class forum_newforumposts_menu // plugin folder + menu name (without the .php)
|
|||||||
{
|
{
|
||||||
$caption = !empty($this->menuPref['caption'][e_LANGUAGE]) ? $this->menuPref['caption'][e_LANGUAGE] : $this->menuPref['caption'];
|
$caption = !empty($this->menuPref['caption'][e_LANGUAGE]) ? $this->menuPref['caption'][e_LANGUAGE] : $this->menuPref['caption'];
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
|
||||||
|
if(empty($caption))
|
||||||
{
|
{
|
||||||
$caption = LAN_PLUGIN_FORUM_LATESTPOSTS;
|
$caption = LAN_PLUGIN_FORUM_LATESTPOSTS;
|
||||||
}
|
}
|
||||||
|
File diff suppressed because it is too large
Load Diff
63
e107_plugins/forum/templates/newforumposts_menu_template.php
Normal file
63
e107_plugins/forum/templates/newforumposts_menu_template.php
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* e107 website system
|
||||||
|
*
|
||||||
|
* Copyright (C) 2008-2017 e107 Inc (e107.org)
|
||||||
|
* Released under the terms and conditions of the
|
||||||
|
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
$NEWFORUMPOSTS_MENU_TEMPLATE['default']['start'] = "<ul class='media-list newforumposts-menu'>{SETIMAGE: w=48&h=48&crop=1}";
|
||||||
|
$NEWFORUMPOSTS_MENU_TEMPLATE['default']['item'] = "<li class='media'>
|
||||||
|
<div class='media-left'>
|
||||||
|
<a href='{POST_URL}'>{POST_AUTHOR_AVATAR: shape=circle}</a>
|
||||||
|
</div>
|
||||||
|
<div class='media-body'>
|
||||||
|
<h4 class='media-header'><a href='{POST_URL}'>{POST_TOPIC}</a></h4>{POST_CONTENT}<br /><small class='text-muted muted'>".LAN_FORUM_MENU_001." {POST_AUTHOR} {POST_DATESTAMP}</small>
|
||||||
|
</div></li>";
|
||||||
|
$NEWFORUMPOSTS_MENU_TEMPLATE['default']['end'] = "</ul>";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$NEWFORUMPOSTS_MENU_TEMPLATE['minimal']['start'] = "<ul class='media-list newforumposts-menu'>{SETIMAGE: w=48&h=48&crop=1}";
|
||||||
|
$NEWFORUMPOSTS_MENU_TEMPLATE['minimal']['item'] = "<li class='media'>
|
||||||
|
<div class='media-left'>
|
||||||
|
<a href='{POST_URL}'>{POST_AUTHOR_AVATAR: shape=circle}</a>
|
||||||
|
</div>
|
||||||
|
<div class='media-body'>
|
||||||
|
<a href='{POST_URL}'>".LAN_FORUM_MENU_001."</a> {POST_AUTHOR_NAME} <small class='text-muted muted'>{POST_DATESTAMP}</small><br />{POST_CONTENT}<br />
|
||||||
|
</div></li>";
|
||||||
|
$NEWFORUMPOSTS_MENU_TEMPLATE['minimal']['end'] = "</ul>";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$NEWFORUMPOSTS_MENU_TEMPLATE['main']['start'] = "<!-- newforumposts -->
|
||||||
|
<table class='table table-bordered table-striped fborder'>
|
||||||
|
<tr>
|
||||||
|
<td style='width:5%' class='forumheader'> </td>
|
||||||
|
<td style='width:45%' class='forumheader'>".LAN_FORUM_1003."</td>
|
||||||
|
<td style='width:15%; text-align:center' class='forumheader'>".LAN_USER."</td>
|
||||||
|
<td style='width:5%; text-align:center' class='forumheader'>".LAN_FORUM_1005."</td>
|
||||||
|
<td style='width:5%; text-align:center' class='forumheader'>".LAN_FORUM_0003."</td>
|
||||||
|
<td style='width:25%; text-align:center' class='forumheader'>".LAN_FORUM_0004."</td>
|
||||||
|
</tr>";
|
||||||
|
|
||||||
|
$NEWFORUMPOSTS_MENU_TEMPLATE['main']['item'] = "<tr>
|
||||||
|
<td style='width:5%; text-align:center' class='forumheader3'>{ICON}</td>
|
||||||
|
<td style='width:45%' class='forumheader3'><a href='{TOPIC_URL}'>{TOPIC_NAME}</a> <small class='smalltext'>(<a href='{FORUM_URL}'>{FORUM_NAME}</a>)</small></td>
|
||||||
|
<td style='width:15%; text-align:center' class='forumheader3'>{POST_AUTHOR_NAME}</td>
|
||||||
|
<td style='width:5%; text-align:center' class='forumheader3'>{TOPIC_VIEWS}</td>
|
||||||
|
<td style='width:5%; text-align:center' class='forumheader3'>{TOPIC_REPLIES}</td>
|
||||||
|
<td style='width:25%; text-align:center' class='forumheader3'>{TOPIC_LASTPOST_AUTHOR}<br /><span class='smalltext'>{TOPIC_LASTPOST_DATE} </span></td>
|
||||||
|
</tr>";
|
||||||
|
|
||||||
|
$NEWFORUMPOSTS_MENU_TEMPLATE['main']['end'] = "<tr>
|
||||||
|
<td colspan='6' style='text-align:center' class='forumheader2'>
|
||||||
|
<span class='smalltext'>".LAN_FORUM_0002.": <b>{TOTAL_TOPICS}</b> | ".LAN_FORUM_0003.": <b>{TOTAL_REPLIES}</b> | ".LAN_FORUM_1005.": <b>{TOTAL_VIEWS}</b></span>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
";
|
Reference in New Issue
Block a user