当前位置: 首页>>代码示例>>PHP>>正文


PHP ctools_export_crud_save函数代码示例

本文整理汇总了PHP中ctools_export_crud_save函数的典型用法代码示例。如果您正苦于以下问题:PHP ctools_export_crud_save函数的具体用法?PHP ctools_export_crud_save怎么用?PHP ctools_export_crud_save使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了ctools_export_crud_save函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: saveToActiveStore

 /**
  * Implements Drupal\configuration\Config\Configuration::saveToActiveStore().
  */
 public function saveToActiveStore(ConfigIteratorSettings &$settings)
 {
     ctools_include('export');
     $object = ctools_export_crud_load($this->getComponent(), $this->getIdentifier());
     if ($object) {
         ctools_export_crud_delete($this->getComponent(), $object);
     }
     $data = $this->getData();
     $data->export_type = NULL;
     // get title_pane key if configured.
     if (isset($data->conf['display']->title_pane)) {
         $title_pane = $data->conf['display']->title_pane;
     }
     $display = panels_save_display($data->conf['display']);
     // title_pane configuration workaround.
     if (isset($display->content[$title_pane])) {
         $pid = $display->content[$title_pane]->pid;
         $display->{$title_pane} = $pid;
         db_update('panels_display')->fields(array('title_pane' => $pid))->condition('did', $display->did)->execute();
     }
     $data->conf['did'] = $data->conf['display']->did;
     unset($data->conf['display']);
     ctools_export_crud_save($this->getComponent(), $data);
     $settings->addInfo('imported', $this->getUniqueId());
 }
开发者ID:isaenkov,项目名称:Dru.io,代码行数:28,代码来源:PageManagerHandlerConfiguration.php

示例2: save

 public function save()
 {
     $op = $this->inDatabase ? 'edit' : 'insert';
     $values = new stdClass();
     // $this;
     $values->sid = $this->sid;
     $values->consumer_type = $this->consumerType;
     $values->consumer_module = $this->consumer->consumerModule;
     $values->status = $this->status ? 1 : 0;
     $values->only_ldap_authenticated = (int) $this->onlyApplyToLdapAuthenticated;
     $values->derive_from_dn = (int) $this->deriveFromDn;
     $values->derive_from_dn_attr = $this->deriveFromDnAttr;
     $values->derive_from_attr = (int) $this->deriveFromAttr;
     $values->derive_from_attr_attr = $this->arrayToLines($this->deriveFromAttrAttr);
     $values->derive_from_attr_use_first_attr = (int) $this->deriveFromAttrUseFirstAttr;
     $values->derive_from_attr_nested = (int) $this->deriveFromAttrNested;
     $values->derive_from_entry = (int) $this->deriveFromEntry;
     $values->derive_from_entry_search_all = (int) $this->deriveFromEntrySearchAll;
     $values->derive_from_entry_entries = $this->arrayToLines($this->deriveFromEntryEntries);
     $values->derive_from_entry_entries_attr = $this->deriveFromEntryEntriesAttr;
     $values->derive_from_entry_attr = $this->deriveFromEntryMembershipAttr;
     $values->derive_from_entry_user_ldap_attr = $this->deriveFromEntryAttrMatchingUserAttr;
     $values->derive_from_entry_use_first_attr = (int) $this->deriveFromEntryUseFirstAttr;
     $values->derive_from_entry_nested = (int) $this->deriveFromEntryNested;
     $values->mappings = $this->arrayToPipeList($this->mappings);
     $values->use_filter = (int) $this->useMappingsAsFilter;
     $values->synch_to_ldap = (int) $this->synchToLdap;
     $values->synch_on_logon = (int) $this->synchOnLogon;
     $values->revoke_ldap_provisioned = (int) $this->revokeLdapProvisioned;
     $values->create_consumers = (int) $this->createConsumers;
     $values->regrant_ldap_provisioned = (int) $this->regrantLdapProvisioned;
     if (module_exists('ctools')) {
         ctools_include('export');
         // Populate our object with ctool's properties
         $object = ctools_export_crud_new('ldap_authorization');
         foreach ($object as $property => $value) {
             if (!isset($values->{$property})) {
                 $values->{$property} = $value;
             }
         }
         $result = ctools_export_crud_save('ldap_authorization', $values);
     } elseif ($op == 'edit') {
         $result = drupal_write_record('ldap_authorization', $values, 'consumer_type');
     } else {
         // insert
         $result = drupal_write_record('ldap_authorization', $values);
     }
     if ($result) {
         $this->inDatabase = TRUE;
     } else {
         drupal_set_message(t('Failed to write LDAP Authorization to the database.'));
     }
     // revert mappings to array and remove temporary properties from ctools export
     $this->mappings = $this->pipeListToArray($values->mappings, TRUE);
     foreach (array('consumer_type', 'consumer_module', 'only_ldap_authenticated', 'derive_from_dn', 'derive_from_dn_attr', 'derive_from_attr', 'derive_from_attr_attr', 'derive_from_attr_use_first_attr', 'derive_from_attr_nested', 'derive_from_entry', 'derive_from_entry_entries', 'derive_from_entry_attr', 'derive_from_entry_search_all', 'derive_from_entry_use_first_attr', 'derive_from_entry_nested', 'use_filter', 'synch_to_ldap', 'synch_on_logon', 'revoke_ldap_provisioned', 'create_consumers', 'regrant_ldap_provisioned') as $prop_name) {
         unset($this->{$prop_name});
     }
 }
