root/trunk/gui/reseller/orders.php

Revision 1374, 6.0 kB (checked in by rats, 2 months 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 $tpl = new pTemplate();
27 $tpl->define_dynamic('page', Config::get('RESELLER_TEMPLATE_PATH') . '/orders.tpl');
28 $tpl->define_dynamic('logged_from', 'page');
29 $tpl->define_dynamic('page_message', 'page');
30 // Table with orders
31 $tpl->define_dynamic('orders_table', 'page');
32 $tpl->define_dynamic('order', 'orders_table');
33 // scrolling
34 $tpl->define_dynamic('scroll_prev_gray', 'page');
35 $tpl->define_dynamic('scroll_prev', 'page');
36 $tpl->define_dynamic('scroll_next_gray', 'page');
37 $tpl->define_dynamic('scroll_next', 'page');
38
39 $theme_color = Config::get('USER_INITIAL_THEME');
40
41 $tpl->assign(array('TR_RESELLER_MAIN_INDEX_PAGE_TITLE' => tr('ispCP - Reseller/Order management'),
42         'THEME_COLOR_PATH' => "../themes/$theme_color",
43         'THEME_CHARSET' => tr('encoding'),
44         'ISP_LOGO' => get_logo($_SESSION['user_id'])));
45 // Functions
46 // *
47 // *
48 function gen_order_page (&$tpl, &$sql, $user_id) {
49     $start_index = 0;
50     $current_psi = 0;
51
52     if (isset($_GET['psi']) && is_numeric($_GET['psi'])) {
53         $start_index = $_GET['psi'];
54         $current_psi = $_GET['psi'];
55     }
56
57     $rows_per_page = Config::get('DOMAIN_ROWS_PER_PAGE');
58     // count query
59     $count_query = <<<SQL_QUERY
60                 select
61                     count(id) as cnt
62                 from
63                     orders
64                 where
65                     user_id = ?
66                 and
67                     status != ?
68 SQL_QUERY;
69     // lets count
70     $rs = exec_query($sql, $count_query, array($user_id, 'added'));
71     $records_count = $rs->fields['cnt'];
72
73     $query = <<<SQL_QUERY
74         SELECT
75             *
76         FROM
77             orders
78         WHERE
79             user_id = ?
80           AND
81             status != ?
82         ORDER BY
83             date DESC
84         LIMIT
85             $start_index, $rows_per_page
86 SQL_QUERY;
87     $rs = exec_query($sql, $query, array($user_id, 'added'));
88
89     $prev_si = $start_index - $rows_per_page;
90
91     if ($start_index == 0) {
92         $tpl->assign('SCROLL_PREV', '');
93     } else {
94         $tpl->assign(
95             array('SCROLL_PREV_GRAY' => '',
96                 'PREV_PSI' => $prev_si
97                 )
98             );
99     }
100
101     $next_si = $start_index + $rows_per_page;
102
103     if ($next_si + 1 > $records_count) {
104         $tpl->assign('SCROLL_NEXT', '');
105     } else {
106         $tpl->assign(
107             array('SCROLL_NEXT_GRAY' => '',
108                 'NEXT_PSI' => $next_si
109                 )
110             );
111     }
112
113     if ($rs->RecordCount() == 0) {
114         set_page_message(tr('You do not have new orders!'));
115         $tpl->assign('ORDERS_TABLE', '');
116         $tpl->assign('SCROLL_NEXT_GRAY', '');
117         $tpl->assign('SCROLL_PREV_GRAY', '');
118     } else {
119         $counter = 0;
120         while (!$rs->EOF) {
121             $plan_id = $rs->fields['plan_id'];
122             $order_status = tr('New order');
123             // lets get hosting plan name
124             $planname_query = <<<SQL_QUERY
125         select
126             name
127         from
128             hosting_plans
129         where
130             id = ?
131 SQL_QUERY;
132             $rs_planname = exec_query($sql, $planname_query, array($plan_id));
133             $plan_name = $rs_planname->fields['name'];
134
135             if ($counter % 2 == 0) {
136                 $tpl->assign('ITEM_CLASS', 'content');
137             } else {
138                 $tpl->assign('ITEM_CLASS', 'content2');
139             }
140             $status = $rs->fields['status'];
141             if ($status === 'update') {
142                 $customer_id = $rs->fields['customer_id'];
143                 $cusrtomer_query = <<<SQL_QUERY
144                     select
145                         *
146                     from
147                         admin
148                     where
149                         admin_id = ?
150 SQL_QUERY;
151                 $rs_customer = exec_query($sql, $cusrtomer_query, array($customer_id));
152
153                 $user_details = $rs_customer->fields['fname'] . "&nbsp;" . $rs_customer->fields['lname'] . "<br><a href=\"mailto:" . $rs_customer->fields['email'] . "\" class=\"link\">" . $rs_customer->fields['email'] . "</a><br>" . $rs_customer->fields['zip'] . "&nbsp;" . $rs_customer->fields['city'] . "&nbsp;" . $rs_customer->fields['country'];
154                 $order_status = tr('Update order');
155                 $tpl->assign('LINK', 'orders_update.php?order_id=' . $rs->fields['id']);
156             } else {
157                 $user_details = $rs->fields['fname'] . "&nbsp;" . $rs->fields['lname'] . "<br><a href=\"mailto:" . $rs->fields['email'] . "\" class=\"link\">" . $rs->fields['email'] . "</a><br>" . $rs->fields['zip'] . "&nbsp;" . $rs->fields['city'] . "&nbsp;" . $rs->fields['country'];
158                 $tpl->assign('LINK', 'orders_detailst.php?order_id=' . $rs->fields['id']);
159             }
160             $tpl->assign(
161                 array('ID' => $rs->fields['id'],
162                     'HP' => $plan_name,
163                     'DOMAIN' => $rs->fields['domain_name'],
164                     'USER' => $user_details,
165                     'STATUS' => $order_status,
166                     )
167                 );
168
169             $tpl->parse('ORDER', '.order');
170
171             $rs->MoveNext();
172             $counter ++;
173         }
174     }
175 }
176
177 // end of functions
178
179 /*
180  *
181  * static page messages.
182  *
183  */
184
185 gen_order_page($tpl, $sql, $_SESSION['user_id']);
186
187 gen_reseller_mainmenu($tpl, Config::get('RESELLER_TEMPLATE_PATH') . '/main_menu_orders.tpl');
188 gen_reseller_menu($tpl, Config::get('RESELLER_TEMPLATE_PATH') . '/menu_orders.tpl');
189
190 gen_logged_from($tpl);
191
192 $tpl->assign(array('TR_MANAGE_ORDERS' => tr('Manage Orders'),
193         'TR_ID' => tr('ID'),
194         'TR_DOMAIN' => tr('Domain'),
195         'TR_USER' => tr('Customer data'),
196         'TR_ACTION' => tr('Action'),
197         'TR_STATUS' => tr('Order'),
198         'TR_EDIT' => tr('Edit'),
199         'TR_DELETE' => tr('Delete'),
200         'TR_DETAILS' => tr('Details'),
201         'TR_HP' => tr('Hosting plan'),
202         'TR_MESSAGE_DELETE_ACCOUNT' => tr('Are you sure you want to delete this order?', true),
203         'TR_ADD' => tr('Add/Details')));
204
205 gen_page_message($tpl);
206
207 $tpl->parse('PAGE', 'page');
208 $tpl->prnt();
209
210 if (Config::get('DUMP_GUI_DEBUG'))
211     dump_gui_debug();
212
213 unset_messages();
214
215 ?>
216
Note: See TracBrowser for help on using the browser.