function commit()
 {
     if (!parent::commit()) {
         return false;
     }
     $id = $this->get('id');
     if ($id === false) {
         return false;
     }
     $fields = array();
     $fields['field_id'] = $id;
     $fields['default_location'] = $this->get('default_location');
     if (!$fields['default_location']) {
         $fields['default_location'] = 'Brisbane, Australia';
     }
     include_once TOOLKIT . '/class.gateway.php';
     $ch = new Gateway();
     $ch->init();
     $ch->setopt('URL', 'http://maps.google.com/maps/geo?q=' . urlencode($fields['default_location']) . '&output=xml&key=' . $this->_engine->Configuration->get('google-api-key', 'map-location-field'));
     $response = $ch->exec();
     if (!preg_match('/<Placemark/i', $response)) {
         $fields['default_location'] = 'Brisbane, Australia';
         $fields['default_location_coords'] = '-27.46, 153.025';
     } else {
         $xml = new SimpleXMLElement($response);
         $coords = preg_split('/,/', $xml->Response->Placemark[0]->Point->coordinates, -1, PREG_SPLIT_NO_EMPTY);
         $fields['default_location_coords'] = $coords[1] . ',' . $coords[0];
     }
     $this->_engine->Database->query("DELETE FROM `tbl_fields_" . $this->handle() . "` WHERE `field_id` = '{$id}' LIMIT 1");
     return $this->_engine->Database->insert($fields, 'tbl_fields_' . $this->handle());
 }
 public function commit()
 {
     if (!Field::commit()) {
         return false;
     }
     $id = $this->get('id');
     if ($id === false) {
         return false;
     }
     // set field instance values
     $fields = array();
     $fields['field_id'] = $id;
     if (!is_null($this->get('related_field_id'))) {
         $fields['related_field_id'] = implode(',', $this->get('related_field_id'));
     }
     $fields['allow_multiple_selection'] = $this->get('allow_multiple_selection') ? $this->get('allow_multiple_selection') : 'no';
     $fields['limit'] = max(1, (int) $this->get('limit'));
     $fields['field_type'] = $this->get('field_type') ? $this->get('field_type') : 'select';
     // save/replace field instance
     $this->Database->query("DELETE FROM `tbl_fields_" . $this->handle() . "` WHERE `field_id` = '{$id}'");
     if (!$this->Database->insert($fields, 'tbl_fields_' . $this->handle())) {
         return false;
     }
     // build associations
     $this->removeSectionAssociation($id);
     if (!is_null($this->get('related_field_id'))) {
         foreach ($this->get('related_field_id') as $field_id) {
             $this->createSectionAssociation(NULL, $id, $field_id);
         }
     }
     return true;
 }
 public function commit()
 {
     if (!parent::commit() or $this->get('id') === false) {
         return false;
     }
     $fields = array('field_id' => $this->get('id'), 'pre_populate' => $this->get('pre_populate') ? $this->get('pre_populate') : 'no');
     $this->_engine->Database->query("\n\t\t\t\tDELETE FROM\n\t\t\t\t\t`tbl_fields_datetaglist`\n\t\t\t\tWHERE\n\t\t\t\t\t`field_id` = '{$id}'\n\t\t\t\tLIMIT 1\n\t\t\t");
     return $this->_engine->Database->insert($fields, 'tbl_fields_datetaglist');
 }
 public function commit()
 {
     $field_id = $this->get('id');
     if (!parent::commit() or $this->get('id') === false) {
         return false;
     }
     $fields = array('field_id' => $this->get('id'));
     $this->_engine->Database->query("\n\t\t\t\tDELETE FROM\n\t\t\t\t\t`tbl_fields_memberemail`\n\t\t\t\tWHERE\n\t\t\t\t\t`field_id` = '{$field_id}'\n\t\t\t\tLIMIT 1\n\t\t\t");
     return $this->_engine->Database->insert($fields, 'tbl_fields_memberemail');
 }
 public function commit()
 {
     $id = $this->get('id');
     $handle = $this->handle();
     if (!parent::commit() or $id === false) {
         return false;
     }
     $fields = array('field_id' => $id);
     $this->_engine->Database->query("\n\t\t\t\tDELETE FROM\n\t\t\t\t\t`tbl_fields_{$handle}`\n\t\t\t\tWHERE\n\t\t\t\t\t`field_id` = '{$id}'\n\t\t\t\tLIMIT 1\n\t\t\t");
     return $this->_engine->Database->insert($fields, "tbl_fields_{$handle}");
 }
 public function commit()
 {
     if (!parent::commit() or $field_id === false) {
         return false;
     }
     $field_id = $this->get('id');
     $handle = $this->handle();
     $fields = array('field_id' => $field_id, 'nth_entry' => (int) $this->get('nth_entry'));
     Symphony::Database()->query("\n\t\t\t\tDELETE FROM\n\t\t\t\t\t`tbl_fields_{$handle}`\n\t\t\t\tWHERE\n\t\t\t\t\t`field_id` = '{$field_id}'\n\t\t\t\tLIMIT 1\n\t\t\t");
     return Symphony::Database()->insert($fields, "tbl_fields_{$handle}");
 }
 public function commit()
 {
     if (!parent::commit()) {
         return false;
     }
     $id = $this->get('id');
     if ($id === false) {
         return false;
     }
     $fields = array('validator' => null);
     $fields['validator'] = $fields['validator'] == 'custom' ? null : $this->get('validator');
     return FieldManager::saveSettings($id, $fields);
 }
 public function commit()
 {
     if (!parent::commit()) {
         return false;
     }
     $id = $this->get('id');
     if ($id === false) {
         return false;
     }
     $fields = array();
     $fields['field_id'] = $id;
     return FieldManager::saveSettings($id, $fields);
 }
 /**
  * Persist field configuration
  */
 function commit()
 {
     // set up standard Field settings
     if (!parent::commit()) {
         return FALSE;
     }
     $id = $this->get('id');
     if ($id === FALSE) {
         return FALSE;
     }
     $fields = array();
     $fields['field_id'] = $id;
     return FieldManager::saveSettings($id, $fields);
 }
 public function commit()
 {
     if (!parent::commit()) {
         return FALSE;
     }
     $id = $this->get('id');
     if ($id === FALSE) {
         return FALSE;
     }
     $query = "DELETE FROM `tbl_fields_" . $this->handle() . "` WHERE `field_id` = '{$id}' LIMIT 1";
     Symphony::Database()->query($query);
     $fields = array('field_id' => $id, 'starting_value' => $this->get('starting_value'), 'hide' => $this->get('hide'));
     return Symphony::Database()->insert($fields, 'tbl_fields_' . $this->handle());
 }
 public function commit()
 {
     if (!parent::commit()) {
         return;
     }
     $id = $this->get('id');
     if ($id === FALSE) {
         return;
     }
     $fields = array('field_id' => $id, 'url_expression' => $this->get('url_expression'));
     $handle = $this->handle();
     Symphony::Database()->query("\n            DELETE FROM\n                `tbl_fields_{$handle}`\n            WHERE\n                `field_id` = '{$id}'\n            LIMIT 1\n        ");
     return Symphony::Database()->insert($fields, "tbl_fields_{$handle}");
 }
 public function commit()
 {
     if (!parent::commit()) {
         return false;
     }
     $id = $this->get('id');
     $handle = $this->handle();
     if ($id === false) {
         return false;
     }
     $fields = array('field_id' => $id, 'anchor_label' => $this->get('anchor_label'), 'expression' => $this->get('expression'), 'new_window' => $this->get('new_window'), 'hide' => $this->get('hide'));
     Symphony::Database()->query("DELETE FROM `tbl_fields_{$handle}` WHERE `field_id` = '{$id}' LIMIT 1");
     return Symphony::Database()->insert($fields, "tbl_fields_{$handle}");
 }
 public function commit()
 {
     if (!parent::commit()) {
         return false;
     }
     $id = $this->get('id');
     $handle = $this->handle();
     if ($id === false) {
         return false;
     }
     $fields = array('field_id' => $id, 'expression' => $this->get('expression'), 'hide' => $this->get('hide'));
     Symphony::Database()->query("\n\t\t\t\tDELETE FROM\n\t\t\t\t\t`tbl_fields_{$handle}`\n\t\t\t\tWHERE\n\t\t\t\t\t`field_id` = '{$id}'\n\t\t\t\tLIMIT 1\n\t\t\t");
     return Symphony::Database()->insert($fields, "tbl_fields_{$handle}");
 }
