コード例 #1
0
ファイル: Openlayers.php プロジェクト: akapivo/www.dmi.be
 /**
  * Gets all available OL objects.
  *
  * @param string $type
  *   The plugin type.
  *
  * @return array
  *   Array of Openlayers CTools object instances. (stdClass)
  */
 public static function loadAllExportable($type = NULL)
 {
     ctools_include('export');
     $exports = ctools_export_crud_load_all('openlayers_' . drupal_strtolower(check_plain($type)) . 's');
     uasort($exports, function ($a, $b) {
         return strcmp($a->name, $b->name);
     });
     return $exports;
 }
コード例 #2
0
ファイル: Tooltip.php プロジェクト: EMerino236/afiperudrupal
 /**
  * {@inheritdoc}
  */
 public function optionsForm(&$form, &$form_state)
 {
     $layers = ctools_export_crud_load_all('openlayers_layers');
     $options = array('' => t('<Choose the layer>'));
     foreach ($layers as $machine_name => $data) {
         $options[$machine_name] = $data->name;
     }
     $form['options']['layer'] = array('#type' => 'select', '#title' => t('Layer'), '#default_value' => isset($form_state['item']->options['layer']) ? $form_state['item']->options['layer'] : '', '#description' => t('Select the layer.'), '#options' => $options, '#required' => TRUE);
     $form['options']['positioning'] = array('#type' => 'select', '#title' => t('Positioning'), '#default_value' => isset($form_state['item']->options['positioning']) ? $form_state['item']->options['positioning'] : 'top-left', '#description' => t('Defines how the overlay is actually positioned. Default is top-left.'), '#options' => openlayers_positioning_options(), '#required' => TRUE);
 }
コード例 #3
0
ファイル: Snap.php プロジェクト: EMerino236/afiperudrupal
 /**
  * {@inheritdoc}
  */
 public function optionsForm(&$form, &$form_state)
 {
     $sources = ctools_export_crud_load_all('openlayers_sources');
     $options = array('' => t('<Choose the source>'));
     foreach ($sources as $machine_name => $data) {
         $options[$machine_name] = $data->name;
     }
     $form['options'] = array('#tree' => TRUE);
     $form['options']['source'] = array('#type' => 'select', '#title' => t('Source'), '#default_value' => isset($form_state['item']->options['source']) ? $form_state['item']->options['source'] : '', '#description' => t('Select the vector source.'), '#options' => $options, '#required' => TRUE);
 }
コード例 #4
0
/**
 * Custom form submission handler for system theme settings.
 *
 * Handles general settings plus enabling and disabling of content types throughtout the system.
 */
