forked from bitweaver/nlpg
-
Notifications
You must be signed in to change notification settings - Fork 1
/
load_ons.php
66 lines (56 loc) · 1.42 KB
/
load_ons.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
<?php
/*
* Created on 5 Jan 2008
*
* To change the template for this generated file go to
* Window - Preferences - PHPeclipse - PHP - Code Templates
*/
// Initialization
require_once( '../kernel/setup_inc.php' );
require_once(NLPG_PKG_PATH.'BitNlpg.php' );
// Is package installed and enabled
$gBitSystem->verifyPackage('nlpg' );
// Now check permissions to access this page
$gBitSystem->verifyPermission('p_nlpg_admin' );
$nlpg = new BitNlpg();
//$listnlpg = $nlpg->getList( $_REQUEST );
$nlpg->OnsExpunge();
$row = 0;
$handle = fopen("data/Local_Authorities.csv", "r");
if ( $handle == FALSE) {
$row = -999;
} else {
while (($data = fgetcsv($handle, 400, ",")) !== FALSE) {
$row++;
$nlpg->OnsLARecordLoad( $data );
}
fclose($handle);
}
$gBitSmarty->assign( 'local', $row );
$row = 0;
$handle = fopen("data/Ward.csv", "r");
if ( $handle == FALSE) {
$row = -999;
} else {
while (($data = fgetcsv($handle, 4000, ",")) !== FALSE) {
$row++;
$nlpg->OnsWardRecordLoad( $data );
}
fclose($handle);
}
$gBitSmarty->assign( 'ward', $row );
$row = 0;
$handle = fopen("data/Parish.csv", "r");
if ( $handle == FALSE) {
$row = -999;
} else {
while (($data = fgetcsv($handle, 4000, ",")) !== FALSE) {
$row++;
$nlpg->OnsParishRecordLoad( $data );
}
fclose($handle);
}
$gBitSmarty->assign( 'parish', $row );
$nlpg->OnsRecordsFix();
$gBitSystem->display( 'bitpackage:nlpg/load_ons.tpl', tra( 'Load results: ' ) );
?>