本文整理匯總了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);
}