コード例 #1
0
 public function __toString()
 {
     global $PH;
     $news = $this->project->getTasks(array('is_news' => 1, 'order_by' => 'created DESC'));
     if (!$news) {
         return '';
     }
     #--- news -----------------------------------------------------------
     $this->render_blockStart();
     $count = 0;
     foreach ($news as $n) {
         if ($count++ >= $this->max_news) {
             break;
         }
         echo "<div class='post_list_entry'>";
         if ($creator = Person::getVisibleById($n->created_by)) {
             $link_creator = ' by ' . $creator->getLink();
         } else {
             $link_creator = '';
         }
         echo "<h3>" . asHtml($n->name) . "</h3>";
         echo "<p class= details>";
         echo sprintf(__("%s by %s", "time ago by nickname"), renderTimeAgo($n->created), asHtml($creator->nickname));
         if ($comments = $n->getComments()) {
             echo " / ";
             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 "</p>";
         echo wikifieldAsHtml($n, 'description');
         echo "</div>";
     }
     $this->render_blockEnd();
     return '';
 }
コード例 #2
0
/**
* writes a changeline as html
*
* 
*/
function printChangeLine($c)
{
    global $PH;
    global $auth;
    if ($c->person_by == $auth->cur_user->id) {
        $changed_by_current_user = true;
    } else {
        $changed_by_current_user = false;
    }
    if ($c->item->type == ITEM_TASK) {
        if ($changed_by_current_user) {
            echo '<li class=by_cur_user>';
        } else {
            echo '<li>';
        }
        echo $c->item->getLink(false);
    } elseif ($c->item->type == ITEM_FILE) {
        echo '<li>' . $PH->getLink('fileView', $c->item->name, array('file' => $c->item->id));
    } else {
        trigger_error('printChangeLine() for unknown item item', E_USER_WARNING);
        return;
    }
    /**
     * remarks on new, updated or item that require feedback
     */
    if ($c->item) {
        if ($c->item->isFeedbackRequestedForUser()) {
            echo '<span class=new> (' . __('Needs feedback') . ') </span>';
        } elseif ($new = $c->item->isChangedForUser()) {
            if ($new == 1) {
                echo '<span class=new> (' . __('New') . ') </span>';
            } else {
                echo '<span class=new>  (' . __('Updated') . ') </span>';
            }
        }
    }
    echo "<span class=sub>{$c->txt_what}";
    if ($person = Person::getVisibleById($c->person_by)) {
        echo ' ' . __('by') . ' <span class=person>' . asHtml($person->name) . "</span>";
    }
    echo ' ' . renderTimeAgo($c->timestamp);
    echo "</span>";
    echo '</li>';
    return;
}
コード例 #3
0
 public function __toString()
 {
     global $PH;
     global $auth;
     #--- news -----------------------------------------------------------
     $comments = $this->item_with_comments->getComments(array('order_by' => 'created'));
     $block = new PageBlock(array('title' => sprintf(__("%s Comments"), count($comments) ? count($comments) : __("No", "As in... >No< Comments")), 'id' => 'news'));
     $block->render_blockStart();
     $count = 0;
     foreach ($comments as $c) {
         ### own comment
         $is_comment_editable = $auth->cur_user->user_rights & RIGHT_EDITALL || $c->created_by == $auth->cur_user->id;
         if (!($creator = Person::getVisibleById($c->created_by))) {
             continue;
         }
         echo "<div class='post_list_entry'>";
         echo "<h3>";
         if ($c->created_by == $auth->cur_user->id) {
             echo $creator->nickname;
         } else {
             echo $creator->getLink();
         }
         echo "<span class=separator>:</span>";
         echo asHtml($c->name);
         if ($new = $c->isChangedForUser()) {
             if ($new == 1) {
                 echo '<span class=new> (' . __('New') . ') </span>';
             } else {
                 echo '<span class=new>  (' . __('Updated') . ') </span>';
             }
         }
         echo "</h3>";
         echo "<p class= details>";
         echo renderTimeAgo($c->created);
         require_once confGet('DIR_STREBER') . "db/db_itemchange.inc.php";
         $versions = ItemVersion::getFromItem($c);
         if (count($versions) > 1) {
             echo " (" . $PH->getLink('itemViewDiff', sprintf(__("%s. update", "like in... Nth update"), count($versions)), array('item' => $c->id));
             echo " " . renderTimeAgo($c->modified);
             echo ") ";
         }
         if ($c->pub_level != PUB_LEVEL_OPEN) {
             echo ' - ' . sprintf(__("visible as %s"), renderPubLevelName($c->pub_level));
             ### publish ###
             if (($parent_task = Task::getEditableById($c->task)) && $c->pub_level < PUB_LEVEL_OPEN) {
                 echo " - " . $PH->getLink('itemsSetPubLevel', __('Publish'), array('item' => $c->id, 'item_pub_level' => PUB_LEVEL_OPEN));
             }
         }
         ### delete
         if ($is_comment_editable) {
             echo " - " . $PH->getLink('commentsDelete', __('Delete'), array('comment' => $c->id));
         }
         echo "</p>";
         if ($is_comment_editable) {
             echo wikifieldAsHtml($c, 'description');
         } else {
             echo wikifieldAsHtml($c, 'description', array('editable' => false));
         }
         echo "</div>";
         $c->nowViewedByUser();
     }
     $this->render_blockEnd();
     return '';
 }
コード例 #4
0
 function render_tr(&$pp, $style = "")
 {
     if ($person = $pp->getPerson()) {
         print "<td class='small nobreak'>" . renderTimeAgo($person->last_login) . "</td>";
     }
 }
コード例 #5
0
 function render_tr(&$obj, $style = "")
 {
     global $auth;
     if (!isset($obj) || !is_object($obj)) {
         trigger_error("ListBlockColDate->render_tr() called without valid object", E_USER_WARNING);
         return;
     }
     $key = $this->key;
     $value_str = renderTimeAgo($obj->{$key});
     print "<td class='nowrap'>{$value_str}</td>";
 }