コード例 #1
0
 public function info()
 {
     $infoid = I('get.infoid');
     $this->assign('infoid', $infoid);
     //获取车型列表
     $info_db = D('Info');
     $infoList = $info_db->getInfoList();
     $this->assign('infoList', $infoList);
     //题图
     $topPicList = getPicMetaArr($infoid, 91);
     //print_r($topPicList);exit;
     $this->assign('topPicList', $topPicList);
     $classself_db = D('ClassSelf');
     $data_class = array();
     $data_class = $classself_db->getClassSelfList($infoid);
     foreach ($data_class as $key => &$row) {
         if ($row['classid'] == 91) {
             unset($data_class[$key]);
         }
         if ($row['parentid'] == 91) {
             unset($data_class[$key]);
         }
         $row['cid'] = $row['id'];
         $row['id'] = $row['classid'];
     }
     $tree = new \Tree();
     $tree->init($data_class);
     $menuList = $tree->get_tree_array(0);
     $this->assign('menuList', $menuList);
     $this->display(":info");
 }
コード例 #2
0
ファイル: function.php プロジェクト: noikiy/luokeke2
function sp_get_menu_tree($id = "main")
{
    $navs = F("site_nav_" . $id);
    if (empty($navs)) {
        $navs = _sp_get_menu_datas($id);
    }
    import("Tree");
    $tree = new \Tree();
    $tree->init($navs);
    return $tree->get_tree_array(0, "");
}
コード例 #3
0
 public function index()
 {
     //首页职业分类表最大度81个字节start_1
     import("Tree");
     $tree = new \Tree();
     $result = $this->category_model->where('progenitor = 9130971')->select();
     foreach ($result as $r) {
         $array[] = $r;
     }
     $tree->init($array);
     $str = '';
     $select_categorys = $tree->get_tree_array(0);
     $classnums = 1;
     if ($classnums <= 9) {
         foreach ($select_categorys[1]['child'] as $v) {
             $str .= '<div class="cd' . $classnums . '">';
             $str .= '<div class="cd' . $classnums . '_1">' . $v['name'] . '</div>';
             $vv_strlen_all = '';
             foreach ($v['child'] as $vv) {
                 $vv_strlen = strlen($vv['name']);
                 $vv_strlen_all += $vv_strlen;
                 if ($vv_strlen_all > 85) {
                 } else {
                     if ($vv_strlen >= 16) {
                         $str .= '<div class="cd1_3"><a href="' . U('portal/index/list_recruit', array('category' => $vv['id'])) . '">' . $vv['name'] . '</a></div>';
                     } else {
                         $str .= '<div class="cd1_2"><a href="' . U('portal/index/list_recruit', array('category' => $vv['id'])) . '">' . $vv['name'] . '</a></div>';
                     }
                 }
             }
             unset($vv_strlen_all);
             $str .= '</div>';
             $classnums++;
         }
     }
     $this->assign("str_posts", $str);
     //end_1
     //企业标签start_2
     $user_posts = $this->users_model->where('user_type = 3')->order('create_time desc')->limit(8)->select();
     foreach ($user_posts as &$v) {
         $v['position_cg'] = array();
         $v_recruit = $this->recruit_model->where('user_id =' . $v['id'] . ' and status = 1')->select();
         $i = 0;
         foreach ($v_recruit as $k => &$vv) {
             $v['position_cg'][] = $this->get_category_name($vv['position_cg']);
             if ($i <= 3) {
                 $v['recruittitle'][$i]['title'] = $vv['title'];
                 $v['recruittitle'][$i]['id'] = $vv['id'];
             }
             $v['recruit_nums'] = $k + 1;
             $i++;
         }
     }
     $this->assign('user_posts', $user_posts);
     //end_2
     //挂证start_3
     $certificate_posts = $this->lookcertificate_model->where('status = 1')->order('created_at desc')->limit(4)->select();
     foreach ($certificate_posts as &$v) {
         $v['user'] = $this->users_model->field(array('user_nicename', 'thumb'))->where('id=' . $v['user_id'])->find();
     }
     $this->assign('certificate_posts', $certificate_posts);
     //end_3
     $certificate_results = $this->certificate_model->limit(16)->select();
     foreach ($certificate_results as &$v) {
         $v['updated_at'] = $this->get_timediff($v['updated_at']);
         $v['position_cg'] = $this->get_category_name($v['position_cg']);
     }
     $this->assign('certificate_results', $certificate_results);
     $this->display(":index");
 }