You are here

spaces_core.module in Spaces 5.2

Same filename and directory in other branches
  1. 5 spaces_core/spaces_core.module
  2. 6 spaces_core/spaces_core.module

File

spaces_core/spaces_core.module
View source
<?php

/**
 * Implementation of hook_menu().
 */
function spaces_core_menu($may_cache) {
  $items = array();
  if ($may_cache) {
    if (module_exists('book')) {
      $items[] = array(
        'title' => t('Documents'),
        'path' => 'documents',
        'description' => t('Displays the parent book node for a given spaces group.'),
        'callback' => 'spaces_core_documents',
        'access' => user_access('access content'),
        'type' => MENU_NORMAL_ITEM,
      );
    }
    if (module_exists('taxonomy')) {
      $items[] = array(
        'title' => t('Taxonomy'),
        'path' => 'taxonomy/term',
        'description' => t('Custom taxonomy term callback.'),
        'callback' => 'spaces_core_taxonomy',
        'access' => user_access('access content'),
        'type' => MENU_CALLBACK,
      );
    }
    return $items;
  }
}

/**
 * Implementation of hook_help().
 */
function spaces_core_help($page) {
  switch (context_get('spaces', 'feature')) {
    case 'blog':
      return "<p>" . t('The blog is a team discussion place where you can post and discuss information relevant to your team.') . "</p>";
    case 'book':
      return "<p>" . t('The book provides a place for you to post documents and other reference material.') . "</p>";
  }
}

/**
 * Implementation of hook_block().
 */
function spaces_core_block($op = 'list', $delta = 0) {
  if ($op == 'list') {
    $blocks['tags']['info'] = t('Spaces Core: Tag chart');
    $blocks['book']['info'] = t('Spaces Core: Book navigation');
    return $blocks;
  }
  else {
    if ($op == 'view') {
      switch ($delta) {
        case 'tags':
          return _spaces_core_block_tags();
        case 'book':
          return _spaces_core_block_book();
      }
    }
  }
}

/**
 * Implementation of hook_form_alter().
 */
function spaces_core_form_alter($form_id, &$form) {
  switch ($form_id) {
    case 'user_edit':
      unset($form['og_settings']);

      // Remove the og email settings.
      break;
    case 'comment_form':
      if (!drupal_get_title()) {
        drupal_set_title(t('Reply'));
      }
      break;
  }
}

/**
 * Implementation of hook_nodeapi().
 */
function spaces_core_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
  switch ($op) {
    case "view":
      switch ($node->type) {
        case 'book':

          // Hide top book navigation if page is unusually short
          if (strlen(strip_tags($node->content['body']['#value'])) > 1000) {
            $node->content['spaces_book'] = array(
              '#value' => theme('book_navigation', $node, false),
              '#weight' => -100,
            );
          }
          break;
      }
      break;
  }
}

/**
 *  Implementation of hook_user().
 */
function spaces_core_user($op, &$edit, &$account, $category = NULL) {
  switch ($op) {
    case 'view':
      global $user;
      context_set('spaces', 'user', $account->uid);
      if ($user->uid == $account->uid) {
        $links = array();
        $links['user']['title'] = t('Edit my account');
        $links['user']['href'] = 'user/' . $account->uid . '/edit';
        $links['user']['custom'] = true;
        context_set('spaces', 'links', $links);
      }
      break;
  }
}

/**
 *  Implementation of hook_default_views().
 */
function spaces_core_views_default_views() {
  $default_views = array(
    '_spaces_core_views_blog',
    '_spaces_core_views_blog_comments',
    '_spaces_core_views_ref_blog2book',
    '_spaces_core_views_user_posts',
    '_spaces_core_views_changes',
    '_spaces_core_views_comments',
    '_spaces_core_views_taxonomy',
    '_spaces_core_views_tags',
  );
  foreach ($default_views as $v) {
    $view = call_user_func($v);
    if (is_object($view) && $view->name) {
      $views[$view->name] = $view;
    }
  }
  return $views;
}

/**
 * Implementation of hook_context_define().
 */