Example #14
0
 function commit()
 {
     if (!parent::commit()) {
         return false;
     }
     $id = $this->get('id');
     if ($id === false) {
         return false;
     }
     $fields = array();
     $fields['field_id'] = $id;
     $this->_engine->Database->query("DELETE FROM `tbl_fields_" . $this->handle() . "` WHERE `field_id` = '{$id}' LIMIT 1");
     return $this->_engine->Database->insert($fields, 'tbl_fields_' . $this->handle());
 }
Example #15
0
 public function commit()
 {
     if (!parent::commit()) {
         return false;
     }
     $id = $this->get('id');
     if ($id === false) {
         return false;
     }
     $fields = array();
     $fields['field_id'] = $id;
     $fields['validator'] = $fields['validator'] == 'custom' ? NULL : $this->get('validator');
     Symphony::Database()->query("DELETE FROM `tbl_fields_" . $this->handle() . "` WHERE `field_id` = '{$id}' LIMIT 1");
     return Symphony::Database()->insert($fields, 'tbl_fields_' . $this->handle());
 }
 function commit()
 {
     if (!parent::commit()) {
         return false;
     }
     $id = $this->get('id');
     if ($id === false) {
         return false;
     }
     $fields = array();
     $fields['field_id'] = $id;
     $fields['show_in_publish'] = $this->get('hide_in_publish') == 'yes' ? 'no' : 'yes';
     Symphony::Database()->query("DELETE FROM `tbl_fields_" . $this->handle() . "` WHERE `field_id` = '{$id}' LIMIT 1");
     return Symphony::Database()->insert($fields, 'tbl_fields_' . $this->handle());
 }
