當前位置: 首頁>>代碼示例>>PHP>>正文


PHP file::hierarchy方法代碼示例

本文整理匯總了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">&nbsp;</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"))
開發者ID:NavigateCMS,項目名稱:Navigate-CMS,代碼行數:67,代碼來源:navibrowse.class.php

示例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;
 }
開發者ID:NavigateCMS,項目名稱:Navigate-CMS,代碼行數:37,代碼來源:file.class.php


注:本文中的file::hierarchy方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。