开发者ID:bellcom,项目名称:syddjurs.dk,代码行数:58,代码来源:LdapAuthorizationConsumerConfAdmin.class.php

示例3: save

 public function save()
 {
     $op = $this->inDatabase ? 'edit' : 'insert';
     $values = new stdClass();
     // $this;
     $values->sid = $this->sid;
     $values->numeric_consumer_conf_id = $this->numericConsumerConfId;
     $values->consumer_type = $this->consumerType;
     $values->consumer_module = $this->consumer->consumerModule;
     $values->status = $this->status ? 1 : 0;
     $values->only_ldap_authenticated = (int) $this->onlyApplyToLdapAuthenticated;
     $values->use_first_attr_as_groupid = (int) $this->useFirstAttrAsGroupId;
     $values->mappings = serialize($this->mappings);
     $values->use_filter = (int) $this->useMappingsAsFilter;
     $values->synch_to_ldap = (int) $this->synchToLdap;
     $values->synch_on_logon = (int) $this->synchOnLogon;
     $values->revoke_ldap_provisioned = (int) $this->revokeLdapProvisioned;
     $values->create_consumers = (int) $this->createConsumers;
     $values->regrant_ldap_provisioned = (int) $this->regrantLdapProvisioned;
     if (module_exists('ctools')) {
         ctools_include('export');
         // Populate our object with ctool's properties
         $object = ctools_export_crud_new('ldap_authorization');
         foreach ($object as $property => $value) {
             if (!isset($values->{$property})) {
                 $values->{$property} = $value;
             }
         }
         try {
             $values->export_type = NULL;
             $result = ctools_export_crud_save('ldap_authorization', $values);
         } catch (Exception $e) {
             //  debug($e); Integrity constraint violation: 1062 Duplicate entry
             $values->export_type = EXPORT_IN_DATABASE;
             $result = ctools_export_crud_save('ldap_authorization', $values);
         }
         ctools_export_load_object_reset('ldap_authorization');
         // ctools_export_crud_save doesn't invalidate cache
     } else {
         if ($op == 'edit') {
             $result = drupal_write_record('ldap_authorization', $values, 'consumer_type');
         } else {
             // insert
             $result = drupal_write_record('ldap_authorization', $values);
         }
         if ($result) {
             $this->inDatabase = TRUE;
         } else {
             drupal_set_message(t('Failed to write LDAP Authorization to the database.'));
         }
     }
 }
开发者ID:tierce,项目名称:ppbe,代码行数:52,代码来源:LdapAuthorizationConsumerConfAdmin.class.php

示例4: saveToActiveStore

 /**
  * Implements Drupal\configuration\Config\Configuration::saveToActiveStore().
  */
 public function saveToActiveStore(ConfigIteratorSettings &$settings)
 {
     ctools_include('export');
     $object = ctools_export_crud_load($this->getComponent(), $this->getIdentifier());
     if ($object) {
         ctools_export_crud_delete($this->getComponent(), $object);
     }
     $data = $this->getData();
     $data->export_type = NULL;
     $group = field_group_unpack($data);
     ctools_export_crud_save($this->getComponent(), $group);
     $settings->addInfo('imported', $this->getUniqueId());
 }