Example #17
0
 public function commit()
 {
     if (!parent::commit()) {
         return FALSE;
     }
     $id = $this->get('id');
     if ($id === FALSE) {
         return FALSE;
     }
     $fields = array();
     $fields['field_id'] = $id;
     $fields['note'] = $this->get('note');
     $fields['editable'] = $this->get('editable') ? 1 : 0;
     return FieldManager::saveSettings($id, $fields);
 }
 public function commit()
 {
     if (!parent::commit()) {
         return false;
     }
     $id = $this->get('id');
     if ($id === false) {
         return false;
     }
     $fields = array();
     $fields['field_id'] = $id;
     $fields['developers_only'] = $this->get('developers_only') ? $this->get('developers_only') : 'no';
     Symphony::Database()->query("DELETE FROM `tbl_fields_" . $this->handle() . "` WHERE `field_id` = '{$id}' LIMIT 1");
     return Symphony::Database()->insert($fields, 'tbl_fields_' . $this->handle());
 }
 public function commit()
 {
     if (!Field::commit()) {
         return false;
     }
     $id = $this->get('id');
     if ($id === false) {
         return false;
     }
     $fields = array();
     $fields['field_id'] = $id;
     $fields['pre_populate'] = $this->get('pre_populate') ? $this->get('pre_populate') : 'no';
     $fields['mode'] = $this->get('mode') ? $this->get('mode') : 'normal';
     return FieldManager::saveSettings($id, $fields);
 }
 function commit()
 {
     if (!parent::commit()) {
         return false;
     }
     $id = $this->get('id');
     if ($id === false) {
         return false;
     }
     $fields = array();
     $fields['field_id'] = $id;
     $fields['force_sort'] = $this->get('force_sort');
     $fields['hide'] = $this->get('hide');
     Symphony::Database()->query("DELETE FROM `tbl_fields_" . $this->handle() . "` WHERE `field_id` = '{$id}' LIMIT 1");
     return Symphony::Database()->insert($fields, 'tbl_fields_' . $this->handle());
 }
 public function commit()
 {
     if (!parent::commit()) {
         return false;
     }
     $id = $this->get('id');
     $handle = $this->handle();
     if ($id === false) {
         return false;
     }
     $fields = array();
     $fields['field_id'] = $id;
     $fields['pre_populate'] = $this->get('pre_populate') ? $this->get('pre_populate') : 'no';
     $this->_engine->Database->query("DELETE FROM `tbl_fields_{$handle}` WHERE `field_id` = '{$id}' LIMIT 1");
     $this->_engine->Database->insert($fields, "tbl_fields_{$handle}");
 }
 public function commit()
 {
     if (!parent::commit()) {
         return FALSE;
     }
     $id = $this->get('id');
     if ($id === FALSE) {
         return FALSE;
     }
     $fields = array();
     $fields['field_id'] = $id;
     $fields['note'] = $this->get('note');
     $fields['editable'] = $this->get('editable') ? 1 : 0;
     Symphony::Database()->query("DELETE FROM `tbl_fields_" . $this->handle() . "` WHERE `field_id` = '{$id}' LIMIT 1");
     return Symphony::Database()->insert($fields, 'tbl_fields_' . $this->handle());
 }
