本文整理汇总了PHP中Attachment::getFileUrl方法的典型用法代码示例。如果您正苦于以下问题:PHP Attachment::getFileUrl方法的具体用法?PHP Attachment::getFileUrl怎么用?PHP Attachment::getFileUrl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Attachment
的用法示例。
在下文中一共展示了Attachment::getFileUrl方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handleTreeEditGet
/**
* handle tree edit
*/
private function handleTreeEditGet($retrieveFields = true)
{
$template = new TemplateEngine($this->getPath() . "templates/" . $this->templateFile);
$request = Request::getInstance();
$view = ViewManager::getInstance();
$view->setType(NewsLetter::VIEW_FILE_EDIT);
$tree_id = intval($request->getValue('tree_id'));
$tag = $request->getValue('tag');
$template->setVariable('tree_id', $tree_id, false);
$template->setVariable('tag', $tag, false);
if (!$request->exists('id')) {
throw new Exception('Bestand ontbreekt.');
}
$id = intval($request->getValue('id'));
$template->setVariable('id', $id, false);
$key = array('id' => $id);
if ($retrieveFields) {
$fields = $this->getDetail($key);
} else {
$fields = $this->getFields(SqlParser::MOD_UPDATE);
$detail = $this->getDetail($key);
$fields['file'] = $detail['file'];
}
$this->setFields($fields);
// get path to file
if ($fields['file']) {
$template->setVariable('file_url', $this->plugin->getFileUrl($id), false);
}
$template->setVariable($fields, NULL, false);
$this->handleTreeSettings($template);
$this->template[$this->director->theme->getConfig()->main_tag] = $template;
}
示例2: handleTreeEditGet
/**
* handle tree edit
*/
private function handleTreeEditGet($retrieveFields = true)
{
$template = new TemplateEngine($this->getPath() . "templates/" . $this->templateFile);
$request = Request::getInstance();
$view = ViewManager::getInstance();
$view->setType(ViewManager::TREE_EDIT);
if (!$request->exists('id')) {
throw new Exception('Bestand ontbreekt.');
}
$id = intval($request->getValue('id'));
$template->setVariable('id', $id, false);
$key = array('id' => $id);
if ($retrieveFields) {
$fields = $this->getDetail($key);
$fields['online'] = $fields['online'] ? strftime('%Y-%m-%d', $fields['online']) : '';
$fields['offline'] = $fields['offline'] ? strftime('%Y-%m-%d', $fields['offline']) : '';
} else {
$fields = $this->getFields(SqlParser::MOD_UPDATE);
$detail = $this->getDetail($key);
$fields['file'] = $detail['file'];
}
$this->setFields($fields);
// get path to file
if ($fields['file']) {
$template->setVariable('file_url', $this->plugin->getFileUrl($id), false);
}
$template->setVariable($fields, NULL, false);
$this->handleTreeSettings($template);
$datefields = array();
$datefields[] = array('dateField' => 'online', 'triggerElement' => 'online');
$datefields[] = array('dateField' => 'offline', 'triggerElement' => 'offline');
Utils::getDatePicker($this->director->theme, $datefields);
$this->template[$this->director->theme->getConfig()->main_tag] = $template;
}
示例3: handleOverview
/**
* handle overview request
*/
private function handleOverview()
{
$view = ViewManager::getInstance();
$taglist = $this->plugin->getTagList();
if (!$taglist) {
return;
}
$tree = $this->director->tree;
// link to attachment tree nodes
$treeRef = new AttachmentTreeRef();
foreach ($taglist as $item) {
$key = array('tree_id' => $item['tree_id'], 'tag' => $item['tag']);
$detail = $this->getDetail($key);
$template = new TemplateEngine($this->getPath() . "templates/" . $this->templateFile);
$template->setPostfix($item['tag']);
$template->setCacheable($detail['display_order'] != Attachment::ORDER_RAND);
// check if template is in cache
if (!$template->isCached()) {
// get settings
$settings = $this->getSettings();
$treeRefList = $treeRef->getList($key);
$treeItemList = array();
foreach ($treeRefList['data'] as $treeRefItem) {
if (!$tree->exists($treeRefItem['ref_tree_id'])) {
continue;
}
$treeItemList[] = $treeRefItem['ref_tree_id'];
}
if (!$treeItemList) {
continue;
}
$searchcriteria = array('activated' => true, 'tree_id' => $treeItemList);
$display_order = $detail['display_order'] ? $detail['display_order'] : $settings['display_order'];
$overview = $this->getAttachmentOverview();
$list = $overview->getList($searchcriteria, $detail['rows'], 1, $display_order);
// skip if empty
if ($list['totalItems'] < 1) {
continue;
}
foreach ($list['data'] as &$att) {
$att['href_detail'] = $att['file'] ? $this->plugin->getFileUrl($att['id']) : '';
}
$template->setVariable('attachment', $list);
$template->setVariable('name', $detail['name']);
$template->setVariable('display', $settings['display_hdl']);
}
$this->template[$item['tag']] = $template;
}
}
示例4: handleOverview
/**
* handle overview request
*/
private function handleOverview()
{
$view = ViewManager::getInstance();
$taglist = $this->plugin->getTagList();
if (!$taglist) {
return;
}
$tree = $this->director->tree;
// link to attachment tree nodes
$treeRef = new AttachmentTreeRef();
foreach ($taglist as $item) {
$template = new TemplateEngine($this->getPath() . "templates/" . $this->templateFile);
$template->setPostfix($item['tag']);
$template->setCacheable(true);
// check if template is in cache
if (!$template->isCached()) {
// get settings
$settings = $this->getSettings();
$key = array('tree_id' => $item['tree_id'], 'tag' => $item['tag']);
$detail = $this->getDetail($key);
$treeRefList = $treeRef->getList($key);
$treeItemList = array();
foreach ($treeRefList['data'] as $treeRefItem) {
if (!$tree->exists($treeRefItem['ref_tree_id'])) {
continue;
}
$treeItemList[] = $treeRefItem['ref_tree_id'];
}
if (!$treeItemList) {
continue;
}
$searchcriteria = array('tree_id' => $treeItemList, 'active' => true);
if ($detail['online']) {
$searchcriteria['archiveonline'] = $detail['online'];
}
$searchcriteria['archiveoffline'] = $detail['offline'] ? $detail['offline'] : time();
$overview = $this->getAttachmentOverview();
$list = $overview->getList($searchcriteria, $settings['rows']);
foreach ($list['data'] as &$item) {
$item['href_detail'] = $item['file'] ? $this->plugin->getFileUrl($item['id']) : '';
}
$template->setVariable('attachment', $list);
$template->setVariable('display', $settings['display'], false);
}
$this->template[$detail['tag']] = $template;
}
}