本文整理汇总了PHP中FeedItem::setId方法的典型用法代码示例。如果您正苦于以下问题:PHP FeedItem::setId方法的具体用法?PHP FeedItem::setId怎么用?PHP FeedItem::setId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FeedItem
的用法示例。
在下文中一共展示了FeedItem::setId方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: rss
/**
* Render recent activities feed
*
* @param void
* @return null
*/
function rss()
{
if ($this->active_project->isNew()) {
$this->httpError(HTTP_ERR_NOT_FOUND);
}
// if
require_once ANGIE_PATH . '/classes/feed/init.php';
$feed = new Feed(lang(':project project', array('project' => $this->active_project->getName())) . ' - ' . lang('Recent activities'), $this->active_project->getOverviewUrl());
$feed->setDescription(lang('Recent ":project" activities', array('project' => $this->active_project->getName())));
$activities = ActivityLogs::findProjectActivitiesByUser($this->active_project, $this->logged_user, 50);
if (is_foreachable($activities)) {
foreach ($activities as $activity) {
$object = $activity->getObject();
$activity_title = $activity_body = $activity->renderHead(null, true);
$activity_title = strip_tags($activity_title);
if ($activity->has_body && ($body = trim($activity->renderBody()))) {
$activity_body .= $body;
}
// if
$item = new FeedItem($activity_title, $object->getViewUrl(), $activity_body, $activity->getCreatedOn());
$item->setId(extend_url($object->getViewUrl(), array('guid' => $activity->getId())));
$feed->addItem($item);
}
// foreach
}
// if
print render_rss_feed($feed);
die;
}
示例2: rss
/**
* Rss for status updates
*
* @param void
* @return void
*/
function rss()
{
require_once ANGIE_PATH . '/classes/feed/init.php';
$archive_url = assemble_url('status_updates');
$selected_user = $this->request->get('user_id');
if ($selected_user) {
if (!in_array($selected_user, $this->logged_user->visibleUserIds())) {
$this->httpError(HTTP_ERR_FORBIDDEN);
}
// if
$user = Users::findById($selected_user);
if (!instance_of($user, 'User')) {
$this->httpError(HTTP_ERR_NOT_FOUND);
}
// if
$archive_url = assemble_url('status_updates', array('user_id' => $user->getId()));
$latest_status_updates = StatusUpdates::findByUser($user, 20);
$feed = new Feed(lang(":display_name's Status Updates", array('display_name' => $user->getDisplayName())), $archive_url);
} else {
$latest_status_updates = StatusUpdates::findVisibleForUser($this->logged_user, 20);
$feed = new Feed(lang('Status Updates'), $archive_url);
}
// if
if (is_foreachable($latest_status_updates)) {
foreach ($latest_status_updates as $status_update) {
$this->smarty->assign(array('status_update' => $status_update));
$item = new FeedItem(str_excerpt($status_update->getMessage(), 50), $status_update->getViewUrl(), $this->smarty->fetch(get_template_path('feed_item', 'status', STATUS_MODULE)), $status_update->getLastUpdateOn());
$item->setId($status_update->getId());
$feed->addItem($item);
}
// foreach
}
// if
print render_rss_feed($feed);
die;
}
示例3: rss
/**
* Render RSS feed for a spcific filter
*
* @param void
* @return null
*/
function rss()
{
if ($this->active_filter->isNew()) {
$this->httpError(HTTP_ERR_NOT_FOUND);
}
// if
if (!$this->active_filter->canUse($this->logged_user)) {
$this->httpError(HTTP_ERR_FORBIDDEN);
}
// if
require_once ANGIE_PATH . '/classes/feed/init.php';
$feed = new Feed($this->owner_company->getName() . ' - ' . $this->active_filter->getName(), $this->active_filter->getUrl());
$assignments = AssignmentFilters::executeFilter($this->logged_user, $this->active_filter, false);
if (is_foreachable($assignments)) {
$project_ids = array();
foreach ($assignments as $assignment) {
if (!in_array($assignment->getProjectId(), $project_ids)) {
$project_ids[] = $assignment->getProjectId();
}
// if
}
// foreach
$projects = array();
if (is_foreachable($project_ids)) {
$rows = db_execute_all('SELECT id, name FROM ' . TABLE_PREFIX . 'projects WHERE id IN (?)', $project_ids);
if (is_foreachable($rows)) {
foreach ($rows as $row) {
$projects[$row['id']] = $row['name'];
}
// foreach
}
// if
}
// if
foreach ($assignments as $assignment) {
$title = '[' . array_var($projects, $assignment->getProjectId()) . '] ' . $assignment->getVerboseType() . ' "' . $assignment->getName() . '"';
$this->smarty->assign('_assignment', $assignment);
$body = $this->smarty->fetch(get_template_path('_feed_body', 'assignment_filters', RESOURCES_MODULE));
$item = new FeedItem($title, $assignment->getViewUrl(), $body, $assignment->getCreatedOn());
$item->setId($assignment->getViewUrl());
$feed->addItem($item);
}
// foreach
}
// if
print render_rss_feed($feed);
die;
}
示例4: rss
/**
* Render recent activities feed
*
* @param void
* @return null
*/
function rss()
{
require_once ANGIE_PATH . '/classes/feed/init.php';
$projects = Projects::findNamesByUser($this->logged_user);
$feed = new Feed($this->owner_company->getName() . ' - ' . lang('Recent activities'), ROOT_URL);
$feed->setDescription(lang('Recent activities in active projects'));
$activities = ActivityLogs::findActiveProjectsActivitiesByUser($this->logged_user, 50);
if (is_foreachable($activities)) {
foreach ($activities as $activity) {
$object = $activity->getObject();
$activity_title = $activity_body = $activity->renderHead();
$activity_title = strip_tags($activity_title);
if ($activity->has_body && ($body = trim($activity->renderBody()))) {
$activity_body .= $body;
}
// if
$item = new FeedItem($activity_title, $object->getViewUrl(), $activity_body, $activity->getCreatedOn());
$item->setId(extend_url($object->getViewUrl(), array('guid' => $activity->getId())));
$feed->addItem($item);
}
// foreach
}
// if
print render_rss_feed($feed);
die;
}