Core  3.2
PHP API documentation
 All Data Structures Namespaces Files Functions Variables Pages
setparamu.php
Go to the documentation of this file.
1 <?php
2 /*
3  * @author Anakeen
4  * @package FDL
5 */
6 /**
7  * Get Values in XML form
8  *
9  * @author Anakeen
10  * @version $Id: setparamu.php,v 1.4 2008/06/10 15:00:14 jerome Exp $
11  * @package FDL
12  * @subpackage FDC
13  */
14 /**
15  */
16 
17 include_once ("Class.Param.php");
18 /**
19  * set an user attribute value
20  * @param Action &$action current action
21  * @global string $appname Http var : application name of the attribute
22  * @global string $parname Http var : parameters name
23  * @global string $parval Http var : new value
24  */
26 {
27  header('Content-type: text/xml; charset=utf-8');
28  $err = '';
29  $mb = microtime();
30  $appname = GetHttpVars("appname");
31  $parname = GetHttpVars("parname");
32 
33  $parval = GetHttpVars("parval");
34 
35  $action->lay->set("warning", "");
36 
37  $appid = $action->parent->GetIdFromName($appname);
38 
39  $pdef = new QueryDb("", "ParamDef");
40  $pdef->AddQuery("name='" . pg_escape_string($parname) . "'");
41  $pdef->AddQuery("isuser='Y'");
42  $pdef->AddQuery("appid=$appid");
43  $list = $pdef->Query(0, 2);
44  if ($pdef->nb == 0) {
45  $err = sprintf(_("Attribute %s not found\n") , $parname);
46  } elseif ($pdef->nb > 1) {
47  $err = sprintf(_("Attribute %s found is not alone\nMust precise request with appname arguments\n") , $parname);
48  } else {
49 
50  $param = new QueryDb("", "Param");
51  $param->AddQuery("name='" . pg_escape_string($parname) . "'");
52  $param->AddQuery("type='" . Param::PARAM_USER . $action->user->id . "'");
53  $param->AddQuery("appid=$appid");
54  $list = $param->Query(0, 1);
55  if ($param->nb == 0) {
56  $p = new Param("");
57  $p->name = $parname;
58  $p->type = Param::PARAM_USER . $action->user->id;
59  $p->appid = $appid;
60  } else {
61  $p = $list[0];
62  }
63 
64  $p->Set($p->name, $parval, $p->type, $p->appid);
65  }
66 
67  if ($err) $action->lay->set("warning", $err);
68 
69  $action->lay->set("CODE", "OK");
70  $action->lay->set("count", 1);
71  $action->lay->set("delay", microtime_diff(microtime() , $mb));
72 }
$appname
global $action
const PARAM_USER
Definition: Class.Param.php:34
microtime_diff($a, $b)
Definition: Lib.Common.php:302
setparamu(Action &$action)
Definition: setparamu.php:25
if($file) if($subject==""&&$file) if($subject=="") $err
$param
Definition: import_size.php:31
← centre documentaire © anakeen