class MembersActivity in Heartbeat 7
Same name and namespace in other branches
- 6.4 modules/og_activity/membersactivity.inc \MembersActivity
Concrete class MembersActivity Defines a stream displaying all activity from members in a group.
Hierarchy
- class \HeartbeatStream
- class \MembersActivity
Expanded class hierarchy of MembersActivity
File
- modules/
heartbeat_og/ streams/ membersactivity.inc, line 12 - Defines a stream for Member Activity.
View source
class MembersActivity extends HeartbeatStream {
protected $nid = 0;
protected $og_context = NULL;
protected $group = NULL;
public function construct() {
$this
->detectGroup();
}
/**
* detectGroup
*
* Detects the group for a given node ID.
*/
private function detectGroup() {
// First check the contextual arguments that could have been sent along
// with ajax posts to get the context of the current node.
if (!empty($_GET['contextualArguments']) && isset($_GET['contextualArguments']['og_etid'])) {
$this
->setGroup($_GET['contextualArguments']['og_etid']);
}
elseif ($og_context = og_context()) {
$this->og_context = $og_context;
if (isset($og_context->etid)) {
$this
->setGroup($og_context->etid);
}
}
}
/**
* modifyActivityMessage().
*/
public function modifyActivityMessage(HeartbeatActivity $heartbeatActivity) {
// Add the content node context.
$heartbeatActivity->nid = $this->nid;
$heartbeatActivity->in_group = 1;
}
/**
* setGroup
*
* Sets the group for a given node ID.
* @param Integer $nid
* The group node ID.
*/
private function setGroup($nid) {
$this->nid = $nid;
$this->group = node_load($this->nid);
}
/**
* hasAccess
*
* @param $text
* @return boolean to indicate the access to the stream
*/
public function hasAccess() {
return $this->nid > 0 ? TRUE : FALSE;
}
/**
* Implementation of queryAlter().
*/
protected function queryAlter() {
if (empty($this->og_context->gid)) {
$this->nid = 0;
return;
}
$members = array();
$result = db_query("SELECT u.uid FROM {users} u LEFT JOIN {og_membership} om ON u.uid = om.etid AND om.entity_type = 'user' " . "WHERE om.gid = :gid AND u.status <> '0' AND om.state = '1' ", array(
':gid' => $this->og_context->gid,
));
foreach ($result as $row) {
$members[$row->uid] = $row->uid;
}
//$this->query->condition('ha.in_group', 0, '<>');
if (!empty($members)) {
$this->query
->condition('ha.uid', $members, 'IN');
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
HeartbeatStream:: |
protected | property | ||
HeartbeatStream:: |
protected | property | ||
HeartbeatStream:: |
public | property | ||
HeartbeatStream:: |
public | property | ||
HeartbeatStream:: |
protected | property | ||
HeartbeatStream:: |
protected | property | ||
HeartbeatStream:: |
protected | property | ||
HeartbeatStream:: |
public | property | ||
HeartbeatStream:: |
protected | property | ||
HeartbeatStream:: |
protected | property | ||
HeartbeatStream:: |
protected | property | ||
HeartbeatStream:: |
public | property | ||
HeartbeatStream:: |
protected | property | ||
HeartbeatStream:: |
public | property | ||
HeartbeatStream:: |
public | property | ||
HeartbeatStream:: |
protected | property | ||
HeartbeatStream:: |
protected | property | ||
HeartbeatStream:: |
protected | property | ||
HeartbeatStream:: |
protected | property | ||
HeartbeatStream:: |
protected | property | ||
HeartbeatStream:: |
protected | property | ||
HeartbeatStream:: |
protected | property | ||
HeartbeatStream:: |
protected | property | ||
HeartbeatStream:: |
protected | property | ||
HeartbeatStream:: |
protected | property | ||
HeartbeatStream:: |
protected | property | ||
HeartbeatStream:: |
public | function | addError | |
HeartbeatStream:: |
public | function | canPostActivityStatuses(). TODO Remove this here. The stream plugins should be stored in the stream object. This kind of access will become much easier to implement. | |
HeartbeatStream:: |
protected | function | Function to check access on messages This behaviour is set by a heartbeat message configuration to overrule the chosen display access type | |
HeartbeatStream:: |
protected | function | createQuery(). | 1 |
HeartbeatStream:: |
public | function | excludeOg(). | |
HeartbeatStream:: |
public | function | Function that reorganizes a query result of messages into a stream of heartbeat activity objects. | |
HeartbeatStream:: |
protected | function | executeQuery | |
HeartbeatStream:: |
public | function | executeViews(). | |
HeartbeatStream:: |
public | function | getAjax(). | |
HeartbeatStream:: |
public | function | getConfig(). | |
HeartbeatStream:: |
public | function | getCurrentLanguages(). | |
HeartbeatStream:: |
public | function | ||
HeartbeatStream:: |
public | function | getLatestActivityId() | |
HeartbeatStream:: |
public | function | Get the messages. | |
HeartbeatStream:: |
final public | function | getOffsetTime | |
HeartbeatStream:: |
final public | function | getTemplate(). | |
HeartbeatStream:: |
public | function | getViewed(). | |
HeartbeatStream:: |
public | function | getViewedId(). | |
HeartbeatStream:: |
public | function | getViewer(). | |
HeartbeatStream:: |
public | function | hasErrors | |
HeartbeatStream:: |
public | function | Function to check if more/older messages can be loaded | |
HeartbeatStream:: |
public | function | isAjax(). | |
HeartbeatStream:: |
public | function | isPage(). | |
HeartbeatStream:: |
public | function | needsModal(). Returns a boolean to indicate whether modal window is needed on the page. | |
HeartbeatStream:: |
public | function | numberOfMessages(). | |
HeartbeatStream:: |
public | function | Create the well-formed activity messages from a result. HeartbeatParser will do most of the work here. | |
HeartbeatStream:: |
public | function | Render(). | |
HeartbeatStream:: |
public | function | result Prepares a query, makes it available to alter it and finally executes it. | |
HeartbeatStream:: |
public | function | setAjax(). | |
HeartbeatStream:: |
protected | function | setAvailableTemplates() | |
HeartbeatStream:: |
public | function | setConfig(). | |
HeartbeatStream:: |
protected | function | setContextualArguments(). | |
HeartbeatStream:: |
protected | function | setError Alias for addError. | |
HeartbeatStream:: |
public | function | setIsPage(). | |
HeartbeatStream:: |
public | function | Set the maximum number of items to fetch. | |
HeartbeatStream:: |
public | function | setLanguage(). | |
HeartbeatStream:: |
public | function | setLatestActivityId(). | |
HeartbeatStream:: |
final public | function | setOffsetTime | |
HeartbeatStream:: |
public | function | setViewed(). | |
HeartbeatStream:: |
public | function | setViewer(). | |
HeartbeatStream:: |
public | function | setViewMode(). | |
HeartbeatStream:: |
public | function | skipActiveUser(). | |
HeartbeatStream:: |
constant | |||
HeartbeatStream:: |
constant | |||
HeartbeatStream:: |
public | function | viewsQueryAlter | 5 |
HeartbeatStream:: |
final public | function | Constructor | |
MembersActivity:: |
protected | property | ||
MembersActivity:: |
protected | property | ||
MembersActivity:: |
protected | property | ||
MembersActivity:: |
public | function |
Fake constructor to hook this method instead of the constructor. Overrides HeartbeatStream:: |
|
MembersActivity:: |
private | function | detectGroup | |
MembersActivity:: |
public | function |
hasAccess Overrides HeartbeatStream:: |
|
MembersActivity:: |
public | function |
modifyActivityMessage(). Overrides HeartbeatStream:: |
|
MembersActivity:: |
protected | function |
Implementation of queryAlter(). Overrides HeartbeatStream:: |
|
MembersActivity:: |
private | function | setGroup |