source: extensions/skeleton/trunk/include/admin_events.inc.php @ 28650

Last change on this file since 28650 was 28650, checked in by mistic100, 10 years ago

update for 2.7

File size: 2.1 KB
Line 
1<?php
2defined('SKELETON_PATH') or die('Hacking attempt!');
3
4/**
5 * admin plugins menu link
6 */
7function skeleton_admin_plugin_menu_links($menu)
8{
9  $menu[] = array(
10    'NAME' => l10n('Skeleton'),
11    'URL' => SKELETON_ADMIN,
12    );
13
14  return $menu;
15}
16
17/**
18 * add a tab on photo properties page
19 */
20function skeleton_tabsheet_before_select($sheets, $id)
21{
22  if ($id == 'photo')
23  {
24    $sheets['skeleton'] = array(
25      'caption' => l10n('Skeleton'),
26      'url' => SKELETON_ADMIN.'-photo&amp;image_id='.$_GET['image_id'],
27      );
28  }
29
30  return $sheets;
31}
32
33/**
34 * add a prefilter to the Batch Downloader
35 */
36function skeleton_add_batch_manager_prefilters($prefilters)
37{
38  $prefilters[] = array(
39    'ID' => 'skeleton',
40    'NAME' => l10n('Skeleton'),
41    );
42
43  return $prefilters;
44}
45
46/**
47 * perform added prefilter
48 */
49function skeleton_perform_batch_manager_prefilters($filter_sets, $prefilter)
50{
51  if ($prefilter == 'skeleton')
52  {
53    $query = '
54SELECT id
55  FROM '.IMAGES_TABLE.'
56  ORDER BY RAND()
57  LIMIT 20
58;';
59    $filter_sets[] = query2array($query, null, 'id');
60  }
61
62  return $filter_sets;
63}
64
65/**
66 * add an action to the Batch Manager
67 */
68function skeleton_loc_end_element_set_global()
69{
70  global $template;
71
72  /*
73    CONTENT is optional
74    for big contents it is advised to use a template file
75
76    $template->set_filename('skeleton_batchmanager_action', realpath(SKELETON_PATH.'template/batchmanager_action.tpl'));
77    $content = $template->parse('skeleton_batchmanager_action', true);
78   */
79  $template->append('element_set_global_plugins_actions', array(
80    'ID' => 'skeleton',
81    'NAME' => l10n('Skeleton'),
82    'CONTENT' => '<label><input type="checkbox" name="check_skeleton"> '.l10n('Check me!').'</label>',
83    ));
84}
85
86/**
87 * perform added action
88 */
89function skeleton_element_set_global_action($action, $collection)
90{
91  global $page;
92
93  if ($action == 'skeleton')
94  {
95    if (empty($_POST['check_skeleton']))
96    {
97      $page['warnings'][] = l10n('Nothing appened, but you didn\'t check the box!');
98    }
99    else
100    {
101      $page['infos'][] = l10n('Nothing appened, but you checked the box!');
102    }
103  }
104}
Note: See TracBrowser for help on using the repository browser.