protected function onRequest()
 {
     parent::onRequest();
     if ($this->getSentValue('delete') === $this->translate('Delete')) {
         $this->object()->delete();
         $this->setSuccessUrl($this->getSuccessUrl()->without('field_id'));
         $this->redirectOnSuccess($this->translate('Field has been removed'));
     }
 }
Пример #2
0
 public function onSuccess()
 {
     if (!$this->getValue('key_column')) {
         if ($default = $this->getDefaultKeyColumnName()) {
             $this->setElementValue('key_column', $default);
             $this->object()->key_column = $default;
         }
     }
     parent::onSuccess();
 }
 public function onSuccess()
 {
     $fieldId = $this->getValue('datafield_id');
     if (!ctype_digit($fieldId)) {
         $field = DirectorDatafield::create(array('varname' => trim($fieldId, '$'), 'caption' => $this->getValue('caption'), 'datatype' => 'Icinga\\Module\\Director\\DataType\\DataTypeString'));
         $field->store($this->getDb());
         $this->setElementValue('datafield_id', $field->id);
         $this->object()->datafield_id = $field->id;
     }
     return parent::onSuccess();
 }
Пример #4
0
 public function onSuccess()
 {
     $sourceColumn = $this->getValue('source_column');
     if ($sourceColumn === self::EXPRESSION) {
         unset($this->source_column);
         $this->removeElement('source_column');
     } else {
         if (!$this->getElement('source_expression')) {
             $this->addHidden('source_expression', '${' . $sourceColumn . '}');
         }
     }
     $object = $this->getObject();
     $object->rule_id = $this->rule->id;
     // ?!
     $destination = $this->getValue('destination_field');
     if ($destination === 'vars.*') {
         $destination = $this->getValue('customvar');
         $object->destination_field = 'vars.' . $destination;
     }
     if ($object->hasBeenModified()) {
         if (!$object->hasBeenLoadedFromDb()) {
             $object->priority = $this->rule->getPriorityForNextProperty();
         }
     }
     return parent::onSuccess();
 }
 public function onSuccess()
 {
     $this->object()->list_id = $this->listId;
     parent::onSuccess();
 }
 public function onSuccess()
 {
     $this->clearOutdatedSettings();
     if ($class = $this->getValue('datatype')) {
         if (array_key_exists($class, $this->enumDataTypes())) {
             $this->addHidden('format', $class::getFormat());
         }
     }
     parent::onSuccess();
 }
 public function onSuccess()
 {
     $this->object()->owner = self::username();
     parent::onSuccess();
 }