public function getParentalIndex() { $parentalIndex = "#" . str_pad($this->getId(), 3, '0', STR_PAD_LEFT); $this->level = 1; if ($this->getParent() !== null && $this->getParent() != 0) { $p = RegionPeer::retrieveByPK($this->getParent()); $parentalIndex = str_pad($p->getParentalIndex(), 3, '0', STR_PAD_LEFT) . "_" . $parentalIndex; $this->level += $p->level; } $this->parentalIndex = $parentalIndex; return $parentalIndex; }
public function getRegion($con = null) { include_once 'lib/model/om/BaseRegionPeer.php'; if ($this->aRegion === null && $this->region_id !== null) { $this->aRegion = RegionPeer::retrieveByPK($this->region_id, $con); } return $this->aRegion; }
public function getRegionRelatedByParent($con = null) { include_once 'lib/model/om/BaseRegionPeer.php'; if ($this->aRegionRelatedByParent === null && $this->parent !== null) { $this->aRegionRelatedByParent = RegionPeer::retrieveByPK($this->parent, $con); } return $this->aRegionRelatedByParent; }
public function executeEditregion() { $c = new Criteria(); $c->add(RegionPeer::NAME, $this->getRequestParameter('region')); $exregion = RegionPeer::doSelectOne($c); if ($exregion) { $this->setFlash('notice', 'Region could not be edited. A Region with this name already exists.'); } else { $region = RegionPeer::retrieveByPK($this->getRequestParameter('id')); $region->setName($this->getRequestParameter('region')); $region->save(); $this->setFlash('notice', 'Region Edited Successfuly'); } $this->redirect('admin/regions'); }