Exemple #1
0
function GetAreaParents($AreaID)
{
    if (!$AreaID) {
        return false;
    }
    $detail = GetAreaDetail($AreaID);
    if ($detail) {
        $data[] = array('AreaID' => $detail['AreaID'], 'AreaName' => $detail['AreaName'], 'Alias' => $detail['Alias'], 'ParentAlias' => $detail['ParentAlias'], 'Property' => $detail['Property'], 'Ab' => $detail['Ab']);
        if ($detail['ParentAreaID']) {
            $subdata = GetAreaParents($detail['ParentAreaID']);
            if ($subdata) {
                return array_merge($subdata, $data);
            }
        }
        return $data;
    } else {
        return false;
    }
}
Exemple #2
0
 public function Areas()
 {
     $p = $this->__LoadParameters('globals');
     if (is_array($p)) {
         foreach ($p as $key => $value) {
             $this->{$key} = $value;
         }
     }
     unset($p);
     if ($this->_POST) {
         $GroupID = _intval($this->_POST['GroupID'], true);
         $DB = new DB();
         if ($this->_POST['OP'] == 'SetIsCity') {
             $Sql = 'UPDATE location set Property=1 WHERE AreaID=%d';
         } elseif ($this->_POST['OP'] == 'SetIsState') {
             $Sql = 'UPDATE location set Property=0 WHERE AreaID=%d';
         } elseif ($this->_POST['OP'] == 'SetIsTown') {
             $Sql = 'UPDATE location set Property=2 WHERE AreaID=%d';
         } elseif ($this->_POST['OP'] == 'SetIsTop') {
             $Sql = 'UPDATE location set IsTop=1 WHERE AreaID=%d';
         } elseif ($this->_POST['OP'] == 'SetUnIsTop') {
             $Sql = 'UPDATE location set IsTop=0 WHERE AreaID=%d';
         }
         if (is_array($this->_POST['AreaID'])) {
             foreach ($this->_POST['AreaID'] as $AreaID) {
                 if ($this->_POST['OP'] == 'SetGroup') {
                     UpdateAreaGroupID($AreaID, $GroupID);
                 } else {
                     $DB->Update(sprintf($Sql, $AreaID));
                 }
             }
         }
         $ParentAreaID = _intval($this->_POST['ParentAreaID'], true);
         $this->__Message('操作已完成!', UrlRewriteSimple('AreasManager', 'Areas') . '&ParentAreaID=' . $ParentAreaID, '继续操作');
     }
     $this->ParentAreaID = _intval($this->_GET['ParentAreaID']);
     if ($this->_GET['AreaID']) {
         $AreaDetail = GetAreaDetail($this->_GET['AreaID']);
         if ($AreaDetail) {
             $this->AreaDetail = $AreaDetail;
         }
     }
 }