开发者ID:gnulugtn,项目名称:portal,代码行数:16,代码来源:FieldGroupConfiguration.php

示例5: save

 public function save($op)
 {
     $op = $this->inDatabase ? 'edit' : 'insert';
     if (module_exists('ctools')) {
         // add or edit with ctolls
         ctools_include('export');
         $ctools_values = clone $this;
         foreach ($this->fields() as $field_id => $field) {
             $value = $this->{$field['property_name']};
             if (isset($field['exportable']) && $field['exportable'] === FALSE) {
                 // field not exportable
                 unset($ctools_values->{$field['property_name']});
             } elseif (isset($field['schema']) && $field['property_name'] != $field_id) {
                 // field in property with different name
                 $ctools_values->{$field_id} = $value;
                 unset($ctools_values->{$field['property_name']});
             } else {
                 // do nothing.  property is already in cloned objecat
             }
         }
         // Populate our object with ctool's properties.  copying all properties for backward compatibility
         $object = ctools_export_crud_new('ldap_query');
         foreach ($object as $property_name => $value) {
             if (!isset($ctools_values->{$property_name})) {
                 $ctools_values->{$property_name} = $value;
             }
         }
         $result = ctools_export_crud_save('ldap_query', $ctools_values);
         ctools_export_load_object_reset('ldap_query');
         // ctools_export_crud_save doesn't invalidate cache
     } else {
         $values = array();
         foreach ($this->fields() as $field_id => $field) {
             if (isset($field['schema'])) {
                 $values[$field_id] = $this->{$field['property_name']};
             }
         }
         if ($op == 'edit') {
             // edit w/o ctools
             $result = drupal_write_record('ldap_query', $values, 'qid');
         } else {
             // insert
             $result = drupal_write_record('ldap_query', $values);
         }
     }
     if ($result) {
         $this->inDatabase = TRUE;
     } else {
         drupal_set_message(t('Failed to write LDAP Query to the database.'));
     }
 }
开发者ID:mrschleig,项目名称:sensdata,代码行数:51,代码来源:LdapQueryAdmin.class.php

示例6: save

 public function save()
 {
     $op = $this->inDatabase ? 'edit' : 'insert';
     $values = new stdClass();
     // $this;
     $values->sid = $this->sid;
     $values->numeric_consumer_conf_id = $this->numericConsumerConfId;
     $values->consumer_type = $this->consumerType;
     $values->consumer_module = $this->consumer->consumerModule;
     $values->status = $this->status ? 1 : 0;
     $values->only_ldap_authenticated = (int) $this->onlyApplyToLdapAuthenticated;
     $values->useFirstAttrAsGroupId = (int) $this->useFirstAttrAsGroupId;
     $values->mappings = $this->arrayToPipeList($this->mappings);
     $values->use_filter = (int) $this->useMappingsAsFilter;
     $values->synch_to_ldap = (int) $this->synchToLdap;
     $values->synch_on_logon = (int) $this->synchOnLogon;
     $values->revoke_ldap_provisioned = (int) $this->revokeLdapProvisioned;
     $values->create_consumers = (int) $this->createConsumers;
     $values->regrant_ldap_provisioned = (int) $this->regrantLdapProvisioned;
     if (module_exists('ctools')) {
         ctools_include('export');
         // Populate our object with ctool's properties
         $object = ctools_export_crud_new('ldap_authorization');
         foreach ($object as $property => $value) {
             if (!isset($values->{$property})) {
                 $values->{$property} = $value;
             }
         }
         $values->export_type = $this->numericConsumerConfId ? EXPORT_IN_DATABASE : NULL;
         $result = ctools_export_crud_save('ldap_authorization', $values);
         ctools_export_load_object_reset('ldap_authorization');
         // ctools_export_crud_save doesn't invalidate cache
     } else {
         if ($op == 'edit') {
             $result = drupal_write_record('ldap_authorization', $values, 'consumer_type');
         } else {
             // insert
             $result = drupal_write_record('ldap_authorization', $values);
         }
         if ($result) {
             $this->inDatabase = TRUE;
         } else {
             drupal_set_message(t('Failed to write LDAP Authorization to the database.'));
         }
     }
     // revert mappings to array and remove temporary properties from ctools export
     $this->mappings = $this->pipeListToArray($values->mappings, FALSE);
     foreach (array('consumer_type', 'consumer_module', 'only_ldap_authenticated', 'use_filter', 'synch_to_ldap', 'synch_on_logon', 'revoke_ldap_provisioned', 'create_consumers', 'regrant_ldap_provisioned') as $prop_name) {
         unset($this->{$prop_name});
     }
 }
