| 
									
										
										
										
											2011-02-07 09:46:26 -05:00
										 |  |  | <?php | 
					
						
							|  |  |  | /** | 
					
						
							|  |  |  |  * StatusNet - the distributed open-source microblogging tool | 
					
						
							| 
									
										
										
										
											2011-02-07 12:28:58 -05:00
										 |  |  |  * Copyright (C) 2011, StatusNet, Inc. | 
					
						
							| 
									
										
										
										
											2011-02-07 09:46:26 -05:00
										 |  |  |  * | 
					
						
							|  |  |  |  * Widget for showing an individual group message | 
					
						
							| 
									
										
										
										
											2011-04-08 18:46:41 +02:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2011-02-07 09:46:26 -05:00
										 |  |  |  * PHP version 5 | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * This program is free software: you can redistribute it and/or modify | 
					
						
							|  |  |  |  * it under the terms of the GNU Affero General Public License as published by | 
					
						
							|  |  |  |  * the Free Software Foundation, either version 3 of the License, or | 
					
						
							|  |  |  |  * (at your option) any later version. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * This program is distributed in the hope that it will be useful, | 
					
						
							|  |  |  |  * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
					
						
							|  |  |  |  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
					
						
							|  |  |  |  * GNU Affero General Public License for more details. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * You should have received a copy of the GNU Affero General Public License | 
					
						
							|  |  |  |  * along with this program.  If not, see <http://www.gnu.org/licenses/>. | 
					
						
							|  |  |  |  * | 
					
						
							| 
									
										
										
										
											2011-02-07 12:28:58 -05:00
										 |  |  |  * @category  GroupPrivateMessage | 
					
						
							| 
									
										
										
										
											2011-02-07 09:46:26 -05:00
										 |  |  |  * @package   StatusNet | 
					
						
							|  |  |  |  * @author    Evan Prodromou <evan@status.net> | 
					
						
							| 
									
										
										
										
											2011-02-07 12:28:58 -05:00
										 |  |  |  * @copyright 2011 StatusNet, Inc. | 
					
						
							| 
									
										
										
										
											2011-02-07 09:46:26 -05:00
										 |  |  |  * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0 | 
					
						
							|  |  |  |  * @link      http://status.net/ | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | if (!defined('STATUSNET')) { | 
					
						
							|  |  |  |     // This check helps protect against security problems;
 | 
					
						
							|  |  |  |     // your code file can't be executed directly from the web.
 | 
					
						
							|  |  |  |     exit(1); | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /** | 
					
						
							|  |  |  |  * Widget for showing a single group message | 
					
						
							|  |  |  |  * | 
					
						
							| 
									
										
										
										
											2011-02-07 12:28:58 -05:00
										 |  |  |  * @category  GroupPrivateMessage | 
					
						
							| 
									
										
										
										
											2011-02-07 09:46:26 -05:00
										 |  |  |  * @package   StatusNet | 
					
						
							|  |  |  |  * @author    Evan Prodromou <evan@status.net> | 
					
						
							| 
									
										
										
										
											2011-02-07 12:28:58 -05:00
										 |  |  |  * @copyright 2011 StatusNet, Inc. | 
					
						
							| 
									
										
										
										
											2011-02-07 09:46:26 -05:00
										 |  |  |  * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0 | 
					
						
							|  |  |  |  * @link      http://status.net/ | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | class GroupMessageListItem extends Widget | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |     var $gm; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Constructor | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @param HTMLOutputter $out output context | 
					
						
							|  |  |  |      * @param Group_message $gm  Group message | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     function __construct($out, $gm) | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         parent::__construct($out); | 
					
						
							|  |  |  |         $this->gm = $gm; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     /** | 
					
						
							|  |  |  |      * Show the item | 
					
						
							|  |  |  |      * | 
					
						
							|  |  |  |      * @return void | 
					
						
							|  |  |  |      */ | 
					
						
							|  |  |  |     function show() | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         $group  = $this->gm->getGroup(); | 
					
						
							|  |  |  |         $sender = $this->gm->getSender(); | 
					
						
							| 
									
										
										
										
											2011-04-08 18:46:41 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-02-07 09:46:26 -05:00
										 |  |  |         $this->out->elementStart('li', array('class' => 'hentry notice message group-message', | 
					
						
							|  |  |  |                                          'id' => 'message-' . $this->gm->id)); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         $this->out->elementStart('div', 'entry-title'); | 
					
						
							|  |  |  |         $this->out->elementStart('span', 'vcard author'); | 
					
						
							| 
									
										
										
										
											2011-04-08 18:46:41 +02:00
										 |  |  |         $this->out->elementStart('a', | 
					
						
							| 
									
										
										
										
											2011-02-07 09:46:26 -05:00
										 |  |  |                                  array('href' => $sender->profileurl, | 
					
						
							|  |  |  |                                        'class' => 'url')); | 
					
						
							| 
									
										
										
										
											2013-10-01 11:37:59 +02:00
										 |  |  |         $avatarUrl = $sender->avatarUrl(AVATAR_STREAM_SIZE); | 
					
						
							|  |  |  |         $this->out->element('img', array('src' => $avatarUrl, | 
					
						
							| 
									
										
										
										
											2011-02-07 09:46:26 -05:00
										 |  |  |                                     'width' => AVATAR_STREAM_SIZE, | 
					
						
							|  |  |  |                                     'height' => AVATAR_STREAM_SIZE, | 
					
						
							|  |  |  |                                     'class' => 'photo avatar', | 
					
						
							|  |  |  |                                     'alt' => $sender->getBestName())); | 
					
						
							|  |  |  |         $this->out->element('span', | 
					
						
							|  |  |  |                             array('class' => 'nickname fn'), | 
					
						
							|  |  |  |                             $sender->nickname); | 
					
						
							|  |  |  |         $this->out->elementEnd('a'); | 
					
						
							|  |  |  |         $this->out->elementEnd('span'); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         $this->out->elementStart('p', array('class' => 'entry-content message-content')); | 
					
						
							|  |  |  |         $this->out->raw($this->gm->rendered); | 
					
						
							|  |  |  |         $this->out->elementEnd('p'); | 
					
						
							|  |  |  |         $this->out->elementEnd('div'); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         $this->out->elementStart('div', 'entry-content'); | 
					
						
							|  |  |  |         $this->out->elementStart('a', array('rel' => 'bookmark', | 
					
						
							|  |  |  |                                             'class' => 'timestamp', | 
					
						
							|  |  |  |                                             'href' => $this->gm->url)); | 
					
						
							| 
									
										
										
										
											2014-04-28 17:45:21 +02:00
										 |  |  |         $this->out->element('time', array('class' => 'dt-published', | 
					
						
							|  |  |  |                                           'datetime' => common_date_iso8601($this->gm->created), | 
					
						
							|  |  |  |                                           // TRANS: Timestamp title (tooltip text) for NoticeListItem
 | 
					
						
							|  |  |  |                                           'title' => common_exact_date($this->gm->created)), | 
					
						
							| 
									
										
										
										
											2011-02-07 09:46:26 -05:00
										 |  |  |                             common_date_string($this->gm->created)); | 
					
						
							|  |  |  |         $this->out->elementEnd('a'); | 
					
						
							|  |  |  |         $this->out->elementEnd('div'); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         $this->out->elementEnd('li'); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | } |