Platform  3.1
PHP API documentation
 All Data Structures Namespaces Files Functions Variables Pages
Method.DocFile.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: Method.DocFile.php,v 1.10 2008/03/10 10:45:52 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  * @begin-method-ignore
20  * this part will be deleted when construct document class until end-method-ignore
21  */
22 class _FILE extends Doc
23 {
24  /*
25  * @end-method-ignore
26  */
27  //var $defaultview= "FDL:VIEWFILECARD";
28  // -----------------------------------
29  function viewfilecard($target = "_self", $ulink = true, $abstract = false)
30  {
31  // -----------------------------------
32  $nbimg = 0; // number of image
33  $this->viewattr($target, $ulink, $abstract);
34  $listattr[] = $this->GetAttribute("FI_FILE");
35 
36  $tableimage = array();
37  $vf = newFreeVaultFile($this->dbaccess);
38  // view all (and only) images
39  while (list($i, $attr) = each($listattr)) {
40 
41  $value = chop($this->GetValue($attr->id));
42  //------------------------------
43  // Set the table value elements
44  if (($value != "") && ($attr->visibility != "H")) {
45  // print values
46  switch ($attr->type) {
47  case "file":
48 
49  $tableimage[$nbimg]["imgsrc"] = $this->GetHtmlValue($attr, $value, $target, $ulink);
50  if (preg_match(PREGEXPFILE, $value, $reg)) {
51  // reg[1] is mime type
52  $tableimage[$nbimg]["type"] = $reg[1];
53  if ($vf->Show($reg[2], $info) == "") {
54  $fname = $info->name;
55  $tableimage[$nbimg]["size"] = round($info->size / 1024, 2);
56  } else $fname = _("no filename");
57 
58  $tableimage[$nbimg]["name"] = $fname;
59  }
60 
61  break;
62  }
63  }
64  }
65  // Out
66  $this->lay->SetBlockData("TABLEFILE", $tableimage);
67  }
68 
69  function PostModify()
70  {
71  $filename = $this->vault_filename("FI_FILE");
72  /* to not view extension file
73  $pos = strrpos($filename , ".");
74  if ($pos !== false) {
75  $filename=substr($filename,0,$pos);
76  }
77  */
78  if ($this->getValue("FI_TITLEW") == "") $this->SetValue("FI_TITLE", $filename);
79  else $this->SetValue("FI_TITLE", $this->getValue("FI_TITLEW"));
80  }
81  /**
82  * @begin-method-ignore
83  * this part will be deleted when construct document class until end-method-ignore
84  */
85 }
86 /*
87  * @end-method-ignore
88 */
89 ?>
← centre documentaire © anakeen - published under CC License - Dynacase