开发者ID:nhamm18213,项目名称:test,代码行数:51,代码来源:LdapAuthorizationConsumerConfAdmin.class.php

示例7: saveToActiveStore

 /**
  * Implements Drupal\configuration\Config\Configuration::saveToActiveStore().
  */
 public function saveToActiveStore(ConfigIteratorSettings &$settings)
 {
     ctools_include('export');
     $object = ctools_export_crud_load($this->getComponent(), $this->getIdentifier());
     if ($object) {
         ctools_export_crud_delete($this->getComponent(), $object);
     }
     $data = $this->getData();
     $data->export_type = NULL;
     panels_save_display($data->conf['display']);
     $data->conf['did'] = $data->conf['display']->did;
     unset($data->conf['display']);
     ctools_export_crud_save($this->getComponent(), $data);
     $settings->addInfo('imported', $this->getUniqueId());
 }
开发者ID:gnulugtn,项目名称:portal,代码行数:18,代码来源:PageManagerHandlerConfiguration.php

示例8: edit_save_form

 /**
  * Called to save the final product from the edit form.
  */
 function edit_save_form($form_state)
 {
     $item =& $form_state['item'];
     $export_key = $this->plugin['export']['key'];
     $result = ctools_export_crud_save($this->plugin['schema'], $item);
     if ($result) {
         $message = str_replace('%title', check_plain($item->{$export_key}), $this->plugin['strings']['confirmation'][$form_state['op']]['success']);
         drupal_set_message($message);
     } else {
         $message = str_replace('%title', check_plain($item->{$export_key}), $this->plugin['strings']['confirmation'][$form_state['op']]['fail']);
         drupal_set_message($message, 'error');
     }
 }
开发者ID:kennygrage,项目名称:dynastyDish,代码行数:16,代码来源:ctools_export_ui.class.php

示例9: current_search_delete_item_form_submit

/**
 * Form submission handler for facetapi_revert_form_submit().
 */
function current_search_delete_item_form_submit($form, &$form_state)
{
    $name = $form['#current_search']['name'];
    $item = $form['#current_search']['item'];
    // Removes item from the current search block configuration.
    if (isset($item->settings['items'][$name])) {
        $label = $item->settings['items'][$name]['label'];
        drupal_set_message(t('@label has been removed.', array('@label' => $label)));
        unset($item->settings['items'][$name]);
        ctools_export_crud_save('current_search', $item);
    }
    // Resirects back to current search block configuration page.
    $form_state['redirect'] = 'admin/config/search/current_search/list/' . $item->name . '/edit';
}
开发者ID:ludichrislyts,项目名称:fieldWork,代码行数:17,代码来源:current_search_export_ui.class.php

示例10: save

 /**
  * @param string enum $op 'add', 'update'
  */
 public function save($op)
 {
     $values = new stdClass();
     foreach ($this->field_to_properties_map() as $field_name => $property_name) {
         $field_name_lcase = drupal_strtolower($field_name);
         $values->{$field_name_lcase} = $this->{$property_name};
     }
     if (isset($this->bindpw) && $this->bindpw) {
         $values->bindpw = ldap_servers_encrypt($this->bindpw);
     }
     if ($this->bindpw_new) {
         $values->bindpw = ldap_servers_encrypt($this->bindpw_new);
     } elseif ($this->bindpw_clear) {
         $values->bindpw = NULL;
     }
     $values->tls = (int) $this->tls;
     $values->followrefs = (int) $this->followrefs;
     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) {
             $property_lcase = drupal_strtolower($property);
             if (!isset($values->{$property}) || !isset($values->{$property_lcase})) {
                 $values->{$property_lcase} = $value;
             }
         }
         try {
             $values->export_type = NULL;
             $result = ctools_export_crud_save('ldap_servers', $values);
         } catch (Exception $e) {
             $values->export_type = EXPORT_IN_DATABASE;
             $result = ctools_export_crud_save('ldap_servers', $values);
         }
         ctools_export_load_object_reset('ldap_servers');
         // ctools_export_crud_save doesn't invalidate cache
     } else {
         // directly via db
         unset($values->numeric_sid);
         if ($op == 'add') {
             $result = drupal_write_record('ldap_servers', $values);
         } else {
             $result = drupal_write_record('ldap_servers', $values, 'sid');
         }
         ldap_servers_cache_clear();
     }
     //  debug("values sent to save op=$op, ctools=". (int)module_exists('ctools')); debug($values);
     if ($result) {
         $this->inDatabase = TRUE;
     } else {
         drupal_set_message(t('Failed to write LDAP Server to the database.'));
     }
 }
