static function getparent($id,$name=null) { $area=new area(); $area2=$area->getrow('id='.$id); $area=$area->getrow('id='.$area2['parentid']); if ($name) return $area[$name]; else return $area; }
function list_action() { $this->view->page=front::get('page') ?front::get('page') : 1; $this->pagesize=config::get('list_pagesize'); $limit=(($this->view->page -1) * $this->pagesize).','.$this->pagesize; $area=new area(); $where='1'; if (front::get('province_id')) $where.=' and id='.front::get('province_id'); if (front::get('city_id')) $where.=' and id='.front::get('city_id'); if (front::get('section_id')) $where.=' and id='.front::get('section_id'); if (front::get('id')) $where.=' and id='.front::get('id'); $this->view->area=$area->getrow($where); $archive=new archive(); $where='1'; if (front::get('province_id')) $where.=' and province_id='.front::get('province_id'); if (front::get('city_id')) $where.=' and city_id='.front::get('city_id'); if (front::get('section_id')) $where.=' and section_id='.front::get('section_id'); if (front::get('id')) $where.=' and section_id='.front::get('id').' or city_id='.front::get('id').' or province_id='.front::get('id'); $archives=$archive->getrows($where,$limit,'listorder,aid desc'); foreach ($archives as $order=>$arc) { $archives[$order]['url']=archive::url($arc); $archives[$order]['catname']=category::name($arc['catid']); $archives[$order]['caturl']=category::url($arc['catid']); $archives[$order]['adddate']=sdate($arc['adddate']); $archives[$order]['stitle']=strip_tags($arc['title']); } $this->view->pages=true; if(front::get('id')!='') { $this->view->areaid=front::get('id'); }elseif(front::get('province_id')!='') { $this->view->areaid=front::get('province_id'); }elseif(front::get('city_id')!='') { $this->view->areaid=front::get('city_id'); }elseif(front::get('section_id')!='') { $this->view->areaid=front::get('section_id'); } $this->view->archive['title'] = area::name($this->view->areaid); $this->view->archives=$archives; $this->view->record_count=$archive->rec_count($where); front::$record_count=$this->view->record_count; if (front::get('t') == 'wap') { $this->out('wap/area_list.html'); return; } $this->render(); }