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

Last change on this file since 24349 was 24182, checked in by mistic100, 11 years ago

remove php end tags, remove at symbol in template, add example of class handlers, remove useless files

File size: 1.9 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  array_push($menu, array(
10    'NAME' => l10n('Skeleton'),
11    'URL' => SKELETON_ADMIN,
12  ));
13  return $menu;
14}
15
16/**
17 * add a tab on photo properties page
18 */
19function skeleton_tabsheet_before_select($sheets, $id)
20{
21  if ($id == 'photo')
22  {
23    $sheets['skeleton'] = array(
24      'caption' => l10n('Skeleton'),
25      'url' => SKELETON_ADMIN.'-photo&amp;image_id='.$_GET['image_id'],
26      );
27  }
28 
29  return $sheets;
30}
31
32/**
33 * add a prefilter to the Batch Downloader
34 */
35function skeleton_add_batch_manager_prefilters($prefilters)
36{
37        array_push($prefilters, array(
38    'ID' => 'skeleton',
39    'NAME' => l10n('Skeleton'),
40  ));
41        return $prefilters;
42}
43
44/**
45 * perform added prefilter
46 */
47function skeleton_perform_batch_manager_prefilters($filter_sets, $prefilter)
48{
49  if ($prefilter == 'skeleton')
50  {
51    $query = '
52SELECT id
53  FROM '.IMAGES_TABLE.'
54  ORDER BY RAND()
55  LIMIT 20
56;';
57    $filter_sets[] = array_from_query($query, 'id');
58  }
59 
60        return $filter_sets;
61}
62
63/**
64 * add an action to the Batch Manager
65 */
66function skeleton_loc_end_element_set_global()
67{
68        global $template;
69 
70        $template->append('element_set_global_plugins_actions', array(
71    'ID' => 'skeleton', 
72    'NAME' => l10n('Skeleton'), 
73    'CONTENT' => '<label><input type="checkbox" name="check_skeleton"> '.l10n('Check me!').'</label>', // this is optional
74    ));
75}
76
77/**
78 * perform added action
79 */
80function skeleton_element_set_global_action($action, $collection)
81{
82        if ($action == 'skeleton')
83  {
84    global $page;
85   
86    if (empty($_POST['check_skeleton']))
87    {
88      array_push($page['warnings'], l10n('Nothing appened, but you didn\'t check the box!'));
89    }
90    else
91    {
92      array_push($page['infos'], l10n('Nothing appened, but you checked the box!'));
93    }
94  }
95}
Note: See TracBrowser for help on using the repository browser.