function spaces_core_context_define() {
  $items = array();
  if (module_exists('blog')) {
    $items[] = array(
      'namespace' => 'spaces',
      'attribute' => 'feature',
      'value' => 'blog',
      'node' => array(
        'blog',
      ),
      'views' => array(
        'spaces_blog',
        'spaces_blog_comments',
      ),
      'block' => array(
        array(
          'module' => 'views',
          'delta' => 'spaces_blog_comments',
          'region' => 'right',
          'weight' => -11,
        ),
      ),
      'spaces' => array(
        'label' => t('Blog'),
        'description' => t('A member blog and team discussion space.'),
        'menu' => array(
          'blog' => array(
            'title' => t('Blog'),
            'weight' => -5,
          ),
        ),
      ),
    );
  }
  if (module_exists('book')) {
    $items[] = array(
      'namespace' => 'spaces',
      'attribute' => 'feature',
      'value' => 'book',
      'node' => array(
        'book',
      ),
      'block' => array(
        array(
          'module' => 'spaces_core',
          'delta' => 'book',
          'region' => 'right',
          'weight' => -11,
        ),
      ),
      'spaces' => array(
        'label' => t('Documents'),
        'description' => t('A document section for maintaining a knowledge base.'),
        'menu' => array(
          'documents' => array(
            'title' => t('Documents'),
          ),
        ),
        'types' => array(
          'og',
        ),
      ),
    );
  }
  if (module_exists('taxonomy')) {
    $items[] = array(
      'namespace' => 'spaces',
      'attribute' => 'feature',
      'value' => 'taxonomy',
      'views' => array(
        'spaces_taxonomy',
      ),
      'block' => array(
        array(
          'module' => 'spaces_core',
          'delta' => 'tags',
          'region' => 'right',
          'weight' => -11,
        ),
      ),
    );
  }
  return $items;
}

/*
 * This function acts as a fallback in case users delete or re-path the root book page at 'documents'
 */
function spaces_core_documents() {

  // og version of the book root lookup
  if ($space = spaces_get_space()) {
    $nid = db_result(db_query('SELECT n.nid FROM {node} n JOIN {book} b ON n.nid = b.nid AND n.vid = b.vid JOIN {og_ancestry} og ON og.nid = n.nid WHERE og.group_nid = %d AND n.type = "%s" AND b.parent = %d LIMIT 1', $space->sid, 'book', 0));
    if ($nid) {
      drupal_goto('node/' . $nid);
    }
    context_ui_set('node', 'book');
    $message = t('Please add your first book page to get started.');
    $button = spaces_node_links();
    $o = "<p>{$message}</p>{$button}";
    return $o;
  }
}

/**
 * @TODO: Abstract this into a hook -- we will not always be testing
 * against OG conditions!
 * 
 * Page call back to handle taxonomy listing
 *
 * If a term is requested in a group context we use a group aware page
 * when then term's vocabulary is related to any group targeted node 
 * types. If it is from a vocab that doesn't relate to any group aware 
 * content or is request outsite of a group contexts we use a group
 * agnostic listing.
 *
 * @param $tid
 *   The term id to generate a listing page for.
 *
 * @return
 *   A themed taxonomy listing page.
 */
function spaces_core_taxonomy($tid) {
  if (is_numeric($tid) && ($t = taxonomy_get_term($tid))) {
    $v = taxonomy_get_vocabulary($t->vid);
  }
  if ($v && $t) {
    $view = views_get_view('spaces_taxonomy');
    $content = views_build_view('page', $view, array(
      $tid,
    ), true, 25);
    if (is_object($t) && is_object($v)) {
      drupal_set_title($v->name . ': ' . $t->name);

      // set taxonomy context
      context_set('taxonomy', array(
        'vid' => $t->vid,
        'tid' => $t->tid,
      ));
      if ($use_gid) {
        context_set('taxonomy', 'group_vocab', true);
      }
    }
    return $content;
  }
  return drupal_not_found();
  exit;
}

/**
 * Implementation of hook_spaces_node_links_alter();
 */
function spaces_core_spaces_node_links_alter(&$links) {
  if (isset($links['book'])) {
    if ($space = spaces_get_space()) {
      if ($space
        ->feature_access('book') && arg(0) == 'node' && is_numeric(arg(1))) {
        $pid = arg(1);
        $links['book']['href'] = 'node/add/book/parent/' . $pid;
      }
    }
  }
}

/**
 * BLOCKS =============================================================
 */
