コード例 #1
0
 /**
  * {@inheritdoc}
  */
 public function optionsForm(&$form, &$form_state)
 {
     $form['options']['grouptitle'] = array('#type' => 'textfield', '#title' => 'Layer group title', '#default_value' => $this->getOption('grouptitle', 'Base layers'));
     $all_layers = \Drupal\openlayers\Openlayers::loadAllExportable('Layer');
     array_walk($all_layers, function ($object) {
         $object->weight = 0;
         $object->enabled = 0;
     });
     foreach ($this->getOption('grouplayers', array()) as $weight => $layer) {
         $layer = Openlayers::load('layer', $layer);
         $all_layers[$layer->getMachineName()]->weight = $weight;
         $all_layers[$layer->getMachineName()]->enabled = 1;
     }
     uasort($all_layers, function ($a, $b) {
         if ($a->enabled > $b->enabled) {
             return -1;
         } else {
             if ($a->enabled < $b->enabled) {
                 return 1;
             }
         }
         if ($a->weight < $b->weight) {
             return -1;
         } else {
             if ($a->weight > $b->weight) {
                 return 1;
             }
         }
         if ($a->machine_name < $b->machine_name) {
             return -1;
         } else {
             if ($a->machine_name > $b->machine_name) {
                 return 1;
             }
         }
         return 0;
     });
     $data = array();
     $i = 0;
     /* @var \Drupal\openlayers\Types\Layer $layer */
     foreach ($all_layers as $machine_name => $layer) {
         $data[$machine_name] = array('name' => $layer->name, 'machine_name' => $layer->machine_name, 'factory_service' => $layer->factory_service, 'weight' => $i++, 'enabled' => isset($layer->enabled) ? $layer->enabled : 0);
     }
     $rows = array();
     $row_elements = array();
     foreach ($data as $id => $entry) {
         $rows[$id] = array('data' => array(array('class', array('entry-cross')), array('data' => array('#type' => 'weight', '#title' => t('Weight'), '#title_display' => 'invisible', '#default_value' => $entry['weight'], '#parents' => array('grouplayers', $id, 'weight'), '#attributes' => array('class' => array('entry-order-weight')))), array('data' => array('#type' => 'hidden', '#default_value' => $entry['machine_name'], '#parents' => array('grouplayers', $id, 'machine_name'))), array('data' => array('#type' => 'checkbox', '#title' => t('Enable'), '#title_display' => 'invisible', '#default_value' => $entry['enabled'], '#parents' => array('grouplayers', $id, 'enabled'))), check_plain($entry['name']), check_plain($entry['machine_name']), check_plain($entry['factory_service']), l(t('Edit'), 'admin/structure/openlayers/layers/list/' . $entry['machine_name'] . '/edit/options', array('query' => array('destination' => current_path())))), 'class' => array('draggable'));
         // Build rows of the form elements in the table.
         $row_elements[$id] = array('weight' => &$rows[$id]['data'][1]['data'], 'enabled' => &$rows[$id]['data'][2]['data'], 'machine_name' => &$rows[$id]['data'][3]['data']);
     }
     $form['grouplayers'] = array('#type' => 'fieldset', '#title' => 'Layers', '#collapsible' => FALSE, '#collapsed' => FALSE);
     // Add the table to the form.
     $form['grouplayers']['table_layers'] = array('#theme' => 'table', 'elements' => $row_elements, '#header' => array(array('data' => NULL, 'colspan' => 2), array('data' => t('Enabled'), 'colspan' => 2), t('Name'), t('Machine name'), t('Factory service'), t('Operations')), '#rows' => $rows, '#empty' => t('There are no entries available.'), '#attributes' => array('id' => 'entry-order-layers'));
     drupal_add_tabledrag('entry-order-layers', 'order', 'sibling', 'entry-order-weight');
 }
/**
 * Theme the providers table.
 *
 * @ingroup themeable
 */
function theme_entityreference_prepopulate_providers_table($variables)
{
    $form = $variables['form'];
    $provider_names = element_children($form['enabled']);
    foreach ($provider_names as $provider_name) {
        $row = array('data' => array(drupal_render($form['title'][$provider_name]), drupal_render($form['enabled'][$provider_name]), drupal_render($form['weight'][$provider_name])), 'class' => array('draggable'));
        $rows[] = $row;
    }
    $header = array(array('data' => t('Provider')), array('data' => t('Enabled')), array('data' => t('Weight')));
    $table_variables = array('header' => $header, 'rows' => $rows, 'attributes' => array('id' => 'table-providers'));
    $output = theme('table', $table_variables);
    drupal_add_tabledrag('table-providers', 'order', 'sibling', 'provider-weight');
    return $output;
}
コード例 #3
0
ファイル: template.php プロジェクト: jgosier/kamusi
function paldo_keditmultiple_form(&$form)
{
    $output = '<div style="width:530px;overflow:scroll; padding:10px;">';
    $header = array('', t('Entry'), t(' '), t('Definition'), t('Notes'), t('Examples'), t('Priority'), t('Group'));
    $rows = array();
    /*   $groups = array_keys(array_fill(0, count(array_filter(element_children($form), 'is_numeric'))-1, 0));
        foreach ($groups as $group){
            drupal_add_tabledrag('kgrouping', 'match', 'sibling', 'group-weight-'.$group, NULL);
            drupal_add_tabledrag('kgrouping', 'order', 'sibling', 'priority-in-group', 'group-weight-'.$group);
        }*/
    drupal_add_tabledrag('keditmultiple', 'order', 'sibling', 'priority-in-group');
    foreach (element_children($form) as $i => $key) {
        if (isset($form[$key]['pos'])) {
            $row = $grow = array('');
            $row[] = drupal_render($form[$key]['title']);
            $row[] = drupal_render($form[$key]['pos']);
            $row[] = drupal_render($form[$key]['defn']);
            $row[] = drupal_render($form[$key]['notes']);
            $row[] = drupal_render($form[$key]['example']);
            // Add class to priority weight fields for drag and drop.
            if (isset($form[$key]['priority'])) {
                $form[$key]['priority']['#attributes']['class'] = 'priority-in-group';
                $row[] = drupal_render($form[$key]['priority']);
            }
            if (isset($form[$key]['grouping'])) {
                $form[$key]['grouping']['#attributes']['class'] = 'group-weight-' . $form[$key]['grouping']['#value'];
                $grow[] = $row[] = array('data' => drupal_render($form[$key]['grouping']), 'colspan' => 4);
            }
            $rows[] = array('data' => $row, 'class' => 'draggable');
            if ($i < count($groups)) {
                //  $rows[] = array('data' => $grow, 'class' => 'tabledrag-root draggable');
            }
        }
    }
    $output .= theme('table', $header, $rows, array('id' => 'keditmultiple', 'width' => '100%'));
    $output .= drupal_render($form);
    $output .= '</div>';
    return $output;
}
コード例 #4
0
 *   start_date:      (int) Start date of the poll
 *   end_date:        (int) End date of the poll
 *   mode:            The mode used to store the vote: normal, cookie, unlimited
 *   cookie_duration: (int) If mode is cookie, the number of minutes to delay votes.
 *   state:           Is the poll 'open' or 'close'
 *   behavior:        approval or pool - determines how to treat multiple vote/user 
 *                    tally. When plugin is installed, voting will default to tabulating
 *                    values returned from voting API.
 *   max_choices:     (int) How many choices a user can select per vote.
 *   show_results:    When to display results - aftervote, afterclose or never.
 *   electoral:       Boolean - voting restricted to users in an electoral list.
 *   write_in:        Boolean - all write-in voting.
 *   block:           Boolean - Poll can be displayed as a block.
 */
$tableId = 'advpolltable-' . $node->nid;
drupal_add_tabledrag($tableId, 'match', 'sibling', 'advpoll-weight', NULL, NULL, FALSE);
$choices = $data->choices;
?>
<ul class="selectable-list">
  <?php 
$row = 0;
?>
  <?php 
