Example #1
0
 protected function parseMarcroAttach($runID, $attachmentID, $showImg = true)
 {
     $attachDir = Ibos::app()->setting->get("setting/attachdir");
     $attach = AttachmentN::model()->fetch("rid:" . $runID, $attachmentID);
     if ($attach["isimage"] && $showImg) {
         $imgAttr = FileUtil::imageSize($attachDir . $attach["attachment"]);
         $attachLink = "<img src=\"{$attachDir}" . $attach["attachment"] . "\" {$imgAttr['3']} alt=\"{$attach["filename"]}\">";
         return $attachLink;
     }
     if ($this->flow->isFixed() && (StringUtil::findIn($this->process->attachpriv, "4") || !$this->process->attachpriv)) {
         $down = 1;
     } else {
         $down = 0;
     }
     if ($down) {
         $attachstr = AttachUtil::getAttachStr($attachmentID);
         $url = Ibos::app()->urlManager->createUrl("main/attach/download", array("id" => $attachstr));
         $link = "<a target=\"_blank\" class=\"xi2\" href=\"{$url}\">{$attach["filename"]}</a>";
     } else {
         $link = "<a class=\"xi2\" href=\"#\">{$attach["filename"]}</a>";
     }
     $type = StringUtil::getFileExt($attach["attach"]);
     $path = AttachUtil::attachType($type);
     $attachLink = "<span><img src=\"{$path}\">{$link}</span>";
     return $attachLink;
 }