class MembersActivity in Heartbeat 6.4
Same name and namespace in other branches
- 7 modules/heartbeat_og/streams/membersactivity.inc \MembersActivity
Class MembersActivity Concrete class to prepare messages for the current user and all of his/her relations.
Hierarchy
- class \HeartbeatAccess
- class \MembersActivity
Expanded class hierarchy of MembersActivity
1 string reference to 'MembersActivity'
- og_activity_heartbeat_register_access_types in modules/
og_activity/ og_activity.module - Implementation of hook_heartbeat_register_access_types()
File
- modules/
og_activity/ membersactivity.inc, line 18
View source
class MembersActivity extends HeartbeatAccess {
protected $_gid = 0;
protected $_group_access = FALSE;
protected $group = NULL;
public function construct() {
// Where the user id is a member of the group
// and where the nid target is the group nid
$this
->setGroup();
drupal_add_js(drupal_get_path('module', 'og_activity') . '/og_activity.js');
drupal_add_js(array(
'group_nid' => $this->_gid,
), "setting");
}
/**
* Skip active user.
* We never want to skip the active user.
*/
public function skipActiveUser() {
return FALSE;
}
/**
* hasAccess
*
* Checks access for this stream.
*/
protected function hasAccess() {
// if the user has access to this node (member or public group)
//og_set_group_context($this->group);
if (isset($this->group) && (og_is_group_member($this->group) || $this->group->og_private == 0)) {
$this->_group_access = TRUE;
}
if (!isset($this->group)) {
$this
->setError('We are not in a group context.');
}
return $this->_group_access;
}
/**
* getGroup
*/
public function getGroup() {
return $this->group;
}
/**
* setGroup
*
* Sets the group for a given node ID.
* @param Integer $nid
* The group node ID.
*/
private function setGroup($nid = 0) {
if ($nid != 0) {
$this->_gid = $nid;
$this->group = node_load($nid);
}
elseif (!empty($_REQUEST['group_nid'])) {
$this->_gid = $_REQUEST['group_nid'];
$this->group = node_load($this->_gid);
}
elseif (arg(0) == 'node' && is_numeric(arg(1))) {
$node = node_load(arg(1));
if (og_is_group_type($node->type)) {
$this->_gid = arg(1);
$this->group = $node;
}
elseif (og_is_group_post_type($node->type)) {
$this->_gid = current($node->og_groups);
$this->group = node_load($this->_gid);
}
}
}
/**
* dressUpMessages
*
* @param HeartbeatParser $heartbeat
* The parser for the messages in this stream.
*/
public function dressUpMessages(HeartbeatParser $heartbeat) {
$members = array();
$sql = og_list_users_sql(1, 0, NULL);
$res = db_query($sql, $this->_gid);
while ($row = db_fetch_object($res)) {
$members[] = $row->uid;
}
if (!empty($members)) {
$sql = " AND ua.uid IN (" . implode(',', $members) . ") ";
$heartbeat->raw_messages = $this
->resultSql($sql);
}
else {
$heartbeat->raw_messages = array();
}
return $heartbeat;
}
/**
* Function to add a part of a sql to a query built by views UI
*
* @param object $view The view handler object by reference to add our part to the query
*/
public function addViewQuery(&$view) {
$members = array();
$sql = og_list_users_sql(1, 0, NULL);
$res = db_query($sql, $this->_gid);
while ($row = db_fetch_object($res)) {
$members[] = $row->uid;
}
$sql = "{$view->table_alias}.uid IN (" . implode(',', $members) . ") ";
$view->query
->set_where_group('AND', 'extra');
$view->query
->add_where('extra', $sql);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
HeartbeatAccess:: |
public | property | ||
HeartbeatAccess:: |
protected | property | ||
HeartbeatAccess:: |
protected | property | ||
HeartbeatAccess:: |
protected | property | ||
HeartbeatAccess:: |
protected | property | ||
HeartbeatAccess:: |
protected | property | ||
HeartbeatAccess:: |
protected | property | ||
HeartbeatAccess:: |
protected | property | ||
HeartbeatAccess:: |
protected | property | ||
HeartbeatAccess:: |
protected | function | Check denied messages | |
HeartbeatAccess:: |
public | function | ConfigurationForm Basic configuration form for streams. | |
HeartbeatAccess:: |
protected | function | createHeartbeatParser | |
HeartbeatAccess:: |
public | function | ||
HeartbeatAccess:: |
protected | function | finishMessages | |
HeartbeatAccess:: |
final public | function | getAccess | |
HeartbeatAccess:: |
public | function | Function to retrieve the active user. | |
HeartbeatAccess:: |
public | function | ||
HeartbeatAccess:: |
final public | function | getOffsetSql | |
HeartbeatAccess:: |
public | function | Get HeartbeatStream object with all configurations | |
HeartbeatAccess:: |
public | function | hasErrors | |
HeartbeatAccess:: |
public | function | Getter function for heartbeat page/blocks | |
HeartbeatAccess:: |
protected | function | prepareStream | 2 |
HeartbeatAccess:: |
protected | function | resultSql | 1 |
HeartbeatAccess:: |
protected | function | setError | |
HeartbeatAccess:: |
final public | function | setOffsetSql | |
HeartbeatAccess:: |
constant | |||
HeartbeatAccess:: |
constant | |||
HeartbeatAccess:: |
protected | function | proctected fuinction whoIsActor Calculate the user of whom we want to see activity for. Set the actor of the stream. | 1 |
HeartbeatAccess:: |
public | function | Constructor | |
MembersActivity:: |
protected | property | ||
MembersActivity:: |
protected | property | ||
MembersActivity:: |
protected | property | ||
MembersActivity:: |
public | function |
Function to add a part of a sql to a query built by views UI Overrides HeartbeatAccess:: |
|
MembersActivity:: |
public | function |
Fake constructor to hook this method instead of the constructor. Overrides HeartbeatAccess:: |
|
MembersActivity:: |
public | function |
dressUpMessages Overrides HeartbeatAccess:: |
|
MembersActivity:: |
public | function | getGroup | |
MembersActivity:: |
protected | function |
hasAccess Overrides HeartbeatAccess:: |
|
MembersActivity:: |
private | function | setGroup | |
MembersActivity:: |
public | function |
Skip active user.
We never want to skip the active user. Overrides HeartbeatAccess:: |