zzwy2/app/widget/Common.php

76 lines
2.1 KiB
PHP
Executable File

<?php
namespace app\widget;
use app\model\Block;
use app\model\Category;
use app\model\ConfigSetting;
use app\model\Link;
use app\model\System;
use think\facade\View;
class Common
{
protected $data = [];
public function footer()
{
// $configExtraBase = ConfigSetting::getConfigContentsByName('extraBase');
/*
$menus = Category::getListForFrontMenu();
$footerMenus = [];
foreach ($menus as $menu) {
if (isset($menu['children'])) {
foreach ($menu['children'] as $child) {
if(!empty($child['footer_group'])) {
$footerMenus[$child['footer_group']][] = $child;
}
}
} else {
if(!empty($menu['footer_group'])) {
$footerMenus[$menu['footer_group']][] = $menu;
}
}
}
$this->data['footerMenus'] = $footerMenus;
*/
// $this->data['extraBase'] = $configExtraBase;
// $this->data['links'] = Link::getList(5);
// $this->data['systemSetting'] = System::getSystem();
return View::assign($this->data)->fetch('public/footer');
}
// 区块:试用栏
public function blockTrial($className='marginTop')
{
$this->data['className'] = $className;
return View::assign($this->data)->fetch('public/block/trial');
}
// 区块:了解更多课程详情弹窗
public function blockMoreCourse()
{
$blocks = Block::getByCategoryId(Category::CATEGORY_PAGE_COURSE);
$blocks = Block::convertValue($blocks);
$this->data['confBlocks'] = $blocks;
return View::assign($this->data)->fetch('public/block/more_course');
}
// 区块:课程简览
public function blockSimpleCourse()
{
$courseList = Category::getChildrenByParentId(Category::CATEGORY_PAGE_COURSE);
$courseListShow = array_chunk($courseList, 3)[0] ?? [];
$this->data['courseList'] = $courseListShow;
return View::assign($this->data)->fetch('public/block/simple_course');
}
}