Пример #1
0
 /**
  * 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;
 }
Пример #2
0
function pieform_element_filebrowser_get_path($folder)
{
    $path = array();
    if ($folder) {
        $folders = ArtefactTypeFileBase::artefactchooser_folder_data(artefact_instance_from_id($folder))->data;
        $f = $folder;
        while ($f) {
            $path[] = (object) array('title' => $folders[$f]->title, 'id' => $f);
            $f = $folders[$f]->parent;
        }
    }
    $path[] = (object) array('title' => get_string('home', 'artefact.file'), 'id' => 0);
    return $path;
}
Пример #3
0
 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'];
 }