views_system.module in Views System 6.3
Same filename and directory in other branches
This module extends the Views module and allows to create customized lists (pages, blocks) of modules, themes, and theme engines that are or have been installed in Drupal's file system.
File
views_system.moduleView source
<?php
/**
* @file
* This module extends the Views module and allows to create customized lists
* (pages, blocks) of modules, themes, and theme engines that are or have been
* installed in Drupal's file system.
*/
/**
* Implementation of hook_help().
*/
function views_system_help($path, $arg) {
switch ($path) {
case 'admin/help#views_system':
$output = '<p>' . t('The <em>Views System</em> module extends the <a href="@views">Views</a> module and allows to create customized lists (pages, blocks) of modules, themes, and theme engines that are or have been installed in Drupal\'s file system.', array(
'@views' => 'http://drupal.org/project/views',
)) . '</p>';
$output .= '<p>' . t('For more information, see the online handbook entry for <a href="@views_system">Views System module</a>.', array(
'@views_system' => 'http://drupal.org/project/views_system',
)) . '</p>';
return $output;
}
}
/**
* Implementation of hook_views_api().
*/
function views_system_views_api() {
$api = array(
'api' => 3,
'path' => drupal_get_path('module', 'views_system') . '/views',
);
return $api;
}
/**
* Helper function; retrieves list of item types.
*/
function _views_system_get_type() {
static $type = array();
if (!$type) {
$result = db_query('SELECT DISTINCT(type) FROM {system} ORDER BY type');
while ($record = db_fetch_object($result)) {
$type[$record->type] = _views_system_get_type_name($record->type);
}
}
return $type;
}
/**
* Helper function; retrieves display name of the item type.
*/
function _views_system_get_type_name($type) {
$type_name = array();
$type_name['module'] = t('Module');
$type_name['theme'] = t('Theme');
$type_name['theme_engine'] = t('Theme engine');
return isset($type_name[$type]) ? $type_name[$type] : theme('placeholder', t('Unknown'));
}
/**
* Helper function; retrieves screenshot path of the theme.
*/
function _views_system_get_screenshot($info) {
if (!file_exists($info['screenshot'])) {
if (isset($info['base theme'])) {
$result = db_query('SELECT info FROM {system} WHERE name = "%s" and type = "theme"', $info['base theme']);
if ($system = db_fetch_object($result)) {
$screenshot = _views_system_get_screenshot(unserialize($system->info));
}
else {
$screenshot = NULL;
}
}
else {
$screenshot = NULL;
}
}
else {
$screenshot = $info['screenshot'];
}
return $screenshot;
}
/**
* Helper function; retrieves list of Drupal core modules and themes.
*/
function _views_system_get_drupal_core($item = NULL) {
$core = array();
// Modules
$core['modules/aggregator/aggregator.module'] = 'aggregator';
$core['modules/block/block.module'] = 'block';
$core['modules/blog/blog.module'] = 'blog';
$core['modules/blogapi/blogapi.module'] = 'blogapi';
$core['modules/book/book.module'] = 'book';
$core['modules/color/color.module'] = 'color';
$core['modules/comment/comment.module'] = 'comment';
$core['modules/contact/contact.module'] = 'contact';
$core['modules/dblog/dblog.module'] = 'dblog';
$core['modules/filter/filter.module'] = 'filter';
$core['modules/forum/forum.module'] = 'forum';
$core['modules/help/help.module'] = 'help';
$core['modules/locale/locale.module'] = 'locale';
$core['modules/menu/menu.module'] = 'menu';
$core['modules/node/node.module'] = 'node';
$core['modules/openid/openid.module'] = 'openid';
$core['modules/path/path.module'] = 'path';
$core['modules/php/php.module'] = 'php';
$core['modules/ping/ping.module'] = 'ping';
$core['modules/poll/poll.module'] = 'poll';
$core['modules/profile/profile.module'] = 'profile';
$core['modules/search/search.module'] = 'search';
$core['modules/statistics/statistics.module'] = 'statistics';
$core['modules/syslog/syslog.module'] = 'syslog';
$core['modules/system/system.module'] = 'system';
$core['modules/taxonomy/taxonomy.module'] = 'taxonomy';
$core['modules/throttle/throttle.module'] = 'throttle';
$core['modules/tracker/tracker.module'] = 'tracker';
$core['modules/translation/translation.module'] = 'translation';
$core['modules/trigger/trigger.module'] = 'trigger';
$core['modules/update/update.module'] = 'update';
$core['modules/upload/upload.module'] = 'upload';
$core['modules/user/user.module'] = 'user';
// Themes
$core['themes/bluemarine/bluemarine.info'] = 'bluemarine';
$core['themes/chameleon/chameleon.info'] = 'chameleon';
$core['themes/garland/garland.info'] = 'garland';
$core['themes/chameleon/marvin/marvin.info'] = 'marvin';
$core['themes/garland/minnelli/minnelli.info'] = 'minnelli';
$core['themes/pushbutton/pushbutton.info'] = 'pushbutton';
return $item ? isset($core[$item]) : $core;
}
Functions
Name![]() |
Description |
---|---|
views_system_help | Implementation of hook_help(). |
views_system_views_api | Implementation of hook_views_api(). |
_views_system_get_drupal_core | Helper function; retrieves list of Drupal core modules and themes. |
_views_system_get_screenshot | Helper function; retrieves screenshot path of the theme. |
_views_system_get_type | Helper function; retrieves list of item types. |
_views_system_get_type_name | Helper function; retrieves display name of the item type. |