aboutsummaryrefslogtreecommitdiff
path: root/views
diff options
context:
space:
mode:
authorHeshan Wanigasooriya <heshanmw@gmail.com>2010-12-05 12:52:20 +0000
committerHeshan Wanigasooriya <heshanmw@gmail.com>2010-12-05 12:52:20 +0000
commit973537f36c8f33473a00190aa64fc30b82d94c04 (patch)
tree2c2f99a3bd254b145453fab186fdc824d34a260f /views
parent07e453e2ff2f66017eb49cc0374aa1531805a043 (diff)
downloadvideo-973537f36c8f33473a00190aa64fc30b82d94c04.tar.gz
video-973537f36c8f33473a00190aa64fc30b82d94c04.tar.bz2
Removing all files
Diffstat (limited to 'views')
-rw-r--r--views/video.views.inc77
-rw-r--r--views/video_views_handler_field_data.inc60
2 files changed, 0 insertions, 137 deletions
diff --git a/views/video.views.inc b/views/video.views.inc
deleted file mode 100644
index 5f2c46f..0000000
--- a/views/video.views.inc
+++ /dev/null
@@ -1,77 +0,0 @@
-<?php
-// $Id$
-/**
- * @file
- * Provide views data for video.module.
- */
-
-module_load_include('inc', 'content', '/includes/views/content.views');
-/**
- * Implementation of hook_views_handlers().
- */
-function video_views_handlers() {
- return array(
- 'info' => array(
- 'path' => drupal_get_path('module', 'video') . '/views',
- ),
- 'handlers' => array(
- // field handlers
- 'video_views_handler_field_data' => array(
- 'parent' => 'content_handler_field',
- ),
- ),
- );
-}
-
-/**
- * Implementation of hook_views_data()
- */
-function video_views_data() {
- $data = array();
- $data['video']['table']['group'] = t('Video');
- $widgets = array('videoftp_widget','uploadfield_widget');
- foreach (content_fields() as $field) {
- if($field['module'] == 'filefield' && isset($field['widget']['type']) && in_array($field['widget']['type'], $widgets)) {
- $views_data = content_views_field_views_data($field);
- $table_alias = content_views_tablename($field);
- $db_info = content_database_info($field);
-
- $title = t('@label (!name) thumbnail', array('@label' => t($field['widget']['label']), '!name' => $field['field_name']));
- $types = array();
- foreach (content_types() as $type) {
- if (isset($type['fields'][$field['field_name']])) {
- // TODO : run check_plain here instead of on the imploded string below ?
- $types[] = $type['name'];
- }
- }
-
- $additional_fields = array();
- foreach ($db_info['columns'] as $column => $attributes) {
- // Select explicitly enabled field columns.
- if (!empty($attributes['views'])) {
- $db_columns[$column] = $attributes;
- }
- // Ensure all columns are retrieved.
- $additional_fields[$attributes['column']] = $attributes['column'];
- }
-
- $data[$table_alias][$field['field_name'].'_thumbnail'] = array(
- 'group' => t('Video'),
- 'title' => $title,
- 'help' => t($field_types[$field['type']]['label']) .' - '. t('Appears in: @types', array('@types' => implode(', ', $types))),
- );
- $data[$table_alias][$field['field_name'].'_thumbnail']['field'] = array(
- 'title' => $title,
- 'field' => $db_info['columns']['data']['column'],
- 'table' => $db_info['table'],
- 'handler' => 'video_views_handler_field_data',
- 'click sortable' => FALSE,
- 'content_field_name' => $field['field_name'],
- 'additional fields' => $additional_fields,
- 'access callback' => 'content_access',
- 'access arguments' => array('view', $field),
- );
- }
- }
- return $data;
-}
diff --git a/views/video_views_handler_field_data.inc b/views/video_views_handler_field_data.inc
deleted file mode 100644
index d082e46..0000000
--- a/views/video_views_handler_field_data.inc
+++ /dev/null
@@ -1,60 +0,0 @@
-<?php
-// $Id$
-
-/**
- * @file
- * video_handler_field_data.inc
- *
- * Provides a handler for displaying thumbnails within the serialized data column.
- */
-class video_views_handler_field_data extends content_handler_field {
-
- function render($values) {
- $values = drupal_clone($values); // Prevent affecting the original.
- $data = unserialize($values->{$this->field_alias});
- $filepath = $data['video_thumb'];
-
- // We're down to a single node here, so we can retrieve the actual field
- // definition for the node type being considered.
- $field = content_fields($this->content_field['field_name'], $values->{$this->aliases['type']});
- $options = $this->options;
- $db_info = content_database_info($field);
-
- // Build a pseudo-node from the retrieved values.
- $node = drupal_clone($values);
- $node->type = $values->{$this->aliases['type']};
- $node->nid = $values->{$this->aliases['nid']};
- $node->vid = $values->{$this->aliases['vid']};
- // Some formatters need to behave differently depending on the build_mode
- // (for instance: preview), so we provide one.
- $node->build_mode = NODE_BUILD_NORMAL;
-
- $item = array();
- foreach ($db_info['columns'] as $column => $attributes) {
- $item[$column] = $values->{$this->aliases[$attributes['column']]};
- }
-
- $item['#delta'] = $field['multiple'] ? $values->{$this->aliases['delta']} : 0;
- //added for thumbnails this should work.
- $file = pathinfo($filepath);
- $item['filepath'] = $filepath;
- $item['filename'] = $file['basename'];
- $item['filemime'] = file_get_mimetype($file['basename']);
- $item['filesize'] = filesize($filepath);
-
- // Render items.
- $formatter_name = $options['format'];
- if ($formatter = _content_get_formatter($formatter_name, $field['type'])) {
- if (content_handle('formatter', 'multiple values', $formatter) == CONTENT_HANDLE_CORE) {
- // Single-value formatter.
- $output = content_format($field, $item, $formatter_name, $node);
- }
- else {
- // Multiple values formatter - we actually have only one value to display.
- $output = content_format($field, array($item), $formatter_name, $node);
- }
- return $this->render_link($output, $values);
- }
- return '';
- }
-} \ No newline at end of file