99// No direct access to this file
1010defined ('_JEXEC ' ) or die;
1111
12+ use Joomla \CMS \Factory ;
13+ use Joomla \CMS \Language \Text ;
14+ use Joomla \CMS \MVC \Model \ListModel ;
15+ use Joomla \CMS \HTML \HTMLHelper ;
16+ use Joomla \CMS \Uri \Uri ;
17+
1218/**
1319 * ActivityStreamList Model
1420 *
1521 * @since 0.0.1
1622 */
17- class ActivityStreamModelActivities extends JModelList
23+ class ActivityStreamModelActivities extends ListModel
1824{
1925 protected $ activityStreamActivitiesHelper ;
2026
@@ -58,7 +64,7 @@ public function __construct($config = array())
5864 protected function getListQuery ()
5965 {
6066 // Initialize variables.
61- $ db = JFactory ::getDbo ();
67+ $ db = Factory ::getDbo ();
6268 $ query = $ db ->getQuery (true );
6369
6470 // Create the base select statement.
@@ -82,10 +88,10 @@ protected function getListQuery()
8288 $ query ->where ('state = ' . (int ) $ published );
8389 }
8490
85- $ type = $ this ->getState ('type ' );
86- $ from_date = $ this ->getState ('from_date ' );
87- $ limit = $ this ->getState ('list.limit ' );
88- $ start = $ this ->getState ('list.start ' );
91+ $ type = $ this ->getState ('type ' );
92+ $ from_date = $ this ->getState ('from_date ' );
93+ $ limit = $ this ->getState ('list.limit ' );
94+ $ start = $ this ->getState ('list.start ' );
8995 $ filter_condition = $ this ->getState ('filter_condition ' );
9096
9197 $ result_arr = array ();
@@ -125,7 +131,7 @@ protected function getListQuery()
125131
126132 if (!empty ($ filterValue ) && $ filter != 'type ' )
127133 {
128- $ filterValue = $ this ->activityStreamActivitiesHelper ->buildActivityFilterQuery ($ filterValue );
134+ $ filterValue = $ this ->activityStreamActivitiesHelper ->buildActivityFilterQuery ($ filterValue );
129135 $ conditionFilters = array ('target_id ' , 'object_id ' , 'actor_id ' );
130136
131137 if (!in_array ($ filter , $ conditionFilters ))
@@ -159,7 +165,7 @@ protected function getListQuery()
159165 }
160166
161167 // Add the list ordering clause.
162- $ orderCol = $ this ->state ->get ('list.ordering ' , 'created_date ' );
168+ $ orderCol = $ this ->state ->get ('list.ordering ' , 'created_date ' );
163169 $ orderDirn = $ this ->state ->get ('list.direction ' , 'desc ' );
164170
165171 $ query ->order ($ db ->escape ($ orderCol ) . ' ' . $ db ->escape ($ orderDirn ));
@@ -177,21 +183,20 @@ protected function getListQuery()
177183 public function getItems ()
178184 {
179185 $ items = parent ::getItems ();
180-
181186 $ activities = array ();
182187
183188 if (!empty ($ items ))
184189 {
185190 foreach ($ items as $ k => $ item )
186191 {
187192 // Get date in local time zone
188- $ item ->created_date = JHtml ::date ($ item ->created_date , 'Y-m-d h:i:s ' );
189- $ item ->updated_date = JHtml ::date ($ item ->updated_date , 'Y-m-d h:i:s ' );
190- $ item ->root = JUri ::root ();
193+ $ item ->created_date = HTMLHelper ::date ($ item ->created_date , 'Y-m-d h:i:s ' );
194+ $ item ->updated_date = HTMLHelper ::date ($ item ->updated_date , 'Y-m-d h:i:s ' );
195+ $ item ->root = Uri ::root ();
191196
192197 // Get extra date info
193- $ items [$ k ]->created_day = date_format ( date_create ( $ item ->created_date ), " D " );
194- $ items [$ k ]->created_date_month = date_format ( date_create ( $ item ->created_date ), " d, M " );
198+ $ items [$ k ]->created_day = Factory:: getDate ( $ item ->created_date )-> Format (Text:: _ ( ' COM_ACTIVITYSTREAM_CREATED_DAY ' ), false , true );
199+ $ items [$ k ]->created_date_month = Factory:: getDate ( $ item ->created_date )-> Format (Text:: _ ( ' COM_ACTIVITYSTREAM_CREATED_DATE_MONTH ' ), false , true );
195200
196201 // Convert item data into array
197202 $ itemArray = (array ) $ item ;
0 commit comments