コード例 #1
0
ファイル: Edit.php プロジェクト: sitz-air/nethserver-base
 public function validate(\Nethgui\Controller\ValidationReportInterface $report)
 {
     parent::validate($report);
     if ($this->getRequest()->isMutation()) {
         $v = $this->createValidator()->platform('interface-config');
         if (!$v->evaluate(json_encode($this->parameters->getArrayCopy()))) {
             $report->addValidationError($this, 'interface-config', $v);
         }
     }
 }
コード例 #2
0
 public function validate(\Nethgui\Controller\ValidationReportInterface $report)
 {
     // Bind the dhcp-reservation platform validator:
     $this->getValidator('IpAddress')->platform('dhcp-reservation', $this->parameters['MacAddress'], $this->parameters['hostname']);
     parent::validate($report);
 }
コード例 #3
0
 public function validate(\Nethgui\Controller\ValidationReportInterface $report)
 {
     parent::validate($report);
     if ($this->getRequest()->isMutation()) {
         $v = $this->createValidator()->platform('interface-config');
         if (!$v->evaluate(json_encode($this->parameters->getArrayCopy()))) {
             $report->addValidationError($this, 'interface-config', $v);
         }
         $providers = $this->getPlatform()->getDatabase('networks')->getAll();
         $request = $this->getRequest();
         $device = \Nethgui\array_head($request->getPath());
         if (!empty($providers[$this->parameters['ProviderName']]) && $providers[$this->parameters['ProviderName']]['interface'] != $device) {
             $report->addValidationError($this, 'interface-config', $v);
         }
     }
 }