开发者ID:tierce,项目名称:ppbe,代码行数:56,代码来源:LdapServerAdmin.class.php

示例11: save

 /**
  * Save an object in the database.
  *
  * @param ObjectInterface $object
  *   The object to save.
  */
 public static function save(ObjectInterface $object)
 {
     ctools_include('export');
     $configuration = $object->getConfiguration();
     $export = $object->getExport();
     ctools_export_crud_save($configuration['table'], $export);
 }
开发者ID:akapivo,项目名称:www.dmi.be,代码行数:13,代码来源:Openlayers.php

示例12: add_bundle_setting_form_submit

 /**
  * Submit callback for the bundle edit form.
  */
 public function add_bundle_setting_form_submit($form, &$form_state, $bundle, $type_location)
 {
     // Some types do not support changing bundles, so we don't check if it's
     // not possible to change.
     if ($type_location) {
         $new_bundle = drupal_array_get_nested_value($form_state['values'], $type_location);
     } else {
         $new_bundle = $bundle;
     }
     // Check to see if the bundle has changed. If so, we need to move stuff
     // around.
     if ($bundle && $new_bundle != $bundle) {
         // Remove old settings.
         variable_del('panelizer_defaults_' . $this->entity_type . '_' . $bundle);
         $allowed_layouts = variable_get('panelizer_' . $this->entity_type . ':' . $bundle . '_allowed_layouts', NULL);
         if ($allowed_layouts) {
             variable_del('panelizer_' . $this->entity_type . ':' . $bundle . '_allowed_layouts');
             variable_set('panelizer_' . $this->entity_type . ':' . $new_bundle . '_allowed_layouts', $allowed_layouts);
         }
         $default = variable_get('panelizer_' . $this->entity_type . ':' . $bundle . '_default', NULL);
         if ($default) {
             variable_del('panelizer_' . $this->entity_type . ':' . $bundle . '_default');
             variable_set('panelizer_' . $this->entity_type . ':' . $new_bundle . '_default', $default);
         }
         // Load up all panelizer defaults for the old bundle and resave them
         // for the new bundle.
         $panelizer_defaults = $this->get_default_panelizer_objects($bundle);
         if (!empty($panelizer_defaults)) {
             foreach ($panelizer_defaults as $panelizer) {
                 list($entity_type, $old_bundle, $name) = explode(':', $panelizer->name);
                 $panelizer->name = implode(':', array($entity_type, $new_bundle, $name));
                 if ($panelizer->view_mode != 'page_manager') {
                     $panelizer->name .= ':' . $panelizer->view_mode;
                 }
                 // The default display selection.
                 $old_variable_name = 'panelizer_' . $this->entity_type . ':' . $bundle . ':' . $panelizer->view_mode . '_selection';
                 $new_variable_name = 'panelizer_' . $this->entity_type . ':' . $new_bundle . ':' . $panelizer->view_mode . '_selection';
                 $default_layout = variable_get($old_variable_name, NULL);
                 if (!is_null($default_layout)) {
                     variable_set($new_variable_name, $default_layout);
                     variable_del($old_variable_name);
                 }
                 $panelizer->panelizer_key = $new_bundle;
                 // If there's a pnid this should change the name and retain the pnid.
                 // If there is no pnid this will create a new one in the database
                 // because exported panelizer defaults attached to a bundle will have
                 // to be moved to the database in order to follow along and then be
                 // re-exported.
                 // @todo Should we warn the user about this?
                 ctools_export_crud_save('panelizer_defaults', $panelizer);
             }
         }
     }
     // Fix the configuration.
     // If the main configuration is disabled then everything gets disabled.
     if (empty($form_state['values']['panelizer']['status'])) {
         $form_state['values']['panelizer']['view modes'] = array();
     } elseif (!empty($form_state['values']['panelizer']['view modes'])) {
         // Make sure each setting is disabled if the view mode is disabled.
         foreach ($form_state['values']['panelizer']['view modes'] as $view_mode => &$config) {
             if (empty($config['status'])) {
                 foreach ($config as $key => $val) {
                     $config[$key] = 0;
                 }
             }
         }
     }
     // Save the default display for this bundle to a variable so that it may be
     // controlled separately.
     foreach ($this->get_default_panelizer_objects($new_bundle) as $panelizer) {
         if (!empty($form_state['values']['panelizer']['view modes'][$panelizer->view_mode]['default display'])) {
             $new_value = $form_state['values']['panelizer']['view modes'][$panelizer->view_mode]['default display'];
             $variable_name = 'panelizer_' . $this->entity_type . ':' . $new_bundle . ':' . $panelizer->view_mode . '_selection';
             variable_set($variable_name, $new_value);
             // Don't save the setting with the rest of the settings bundle.
             unset($form_state['values']['panelizer']['view modes'][$panelizer->view_mode]['default display']);
         }
     }
     variable_set('panelizer_defaults_' . $this->entity_type . '_' . $new_bundle, $form_state['values']['panelizer']);
     // Unset this so that the type save forms don't try to save it to variables.
     unset($form_state['values']['panelizer']);
 }
