本文整理汇总了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'));
}
示例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'));
}
示例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'));
}
示例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;
}
}
}
}
示例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;
示例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'));
}
示例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'));
}