Core  3.2
PHP API documentation
 All Data Structures Namespaces Files Functions Variables Pages
fdl_getvalue.php
Go to the documentation of this file.
1 <?php
2 /*
3  * @author Anakeen
4  * @package FDL
5 */
6 /**
7  * View Document
8  *
9  * @author Anakeen
10  * @version $Id: fdl_getvalue.php,v 1.1 2005/07/28 16:47:51 eric Exp $
11  * @package FDL
12  * @subpackage
13  */
14 /**
15  */
16 
17 include_once ("FDL/Class.Dir.php");
18 /**
19  * View a document
20  * @param Action &$action current action
21  * @global string $docid Http var : document identifier to see
22  * @global string $latest Http var : (Y|N) if Y force view latest revision
23  * @global string $attrid Http var : the attribute id to see
24  */
26 {
27  // -----------------------------------
28  $docid = $action->getArgument("id");
29  $latest = $action->getArgument("latest", "Y");
30  $attrid = $action->getArgument("attrid");
31  $dbaccess = $action->dbaccess;
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'") , $docid));
37  if (!$doc->isAffected()) $action->exitError(sprintf(_("cannot see unknow reference %s") , $docid));
38 
39  if (($latest == "Y") && ($doc->locked == - 1)) {
40  // get latest revision
41  $docid = $doc->getLatestId();
43  }
44  $err = $doc->control("view");
45  if ($err != "") $action->exitError($err);
46 
47  $a = $doc->getAttribute($attrid);
48  if ($a) {
49  if ($a->mvisibility != "I") $v = $doc->getRawValue($attrid);
50  else $v = sprintf("no privilege to access attribute [%s] for document %s |%d]", $attrid, $doc->title, $doc->id);
51  } else {
52  $v = sprintf("unknown attribute [%s] for document %s |%d]", $attrid, $doc->title, $doc->id);
53  }
54  header('Content-Type: text/plain');
55  $action->lay->template = $v;
56  $action->lay->noparse = true;
57 }
global $action
print< H1 > Check Database< i > $dbaccess</i ></H1 > $a
Definition: checklist.php:45
fdl_getvalue(Action &$action)
exitError($texterr, $exit=true, $code="")
$docid
Definition: cleanFamily.php:13
new_Doc($dbaccess, $id= '', $latest=false)
static getArgument($k, $def= '')
$dbaccess
Definition: checkVault.php:17
getIdFromName($dbaccess, $name)
if($file) if($subject==""&&$file) if($subject=="") $err
$latest
← centre documentaire © anakeen