function _spaces_core_block_tags() {
  $space = spaces_get_space();
  if (context_get('spaces', 'feature') == 'taxonomy') {
    $terms = taxonomy_terms_parse_string(arg(2));
    $tid = $terms['tids'][0];
    if ($term = taxonomy_get_term($tid)) {
      $vocab = taxonomy_get_vocabulary($term->vid);
      $view = views_get_view('spaces_tags');
      $view->filter[1]['value'] = array(
        $term->vid,
      );
      $block['content'] = views_build_view('block', $view, array(
        $space->sid,
      ));
      $block['subject'] = $vocab->name;
      return $block;
    }
  }
}

/**
 * Spaces version of the book nav block -- shows all root books in a group
 */
function _spaces_core_block_book() {
  $space = spaces_get_space();
  if ($space) {

    // Only display this block when the user is browsing a book:
    $result = db_query(db_rewrite_sql('SELECT n.nid, n.title, b.parent FROM {node} n INNER JOIN {book} b ON n.vid = b.vid WHERE n.nid = %d'), arg(1));
    if (db_num_rows($result) > 0) {
      $node = db_fetch_object($result);
      $path = book_location($node);
      $path[] = $node;
      $expand = array();
      foreach ($path as $key => $node) {
        $expand[] = $node->nid;
      }
      $features = spaces_features();
      $feature_menu = space_customizer_menu::customize($space, 'book', $features['book']->spaces['menu']);
      $block['subject'] = isset($feature_menu['documents']['title']) ? $feature_menu['documents']['title'] : t('Documents');
      $block['content'] = _spaces_core_book_tree(0, 5, $expand);
      return $block;
    }
  }
}

/**
 * Group-aware book tree generation
 */
function _spaces_core_book_tree($parent = 0, $depth = 3, $unfold = array(), $sid = NULL) {
  if (!$sid && ($space = spaces_get_space())) {
    $sid = $space->sid;
  }
  if ($sid) {
    $result = db_query(db_rewrite_sql('SELECT n.nid, n.title, b.parent, b.weight FROM {node} n INNER JOIN {book} b ON n.vid = b.vid JOIN {og_ancestry} og ON og.nid = b.nid WHERE n.status = 1 AND og.group_nid = %d ORDER BY b.weight, n.title'), $sid);
    while ($node = db_fetch_object($result)) {
      $list = isset($children[$node->parent]) ? $children[$node->parent] : array();
      $list[] = $node;
      $children[$node->parent] = $list;
    }
    if ($tree = book_tree_recurse($parent, $depth, $children, $unfold)) {
      return '<ul class="menu">' . $tree . '</ul>';
    }
  }
  else {
    return '';
  }
}