开发者ID:Dannie215,项目名称:DanielPope,代码行数:85,代码来源:PanelizerEntityDefault.class.php

示例13: save

 public function save($op)
 {
     $entry = $this;
     foreach ($this->field_to_properties_map() as $field_name => $property_name) {
         $entry->{$field_name} = $this->{$property_name};
     }
     if (isset($this->bindpw) && $this->bindpw) {
         $entry->bindpw = ldap_servers_encrypt($this->bindpw);
     }
     if ($this->bindpw_new) {
         $entry->bindpw = ldap_servers_encrypt($this->bindpw_new);
     } elseif ($this->bindpw_clear) {
         $entry->bindpw = NULL;
     }
     $entry->tls = (int) $entry->tls;
     $result = FALSE;
     if ($op == 'edit') {
         if (module_exists('ctools')) {
             ctools_include('export');
             $result = ctools_export_crud_save('ldap_servers', $entry);
         } 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);
         } 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.'));
     }
 }
开发者ID:bellcom,项目名称:syddjurs.dk,代码行数:44,代码来源:LdapServerAdmin.class.php

示例14: save

 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.'));
     }
 }
开发者ID:nhamm18213,项目名称:test,代码行数:36,代码来源:LdapServerAdmin.class.php

示例15: edit_save_form

 /**
  * Called to save the final product from the edit form.
  */
 function edit_save_form($form_state)
 {
     $item =& $form_state['item'];
     $export_key = $this->plugin['export']['key'];
     $operation_type = $form_state['op'];
     // if snippet is being added for the first time then make entry in snippet and snippet_revison
     // table to have complete information
     if ($operation_type == 'add') {
         $result = ctools_export_crud_save($this->plugin['schema'], $item);
         $result = _save_snippet($form_state['values']);
     } elseif ($operation_type == 'edit') {
         $result = _save_snippet($form_state['values']);
     }
     if ($result) {
         $message = str_replace('%title', check_plain($item->{$export_key}), $this->plugin['strings']['confirmation'][$form_state['op']]['success']);
         drupal_set_message($message);
     } else {
         $message = str_replace('%title', check_plain($item->{$export_key}), $this->plugin['strings']['confirmation'][$form_state['op']]['fail']);
         drupal_set_message($message, 'error');
     }
 }
开发者ID:sharprakeshverma,项目名称:LifeStyle,代码行数:24,代码来源:snippet_ctools_export_ui.class.php


注:本文中的ctools_export_crud_save函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。