function sociale_platforme_settings_form_submit(&$form, $form_state)
{
    /**
     * General Settings
     */
    variable_set('site_name', $form_state['values']['site_name']);
    variable_set('site_mail', $form_state['values']['site_mail']);
    /**
     * Content Types
     */
    $content_types = $form_state["values"]["sp_content_types"];
    $browsing_widgets = ctools_export_crud_load_all('commons_bw_ui');
    // Enable or disable browsing widgets (Quicktabs).
    foreach ($browsing_widgets as $widget) {
        if (array_key_exists($widget->bundle, $content_types)) {
            $status = $content_types[$widget->bundle];
            if ($status === 0) {
                ctools_export_crud_disable('commons_bw_ui', $widget);
            } else {
                ctools_export_crud_enable('commons_bw_ui', $widget);
            }
        }
    }
    // Grant or remove content access view permissions.
    foreach ($content_types as $type_name => $status) {
        $settings = array();
        if ($status === 0) {
            $settings['view_own'] = array();
            $settings['view'] = array();
        } else {
            $settings['view_own'] = array(1, 2);
            $settings['view'] = array(1, 2);
        }
        content_access_set_settings($settings, $type_name);
    }
    node_access_rebuild();
}
コード例 #5
0
 /**
  * Master entry point for handling a list.
  *
  * It is unlikely that a child object will need to override this method,
  * unless the listing mechanism is going to be highly specialized.
  */
 function list_page($js, $input)
 {
     $this->items = ctools_export_crud_load_all($this->plugin['schema'], $js);
     // Respond to a reset command by clearing session and doing a drupal goto
     // back to the base URL.
     if (isset($input['op']) && $input['op'] == t('Reset')) {
         unset($_SESSION['ctools_export_ui'][$this->plugin['name']]);
         if (!$js) {
             drupal_goto($_GET['q']);
         }
         // clear everything but form id, form build id and form token:
         $keys = array_keys($input);
         foreach ($keys as $id) {
             if (!in_array($id, array('form_id', 'form_build_id', 'form_token'))) {
                 unset($input[$id]);
             }
         }
         $replace_form = TRUE;
     }
     // If there is no input, check to see if we have stored input in the
     // session.
     if (!isset($input['form_id'])) {
         if (isset($_SESSION['ctools_export_ui'][$this->plugin['name']]) && is_array($_SESSION['ctools_export_ui'][$this->plugin['name']])) {
             $input = $_SESSION['ctools_export_ui'][$this->plugin['name']];
         }
     } else {
         $_SESSION['ctools_export_ui'][$this->plugin['name']] = $input;
         unset($_SESSION['ctools_export_ui'][$this->plugin['name']]['q']);
     }
     // This is where the form will put the output.
     $this->rows = array();
     $this->sorts = array();
     $form_state = array('plugin' => $this->plugin, 'input' => $input, 'rerender' => TRUE, 'no_redirect' => TRUE, 'object' => &$this);
     if (!isset($form_state['input']['form_id'])) {
         $form_state['input']['form_id'] = 'ctools_export_ui_list_form';
     }
     // If we do any form rendering, it's to completely replace a form on the
     // page, so don't let it force our ids to change.
     if ($js && isset($_POST['ajax_html_ids'])) {
         unset($_POST['ajax_html_ids']);
     }
     $form = drupal_build_form('ctools_export_ui_list_form', $form_state);
     $form = drupal_render($form);
     $output = $this->list_header($form_state) . $this->list_render($form_state) . $this->list_footer($form_state);
     if (!$js) {
         $this->list_css();
         return $form . $output;
     }
     $commands = array();
     $commands[] = ajax_command_replace('#ctools-export-ui-list-items', $output);
     if (!empty($replace_form)) {
         $commands[] = ajax_command_replace('#ctools-export-ui-list-form', $form);
     }
     print ajax_render($commands);
     ajax_footer();
 }
コード例 #6
0
/**
 * Tests if the configuration name already exists.
 *
 * @return
 *   A boolean flagging whether the item exists.
 */
function current_search_config_exists($name)
{
    $configs = ctools_export_crud_load_all('current_search');
    return isset($configs[$name]);
}
コード例 #7
0
ファイル: ctools_export_ui.class.php プロジェクト: EWB/lrcs
 /**
  * Master entry point for handling a list.
  *
  * It is unlikely that a child object will need to override this method,
  * unless the listing mechanism is going to be highly specialized.
  */
 function list_page($js, $input)
 {
     $this->items = ctools_export_crud_load_all($this->plugin['schema'], $js);
     // Respond to a reset command by clearing session and doing a drupal goto
     // back to the base URL.
     if (isset($input['op']) && $input['op'] == t('Reset')) {
         unset($_SESSION['ctools_export_ui'][$this->plugin['name']]);
         if (!$js) {
             return drupal_goto($_GET['q']);
         }
         // clear everything but form id, form build id and form token:
         $keys = array_keys($input);
         foreach ($keys as $id) {
             if (!in_array($id, array('form_id', 'form_build_id', 'form_token'))) {
                 unset($input[$id]);
             }
         }
         $replace_form = TRUE;
     }
     // If there is no input, check to see if we have stored input in the
     // session.
     if (!isset($input['form_id'])) {
         if (isset($_SESSION['ctools_export_ui'][$this->plugin['name']]) && is_array($_SESSION['ctools_export_ui'][$this->plugin['name']])) {
             $input = $_SESSION['ctools_export_ui'][$this->plugin['name']];
         }
     } else {
         $_SESSION['ctools_export_ui'][$this->plugin['name']] = $input;
         unset($_SESSION['ctools_export_ui'][$this->plugin['name']]['q']);
     }
     // We rely on list_form_submit() to build the table rows. Clean out any
     // AJAX markers that would prevent list_form() from automatically
     // submitting the form.
     if ($js) {
         unset($input['js'], $input['ctools_ajax']);
     }
     // This is where the form will put the output.
     $this->rows = array();
     $this->sorts = array();
     $form_state = array('plugin' => $this->plugin, 'input' => $input, 'rerender' => TRUE, 'no_redirect' => TRUE, 'object' => &$this);
     $help_area = $this->help_area($form_state);
     ctools_include('form');
     $form = ctools_build_form('ctools_export_ui_list_form', $form_state);
     $output = $this->list_header($form_state) . $this->list_render($form_state) . $this->list_footer($form_state);
     if (!$js) {
         $this->list_css();
         return $help_area . $form . $output;
     }
     ctools_include('ajax');
     $commands = array();
     $commands[] = ctools_ajax_command_replace('#ctools-export-ui-list-items', $output);
     if (!empty($replace_form)) {
         $commands[] = ctools_ajax_command_replace('#ctools-export-ui-list-form', $form);
     }
     ctools_ajax_render($commands);
 }
