/[drupal]/contributions/modules/simpleviews/simpleviews.views_default.inc
ViewVC logotype

Contents of /contributions/modules/simpleviews/simpleviews.views_default.inc

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.3 - (show annotations) (download) (as text)
Thu Sep 25 22:08:09 2008 UTC (14 months ago) by eaton
Branch: MAIN
CVS Tags: DRUPAL-6--1-0, HEAD
Branch point for: DRUPAL-6--1
Changes since 1.2: +7 -12 lines
File MIME type: text/x-php
A real, honest-to-goodness, working version of Simpleviews.
1 <?php
2 // $Id$
3
4 /**
5 * Implementation of hook_views_default_views().
6 *
7 * Loads all simpleviews entries and content type settings, then generates a
8 * view for each one. We do this so that the simple views can be overridden by
9 * views_ui and customized by advanced users.
10 */
11 function simpleviews_views_default_views() {
12 $views = array();
13
14 $results = db_query("SELECT * FROM {simpleviews}");
15 $items = array();
16 while ($item = db_fetch_array($results)) {
17 $item['name'] = $item['module'] . '_' . $item['svid'];
18 $view = simpleviews_build_view($item);
19 $views[$view->name] = $view;
20 }
21
22 foreach (node_get_types('types', NULL, TRUE) as $type) {
23 if (variable_get('simpleviews_type_' . $type->type, FALSE)) {
24 $type_url_str = str_replace('_', '-', $type->type);
25 $record = array(
26 'name' => 'simpleviews_' . $type->type,
27 'path' => $type_url_str,
28 'title' => $type->name . ' content',
29 'filter' => 'node:' . $type->type,
30 'style' => 'teasers',
31 'sort' => 'newest',
32 );
33 $view = simpleviews_build_view($record);
34 $views[$view->name] = $view;
35 }
36 }
37 return $views;
38 }

  ViewVC Help
Powered by ViewVC 1.1.2