-
Notifications
You must be signed in to change notification settings - Fork 0
/
import.php
110 lines (95 loc) · 2.79 KB
/
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
<?php
ini_set ("display_errors", "1");
error_reporting(E_ALL);
// start the session managment
session_start();
// INCLUDE FILES
include_once 'functions.php';
if(isset($_POST['submit'])) {
// get credentials to login
$user = htmlspecialchars($_POST['username']);
$password = htmlspecialchars($_POST['password']);
$user = 'jsposato';
$password = 'codiesassy';
// setup the soap client
$forge_soap_url = "https://forge.ctrip.ufl.edu:443/soap/index.php?wsdl";
$soapClient = new SoapClient($forge_soap_url);
// check to see if we can login
$sessionKey = doLogin($soapClient,$user,$password);
if($sessionKey != null) {
$_SESSION['sessionId'] = $sessionKey;
}
//print "isLoggedIn?: ".isLoggedIn($_SESSION['sessionId'])."<br>";
print "Forge API Version: ".$soapClient->version()."<br>";
// Init variables
$intGroupId = 0;
$intGroupProjectId = 0;
$strSummary = "";
$strDetails = "";
$intPriority = 0;
$intHours = 0;
$intStartDate = 0;
$intEndDate = 0;
$intCategoryId = 0;
$intPercentComplete = 0;
$arrAssignedTo = 0;
$arrDependentOn = 0;
$intDuration = 0; // Not sure what this is for
$intParentId = 0;
echo "<pre>";
print_r($_FILES);
echo "</pre>";
$file = getUploadFile($_FILES);
// open the file for reading
$filehandle = fopen($file,"r");
// read until end of file
while($line=fgetcsv($filehandle)) {
// skip the header line
if("group_id" == $line[0]) {
continue;
}
$intGroupId = $line[0];
$intGroupProjectId = $line[1];
$strSummary = $line[2];
$strDetails = $line[3];
$intPriority = $line[4];
$intHours = $line[5];
$intStartDate = strtotime($line[6]);
$intEndDate = strtotime($line[7]);
// if there's not category, set the default of 100 ('None')
$intCategoryId = ("" == $line[8]) ? 100:$line[8];
$intPercentComplete = $line[9];
$arrAssignedTo = explode("|",$line[10]);
$arrDependentOn = explode("|",$line[11]);
$intDuration = 0; // Not sure what this is for
$intParentId = $line[13];
echo "<pre>";
print_r($line);
echo "</pre>";
/*try {
$taskId = $soapClient->addProjectTask($_SESSION['sessionId'],
$intGroupId,
$intGroupProjectId,
$strSummary,
$strDetails,
$intPriority,
$intHours,
$intStartDate,
$intEndDate,
$intCategoryId,
$intPercentComplete,
$arrAssignedTo,
$arrDependentOn,
$intDuration,
$intParentId);
echo "Task # ".$taskId." created<br>";
} catch (Exception $e) {
echo $e->getMessage();
}*/
}
// close file
fclose($filehandle);
// logout
doLogout($soapClient,$_SESSION['sessionId']);
}
?>