/** * Returns an associative array for the branch list page */ public function getTpl() { $tpl['URL'] = $this->getUrl(); $links[] = PHPWS_Text::secureLink(Icon::show('edit'), 'branch', array('command' => 'edit_branch', 'branch_id' => $this->id)); $js['question'] = dgettext('branch', 'Removing this branch will make it inaccessible.\\nThe database and files will remain behind.\\nIf you are sure you want to remove the branch, type the branch name:'); $js['address'] = sprintf('index.php?module=branch&command=remove_branch&branch_id=%s&authkey=%s', $this->id, Current_User::getAuthKey()); $js['value_name'] = 'branch_name'; $js['link'] = Icon::show('delete'); $links[] = javascript('prompt', $js); $tpl['DIRECTORY'] = sprintf('<abbr title="%s">%s</abbr>', $this->directory, PHPWS_Text::shortenUrl($this->directory)); $tpl['ACTION'] = implode(' ', $links); return $tpl; }
/** * Template sent to File Manager for media selection. */ public function managerTpl($fmanager) { $tpl['ICON'] = $this->getManagerIcon($fmanager); $title_len = strlen($this->title); if ($title_len > 20) { $file_name = sprintf('<abbr title="%s">%s</abbr>', $this->file_name, PHPWS_Text::shortenUrl($this->file_name, 20)); } else { $file_name =& $this->file_name; } $tpl['TITLE'] = $this->getTitle(true); $filename_len = strlen($this->file_name); if ($filename_len > 20) { $file_name = sprintf('<abbr title="%s">%s</abbr>', $this->file_name, PHPWS_Text::shortenUrl($this->file_name, 20)); } else { $file_name =& $this->file_name; } if (!$this->embedded) { $tpl['INFO'] = sprintf('%s<br>%s', $file_name, $this->getSize(true)); } if (Current_User::allow('filecabinet', 'edit_folders', $this->folder_id, 'folder')) { if (!$this->embedded) { $links[] = $this->editLink(true); } $links[] = $this->deleteLink(true); $tpl['LINKS'] = implode(' ', $links); } return $tpl; }