Skip to content

Commit

Permalink
Minor bug correction and update
Browse files Browse the repository at this point in the history
Minor bug correction and update
Still work in progress
  • Loading branch information
rica-carv authored Sep 28, 2024
1 parent 4169976 commit dc102f8
Showing 1 changed file with 22 additions and 30 deletions.
52 changes: 22 additions & 30 deletions e107_plugins/forum/newforumposts_menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@

include_once(e_PLUGIN.'forum/forum_class.php');



if(!class_exists('forum_newforumposts_menu'))
{
class forum_newforumposts_menu // plugin folder + menu name (without the .php)
Expand Down Expand Up @@ -54,7 +52,6 @@ function __construct()

$this->cacheTag .= "_".$this->menuPref['layout'];


if($text = e107::getCache()->retrieve($this->cacheTag, $this->cacheTime, true))
{
e107::getDebug()->log("New Forum Posts Menu Cache Rendered");
Expand All @@ -63,6 +60,7 @@ function __construct()
return null;
}

/*
$sql = e107::getDb();
$this->total['topics'] = $sql->count("forum_thread");
Expand All @@ -73,14 +71,11 @@ function __construct()
$tmp = $sql->fetch();
$this->total['views'] = intval($tmp["sum"]);
}

*/
$this->render();

}




private function getQuery()
{
$max_age = vartrue($this->menuPref['maxage'], 0);
Expand All @@ -95,7 +90,6 @@ private function getQuery()
return false;
}


$this->menuPref['layout'] = vartrue($this->menuPref['layout'], 'default');
switch($this->menuPref['layout'])
{
Expand Down Expand Up @@ -141,11 +135,9 @@ private function getQuery()
ORDER BY t.thread_lastpost DESC LIMIT 0, ".vartrue($this->menuPref['display'],10);
}


return $qry;
}


private function render()
{
$tp = e107::getParser();
Expand Down Expand Up @@ -173,17 +165,13 @@ private function render()

$template = e107::getTemplate('forum','newforumposts_menu',$layout);




$param = array();

foreach($this->menuPref as $k=>$v)
{
$param['nfp_'.$k] = $v;
}


if($qry)
{
if($results = $sql->gen($qry))
Expand All @@ -195,22 +183,34 @@ private function render()

$sc = e107::getScBatch('view', 'forum')->setScVar('param',$param);

$list = $tp->parseTemplate($template['start'], true);
// $list = $tp->parseTemplate($template['start'], true);
$text = $tp->parseTemplate($template['start'], true);

while($row = $sql->fetch())
{
// var_dump ($row);
// echo "<hr>";

$row['thread_sef'] = $this->forumObj->getThreadSef($row);

$sc->setScVar('postInfo', $row);
$sc->setVars($row);
$list .= $tp->parseTemplate($template['item'], true, $sc);
}
// $list .= $tp->parseTemplate($template['item'], true, $sc);
$text .= $tp->parseTemplate($template['item'], true, $sc);

$TOTALS = array('TOTAL_TOPICS'=>$this->total['topics'], 'TOTAL_VIEWS'=>$this->total['views'], 'TOTAL_REPLIES'=>$this->total['replies']);
++$total_topics;
$total_views += $row['thread_views'];
$total_replies += $row['thread_total_replies'];

$list .= $tp->parseTemplate($template['end'], true, $TOTALS);
}

$text = $list;
// $TOTALS = array('TOTAL_TOPICS'=>$this->total['topics'], 'TOTAL_VIEWS'=>$this->total['views'], 'TOTAL_REPLIES'=>$this->total['replies']);
$TOTALS = array('TOTAL_TOPICS'=>$total_topics, 'TOTAL_VIEWS'=>$total_views, 'TOTAL_REPLIES'=>$total_replies);

// $list .= $tp->parseTemplate($template['end'], true, $TOTALS);
$text .= $tp->parseTemplate($template['end'], true, $TOTALS);
//
// $text = $list;
}
else
{
Expand All @@ -221,7 +221,7 @@ private function render()
{
$text = LAN_FORUM_MENU_016;
}

//var_dump ($text);
$caption = $this->getCaption();

if(!empty($this->menuPref['scroll']))
Expand All @@ -230,7 +230,6 @@ private function render()
}
// e107::debug('menuPref', $this->menuPref);


e107::getCache()->set($this->cacheTag, $text, true);

$ns->tablerender($caption, $text, 'nfp_menu');
Expand Down Expand Up @@ -261,7 +260,6 @@ private function getCaption()
//$caption = !empty($this->menuPref['caption'][e_LANGUAGE]) ? $this->menuPref['caption'][e_LANGUAGE] : $this->menuPref['caption'];
}


if (empty($caption))
{
$caption = LAN_PLUGIN_FORUM_LATESTPOSTS;
Expand All @@ -270,14 +268,8 @@ private function getCaption()
return $caption;
}


}


}


new forum_newforumposts_menu;



new forum_newforumposts_menu;

0 comments on commit dc102f8

Please sign in to comment.