This repository was archived by the owner on Jul 17, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadmin_acad_manages_talks_action_update.php
77 lines (66 loc) · 2.23 KB
/
admin_acad_manages_talks_action_update.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
<?php
include_once 'check_access_permissions.php';
mustHaveAnyOfTheseRoles( array( 'AWS_ADMIN', 'BOOKMYVENUE_ADMIN' ) );
include_once 'header.php';
include_once 'database.php';
include_once 'mail.php';
include_once 'tohtml.php';
if( ! $_POST[ 'response' ] )
{
// Go back to previous page.
goToPage( "admin_acad.php", 0 );
exit;
}
else if( $_POST[ 'response' ] == 'submit' )
{
$res = updateTable( 'talks', 'id'
, 'class,host,coordinator,title,description'
, $_POST
);
if( $res )
{
echo printInfo( 'Successfully updated entry' );
// TODO: Update the request or event associated with this entry as well.
$externalId = getTalkExternalId( $_POST );
$talk = getTableEntry( 'talks', 'id', $_POST );
assert( $talk );
$success = true;
$event = getEventsOfTalkId( $_POST[ 'id' ] );
$request = getBookingRequestOfTalkId( $_POST[ 'id' ] );
if( $event )
{
echo printInfo( "Updating event related to this talk" );
$event[ 'title' ] = talkToEventTitle( $talk );
$event[ 'description' ] = $talk[ 'description' ];
$res = updateTable( 'events', 'gid,eid', 'title,description', $event );
if( $res )
echo printInfo( "... Updated successfully" );
else
$success = false;
}
else if( $request )
{
echo printInfo( "Updating booking request related to this talk" );
$request[ 'title' ] = talkToEventTitle( $talk );
$request[ 'description' ] = $talk[ 'description' ];
$res = updateTable( 'bookmyvenue_requests', 'gid,eid'
, 'title,description', $request );
if( $res )
echo printInfo( "... Updated successfully" );
else
$success = false;
}
if( $success )
{
echo goToPage( 'admin_acad_manages_talks.php' , 0 );
exit;
}
}
else
echo printWarning( "Failed to update the talk " );
}
else
echo printInfo( "Unknown operation " . $_POST[ 'response' ] );
echo goBackToPageLink( 'admin_acad_manages_talks.php', "Go back" );
exit;
?>