Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

action.php
Go to the documentation of this file.
1 <?php
12 $session = ezcPersistentSessionInstance::get();
13
14 $module = $Params['Module'];
15
16 // new application: create draft, redirect to edit this draft
17 if ( $module->isCurrentAction( 'NewApplication' ) )
18 {
19 $user = eZUser::currentUser();
20 $application = new ezpRestClient();
21 $application->name = ezpI18n::tr( 'extension/oauthadmin', 'New REST application' );
22 $application->version = ezpRestClient::STATUS_DRAFT;
23 $application->owner_id = $user->attribute( 'contentobject_id' );
24 $application->created = time();
25 $application->updated = 0;
26 $application->version = ezpRestClient::STATUS_DRAFT;
27
28 $session->save( $application );
29
30 // The following does not work on PostgreSQL, incorrect id. Probably need refresh from DB.
31 return $module->redirectToView( 'edit', array( $application->id ) );
32 }
33
34 // delete several applications
35 // Used from full view and checkboxes in view list
36 if ( $module->isCurrentAction( 'DeleteApplicationList' ) )
37 {
38 $applicationList = array();
39 $applicationIdList = $module->actionParameter( 'ApplicationIDList' );
40
41 if ( $applicationIdList == null )
42 {
43 return $module->redirectToView( 'list' );
44 }
45
46 foreach ( $applicationIdList as $applicationId )
47 {
48 $applicationList[] = $session->load( 'ezpRestClient', $applicationId );
49 }
50
51 if ( $module->hasActionParameter( 'ConfirmDelete') )
52 {
53 // confirmed, remove the applications
54 foreach ($applicationList as $application)
55 {
56 $session->delete( $application );
57 }
58 return $module->redirectToView( 'list' );
59 }
60 else
61 {
62 // display confirmation request
63 $tpl = eZTemplate::factory();
64 $tpl->setVariable( 'module', $module );
65 $tpl->setVariable( 'applications', $applicationList );
66 $Result['path'] = array( array( 'url' => false,
67 'text' => ezpI18n::tr( 'extension/oauthadmin', 'oAuth admin' ) ),
68 array( 'url' => false,
69 'text' => ezpI18n::tr( 'extension/oauthadmin', 'Confirm removal' ) )
70 );
71
72 $Result['content'] = $tpl->fetch( 'design:oauthadmin/delete_confirmation.tpl' );
73 return $Result;
74 }
75 }
76
77 return $Result;
78 ?>
$Result
if( $module->isCurrentAction( 'NewApplication')) if( $module->isCurrentAction( 'DeleteApplicationList')) return $Result
Definition: action.php:36
$session
$session
Definition: action.php:12
$module
$module
Definition: action.php:14
$application
$application
Definition: authorize.php:51
eZUser\currentUser
static & currentUser()
Definition: ezuser.php:896
ezpRestClient\STATUS_DRAFT
const STATUS_DRAFT
Definition: restclient.php:268
$applicationId
$applicationId
Definition: edit.php:17
ezpRestClient
$def class ezpRestClient
Definition: ezprestclient.php:14
$tpl
$tpl
Definition: mailtofriend.php:58
$user
$user
Definition: user/adlist.php:39
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.