/** * Populate feed object with activity log entries * * @param Angie_Feed * @param array $activity_log * @return Angie_Feed */ private function populateFeedFromLog(Angie_Feed $feed, $activity_log) { if (is_array($activity_log)) { foreach ($activity_log as $activity_log_entry) { $item = $feed->addItem(new Angie_Feed_Item($activity_log_entry->getText(), undo_htmlspecialchars($activity_log_entry->getObjectUrl()), '', $activity_log_entry->getCreatedOn())); $taken_by = $activity_log_entry->getTakenBy(); if ($taken_by instanceof User) { $item->setAuthor(new Angie_Feed_Author($taken_by->getDisplayName(), $taken_by->getEmail())); } // if } // foreach } // if return $feed; }
/** * Populate feed object with activity log entries * * @param Angie_Feed * @param array $activity_log * @return Angie_Feed */ private function populateFeedFromLog(Angie_Feed $feed, $activity_log) { $this->addHelper('textile'); if (is_array($activity_log)) { foreach ($activity_log as $activity_log_entry) { tpl_assign('object', $activity_log_entry->getObject()); $description = 'no object attached'; if ($activity_log_entry->getObject()) { $object_type = str_replace(" ", "_", strtolower($activity_log_entry->getObject()->getObjectTypeName())); if (file_exists(get_template_path('render_' . $object_type, 'feed'))) { $description = tpl_fetch(get_template_path('render_' . $object_type, 'feed')); } else { $description = tpl_fetch(get_template_path('render_object', 'feed')); } } $item = $feed->addItem(new Angie_Feed_Item($activity_log_entry->getText(), undo_htmlspecialchars($activity_log_entry->getObjectUrl()), $description, $activity_log_entry->getCreatedOn())); $taken_by = $activity_log_entry->getTakenBy(); if ($taken_by instanceof User) { $item->setAuthor(new Angie_Feed_Author($taken_by->getDisplayName(), $taken_by->getEmail())); } // if } // foreach } // if return $feed; }