-
Notifications
You must be signed in to change notification settings - Fork 0
/
account_list_import.php
192 lines (152 loc) · 7.72 KB
/
account_list_import.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
<?php
require(__DIR__.'/source/main.php');
// Prepare redirect url with variables.
$url_query = new \dc\url\URLFix;
// User access.
$access_obj = new \dc\dc\stoeckl\status();
$access_obj->get_config()->set_authenticate_url(APPLICATION_SETTINGS::DIRECTORY_PRIME);
$access_obj->get_config()->set_database($yukon_database);
$access_obj->set_redirect($url_query->return_url());
$access_obj->verify();
$access_obj->action();
// Start page cache.
$page_obj = new \dc\cache\PageCache();
// Set up navigaiton.
$navigation_obj = new class_navigation();
$navigation_obj->generate_markup_nav();
$navigation_obj->generate_markup_footer();
// Set up database.
$db_conn_set = new ConnectConfig();
$db_conn_set->set_name(DATABASE::NAME);
$db = new Connect($db_conn_set);
$query = new \dc\yukon\Database($db);
$paging = new \dc\recordnav\Paging();
$paging->set_row_max(APPLICATION_SETTINGS::PAGE_ROW_MAX);
$query->set_sql('{call account_list(@page_current = ?,
@page_rows = ?)}');
$params = array(array($paging->get_page_current(), SQLSRV_PARAM_IN),
array(1000, SQLSRV_PARAM_IN));
$query->set_param_array($params);
$query->query_run();
$query->get_line_config()->set_class_name('\data\Account');
$_obj_data_main_list = $query->get_line_object_list();
// --Paging
$query->get_next_result();
$query->get_line_config()->set_class_name('\dc\recordnav\Paging');
//$_obj_data_paging = new \dc\recordnav\Paging();
if($query->get_row_exists()) $paging = $query->get_line_object();
?>
<!DOCtype html>
<html lang="en">
<head>
<meta charset="utf-8" name="viewport" content="width=device-width, initial-scale=1" />
<title><?php echo APPLICATION_SETTINGS::NAME; ?></title>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
<link rel="stylesheet" href="source/css/style.css" />
<link rel="stylesheet" href="source/css/print.css" media="print" />
<!-- jQuery library -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<!-- Latest compiled JavaScript -->
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
</head>
<body>
<div id="container" class="container">
<?php echo $navigation_obj->get_markup_nav(); ?>
<div class="page-header">
<h1>Accounts</h1>
<p>Accounts allow clients to log into application, and are given levels of access based on assigned roles. The following is a list of accounts.</p>
</div>
<a href="account.php?nav_command=<?php echo \dc\recordnav\COMMANDS::NEW_BLANK;?>&id=<?php echo \dc\yukon\DEFAULTS::NEW_ID; ?>" class="btn btn-success btn-block" title="Click here to start entering a new account."><span class="glyphicon glyphicon-plus"></span> New Account</a>
<!--div class="table-responsive"-->
<table class="table table-striped table-hover">
<caption></caption>
<thead>
<tr>
<th>Account</th>
<th>Name</th>
<th>Notes</th>
<th><!--Action--></th>
</tr>
</thead>
<tfoot>
</tfoot>
<tbody>
<?php
$account_lookup = new \dc\dc\stoeckl\lookup();
if(is_object($_obj_data_main_list) === TRUE)
{
for($_obj_data_main_list->rewind(); $_obj_data_main_list->valid(); $_obj_data_main_list->next())
{
$_obj_data_main = $_obj_data_main_list->current();
if($_obj_data_main->get_notes() == '')
{
$account_lookup->access_lookup($_obj_data_main->get_account());
// Call update stored procedure.
$query->set_sql('{call account_update(@id = ?,
@account = ?,
@department = ?,
@notes = ?,
@name_f = ?,
@name_l = ?,
@name_m = ?,
@sub_role_xml = ?,
@log_update_by = ?,
@log_update_ip = ?)}');
$params = array(array($_obj_data_main->get_id(), SQLSRV_PARAM_IN),
array($_obj_data_main->get_account(), SQLSRV_PARAM_IN),
array($_obj_data_main->get_department(), SQLSRV_PARAM_IN),
array($_obj_data_main->get_notes(), SQLSRV_PARAM_IN),
array($account_lookup->get_access_data_account()->get_name_f(), SQLSRV_PARAM_IN),
array($account_lookup->get_access_data_account()->get_name_l(), SQLSRV_PARAM_IN),
array($account_lookup->get_access_data_account()->get_name_m(), SQLSRV_PARAM_IN),
array(NULL, SQLSRV_PARAM_IN),
array($access_obj->get_id(), SQLSRV_PARAM_IN),
array($access_obj->get_ip(), SQLSRV_PARAM_IN));
$query->set_param_array($params);
$query->query_run();
// Insert the roles.
$query->set_sql("INSERT INTO tbl_account_role (fk_id, role) VALUES (?, ?)");
$params = array(array($_obj_data_main->get_id(), SQLSRV_PARAM_IN),
array('cd0a6b6c-ed15-40c0-95be-cbf0953a593e', SQLSRV_PARAM_IN));
$query->set_param_array($params);
$query->query_run();
}
?>
<tr>
<td><?php echo $_obj_data_main->get_account(); ?></td>
<td><?php if($_obj_data_main->get_name_l()) echo $_obj_data_main->get_name_l().', '.$_obj_data_main->get_name_f(); ?></td>
<td><?php echo $_obj_data_main->get_notes(); ?></td>
<td><a href ="account.php?id=<?php echo $_obj_data_main->get_id(); ?>"
class ="btn btn-info"
title ="View details or edit this item."
><span class="glyphicon glyphicon-eye-open"></span></a></td>
</tr>
<?php
}
}
?>
</tbody>
</table>
<?php
echo $paging->generate_paging_markup();
echo $navigation_obj->get_markup_footer();
?>
</div><!--container-->
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-40196994-1', 'uky.edu');
ga('send', 'pageview');
$(document).ready(function(){
$('[data-toggle="tooltip"]').tooltip();
});
</script>
</body>
</html>
<?php
// Collect and output page markup.
echo $page_obj->markup_and_flush();
?>