/[drupal]/contributions/modules/video_upload/video_upload_file.inc
ViewVC logotype

Contents of /contributions/modules/video_upload/video_upload_file.inc

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


Revision 1.3 - (show annotations) (download) (as text)
Sun Oct 11 22:06:52 2009 UTC (6 weeks, 1 day ago) by jhedstrom
Branch: MAIN
CVS Tags: HEAD
Branch point for: DRUPAL-7--1
Changes since 1.2: +0 -0 lines
File MIME type: text/x-php
Initital 7.x port.
1 <?php
2
3 // $Id$
4
5 /**
6 * @file
7 * File hook implementations.
8 */
9
10 /**
11 * Implementation of filefield's hook_file_load().
12 */
13 function video_upload_file_load(&$file) {
14 // Load corresponding data from video_upload.
15 $result = db_fetch_object(db_query("SELECT video_id, video_status, video_status_ts FROM {video_upload} WHERE fid = %d", array(':fid' => $file->fid)));
16 foreach (array('video_id', 'video_status', 'video_status_ts') as $key) {
17 $file->$key = $result->$key;
18 }
19 }
20
21 /**
22 * Implementation of filefield's hook_file_insert().
23 */
24 function video_upload_file_insert(&$file) {
25 if (!empty($file->fid) && ($file->field['widget']['type'] == 'video_upload_widget')) {
26 $record = (object) array(
27 'fid' => $file->fid,
28 'video_status' => VIDEO_UPLOAD_STATUS_UPLOAD_PENDING,
29 'video_status_ts' => $_SERVER['REQUEST_TIME'],
30 );
31 drupal_write_record('video_upload', $record);
32 }
33 }
34
35 /**
36 * Implementation of filefield's hook_file_delete().
37 */
38 function video_upload_file_delete($file) {
39 $field = content_fields($file->field_name);
40 $delete = $field['widget']['remove_deleted_videos'];
41 if (isset($file->video_id) && $delete) {
42 $update = array('fid');
43 $file->video_status = VIDEO_UPLOAD_STATUS_DELETE;
44 drupal_write_record('video_upload', $file, $update);
45 }
46 }

  ViewVC Help
Powered by ViewVC 1.1.2