foreach ($choices as $choice) {
    ?>
  <li class="selectable">
    <span class="choice"><?php 
    print $choice['choice'];
    ?>
</span>
    <a class="vote add" href="" style="display: none"><?php 
 * @file
 * Default theme implementation to configure format manager filter admin page.
 *
 * Available variables:
 * - $form_submit: Form submit button.
 *
 * Each $node_default_rows contains a row
 *
 * Each $data in $node_default_rows contains:
 * - $data->role: Role name.
 * - $data->format_select: Drop-down menu for setting format.
 * - $data->weight_select: Drop-down menu for setting weights.
 */
// Add table javascript
drupal_add_tabledrag('node-format-defaults', 'order', 'sibling', 'better-formats-role-node-weight');
drupal_add_tabledrag('comment-format-defaults', 'order', 'sibling', 'better-formats-role-comment-weight');
?>
<div class="description"><?php 
print t('Only formats that a role has permission to use are shown.');
?>
</div>
<fieldset>
  <legend><strong>Node Defaults</strong></legend>
  <table id="node-format-defaults">
    <thead>
      <tr>
        <th><?php 
print t('Role');
?>
</th>
        <th><?php 
コード例 #6
0
/**
 * Theme the attachment form.
 * Note: required to output prefix/suffix.
 *
 * @ingroup themeable
 */
function phptemplate_upload_form_new($form)
{
    // add wysiwyg insert buttons
    foreach (element_children($form['files']) as $key) {
        $filepath = $form['files'][$key]['filepath']['#value'];
        $fid = $form['files'][$key]['fid']['#value'];
        if (image_get_info($filepath)) {
            $thumb_path = 'sites/default/files/imagecache/small_thumb/' . $filepath;
            /* The javascript for this is in imc_alba module */
            $form['files'][$key]['insertbutton'] = array('#type' => 'markup', '#value' => '<button type="button" class="insertimg" id="' . file_create_url($filepath) . '">Big</button>' . '<button type="button" class="insertthumb" id="' . file_create_url($thumb_path) . '">Small</button>');
        }
    }
    drupal_add_tabledrag('upload-attachments', 'order', 'sibling', 'upload-weight');
    $output = drupal_render($form);
    return $output;
}
コード例 #7
0
ファイル: template.php プロジェクト: hoannm/d6e
function rootcandy_system_settings_form($form)
{
    $themes = list_themes();
    $enabled_theme = arg(4);
    if ($form['#id'] == 'system-theme-settings' and $enabled_theme == 'rootcandy' || $themes[$enabled_theme]->base_theme == 'rootcandy') {
        foreach ($form['theme_specific']['rows'] as $rid => $row) {
            //we are only interested in numeric keys
            if (intval($rid)) {
                $this_row = $row['data']['#value'];
                //Add the weight field to the row
                $weight = $form['theme_specific']['rows'][$rid]['role-weight-' . $rid]['#value'];
                $this_row[] = drupal_render($form['theme_specific']['navigation']['nav-by-role']['rootcandy_navigation_source_' . $rid]);
                $this_row[] = drupal_render($form['theme_specific']['rows'][$rid]['role-weight-' . $rid]);
                //Add the row to the array of rows
                $table_rows[$weight] = array('data' => $this_row, 'class' => 'draggable');
            }
        }
        ksort($table_rows);
        $header = array("Role", "Navigation menu", "Order");
        $form['theme_specific']['navigation']['role-weights']['content']['#value'] = theme('table', $header, $table_rows, array('id' => 'rootcandy-settings-table'));
        $output = drupal_render($form);
        drupal_add_tabledrag('rootcandy-settings-table', 'order', 'sibling', 'weight');
    } else {
        $output = drupal_render($form);
    }
    return $output;
}
コード例 #8
0
<?php

// $Id: homebox-admin-display-form.tpl.php,v 1.1.4.2 2010/06/17 23:19:07 mikestefff Exp $
/**
 * @file
 * homebox-admin-display-form.tpl.php
 * Default theme implementation to configure homebox blocks.
 */
// Add table javascript.
drupal_add_js('misc/tableheader.js');
drupal_add_js(drupal_get_path('module', 'block') . '/block.js');
foreach ($block_regions as $region => $title) {
    drupal_add_tabledrag('blocks', 'match', 'sibling', 'block-region-select', 'block-region-' . $region, NULL, FALSE);
    drupal_add_tabledrag('blocks', 'order', 'sibling', 'block-weight', 'block-weight-' . $region);
}
?>
<table id="blocks" class="sticky-enabled">
  <thead>
    <tr>
      <th><?php 
print t('Block');
?>
</th>
      <th><?php 
print t('Region');
?>
</th>
      <th><?php 
print t('Custom title');
?>
</th>
コード例 #9
0
ファイル: template.php プロジェクト: knieper/crltmich
function city_magazine_custom_content_multiple_values($element)
{
    $field_name = $element['#field_name'];
    $field = content_fields($field_name);
    $output = '';
    if ($field['multiple'] >= 1) {
        $table_id = $element['#field_name'] . '_values';
        $order_class = $element['#field_name'] . '-delta-order';
        $required = !empty($element['#required']) ? '<span class="form-required" title="' . t('This field is required.') . '">*</span>' : '';
        $header = array(array('data' => t('!title: !required', array('!title' => $element['#title'], '!required' => $required)) . '<br /><div class="description">' . $element['#description'] . '</div>', 'colspan' => 2), t('Order'));
        $rows = array();
        // Sort items according to '_weight' (needed when the form comes back after
        // preview or failed validation)
        $items = array();
        foreach (element_children($element) as $key) {
            if ($key !== $element['#field_name'] . '_add_more') {
                $items[] =& $element[$key];
            }
        }
        usort($items, '_content_sort_items_value_helper');
        // Add the items as table rows.
        foreach ($items as $key => $item) {
            $item['_weight']['#attributes']['class'] = $order_class;
            $delta_element = drupal_render($item['_weight']);
            $cells = array(array('data' => '', 'class' => 'content-multiple-drag'), drupal_render($item), array('data' => $delta_element, 'class' => 'delta-order'));
            $rows[] = array('data' => $cells, 'class' => 'draggable');
        }
        $output .= theme('table', $header, $rows, array('id' => $table_id, 'class' => 'content-multiple-table'));
        $output .= drupal_render($element[$element['#field_name'] . '_add_more']);
        drupal_add_tabledrag($table_id, 'order', 'sibling', $order_class);
    } else {
        foreach (element_children($element) as $key) {
            $output .= drupal_render($element[$key]);
        }
    }
    return $output;
}
コード例 #10
0
ファイル: template.php プロジェクト: ATouhou/www.alim.org
/**
 * Theme the menu overview form into a table.
 *  Modified theme_bookmarks_overview_form
 * in Bookmark module
 * hide the  default enabled , public checkboxes in mange bookmarks section 
 */
function alim_bookmarks_overview_form($form) {
  $output = ''; global $user;
  if ($_GET['q'] == BOOKMARKS_PRESETS_URL) {
    $header = array(
      t('Menu item'),
      array('data' => t('Operations'), 'colspan' => '3'),
    );
  }
  else {
    drupal_add_tabledrag('bookmarks-overview', 'match', 'parent', 'menu-plid', 'menu-plid', 'menu-mlid', TRUE, MENU_MAX_DEPTH - 1);
    drupal_add_tabledrag('bookmarks-overview', 'order', 'sibling', 'menu-weight');

    if (module_exists('bookmarks_public')) {
      $header = array(
        t('Menu item'),
        array('data' => t(''), 'class' => 'checkbox'), //Enabled
        array('data' => t(' '), 'class' => 'checkbox'),//Expanded
        array('data' => t(' '), 'class' => 'checkbox'),//Public removed
        t('Weight'),
        array('data' => t('Operations'), 'colspan' => '3'),
      );
    }
    else {
      $header = array(
        t('Menu item'),
        array('data' => t(''), 'class' => 'checkbox'),//Enabled
        array('data' => t(''), 'class' => 'checkbox'),//Expanded
        t('Weight'),
        array('data' => t('Operations'), 'colspan' => '3'),
      );
    }
  }

  $rows = array();
  foreach (element_children($form) as $mlid) {
    if (isset($form[$mlid]['hidden'])) {
      $element = &$form[$mlid];
      // Build a list of operations.
      $operations = array();
      foreach (element_children($element['operations']) as $op) {
        $operations[] = drupal_render($element['operations'][$op]);
      }
      while (count($operations) < 2) {
        $operations[] = '';
      }

      // Add special classes to be used for tabledrag.js.
      $element['plid']['#attributes']['class'] = 'menu-plid';
      $element['mlid']['#attributes']['class'] = 'menu-mlid';
      $element['weight']['#attributes']['class'] = 'menu-weight';

      // Change the parent field to a hidden. This allows any value but hides the field.
      $element['plid']['#type'] = 'hidden';
      if ($_GET['q'] == BOOKMARKS_PRESETS_URL) {
        $element['hidden']['#type'] = 'hidden';
      }

      $row = array();
      $row[] = theme('indentation', $element['#item']['depth'] - 1) . drupal_render($element['title']);
      if ($_GET['q'] != BOOKMARKS_PRESETS_URL) {
        $row[] = array('data' => drupal_render($element['hidden']), 'class' => 'checkbox');
        $row[] = array('data' => drupal_render($element['expanded']), 'class' => 'checkbox');
        if (module_exists('bookmarks_public')) {
          $row[] = array('data' => drupal_render($element['public']), 'class' => 'checkbox');
        }
      }
      $row[] = drupal_render($element['weight']) . drupal_render($element['plid']) . drupal_render($element['mlid']);
      $row = array_merge($row, $operations);

      $row = array_merge(array('data' => $row), $element['#attributes']);
      $row['class'] = !empty($row['class']) ? $row['class'] . ' draggable' : 'draggable';
      $rows[] = $row;
    }
  }
  if ($rows) {
    $output .= theme('table', $header, $rows, array('id' => 'bookmarks-overview'));
  }
  				$menuid1 = db_result(db_query("SELECT value as lpage FROM {profile_values} WHERE fid='%d' AND uid= '%d'", 12 , $user->uid ));
  				if(  isset($menuid1) && $menuid1 != ''  ) 
					$out =  l( t('Go to Last page'), $menuid1 ,array('attributes' => array(  
				'title' => 'Go to the last place you were reading.'  ) )  );
				else
					$out =  l( t('Go to Last page'), 'library/quran/surah/arabic/1/ARB' ,array('attributes' => array(  
				'title' => 'Go to the last place you were reading'  ) )  );
				 $output .= '<div style="padding:10px 0 10px 20px;" >'.$out.'</div>';
				
  $output .= drupal_render($form);

  return $output;
}
コード例 #11
0
 * Each $block_listing[$state] contains an array of blocks for that region.
 *
 * Each $data in $block_listing[$state] contains:
 * - $data->region_title: Region title for the listed block.
 * - $data->block_config: Block title and other config options.
 * - $data->state_select: Drop-down menu for assigning a state.
 * - $data->weight_select: Drop-down menu for setting weights.
 * - $data->operations: Row containing all the operations for the block.
 */
// Add table javascript.
drupal_add_js('misc/tableheader.js');
drupal_add_js(drupal_get_path('module', 'region_manager') . '/region_manager.js');
drupal_add_js(array('block_name' => _region_manager_block_name()), 'setting');
foreach ($block_states as $state => $title) {
    //drupal_add_tabledrag('blocks', 'match', 'sibling', 'block-region-select', 'block-region-'. $region, NULL, FALSE);
    drupal_add_tabledrag('region-manager-blocks-active_path', 'order', 'sibling', 'block-weight');
}
?>

<?php 
foreach ($block_states as $state => $title) {
    ?>
  <?php 
    $row = 0;
    ?>
  <?php 
    print $state_prefix[$state];
    ?>
  <div class="table-wrapper">
    <table id="region-manager-blocks-<?php 
    print $state;
コード例 #12
0
<?php

// $Id: advpoll-display-ranking-form.tpl.php,v 1.1.2.1 2009/04/11 16:02:47 chriskennedy Exp $
/**
 * @file advpoll-display-ranking-form.tpl.php
 * Default theme implementation to show voting form for ranked polls.
 *
 * $writein_choice - writein_choice element, if poll needs it.
 * $form_id
 * $form_submit
 * $choice_list - choices in the poll.
 * $tabledrag_group_class
 */
// Add table JavaScript.
drupal_add_js(drupal_get_path('module', 'advpoll') . '/advpoll-vote.js');
drupal_add_tabledrag($form_id . '-table', 'order', 'self', 'advpoll-choice-order', NULL, NULL, FALSE);
?>
<div class="poll">
<div class="advpoll-available-choices">
<div class="choice-header"><?php 
print t('Choices');
?>
</div>
<div class="vote-choices">
<?php 
print $choice_list;
?>
</div>
<?php 
if (isset($writein_choice)) {
    ?>
コード例 #13
0
/**
 * Implements template_preprocess_views_view_table().
 */
function ringstedtheme_preprocess_views_view_table(&$vars)
{
    $view = $vars['view'];
    // We need the raw data for this grouping, which is passed in as $vars['rows'].
    // However, the template also needs to use for the rendered fields.  We
    // therefore swap the raw data out to a new variable and reset $vars['rows']
    // so that it can get rebuilt.
    // Store rows so that they may be used by further preprocess functions.
    $result = $vars['result'] = $vars['rows'];
    $vars['rows'] = array();
    $vars['field_classes'] = array();
    $vars['header'] = array();
    $options = $view->style_plugin->options;
    $handler = $view->style_plugin;
    $default_row_class = isset($options['default_row_class']) ? $options['default_row_class'] : TRUE;
    $row_class_special = isset($options['row_class_special']) ? $options['row_class_special'] : TRUE;
    $fields =& $view->field;
    $columns = $handler->sanitize_columns($options['columns'], $fields);
    $active = !empty($handler->active) ? $handler->active : '';
    $order = !empty($handler->order) ? $handler->order : 'asc';
    $query = tablesort_get_query_parameters();
    if (isset($view->exposed_raw_input)) {
        $query += $view->exposed_raw_input;
    }
    // Fields must be rendered in order as of Views 2.3, so we will pre-render
    // everything.
    $renders = $handler->render_fields($result);
    // Save start date values of Events
    $start_date_strings = array();
    foreach ($columns as $field => $column) {
        // Create a second variable so we can easily find what fields we have and what the
        // CSS classes should be.
        $vars['fields'][$field] = drupal_clean_css_identifier($field);
        if ($active == $field) {
            $vars['fields'][$field] .= ' active';
        }
        // render the header labels
        if ($field == $column && empty($fields[$field]->options['exclude'])) {
            $label = check_plain(!empty($fields[$field]) ? $fields[$field]->label() : '');
            if (empty($options['info'][$field]['sortable']) || !$fields[$field]->click_sortable()) {
                $vars['header'][$field] = $label;
            } else {
                $initial = !empty($options['info'][$field]['default_sort_order']) ? $options['info'][$field]['default_sort_order'] : 'asc';
                if ($active == $field) {
                    $initial = $order == 'asc' ? 'desc' : 'asc';
                }
                $title = t('sort by @s', array('@s' => $label));
                if ($active == $field) {
                    $label .= theme('tablesort_indicator', array('style' => $initial));
                }
                $query['order'] = $field;
                $query['sort'] = $initial;
                $link_options = array('html' => TRUE, 'attributes' => array('title' => $title), 'query' => $query);
                $vars['header'][$field] = l($label, $_GET['q'], $link_options);
            }
            $vars['header_classes'][$field] = '';
            // Set up the header label class.
            if ($fields[$field]->options['element_default_classes']) {
                $vars['header_classes'][$field] .= "views-field views-field-" . $vars['fields'][$field];
            }
            $class = $fields[$field]->element_label_classes(0);
            if ($class) {
                if ($vars['header_classes'][$field]) {
                    $vars['header_classes'][$field] .= ' ';
                }
                $vars['header_classes'][$field] .= $class;
            }
            // Add a CSS align class to each field if one was set
            if (!empty($options['info'][$field]['align'])) {
                $vars['header_classes'][$field] .= ' ' . drupal_clean_css_identifier($options['info'][$field]['align']);
            }
            // Add a header label wrapper if one was selected.
            if ($vars['header'][$field]) {
                $element_label_type = $fields[$field]->element_label_type(TRUE, TRUE);
                if ($element_label_type) {
                    $vars['header'][$field] = '<' . $element_label_type . '>' . $vars['header'][$field] . '</' . $element_label_type . '>';
                }
            }
        }
        // Add a CSS align class to each field if one was set
        if (!empty($options['info'][$field]['align'])) {
            $vars['fields'][$field] .= ' ' . drupal_clean_css_identifier($options['info'][$field]['align']);
        }
        // Render each field into its appropriate column.
        foreach ($result as $num => $row) {
            // Add field classes
            $vars['field_classes'][$field][$num] = '';
            if ($fields[$field]->options['element_default_classes']) {
                $vars['field_classes'][$field][$num] = "views-field views-field-" . $vars['fields'][$field];
            }
            if ($classes = $fields[$field]->element_classes($num)) {
                if ($vars['field_classes'][$field][$num]) {
                    $vars['field_classes'][$field][$num] .= ' ';
                }
                $vars['field_classes'][$field][$num] .= $classes;
            }
            $vars['field_attributes'][$field][$num] = array();
            if (!empty($fields[$field]) && empty($fields[$field]->options['exclude'])) {
                $field_output = $renders[$num][$field];
                $element_type = $fields[$field]->element_type(TRUE, TRUE);
                // Custom render settings for newsletter tables
                $field_prefix = '';
                $field_suffix = '';
                $element_style = '';
                if ($view->name == 'view_newsletter' && $view->current_display == 'related_news_list') {
                    switch ($field) {
                        case 'title':
                            $element_type = 'h3';
                            $element_style = 'style="width:255px; margin:0; font-size:22px; font-weight:bold; font-family: Arial, sans-serif; line-height:120%;"';
                            $field_output = preg_replace('/(^<a href="\\S*")(>.*<\\/a>)/', '$1 style="color:#333; text-decoration:none;"$2', $field_output);
                            break;
                        case 'field_date':
                            $element_type = 'p';
                            $element_style = 'style="color:#6c6c6c; text-transform:lowercase; font-size:16px; line-height:145%;"';
                            break;
                        case 'field_teaser':
                            $element_type = 'p';
                            $element_style = 'style="color:#333; font-size:16px; line-height:145%; font-family: Arial, sans-serif;"';
                            break;
                    }
                } elseif ($view->name == 'view_newsletter' && $view->current_display == 'related_events_list') {
                    switch ($field) {
                        case 'field_kultunaut_event_start_date':
                            $start_date_strings[$num] = $field_output;
                            $field_output = '';
                            break;
                        case 'field_kultunaut_event_end_date':
                            if (isset($start_date_strings[$num])) {
                                $event_start_timestamp = strtotime($start_date_strings[$num]);
                                $event_end_timestamp = strtotime($field_output);
                                $event_start_month = format_date($event_start_timestamp, 'custom', 'M');
                                $event_end_month = format_date($event_end_timestamp, 'custom', 'M');
                                $event_start_day = date('d', $event_start_timestamp);
                                $event_end_day = date('d', $event_end_timestamp);
                                if ($event_start_month === $event_end_month) {
                                    if ($event_start_day === $event_end_day) {
                                        $date = "<span class='day'>{$event_start_day}</span> " . "<span class='month'>{$event_start_month}</span>";
                                    } else {
                                        $date = "<span class='day'>{$event_start_day}-{$event_end_day}</span> " . "<span class='month'>{$event_start_month}</span>";
                                    }
                                } else {
                                    $date = "<span class='day-month'>{$event_start_day} {$event_start_month}</span>-" . "<span class='day-month'>{$event_end_day} {$event_end_month}</span>";
                                }
                                $field_output = $date;
                            }
                            $field_prefix = '<!-- this table fix bug in Outlook.  -->
          <table style="width: 100%; border:0; border-collapse:collapse;">
            <tr>
              <td
                style="font-size: 0;line-height: 0;vertical-align: top;width:50px;">
                <!-- fix padding in Outlook-->
                <p
                  style="margin: 0;padding: 0;font-size: 8px;line-height: 8px;background:#d2000f;">
                  &nbsp;</p>';
                            $element_type = 'h3';
                            $element_style = 'style="width:50px; padding:0; background:#d2000f; margin:0; color:#fff; text-align:center; font-size:15px; font-weight:bold; font-family: Arial, sans-serif; line-height:18px;"';
                            $field_suffix = '<!-- fix padding in Outlook-->
                <p
                  style="margin: 0;padding: 0;font-size: 12px;line-height: 12px;background:#d2000f;">
                  &nbsp;</p>
              </td>';
                            break;
                        case 'title':
                            $field_prefix = '<td
                style="font-size: 0;line-height: 0;vertical-align: top;width:10px;">
                &nbsp;</td>
              <td style="font-size: 0;line-height: 0;vertical-align: middle;">';
                            $element_type = 'h4';
                            $element_style = 'style="margin: 0; padding: 0;font-size:24px;line-height: 24px;font-weight:bold;font-family: Arial, sans-serif; color:#333;"';
                            $field_output = preg_replace('/(^<a href="\\S*")(>.*<\\/a>)/', '$1 style="color:#333; text-decoration:none;"$2', $field_output);
                            $field_suffix = '</td>
            </tr>
          </table>';
                            break;
                        case 'body':
                            $field_prefix = '<!-- fix padding in Outlook-->
          <p style="margin: 0;padding: 0;font-size: 25px;line-height: 25px;">
            &nbsp;</p>';
                            $element_type = 'p';
                            $element_style = 'style="margin:0; padding: 0 25px 0 0; line-height:140%; font-size:16px; color:#333; font-family: Arial, sans-serif;"';
                            break;
                    }
                } elseif ($view->name == 'view_newsletter' && $view->current_display == 'related_links_list') {
                    if (!empty($renders[$num]['field_related_links_content'])) {
                        $renders[$num]['field_related_links_link'] = '';
                    }
                    if (!empty($field_output)) {
                        $element_type = 'li';
                        $element_style = 'style="font-size:16px; line-height:210%;"';
                        $field_output = preg_replace('/(^<a href="\\S*")(>.*<\\/a>)/', '$1 style="color:#333; text-decoration:none;"$2', $field_output);
                        $field_output = '<img src="https://gallery.mailchimp.com/9d2a465548ae81441a4c760fd/images/arrow.png" width="9" height="14" style="vertical-align:middle; padding-right:8px;" alt="Arrow">' . $field_output;
                    }
                } elseif ($view->name == 'page_subscription' && $view->current_display == 'jobs_pane') {
                    switch ($field) {
                        case 'title':
                            $element_type = 'h3';
                            $element_style = 'style="width:255px; margin:0; font-size:22px; font-weight:bold; font-family: Arial, sans-serif; line-height:120%;"';
                            $field_output = preg_replace('/(^<a href="\\S*")(>.*<\\/a>)/', '$1 style="color:#333; text-decoration:none;"$2', $field_output);
                            break;
                        case 'body':
                            $element_type = 'p';
                            $element_style = 'style="color:#333; font-size:16px; line-height:145%; font-family: Arial, sans-serif;"';
                            break;
                    }
                } elseif ($view->name == 'page_subscription' && $view->current_display == 'meetings_pane') {
                    switch ($field) {
                        case 'title':
                            $element_type = 'h3';
                            $element_style = 'style="width:255px; margin:0; font-size:22px; font-weight:bold; font-family: Arial, sans-serif; line-height:120%;"';
                            $field_output = preg_replace('/(^<a href="\\S*")(>.*<\\/a>)/', '$1 style="color:#333; text-decoration:none;"$2', $field_output);
                            break;
                        case 'field_os2web_meetings_type':
                            $field_prefix = '<span style="color:#333; font-size:16px; line-height:145%; font-family: Arial, sans-serif;">' . t('Type') . ': </span>';
                            $element_type = 'span';
                            $element_style = 'style="color:#333; font-size:16px; line-height:145%; font-family: Arial, sans-serif;"';
                            break;
                    }
                } elseif ($view->name == 'page_subscription' && $view->current_display == 'articles_pane') {
                    switch ($field) {
                        case 'title':
                            $element_type = 'h3';
                            $element_style = 'style="width:255px; margin:0; font-size:22px; font-weight:bold; font-family: Arial, sans-serif; line-height:120%;"';
                            $field_output = preg_replace('/(^<a href="\\S*")(>.*<\\/a>)/', '$1 style="color:#333; text-decoration:none;"$2', $field_output);
                            break;
                        case 'views_ifempty':
                            $element_type = 'p';
                            $element_style = 'style="color:#333; font-size:16px; line-height:145%; font-family: Arial, sans-serif;"';
                            break;
                    }
                } elseif ($view->name == 'page_subscription' && $view->current_display == 'hearings_pane') {
                    switch ($field) {
                        case 'title':
                            $element_type = 'h3';
                            $element_style = 'style="width:255px; margin:0; font-size:22px; font-weight:bold; font-family: Arial, sans-serif; line-height:120%;"';
                            $field_output = preg_replace('/(^<a href="\\S*")(>.*<\\/a>)/', '$1 style="color:#333; text-decoration:none;"$2', $field_output);
                            break;
                        case 'field_teaser':
                            $element_type = 'p';
                            $element_style = 'style="color:#333; font-size:16px; line-height:145%; font-family: Arial, sans-serif;"';
                            break;
                    }
                }
                if ($element_type) {
                    if ($element_style) {
                        $field_output = '<' . $element_type . ' ' . $element_style . '>' . $field_output . '</' . $element_type . '>';
                    } else {
                        $field_output = '<' . $element_type . '>' . $field_output . '</' . $element_type . '>';
                    }
                }
                if ($field_prefix) {
                    $field_output = $field_prefix . $field_output;
                }
                if ($field_suffix) {
                    $field_output = $field_output . $field_suffix;
                }
                // Don't bother with separators and stuff if the field does not show up.
                if (empty($field_output) && !empty($vars['rows'][$num][$column])) {
                    continue;
                }
                // Place the field into the column, along with an optional separator.
                if (!empty($vars['rows'][$num][$column])) {
                    if (!empty($options['info'][$column]['separator'])) {
                        $vars['rows'][$num][$column] .= filter_xss_admin($options['info'][$column]['separator']);
                    }
                } else {
                    $vars['rows'][$num][$column] = '';
                }
                $vars['rows'][$num][$column] .= $field_output;
            }
        }
        // Remove columns if the option is hide empty column is checked and the field is not empty.
        if (!empty($options['info'][$field]['empty_column'])) {
            $empty = TRUE;
            foreach ($vars['rows'] as $num => $columns) {
                $empty &= empty($columns[$column]);
            }
            if ($empty) {
                foreach ($vars['rows'] as $num => &$column_items) {
                    unset($column_items[$column]);
                    unset($vars['header'][$column]);
                }
            }
        }
    }
    // Hide table header if all labels are empty.
    if (!array_filter($vars['header'])) {
        $vars['header'] = array();
    }
    $count = 0;
    foreach ($vars['rows'] as $num => $row) {
        $vars['row_classes'][$num] = array();
        if ($row_class_special) {
            $vars['row_classes'][$num][] = $count++ % 2 == 0 ? 'odd' : 'even';
        }
        if ($row_class = $handler->get_row_class($num)) {
            $vars['row_classes'][$num][] = $row_class;
        }
    }
    if ($row_class_special) {
        $vars['row_classes'][0][] = 'views-row-first';
        $vars['row_classes'][count($vars['row_classes']) - 1][] = 'views-row-last';
    }
    $vars['classes_array'] = array('views-table');
    if (empty($vars['rows']) && !empty($options['empty_table'])) {
        $vars['rows'][0][0] = $view->display_handler->render_area('empty');
        // Calculate the amounts of rows with output.
        $vars['field_attributes'][0][0]['colspan'] = count($vars['header']);
        $vars['field_classes'][0][0] = 'views-empty';
    }
    if (!empty($options['sticky'])) {
        drupal_add_js('misc/tableheader.js');
        $vars['classes_array'][] = "sticky-enabled";
    }
    $vars['classes_array'][] = 'cols-' . count($vars['header']);
    // Add the summary to the list if set.
    if (!empty($handler->options['summary'])) {
        $vars['attributes_array'] = array('summary' => filter_xss_admin($handler->options['summary']));
    }
    // Add the caption to the list if set.
    if (!empty($handler->options['caption'])) {
        $vars['caption'] = filter_xss_admin($handler->options['caption']);
    } else {
        $vars['caption'] = '';
    }
    // Check whether this table view has draggableview field.
    if (!isset($vars['view']->field['draggableviews'])) {
        return;
    }
    // Check permissions.
    if (!user_access('access draggableviews')) {
        return;
    }
    // Add table class.
    $vars['classes_array'][] = 'draggable';
    // Add row class.
    foreach ($vars['row_classes'] as &$row_classes) {
        $row_classes[] = 'draggable';
    }
    $vars['attributes_array']['id'] = 'draggableviews-table-' . $vars['view']->name . '-' . $vars['view']->current_display;
    // Add javascript.
    drupal_add_tabledrag($vars['attributes_array']['id'], 'order', 'sibling', 'draggableviews-weight');
}
 * Each $perms_listing[$region] contains an array of blocks for that region.
 *
 * Each $data in $perms_listing[$region] contains:
 * - $data->region_title: Region title for the listed block.
 * - $data->block_title: Block title.
 * - $data->region_select: Drop-down menu for assigning a region.
 * - $data->weight_select: Drop-down menu for setting weights.
 * - $data->configure_link: Block configuration link.
 * - $data->delete_link: For deleting user added blocks.
 *
 * @see template_preprocess_block_admin_display_form()
 * @see theme_block_admin_display()
 */
foreach ($mimes as $region => $title) {
    drupal_add_tabledrag('te_perms', 'match', 'sibling', 'perm-mime-select', 'perm-mime-' . $region, NULL, FALSE);
    drupal_add_tabledrag('te_perms', 'order', 'sibling', 'perm-weight', 'perm-weight-' . $region);
}
?>
<table id="te_perms">
  <thead>
    <tr>
      <th><?php 
print t('Mime Type');
?>
</th>
      <th><?php 
print t('Order');
?>
</th>
      <th><?php 
print t('Operations');
コード例 #15
0
 * - $form_submit: Form submit button.
 *
 *
 * Each $data in $node_listing[$i] contains:
 * - $data->node_title: Node title.
 * - $data->weight: Drop-down menu for setting weights.
 * - $data->tid
 * - $data->nid
 *
 * @see template_preprocess_nodeorder_admin_display_form()
 * @see theme_nodeorder_admin_display()
 */
// Add table javascript.
drupal_add_js('misc/tableheader.js');
drupal_add_js(drupal_get_path('module', 'nodeorder') . '/nodeorder.js');
drupal_add_tabledrag('ordernodes', 'order', 'sibling', 'nodeorder-weight');
?>
<table id="ordernodes" class="sticky-enabled">
  <thead>
    <tr>
      <th colspan=2><?php 
print t('Node title');
?>
</th>
    </tr>
  </thead>
  <tbody>
    <?php 
$row = 0;
?>
    <?php 
コード例 #16
0
 * Default theme implementation to configure Better Formats defaults admin page.
 *
 * Available variables:
 * - $form_submit: Form submit button.
 *
 * Each $node_default_rows contains a row
 *
 * Each $data in $node_default_rows contains:
 * - $data->role: Role name.
 * - $data->format_select: Drop-down menu for setting format.
 * - $data->weight_select: Drop-down menu for setting weights.
 */
// Add table javascript
drupal_add_tabledrag('node-format-defaults', 'order', 'sibling', 'better-formats-role-node-weight');
drupal_add_tabledrag('comment-format-defaults', 'order', 'sibling', 'better-formats-role-comment-weight');
drupal_add_tabledrag('block-format-defaults', 'order', 'sibling', 'better-formats-role-block-weight');
?>
<div class="description">
  <?php 
print '<p><strong>' . t('Defaults only affect NEW content NOT existing content.') . '</strong></p>';
?>
  <?php 
print '<p><strong>' . t('Place roles in order of precedence by dragging more important roles to the top.') . '</strong></p>';
?>
</div>
<fieldset>
  <legend><strong><?php 
print t('Node defaults');
?>
</strong></legend>
  <table id="node-format-defaults">
コード例 #17
0
/**
 * Paragraphs widget -> see paragraphs.module
 * override function theme_paragraphs_field_multiple_value_form (for now)
 */
function basetpl_paragraphs_field_multiple_value_form($variables)
{
    $element = $variables['element'];
    $output = '';
    $instance = $element['#instance'];
    if (!isset($instance['settings']['title'])) {
        $instance['settings']['title'] = PARAGRAPHS_DEFAULT_TITLE;
    }
    if (!isset($instance['settings']['title_multiple'])) {
        $instance['settings']['title_multiple'] = PARAGRAPHS_DEFAULT_TITLE_MULTIPLE;
    }
    $add_mode = isset($instance['settings']['add_mode']) ? $instance['settings']['add_mode'] : PARAGRAPHS_DEFAULT_ADD_MODE;
    $table_id = drupal_html_id($element['#field_name'] . '_values');
    $order_class = $element['#field_name'] . '-delta-order';
    $required = !empty($element['#required']) ? theme('form_required_marker', $variables) : '';
    $header = array(array('data' => '<label>' . t('!title !required', array('!title' => $element['#title'], '!required' => $required)) . "</label>", 'colspan' => 2, 'class' => array('field-label')), t('Order'));
    $rows = array();
    // Sort items according to '_weight' (needed when the form comes back after
    // preview or failed validation)
    $items = array();
    foreach (element_children($element) as $key) {
        if ($key === 'add_more') {
            $add_more_button =& $element[$key];
        } elseif ($key === 'add_more_type') {
            $add_more_button_type =& $element[$key];
        } else {
            if (!isset($element[$key]['#access']) || $element[$key]['#access']) {
                $items[] =& $element[$key];
            }
        }
    }
    usort($items, '_field_sort_items_value_helper');
    // Add the items as table rows.
    foreach ($items as $key => $item) {
        $item['_weight']['#attributes']['class'] = array($order_class);
        $delta_element = drupal_render($item['_weight']);
        $cells = array(array('data' => '', 'class' => array('field-multiple-drag')), drupal_render($item), array('data' => $delta_element, 'class' => array('delta-order')));
        $rows[] = array('data' => $cells, 'class' => array('draggable', drupal_html_class('paragraphs_item_type_' . $item['#bundle'])));
    }
    $output = '<div class="form-item">';
    if (count($items)) {
        $output .= theme('table', array('header' => $header, 'rows' => $rows, 'attributes' => array('id' => $table_id, 'class' => array('field-multiple-table'))));
    } else {
        $output .= '<label>' . t('!title !required', array('!title' => $element['#title'], '!required' => $required)) . "</label>";
    }
    $output .= $element['#description'] ? '<div class="description">' . $element['#description'] . '</div>' : '';
    $output .= '<div class="clearfix">' . drupal_render($add_more_button_type) . drupal_render($add_more_button) . '</div>';
    $output .= '</div>';
    drupal_add_tabledrag($table_id, 'order', 'sibling', $order_class);
    return $output;
}
コード例 #18
0
<?php

// Add tabledrag.js.
drupal_add_tabledrag('field-weight-table', 'order', 'sibling', 'field-weight');
// Setup static zebra to stripe table rows.
static $zebra;
$zebra = 1;
?>

<p><?php 
print drupal_render($form['markup']);
?>
</p>

<table id="field-weight-table">
  <thead>
    <th><?php 
print t('Fields');
?>
</th>
    <th class="tabledrag-hide"><?php 
print t('Weight');
?>
</th>
    <th><?php 
print t('Hide');
?>
</th>
  </thead>
  <tbody>
    <?php 
コード例 #19
0
 * - $tags: An array of meta tags.
 * - $form_submit: Form submit button.
 *
 * Each $data in $tags contains:
 * - $data->name: Meta tag name (text).
 * - $data->type: Meta tag type (text).
 * - $data->widget: Meta tag widget (text).
 * - $data->description: Meta tag description (text).
 * - $data->weight_select: Drop-down menu for setting weights.
 * - $data->edit_link: Meta tag edit link.
 * - $data->delete_link: Meta tag delete link.
 *
 * @see template_preprocess_nodewords_list() theme_nodewords_list()
 */
drupal_add_js('misc/tableheader.js');
drupal_add_tabledrag('nodewords-list-table', 'order', 'sibling', 'nodewords-weight');
?>

<table id="nodewords-list-table" class="sticky-enabled">
  <thead>
    <tr>
      <th><?php 
print t('Name');
?>
</th>
      <th><?php 
print t('Type');
?>
</th>
      <th><?php 
print t('Widget');
コード例 #20
0
<?php

/**
 * @file
 * Default theme implementation to configure blocks.
 */
$element_regions = array('block' => array('title' => t('Block'), 'count' => 0), 'popup' => array('title' => t('Popup'), 'count' => 0));
foreach (element_children($form) as $element) {
    $element_regions[$form[$element]['region']['#value']]['count']++;
}
// Add table javascript.
drupal_add_js('misc/tableheader.js');
drupal_add_js(drupal_get_path('module', 'custom_search') . '/custom_search_sort.js');
foreach ($element_regions as $region => $title) {
    drupal_add_tabledrag('elements', 'match', 'sibling', 'region-select', 'region-select-' . $region, NULL, FALSE);
    drupal_add_tabledrag('elements', 'order', 'sibling', 'sort-select', 'sort-select-' . $region);
}
?>
<table id="elements" class="sticky-enabled">
  <thead>
    <tr>
      <th><?php 
print t('Element');
?>
</th>
      <th><?php 
print t('Region');
?>
</th>
      <th><?php 
print t('Weight');
コード例 #21
0
ファイル: sopac_user.php プロジェクト: aadl/sopac
function theme_sopac_list_form($form)
{
    // loop through each "row" in the table array
    foreach ($form['rows'] as $id => $row) {
        // we are only interested in numeric keys
        if (intval($id)) {
            $this_row = $row['data']['#value'];
            //Add the place field to the row
            $this_row[] = drupal_render($form['rows'][$id]['places'][$id]);
            //Add the row to the array of rows
            $table_rows[] = array('data' => $this_row, 'class' => 'draggable');
        }
    }
    //Make sure the header count matches the column count
    $header = $form['#header'];
    $header[] = 'New Place';
    $output .= theme('table', $header, $table_rows, array('id' => 'sopac-list-table'));
    $output .= drupal_render($form);
    // Call add_tabledrag to add and setup the JS for us
    // The key thing here is the first param - the table ID
    // and the 4th param, the class of the form item which holds the weight
    drupal_add_tabledrag('sopac-list-table', 'order', 'sibling', 'sopac-list-place');
    return $output;
}
コード例 #22
0
ファイル: form.php プロジェクト: kieranbutler/ikieran
function mothership_field_multiple_value_form($variables)
{
    $element = $variables['element'];
    $output = '';
    if ($element['#cardinality'] > 1 || $element['#cardinality'] == FIELD_CARDINALITY_UNLIMITED) {
        $table_id = drupal_html_id($element['#field_name'] . '_values');
        $order_class = $element['#field_name'] . '-delta-order';
        $required = !empty($element['#required']) ? theme('form_required_marker', $variables) : '';
        $header = array(array('data' => '<label>' . t('!title: !required', array('!title' => $element['#title'], '!required' => $required)) . "</label>", 'colspan' => 2, 'class' => array('field-label')), t('Order'));
        $rows = array();
        // Sort items according to '_weight' (needed when the form comes back after
        // preview or failed validation)
        $items = array();
        foreach (element_children($element) as $key) {
            if ($key === 'add_more') {
                $add_more_button =& $element[$key];
            } else {
                $items[] =& $element[$key];
            }
        }
        usort($items, '_field_sort_items_value_helper');
        // Add the items as table rows.
        foreach ($items as $key => $item) {
            $item['_weight']['#attributes']['class'] = array($order_class);
            $delta_element = drupal_render($item['_weight']);
            $cells = array(array('data' => '', 'class' => array('field-multiple-drag')), drupal_render($item), array('data' => $delta_element, 'class' => array('delta-order')));
            $rows[] = array('data' => $cells, 'class' => array('draggable'));
        }
        /*
        adds form-item-multiple
        */
        $output .= '<div class="form-item form-item-multiple">';
        $output .= theme('table', array('header' => $header, 'rows' => $rows, 'attributes' => array('id' => $table_id, 'class' => array('field-multiple-table'))));
        $output .= $element['#description'] ? '<div class="description">' . $element['#description'] . '</div>' : '';
        /*removes the clearfix*/
        // $output .= '<div class="clearfix">' . drupal_render($add_more_button) . '</div>';
        $output .= drupal_render($add_more_button);
        $output .= '</div>';
        drupal_add_tabledrag($table_id, 'order', 'sibling', $order_class);
    } else {
        foreach (element_children($element) as $key) {
            $output .= drupal_render($element[$key]);
        }
    }
    return $output;
}
コード例 #23
0
 */
/**
 * Available variables:
 * - $regions - regions (provider states)
 * - $providers - providers list assoc array with region as key and providers array in this state
 * - $form - all another form elements that should exists on form
 */
?>

<?php 
// add all required JavaScript for providers manipulation
drupal_add_js('misc/tableheader.js');
drupal_add_js(drupal_get_path('module', 'external_login') . '/files/external_login.admin.js');
foreach ($regions as $region => $title) {
    drupal_add_tabledrag('external_login_providers', 'match', 'sibling', 'external_login_provider-region-select', 'external_login_provider-region-enabled-' . $region, NULL, FALSE);
    drupal_add_tabledrag('external_login_providers', 'order', 'sibling', 'external_login_provider-weight', 'external_login_provider-weight-enabled-' . $region);
}
?>
<table id="external_login_providers" class="sticky-enabled">
	<thead>
		<tr>
			<th><?php 
print t('Provider');
?>
</th>
			<th><?php 
print t('Enabled');
?>
</th>
			<th><?php 
print t('Weight');
コード例 #24
0
/**
 * Returns HTML for a group of file upload widgets.
 *
 * @param array $variables
 *   An associative array containing:
 *   - element: A render element representing the widgets.
 *
 * @return string
 *   The constructed HTML.
 *
 * @see theme_file_widget_multiple()
 *
 * @ingroup theme_functions
 */
function bootstrap_file_widget_multiple($variables)
{
    $element = $variables['element'];
    // Special ID and classes for draggable tables.
    $weight_class = $element['#id'] . '-weight';
    $table_id = $element['#id'] . '-table';
    // Build up a table of applicable fields.
    $headers = array();
    $headers[] = t('File information');
    if ($element['#display_field']) {
        $headers[] = array('data' => t('Display'), 'class' => array('checkbox'));
    }
    $headers[] = t('Weight');
    $headers[] = t('Operations');
    // Get our list of widgets in order (needed when the form comes back after
    // preview or failed validation).
    $widgets = array();
    foreach (element_children($element) as $key) {
        $widgets[] =& $element[$key];
    }
    usort($widgets, '_field_sort_items_value_helper');
    $rows = array();
    foreach ($widgets as $key => &$widget) {
        // Save the uploading row for last.
        if ($widget['#file'] == FALSE) {
            $widget['#title'] = $element['#file_upload_title'];
            $widget['#description'] = $element['#file_upload_description'];
            continue;
        }
        // Delay rendering of the buttons, so that they can be rendered later in the
        // "operations" column.
        $operations_elements = array();
        foreach (element_children($widget) as $sub_key) {
            if (isset($widget[$sub_key]['#type']) && $widget[$sub_key]['#type'] == 'submit') {
                hide($widget[$sub_key]);
                $operations_elements[] =& $widget[$sub_key];
            }
        }
        // Delay rendering of the "Display" option and the weight selector, so that
        // each can be rendered later in its own column.
        if ($element['#display_field']) {
            hide($widget['display']);
        }
        hide($widget['_weight']);
        // Render everything else together in a column, without the normal wrappers.
        $widget['#theme_wrappers'] = array();
        $information = drupal_render($widget);
        // Render the previously hidden elements, using render() instead of
        // drupal_render(), to undo the earlier hide().
        $operations = '';
        foreach ($operations_elements as $operation_element) {
            $operation_element['#attributes']['class'][] = 'btn-xs';
            switch ($operation_element['#value']) {
                case t('Remove'):
                    $operation_element['#icon'] = _bootstrap_icon('remove');
                    break;
            }
            $operations .= render($operation_element);
        }
        $display = '';
        if ($element['#display_field']) {
            unset($widget['display']['#title']);
            $display = array('data' => render($widget['display']), 'class' => array('checkbox'));
        }
        $widget['_weight']['#attributes']['class'] = array($weight_class);
        $weight = render($widget['_weight']);
        // Arrange the row with all of the rendered columns.
        $row = array();
        $row[] = $information;
        if ($element['#display_field']) {
            $row[] = $display;
        }
        $row[] = $weight;
        $row[] = $operations;
        $rows[] = array('data' => $row, 'class' => isset($widget['#attributes']['class']) ? array_merge($widget['#attributes']['class'], array('draggable')) : array('draggable'));
    }
    drupal_add_tabledrag($table_id, 'order', 'sibling', $weight_class);
    $output = '';
    if (!empty($rows)) {
        $table = array('#theme' => 'table', '#header' => $headers, '#rows' => $rows, '#attributes' => array('id' => $table_id, 'class' => array('managed-files')));
        $output = drupal_render($table);
    }
    $output .= drupal_render_children($element);
    return $output;
}
 * - $data->region_select: Drop-down menu for assigning a region.
 * - $data->weight_select: Drop-down menu for setting weights.
 * - $data->configure_link: Block configuration link.
 * - $data->delete_link: For deleting user added blocks.
 *
 * @see template_preprocess_block_admin_display_form()
 * @see theme_block_admin_display()
 *
 * @ingroup themeable
 */
// Add table javascript.
drupal_add_js('misc/tableheader.js');
drupal_add_js(drupal_get_path('module', 'stripe_subscription') . '/stripe_subscription.js');
foreach ($plan_groups as $pgid => $pg) {
    drupal_add_tabledrag('plans', 'match', 'sibling', 'pgid-select', 'pg-' . $pgid, NULL, FALSE);
    drupal_add_tabledrag('plans', 'order', 'sibling', 'plan-weight', 'plan-weight-' . $pgid);
}
print $action_links;
?>

<table id="plans" class="sticky-enabled">
  <thead>
  <tr>
    <th><?php 
print t('Plan ID');
?>
</th>
    <th><?php 
print t('Name');
?>
</th>
コード例 #26
0
/**
 * @file nodewords-edit-attributes.tpl.php
 * Default theme implementation to list attributes of a meta tag (admin/content/nodewords/%/attributes).
 *
 * Available variables:
 * - $attributes: An array of meta tag attributes.
 * - $form_submit: Form submit button.
 *
 * Each $data in $attributes contains:
 * - $data->delete_check: Checkbox for deletion (checkbox).
 * - $data->name: Meta tag name (textfield).
 * - $data->value: Meta tag type (textfield).
 * - $data->weight_select: Drop-down menu for setting weights.
 */
drupal_add_js('misc/tableheader.js');
drupal_add_tabledrag('nodewords-edit-attributes-table', 'order', 'sibling', 'nodewords-weight');
?>

<table id="nodewords-edit-attributes-table" class="sticky-enabled">
  <thead>
    <tr>
      <th><?php 
print t('Delete');
?>
</th>
      <th><?php 
print t('Name');
?>
</th>
      <th><?php 
print t('Value');
コード例 #27
0
/**
 * Returns the sort table.
 *
 * @param $variables
 *   An associative array containing:
 *   - element: A render element representing the form.
 *
 * @ingroup themeable
 */
function theme_current_search_sort_settings_table($variables)
{
    $output = '';
    // Initializes table header.
    $header = array('item' => t('Item'), 'weight' => t('weight'));
    // Builds table rows.
    $rows = array();
    foreach ($variables['#current_search']['items'] as $name => $settings) {
        $rows[$name] = array('class' => array('draggable'), 'data' => array(drupal_render($variables[$name]['item']), drupal_render($variables[$name]['weight']), array('data' => drupal_render($variables[$name]['remove']), 'class' => 'current-search-remove-link')));
    }
    // Builds table with drabble rows, returns output.
    $table_id = 'current-search-sort-settings';
    drupal_add_tabledrag($table_id, 'order', 'sibling', 'current-search-sort-weight');
    //$output .= drupal_render_children($variables['element']);
    $output .= theme('table', $header, $rows, array('id' => $table_id));
    return $output;
}
コード例 #28
0
ファイル: OLMap.php プロジェクト: josemrc/ae2web
 /**
  * {@inheritdoc}
  */
 public function optionsForm(&$form, &$form_state)
 {
     $form['options']['ui'] = array('#type' => 'fieldset', '#title' => t('User interface'), 'width' => array('#type' => 'textfield', '#title' => 'Width of the map', '#default_value' => $this->getOption('width', 'auto'), '#parents' => array('options', 'width')), 'height' => array('#type' => 'textfield', '#title' => t('Height of the map'), '#default_value' => $this->getOption('height', '300px'), '#parents' => array('options', 'height')));
     $form['options']['view'] = array('#type' => 'fieldset', '#title' => t('Center and rotation'), '#tree' => TRUE);
     if ($this->getMachineName() != Config::get('openlayers.edit_view_map')) {
         if (($map = Openlayers::load('Map', Config::get('openlayers.edit_view_map'))) == TRUE) {
             $map_configuration = $map->getConfiguration();
             if ($view = $this->getOption('view')) {
                 // Don't apply min / max zoom settings to this map to avoid lock-in.
                 $view['minZoom'] = 0;
                 $view['maxZoom'] = 0;
                 $map->setOption('view', $view);
             }
             $form['options']['view']['map'] = array('#type' => 'openlayers', '#description' => $map->getPluginDescription(), '#map' => $map);
         }
     }
     $form['options']['view']['center'] = array('#tree' => TRUE, 'lat' => array('#type' => 'textfield', '#title' => t('Latitude'), '#default_value' => $this->getOption(array('view', 'center', 'lat'), 0)), 'lon' => array('#type' => 'textfield', '#title' => t('Longitude'), '#default_value' => $this->getOption(array('view', 'center', 'lat'), 0)));
     $form['options']['view']['rotation'] = array('#type' => 'textfield', '#title' => t('Rotation'), '#default_value' => $this->getOption(array('view', 'rotation'), 0));
     $form['options']['view']['zoom'] = array('#type' => 'textfield', '#title' => t('Zoom'), '#default_value' => $this->getOption(array('view', 'zoom'), 0));
     $form['options']['view']['minZoom'] = array('#type' => 'textfield', '#title' => t('Min zoom'), '#default_value' => $this->getOption(array('view', 'minZoom'), 0));
     $form['options']['view']['maxZoom'] = array('#type' => 'textfield', '#title' => t('Max zoom'), '#default_value' => $this->getOption(array('view', 'maxZoom'), 0));
     $form['options']['view']['limit_extent'] = array('#type' => 'select', '#title' => t('Limit to extent'), '#empty_option' => t('Disabled'), '#empty_value' => '', '#options' => array('custom' => 'Custom extent', 'projection' => 'Map projection'), '#description' => t('If enabled navigation on the map is limited to the give extent.'), '#default_value' => $this->getOption(array('view', 'limit_extent'), FALSE));
     $form['options']['view']['extent'] = array('#type' => 'textfield', '#title' => t('Extent [minx, miny, maxx, maxy]'), '#default_value' => $this->getOption(array('view', 'extent'), ''), '#states' => array('visible' => array(':input[name="options[view][limit_extent]"]' => array('value' => 'custom'))));
     $form['options']['misc'] = array('#type' => 'fieldset', '#title' => t('Miscellaneous options'));
     $form['options']['misc']['renderer'] = array('#type' => 'radios', '#title' => t('Renderer'), '#description' => t('Renderer by default. Canvas, DOM and WebGL renderers are tested for support in that order. Note that at present only the Canvas renderer support vector data.'), '#options' => array('canvas' => t('Canvas'), 'dom' => t('DOM'), 'webgl' => t('WebGL')), '#default_value' => $this->getOption('renderer', 'canvas'), '#parents' => array('options', 'renderer'));
     $i = 0;
     $data = array();
     $map_options = $this->getOptions();
     /* @var \Drupal\openlayers\Types\Object $object */
     foreach ($this->getCollection()->getFlatList() as $object) {
         $weight = 0;
         if (isset($map_options['capabilities']['options']['table'][$object->getMachineName()])) {
             $weight = array_search($object->getMachineName(), array_keys($map_options['capabilities']['options']['table']));
         }
         $data[$object->getMachineName()] = array('name' => $object->getName(), 'machine_name' => $object->getMachineName(), 'text' => isset($map_options['capabilities']['options']['table'][$object->getMachineName()]) ? $map_options['capabilities']['options']['table'][$object->getMachineName()] : $object->getPluginDescription(), 'weight' => $weight, 'enabled' => isset($map_options['capabilities']['options']['table'][$object->getMachineName()]) ? TRUE : FALSE, 'default' => 1);
     }
     uasort($data, function ($a, $b) {
         if ($a['enabled'] > $b['enabled']) {
             return -1;
         } elseif ($a['enabled'] < $b['enabled']) {
             return 1;
         }
         if ($a['weight'] < $b['weight']) {
             return -1;
         } elseif ($a['weight'] > $b['weight']) {
             return 1;
         }
         return 0;
     });
     $rows = array();
     $row_elements = array();
     foreach ($data as $id => $entry) {
         $rows[$id] = array('data' => array(array('class', array('entry-cross')), array('data' => array('#type' => 'weight', '#title' => t('Weight'), '#title_display' => 'invisible', '#default_value' => $entry['weight'], '#attributes' => array('class' => array('entry-order-weight')))), array('data' => array('#type' => 'hidden', '#default_value' => $entry['machine_name'])), array('data' => array('#type' => 'checkbox', '#title' => t('Enable'), '#title_display' => 'invisible', '#default_value' => $entry['enabled'])), array('data' => array('#type' => 'textfield', '#title' => t('Text'), '#title_display' => 'invisible', '#default_value' => $entry['text'], '#maxlength' => 256)), check_plain($entry['name']), check_plain($entry['machine_name'])), 'class' => array('draggable'));
         // Build rows of the form elements in the table.
         $row_elements[$id] = array('weight' => &$rows[$id]['data'][1]['data'], 'machine_name' => &$rows[$id]['data'][2]['data'], 'enabled' => &$rows[$id]['data'][3]['data'], 'text' => &$rows[$id]['data'][4]['data']);
     }
     $form['options']['capabilities'] = array('#type' => 'fieldset', '#title' => 'Map description and capabilities', '#collapsible' => FALSE, '#collapsed' => FALSE, 'enabled' => array('#type' => 'checkbox', '#title' => t('Enable map capabilities ?'), '#default_value' => (bool) $this->getOption(array('capabilities'), FALSE)), 'options' => array('#type' => 'container', '#states' => array('visible' => array(':input[name="options[capabilities][enabled]"]' => array('checked' => TRUE))), 'container_type' => array('#type' => 'select', '#title' => t('Container type'), '#options' => array('fieldset' => 'Fieldset', 'container' => 'Simple div'), '#default_value' => $this->getOption(array('capabilities', 'options', 'container_type'), 'fieldset')), 'title' => array('#type' => 'textfield', '#title' => t('Title'), '#description' => t('Show a title ? Empty to disable.'), '#default_value' => $this->getOption(array('capabilities', 'options', 'title'), t('Map capabilities')), '#states' => array('visible' => array(':input[name="options[capabilities][options][container_type]"]' => array('value' => 'fieldset')))), 'description' => array('#type' => 'textfield', '#title' => t('Description'), '#description' => t('Show a description ? Empty to disable.'), '#default_value' => $this->getOption(array('capabilities', 'options', 'description'), t('Description')), '#states' => array('visible' => array(':input[name="options[capabilities][options][container_type]"]' => array('value' => 'fieldset')))), 'collapsible' => array('#type' => 'checkbox', '#title' => t('Collapsible'), '#default_value' => (bool) $this->getOption(array('capabilities', 'options', 'collapsible'), TRUE), '#states' => array('visible' => array(':input[name="options[capabilities][options][container_type]"]' => array('value' => 'fieldset')))), 'collapsed' => array('#type' => 'checkbox', '#title' => t('Collapsed'), '#default_value' => (bool) $this->getOption(array('capabilities', 'options', 'collapsed'), TRUE), '#states' => array('visible' => array(':input[name="options[capabilities][options][container_type]"]' => array('value' => 'fieldset'))))));
     // Add the table to the form.
     $form['options']['capabilities']['options']['table'] = array('#theme' => 'table', 'elements' => $row_elements, '#header' => array(array('data' => NULL, 'colspan' => 2), array('data' => t('Enabled'), 'colspan' => 2), array('data' => t('Description'), 'colspan' => 1), t('Name'), t('Machine name')), '#rows' => $rows, '#empty' => t('There are no entries available.'), '#attributes' => array('id' => 'entry-order-objects'));
     drupal_add_tabledrag('entry-order-objects', 'order', 'sibling', 'entry-order-weight');
 }
コード例 #29
0
$element = $variables['element'];
$output = '';
$table_id = 'properties-table';
if (user_access('add properties attributes')) {
    $header = array(t('Attribute name'), t('Attribute label'), t('Value'), t('Category'), t('Order'), t('Delete'));
} else {
    $header = array(t('Attribute'), t('Value'));
    if (user_access('add properties categories')) {
        $header[] = t('Order');
    }
}
$rows = array();
if (user_access('add properties attributes') || user_access('add properties categories')) {
    drupal_add_tabledrag($table_id, 'match', 'parent', 'property-category-select', 'property-category-select', 'category-name');
    drupal_add_tabledrag($table_id, 'order', 'sibling', 'property-weight');
}
foreach (element_children($element['listing']) as $category_name) {
    $category = $element['listing'][$category_name];
    $category['_weight']['#attributes']['class'] = array('property-weight');
    $category['name']['#attributes']['class'] = array('category-name');
    $category['category']['#attributes']['class'] = array('property-category-select');
    $cells = array();
    $cells[] = '<strong>' . $category['#label'] . '</strong>';
    $cells[] = '&nbsp;';
    if (user_access('add properties attributes')) {
        $cells[] = '&nbsp;';
        $cells[] = '&nbsp;';
    }
    if (user_access('add properties categories')) {
        $cells[] = drupal_render($category['category']) . drupal_render($category['name']) . drupal_render($category['_weight']);