Beispiel #1
0
 /**
  * @param BlogPost[] $postList
  * @return mixed[]
  */
 private function getBlogPosts(array $postList)
 {
     $blogPosts = array();
     foreach ($postList as $id => $bpost) {
         $srcUser = UserCache::getInstance()->getUser($bpost->src_user_id);
         $item = array();
         // TODO
         $item['category'] = Config::getVariableValueFromKey(Config::id_blogCategories, $bpost->category);
         $item['severity'] = BlogPost::getSeverityName($bpost->severity);
         $item['summary'] = $bpost->summary;
         $item['content'] = $bpost->content;
         $item['date_submitted'] = date('Y-m-d G:i', $bpost->date_submitted);
         $item['from'] = $srcUser->getRealname();
         // find receiver
         if (0 != $bpost->dest_user_id) {
             $destUser = UserCache::getInstance()->getUser($bpost->dest_user_id);
             $item['to'] = $destUser->getRealname();
         } else {
             if (0 != $bpost->dest_team_id) {
                 $team = TeamCache::getInstance()->getTeam($bpost->dest_team_id);
                 $item['to'] = $team->getName();
             } else {
                 if (0 != $bpost->dest_project_id) {
                     $destProj = ProjectCache::getInstance()->getProject($bpost->dest_project_id);
                     $item['to'] = $destProj->getName();
                 } else {
                     $item['to'] = '?';
                 }
             }
         }
         $item['activity'] = 'activities...';
         $item['buttons'] = "<input type='button' value='" . T_('Ack') . "' onclick='javascript: ackPost(" . $bpost->id . ")' />";
         $item['buttons'] .= "<input type='button' value='" . T_('Hide') . "' onclick='javascript: hidePost(" . $bpost->id . ")' />";
         // TODO only if i'm the owner
         $item['buttons'] .= "<input type='button' value='" . T_('Delete') . "' onclick='javascript: deletePost(" . $bpost->id . ")' />";
         $item['isHidden'] = '0';
         $blogPosts[$id] = $item;
     }
     return $blogPosts;
 }
Beispiel #2
0
 /**
  * available severity values
  * @return string[] (id => name)
  */
 public function getSeverityList()
 {
     if (NULL == $this->severityList) {
         $this->severityList = array();
         for ($i = 0; $i < 10; $i++) {
             $sevName = BlogPost::getSeverityName($i);
             if (NULL != $sevName) {
                 $this->severityList[$i] = $sevName;
             }
         }
     }
     return $this->severityList;
 }