source: extensions/AdminTools/include/events.inc.php @ 25619

Last change on this file since 25619 was 25619, checked in by mistic100, 10 years ago
  • display info about current logged user
  • add button to hide the bar
  • fix select boxes
File size: 2.6 KB
Line 
1<?php
2defined('ADMINTOOLS_PATH') or die('Hacking attempt!');
3
4function admintools_add_public_controller()
5{
6  global $MultiView, $conf;
7
8  if (!$MultiView->is_admin())
9  {
10    return;
11  }
12
13  global $template, $page;
14
15  $url_root = get_root_url();
16
17  $tpl_vars = array(
18    'U_SITE_ADMIN' => $url_root . 'admin.php?page=',
19    'MULTIVIEW' => $MultiView->get_data(),
20    'U_SELF' => $MultiView->get_clean_url(true),
21    'USER' => $MultiView->get_user(),
22    );
23
24  // TODO : param to allow owner modification
25  if (script_basename() == 'picture')
26  {
27    global $picture;
28
29    $url_self = duplicate_picture_url();
30
31    $tpl_vars['IS_PICTURE'] = true;
32
33    $template->clear_assign(array(
34      'U_SET_AS_REPRESENTATIVE',
35      'U_PHOTO_ADMIN',
36      'U_CADDIE',
37      ));
38
39    if (isset($page['category']))
40    {
41      $tpl_vars['U_SET_REPRESENTATIVE'] = add_url_params(
42        $url_self,
43        array('action'=>'set_as_representative')
44        );
45      $tpl_vars['CATEGORY_ID'] = $page['category']['id'];
46    }
47
48    $tpl_vars['U_EDIT'] = $url_root . 'admin.php?page=photo-' . $page['image_id']
49      .(isset($page['category']) ? '&amp;cat_id=' . $page['category']['id'] : '');
50
51    $tpl_vars['U_CADDIE'] = add_url_params(
52      $url_self,
53      array('action'=>'add_to_caddie')
54      );
55  }
56  else if (@$page['section'] = 'categories' and isset($page['category']))
57  {
58    $url_self = duplicate_index_url();
59
60    $tpl_vars['IS_CATEGORY'] = true;
61    $tpl_vars['CATEGORY_ID'] = $page['category']['id'];
62
63    $template->clear_assign(array(
64      'U_EDIT',
65      'U_CADDIE',
66      ));
67
68    $tpl_vars['U_EDIT'] = $url_root . 'admin.php?page=album-' . $page['category']['id'];
69
70    if (!empty($page['items']))
71    {
72      $tpl_vars['U_CADDIE'] = add_url_params(
73        $url_self,
74        array('caddie'=>1)
75        );
76    }
77  }
78
79
80  // get users
81  $query = '
82SELECT
83  '.$conf['user_fields']['id'].' AS id,
84  '.$conf['user_fields']['username'].' AS username
85FROM '.USERS_TABLE.'
86  ORDER BY CONVERT('.$conf['user_fields']['username'].', CHAR)
87;';
88  $tpl_vars['USERS'] = simple_hash_from_query($query, 'id', 'username');
89
90  // get themes
91  include_once(PHPWG_ROOT_PATH.'admin/include/themes.class.php');
92  $themes = new themes();
93  foreach (array_keys($themes->fs_themes) as $theme)
94  {
95    $tpl_vars['THEMES'][$theme] = $theme;
96  }
97
98  // get languages
99  foreach (get_languages() as $code => $name)
100  {
101    $tpl_vars['LANGS'][$code] = $name;
102  }
103
104
105  $template->assign(array(
106    'ADMINTOOLS_PATH' => ADMINTOOLS_PATH,
107    'ato' => $tpl_vars,
108  ));
109
110  $template->set_filename('ato', realpath(ADMINTOOLS_PATH . 'template/public_controller.tpl'));
111  $template->parse('ato');
112}
Note: See TracBrowser for help on using the repository browser.