Skip to content

Commit c13dab8

Browse files
author
root
committed
New changes
1 parent 34240a0 commit c13dab8

37 files changed

+6961
-94
lines changed

application/controllers/admin/reports.php

+50-2
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public function index($page = 1)
5353
array_push($params, 'i.incident_status = 0');
5454
}
5555
elseif($status == 't') {
56-
array_push($params, 'i.incident_status = 2');
56+
array_push($params, 'i.incident_verified = 1 AND i.incident_status < 3');
5757
}
5858
elseif($status == 'f') {
5959
array_push($params, 'i.incident_status = 3');
@@ -1268,8 +1268,56 @@ public function translate( $id = false, $saved = FALSE)
12681268
// Javascript Header
12691269
$this->template->js = new View('admin/reports_translate_js');
12701270
}
1271+
1272+
/*
1273+
* Should be in simple groups but it isn't.
1274+
*/
1275+
public function remove_group() {
1276+
$this->auto_render = FALSE;
1277+
$this->template = '';
1278+
json_encode('moo');
1279+
if($_POST) {
1280+
// Instantiate Validation, use $post, so we don't overwrite $_POST fields with our own things
1281+
$post = Validation::factory($_POST);
1282+
$post->pre_filter('trim', TRUE);
1283+
// Add rules
1284+
$post->add_rules('incident_id', 'required');
1285+
$post->add_rules('group_id', 'required');
1286+
1287+
if($post->validate()) {
1288+
$incident = ORM::factory('simplegroups_groups_incident')
1289+
->where(array('incident_id' => $post['incident_id'], 'simplegroups_groups_id' => $post['group_id']))
1290+
->delete_all();
1291+
}
1292+
}
1293+
}
12711294

1272-
1295+
/*
1296+
* Change report status, based on drop-down list
1297+
* Currently only works for post
1298+
*/
1299+
public function change_status($form_id = 0, $incident_id = 0, $status = 0) {
1300+
$this->auto_render = FALSE;
1301+
$this->template = "";
1302+
1303+
if($_POST) {
1304+
// Instantiate Validation, use $post, so we don't overwrite $_POST fields with our own things
1305+
$post = Validation::factory($_POST);
1306+
$post->pre_filter('trim', TRUE);
1307+
// Add rules
1308+
$post->add_rules('incident_id', 'required');
1309+
$post->add_rules('status', 'required');
1310+
1311+
if($post->validate()) {
1312+
$incident = ORM::factory('incident', $_POST['incident_id']);
1313+
// Only if the incident exists
1314+
if($incident->id) {
1315+
$incident->incident_status = $_POST['status'];
1316+
$incident->save();
1317+
}
1318+
}
1319+
}
1320+
}
12731321

12741322

12751323
/**
+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
$(function() {
2+
function removeAssignment(incident_id) {
3+
console.log('yes');
4+
}
5+
});
6+
7+
/*jQuery.post("/admin/simplegroups/reports/remove_group", {pid: page_id, gid: group_id},
8+
function(data) {
9+
console.log(data);
10+
}); */

application/views/reports_submit_edit_js.php

+5-10
Original file line numberDiff line numberDiff line change
@@ -860,16 +860,11 @@ function updateFeature(feature, color, strokeWidth){
860860
feature.layer.drawFeature(feature);
861861
}
862862

