コード例 #1
0
ファイル: event.php プロジェクト: kevinwojo/hubzero-cms
 /**
  * Event call to get the latest records
  *
  * @param   integer  $num
  * @param   string   $dateField
  * @param   string   $sort
  * @return  array
  */
 public function onGetLatest($num = 5, $dateField = 'created', $sort = 'DESC')
 {
     $model = CalEvent::getLatest($num, $dateField, $sort)->rows()->toObject();
     $objects = array();
     foreach ($model as $m) {
         $object = new stdClass();
         $object->title = $m->title;
         $object->body = htmlspecialchars_decode($m->content);
         $object->date = Date::of($m->publish_up)->toLocal("F j, Y");
         $object->path = 'events/details/' . $m->id;
         $object->id = $m->id;
         array_push($objects, $object);
     }
     return $objects;
 }
コード例 #2
0
ファイル: event.php プロジェクト: kevinwojo/hubzero-cms
 public static function getLatest($limit = 10, $dateField = 'created', $sort = 'DESC')
 {
     $rows = Event::all()->where('scope', '=', 'event')->where('state', '=', '1')->order($dateField, $sort)->limit($limit);
     return $rows;
 }