Exemplo n.º 1
0
 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;
 }
Exemplo n.º 2
0
 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;
 }
Exemplo n.º 3
0
 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;
 }
Exemplo n.º 4
0
 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');
 }