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


PHP Tree::getSubTree方法代碼示例

本文整理匯總了PHP中Tree::getSubTree方法的典型用法代碼示例。如果您正苦於以下問題:PHP Tree::getSubTree方法的具體用法?PHP Tree::getSubTree怎麽用?PHP Tree::getSubTree使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Tree的用法示例。


在下文中一共展示了Tree::getSubTree方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: showMain

 public function showMain()
 {
     $page = $this->node;
     $tree = Collector::get('root');
     $subTree = Tree::getSubTree($tree, $page);
     $blocks = null;
     if ($subTree) {
         $blocks = $subTree->children;
     }
     foreach ($blocks as $index => $block) {
         $blocks[$block->slug] = $block;
         unset($blocks[$index]);
     }
     $allRates = Cache::tags('rates')->rememberForever('rates_' . App::getLocale(), function () {
         return Rates::orderPriority()->get();
     });
     $rates = array();
     foreach ($allRates as $i => $rate) {
         if ($rate['type'] == 1) {
             $rates['departments'][] = $rate;
         } else {
             $rates['cards'][$rate['name_card']][] = $rate;
         }
     }
     $calculatorCredit = new CashCalculator();
     // fixme:
     //$calculatorCredit->setMonthlyIncome(Settings::get('monthly_income_default', 0));
     $calculatorCredit->setCreditAmount(Settings::get('credit_amount_default', 100000));
     $calculatorCredit->setTerm(Settings::get('term_default', 3));
     $calculationsCredit = $calculatorCredit->calculate();
     return View::make('index', compact('page', 'blocks', 'rates', 'calculationsCredit'));
 }
開發者ID:OlesKashchenko,項目名稱:SkillsProject1,代碼行數:32,代碼來源:HomeController.php

示例2: showRisksManagement

 public function showRisksManagement()
 {
     $page = $this->node;
     $tree = Collector::get('root');
     $subTree = Tree::getSubTree($tree, $page);
     $risks = null;
     if ($subTree) {
         $risks = $subTree->children;
     }
     return View::make('investor.risks', compact('page', 'risks'));
 }
開發者ID:OlesKashchenko,項目名稱:SkillsProject1,代碼行數:11,代碼來源:InvestorRelationsController.php

示例3: showSingle

 public function showSingle()
 {
     $page = $this->node;
     $tree = Collector::get('root');
     $subTree = Tree::getSubTree($tree, $page);
     $blocks = null;
     if ($subTree) {
         $blocks = $subTree->children;
     }
     return View::make('small-business.single', compact('page', 'blocks'));
 }
開發者ID:OlesKashchenko,項目名稱:SkillsProject1,代碼行數:11,代碼來源:SmallBusinessController.php

示例4: getSubTree

 public static function getSubTree($tree, $node, &$isOk = false)
 {
     foreach ($tree as $current) {
         if ($current->id == $node->id) {
             $isOk = true;
             return $current;
         } else {
             $result = Tree::getSubTree($current->children, $node, $isOk);
             if ($isOk) {
                 return $result;
             }
         }
     }
 }
開發者ID:OlesKashchenko,項目名稱:SkillsProject1,代碼行數:14,代碼來源:Tree.php

示例5: function

});
View::composer('partials.main_news', function ($view) {
    $mainNews = Cache::tags('news', 'news_categories')->rememberForever('main_news_' . App::getLocale(), function () {
        return Tree::with(array('news' => function ($query) {
            $query->main()->active()->orderFixed('desc')->desc();
        }))->main()->active()->get();
    });
    $view->with('mainNews', $mainNews);
});
View::composer('partials.main_achievements', function ($view) {
    $idAchievementsSection = Collector::get('idAboutAchievements');
    $tree = Collector::get('root');
    $achievementsPage = Cache::tags('j_tree')->rememberForever('achievements_page_' . App::getLocale(), function () use($idAchievementsSection) {
        return Tree::active()->where('id', $idAchievementsSection)->first();
    });
    $subTree = Tree::getSubTree($tree, $achievementsPage);
    $treeAchievements = $achievements = null;
    if ($subTree) {
        $treeAchievements = $subTree->children;
    }
    foreach ($treeAchievements as $achievement) {
        if (!$achievement->isActive() || !$achievement->isMain() || !$achievement->children->count()) {
            continue;
        }
        $currentYear = substr(trim($achievement->t('title')), -4);
        foreach ($achievement->children as $item) {
            if (!$item->isActive() || !$item->isMain()) {
                continue;
            }
            if ($currentYear) {
                $achievements[$currentYear][] = $item;
開發者ID:OlesKashchenko,項目名稱:SkillsProject1,代碼行數:31,代碼來源:view_composers.php

示例6: showTransfer

 public function showTransfer()
 {
     $page = $this->node;
     $tree = Collector::get('root');
     $subTree = Tree::getSubTree($tree, $page);
     $blocks = null;
     if ($subTree) {
         $blocks = $subTree->children;
     }
     return View::make('private-persons.transfers.single', compact('page', 'blocks'));
 }
開發者ID:OlesKashchenko,項目名稱:SkillsProject1,代碼行數:11,代碼來源:PrivatePersonsController.php

示例7: showCreditRepay

 public function showCreditRepay()
 {
     $page = $this->node;
     $tree = Collector::get('root');
     $subTree = Tree::getSubTree($tree, $page);
     $blocks = null;
     if ($subTree) {
         $blocks = $subTree->children;
     }
     return View::make('about.credit_repay', compact('page', 'blocks'));
 }
開發者ID:OlesKashchenko,項目名稱:SkillsProject1,代碼行數:11,代碼來源:AboutController.php


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