Example #23
0
 public function commit()
 {
     if (!parent::commit()) {
         return false;
     }
     $id = $this->get('id');
     if ($id === false) {
         return false;
     }
     $fields = array();
     if ($this->get('formatter') != 'none') {
         $fields['formatter'] = $this->get('formatter');
     }
     $fields['size'] = $this->get('size');
     return FieldManager::saveSettings($id, $fields);
 }
 /**
  * Persist field configuration
  */
 function commit()
 {
     // set up standard Field settings
     if (!parent::commit()) {
         return FALSE;
     }
     $id = $this->get('id');
     if ($id === FALSE) {
         return FALSE;
     }
     $fields = array();
     $fields['field_id'] = $id;
     // delete existing field configuration
     $this->_engine->Database->query("DELETE FROM `tbl_fields_" . $this->handle() . "` WHERE `field_id` = '{$id}' LIMIT 1");
     // save new field configuration
     return $this->_engine->Database->insert($fields, 'tbl_fields_' . $this->handle());
 }
Example #25
0
 public function commit()
 {
     if (!parent::commit()) {
         return false;
     }
     $id = $this->get('id');
     $handle = $this->handle();
     if ($id === false) {
         return false;
     }
     $fields['field_id'] = $id;
     $available_codes = $this->get('available_codes');
     $fields['available_codes'] = empty($available_codes) ? '' : implode(',', $available_codes);
     $fields['allow_multiple_selection'] = $this->get('allow_multiple_selection') ? $this->get('allow_multiple_selection') : 'no';
     Symphony::Database()->query("DELETE FROM `tbl_fields_{$handle}` WHERE `field_id` = '{$id}' LIMIT 1");
     return Symphony::Database()->insert($fields, "tbl_fields_{$handle}");
 }
 public function commit($propogate = null)
 {
     if (!parent::commit()) {
         return false;
     }
     $id = $this->get('id');
     $handle = $this->handle();
     $options = $this->get('options');
     if ($id === false) {
         return false;
     }
     $options = preg_split('/\\s*,\\s*/', $options, -1, PREG_SPLIT_NO_EMPTY);
     $options = implode(', ', $options);
     $fields = array('field_id' => $id, 'options' => $options);
     $this->Database->query("\n\t\t\t\tDELETE FROM\n\t\t\t\t\t`tbl_fields_{$handle}`\n\t\t\t\tWHERE\n\t\t\t\t\t`field_id` = '{$id}'\n\t\t\t\tLIMIT 1\n\t\t\t");
     return $this->Database->insert($fields, "tbl_fields_{$handle}");
 }
 public function commit()
 {
     if (!parent::commit()) {
         return FALSE;
     }
     $id = $this->get('id');
     if ($id === FALSE) {
         return FALSE;
     }
     $fields = array();
     $fields['field_id'] = $id;
     $fields['related_sbl_id'] = $this->get('related_sbl_id');
     Symphony::Database()->query("DELETE FROM `tbl_fields_" . $this->handle() . "` WHERE `field_id` = '{$id}'");
     if (!Symphony::Database()->insert($fields, 'tbl_fields_' . $this->handle())) {
         return FALSE;
     }
     return TRUE;
 }
