本文整理汇总了PHP中Field::commit方法的典型用法代码示例。如果您正苦于以下问题:PHP Field::commit方法的具体用法?PHP Field::commit怎么用?PHP Field::commit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Field
的用法示例。
在下文中一共展示了Field::commit方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: commit
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());
}
示例2: commit
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;
}
示例3: commit
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');
}
示例4: commit
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');
}
示例5: commit
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}");
}
示例6: commit
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}");
}
示例7: commit
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);
}
示例8: commit
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);
}
示例9: commit
/**
* 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);
}
示例10: commit
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());
}
示例11: commit
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}");
}
示例12: commit
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}");
}
示例13: commit
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}");
}
示例14: commit
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());
}
示例15: commit
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());
}