CMS  Version 3.9
AttachmentManager Class Reference

Public Member Functions

 AttachmentManager ()
 

Static Public Member Functions

static deleteAttachment ($attachment, $xrefClass="")
 
static getAttachmentLink ($attachment)
 
static deleteAttachmentXref ($attachment_id, $xrefClass)
 
static upgradeComponent ($version)
 

Detailed Description

Definition at line 40 of file attachment_manager.inc.

Member Function Documentation

◆ AttachmentManager()

AttachmentManager::AttachmentManager ( )

Definition at line 42 of file attachment_manager.inc.

43  {
44 
45  }

◆ deleteAttachment()

static AttachmentManager::deleteAttachment (   $attachment,
  $xrefClass = "" 
)
static

Definition at line 47 of file attachment_manager.inc.

48  {
49  if(!$attachment)
50  return;
51 
52  global $config;
53 
54  $dir = $config["attachmentdir"];
55  $base = $config['uploadbase'];
56 
57  $file = "$base/$dir{$attachment->local_filename}";
58 
59  if (file_exists($file))
60  {
61  unlink($file);
62  }
63 
64  if($xrefClass)
66 
67  $attachment->delete();
68  }
$dir
Definition: delete.inc:44
if(! $attachment_id) $attachment
Definition: delete.inc:42
$file
Definition: delete.inc:47
$base
Definition: delete.inc:45
static deleteAttachmentXref($attachment_id, $xrefClass)
global $config
Definition: import.inc:4

◆ deleteAttachmentXref()

static AttachmentManager::deleteAttachmentXref (   $attachment_id,
  $xrefClass 
)
static

Definition at line 82 of file attachment_manager.inc.

83  {
84 
85  $xrefs = Query::create($xrefClass, "WHERE attachment_id=:attachment_id")
86  ->bind(":attachment_id", $attachment_id)
87  ->execute();
88 
89  if(count($xrefs) > 0)
90  {
91  foreach($xrefs as $xref)
92  $xref->delete();
93  }
94  }
$attachment_id
Definition: delete.inc:36

◆ getAttachmentLink()

static AttachmentManager::getAttachmentLink (   $attachment)
static

Definition at line 70 of file attachment_manager.inc.

71  {
72  $icon = getDocIcon($attachment->filename);
73 
74  $html .= "<img src=\"$icon\" alt=\"Icon\" style=\"display:inline-block;vertical-align:middle\"/>&nbsp;
75  <a href=\"/action/attachment/download?attachment_id={$attachment->attachment_id}\">{$attachment->filename}</a>&nbsp;
76  ({$attachment->file_size})";
77 
78  return $html;
79  }
$icon
Definition: upload.inc:92

◆ upgradeComponent()

static AttachmentManager::upgradeComponent (   $version)
static

Definition at line 96 of file attachment_manager.inc.

97  {
99  $mgr->upgrade($version);
100  }

The documentation for this class was generated from the following file: