Core  3.2
PHP API documentation
 All Data Structures Namespaces Files Functions Variables Pages
freedom_access.php
Go to the documentation of this file.
1 <?php
2 /*
3  * @author Anakeen
4  * @package FDL
5 */
6 /**
7  * Generated Header (not documented yet)
8  *
9  * @author Anakeen
10  * @version $Id: freedom_access.php,v 1.7 2005/06/28 08:37:46 eric Exp $
11  * @package FDL
12  * @subpackage GED
13  */
14 /**
15  */
16 // ---------------------------------------------------------------
17 // $Id: freedom_access.php,v 1.7 2005/06/28 08:37:46 eric Exp $
18 // $Source: /home/cvsroot/anakeen/freedom/freedom/Action/Freedom/freedom_access.php,v $
19 // ---------------------------------------------------------------
20 include_once ("FDL/Class.Doc.php");
21 include_once "FDL/editutil.php";
22 // -----------------------------------
24 {
25  // -----------------------------------
26  // export all selected card in a tempory file
27  // this file is sent by dowload
28  // -----------------------------------
29  // Get all the params
30  $dbaccess = $action->dbaccess;
31  $docid = $action->getArgument("id");
32  $userId = $action->getArgument("userid");
33  if (!$userId) {
34  $duid = $action->getArgument("_userid");
35  if ($duid) {
36  $userId = User::getUidFromFid($duid);
37  }
38  }
39  if (!$userId) {
40  $userId = $action->user->id;
41  }
42 
44  // test if current user can view ACL
45  $err = $doc->Control("viewacl");
46  if ($err != "") $action->exitError($err);
47  editmode($action);
48  $action->lay->Set("title", $doc->getHtmlTitle());
49  // contruct user id list
50  $ouser = new Account('', $userId);
51  if (!$ouser->isAffected()) $action->exitError(sprintf(_("unknow user #%s") , $userId));
52  $tiduser = $ouser->GetUserAndGroupList();
53 
54  $action->lay->Set("docid", $doc->id);
55  $action->lay->Set("userid", $ouser->id);
56 
57  $action->lay->Set("toProfil", $doc->getDocAnchor($doc->id, 'account', true, false, false, 'latest', true));
58  if ($doc->dprofid) {
59  $action->lay->Set("dynamic", true);
60  $action->lay->Set("dprofid", $doc->dprofid);
61  $action->lay->Set("ComputedFrom", _("Computed from profil"));
62  $action->lay->Set("toDynProfil", $doc->getHTMLTitle($doc->dprofid));
63  } elseif ($doc->profid != $doc->id) {
64  $action->lay->Set("dynamic", true);
65  $action->lay->Set("dprofid", $doc->profid);
66  $action->lay->Set("ComputedFrom", _("Linked from profil"));
67  $action->lay->Set("toDynProfil", $doc->getHTMLTitle($doc->profid));
68  } else {
69  $action->lay->Set("dynamic", false);
70  }
71  if ($doc->isRealProfile()) {
72  $action->lay->Set("profprefix", _("Profile of"));
73  $origin = $action->lay->get("toProfil");
74  $action->lay->Set("toProfil", preg_replace('/href="([^"]*)"/', 'href="?app=FREEDOM&action=FREEDOM_GACCESS&id=' . $doc->id . '"', $origin));
75  } else {
76  $action->lay->Set("profprefix", _("Document Profile"));
77  }
78 
79  $action->lay->Set("fid", $doc->getDocAnchor($ouser->fid, 'account', true, false, false, 'latest', true));
80  $action->lay->Set("userid", ($userId == 1) ? $tiduser[0]->id : $userId);
81  $action->lay->Set("username", User::getDisplayName($userId));
82 }
global $action
Set($name, &$parent)
exitError($texterr, $exit=true, $code="")
$docid
Definition: cleanFamily.php:13
freedom_access(Action &$action)
static getDisplayName($uid)
static getUidFromFid($fid)
new_Doc($dbaccess, $id= '', $latest=false)
static getArgument($k, $def= '')
editmode(Action &$action)
Definition: editutil.php:41
$dbaccess
Definition: checkVault.php:17
if($file) if($subject==""&&$file) if($subject=="") $err
← centre documentaire © anakeen