本文整理汇总了PHP中ArtefactTypeFileBase::get_full_path方法的典型用法代码示例。如果您正苦于以下问题:PHP ArtefactTypeFileBase::get_full_path方法的具体用法?PHP ArtefactTypeFileBase::get_full_path怎么用?PHP ArtefactTypeFileBase::get_full_path使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ArtefactTypeFileBase
的用法示例。
在下文中一共展示了ArtefactTypeFileBase::get_full_path方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: create_index_for_directory
/**
* Given a filesystem directory and the artefact data corresponding to that
* directory, creates an index.html for it.
*
* @param string $filesystemdirectory The file system directory to make the
* index.html inside
* @param int $level How deep this directory index is
* @param object $artefactdata Artefact data relating to the folder
* represented by this directory
*/
private function create_index_for_directory($filesystemdirectory, $level, ArtefactTypeFolder $artefact = null)
{
$smarty = $this->exporter->get_smarty(str_repeat('../', $level + 2), 'file');
$smarty->assign('page_heading', get_string('Files', 'artefact.file'));
$smarty->assign('breadcrumbs', array(array('text' => 'Files', 'path' => 'index.html')));
if ($artefact) {
$smarty->assign('folder', ArtefactTypeFileBase::get_full_path($artefact->get('id'), $this->artefactdata));
} else {
$smarty->assign('folder', '/');
}
$id = $artefact ? $artefact->get('id') : null;
$smarty->assign('folders', $this->prepare_artefacts_for_smarty($id, true));
$smarty->assign('files', $this->prepare_artefacts_for_smarty($id, false));
$content = $smarty->fetch('export:html/file:index.tpl');
if (false === file_put_contents($filesystemdirectory . 'index.html', $content)) {
throw new SystemException("Unable to create index.html for directory {$id}");
}
}
示例2: get_folder_path_for_file
/**
* Given a file, returns the folder path for it in the Mahara files area
*
* The path is pre-sanitised so it can be used when generating the export
*
* @param $file The file or folder to get the folder path for
* @return string
*/
private function get_folder_path_for_file($file)
{
if ($this->folderdata === null) {
$this->folderdata = get_records_select_assoc('artefact', "artefacttype = 'folder' AND owner = ?", array($file->get('owner')));
if ($this->folderdata) {
foreach ($this->folderdata as &$folder) {
$folder->title = PluginExportHtml::sanitise_path($folder->title);
}
}
}
$folderpath = ArtefactTypeFileBase::get_full_path($file->get('parent'), $this->folderdata);
return $folderpath;
}
示例3: artefactchooser_get_element_data
/**
* Optional method. If specified, allows the blocktype class to munge the
* artefactchooser element data before it's templated
*/
public static function artefactchooser_get_element_data($artefact)
{
$folderdata = ArtefactTypeFileBase::artefactchooser_folder_data($artefact);
$artefact->icon = call_static_method(generate_artefact_class_name($artefact->artefacttype), 'get_icon', array('id' => $artefact->id));
$artefact->hovertitle = $artefact->description;
$path = $artefact->parent ? ArtefactTypeFileBase::get_full_path($artefact->parent, $folderdata->data) : '';
$artefact->description = str_shorten_text($folderdata->ownername . $path . $artefact->title, 30);
return $artefact;
}
示例4: unzip_directory_name
public function unzip_directory_name()
{
if (isset($this->data['unzipdir'])) {
return $this->data['unzipdir'];
}
$folderdata = ArtefactTypeFileBase::artefactchooser_folder_data($this);
$parent = $this->get('parent');
$strpath = ArtefactTypeFileBase::get_full_path($parent, $folderdata->data);
$extn = $this->get('oldextension');
$name = $this->get('title');
if (substr($name, -1 - strlen($extn)) == '.' . $extn) {
$name = substr($name, 0, strlen($name) - 1 - strlen($extn));
}
$name = ArtefactTypeFileBase::get_new_file_title($name, $parent, $this->get('owner'), $this->get('group'), $this->get('institution'));
$this->data['unzipdir'] = array('basename' => $name, 'fullname' => $strpath . $name);
return $this->data['unzipdir'];
}