Platform  3.1
PHP API documentation
 All Data Structures Namespaces Files Functions Variables Pages
opendoc.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  * Open Document
9  *
10  * @author Anakeen 2000
11  * @version $Id: $
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.Doc.php");
20 /**
21  * open in edit mode if can else in view mode
22  * all parameters use in GENERIC_GENERIC_EDIT can be use in edit mode
23  * all parameters use in FDL:FDL_CARD can be use in view mode
24  * @param Action &$action current action
25  * @global id Http var : document identificator to see
26  * @global mode Http var : edit or view mode
27  *
28  */
29 function opendoc(Action & $action)
30 {
31  $docid = $action->getArgument("id");
32  $mode = $action->getArgument("mode", "none");
33 
34  if ($mode == "none") {
35  if (!$docid) {
36  $famid = $action->getArgument("famid", $action->getArgument("classid"));
37  if ($famid) {
38  $mode = "new";
39  }
40  } else {
41  $dbaccess = $action->GetParam("FREEDOM_DB");
42  $doc = new_doc($dbaccess, $docid, true);
43  if ($doc->control('edit') == "") {
44  $mode = 'edit';
45  } else if ($doc->control('view') == "") {
46  $mode = 'view';
47  }
48  }
49  }
50  switch ($mode) {
51  case 'new':
52  case 'edit':
53  $action->parent->set("GENERIC", $action->parent->parent);
54  $action->set("GENERIC_EDIT", $action->parent);
55  $action->execute();
56  break;
57 
58  case 'view':
59  $action->set("FDL_CARD", $action->parent);
60  $action->execute();
61  break;
62  }
63 }
64 ?>
← centre documentaire © anakeen - published under CC License - Dynacase