コード例 #8
0
ファイル: Object.php プロジェクト: EMerino236/afiperudrupal
 /**
  * Returns an array with the maps this object is attached on.
  *
  * @return array
  *   An array of map objects this object is attached on. Keyed by the map
  *   machine name.
  */
 public function getParents()
 {
     $maps = ctools_export_crud_load_all('openlayers_maps');
     $parents = array();
     foreach ($maps as $map) {
         $map = openlayers_object_load('map', $map);
         foreach ($map->getCollection()->getFlatList() as $object) {
             if ($object->machine_name == $this->machine_name) {
                 $parents[$map->machine_name] = $map;
             }
         }
     }
     return $parents;
 }
コード例 #9
0
/**
 * Tests if the store name already exists.
 *
 * @name
 *   Machine name of the arc2_store to check.
 *
 * @return
 *   A boolean flagging whether the item exists.
 */
function arc2_store_exists($name)
{
    $configs = ctools_export_crud_load_all('arc2_store_settings');
    return isset($configs[$name]);
}
コード例 #10
0
 /**
  * List footer.
  */
 function list_footer($form_state)
 {
     ctools_include('export');
     $items = ctools_export_crud_load_all('fieldable_panels_pane_type');
     $entity_info = entity_get_info('fieldable_panels_pane');
     $header = array(t('Name'), array('data' => t('Operations'), 'colspan' => 2));
     $rows = array();
     if (!empty($entity_info['bundles'])) {
         foreach ($entity_info['bundles'] as $bundle => $info) {
             // Filter out bundles that already exist as ctools exportable objects.
             if (isset($items[$bundle])) {
                 continue;
             }
             $row = array();
             $label = check_plain($info['label']);
             $label .= ' <small>' . t('(Machine name: @type)', array('@type' => $bundle)) . '</small>';
             $row[] = $label;
             $operations = array();
             $operations['list'] = array('title' => t('list'), 'href' => 'admin/structure/fieldable-panels-panes/manage/' . $bundle);
             $operations['add'] = array('title' => t('add'), 'href' => 'admin/structure/fieldable-panels-panes/manage/' . $bundle . '/add');
             $operations['fields'] = array('title' => t('manage fields'), 'href' => $this->field_admin_path($bundle, 'fields'));
             $operations['display'] = array('title' => t('manage display'), 'href' => $this->field_admin_path($bundle, 'display'));
             $ops = theme('links', array('links' => $operations, 'attributes' => array('class' => array('links', 'inline'))));
             $row[] = $ops;
             $rows[] = $row;
         }
         if (!empty($rows)) {
             $variables = array('caption' => t('Legacy bundles that are not managed by the bundle administrative UI are listed here.'), 'header' => $header, 'rows' => $rows);
             return theme('table', $variables);
         }
     }
 }