Пример #1
0
 public function configure()
 {
     $physical_access_controllers = BasePhysicalAccessController::getControllers();
     $home_automation_controllers = BaseHomeAutomationController::getControllers();
     $this->widgetSchema['number_of_physical_access'] = new sfWidgetFormInput();
     $this->validatorSchema['number_of_physical_access'] = new sfValidatorInteger(array('min' => 0, 'max' => $this->max_controllers, 'required' => true));
     $this->widgetSchema->setLabel('number_of_physical_access', 'Number of physical access controllers');
     if (!is_null($this->getOption('nb_pac'))) {
         $nb_pac = $this->getOption('nb_pac');
     } else {
         $nb_pac = ConfigurationHelper::getParameter(null, 'number_of_physical_access');
     }
     if ($nb_pac > $this->max_controllers) {
         $nb_pac = $this->max_controllers;
     }
     if (count($physical_access_controllers) > 0) {
         for ($i = 1; $i <= $nb_pac; $i++) {
             $this->widgetSchema['physical_access_controller' . $i] = new sfWidgetFormChoice(array('choices' => $physical_access_controllers));
             $this->validatorSchema['physical_access_controller' . $i] = new sfValidatorChoice(array('choices' => array_keys($physical_access_controllers), 'required' => false));
             $this->widgetSchema->setLabel('physical_access_controller' . $i, 'Physical Access Controller');
             foreach ($physical_access_controllers as $physical_access_controller => $name) {
                 $form = PhysicalAccessControllerConfigurationForm::create($physical_access_controller, null);
                 $labelName = $form->getPhysicalAccessController()->getName() . $i;
                 $this->embedForm($labelName, $form);
                 $this->widgetSchema->setLabel($labelName, $name);
             }
         }
     }
     $this->widgetSchema['number_of_home_automation'] = new sfWidgetFormInput();
     $this->validatorSchema['number_of_home_automation'] = new sfValidatorInteger(array('min' => 0, 'max' => $this->max_home_automation, 'required' => true));
     $this->widgetSchema->setLabel('number_of_home_automation', 'Number of home automation controllers');
     if (!is_null($this->getOption('nb_hac'))) {
         $nb_hac = $this->getOption('nb_hac');
     } else {
         $nb_hac = ConfigurationHelper::getParameter(null, 'number_of_home_automation');
     }
     if ($nb_hac > $this->max_home_automation) {
         $nb_hac = $this->max_home_automation;
     }
     if (count($home_automation_controllers) > 0) {
         for ($i = 1; $i <= $nb_hac; $i++) {
             $this->widgetSchema['home_automation_controller' . $i] = new sfWidgetFormChoice(array('choices' => $home_automation_controllers));
             $this->validatorSchema['home_automation_controller' . $i] = new sfValidatorChoice(array('choices' => array_keys($home_automation_controllers), 'required' => false));
             $this->widgetSchema->setLabel('home_automation_controller' . $i, 'Home automation controller');
             foreach ($home_automation_controllers as $home_automation_controller => $name) {
                 $form = HomeAutomationControllerConfigurationForm::create($home_automation_controller, null);
                 $labelName = $form->getHomeAutomationController()->getName() . $i;
                 $this->embedForm($labelName, $form);
                 $this->widgetSchema->setLabel($labelName, $name);
             }
         }
     }
     $this->addSubConfigurationForm('Network', 'Network');
     $this->addSubConfigurationForm('Email', 'Email');
     $this->addSubConfigurationForm('General', 'General');
     $this->addSubConfigurationForm('Rename', 'Rename');
     $this->addSubConfigurationForm('Backup', 'Backup');
     $this->addSubConfigurationForm('Print', 'Print');
     $this->setDefault('number_of_physical_access', 1);
     $this->setDefault('number_of_home_automation', 1);
     $this->setDefaults(ConfigurationHelper::get());
     $this->widgetSchema->setNameFormat('configuration[%s]');
     $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);
 }
 public function configure()
 {
     parent::configure();
     $this->widgetSchema->setLabels(array('host' => 'KNXnet/IP host', 'service' => 'KNXnet/IP port'));
     $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);
 }
 public function configure()
 {
     parent::configure();
     $this->widgetSchema->setLabels(array());
     $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);
 }
 public function configure()
 {
     parent::configure();
     $this->widgetSchema->setLabels(array('host' => 'IPX800 host', 'service' => 'IPX800 port', 'preset' => 'Preset URL'));
     $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);
 }
 public function configure()
 {
     parent::configure();
     $this->widgetSchema->setLabels(array('command' => 'Command', 'force-status' => 'Force status'));
     $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);
 }