当前位置: 首页>>代码示例>>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;未经允许,请勿转载。