17 include_once (
"GENERIC/generic_edit.php");
32 $docid = GetHttpVars(
"id", 0);
33 $classid = GetHttpVars(
"classid", 0);
34 $dirid = GetHttpVars(
"dirid", 0);
35 $usefor = GetHttpVars(
"usefor");
36 $onlysubfam = GetHttpVars(
"onlysubfam");
37 $alsosub = (GetHttpVars(
"alsosubfam",
"N") ==
"Y");
38 $type = GetHttpVars(
"type",
"");
42 else $classid = abs($classid);
43 setHttpVar(
"classid", $classid);
45 $tmpDoc =
createDoc($action->dbaccess, $classid);
46 $isSystemDoc = (is_object($tmpDoc) && substr($tmpDoc->usefor, 0, 1) ==
'S');
52 $fdoc =
$doc->getFamilyDocument();
53 $tclassdoc[
$doc->fromid] = array(
55 "title" => $fdoc->getTitle()
64 if (method_exists(
$dir,
"isAuthorized")) {
67 if (
$dir->isAuthorized($classid)) {
69 if ((
$dir->hasNoRestriction()) || (!$classid)) {
71 }
else $tclassdoc =
$dir->getAuthorizedFamilies();
73 $tclassdoc =
$dir->getAuthorizedFamilies();
74 $first = current($tclassdoc);
75 $classid = abs($first[
"id"]);
76 setHttpVar(
"classid", abs($classid));
89 $tsub = $cdoc->GetChildFam($cdoc->id,
true);
91 $tclassdoc[$classid] = array(
93 "title" => $cdoc->getTitle()
95 $tclassdoc = array_merge($tclassdoc, $tsub);
99 $first = current($tclassdoc);
100 if ($classid ==
"") $classid = $first[
"id"];
101 setHttpVar(
"classid", abs($classid));
110 if (($classid == 0) && (
$docid != 0)) $classid =
$doc->fromid;
111 setHttpVar(
"forcehead",
"yes");
115 $selectclass = array();
119 foreach ($tclassdoc as $k => $cdoc) {
120 if ($cdoc[
"id"] == $classid) $first =
true;
121 $selectclass[$k][
"idcdoc"] = $cdoc[
"id"];
123 $selectclass[$k][
"selected"] =
"";
127 $first = current($tclassdoc);
128 $classid = $first[
"id"];
129 setHttpVar(
"classid", abs($classid));
135 $selectclass[$k + 1][
"idcdoc"] =
"0";
136 $selectclass[$k + 1][
"classname"] = _(
"no document type");
141 $action->lay->
Set(
"refreshfld",
"yes");
154 if ($usefor ==
"D") $action->lay->
Set(
"TITLE", _(
"default values"));
157 if (
$doc ===
false) $action->
exitError(sprintf(_(
"no privilege to create this kind (%d) of document") , $classid));
160 foreach ($selectclass as $k => $cdoc) {
161 $tfid[] = abs($cdoc[
"idcdoc"]);
164 foreach ($selectclass as $k => $cdoc) {
165 if (!in_array(abs($cdoc[
"idcdoc"]) , $tfid)) unset($selectclass[$k]);
169 foreach ($selectclass as $k => $cdoc) {
170 if ($classid == abs($cdoc[
"idcdoc"])) {
171 $selectclass[$k][
"selected"] =
"selected";
175 if (!
$doc->isAlive()) $action->ExitError(_(
"document not referenced"));
177 foreach ($selectclass as $k => $cdoc) {
178 if (
$doc->fromid == abs($selectclass[$k][
"idcdoc"])) {
179 $selectclass[$k][
"selected"] =
"selected";
184 $action->lay->eSet(
"id",
$docid);
185 $action->lay->eSet(
"dirid",
$dirid);
186 $action->lay->eSet(
"onlysubfam", $onlysubfam);
187 $action->lay->eSet(
"alsosubfam", GetHttpVars(
"alsosubfam"));
190 uasort($selectclass,
"cmpselect");
191 $action->lay->SetBlockData(
"SELECTCLASS", $selectclass);
193 $action->lay->
Set(
"boverdisplay",
"none");
197 return strcasecmp(
$a[
"classname"], $b[
"classname"]);
getSystemFamilies($dbaccess, $userid, $qtype="TABLE")
print< H1 > Check Database< i > $dbaccess</i ></H1 > $a
getNonSystemFamilies($dbaccess, $userid, $qtype="TABLE")
exitError($texterr, $exit=true, $code="")
GetClassesDoc($dbaccess, $userid, $classid=0, $qtype="LIST", $extraFilters=array())
freedom_edit(Action &$action)
createDoc($dbaccess, $fromid, $control=true, $defaultvalues=true, $temporary=false)
getFamilyCreationIds($dbaccess, $uid, $tfid=array())
getFamIdFromName($dbaccess, $name)
getFamiliesWithTypeOrClassId($dbaccess, $userid, $type, $classid, $qtype)
new_Doc($dbaccess, $id= '', $latest=false)
static getLangTitle($values)
generic_edit(Action &$action)