Core  3.2
PHP API documentation
 All Data Structures Namespaces Files Functions Variables Pages
Class.ImageDocument.php
Go to the documentation of this file.
1 <?php
2 /*
3  * @author Anakeen
4  * @package FDL
5 */
6 /**
7  * Image document
8  *
9  */
10 namespace Dcp\Core;
12 {
13 
14  var $defaultview = "FDL:VIEWIMGCARD";
15 
16  var $cviews = array(
17  "FDL:VIEWIMGCARD:T"
18  );
19  /**
20  * @templateController default view image fit to window
21  * @param string $target
22  * @param bool $ulink
23  * @param bool $abstract
24  */
25  function viewimgcard($target = "_self", $ulink = true, $abstract = false)
26  {
27  // -----------------------------------
28  $nbimg = 0; // number of image
29  $this->viewattr($target, $ulink, $abstract);
30  $this->viewprop($target, $ulink, $abstract);
31 
32  $listattr = $this->GetNormalAttributes();
33 
34  $tableimage = array();
35  $vf = newFreeVaultFile($this->dbaccess);
36  // view all (and only) images
37  foreach ($listattr as $i => $attr) {
38 
39  $value = chop($this->getRawValue($i));
40  //------------------------------
41  // Set the table value elements
42  if (($value != "") && ($attr->visibility != "H")) {
43  // print values
44  switch ($attr->type) {
45  case "file":
46  case "image":
47 
48  $tableimage[$nbimg]["imgsrc"] = $this->GetHtmlValue($attr, $value, $target, $ulink);
49  if (preg_match(PREGEXPFILE, $value, $reg)) {
50  // reg[1] is mime type
51  $tableimage[$nbimg]["type"] = $reg[1];
52  if ($vf->Show($reg[2], $info) == "") $fname = $info->name;
53  else $fname = _("no filename");
54  $tableimage[$nbimg]["name"] = $fname;
55  }
56  break;
57  }
58  }
59  }
60  // Out
61  $this->lay->SetBlockData("TABLEIMG", $tableimage);
62  }
63 
64  function postStore()
65  {
66  return $this->SetValue("IMG_TITLE", $this->vault_filename("IMG_FILE"));
67  }
68 }
newFreeVaultFile($dbaccess)
Definition: Lib.Util.php:17
vault_filename($attrid, $path=false, $index=-1)
Definition: Class.Doc.php:8176
const PREGEXPFILE
Definition: Class.Doc.php:54
viewattr($target="_self", $ulink=true, $abstract=false, $viewhidden=false)
Definition: Class.Doc.php:7695
viewimgcard($target="_self", $ulink=true, $abstract=false)
viewprop($target="_self", $ulink=true, $abstract=false)
Definition: Class.Doc.php:7781
$vf
Definition: geticon.php:28
$info
Definition: geticon.php:30
getRawValue($idAttr, $def="")
Definition: Class.Doc.php:3117
$value
← centre documentaire © anakeen