Sub Class_Globals
End Sub
'Initializes the object. You can add parameters to this method if needed.
Public Sub Initialize
End Sub
Sub ExecutePHP(frm As Object, pQuery As Map, JobName As String, phpFile As String, phpTag As String)
Dim job As HttpJob
Dim scommand As String
Dim json As String
job.Initialize(JobName, frm)
job.Tag = phpTag
json = modMashiane.Map2QueryString(pQuery)
If modMashiane.Len(json) = 0 Then
scommand = $"${Starter.phpPath}${phpFile}"$
Else
scommand = $"${Starter.phppath}${phpFile}?${json}"$
End If
job.Download(scommand)
Wait For(job) JobDone(job As HttpJob)
End Sub
Sub GetNearByPlaces(frm As Object, fromLat As String, fromLng As String, radius As String, placeTypes As String, JName As String, JTag As String)
Dim Job As HttpJob
Job.Initialize(JName, frm)
Job.Tag = JTag
Dim sb As StringBuilder
sb.Initialize
sb.Append("https://maps.googleapis.com/maps/api/place/nearbysearch/json?")
sb.append("location=").Append(fromLat).Append(",").Append(fromLng)
sb.append("&radius=").Append(radius)
sb.append("&types=").Append(placeTypes)
sb.append("&sensor=false")
sb.append("&key=" & modMashiane.GooglePlacesApiKey)
Job.Download(sb.tostring)
Wait For(Job) JobDone(Job As HttpJob)
End Sub
Sub DownloadFile(frm As Object, iLink As String, JobName As String, phpTag As String)
Dim job As HttpJob
job.Initialize(JobName, frm)
job.Tag = phpTag
job.Download(iLink)
Wait For(job) JobDone(job As HttpJob)
End Sub
Sub UploadFilePhp(frm As Object, pQuery As Map, dir As String, fil As String, JobName As String, phpFile As String, phpTag As String)
Dim job As HttpJob
Dim fd As MultipartFileData
' initialize the job
job.Initialize(JobName, frm)
job.Tag = phpTag
' initialize the mulipart
fd.Initialize
fd.KeyName = "processfile"
fd.Dir = dir
fd.FileName = fil
' determine the contenttype
If fil.EndsWith(".png") = True Then
fd.ContentType = "image/png"
else If fil.EndsWith(".jpg") = True Then
fd.ContentType = "image/jpeg"
else If fil.EndsWith(".jpeg") = True Then
fd.ContentType = "image/jpeg"
else If fil.EndsWith(".json") = True Then
fd.ContentType = "application/json"
else if fil.EndsWith(".pdf") = True Then
fd.ContentType = "application/pdf"
End If
' execute the script to upload the file
job.PostMultipart(Starter.phpPath & phpFile, pQuery, Array(fd))
Wait For(job) JobDone(job As HttpJob)
End Sub