本文整理汇总了PHP中Core_Model_Item_Abstract::membership方法的典型用法代码示例。如果您正苦于以下问题:PHP Core_Model_Item_Abstract::membership方法的具体用法?PHP Core_Model_Item_Abstract::membership怎么用?PHP Core_Model_Item_Abstract::membership使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Core_Model_Item_Abstract
的用法示例。
在下文中一共展示了Core_Model_Item_Abstract::membership方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getActivityAbout
public function getActivityAbout(Core_Model_Item_Abstract $about, User_Model_User $user, array $params = array())
{
// Proc args
extract($this->_getInfo($params));
// action_id, limit, min_id, max_id, actionFilter, filterValue
// Prepare main query
$streamTable = Engine_Api::_()->getDbtable('stream', 'activity');
$streamName = $streamTable->info('name');
$actionTableName = $this->info('name');
$db = $streamTable->getAdapter();
$union = new Zend_Db_Select($db);
// Prepare action types
$masterActionTypes = Engine_Api::_()->getDbtable('actionTypes', 'activity')->getActionTypes();
$subjectActionTypes = array();
$objectActionTypes = array();
// Filter types based on displayable
foreach ($masterActionTypes as $type) {
if ($about->getType() == 'event' && Engine_Api::_()->hasItemType('event') || $about->getType() == 'group' && Engine_Api::_()->hasItemType('group') || $about->getType() == 'ynbusinesspages_business' && Engine_Api::_()->hasItemType('ynbusinesspages_business')) {
if ($actionFilter == 'owner' && isset($type->is_object_thumb) && !$type->is_object_thumb) {
continue;
}
if ($actionFilter == 'membership' && isset($type->is_object_thumb) && $type->is_object_thumb) {
continue;
}
}
if ($type->displayable & 1) {
$subjectActionTypes[] = $type->type;
}
if ($type->displayable & 2) {
$objectActionTypes[] = $type->type;
}
}
// Filter types based on user request
if (isset($showTypes) && is_array($showTypes) && !empty($showTypes)) {
$subjectActionTypes = array_intersect($subjectActionTypes, $showTypes);
$objectActionTypes = array_intersect($objectActionTypes, $showTypes);
} else {
if (isset($hideTypes) && is_array($hideTypes) && !empty($hideTypes)) {
$subjectActionTypes = array_diff($subjectActionTypes, $hideTypes);
$objectActionTypes = array_diff($objectActionTypes, $hideTypes);
}
}
// Nothing to show
if (empty($subjectActionTypes) && empty($objectActionTypes)) {
return null;
}
if (empty($subjectActionTypes)) {
$subjectActionTypes = null;
} else {
if (count($subjectActionTypes) == count($masterActionTypes)) {
$subjectActionTypes = true;
} else {
$subjectActionTypes = "'" . join("', '", $subjectActionTypes) . "'";
}
}
if (empty($objectActionTypes)) {
$objectActionTypes = null;
} else {
if (count($objectActionTypes) == count($masterActionTypes)) {
$objectActionTypes = true;
} else {
$objectActionTypes = "'" . join("', '", $objectActionTypes) . "'";
}
}
// Prepare sub queries
$event = Engine_Hooks_Dispatcher::getInstance()->callEvent('getActivity', array('for' => $user, 'about' => $about));
$responses = (array) $event->getResponses();
if (empty($responses)) {
return null;
}
$friendsFlage = false;
$action_ids = array();
// Filter by hashtag
if ($actionFilter == 'hashtag' && !empty($filterValue)) {
$action_ids = Engine_Api::_()->getDbtable('hashtags', 'ynfeed')->getHashtagFeeds($filterValue, array(), array('limit' => $limit, 'max_id' => $max_id));
if (empty($action_ids)) {
return null;
}
}
// Filter by login as business post
if ($actionFilter == 'business') {
$select = $this->select()->where('`subject_type` = ?', 'ynbusinesspages_business')->where('subject_id', $about->getIdentity())->limit($limit);
if (null !== $max_id) {
$select->where('action_id <= ?', $max_id);
}
$data = $select->query()->fetchAll();
foreach ($data as $row) {
$action_ids[] = $row['action_id'];
}
if (empty($action_ids)) {
return null;
}
}
$member_ids = array();
if ($actionFilter == 'owner') {
if ($about instanceof User_Model_User) {
$member_ids[] = $about->getIdentity();
} elseif ($about instanceof Group_Model_Group || $about instanceof Advgroup_Model_Group) {
$objectParent = $about->getParent('user');
if ($objectParent instanceof User_Model_User) {
//.........这里部分代码省略.........