root/trunk/gui/admin/hosting_plan.php

Revision 1372, 5.4 kB (checked in by rats, 1 month ago)

* Added Mailsize function
* Fixed #1594: (CentOS) More perl dependencies on CentOS
* Fixed #1595: (CentOS) CentOS perl docs: Advice to autoconfigure first
* Fixed #1483: Misleading information in INSTALL-files
* Fixed #1512: Subdomains for domain-aliases
* Fixed #1509: New subdomain management system
* Fixed Order delete bug
* Fixed #1507: Some errors on around "Execute Query" option on a database
* Fixed #1511: e-mail aliases & autoreply
* Fixed #1151: Update Hosting Package should only visible for a customer if a hosting plan to update is available (thanks Feg)
* Fixed #1556: Special Characters like Umlauts (äüöÄÜÖ) and Ligatures (ß) in Javascript messages are encoded, wrongly.
* PHPmyAdmin 3.0.0

Line 
1 <?php
2 /**
3  * ispCP ω (OMEGA) a Virtual Hosting Control System
4  *
5  * @copyright     2001-2006 by moleSoftware GmbH
6  * @copyright     2006-2008 by ispCP | http://isp-control.net
7  * @version     SVN: $Id$
8  * @link         http://isp-control.net
9  * @author         ispCP Team
10  *
11  * @license
12  *   This program is free software; you can redistribute it and/or modify it under
13  *   the terms of the MPL General Public License as published by the Free Software
14  *   Foundation; either version 1.1 of the License, or (at your option) any later
15  *   version.
16  *   You should have received a copy of the MPL Mozilla Public License along with
17  *   this program; if not, write to the Open Source Initiative (OSI)
18  *   http://opensource.org | osi@opensource.org
19  */
20
21 // Begin page line
22 require '../include/ispcp-lib.php';
23
24 check_login(__FILE__);
25
26 if (strtolower(Config::get('HOSTING_PLANS_LEVEL')) != 'admin') {
27     header('Location: index.php');
28     die();
29 }
30
31 $tpl = new pTemplate();
32 $tpl->define_dynamic('page', Config::get('ADMIN_TEMPLATE_PATH') . '/hosting_plan.tpl');
33 $tpl->define_dynamic('page_message', 'page');
34 $tpl->define_dynamic('hosting_plans', 'page');
35 // Table with hosting plans
36 $tpl->define_dynamic('hp_table', 'page');
37 $tpl->define_dynamic('hp_entry', 'hp_table');
38 $tpl->define_dynamic('hp_delete', 'page');
39 $tpl->define_dynamic('hp_menu_add', 'page');
40
41 $theme_color = Config::get('USER_INITIAL_THEME');
42
43 $tpl->assign(array(
44     'TR_RESELLER_MAIN_INDEX_PAGE_TITLE' => tr('ispCP - Administrator/Hosting Plan Management'),
45     'THEME_COLOR_PATH' => "../themes/$theme_color",
46     'THEME_CHARSET' => tr('encoding'),
47     'ISP_LOGO' => get_logo($_SESSION['user_id'])
48 ));
49
50 /*
51  *
52  * static page messages.
53  *
54  */
55
56 gen_admin_mainmenu($tpl, Config::get('ADMIN_TEMPLATE_PATH') . '/main_menu_hosting_plan.tpl');
57 gen_admin_menu($tpl, Config::get('ADMIN_TEMPLATE_PATH') . '/menu_hosting_plan.tpl');
58 gen_hp_table($tpl, $_SESSION['user_id']);
59
60 $tpl->assign(
61         array(
62             'TR_HOSTING_PLANS' => tr('Hosting plans'),
63             'TR_PAGE_MENU' => tr('Manage hosting plans'),
64             'TR_PURCHASING' => tr('Purchasing'),
65             'TR_ADD_HOSTING_PLAN' => tr('Add hosting plan'),
66             'TR_TITLE_ADD_HOSTING_PLAN' => tr('Add new user hosting plan'),
67             'TR_BACK' => tr('Back'),
68             'TR_TITLE_BACK' => tr('Return to previous menu'),
69             'TR_MESSAGE_DELETE' => tr('Are you sure you want to delete %s?', true, '%s')
70             )
71         );
72
73 gen_hp_message();
74 gen_page_message($tpl);
75 $tpl->parse('PAGE', 'page');
76 $tpl->prnt();
77
78 // BEGIN FUNCTION DECLARE PATH
79
80 function gen_hp_message () {
81     // global $externel_event, $hp_added, $hp_deleted, $hp_updated;
82     // global $external_event;
83     if (isset($_SESSION["hp_added"]) && $_SESSION["hp_added"] == '_yes_') {
84         // $external_event = '_on_';
85         set_page_message(tr('Hosting plan added!'));
86         unset($_SESSION["hp_added"]);
87         if (isset($GLOBALS['hp_added']))
88             unset($GLOBALS['hp_added']);
89     } else if (isset($_SESSION["hp_deleted"]) && $_SESSION["hp_deleted"] == '_yes_') {
90         // $external_event = '_on_';
91         set_page_message(tr('Hosting plan deleted!'));
92         unset($_SESSION["hp_deleted"]);
93         if (isset($GLOBALS['hp_deleted']))
94             unset($GLOBALS['hp_deleted']);
95     } else if (isset($_SESSION["hp_updated"]) && $_SESSION["hp_updated"] == '_yes_') {
96         // $external_event = '_on_';
97         set_page_message(tr('Hosting plan updated!'));
98         unset($_SESSION["hp_updated"]);
99         if (isset($GLOBALS['hp_updated']))
100             unset($GLOBALS['hp_updated']);
101     } else if (isset($_SESSION["hp_deleted_ordererror"]) && $_SESSION["hp_deleted_ordererror"] == '_yes_') {
102         //$external_event = '_on_';
103         set_page_message(tr('Hosting plan can\'t be deleted, there are orders!'));
104         unset($_SESSION["hp_deleted_ordererror"]);
105     }
106 } // End of gen_hp_message()
107 // Extract and show data for hosting plans
108 function gen_hp_table(&$tpl, $reseller_id) {
109     $sql = Database::getInstance();
110
111     $query = <<<SQL_QUERY
112         SELECT
113             t1.id, t1.reseller_id, t1.name, t1.props, t1.status,
114             t2.admin_id, t2.admin_type
115         FROM
116             hosting_plans AS t1,
117             admin AS t2
118         WHERE
119             t2.admin_type = ?
120         AND
121             t1.reseller_id = t2.admin_id
122         ORDER BY
123             t1.name
124 SQL_QUERY;
125     $rs = exec_query($sql, $query, array('admin'));
126     $tr_edit = tr('Edit');
127
128     if ($rs->RowCount() == 0) {
129         // if ($externel_event == '_off_') {
130         set_page_message(tr('Hosting plans not found!'));
131         // }
132         $tpl->assign('HP_TABLE', '');
133     } else { // There are data for hosting plants :-)
134         /*if ($GLOBALS['external_event'] == '_off_') {
135             $tpl -> assign('HP_MESSAGE', '');
136         }*/
137
138         $tpl->assign(
139                 array(
140                     'TR_HOSTING_PLANS' => tr('Hosting plans'),
141                     'TR_NOM' => tr('No.'),
142                     'TR_EDIT' => $tr_edit,
143                     'TR_PLAN_NAME' => tr('Name'),
144                     'TR_ACTION' => tr('Action')
145                     )
146                 );
147
148         $i = 1;
149
150         while (($data = $rs->FetchRow())) {
151             if ($i % 2 == 0) {
152                 $tpl->assign(array('CLASS_TYPE_ROW' => 'content'));
153             } else {
154                 $tpl->assign(array('CLASS_TYPE_ROW' => 'content2'));
155             }
156             $status = $data['status'];
157             if ($status == 1) {
158                 $status = tr('Enabled');
159             } else {
160                 $status = tr('Disabled');
161             }
162
163             $tpl->assign(
164                     array(
165                         'PLAN_NOM' => $i++,
166                         'PLAN_NAME' => stripslashes($data['name']),
167                         'PLAN_ACTION' => tr('Delete'),
168                         'PLAN_SHOW' => tr('Show hosting plan'),
169                         'PURCHASING' => $status,
170                         'HP_ID' => $data['id'],
171                         'ADMIN_ID' => $_SESSION['user_id']
172                         )
173                     );
174             $tpl->parse('HP_ENTRY', '.hp_entry');
175         } // End  loop
176         $tpl->parse('HP_TABLE', 'hp_table');
177     }
178 } // End of gen_hp_table()
179
180 if (Config::get('DUMP_GUI_DEBUG')) dump_gui_debug();
181
182 unset_messages();
183
184 ?>
185
Note: See TracBrowser for help on using the browser.