> > Topic

fast implementation of a news block

Jan 3, 2007 / pixtur
Apr 7, 2011 / guest

Attached files

No files uploaded
For the new project page at http://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(
            #echo $str;
            echo "<div class='text'>";
            $count = 0;
            foreach($news as $n) {
                if($count++ >= 3) {
                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>";


also see:



11 years ago (2. update 11 years ago)

I saw this feature at the custom_projectview.inc.php.
But how can I use this custom_projectview?
What's the sense of this view?

Futher I would like to now if everybody should have the new labels like "important", "3d" etc?
Or can everybody have it's own labels in it's local streber?

I ask this because we still have the old labeling like "Enhancement", "Refactor", etc. and cannot set the docu to "important" like you describe above.

pixtur:sorry. Documenation was incomplete...

11 years ago

I added some more details at the text. The purpose for the custom_projectView was the new streber page at http://www.streber-pm.org .

For using customized pages see

The name of the label is not important. It's the 1. position on the list after Undefined.

burger:Thanks for your answer

11 years ago

Your more detailed description helped me to test this new feature. Thanks :-).

But I have one annotation:

All docus are shown at every project view. But it would be great if only the related docus of a project would be displayed at the specific project view.

Can you implement it like this or do you have a reason why all docus are shown at every project view?

pixtur:ups... I missed this...

11 years ago

Hi Burger,

obviously I overlooked your last comment. This would obviously be a bug. Are you talking about the customized proj_view? I only tested this with streber-pm.org are we only have one project here...

cvivanco:Add or remove users window disapeared

11 years ago

After implementing this, there is no way to remove a person from the project, you can still add a member though. It would be nice to activate/deactivate user from projects from the add Team Member window from the project view.

pixtur:it's custom :)

11 years ago

Well, this implementation was meant for www.streber-pm.org only. The team list has been intentially left out, because we do not need the team list on this site.

Of couse it should be displayed when used within a normal environment :)

guest:Fixed bug "show news for current project only"

11 years ago -


I just wanted to let you know that there's a little bug in the code mentioned above! It gets ALL tasks defined as news from db but actually we just want to have the news for the current project.

from pages/custom_projView.inc.php

    #--- news -----------------------------------------------------------
// 20070314 AHE: Fixed bug "show only news for current project"
//        if($news= Task::getAll(array(
        if($news= $project->getTasks(array(
            'category'  => TCATEGORY_DOCU,
            'label'     => 1,
            'order_by'  => 'created DESC',
        ))) {


pixtur:good hint...

11 years ago

Thanks for mentioning.

burger:Another bug

10 years ago

Can someone please change the code line the guest user mentioned at 15 March 2007? It's still the old version in the svn repository.
Furthermore the codeline with label => 1 is wrong. Label 1 stands for Bug and that's not the correct notation for News . Or am I wrong?
Maybe we should initiate a new label called News? What do you think about this?

krisp:Label News

10 years ago

I am in but I'd rather call it Info than News.

burger:Another bug

10 years ago (3. update 10 years ago)

Some parts of the file custom_projectView.inc.php are obsolete. There is, for example, still the old code to show the changes and the description block is missing.

I know that the news block was originally designed for the usage at www.streber-pm.org only, but this block can be useful for "normal" projects, too. Therefore it would be great if the file custom_projectView.inc.php would be in the general identical with the project_view.inc.php file (expect of the news block). Or the news block should be included in the project_view.inc.php with e.g. a customize-option in the customize.inc.php file.
What do you think?

pixtur:I already changed the code here.

10 years ago

So maybe it was more a problem of the old documentation at this Topic.

Yeah, the news feature has been proven to be quiet useful. Using the Label was just a hack at www.streber-pm.org. Note that labels are project specific and different from project to project. So having a new Label-Name is probable not the best idea. Maybe we should add a new Display-Setting for this? But while doing this we could also distinguish between project news and news that are more important and listed in "home". Or is this overdone?

krisp:I think we need more than label...

10 years ago

For example, I need to distinguish tasks from Infos and Discussions the same way as a Docu, Folder or Bug are.

Particularly concerning Discussion, I see it as a Docu like object but seen on tasks list with label Discussion, having people assigned (involved) in it but not being task on their task list (a separate list at home). What do you think?

pixtur:sounds overdone...

10 years ago

Maybe I am not getting your request completely.
  1. You can already assign people to documentation tasks, but I have no idea, what to do with this information. (Maybe use for filters later).
  2. I am looking format for which will be a nice way for involving certain people into a discussion.
  3. Documentation Topics are already separated from tasks.

krisp:Reply to sounds overdone...

10 years ago (2. update 10 years ago)

Ad.1. OK, but in 2 steps: 1) Make task and assign people 2) Make docu. If you want assign one more, you have to bring task back (2 more steps) - Ugh!
Furtermore, I said about steps, not clicks (quite more).

pixtur:So it's just about assignment?

10 years ago

The assignment thing will definitely change into an ajax driven method like in (see screen shot in the comments).