Quick Search:

View

Revision:

Diff

Diff from 1850 to:

Annotations

Annotate by Age | Author | Mixed | None
/fisheye/browse/osCommerce/branches/hpdl/oscommerce/admin/includes/applications/administrators/pages/batch_edit.php

Annotated File View

hpdl
1125
1 <?php
2 /*
3   $Id: batch_edit.php 1850 2009-02-28 03:07:56Z hpdl $
4
5   osCommerce, Open Source E-Commerce Solutions
6   http://www.oscommerce.com
7
hpdl
1446
8   Copyright (c) 2007 osCommerce
hpdl
1125
9
hpdl
1497
10   This program is free software; you can redistribute it and/or modify
11   it under the terms of the GNU General Public License v2 (1991)
12   as published by the Free Software Foundation.
hpdl
1125
13 */
14
15   $osC_DirectoryListing = new osC_DirectoryListing('includes/modules/access');
16   $osC_DirectoryListing->setIncludeDirectories(false);
17
18   $access_modules_array = array();
19
20   foreach ($osC_DirectoryListing->getFiles() as $file) {
21     $module = substr($file['name'], 0, strrpos($file['name'], '.'));
22
23     if (!class_exists('osC_Access_' . ucfirst($module))) {
hpdl
1472
24       $osC_Language->loadIniFile('modules/access/' . $file['name']);
hpdl
1125
25       include($osC_DirectoryListing->getDirectory() . '/' . $file['name']);
26     }
27
28     $module = 'osC_Access_' . ucfirst($module);
29     $module = new $module();
30
31     $access_modules_array[osC_Access::getGroupTitle( $module->getGroup() )][] = array('id' => $module->getModule(),
32                                                                                       'text' => $module->getTitle());
33   }
34
35   ksort($access_modules_array);
36 ?>
37
hpdl
1405
38 <h1><?php echo osc_link_object(osc_href_link_admin(FILENAME_DEFAULT, $osC_Template->getModule()), $osC_Template->getPageTitle()); ?></h1>
hpdl
1125
39
40 <?php
41   if ($osC_MessageStack->size($osC_Template->getModule()) > 0) {
hpdl
1845
42     echo $osC_MessageStack->get($osC_Template->getModule());
hpdl
1125
43   }
44 ?>
45
hpdl
1475
46 <div class="infoBoxHeading"><?php echo osc_icon('edit.png') . ' ' . $osC_Language->get('action_heading_batch_edit_administrators'); ?></div>
hpdl
1125
47 <div class="infoBoxContent">
hpdl
1405
48   <form name="aEditBatch" action="<?php echo osc_href_link_admin(FILENAME_DEFAULT, $osC_Template->getModule() . '&page=' . $_GET['page'] . '&action=batchSave'); ?>" method="post">
hpdl
1125
49
hpdl
1446
50   <p><?php echo $osC_Language->get('introduction_batch_edit_administrators'); ?></p>
hpdl
1125
51
52 <?php
53   $Qadmins = $osC_Database->query('select id, user_name from :table_administrators where id in (":id") order by user_name');
54   $Qadmins->bindTable(':table_administrators', TABLE_ADMINISTRATORS);
55   $Qadmins->bindRaw(':id', implode('", "', array_unique(array_filter(array_slice($_POST['batch'], 0, MAX_DISPLAY_SEARCH_RESULTS), 'is_numeric'))));
56   $Qadmins->execute();
57
58   $names_string = '';
59
60   while ($Qadmins->next()) {
61     $names_string .= osc_draw_hidden_field('batch[]', $Qadmins->valueInt('id')) . '<b>' . $Qadmins->value('user_name') . '</b>, ';
62   }
63
64   if ( !empty($names_string) ) {
hpdl
1200
65     $names_string = substr($names_string, 0, -2);
hpdl
1125
66   }
67
68   echo '<p>' . $names_string . '</p>';
69
hpdl
1446
70   echo '<p>' . osc_draw_radio_field('mode', array(array('id' => OSC_ADMINISTRATORS_ACCESS_MODE_ADD, 'text' => $osC_Language->get('add_to')), array('id' => OSC_ADMINISTRATORS_ACCESS_MODE_REMOVE, 'text' => $osC_Language->get('remove_from')), array('id' => OSC_ADMINISTRATORS_ACCESS_MODE_SET, 'text' => $osC_Language->get('set_to'))), OSC_ADMINISTRATORS_ACCESS_MODE_ADD) . '</p>';
hpdl
1125
71
72   echo '<ul style="list-style-type: none; padding-left: 0;">' .
hpdl
1446
73        '  <li>' . osc_draw_checkbox_field('modules[]', '*', null, 'id="access_globaladmin"') . '&nbsp;<label for="access_globaladmin"><b>' . $osC_Language->get('global_access') . '</b></label></li>' .
hpdl
1125
74        '</ul>' .
75        '<ul style="list-style-type: none; padding-left: 0;">';
76
77   foreach ( $access_modules_array as $group => $modules ) {
78     echo '  <li><b>' . $group . '</b>' .
79          '    <ul style="list-style-type: none; padding-left: 15px;">';
80
81     foreach ($modules as $module) {
82       echo '      <li>' . osc_draw_checkbox_field('modules[]', $module['id'], null, 'id="access_' . $module['id'] . '"') . '&nbsp;<label for="access_' . $module['id'] . '" class="fieldLabel">' . $module['text'] . '</label></li>';
83     }
84
85     echo '    </ul>' .
86          '  </li>';
87   }
88
89   echo '</ul>';
90 ?>
91
hpdl
1475
92   <p align="center"><?php echo osc_draw_hidden_field('subaction', 'confirm') . '<input type="submit" value="' . $osC_Language->get('button_save') . '" class="operationButton" /> <input type="button" value="' . $osC_Language->get('button_cancel') . '" onclick="document.location.href=\'' . osc_href_link_admin(FILENAME_DEFAULT, $osC_Template->getModule() . '&page=' . $_GET['page']) . '\';" class="operationButton" />'; ?></p>
hpdl
1125
93
94   </form>
95 </div>