17 include_once (
'Class.Log.php');
18 include_once (
'Class.DbObj.php');
19 include_once (
'Class.ParamDef.php');
21 define(
"PARAM_APP",
"A");
23 define(
"PARAM_GLB",
"G");
25 define(
"PARAM_USER",
"U");
27 define(
"PARAM_STYLE",
"S");
58 name varchar(50) not null,
62 create index paramv_idx2 on paramv(name);
63 create unique index paramv_idx3 on paramv(name,type,appid);
70 if (strpos($this->
name,
" ") != 0) {
71 return _(
"Parameter name does not include spaces");
77 $opd =
new Paramdef();
88 $this->buffer = array_merge($this->buffer, $this->
GetAll(
$appid, $userid, $styleid));
95 $action->parent->session->unregister(
"sessparam" .
$appid);
103 if ($pdef && $pdef->isAffected()) {
104 if ($pdef->isglob ==
'Y') {
110 $paramt =
new Param($this->dbaccess, array(
115 if ($paramt->isAffected())
$err = $this->Modify();
123 $paramo =
new Param($this->dbaccess, array(
128 if ($paramo->isAffected()) $paramo->delete();
138 else unset($this->buffer[
$name]);
143 require_once (
'WHAT/Class.ApplicationParameterManager.php');
148 if (isset($this->buffer[
$name])) {
149 return ($this->buffer[$name]);
158 $psize =
new Param($this->dbaccess, array(
164 if ($psize->val !=
'')
$size = $psize->val;
165 else $size =
'normal';
170 $styleIdPG = pg_escape_string($styleid);
171 $sql = sprintf(
"select distinct on(paramv.name) paramv.* from paramv left join paramdef on (paramv.name=paramdef.name) where
172 (paramv.type = '%s') OR (paramv.appid=%d and (paramv.type='%s' or paramv.type='%s%d' or paramv.type='%s%s')) OR (paramdef.isglob='Y' and (paramv.type='%s%d' or paramv.type='%s%s')) OR
173 (paramv.type='%s%s') order by paramv.name, paramv.type desc",
self::PARAM_GLB,
$appid,
self::PARAM_APP,
self::PARAM_USER, $userid,
self::PARAM_STYLE, $styleIdPG,
self::PARAM_USER, $userid,
self::PARAM_STYLE, $styleIdPG,
self::PARAM_STYLE, pg_escape_string(
$size));
175 $sql = sprintf(
"SELECT * from paramv where type='G' or (type='A' and appid=%d);",
$appid);
179 foreach (
$list as $v) {
180 $out[$v[
"name"]] = $v[
"val"];
183 $this->log->debug(
"$appid no constant define for this application");
192 $tlist =
$query->Query(0, 0,
"TABLE",
"select distinct on(paramv.name, paramv.appid) paramv.*, paramdef.descr, paramdef.kind from paramv, paramdef where paramv.name = paramdef.name and paramdef.isuser='Y' and (" .
" (type = '" .
self::PARAM_GLB .
"') " .
" OR (type='" .
self::PARAM_APP .
"')" .
" OR (type='" .
self::PARAM_STYLE . $styleid .
"' )" .
" OR (type='" .
self::PARAM_USER . $userid .
"' ))" .
" order by paramv.name, paramv.appid, paramv.type desc");
207 $tlist =
$query->Query(0, 0,
"TABLE");
209 $tlist =
$query->Query(0, 0,
"TABLE",
"select distinct on(paramv.name, paramv.appid) paramv.*, paramdef.descr, paramdef.kind from paramv, paramdef where paramv.name = paramdef.name and paramdef.isstyle='Y' and (" .
" (type = '" .
self::PARAM_GLB .
"') " .
" OR (type='" .
self::PARAM_APP .
"')" .
" OR (type='" .
self::PARAM_STYLE . $styleid .
"' ))" .
" order by paramv.name, paramv.appid, paramv.type desc");
218 $tlist =
$query->Query(0, 0,
"TABLE",
"select paramv.*, paramdef.descr, paramdef.kind from paramv, paramdef where paramv.name = paramdef.name and (" .
" (type = '" .
self::PARAM_GLB .
"') " .
" OR (type='" .
self::PARAM_APP .
"'))" .
" order by paramv.appid, paramv.name, type desc");
226 $req =
"select val from paramv where name='" . $p .
"' and type='U" . $u .
"' and appid=" .
$appid .
";";
228 $tlist =
$query->Query(0, 0,
"TABLE", $req);
229 if (
$query->nb != 0)
return $tlist[0][
"val"];
237 $sql = sprintf(
"select paramv.* from paramv, paramdef where paramdef.name=paramv.name and paramdef.kind='static' and paramdef.isuser!='Y' and paramv.appid=%d",
$appid);
245 foreach (
$list as $k => $v) {
247 if (isset($this->buffer[$v->name])) unset($this->buffer[$v->name]);
254 if (isset($this->buffer[$this->
name])) unset($this->buffer[$this->name]);
261 $query->Query(0, 0,
"TABLE",
"delete from paramv where appid not in (select id from application) ");
static _catchDeprecatedGlobalParameter($parameterName)
print $fam getTitle() $fam name
Add($nopost=false, $nopre=false)
GetStyle($styleid, $onlystyle=false)
GetAll($appid="", $userid, $styleid="0")
static getParamDef($name, $appid=null)
Set($name, $val, $type=self::PARAM_GLB, $appid= '')
SetKey($appid, $userid, $styleid="0")
GetUParam($p, $u=Account::ANONYMOUS_ID, $appid="")
if(($docid!==0)&&(!is_numeric($docid))) $query
simpleQuery($dbaccess, $query, &$result=array(), $singlecolumn=false, $singleresult=false, $useStrict=null)
if($file) if($subject==""&&$file) if($subject=="") $err
GetUser($userid=Account::ANONYMOUS_ID, $styleid="")