コード例 #1
0
ファイル: start.php プロジェクト: pleio/file_tools
function file_tools_url_handler($entity)
{
    if (file_tools_is_odt($entity)) {
        return "file/view/" . $entity->getGUID() . "/" . elgg_get_friendly_title($entity->title);
    }
    if (elgg_in_context("file_tools")) {
        return "file/download/" . $entity->getGUID();
    } else {
        return "file/view/" . $entity->getGUID() . "/" . elgg_get_friendly_title($entity->title);
    }
}
コード例 #2
0
ファイル: file.php プロジェクト: pleio/file_tools
} elseif (elgg_in_context("gallery")) {
    // gallery view of the file
    echo "<div class='file-gallery-item'>";
    echo "<h3>" . $file->title . "</h3>";
    echo elgg_view_entity_icon($file, "medium");
    echo "<p class='elgg-quiet'>{$owner_link} {$date}</p>";
    echo "</div>";
} else {
    // listing view of the file
    $file_icon_alt = "";
    if (file_tools_use_folder_structure()) {
        $file_icon = elgg_view_entity_icon($file, "tiny", array("img_class" => "file-tools-icon-tiny"));
        if (elgg_in_context("file_tools")) {
            $file_icon_alt = elgg_view("input/checkbox", array("name" => "file_guids[]", "value" => $file->getGUID(), "default" => false));
        }
        $excerpt = "";
        $subtitle = "";
        $tags = "";
    } else {
        $file_icon = elgg_view_entity_icon($file, "small");
        $excerpt = elgg_get_excerpt($file->description);
    }
    $title_options = array('text' => $file->title, 'href' => $file->getURL(), 'is_trusted' => true);
    if (file_tools_is_odt($file)) {
        $title_options['target'] = '_blank';
    }
    $params = array("entity" => $file, "metadata" => $entity_menu, "subtitle" => $subtitle, "title" => elgg_view('output/url', $title_options), "tags" => $tags, "content" => $excerpt);
    $params = $params + $vars;
    $list_body = elgg_view("object/elements/summary", $params);
    echo elgg_view_image_block($file_icon, $list_body, array("class" => "file-tools-file", "image_alt" => $file_icon_alt));
}