For the new project page at
www.streber-pm.org pixtur wrote a new version of the projView
Page. Changes:
- Newslist
- no Folders
- no Teamlist
Listing News is actually very easy. News are "Documation Pages" with label Number 1 ("important" in this case). This is the complete code for rendering the news block:
from pages/custom_projView.inc.php
#--- news -----------------------------------------------------------
{
if($news= Task::getAll(array(
'category' => TCATEGORY_DOCU,
'label' => 1,
'order_by' => 'created DESC',
))) {
$block=new PageBlock(array(
'title'=>__('News'),
'id'=>'news',
#'reduced_header'=>true,
));
$block->render_blockStart();
#echo $str;
echo "<div class='text'>";
$count = 0;
foreach($news as $n) {
if($count++ >= 3) {
break;
};
echo "<div class='newsBlock'>";
if($creator= Person::getVisibleById($n->created_by)) {
$link_creator= ' by '. $creator->getLink();
}
echo "<div class=newsTitle><h3>".$PH->getLink('taskView', $n->name , array('tsk' => $n->id)) ."</h3><span class=author>". renderDateHtml($n->created) . $link_creator . "</span></div>";
echo wiki2html($n->description, $project);
echo "<span class=comments>";
if($comments= $n->getComments()) {
echo $PH->getLink('taskViewAsDocu', sprintf(__("%s comments"),count($comments)), array('tsk'=> $n->id));
}
echo " | ";
echo $PH->getLink("commentNew", __("Add comment"), array('parent_task' => $n->id) );
echo "</span>";
echo "</div>";
}
echo "</div>";
$block->render_blockEnd();
}
}
also see: