コード例 #1
0
ファイル: actions.class.php プロジェクト: royalterra/pdns-gui
 public function validateAdd()
 {
     if ($this->isPOST()) {
         $c = new Criteria();
         $c->add(DomainPeer::NAME, $this->getRequestParameter('name'));
         if (DomainPeer::doSelectOne($c)) {
             $this->getRequest()->setError('name', 'This name is already in use.');
             return false;
         }
         if (!($this->template = TemplatePeer::retrieveByPK($this->getRequestParameter('template_id')))) {
             $this->getRequest()->setError('template_id', 'Invalid template id.');
             return false;
         }
     }
     return true;
 }
コード例 #2
0
 public function getTemplate($con = null)
 {
     if ($this->aTemplate === null && $this->template_id !== null) {
         include_once 'lib/model/om/BaseTemplatePeer.php';
         $this->aTemplate = TemplatePeer::retrieveByPK($this->template_id, $con);
     }
     return $this->aTemplate;
 }
コード例 #3
0
ファイル: actions.class.php プロジェクト: poliloco/pdns-gui
 public function validateEdit()
 {
     if ($this->isPOST()) {
         if (!($this->template = TemplatePeer::retrieveByPK($this->getRequestParameter('id')))) {
             $this->getRequest()->setError('id', 'Invalid template id.');
             return false;
         }
         $c = new Criteria();
         $c->add(TemplatePeer::ID, $this->getRequestParameter('id'), Criteria::NOT_EQUAL);
         $c->add(TemplatePeer::NAME, $this->getRequestParameter('name'));
         if (TemplatePeer::doSelectOne($c)) {
             $this->getRequest()->setError('name', 'Name already in use.');
             return false;
         }
         return $this->commonValidate();
     }
     return true;
 }