863-
function changeStatus(form_id, incident_id) {
864-
var answer = confirm('Are you sure you want to change the status of this form?');
865-
if(answer) {
866-
$.post("<?php echo url::base() . 'admin/simplegroups/reports/change_status' ?>", { form_id: form_id, incident_id: incident_id },
867-
function(data){
868-
if (data.status == 'success'){
869-
870-
}
871-
}, "json");
872-
}
863+
function changeStatus(status, incident_id) {
864+
$.post("<?php echo url::base() . 'admin/reports/change_status' ?>", { status: status, incident_id: incident_id },
865+
function(data){
866+
console.log(data);
867+
}, "json");
873868
}
874869

875870
// Reverse GeoCoder
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
<?php
2+
/*
3+
Name: EsendexAccountEventHandler.php
4+
Description: HTTP Form Post account event handler for PHP
5+
Documentation: https://www.esendex.com/secure/messenger/formpost/AccountEventHandler.aspx
6+
7+
Copyright (c) 2007 Esendex®
8+
9+
If you have any questions or comments, please contact:
10+
11+
12+
http://www.esendex.com/support
13+
14+
Detail:
15+
This code can be used as a base for creating a Form Post PHP Account Event Handler. Place code
16+
in the TODO sections to handle the different notifications as required.
17+
18+
Once you have deployed the page you need to specify the URL to it in the Options page of your
19+
account. This piece of code will give you a page that can accept posts that are FormPostVersion2.
20+
*/
21+
22+
$username = GetFormVariable( "username" ) ;
23+
$password = GetFormVariable( "password" ) ;
24+
25+
/*
26+
* TODO: Authenticate user and password if required.
27+
*/
28+
29+
$notificationType = GetFormVariable( "notificationType" ) ;
30+
31+
switch ( $notificationType )
32+
{
33+
case "MessageReceived":
34+
HandleMessageReceived();
35+
break ;
36+
37+
case "MessageEvent" :
38+
HandleMessageEvent() ;
39+
break ;
40+
41+
case "MessageError" :
42+
HandleMessageError() ;
43+
break ;
44+
45+
case "SubscriptionEvent" :
46+
HandleSubscriptionEvent() ;
47+
break ;
48+
49+
default :
50+
/*
51+
* The page received an unhandled type.
52+
*
53+
* TODO: Add code to report unhandled types if required.
54+
*/
55+
break;
56+
}
57+
58+
/*
59+
* Retrieves the form variable with the given name, returning
60+
* the defaultValue if the form variable is not set.
61+
*
62+
* Set $echoValue to true ONLY for testing. If set to true the value
63+
* read will be output.
64+
*/
65+
function GetFormVariable( $formName, $defaultValue = "", $echoValue = false )
66+
{
67+
$returnedValue = ( isset( $_POST[$formName] ) ) ? $_POST[$formName] : $defaultValue;
68+
69+
if ( $echoValue )
70+
{
71+
echo $formName." = [".$returnedValue."]";
72+
}
73+
74+
return $returnedValue;
75+
}
76+
77+
// MessageReceived event.
78+
function HandleMessageReceived()
79+
{
80+
$inboundMessageID = GetFormVariable( "id" );
81+
$originator = GetFormVariable( "originator" );
82+
$recipient = GetFormVariable( "recipient" );
83+
$body = GetFormVariable( "body" );
84+
$messageType = GetFormVariable( "type" );
85+
$receivedAt = GetFormVariable( "receivedAt" );
86+
87+
/*
88+
* TODO: Add code for when a message is received.
89+
*/
90+
}
91+
92+
// MessageEvent event.
93+
function HandleMessageEvent()
94+
{
95+
$eventMessageID = GetFormVariable( "id" );
96+
$eventType = GetFormVariable( "eventType" );
97+
$eventOccurredAt = GetFormVariable( "occurredAt" );
98+
99+
/*
100+
* TODO: Add code for when a message event is fired.
101+
*/
102+
}
103+
104+
// MessageError event.
105+
function HandleMessageError()
106+
{
107+
$errorMessageID = GetFormVariable( "id" );
108+
$errorType = GetFormVariable( "errorType" );
109+
$errorOccurredAt = GetFormVariable( "occurredAt" );
110+
$errorDetail = GetFormVariable( "detail" );
111+
112+
/*
113+
* TODO: Add code to handle message errors.
114+
*/
115+
}
116+
117+
// Subscription event.
118+
function HandleSubscriptionEvent()
119+
{
120+
$mobileNumber = GetFormVariable( "mobileNumber" );
121+
$contactID = GetFormVariable( "contactID" );
122+
$subcriptionEventOccurredAt = GetFormVariable( "occurredAt" );
123+
$eventType = GetFormVariable( "eventType" );
124+
125+
/*
126+
* TODO: Add code to handle premium rate subscription events
127+
* (Only needed for premium rate accounts).
128+
*/
129+
}
130+
131+
?>

0 commit comments

Comments
 (0)