本文整理汇总了PHP中file::hierarchy方法的典型用法代码示例。如果您正苦于以下问题:PHP file::hierarchy方法的具体用法?PHP file::hierarchy怎么用?PHP file::hierarchy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类file
的用法示例。
在下文中一共展示了file::hierarchy方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: generate
//.........这里部分代码省略.........
if ($this->parent > 0) {
$icon = $this->mimeIcon('folder/back');
$html[] = '<div class="navibrowse-folder navibrowse-back ui-corner-all" id="item-' . $this->previous . '">';
$html[] = ' <img src="' . $icon . '" width="' . $this->icon_size . '" height="' . $this->icon_size . '" />';
$html[] = ' <div class="navibrowse-item-name">' . t(139, 'Back') . '</div>';
$html[] = '</div>';
}
if (empty($this->items)) {
$this->items = array();
}
foreach ($this->items as $item) {
$icon = $this->mimeIcon($item->mime, $item->type);
$thumbnail = '';
if ($item->type == 'image') {
$thumbnail = NAVIGATE_DOWNLOAD . '?wid=' . $website->id . '&id=' . $item->id . '&disposition=inline&width=' . intval($this->icon_size) . '&height=' . intval($this->icon_size);
}
if ($item->type == 'folder') {
$html[] = '<div class="navibrowse-folder ui-corner-all" mime="' . $item->mime . '" id="item-' . $item->id . '" data-file-type="' . $item->type . '" data-file-id="' . $item->id . '">';
$html[] = ' <img src="' . $icon . '" width="' . $this->icon_size . '" height="' . $this->icon_size . '" />';
$html[] = ' <div class="navibrowse-item-name">' . $item->name . '</div>';
$html[] = '</div>';
} else {
$html[] = '<div class="navibrowse-file ui-corner-all" mime="' . $item->mime . '" id="item-' . $item->id . '" data-file-type="' . $item->type . '" data-file-id="' . $item->id . '">';
$html[] = ' <div class="navibrowse-file-access-icons">' . $permissions[$item->permission] . $access[$item->access] . '</div>';
$html[] = ' <img src="' . $icon . '" data-src="' . $thumbnail . '" width="' . $this->icon_size . '" height="' . $this->icon_size . '" />';
$html[] = ' <div class="navibrowse-item-name">' . $item->name . '</div>';
$html[] = '</div>';
}
}
$html[] = '<div class="clearer"> </div>';
$html[] = '</div>';
$html[] = '</div>';
$html[] = '</div>';
$hierarchy = file::hierarchy(0);
$folders_tree = file::hierarchyList($hierarchy, $item->parent);
$html[] = '
<div id="navibrowse-folder-tree-dialog" class="hidden">
<div class="navibrowse_folder_tree" style=" width: 90%; ">
<img src="img/icons/silk/folder_home.png" align="absmiddle" /> ' . t(18, 'Home') . '<div class="tree_ul">' . $folders_tree . '</div>
</div>
</div>
';
$html[] = '<script language="javascript" type="text/javascript">';
// replace placeholder images by real thumbnails after document is ready
$html[] = '
$(window).on("load", function()
{
new LazyLoad({
threshold: 200,
container: document.getElementById("navigate-content-safe"),
elements_selector: ".navibrowse-file img",
throttle: 40,
data_src: "src",
show_while_loading: true
});
});
';
// $html[] = '$(".navibrowse-file, .navibrowse-folder").on("mouseover", function() { $(this).css("opacity", 0.7); });';
// $html[] = '$(".navibrowse-file, .navibrowse-folder").on("mouseout", function() { $(this).css("opacity", 1); });';
$html[] = '$(".navibrowse-path a").button();';
$html[] = '$(".navibrowse-items").children().on("click", function(e)
{
if(e.ctrlKey)
{
// just add or remove the item as selected
if($(this).hasClass("ui-selected"))
示例2: hierarchy
public static function hierarchy($id_parent = 0)
{
$tree = array();
if ($id_parent == -1) {
/*
$tree[] = array( 'id' => '0',
'parent' => -1,
'position' => 0,
'permission' => 0,
'icon' => 0,
'metatags' => '',
'label' => $website->name,
'date_published' => '',
'date_unpublish' => '',
'dates' => 'x - x',
'children' => structure::hierarchy(0)
);
*/
$obj = new structure();
$obj->id = 0;
$obj->label = t(18, 'Home');
$obj->parent = -1;
$obj->children = file::hierarchy(0);
$tree[] = $obj;
} else {
$tree = file::loadTree($id_parent);
for ($i = 0; $i < count($tree); $i++) {
$children = file::hierarchy($tree[$i]->id);
$tree[$i]->children = $children;
$tree[$i]->label = $tree[$i]->name;
if (empty($tree[$i]->label)) {
$tree[$i]->label = '[ ? ]';
}
}
}
return $tree;
}