Example #28
0
 function commit()
 {
     if (!parent::commit()) {
         return false;
     }
     $id = $this->get('id');
     if ($id === false) {
         return false;
     }
     $fields = array();
     $fields['field_id'] = $id;
     if ($this->get('options') != '') {
         $fields['options'] = $this->get('options');
     }
     if ($this->get('valid_until') != '') {
         $fields['valid_until'] = $this->get('valid_until');
     }
     $this->Database->query("DELETE FROM `tbl_fields_" . $this->handle() . "` WHERE `field_id` = '{$id}' LIMIT 1");
     if (!$this->Database->insert($fields, 'tbl_fields_' . $this->handle())) {
         return false;
     }
     return true;
 }
 public function commit()
 {
     if (!parent::commit() or $field_id === false) {
         return false;
     }
     $field_id = $this->get('id');
     $handle = $this->handle();
     $parent_section_id = $this->get('parent_section_id');
     // Find existing values:
     if (!isset($parent_section_id)) {
         $data = $this->_engine->Database->fetchRow(0, "\n\t\t\t\t\tSELECT\n\t\t\t\t\t\tf.*\n\t\t\t\t\tFROM\n\t\t\t\t\t\t`tbl_fields_{$handle}` AS f\n\t\t\t\t\tWHERE\n\t\t\t\t\t\tf.field_id = '{$field_id}'\n\t\t\t\t\tLIMIT 1\n\t\t\t\t");
         $this->set('parent_section_id', $data['parent_section_id']);
         $this->set('parent_field_id', $data['parent_field_id']);
     }
     $fields = array('field_id' => $this->get('id'), 'parent_section_id' => $this->get('parent_section_id'), 'parent_field_id' => $this->get('parent_field_id'));
     // Cleanup:
     $this->_engine->Database->query("\n\t\t\t\tDELETE FROM\n\t\t\t\t\t`tbl_fields_{$handle}`\n\t\t\t\tWHERE\n\t\t\t\t\t`field_id` = '{$field_id}'\n\t\t\t\tLIMIT 1\n\t\t\t");
     // Create:
     if (!$this->_engine->Database->insert($fields, "tbl_fields_{$handle}")) {
         return false;
     }
     return true;
 }
Example #30
0
 public function commit()
 {
     if (!parent::commit()) {
         return false;
     }
     $id = $this->get('id');
     if ($id === false) {
         return false;
     }
     $fields = array();
     $fields['pre_populate_source'] = is_null($this->get('pre_populate_source')) ? null : implode(',', $this->get('pre_populate_source'));
     $fields['validator'] = $fields['validator'] == 'custom' ? null : $this->get('validator');
     if (!FieldManager::saveSettings($id, $fields)) {
         return false;
     }
     SectionManager::removeSectionAssociation($id);
     foreach ($this->get('pre_populate_source') as $field_id) {
         if ($field_id === 'none') {
             continue;
         }
         if (!is_null($field_id) && is_numeric($field_id)) {
             SectionManager::createSectionAssociation(null, $id, (int) $field_id, $this->get('show_association') == 'yes' ? true : false, $this->get('association_ui'), $this->get('association_editor'));
         }
     }
     return true;
 }