本文整理汇总了PHP中Activity::setStreamTitle方法的典型用法代码示例。如果您正苦于以下问题:PHP Activity::setStreamTitle方法的具体用法?PHP Activity::setStreamTitle怎么用?PHP Activity::setStreamTitle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Activity
的用法示例。
在下文中一共展示了Activity::setStreamTitle方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getActivities
public function getActivities($ids)
{
$activities = array();
foreach ($ids as $key => $val) {
$ids[$key] = mysql_real_escape_string($val, $this->db);
}
$res = mysql_query("\r\n\t\t\tselect \r\n\t\t\t\tactivities.user_id as user_id,\r\n\t\t\t\tactivities.id as activity_id,\r\n\t\t\t\tactivities.title as activity_title,\r\n\t\t\t\tactivities.body as activity_body,\r\n\t\t\t\tactivities.created as created\r\n\t\t\tfrom \r\n\t\t\t\tactivities\r\n\t\t\twhere\r\n\t\t\t\tactivities.user_id in (" . implode(',', $ids) . ")\r\n\t\t\torder by \r\n\t\t\t\tcreated desc\r\n\t\t\t");
while ($row = @mysql_fetch_assoc($res)) {
$activity = new Activity($row['activity_id'], $row['user_id']);
$activity->setStreamTitle('activities');
$activity->setTitle($row['activity_title']);
$activity->setBody($row['activity_body']);
$activity->setPostedTime($row['created']);
$activity->setMediaItems($this->getMediaItems($row['activity_id']));
$activities[] = $activity;
}
return $activities;
}
示例2: createActivities
private function createActivities($streamItem, $userId, $streamTitle)
{
foreach ($streamItem->activity as $activityItem) {
$title = isset($activityItem['title']) ? (string) $activityItem['title'] : '';
$id = isset($activityItem['id']) ? (string) $activityItem['id'] : 0;
$body = isset($activityItem['body']) ? (string) $activityItem['body'] : '';
$activity = new Activity($id, $userId);
$activity->setStreamTitle($this->turnEvil($streamTitle));
$activity->setTitle($this->turnEvil($title));
$activity->setBody($this->turnEvil($body));
$activity->setMediaItems($this->getMediaItems($activityItem));
$this->createActivity($userId, $activity, 0);
}
}
示例3: testGetStreamTitle
/**
* Tests Activity->getStreamTitle()
*/
public function testGetStreamTitle()
{
$title = 'Foo Activity';
$this->Activity->setStreamTitle($title);
$this->assertEquals($title, $this->Activity->getStreamTitle());
}
示例4: getActivities
/**
* To get Activities of the User(s)
*
* @param
* $ids userids - for all activites needs to be fetched
* @param
* $app_id application to which Activity belongs to
* @param
* $sortBy to sort result sets by
* @param
* $filterBy to filter activity results
* @param
* $startIndex start index for pagination of results
* @param
* $count number of results on the page
* @param
* $fields activity fields in the results
* @return
* $activities array of activity objects
*/
public function getActivities($ids, $appId, $sortBy, $filterBy, $startIndex, $count, $fields)
{
$activities = array();
foreach ($ids as $key => $val) {
$ids[$key] = $val;
}
if (!is_array($ids) || count($ids) < 1) {
return $activities;
}
$res = db_query("\n\t\t\tSELECT \n\t\t\t\tactivities.user_id as user_id,\n\t\t\t\tactivities.id as activity_id,\n\t\t\t\tactivities.title as activity_title,\n\t\t\t\tactivities.body as activity_body,\n\t\t\t\tactivities.created as created\n\t\t\tFROM \n\t\t\t\t{activities}\n\t\t\tWHERE\n\t\t\t\tactivities.user_id IN (" . implode(',', $ids) . ")\n\t\t\tORDER BY \n\t\t\t\tcreated DESC\n\t\t\t");
while ($row = db_fetch_array($res)) {
$activity = new Activity($row['activity_id'], $row['user_id']);
$activity->setStreamTitle('activities');
$activity->setTitle($row['activity_title']);
$activity->setBody($row['activity_body']);
$activity->setPostedTime($row['created']);
$activity->setMediaItems($this->getMediaItems($row['activity_id']));
$activities[] = $activity;
}
//Invoke hook_activities_alter() implementations
$this->drupalAlter('activities', $activities, $appId);
return $activities;
}
示例5: getActivities
public function getActivities($ids, $appId, $sortBy, $filterBy, $filterOp, $filterValue, $startIndex, $count, $fields, $activityIds)
{
//TODO add support for filterBy, filterOp and filterValue
$this->checkDb();
$activities = array();
$ids = array_map('intval', $ids);
$ids = implode(',', $ids);
if (isset($activityIds) && is_array($activityIds)) {
$activityIds = array_map('intval', $activityIds);
$activityIdQuery = " and activities.id in (" . implode(',', $activityIds);
} else {
$activityIdQuery = '';
}
$appIdQuery = $appId ? " and activities.app_id = " . intval($appId) : '';
// return a proper totalResults count
$res = mysqli_query($this->db, "select count(id) from activities where activities.person_id in ({$ids}) {$activityIdQuery} {$appIdQuery}");
if ($res !== false) {
list($totalResults) = mysqli_fetch_row($res);
} else {
$totalResults = '0';
}
$startIndex = !is_null($startIndex) && $startIndex !== false && is_numeric($startIndex) ? intval($startIndex) : '0';
$count = !is_null($count) && $count !== false && is_numeric($count) ? intval($count) : '20';
$activities['totalResults'] = $totalResults;
$activities['startIndex'] = $startIndex;
$activities['count'] = $count;
$query = "\n select\n activities.person_id as person_id,\n activities.id as activity_id,\n activities.title as activity_title,\n activities.body as activity_body,\n activities.created as created\n from\n activities\n where\n activities.person_id in ({$ids})\n {$activityIdQuery}\n {$appIdQuery}\n order by\n created desc\n limit\n {$startIndex}, {$count}\n ";
$res = mysqli_query($this->db, $query);
if ($res) {
if (@mysqli_num_rows($res)) {
while ($row = @mysqli_fetch_array($res, MYSQLI_ASSOC)) {
$activity = new Activity($row['activity_id'], $row['person_id']);
$activity->setStreamTitle('activities');
$activity->setTitle($row['activity_title']);
$activity->setBody($row['activity_body']);
$activity->setPostedTime($row['created']);
$activity->setMediaItems($this->getMediaItemsByActivityId($row['activity_id']));
$activities[] = $activity;
}
} elseif (isset($activityIds) && is_array($activityIds)) {
// specific activity id was specified, return a not found flag
return false;
}
return $activities;
} else {
return false;
}
}
示例6: getActivities
public function getActivities($ids, $appId, $sortBy, $filterBy, $filterOp, $filterValue, $startIndex, $count, $fields, $activityIds)
{
// public function getActivities($ids, $appId, $sortBy, $filterBy, $filterOp, $filterValue, $startIndex, $count, $fields) {
//TODO add support for filterBy, filterOp and filterValue
$this->checkDb();
$activities = array();
foreach ($ids as $key => $val) {
$ids[$key] = mysql_real_escape_string($val);
}
$ids = implode(',', $ids);
if (isset($activityIds) && is_array($activityIds)) {
foreach ($activityIds as $key => $val) {
$activityIds[$key] = mysql_real_escape_string($val);
}
$activityIdQuery = " AND id IN (" . implode(',', $activityIds);
} else {
$activityIdQuery = '';
}
// return a proper totalResults count
$sql = "SELECT count(id) FROM " . TABLE_PREFIX . "social_activities WHERE member_id in ({$ids}) {$activityIdQuery}";
$res = mysql_query($sql, $this->db);
if ($res !== false) {
list($totalResults) = mysql_fetch_row($res);
} else {
$totalResults = '0';
}
$startIndex = !is_null($startIndex) && $startIndex !== false && is_numeric($startIndex) ? intval($startIndex) : '0';
$count = !is_null($count) && $count !== false && is_numeric($count) ? intval($count) : '20';
$activities['totalResults'] = $totalResults;
$activities['startIndex'] = $startIndex;
$activities['count'] = $count;
$query = "SELECT member_id, id, title, created_date FROM " . TABLE_PREFIX . "social_activities WHERE member_id in ({$ids}) {$activityIdQuery} order by created_date desc limit {$startIndex}, {$count}";
$res = mysql_query($query, $this->db);
if ($res) {
if (mysql_num_rows($res)) {
while ($row = mysql_fetch_assoc($res)) {
$activity = new Activity($row['id'], $row['member_id']);
$activity->setStreamTitle('activities');
$activity->setTitle($row['title']);
// $activity->setBody($row['activity_body']);
$activity->setPostedTime($row['created_date']);
$activity->setMediaItems($this->getMediaItems($row['id']));
$activities[] = $activity;
}
} elseif (isset($activityIds) && is_array($activityIds)) {
// specific activity id was specified, return a not found flag
return false;
}
return $activities;
} else {
return false;
}
}