Platform
3.1
PHP API documentation
Main Page
Related Pages
Namespaces
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Pages
application.php
Go to the documentation of this file.
1
<?php
2
/*
3
* @author Anakeen
4
* @license http://creativecommons.org/licenses/by-nc-sa/2.0/fr/ Anakeen - licence CC
5
* @package FDL
6
*/
7
/**
8
* Aplication Api access
9
*
10
* @author Anakeen 2009
11
* @version $Id: $
12
* @license http://creativecommons.org/licenses/by-nc-sa/2.0/fr/ Anakeen - licence CC
13
* @package FDL
14
* @subpackage
15
*/
16
/**
17
*/
18
19
include_once (
"DATA/Class.Application.php"
);
20
/**
21
* Display info before download
22
* @param Action &$action current action
23
* @global id Http var : document for file to edit (SIMPLEFILE family)
24
*/
25
function
application
(&
$action
)
26
{
27
$id
= getHttpVars(
"id"
);
28
$method
= getHttpVars(
"method"
);
29
$err
=
""
;
30
31
$out
=
false
;
32
switch
(strtolower(
$method
)) {
33
case
'getparameter'
:
34
$appName = getHttpVars(
"name"
);
35
$err
=
initTheApplication
(
$action
, $appName, $ou);
36
if
($ou)
$out
= $ou->getParameter(
$id
);
37
break
;
38
39
case
'setparameter'
:
40
$appName = getHttpVars(
"name"
);
41
$nv
= getHttpVars(
"value"
);
42
$err
=
initTheApplication
(
$action
, $appName, $ou);
43
if
($ou)
$out
= $ou->setParameter(
$id
,
$nv
);
44
break
;
45
46
case
'getexecutableactions'
:
47
$appName = getHttpVars(
"name"
);
48
$err
=
initTheApplication
(
$action
, $appName, $ou);
49
if
(
$out
) {
50
$out
[
"actions"
] = $ou->getexecutableactions($actionName);
51
}
52
break
;
53
54
case
'get'
:
55
$appName = getHttpVars(
"name"
);
56
$err
=
initTheApplication
(
$action
, $appName, $ou);
57
if
(
$err
) {
58
$out
->error = sprintf(_(
"application %s not defined"
) , $appName);
59
}
else
{
60
$out
= $ou->getApplication();
61
}
62
63
break
;
64
65
default
:
66
$out
->error = sprintf(_(
"method %s not defined"
) ,
$method
);
67
}
68
69
$action
->lay->noparse =
true
;
// no need to parse after - increase performances
70
$action
->lay->template = json_encode(
$out
);
71
}
72
73
function
initTheApplication
(&
$action
, $appName, &$fdlapp)
74
{
75
if
($appName) {
76
$gapp =
new
Application
();
77
$gapp->set($appName,
$action
->parent->parent,
''
,
false
);
78
if
($gapp->id) {
79
$fdlapp =
new
Fdl_Application
($gapp);
80
}
else
{
81
$err
= sprintf(_(
"application %s not defined"
) , $appName);
82
}
83
}
else
{
84
$err
= _(
"application name not set"
);
85
}
86
return
$err
;
87
}
88
?>
← centre documentaire
© anakeen
- published under
CC License
-
Dynacase