本文整理汇总了PHP中FilesModel::getFile方法的典型用法代码示例。如果您正苦于以下问题:PHP FilesModel::getFile方法的具体用法?PHP FilesModel::getFile怎么用?PHP FilesModel::getFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FilesModel
的用法示例。
在下文中一共展示了FilesModel::getFile方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionPreviewPage
public function actionPreviewPage($id)
{
$file = FilesModel::getFile($id);
if (!$file) {
throw new BadRequestException("File not found", 404);
}
if (!$this->triggerEvent('allowFileDownload', $file)) {
throw new BadRequestException("File download forbidden", 403);
}
$this->template->file = $file;
$this->setLayout(false);
//experimental for documentFile
$xml = substr($file->info, 5);
$sxml = simplexml_load_string($xml);
//TODO proč nefunguje vždy?
$pages = array();
if ($sxml && $sxml->page) {
foreach ($sxml->page as $p) {
$page = array($p, array());
foreach ($p->block as $b) {
foreach ($b->text as $t) {
$page[1][] = $t;
}
}
$pages[] = $page;
}
}
$this->template->pdf2xml = $pages;
}
示例2: editFileFormSubmitted
public function editFileFormSubmitted(AppForm $form)
{
if (!$this->presenter->editAllowed()) {
return;
}
$values = (array) $form->values;
$values['id_page'] = $values['id_page_change'];
//fix - after submitting changing $id_page
unset($values['id_page_change']);
$file = FilesModel::getFile($values['id']);
$file->save($values);
$this->presenter->flashMessage("Popis souboru #{$file->id} uložen");
$this->invalidateControl('editform_filelist');
//TODO (ask) zrušit submitted signál (jak redirect na action?)
$this->handleEditFile($file->id);
//fill form
if (!$this->presenter->isAjax()) {
$this->redirect('this#toc-files');
}
}
示例3: npMacroControlOptions
public function npMacroControlOptions($macro)
{
//TODO combine with Front_BasePresenter (extract to class NpMacros)
if (preg_match('~^file-([0-9]+)(_.+)?$~', $macro[1], $m)) {
return "#-file-{$m['1']}" . FilesModel::getFile($m[1])->getControlMacroOptions(isset($m[2]) ? $m[2] : NULL) . "-#";
} else {
return $macro[0];
}
}
示例4: fileMacro
function fileMacro($opts)
{
$opts = explode('_', $opts);
$id = array_shift($opts);
return FilesModel::getFile($id)->getControlHtml($opts);
}