Platform  3.1
PHP API documentation
 All Data Structures Namespaces Files Functions Variables Pages
editinsertdocument.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  * Interface to inser document in folder
9  *
10  * @author Anakeen 2007
11  * @version $Id: editinsertdocument.php,v 1.3 2008/06/03 10:12:21 eric Exp $
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 ("FDL/Class.Dir.php");
20 /**
21  * View a document
22  * @param Action &$action current action
23  * @global id Http var : folder document identificator to see
24  * @global famid Http var : family to use for search
25  */
27 {
28 
29  $docid = GetHttpVars("id");
30  $famid = GetHttpVars("famid");
31  $dbaccess = $action->GetParam("FREEDOM_DB");
32 
33  if ($docid == "") $action->exitError(_("no document reference"));
34  if (!is_numeric($docid)) $docid = getIdFromName($dbaccess, $docid);
35  if (intval($docid) == 0) $action->exitError(sprintf(_("unknow logical reference '%s'") , GetHttpVars("id")));
37  if (!$doc->isAffected()) $action->exitError(sprintf(_("cannot see unknow reference %s") , $docid));
38  if ($doc->defDoctype != 'D') $action->exitError(sprintf(_("not a static folder %s") , $doc->title));
39  $err = $doc->canModify();
40  if ($err != "") $action->exitError($err);
41  $action->parent->AddJsRef($action->GetParam("CORE_PUBURL") . "/FDC/Layout/inserthtml.js");
42  $action->parent->AddJsRef($action->GetParam("CORE_STANDURL") . "app=FDL&action=EDITJS");
43  $action->parent->AddJsRef($action->GetParam("CORE_PUBURL") . "/FDL/Layout/editinsertdocument.js");
44  $action->parent->AddJsRef($action->GetParam("CORE_JSURL") . "/resizeimg.js");
45 
46  $l = $doc->getContent();
47  foreach ($l as $k => $v) {
48  $l[$k]["icon"] = $doc->getIcon($v["icon"]);
49  }
50 
51  $action->lay->set("restrict", false);
52 
53  if (!$famid) {
54  if (method_exists($doc, "isAuthorized")) {
55  if ($doc->isAuthorized($classid)) {
56  // verify if classid is possible
57  if ($doc->hasNoRestriction()) $tclassdoc = GetClassesDoc($dbaccess, $action->user->id, $classid, "TABLE");
58  else {
59  $tclassdoc = $doc->getAuthorizedFamilies();
60  $action->lay->set("restrict", true);
61  }
62  } else {
63  $tclassdoc = $doc->getAuthorizedFamilies();
64  $first = current($tclassdoc);
65  $famid = $first["id"];
66  $action->lay->set("restrict", true);
67  }
68  } else {
69  $tclassdoc = GetClassesDoc($dbaccess, $action->user->id, $classid, "TABLE");
70  }
71  $action->lay->SetBlockData("SELECTCLASS", $tclassdoc);
72 
73  $action->lay->SetBlockData("SELECTCLASS", $tclassdoc);
74  $action->lay->set("famid", false);
75  } else {
76  $action->lay->set("famid", $famid);
77 
79  $action->lay->set("famicon", $fdoc->getIcon());
80  $action->lay->set("famtitle", sprintf(_("Search %s") , $fdoc->title));
81  }
82  $action->lay->set("docid", $doc->id);
83  $fdoc = $doc->getFamDoc();
84  $action->lay->set("classtitle", $fdoc->title);
85  $action->lay->set("iconsrc", $doc->getIcon());
86  $action->lay->set("TITLE", sprintf(_("Content managing of %s") , $doc->title));
87  $action->lay->set("version", $doc->version);
88  $action->lay->set("hasstate", ($doc->getState() != ""));
89  $action->lay->set("state", $doc->getState());
90  $action->lay->set("statecolor", $doc->getStateColor());
91  $action->lay->set("count", count($l));
92 
93  $action->lay->setBlockData("CONTENT", $l);
94  $action->lay->set("nmembers", sprintf(_("%d documents") , count($l)));
95 }
96 ?>
← centre documentaire © anakeen - published under CC License - Dynacase