Platform  3.1
PHP API documentation
 All Data Structures Namespaces Files Functions Variables Pages
modprof.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  * Generated Header (not documented yet)
9  *
10  * @author Anakeen 2000
11  * @version $Id: modprof.php,v 1.17 2007/10/17 12:01:32 eric Exp $
12  * @license http://creativecommons.org/licenses/by-nc-sa/2.0/fr/ Anakeen - licence CC
13  * @package FDL
14  * @subpackage GED
15  */
16 /**
17  */
18 // ---------------------------------------------------------------
19 // $Id: modprof.php,v 1.17 2007/10/17 12:01:32 eric Exp $
20 // $Source: /home/cvsroot/anakeen/freedom/freedom/Action/Freedom/modprof.php,v $
21 // ---------------------------------------------------------------
22 include_once ("FDL/Class.Doc.php");
23 include_once ("FDL/Class.Dir.php");
24 include_once ("FDL/Class.DocAttr.php");
25 include_once ("FDL/freedom_util.php");
26 // -----------------------------------
27 function modprof(&$action)
28 {
29  // -----------------------------------
30 
31  // Get all the params
32  $docid = GetHttpVars("docid");
33  $createp = GetHttpVars("create", 0); // 1 if use for create profile (only for familly)
34  $profid = GetHttpVars("profid");
35  $cvid = GetHttpVars("cvid");
36  $redirid = GetHttpVars("redirid");
37 
38  if ($docid == 0) $action->exitError(_("the document is not referenced: cannot apply profile access modification"));
39 
40  $dbaccess = $action->GetParam("FREEDOM_DB");
41  // initialise object
43  // control modify acl
44  $err = $doc->Control("modifyacl");
45  if ($err != "") $action->ExitError($err);
46 
47  $err = $doc->lock(true); // auto lock
48  if ($err != "") $action->ExitError($err);
49  // test object permission before modify values (no access control on values yet)
50  $err = $doc->canEdit();
51  if ($err != "") $action->ExitError($err);
52 
53  if ($profid == "private") {
54  $prof = getMyProfil($dbaccess);
55  $profid = $prof->id;
56  }
57 
58  if ($createp) {
59  // change creation profile
60  if ($doc->cprofid != $profid) {
61  $doc->AddComment(sprintf(_("Change creation profil to %s [%d]") , $doc->getTitle($profid) , $profid));
62  $doc->cprofid = $profid; // new creation profile access
63 
64  }
65  if ($doc->ccvid != $cvid) {
66  $doc->ccvid = $cvid; // default control view for creation
67  $doc->AddComment(sprintf(_("Change creation view control to %s [%d]") , $doc->getTitle($cvid) , $cvid));
68  }
69  } else {
70 
71  if (($doc->profid == $doc->id) && ($profid == 0)) {
72  // unset control
73  $doc->UnsetControl();
74  }
75  if ($doc->profid != $profid) $doc->AddComment(sprintf(_("Change profil to %s [%d]") , $doc->getTitle($profid) , $profid));
76  if ($doc->cvid != $cvid) $doc->AddComment(sprintf(_("Change view control to %s [%d]") , $doc->getTitle($cvid) , $cvid));
77  $doc->setProfil($profid); // change profile
78  $doc->setCvid($cvid); // change view control
79  // specific control
80  if ($doc->profid == $doc->id) $doc->SetControl();
81 
82  $doc->disableEditControl(); // need because new profil is not enable yet
83 
84  }
85  $err = $doc->Modify();
86 
87  if ($err != "") $action->exitError($err);
88 
89  $doc->unlock(true); // auto unlock
90 
91  if ($redirid) $docid = $redirid;
92  redirect($action, "FDL", "FDL_CARD&props=Y&id=$docid", $action->GetParam("CORE_STANDURL"));
93 }
94 ?>
← centre documentaire © anakeen - published under CC License - Dynacase