public function LdapServerAdmin::save in Lightweight Directory Access Protocol (LDAP) 7
Same name and namespace in other branches
- 8.2 ldap_servers/LdapServerAdmin.class.php \LdapServerAdmin::save()
- 7.2 ldap_servers/LdapServerAdmin.class.php \LdapServerAdmin::save()
1 call to LdapServerAdmin::save()
- LdapServerAdmin::drupalFormSubmit in ldap_servers/
LdapServerAdmin.class.php
File
- ldap_servers/
LdapServerAdmin.class.php, line 102
Class
Code
public function save($op) {
$entry = $this
->entry();
$result = FALSE;
if ($op == 'edit') {
if (module_exists('ctools')) {
ctools_include('export');
$result = ctools_export_crud_save('ldap_servers', $entry);
ctools_export_load_object_reset('ldap_servers');
// ctools_export_crud_save doesn't invalidate cache
}
else {
$result = drupal_write_record('ldap_servers', $entry, 'sid');
}
}
else {
if (module_exists('ctools')) {
ctools_include('export');
// Populate our object with ctool's properties
$object = ctools_export_crud_new('ldap_servers');
foreach ($object as $property => $value) {
if (!isset($entry->{$property})) {
$entry->{$property} = $value;
}
}
$result = ctools_export_crud_save('ldap_servers', $entry);
ctools_export_load_object_reset('ldap_servers');
// ctools_export_crud_save doesn't invalidate cache
}
else {
$result = drupal_write_record('ldap_servers', $entry);
}
}
if ($result) {
$this->inDatabase = TRUE;
}
else {
drupal_set_message(t('Failed to write LDAP Server to the database.'));
}
}