source: extensions/scheduler/include/admin_events.inc.php @ 19482

Last change on this file since 19482 was 19482, checked in by plg, 11 years ago

fix a few notices

File size: 1.7 KB
Line 
1<?php
2defined('SCHEDULER_PATH') or die('Hacking attempt!');
3
4/**
5 * add a tab on photo properties page
6 */
7function scheduler_tabsheet_before_select($sheets, $id)
8{
9  if ($id == 'photo')
10  {
11    $sheets['scheduler'] = array(
12      'caption' => l10n('Scheduler'),
13      'url' => SCHEDULER_ADMIN.'-photo&amp;image_id='.$_GET['image_id'],
14      );
15  }
16 
17  return $sheets;
18}
19
20/**
21 * add a prefilter on photo edit page
22 */
23function scheduler_picture_edit_prefilter($content)
24{
25  $search = 'selected=$level_options_selected}';
26  $replace = 'selected=$level_options_selected_scheduler}';
27
28  return str_replace($search, $replace, $content);
29}
30
31function scheduler_photo_edit_replace_level()
32{
33  global $page, $template;
34
35  if (!isset($_GET['page']))
36  {
37    return;
38  }
39
40  if ($_GET['page'] != 'photo')
41  {
42    return;
43  }
44
45  if (isset($_GET['tab']) and $_GET['tab'] != 'properties')
46  {
47    return;
48  }
49 
50  // is the current photo on schedule?
51  $query = '
52SELECT *
53  FROM '.SCHEDULER_TABLE.'
54  WHERE image_id = '.$_GET['image_id'].'
55;';
56  $scheduler = pwg_db_fetch_assoc(pwg_query($query));
57
58  if (!isset($scheduler['scheduled_for']))
59  {
60    return;
61  }
62   
63  if (isset($_POST['submit']))
64  {
65    // we have to change the level in the scheduler table
66    single_update(
67      SCHEDULER_TABLE,
68      array('level' => $_POST['level']),
69      array('image_id' => $_GET['image_id'])
70      );
71
72    $scheduler['level'] = $_POST['level'];
73
74    // then picture_modify.php will update IMAGES_TABLE to level 32 (=scheduled)
75    $_POST['level'] = 32;
76  }
77 
78  $template->set_prefilter('picture_modify', 'scheduler_picture_edit_prefilter');
79   
80  $template->assign('level_options_selected_scheduler', array($scheduler['level']));
81}
82?>
Note: See TracBrowser for help on using the repository browser.