17 include_once (
'FDL/Class.PFam.php');
25 create table docfam (cprofid int ,
36 usedocread int) inherits (doc);
37 create unique index idx_idfam on docfam(id);";
63 foreach ($this->addfields as $f) $this->fields[$f] = $f;
68 if ($include && ($this->
id > 0) && ($this->
isAffected())) {
71 include_once (
"FDL$GEN/Class.$adoc.php");
73 $this->attributes =
new $adoc();
74 uasort($this->attributes->attr,
"tordered");
79 return _(
"cannot delete family");
88 $r = $this->name .
'#title';
90 if ($i !=
$r)
return $i;
96 $r = $values[
"name"] .
'#title';
98 if ($i !=
$r)
return $i;
99 return $values[
"title"];
103 include_once (
"FDL/Lib.Attr.php");
109 if ($cdoc->isAlive()) {
110 if (!$this->ccvid) $this->ccvid = $cdoc->ccvid;
111 if (!$this->cprofid) $this->cprofid = $cdoc->cprofid;
112 if (!$this->defval) $this->defval = $cdoc->defval;
113 if (!$this->schar) $this->schar = $cdoc->schar;
121 if ($this->usefor ==
'W') {
122 $w =
createDoc($this->dbaccess, $this->
id);
124 if (method_exists($w,
"createProfileAttribute")) {
125 $w->createProfileAttribute();
136 $this->lay->set(
"modifyacl", ($this->control(
"modifyacl") ==
""));
137 $this->lay->set(
"canInitProfil", $action->HasPermission(
"FREEDOM_ADMIN",
"FREEDOM"));
139 foreach ($this->fields as $k => $v) {
141 $this->lay->set(
"$v", $this->$v ? $this->$v :
false);
147 $this->lay->set(
"cmodifyacl", (
$tdoc->control(
"modifyacl") ==
""));
149 $this->lay->set(
"cproftitle",
$tdoc->title);
150 $this->lay->set(
"cprofdisplay",
"");
151 $hascontrol = ($this->
controlUserId($this->$v, $this->userid,
"modifyacl") ==
"");
152 $this->lay->set(
"ca_" . $v, $hascontrol);
154 $this->lay->set(
"cprofdisplay",
"none");
161 $this->lay->set(
"cfldtitle",
$tdoc->title);
162 $this->lay->set(
"cflddisplay",
"");
164 $this->lay->set(
"cflddisplay",
"none");
171 $this->lay->set(
"dfldtitle",
$tdoc->title);
172 $this->lay->set(
"dflddisplay",
"");
174 $this->lay->set(
"dflddisplay",
"none");
181 $this->lay->set(
"wtitle",
$tdoc->title);
182 $this->lay->set(
"wdisplay",
true);
183 $this->lay->set(
"wactif", (
$tdoc->profid > 0));
184 $hascontrol = (
$tdoc->control(
"modifyacl") ==
"");
185 $this->lay->set(
"wcontrol", $hascontrol);
186 $this->lay->set(
"wedit", (
$tdoc->control(
"edit") ==
""));
189 $tnoprofilstates = array();
191 $pid =
$tdoc->getStateProfil($st);
193 $pdoc = new_doc($this->dbaccess, $pid);
194 $tstates[$pid][
"smodifyacl"] = ($pdoc->control(
"modifyacl") ==
"");
195 $tstates[$pid][
"sactif"] = $pdoc->profid;
196 $tstates[$pid][
"pstateid"] = $pid;
197 $tstates[$pid][
"states"][] = _($st);
199 $tnoprofilstates[_($st) ] = array(
200 "pstateattrid" =>
$tdoc->getStateProfilAttribute($st) ,
206 $this->lay->set(
"noprofilstate", implode(
", ", array_keys($tnoprofilstates)));
207 foreach ($tstates as $k => $v) {
208 $tstates[$k][
"states"] = implode(
", ", $v[
"states"]);
210 $this->lay->setBlockData(
"pstate", $tstates);
211 $this->lay->setBlockData(
"nopstate", $tnoprofilstates);
213 $this->lay->set(
"wdisplay",
false);
220 $this->lay->set(
"cvtitle",
$tdoc->title);
221 $this->lay->set(
"cvdisplay",
"");
223 $this->lay->set(
"cvdisplay",
"none");
228 $this->lay->set(
"forum", ($this->forumid ==
"" ? _(
"disable forum") : _(
"enable forum")));
232 if (!$this->maxrev) {
233 if ($this->schar ==
'S') $this->lay->set(
"maxrevision", _(
"no revisable"));
234 else $this->lay->set(
"maxrevision", _(
"unlimited revisions"));
235 }
else $this->lay->set(
"maxrevision", $this->maxrev);
252 return $this->
getXValue(
"param", $idp, $def);
274 if ($index == - 1)
return $t;
275 if (isset(
$t[$index]))
return $t[$index];
287 if (is_array($val)) $val = $this->
_array2val($val);
288 return $this->
setXValue(
"param", $idp, $val);
301 return $this->
getXValue(
"defval", $idp, $def);
320 return $this->
setXValue(
"defval", $idp, $val);
334 if (!isset($this->$tval)) $this->
getXValues($X);
336 $tval2 = $this->$tval;
337 $v = $tval2[strtolower($idp) ];
338 if ($v !=
"")
return $v;
351 $tdefattr = explode(
"][", substr($defval, 1, strlen($defval) - 2));
352 $this->$tval = array();
355 foreach ($tdefattr as $k => $v) {
357 $aid = substr($v, 0, strpos($v,
'|'));
358 $dval = substr(strstr($v,
'|') , 1);
360 $txval[$aid] = $dval;
362 $this->$tval = $txval;
375 if (is_array($val)) $val = $this->
_array2val($val);
377 if (!isset($this->$tval)) $this->
getXValues($X);
378 $txval = $this->$tval;
379 $txval[strtolower($idp) ] = $val;
380 $this->$tval = $txval;
383 foreach ($txval as $k => $v) {
384 if ($k && ($v !==
'')) $tdefattr[] =
"$k|$v";
387 $this->$X =
"[" . implode(
"][", $tdefattr) .
"]";
399 foreach ($fa as $aid => $oattr) {
400 if ($oattr->inArray()) {
407 foreach (
$ta as $k => $v) {
416 foreach ($tvid as $k => $vid) {
418 $dvi->vaultid = $vid;
425 if (is_resource($stream) && get_resource_type($stream) ==
"stream") {
429 while (!feof($stream)) {
430 if (
false === fwrite($tmpstream, fread($stream, 4096))) {
431 $err =
"403 Forbidden";
437 $err =
$vf->Retrieve($vid, $info);
448 if (!$this->_configuration) {
450 $dxml =
new DomDocument();
451 $famfile =
DEFAULT_PUBDIR . sprintf(
"/families/%s.fam", $this->name);
452 if (!@$dxml->load($famfile)) {
457 $properties = $dxml->getElementsByTagName(
'property');
458 foreach ($properties as $prop) {
459 $name = $prop->getAttribute(
'name');
460 $value = $prop->nodeValue;
463 $views = $dxml->getElementsByTagName(
'view');
464 foreach ($views as $view) {
465 $name = $view->getAttribute(
'name');
466 foreach ($view->attributes as
$a) {
467 $o->views[
$name][$a->name] = $a->value;
471 $this->_configuration =
$o;
474 return $this->_configuration;
480 $lay->set(
"famname", strtolower($this->name));
481 $lay->set(
"famtitle", strtolower($this->
getTitle()));
482 $lay->set(
"includefdlxsd", file_get_contents(
getLayoutFile(
"FDL",
"fdl.xsd")));
488 foreach (
$la as $k => $v) {
489 if ((!$v) || ($v->getOption(
"autotitle") ==
"yes") || ($v->usefor ==
'Q')) unset(
$la[$k]);
491 foreach (
$la as $k => $v) {
492 if (($v->id !=
"FIELD_HIDDENS") && ($v->type ==
'frame' || $v->type ==
"tab") && ((!$v->fieldSet) || $v->fieldSet->id ==
"FIELD_HIDDENS")) {
497 "tax" => $v->getXmlSchema(
$la)
505 $lay->setBlockData(
"ATTR", $tax);
506 $lay->setBlockData(
"LEVEL1", $level1);
507 return ($lay->gen());