コード例 #1
0
 /**
  * Given a person, this returns formatted information about the activities of the person
  * @param PersonEntity $person
  * @return array
  */
 public static function getFormattedActivitiesOfPerson($person)
 {
     /** @var PersonEntity $person */
     $activities = $person->getActivities();
     $ret = [];
     foreach ($activities as $activity) {
         if (!$activity->isHidden()) {
             $ret[] = Activity::getFormattedShortData($activity);
         }
     }
     return $ret;
 }
コード例 #2
0
 /**
  * @param ActivityEntity[] $activities
  * @param $page
  * @return mixed
  */
 public static function getFormattedActivities($activities, $page)
 {
     $response['error'] = null;
     $response['count'] = count($activities);
     for ($i = 10 * ($page - 1); $i < min($response['count'], $page * 10); $i++) {
         $activity = $activities[$i];
         $response['activities'][] = Activity::getFormattedShortData($activity);
     }
     return $response;
 }