/* VIEWS */
function _spaces_core_views_blog() {
  $view = new stdClass();
  $view->name = 'spaces_blog';
  $view->description = t('Provides a default blog listing that is filterable by uid.');
  $view->access = array();
  $view->view_args_php = '';
  $view->menu = TRUE;
  $view->menu_title = t('Blog');
  $view->page = TRUE;
  $view->page_title = t('Blog');
  $view->page_empty = '<?php print _spaces_views_empty("blog"); ?>';
  $view->page_empty_format = '2';
  $view->page_type = 'teaser';
  $view->url = 'blog';
  $view->use_pager = TRUE;
  $view->nodes_per_page = '5';
  $view->block = TRUE;
  $view->block_title = t('Recent blog posts');
  $view->block_empty = "<p class='views-empty'>" . t('No blog entries found.') . "</p>";
  $view->block_empty_format = '1';
  $view->block_type = 'spaces_datetitle';
  $view->nodes_per_block = '3';
  $view->block_more = TRUE;
  $view->sort = array(
    array(
      'tablename' => 'node',
      'field' => 'created',
      'sortorder' => 'DESC',
      'options' => 'normal',
    ),
  );
  $view->argument = array(
    array(
      'type' => 'uid',
      'argdefault' => '2',
      'title' => '%1\'s Blog',
      'options' => '',
      'wildcard' => 'all',
      'wildcard_substitution' => '',
    ),
    array(
      'type' => 'node_feed',
      'argdefault' => '2',
      'title' => 'Blog',
      'options' => '',
      'wildcard' => '',
      'wildcard_substitution' => '',
    ),
  );
  $view->field = array(
    array(
      'tablename' => 'node',
      'field' => 'created',
      'label' => '',
      'handler' => 'views_handler_field_date_small',
    ),
    array(
      'tablename' => 'node',
      'field' => 'title',
      'label' => '',
      'handler' => 'views_handler_field_nodelink',
      'options' => 'link',
    ),
  );
  $view->filter = array(
    array(
      'tablename' => 'node',
      'field' => 'status',
      'operator' => '=',
      'options' => '',
      'value' => '1',
    ),
    array(
      'tablename' => 'node',
      'field' => 'type',
      'operator' => 'OR',
      'options' => '',
      'value' => array(
        0 => 'blog',
      ),
    ),
    array(
      'tablename' => 'spaces',
      'field' => 'type',
      'operator' => 'all',
      'options' => '',
      'value' => 'all',
    ),
  );
  $view->exposed_filter = array();
  $view->requires = array(
    node,
  );
  return $view;
}
function _spaces_core_views_blog_comments() {
  $view = new stdClass();
  $view->name = 'spaces_blog_comments';
  $view->description = t('');
  $view->access = array();
  $view->view_args_php = '';
  $view->page = FALSE;
  $view->block = TRUE;
  $view->block_title = t('Recent Comments');
  $view->block_empty = "<p class='views-empty'>" . t('No recent comments.') . "</p>";
  $view->block_empty_format = '1';
  $view->block_type = 'spaces_datetitle';
  $view->nodes_per_block = '5';
  $view->sort = array(
    array(
      'tablename' => 'node_comment_statistics',
      'field' => 'last_comment_timestamp',
      'sortorder' => 'DESC',
      'options' => 'normal',
    ),
  );
  $view->argument = array();
  $view->field = array(
    array(
      'tablename' => 'comments',
      'field' => 'subject',
      'label' => t('Comment'),
      'handler' => 'views_handler_field_commentlink',
      'options' => 'link',
    ),
    array(
      'tablename' => 'comments',
      'field' => 'name',
      'label' => t('By'),
    ),
    array(
      'tablename' => 'node',
      'field' => 'title',
      'label' => t('On Post'),
      'handler' => 'views_handler_field_nodelink',
      'options' => 'nolink',
    ),
    array(
      'tablename' => 'node_comment_statistics',
      'field' => 'last_comment_timestamp',
      'label' => t('Date'),
      'handler' => 'views_handler_field_date_small',
    ),
  );
  $view->filter = array(
    array(
      'tablename' => 'node',
      'field' => 'status',
      'operator' => '=',
      'options' => '',
      'value' => '1',
    ),
    array(
      'tablename' => 'node_comment_statistics',
      'field' => 'comment_count',
      'operator' => '>',
      'options' => '',
      'value' => '0',
    ),
    array(
      'tablename' => 'node',
      'field' => 'type',
      'operator' => 'OR',
      'options' => '',
      'value' => array(
        0 => 'blog',
      ),
    ),
    array(
      'tablename' => 'spaces',
      'field' => 'type',
      'operator' => 'all',
      'options' => '',
      'value' => 'all',
    ),
    array(
      'tablename' => 'node_comment_statistics',
      'field' => 'last_comment_timestamp',
      'operator' => '>',
      'options' => -1 * SPACES_ARCHIVE_TIMESTAMP,
      'value' => 'now',
    ),
  );
  $view->exposed_filter = array();
  $view->requires = array(
    node_comment_statistics,
    comments,
    node,
  );
  return $view;
}
function _spaces_core_views_ref_blog2book() {
  $view = new stdClass();
  $view->name = 'ref_blog2book';
  $view->description = 'Provides a list of blog entries that refer to the given book page.';
  $view->access = array();
  $view->view_args_php = '';
  $view->page = FALSE;
  $view->block = TRUE;
  $view->block_title = t('Discussions');
  $view->block_type = 'table';
  $view->nodes_per_block = '50';
  $view->sort = array(
    array(
      'tablename' => 'node',
      'field' => 'created',
      'sortorder' => 'DESC',
      'options' => 'normal',
    ),
  );
  $view->argument = array(
    array(
      'type' => 'content: field_referenced_book_page',
      'argdefault' => '1',
    ),
  );
  $view->field = array(
    array(
      'tablename' => 'node',
      'field' => 'title',
      'label' => t('Title'),
      'handler' => 'views_handler_field_nodelink',
      'options' => 'link',
    ),
    array(
      'tablename' => 'users',
      'field' => 'name',
      'label' => t('Author'),
    ),
    array(
      'tablename' => 'node',
      'field' => 'created',
      'label' => t('Posted'),
      'handler' => 'views_handler_field_date_small',
    ),
  );
  $view->filter = array(
    array(
      'tablename' => 'node',
      'field' => 'type',
      'operator' => 'OR',
      'options' => '',
      'value' => array(
        0 => 'blog',
      ),
    ),
    array(
      'tablename' => 'spaces',
      'field' => 'type',
      'operator' => 'all',
      'options' => '',
      'value' => 'all',
    ),
  );
  $view->requires = array(
    node,
    node_comment_statistics,
    users,
  );
  return $view;
}
function _spaces_core_views_user_posts() {
  $view = new stdClass();
  $view->name = 'spaces_user_posts';
  $view->description = t('Shows updated posts.');
  $view->access = array();
  $view->view_args_php = '';
  $view->page = TRUE;
  $view->page_title = t('Recent Posts');
  $view->page_empty = '<p class="views-empty">' . t('No recent posts found') . '</p>';
  $view->page_empty_format = '2';
  $view->page_type = 'table';
  $view->url = 'userposts';
  $view->use_pager = TRUE;
  $view->nodes_per_page = '25';
  $view->block = TRUE;
  $view->block_title = t('Recent Posts');
  $view->block_empty = '<p class="views-empty">' . t('No recent posts found') . '</p>';
  $view->block_empty_format = '1';
  $view->block_type = 'table';
  $view->nodes_per_block = '10';
  $view->block_more = TRUE;
  $view->sort = array(
    array(
      'tablename' => 'node_comment_statistics',
      'field' => 'last_comment_timestamp',
      'sortorder' => 'DESC',
      'options' => 'normal',
    ),
  );
  $view->argument = array(
    array(
      'type' => 'uidtouch',
      'argdefault' => '7',
      'title' => "%1's Posts",
    ),
  );
  $view->field = array(
    array(
      'tablename' => 'node',
      'field' => 'title',
      'label' => 'Title',
      'handler' => 'views_handler_field_nodelink_with_mark',
      'options' => 'link',
    ),
    array(
      'tablename' => 'node',
      'field' => 'type',
      'label' => 'Type',
    ),
    array(
      'tablename' => 'node_comment_statistics',
      'field' => 'comment_count',
      'label' => 'Replies',
      'handler' => 'views_handler_comments',
    ),
    array(
      'tablename' => 'node_comment_statistics',
      'field' => 'last_comment_timestamp',
      'label' => 'Last Post',
      'handler' => 'views_handler_field_since',
      'options' => 1,
    ),
  );
  $view->filter = array(
    array(
      'tablename' => 'node',
      'field' => 'status',
      'operator' => '=',
      'options' => '',
      'value' => '1',
    ),
    array(
      'tablename' => 'node',
      'field' => 'type',
      'operator' => 'NOR',
      'options' => '',
      'value' => array_merge(og_get_types('group'), array(
        'shout',
      )),
    ),
    array(
      'tablename' => 'spaces',
      'field' => 'type',
      'operator' => 'all',
      'options' => '',
      'value' => 'all',
    ),
  );
  $view->requires = array(
    node_comment_statistics,
    node,
  );
  return $view;
}
function _spaces_core_views_changes() {
  $view = new stdClass();
  $view->name = 'spaces_changes';
  $view->description = t('Displays a list of recently modified nodes.');
  $view->access = array();
  $view->view_args_php = '';
  $view->page = TRUE;
  $view->page_title = t('Recent Changes');
  $view->page_type = 'table';
  $view->url = 'changes';
  $view->use_pager = TRUE;
  $view->nodes_per_page = '25';
  $view->block = TRUE;
  $view->block_title = t('Recent Changes');
  $view->block_empty = "<p class='views-empty'>" . t('No recent changes.') . "</p>";
  $view->block_empty_format = '1';
  $view->block_type = 'spaces_datetitle';
  $view->nodes_per_block = '5';
  $view->argument = array();
  $view->sort = array(
    array(
      'tablename' => 'node',
      'field' => 'changed',
      'sortorder' => 'DESC',
      'options' => 'normal',
    ),
  );
  $view->field = array(
    array(
      'tablename' => 'og_node_data',
      'field' => 'title',
      'label' => 'Group',
      'handler' => 'spaces_views_handler_crayon_name',
      'options' => 'og',
    ),
    array(
      'tablename' => 'node',
      'field' => 'title',
      'label' => t('Title'),
      'handler' => 'views_handler_field_nodelink',
      'options' => 'link',
    ),
    array(
      'tablename' => 'node',
      'field' => 'changed',
      'label' => t('Changed'),
      'handler' => 'views_handler_field_since',
      'options' => 1,
    ),
    array(
      'tablename' => 'node',
      'field' => 'type',
      'label' => t('Type'),
    ),
    array(
      'tablename' => 'users',
      'field' => 'name',
      'label' => t('Author'),
    ),
  );
  if (variable_get('spaces_calendar_feed_itemtype', '')) {
    $excluded = array(
      'shout',
      variable_get('spaces_calendar_feed_itemtype', ''),
    );
  }
  else {
    $excluded = array(
      'shout',
    );
  }
  $view->filter = array(
    array(
      'tablename' => 'node',
      'field' => 'type',
      'operator' => 'NOR',
      'options' => '',
      'value' => array_merge(og_get_types('group'), $excluded),
    ),
    array(
      'tablename' => 'og_uid_node',
      'field' => 'currentuid',
      'operator' => '=',
      'options' => '',
      'value' => '***CURRENT_USER***',
    ),
    array(
      'tablename' => 'spaces',
      'field' => 'type',
      'operator' => 'active',
      'options' => '',
      'value' => 'all',
    ),
    array(
      'tablename' => 'node',
      'field' => 'changed',
      'operator' => '>',
      'options' => -1 * SPACES_ARCHIVE_TIMESTAMP,
      'value' => 'now',
    ),
  );
  $view->exposed_filter = array();
  $view->requires = array(
    'node',
    'users',
    'og_node_data',
    'og_uid_node',
  );
  return $view;
}
function _spaces_core_views_comments() {
  $view = new stdClass();
  $view->name = 'spaces_comments';
  $view->description = t('Displays a listing of recent comments');
  $view->access = array();
  $view->view_args_php = '';
  $view->page = TRUE;
  $view->page_title = t('Recent Comments');
  $view->page_empty = '<p class="views-empty">' . t('No recent comments found.') . '</p>';
  $view->page_empty_format = '2';
  $view->page_type = 'table';
  $view->url = 'comments';
  $view->use_pager = TRUE;
  $view->nodes_per_page = '25';
  $view->block = TRUE;
  $view->block_title = t('Recent Comments');
  $view->block_empty = "<p class='views-empty'>" . t('No recent comments.') . "</p>";
  $view->block_empty_format = '1';
  $view->block_type = 'spaces_datetitle';
  $view->nodes_per_block = '5';
  $view->sort = array(
    array(
      'tablename' => 'node_comment_statistics',
      'field' => 'last_comment_timestamp',
      'sortorder' => 'DESC',
      'options' => 'normal',
    ),
  );
  $view->argument = array();
  $view->field = array(
    array(
      'tablename' => 'og_node_data',
      'field' => 'title',
      'label' => 'Group',
      'handler' => 'spaces_views_handler_crayon_name',
      'options' => 'og',
    ),
    array(
      'tablename' => 'comments',
      'field' => 'subject',
      'label' => t('Comment'),
      'handler' => 'views_handler_field_commentlink',
      'options' => 'link',
    ),
    array(
      'tablename' => 'comments',
      'field' => 'name',
      'label' => t('By'),
    ),
    array(
      'tablename' => 'node',
      'field' => 'title',
      'label' => t('On Post'),
      'handler' => 'views_handler_field_nodelink',
      'options' => 'nolink',
    ),
    array(
      'tablename' => 'node',
      'field' => 'type',
      'label' => t('Type'),
    ),
    array(
      'tablename' => 'node_comment_statistics',
      'field' => 'last_comment_timestamp',
      'label' => t('Date'),
      'handler' => 'views_handler_field_date_small',
    ),
  );
  $view->filter = array(
    array(
      'tablename' => 'node',
      'field' => 'status',
      'operator' => '=',
      'options' => '',
      'value' => '1',
    ),
    array(
      'tablename' => 'node_comment_statistics',
      'field' => 'comment_count',
      'operator' => '>',
      'options' => '',
      'value' => '0',
    ),
    array(
      'tablename' => 'og_uid_node',
      'field' => 'currentuid',
      'operator' => '=',
      'options' => '',
      'value' => '***CURRENT_USER***',
    ),
    array(
      'tablename' => 'spaces',
      'field' => 'type',
      'operator' => 'active',
      'options' => '',
      'value' => 'all',
    ),
    array(
      'tablename' => 'node_comment_statistics',
      'field' => 'last_comment_timestamp',
      'operator' => '>',
      'options' => -1 * SPACES_ARCHIVE_TIMESTAMP,
      'value' => 'now',
    ),
  );
  $view->exposed_filter = array();
  $view->requires = array(
    node_comment_statistics,
    comments,
    node,
    og_node_data,
    og_uid_node,
  );
  return $view;
}
function _spaces_core_views_taxonomy() {
  $view = new stdClass();
  $view->name = 'spaces_taxonomy';
  $view->description = t('Spaces taxonomy override.');
  $view->access = $view->field = $view->exposed_filter = array();
  $view->page = TRUE;
  $view->page_empty = '<p>' . t('No entries found.') . '</p>';
  $view->page_empty_format = '2';
  $view->page_type = 'table';
  $view->use_pager = TRUE;
  $view->nodes_per_page = '20';
  $view->field = array(
    array(
      'tablename' => 'node',
      'field' => 'title',
      'label' => 'Title',
      'handler' => 'views_handler_field_nodelink',
      'sortable' => '1',
      'options' => 'link',
    ),
    array(
      'tablename' => 'node',
      'field' => 'created',
      'label' => 'Date',
      'handler' => 'views_handler_field_date_small',
      'sortable' => '1',
      'defaultsort' => 'DESC',
    ),
    array(
      'tablename' => 'node',
      'field' => 'type',
      'label' => 'Type',
      'sortable' => '1',
    ),
  );
  $view->sort = array();
  $view->argument = array(
    array(
      'type' => 'taxid',
      'argdefault' => '1',
      'options' => '0',
      'wildcard' => '',
      'wildcard_substitution' => '',
    ),
  );
  $view->filter = array(
    array(
      'tablename' => 'node',
      'field' => 'status',
      'operator' => '=',
      'options' => '',
      'value' => '1',
    ),
    array(
      'tablename' => 'spaces',
      'field' => 'type',
      'operator' => 'active',
      'options' => '',
      'value' => 'all',
    ),
  );
  $view->requires = array(
    node,
  );
  return $view;
}
function _spaces_core_views_tags() {
  $view = new stdClass();
  $view->name = 'spaces_tags';
  $view->description = '';
  $view->access = array();
  $view->page = FALSE;
  $view->block = TRUE;
  $view->block_title = t('Tags');
  $view->block_empty = '<p>' . t('No tags found.') . '</p>';
  $view->block_empty_format = '1';
  $view->block_type = 'tagadelic';
  $view->nodes_per_block = '20';
  $view->sort = array();
  $view->filter = array(
    array(
      'tablename' => 'node',
      'field' => 'status',
      'operator' => '=',
      'options' => '',
      'value' => '1',
    ),
    array(
      'tablename' => 'term_data',
      'field' => 'vid',
      'operator' => 'AND',
      'options' => '',
      'value' => array(
        0 => '11',
      ),
    ),
    array(
      'tablename' => 'spaces',
      'field' => 'type',
      'operator' => 'active',
      'options' => '',
      'value' => 'all',
    ),
  );
  $view->argument = array();
  $view->field = array(
    array(
      'tablename' => 'term_node',
      'field' => 'name',
      'label' => '',
      'options' => 'link',
    ),
  );
  $view->exposed_filter = array();
  $view->requires = array(
    term_node,
    node,
    term_data,
  );
  return $view;
}

Functions

Namesort descending Description
spaces_core_block Implementation of hook_block().
spaces_core_context_define Implementation of hook_context_define().
spaces_core_documents
spaces_core_form_alter Implementation of hook_form_alter().
spaces_core_help Implementation of hook_help().
spaces_core_menu Implementation of hook_menu().
spaces_core_nodeapi Implementation of hook_nodeapi().
spaces_core_spaces_node_links_alter Implementation of hook_spaces_node_links_alter();
spaces_core_taxonomy @TODO: Abstract this into a hook -- we will not always be testing against OG conditions!
spaces_core_user Implementation of hook_user().
spaces_core_views_default_views Implementation of hook_default_views().
_spaces_core_block_book Spaces version of the book nav block -- shows all root books in a group
_spaces_core_block_tags BLOCKS =============================================================
_spaces_core_book_tree Group-aware book tree generation
_spaces_core_views_blog
_spaces_core_views_blog_comments
_spaces_core_views_changes
_spaces_core_views_comments
_spaces_core_views_ref_blog2book
_spaces_core_views_tags
_spaces_core_views_taxonomy
_spaces_core_views_user_posts