Example #1
0
function at_tf_admin_file_formatter_table($variables)
{
    $rows = array();
    foreach ($variables['items'] as $delta => $item) {
        $rows[] = theme('file_link', array('file' => (object) $item));
    }
    return empty($rows) ? '' : theme_item_list(array('items' => $rows, 'title' => t('Attachments'), 'attributes' => array(), 'type' => 'ul'));
}
Example #2
0
/**
 * Overrides theme_item_list().
 */
function porto_sub_item_list($variables)
{
    $items = $variables['items'];
    $title = $variables['title'];
    $type = $variables['type'];
    if ($variables['attributes']['class'][0] == 'pager') {
        $variables['attributes']['class'] = 'pagination pagination-lg pull-right';
    }
    $attributes = $variables['attributes'];
    // Only output the list container and title, if there are any list items.
    // Check to see whether the block title exists before adding a header.
    // Empty headers are not semantic and present accessibility challenges.
    $output = '';
    if (isset($title) && $title !== '') {
        $output .= '<h3>' . $title . '</h3>';
    }
    if (!empty($items)) {
        $output .= "<{$type}" . drupal_attributes($attributes) . '>';
        $num_items = count($items);
        $i = 0;
        foreach ($items as $item) {
            $attributes = array();
            $children = array();
            $data = '';
            $i++;
            //if ( is_array($item) && in_array('pager-current', $item['class'])) {
            if (isset($item['class']) && is_array($item) && in_array('pager-current', $item['class'])) {
                $item['class'] = array('active');
                $item['data'] = '<a href="#">' . $item['data'] . '</a>';
            }
            if (is_array($item)) {
                foreach ($item as $key => $value) {
                    if ($key == 'data') {
                        $data = $value;
                    } elseif ($key == 'children') {
                        $children = $value;
                    } else {
                        $attributes[$key] = $value;
                    }
                }
            } else {
                $data = $item;
            }
            if (count($children) > 0) {
                // Render nested list.
                $data .= theme_item_list(array('items' => $children, 'title' => NULL, 'type' => $type, 'attributes' => $attributes));
            }
            $output .= '<li' . drupal_attributes($attributes) . '>' . $data . "</li>\n";
        }
        $output .= "</{$type}>";
    }
    return $output;
}
Example #3
0
function mothership_item_list($items = array(), $title = NULL, $type = 'ul', $attributes = NULL)
{
    $attributes['class'] .= " item-list";
    //  $output = '<div class="item-list">';
    if (isset($title)) {
        $output .= '<h3>' . $title . '</h3>';
    }
    if (!empty($items)) {
        $output .= "<{$type}" . drupal_attributes($attributes) . '>';
        $num_items = count($items);
        foreach ($items as $i => $item) {
            $attributes = array();
            $children = array();
            if (is_array($item)) {
                foreach ($item as $key => $value) {
                    if ($key == 'data') {
                        $data = $value;
                    } elseif ($key == 'children') {
                        $children = $value;
                    } else {
                        $attributes[$key] = $value;
                    }
                }
            } else {
                $data = $item;
            }
            if (count($children) > 0) {
                $data .= theme_item_list($children, NULL, $type, $attributes);
                // Render nested list
            }
            //  if ($i == 0) {
            //    $attributes['class'] = empty($attributes['class']) ? 'first' : ($attributes['class'] .' first');
            //  }
            //  if ($i == $num_items - 1) {
            //    $attributes['class'] = empty($attributes['class']) ? 'last' : ($attributes['class'] .' last');
            //  }
            $output .= '<li' . drupal_attributes($attributes) . '>' . $data . "</li>\n";
        }
        $output .= "</{$type}>";
    }
    //  $output .= '</div>';
    return $output;
}
Example #4
0
function philippemouchel_preprocess_page(&$vars)
{
    $mgi = menu_get_item();
    $items = array();
    // Generate items renderable main menu
    foreach ($vars['main_menu'] as $item) {
        // Exception for home page
        if ($item['href'] == '<front>') {
            $item['href'] = '';
            if ($mgi['path'] == variable_get('site_frontpage', '')) {
                $item['attributes']['class'] = array('active-trail', 'active');
            }
        }
        $items[] = l(t($item['title']), $item['href'], array('attributes' => $item['attributes']));
    }
    // Add custom item to download PDF file
    $options = array('html' => TRUE, 'attributes' => array('title' => t('Download my CV as PDF file'), 'target' => '_blank'));
    $items[] = array('data' => l('<i class="icon-file-pdf"></i>', 'sites/default/files/pdf/cv-philippemouchel-2014.pdf', $options), 'class' => array('pdf-download'));
    $vars['rendered_main_menu'] = theme_item_list(array('title' => '<i class="icon-menu2"></i><span>' . t('Main menu') . '</span>', 'type' => 'ul', 'attributes' => array('class' => 'content'), 'items' => $items));
    // Add translated title for HTML 5 Logo
    drupal_add_js(array('philippemouchel' => array('html5LogoTitle' => t('HTML 5 validator'))), 'setting');
}
Example #5
0
/**
 * Preprocess functions for node.tpl.php.
 */
function theadmin_preprocess_node(&$vars)
{
    $node = $vars['node'];
    $url = substr($vars['node_url'], 5);
    // Add general theme suggestions for all content types and view modes
    $vars['theme_hook_suggestions'][] = 'node__' . $vars['type'] . '__' . $vars['view_mode'];
    $vars['nid'] = $vars['node']->nid;
    // IMAGE GALLERY ====================================================
    if ($vars['type'] == 'media_gallery') {
        drupal_set_title(t('welcome to your backend.'));
        if (isset($vars['user']->roles[1]) && $vars['user']->roles[1] || $vars['view_mode'] == 'gallery_preview') {
            //$vars['images'] = render($vars['content']['media_gallery_file']);
            $images = array();
            for ($i = 0; $i < count($vars['media_gallery_file']); $i++) {
                $uri = $vars['media_gallery_file'][$i]['uri'];
                $alt = $vars['media_gallery_file'][$i]['alt'];
                $title = $vars['media_gallery_file'][$i]['title'];
                $images[] = render_image($uri, $style = 'gallery_large', $alt);
            }
            $vars['images'] = theme_item_list(array('items' => $images, 'title' => null, 'type' => 'ul', 'attributes' => array()));
            $vars['theme_hook_suggestions'][] = 'node__' . $vars['type'] . '__preview';
            drupal_add_js(path_to_theme() . '/js/init_gallery.js');
        } else {
            $vars['add_media'] = render($vars['content']['add_media_link']);
            $vars['images'] = render($vars['content']['media_gallery_file']);
        }
        //kpr($vars);
    }
    if ($vars['type'] == 'image_gallery') {
        $images = array();
        for ($i = 0; $i < count($vars['field_images']); $i++) {
            $uri = $vars['field_images'][$i]['uri'];
            $alt = $vars['field_images'][$i]['alt'];
            $images[] = render_image($uri, $style = 'gallery_large', $alt);
        }
    }
    // kpr($vars);
}
Example #6
0
function zimmer_links__locale_block(&$variables)
{
    // the global $language variable tells you what the current language is
    global $language;
    // an array of list items
    $items = array();
    foreach ($variables['links'] as $lang => $info) {
        $name = $info['language']->native;
        $href = isset($info['href']) ? $info['href'] : '';
        $li_classes = array('list-item-class');
        if ($lang === $language->language) {
            $li_classes[] = 'active';
        }
        $link_classes = array('link-class1', 'link-class2');
        $options = array('attributes' => array('class' => $link_classes), 'language' => $info['language'], 'html' => true);
        $link = l($name, $href, $options);
        if ($href) {
            $items[] = array('data' => $link, 'class' => $li_classes);
        }
    }
    $attributes = array('class' => array(''));
    $output = theme_item_list(array('items' => $items, 'title' => '', 'type' => 'ul', 'attributes' => $attributes));
    return $output;
}
Example #7
0
/**
 * Overrides theme_item_list().
 */
function progressive_sub_item_list($vars)
{
    if (isset($vars['attributes']['class']) && is_array($vars['attributes']['class']) && in_array('pager', $vars['attributes']['class'])) {
        foreach ($vars['items'] as $i => $item) {
            if (in_array('pager-current', $item['class'])) {
                $vars['items'][$i]['data'] = '<span>' . $item['data'] . '</span>';
                $vars['items'][$i]['class'][] = 'active';
            }
        }
        $styles = array(1 => 'pagination', 2 => 'pagination pagination-lg', 3 => 'pagination', 4 => 'pagination pagination-sm');
        $vars['attributes']['class'][] = $styles[theme_get_setting('pager') ? theme_get_setting('pager') : 1];
        return '<div class="pagination-box">' . theme_item_list($vars) . '</div>';
    }
    return theme_item_list($vars);
}
Example #8
0
function mothership_item_list($variables)
{
    $items = $variables['items'];
    $title = $variables['title'];
    $type = $variables['type'];
    $attributes = $variables['attributes'];
    $output = '';
    //get the daddy if its set and add it is item-list-$daddy
    if (isset($variables['daddy'])) {
        $wrapperclass = "item-list-" . $variables['daddy'];
    } else {
        $wrapperclass = "";
    }
    if (!empty($wrapperclass)) {
        $output = '<div class="' . $wrapperclass . '">';
    }
    if (isset($title)) {
        $output .= '<h3>' . $title . '</h3>';
    }
    if (!empty($items)) {
        $output .= "<{$type}" . drupal_attributes($attributes) . '>';
        $num_items = count($items);
        foreach ($items as $i => $item) {
            $attributes = array();
            $children = array();
            $data = '';
            if (is_array($item)) {
                foreach ($item as $key => $value) {
                    if ($key == 'data') {
                        $data = $value;
                    } elseif ($key == 'children') {
                        $children = $value;
                    } else {
                        $attributes[$key] = $value;
                    }
                }
            } else {
                $data = $item;
            }
            if (count($children) > 0) {
                // Render nested list.
                $data .= theme_item_list(array('items' => $children, 'title' => NULL, 'type' => $type, 'attributes' => $attributes));
            }
            if ($i == 0) {
                //TODO remove first
                $attributes['class'][] = 'first';
            }
            if ($i == $num_items - 1) {
                //TODO remove last
                $attributes['class'][] = 'last';
            }
            $output .= '<li' . drupal_attributes($attributes) . '>' . $data . "</li>\n";
        }
        $output .= "</{$type}>";
    }
    if (!empty($wrapperclass)) {
        $output .= '</div>';
    }
    return $output;
}
Example #9
0
/**
 * Overrides theme_item_list().
 */
function gavias_laikafood_item_list($variables)
{
    $items = $variables['items'];
    $title = $variables['title'];
    $type = $variables['type'];
    $variables['attributes']['class'] = 'pagination pull-right';
    $attributes = $variables['attributes'];
    $output = '';
    if (isset($title) && $title !== '') {
        $output .= '<h3>' . $title . '</h3>';
    }
    if (!empty($items)) {
        $output .= "<{$type}" . drupal_attributes($attributes) . '>';
        $num_items = count($items);
        $i = 0;
        foreach ($items as $item) {
            $attributes = array();
            $children = array();
            $data = '';
            $i++;
            if (isset($item['class']) && is_array($item) && in_array('pager-current', $item['class'])) {
                $item['class'] = array('active');
                $item['data'] = '<a href="#">' . $item['data'] . '</a>';
            }
            if (is_array($item)) {
                foreach ($item as $key => $value) {
                    if ($key == 'data') {
                        $data = $value;
                    } elseif ($key == 'children') {
                        $children = $value;
                    } else {
                        $attributes[$key] = $value;
                    }
                }
            } else {
                $data = $item;
            }
            if (count($children) > 0) {
                $data .= theme_item_list(array('items' => $children, 'title' => NULL, 'type' => $type, 'attributes' => $attributes));
            }
            $output .= '<li' . drupal_attributes($attributes) . '>' . $data . "</li>\n";
        }
        $output .= "</{$type}>";
    }
    return $output;
}
Example #10
0
/**
 * Modify theme_item_list()
 */
function goodnex_item_list($vars)
{
    if (isset($vars['attributes']['class']) && in_array('pager', (array) $vars['attributes']['class'])) {
        foreach ($vars['items'] as $i => &$item) {
            if (in_array('pager-current', $item['class'])) {
                $item['class'] = array('page-numbers-current current');
                $item['data'] = $item['data'];
            } elseif (is_array($item) && in_array('pager-item', $item['class'])) {
                $item['class'] = array('page-numbers');
                $item['data'] = $item['data'];
            } elseif (in_array('pager-next', $item['class'])) {
                $item['class'] = array('next page-numbers');
                $item['data'] = $item['data'];
            } elseif (in_array('pager-last', $item['class'])) {
                $item['class'] = array('page-numbers');
                $item['data'] = $item['data'];
            } elseif (in_array('pager-first', $item['class'])) {
                $item['class'] = array('page-numbers first');
                $item['data'] = $item['data'];
            } elseif (in_array('pager-previous', $item['class'])) {
                $item['class'] = array('prev page-numbers');
                $item['data'] = $item['data'];
            } elseif (in_array('pager-ellipsis', $item['class'])) {
                $item['class'] = array('disabled');
                $item['data'] = $item['data'];
            }
        }
        return '<div class="wp-pagenavi clearfix">' . theme_item_list($vars) . '</div>';
    }
    return theme_item_list($vars);
}
Example #11
0
/**
 * Overrides theme_item_list().
 */
function jollyany_item_list($vars)
{
    if (isset($vars['attributes']['class']) && is_array($vars['attributes']['class']) && in_array('pager', $vars['attributes']['class'])) {
        $vars['attributes']['class'] = 'pagination';
        foreach ($vars['items'] as $i => &$item) {
            if (in_array('pager-current', $item['class'])) {
                $item['class'] = array('active');
                $item['data'] = '<a href="javascript: void(0);">' . $item['data'] . '</a>';
            } elseif (in_array('pager-item', $item['class'])) {
                $item['class'] = array('page-numbers');
                $item['data'] = $item['data'];
            } elseif (in_array('pager-next', $item['class'])) {
                $item['class'] = array('next page-numbers');
                $item['data'] = $item['data'];
            } elseif (in_array('pager-last', $item['class'])) {
                $item['class'] = array('page-numbers');
                $item['data'] = $item['data'];
            } elseif (in_array('pager-first', $item['class'])) {
                $item['class'] = array('page-numbers first');
                $item['data'] = $item['data'];
            } elseif (in_array('pager-previous', $item['class'])) {
                $item['class'] = array('prev page-numbers');
                $item['data'] = $item['data'];
            } elseif (in_array('pager-ellipsis', $item['class'])) {
                $item['class'] = array('disabled');
                $item['data'] = $item['data'];
            }
        }
        return '<div class="text-center clearfix"><div class="pagination_wrapper">' . theme_item_list($vars) . '</div></div>';
    }
    return theme_item_list($vars);
}
/**
 * list items
 */
function basetpl_item_list($variables)
{
    $items = $variables['items'];
    $title = $variables['title'];
    $type = $variables['type'];
    $attributes = $variables['attributes'];
    $class = isset($variables['attributes']['class']) && in_array('menu', $variables['attributes']['class']) ? 'inline-menu' : 'item-list';
    $output = '<div class="' . $class . '">';
    if (isset($title) && $title !== '') {
        $output .= '<h3>' . $title . '</h3>';
    }
    if (!empty($items)) {
        $output .= "<{$type}" . drupal_attributes($attributes) . '>';
        $num_items = count($items);
        $i = 0;
        foreach ($items as $item) {
            $attributes = array();
            $children = array();
            $data = '';
            $i++;
            if (is_array($item)) {
                foreach ($item as $key => $value) {
                    if ($key == 'data') {
                        $data = $value;
                    } elseif ($key == 'children') {
                        $children = $value;
                    } else {
                        $attributes[$key] = $value;
                    }
                }
            } else {
                $data = $item;
            }
            if (count($children) > 0) {
                $data .= theme_item_list(array('items' => $children, 'title' => NULL, 'type' => $type, 'attributes' => $attributes));
            }
            if ($i == 1) {
                $attributes['class'][] = 'first';
            }
            if ($i == $num_items) {
                $attributes['class'][] = 'last';
            }
            $output .= '<li' . drupal_attributes($attributes) . '>' . $data . "</li>\n";
        }
        $output .= "</{$type}>";
    }
    $output .= '</div>';
    return $output;
}
    ?>
  <div>or</div>
  <br/>
  <?php 
    if ($browse_by_user) {
        ?>
    <h4>Browse by User</h4> 
    <div id="ir-browse-by-user-form">
      <?php 
        print drupal_get_form('scholar_browse_by_user_form');
        ?>
    </div>
    <br/>
  <?php 
    }
    ?>
  <?php 
    if ($browse_by_department) {
        ?>
    <h4>Browse by Department</h4>
    <br/>
    <div id="ir-browse-by-department">
      <?php 
        print theme_item_list(array(l('Place Holder', 'fedorair/ir')));
        ?>
    </div>
  <?php 
    }
}
?>
-->
Example #14
0
/**
 * Modify the output of the language selector block.
 */
function wet4_links__locale_block(&$variables)
{
    // the global $language variable tells you what the current language is
    global $language;
    // hide active language
    unset($variables['links'][$language->language]);
    // an array of list items
    $items = array();
    foreach ($variables['links'] as $lang => $info) {
        $name = $info['language']->native;
        $href = isset($info['href']) ? $info['href'] : '';
        // if the global language is that of this item's language, add the active class
        if ($lang === $language->language) {
            $li_classes[] = 'active';
        }
        $options = array('language' => $info['language'], 'html' => true);
        $link = l($name, $href, $options);
        // display only translated links
        if ($href) {
            $items[] = array('data' => $link);
        }
    }
    // output
    $attributes = array('class' => array('list-inline'), 'id' => 'gc-bar');
    $output = theme_item_list(array('items' => $items, 'title' => '', 'type' => 'ul', 'attributes' => $attributes));
    return $output;
}
Example #15
0
/**
 * Implements theme_item_list()
 * 1. Add some additional CSS classes
 * 2. Make the alerts accessible using WAI standards
 */
function bear_skin_item_list(&$variables)
{
    $items = $variables['items'];
    $title = $variables['title'];
    $type = $variables['type'];
    $attributes = $variables['attributes'];
    // create a more unique CSS identifier for this list
    if (!empty($attributes['class'])) {
        $list_class = implode('-', $attributes['class']);
    } else {
        // since the classes array on the menu is empty
        // we'll just give this a class of theme-item-list since
        // that is the generating function of this item list
        $list_class = 'theme-item-list';
        $variables['attributes']['class'] = array();
    }
    $variables['attributes']['class'][] = $list_class . '__list';
    // determine if this is the pagination element
    $pager = FALSE;
    if (in_array('pager', $variables['attributes']['class'])) {
        $pager = TRUE;
    }
    // add ARIA role to <ul> element
    $variables['attributes']['role'] = $pager ? 'menubar' : 'list';
    // add ARIA roles and SMACCS classes to list items
    if (!empty($items)) {
        foreach ($variables['items'] as &$item) {
            if (!is_array($item)) {
                continue;
            }
            $item['role'] = $pager ? 'presentation' : 'listitem';
            $item['class'] = !empty($item['class']) ? $item['class'] : array();
            $item['class'][] = $list_class . '__item';
            if ($pager) {
                $has_label = preg_match('/title="(.*?)"/', $item['data'], $label_text);
                if ($has_label) {
                    // this is a bit ugly
                    // TODO: find a way to do this that doesn't use str_replace
                    $item['data'] = str_replace('<a ', '<a aria-label="' . $label_text[1] . '" class="' . $list_class . '__link" ', $item['data']);
                }
            }
        }
    }
    if ($pager) {
        return '<nav class="' . $list_class . '" role="navigation" aria-label="Pagination">' . theme_item_list($variables) . '</nav>' . "\n";
    } else {
        return theme_item_list($variables);
    }
}
Example #16
0
/**
 * Retrieve sidebar content according to content type
 * @todo To investigate why passing $variables['node'] as $node will produce extra
 *       taxonomy_term object in $field_items, which cause taxonomy_term_load_multiple() to fail.
 *       Therefore here a $node object is loaded by $nid and $vid.
 */
function _bvng_get_sidebar_content($nid, $vid)
{
    $node = node_load($nid, $vid);
    $markup = '';
    if ($node) {
        switch ($node->type) {
            case 'newsarticle':
            case 'usesofdata':
                $fields = _bvng_get_sidebar_fields($node->type);
                foreach ($fields as $idx => $field) {
                    $variable_name = str_replace('-', '_', $idx);
                    ${$variable_name} = array('title' => $field['title'], 'type' => 'ul', 'items' => array(), 'attributes' => array('id' => $idx, 'class' => $node->type . '-sidebar' . ' ' . $idx));
                    $item_list =& ${$variable_name};
                    if ($idx != 'tags') {
                        $field_items = field_get_items('node', $node, $field['machine_name']);
                        if ($field_items !== FALSE) {
                            switch ($field['field_type']) {
                                case 'node_date':
                                    array_push($item_list['items'], array('data' => format_date($node->{$field}['machine_name'], 'custom', 'F jS, Y ')));
                                    break;
                                case 'text':
                                    foreach ($field_items as $item) {
                                        array_push($item_list['items'], array('data' => $item['value']));
                                    }
                                    break;
                                case 'link_field':
                                    foreach ($field_items as $item) {
                                        array_push($item_list['items'], array('data' => l($item['title'], $item['url'])));
                                    }
                                    break;
                                case 'taxonomy_term_reference':
                                    _bvng_get_tag_links($field_items, $item_list);
                                    break;
                            }
                            $markup .= theme_item_list($item_list);
                        }
                    } elseif ($idx == 'tags') {
                        $terms = array();
                        $term_sources = $field['fields'];
                        // Get all terms.
                        foreach ($term_sources as $term_source) {
                            $items = field_get_items('node', $node, $term_source);
                            if (is_array($items)) {
                                foreach ($items as $item) {
                                    $terms[] = $item['tid'];
                                }
                            }
                        }
                        if (count($terms) > 0) {
                            _bvng_get_tag_links($terms, $item_list);
                            $markup .= theme_item_list($item_list);
                        }
                    }
                }
                break;
            case 'resource_ims':
                $orc_id = _bvng_get_field_value('node', $node, 'field_orc_original_ims_id');
                $file_size_text = _bvng_get_field_value('node', $node, 'field_size_text');
                $resource_url = 'http://imsgbif.gbif.org/CMS_ORC/?doc_id=' . $orc_id . '&download=1';
                $download_text = t('Download');
                if (!empty($file_size_text)) {
                    $download_text .= ' (' . $file_size_text . ')';
                }
                $download_link = l($download_text, $resource_url);
                $markup .= $download_link;
                break;
        }
    }
    return $markup;
}
Example #17
0
/**
 * Social links theme function.
 */
function theme_bootsmacss_social_links($items, $title)
{
    $prefix = $output = $suffix = '';
    // Prefix and suffix for middle centering.
    if (!empty($title)) {
        $prefix = '<div class="middle-align__row">
                <div class="middle-align__col">
                  <p>Follow us at</p>
                </div>
                <div class="middle-align__col">';
        $suffix = '</div></div>';
    }
    // Render links with proper icons.
    foreach ($items as $key => $value) {
        if (strpos($value, 'facebook') !== FALSE) {
            $platform = 'fb';
        } elseif (strpos($value, 'twitter') !== FALSE) {
            $platform = 'twitter';
        } elseif (strpos($value, 'youtube') !== FALSE) {
            $platform = 'link';
        } elseif (strpos($value, 'linkedin') !== FALSE) {
            $platform = 'linkedin';
        } else {
            $platform = 'link';
        }
        $items[$key] = array('data' => l('<span class="icon icon--' . $platform . '"></span>', $value, array('html' => TRUE, 'attributes' => array('target' => '_blank'))), 'class' => array('social-links__item'));
    }
    // Render list.
    $list = theme_item_list(array('title' => '', 'items' => $items, 'type' => 'ul', 'attributes' => array('class' => array('social-links', 'list-inline'))));
    return $prefix . $list . $suffix;
}
Example #18
0
function megatron_item_list($variables)
{
    $items = $variables['items'];
    $title = $variables['title'];
    $type = $variables['type'];
    $attributes = $variables['attributes'];
    $output = '';
    if (isset($title)) {
        $output .= '<h3>' . $title . '</h3>';
    }
    if (!empty($items)) {
        $output .= "<{$type}" . drupal_attributes($attributes) . '>';
        $num_items = count($items);
        foreach ($items as $i => $item) {
            $attributes = array();
            $children = array();
            $data = '';
            if (is_array($item)) {
                foreach ($item as $key => $value) {
                    if ($key == 'data') {
                        $data = $value;
                    } elseif ($key == 'children') {
                        $children = $value;
                    } else {
                        $attributes[$key] = $value;
                    }
                }
            } else {
                $data = $item;
            }
            if (count($children) > 0) {
                // Render nested list.
                $data .= theme_item_list(array('items' => $children, 'title' => NULL, 'type' => $type, 'attributes' => $attributes));
            }
            if ($i == 0) {
                $attributes['class'][] = 'first';
            }
            if ($i == $num_items - 1) {
                $attributes['class'][] = 'last';
            }
            $output .= '<li' . drupal_attributes($attributes) . '>' . $data . "</li>\n";
        }
        $output .= "</{$type}>";
    }
    return $output;
}
Example #19
0
/**
 * Override or insert variables into the node template.
 */
function intranet_preprocess_node(&$variables)
{
    $node = $variables['node'];
    $field_items = field_get_items('node', $node, 'field_linktype');
    $link_type = $field_items[0]['value'];
    if ($variables['view_mode'] == 'full' && node_is_page($variables['node'])) {
        $variables['classes_array'][] = 'node-full';
    }
    if ($variables['type'] == 'cluster_of_links' && $link_type == 'All Applications') {
        $content_array = $variables['field_link_details'];
        $field_items1 = field_get_items('node', $node, 'field_link_details');
        foreach ($field_items1 as $key => $value) {
            $multifield = _multifield_field_item_to_entity('field_link_details', $value);
            $subfield_link = field_get_items('multifield', $multifield, 'field_link');
            $subfield_icon = field_get_items('multifield', $multifield, 'field_clustor_link_icon');
            $link_url = $subfield_link[0]['display_url'];
            $link_title = $subfield_link[0]['title'];
            $img_path = $subfield_icon[0]['uri'];
            $image = array('style_name' => 'all_application', 'path' => $img_path, 'alt' => '', 'title' => '');
            // link elements
            $text = theme('image_style', $image);
            // in your case it's an image
            $path = $link_url;
            $options = array('attributes' => array('target' => '_blank'), 'html' => true);
            $items[] = array('data' => l($text, $path, $options), 'id' => 'all_app_list_' . $key);
        }
        $attributes = array('id' => 'all-app-list');
        $links_html = theme_item_list(array('items' => $items, 'type' => 'ul', 'title' => '', 'attributes' => $attributes));
        $variables['all_applications_record'] = $links_html;
        $variables['theme_hook_suggestions'][] = 'node__teaser_all_app';
    }
    if ($variables['type'] == 'cluster_of_links' && $link_type == 'Quick Links' && ($variables['view_mode'] == 'teaser' || $variables['view_mode'] == 'full')) {
        $variables['theme_hook_suggestions'][] = 'node__teaser_quick_links';
    }
    if ($variables['type'] == 'cxo_messages' && $variables['view_mode'] == 'full') {
        $user = user_load($variables['user']->uid);
        if ($user->picture) {
            $variables['user_picture'] = theme_image_style(array('style_name' => 'cxo-message-user', 'path' => $user->picture->uri, 'attributes' => array('class' => 'avatar'), 'width' => "170", 'height' => "180"));
        } else {
            $variables['user_picture'] = theme_image_style(array('style_name' => 'cxo-message-user', 'path' => 'public://detail-user.png', 'attributes' => array('class' => 'avatar'), 'width' => "170", 'height' => "180"));
        }
        $variables['date'] = date("M j, Y", strtotime($variables['date']));
        $variables['submitted'] = t('!username on !datetime', array('!username' => $variables['name'], '!datetime' => $variables['date']));
    }
    //Applying cxo style to user image on award detail page for consistency.
    if ($variables['type'] == 'award' && $variables['view_mode'] == 'full') {
        if ($variables['field_user_identity'][0]['entity']->picture) {
            $variables['user_picture'] = theme_image_style(array('style_name' => 'cxo-message-user', 'path' => $variables['field_user_identity'][0]['entity']->picture->uri, 'attributes' => array('class' => 'avatar'), 'width' => "170", 'height' => "180"));
        } else {
            $variables['user_picture'] = theme_image_style(array('style_name' => 'cxo-message-user', 'path' => 'public://detail-user.png', 'attributes' => array('class' => 'avatar'), 'width' => "170", 'height' => "180"));
        }
    }
    if ($variables['type'] == 'units' && $variables['view_mode'] == 'full') {
        $variables['theme_hook_suggestions'][] = 'node__units';
    }
}
Example #20
0
/**
 * over ride the item list to exclude the otuside tag
 */
function scsmetronic_subtheme_item_list($variables)
{
    $items = $variables['items'];
    $title = $variables['title'];
    $type = $variables['type'];
    $attributes = $variables['attributes'];
    $add_div = isset($variables['add_div']) ? $variables['add_div'] : TRUE;
    // Only output the list container and title, if there are any list items.
    // Check to see whether the block title exists before adding a header.
    // Empty headers are not semantic and present accessibility challenges.
    $output = $add_div ? '<div class="item-list">' : '';
    if (isset($title) && $title !== '') {
        $output .= '<h3>' . $title . '</h3>';
    }
    if (!empty($items)) {
        $output .= "<{$type}" . drupal_attributes($attributes) . '>';
        $num_items = count($items);
        $i = 0;
        foreach ($items as $item) {
            $attributes = array();
            $children = array();
            $data = '';
            $i++;
            if (is_array($item)) {
                foreach ($item as $key => $value) {
                    if ($key == 'data') {
                        $data = $value;
                    } elseif ($key == 'children') {
                        $children = $value;
                    } else {
                        $attributes[$key] = $value;
                    }
                }
            } else {
                $data = $item;
            }
            if (count($children) > 0) {
                // Render nested list.
                $data .= theme_item_list(array('items' => $children, 'title' => NULL, 'type' => $type, 'attributes' => $attributes));
            }
            if ($i == 1) {
                $attributes['class'][] = 'first';
            }
            if ($i == $num_items) {
                $attributes['class'][] = 'last';
            }
            $output .= '<li' . drupal_attributes($attributes) . '>' . $data . "</li>\n";
        }
        $output .= "</{$type}>";
    }
    $output .= $add_div ? '</div>' : '';
    return $output;
}
Example #21
0
/**
 * Overrides theme_item_list().
 */
function stability_item_list($vars)
{
    if (isset($vars['attributes']['class']) && is_array($vars['attributes']['class']) && in_array('pager', $vars['attributes']['class'])) {
        foreach ($vars['items'] as $i => $item) {
            if (in_array('pager-first', $item['class']) || in_array('pager-last', $item['class'])) {
                $vars['items'][$i]['class'][] = 'hidden-pager';
            }
            if (in_array('pager-current', $item['class'])) {
                $vars['items'][$i]['data'] = '<a href = "#" class = "btn btn-sm btn-primary">' . $item['data'] . '</a>';
            }
        }
        if (array_search('pager-load-more', $vars['attributes']['class']) === FALSE && ($default_class = array_search('pager', $vars['attributes']['class'])) !== FALSE) {
            //unset($vars['attributes']['class'][$default_class]);
        }
        $styles = array(1 => 'pagination-custom list-unstyled list-inline', 2 => 'pagination pagination-lg', 3 => 'pagination', 4 => 'pagination pagination-sm');
        $vars['attributes']['class'][] = $styles[theme_get_setting('pager') ? theme_get_setting('pager') : 1];
        return '<div class="text-center">' . theme_item_list($vars) . '</div>';
    }
    return theme_item_list($vars);
}
Example #22
0
function rufsistems_item_list($variables)
{
    $items = $variables['items'];
    $title = $variables['title'];
    $type = $variables['type'];
    $attributes = $variables['attributes'];
    if (isset($variables['attributes']['class']['1']) and $variables['attributes']['class']['1'] == 'mypager_list') {
        $output = '<div class="mypager">';
    } else {
        $output = '<div class="item-list">';
    }
    if (isset($title) && $title !== '') {
        $output .= '<h3>' . $title . '</h3>';
    }
    if (!empty($items)) {
        $output .= "<{$type}" . drupal_attributes($attributes) . '>';
        $num_items = count($items);
        $i = 0;
        foreach ($items as $item) {
            $attributes = array();
            $children = array();
            $data = '';
            $i++;
            if (is_array($item)) {
                foreach ($item as $key => $value) {
                    if ($key == 'data') {
                        $data = $value;
                    } elseif ($key == 'children') {
                        $children = $value;
                    } else {
                        $attributes[$key] = $value;
                    }
                }
            } else {
                $data = $item;
            }
            if (count($children) > 0) {
                $data .= theme_item_list(array('items' => $children, 'title' => NULL, 'type' => $type, 'attributes' => $attributes));
            }
            $output .= '<li' . drupal_attributes($attributes) . '>' . $data . "</li>\n";
        }
        $output .= "</{$type}>";
    }
    $output .= '</div>';
    return $output;
}
Example #23
0
/**
 * Preprocess functions for node.tpl.php.
 */
function base_preprocess_node(&$vars)
{
    $node = $vars['node'];
    $options = array('absolute' => TRUE);
    $nid = $vars['vid'];
    // Node ID
    $url = url('node/' . $nid, $options);
    $vars['theme_hook_suggestions'][] = 'node__' . $vars['view_mode'];
    $vars['theme_hook_suggestions'][] = 'node__' . $vars['type'] . '__' . $vars['view_mode'];
    // GENERAL VARS ====================================================
    $vars['body'] = render($vars['content']['body']);
    $vars['created'] = format_date($vars['created'], 'custom', "n/j/y");
    $vars['sections'] = render($vars['content']['field_section']);
    $vars['tags'] = render($vars['content']['field_tags']);
    $vars['service_links'] = render($vars['content']['service_links']);
    $vars['video'] = render($vars['content']['field_video_url']);
    if ($vars['view_mode'] == 'teaser') {
        $vars['title'] = l(html_entity_decode($vars['title']), $url, array('html' => TRUE));
        $vars['cover_image'] = render($vars['content']['field_cover_image']);
        if ($vars['type'] == 'video') {
            $vars['cover_image'] = render($vars['content']['field_video_url']);
        }
    }
    // IMAGE GALLERY ====================================================
    if ($vars['type'] == 'image_gallery') {
        if ($vars['view_mode'] == 'teaser') {
            $vars['cover_image'] = render($vars['content']['field_cover_image']);
            if (isset($vars['cover_image'])) {
                $vars['cover_image'] = l($vars['cover_image'], $url, array('html' => TRUE));
            } else {
                $vars['cover_image'] = l(render_image($vars['field_other_images'][0], 'cover_image'), $url, array('html' => TRUE));
            }
            $read_more = l(' — read more', $url);
            $summary_text = render($vars['content']['body']);
            $vars['summary'] = $summary_text . '  ' . $read_more;
        }
        if ($vars['view_mode'] == 'full') {
            $images = array();
            for ($i = 0; $i < count($vars['field_other_images']); $i++) {
                $image = render_image($vars['field_other_images'][$i], 'gallery_large');
                if ($vars['field_other_images'][$i]['linknext'][1]) {
                    $caption1 = '<div class="caption c-left">' . $vars['field_other_images'][$i]['title'] . '</div>';
                    $iw = $vars['field_other_images'][$i]['width'];
                    $i++;
                    $caption2 = '<div class="caption c-right">' . $vars['field_other_images'][$i]['title'] . '</div>';
                    $iw2 = $vars['field_other_images'][$i]['width'];
                    $wt = $iw + $iw2;
                    $image2 = render_image($vars['field_other_images'][$i], 'gallery_large');
                    $images[] = '<div class="image-group" data-wt="' . $wt . '">' . $image . $image2 . '<div class="captions">' . $caption1 . $caption2 . '</div></div>';
                } else {
                    $caption = '<div class="captions"><div class="caption">' . $vars['field_other_images'][$i]['title'] . '</div></div>';
                    $images[] = '<div class="single-image">' . $image . $caption . '</div>';
                }
            }
            $gallery_settings = array('autoplay' => $vars['field_autoplay_slideshow'][0]['value'], 'start_thumbs' => $vars['field_start_with_thumbnails'][0]['value'], 'hide_controls' => $vars['field_hide_controls'][0]['value']);
            drupal_add_js(array('gallery_settings' => $gallery_settings), 'setting');
            $vars['images'] = theme_item_list(array('items' => $images, 'title' => null, 'type' => 'ul', 'attributes' => array()));
            drupal_add_js(path_to_theme() . '/js/init_gallery.js');
        }
        if ($vars['vid'] == 8) {
            $vars['theme_hook_suggestions'][] = 'node__intro__gallery';
            $intro_images = array();
            for ($i = 0; $i < 5; $i++) {
                $intro_images[] = file_create_url($vars['field_other_images'][$i]['uri']);
            }
            drupal_add_js(array('intro_images' => $intro_images), 'setting');
            drupal_add_js(path_to_theme() . '/js/jquery.backstretch.min.js');
            drupal_add_js(path_to_theme() . '/js/intro-gallery.js');
            //kpr($intro_images);
        }
        //kpr($vars);
    }
    // ARTICLE ====================================================
    if ($vars['type'] == 'article') {
        $vars['cover_image'] = render($vars['content']['field_cover_image']);
        $vars['post_date'] = $vars['created'];
        $vars['tags'] = render($vars['content']['field_tags']);
        $vars['summary'] = render($vars['content']['body']);
        $vars['service_links'] = render($vars['content']['service_links']);
        $vars['comment_count'] = l('Comments ' . $vars['comment_count'], $url . '#comments');
        if ($vars['view_mode'] == 'teaser') {
            //$vars['title'] = l($vars['title'], $url);
            $vars['cover_image'] = l($vars['cover_image'], $url, array('html' => TRUE));
            $read_more = l(' — read more', $url);
            $summary_text = render($vars['content']['body']);
            $vars['summary'] = $summary_text . '  ' . $read_more;
        }
        //kpr($vars);
    }
}
Example #24
0
function arquideasprod_item_list($items = array(), $title = NULL, $type = 'ul', $attributes = NULL)
{
    $output = '<div class="item-list">';
    if (isset($title)) {
        $output .= '<h3>' . $title . '</h3>';
    }
    if (isset($attributes['class']) && $attributes['class'] == 'pager') {
        $match = preg_match('/^contest\\/\\d+\\//', $_GET['q']);
        if ($match == 1) {
            $items_per_page_override = $_GET['items-per-page'] > 0 ? $_GET['items-per-page'] : 15;
            $output .= '<div class="items-per-page-selector"><strong>' . t('Show') . '</strong> <select>';
            $output .= '<option value="5"' . ($items_per_page_override == 5 ? ' selected="selected"' : '') . '>5</option>';
            $output .= '<option value="10"' . ($items_per_page_override == 10 ? ' selected="selected"' : '') . '>10</option>';
            $output .= '<option value="15"' . ($items_per_page_override == 15 ? ' selected="selected"' : '') . '>15</option>';
            $output .= '<option value="20"' . ($items_per_page_override == 20 ? ' selected="selected"' : '') . '>20</option>';
            $output .= '<option value="50"' . ($items_per_page_override == 50 ? ' selected="selected"' : '') . '>50</option>';
            $output .= '<option value="100"' . ($items_per_page_override == 100 ? ' selected="selected"' : '') . '>100</option>';
            $output .= '<option value="200"' . ($items_per_page_override == 200 ? ' selected="selected"' : '') . '>200</option>';
            $output .= '<option value="99999"' . ($items_per_page_override == 99999 ? ' selected="selected"' : '') . '>' . t('All') . '</option>';
            $output .= '</select></div>';
        }
    }
    if (!empty($items)) {
        $output .= "<{$type}" . drupal_attributes($attributes) . '>';
        $num_items = count($items);
        $c = $num_items;
        foreach ($items as $i => $item) {
            $c--;
            $attributes = array();
            $children = array();
            if (is_array($item)) {
                foreach ($item as $key => $value) {
                    if ($key == 'data') {
                        $data = $value;
                    } elseif ($key == 'children') {
                        $children = $value;
                    } else {
                        $attributes[$key] = $value;
                    }
                }
            } else {
                $data = $item;
            }
            if (!is_numeric($i)) {
                if (count($children) > 0) {
                    $data .= theme_item_list($children, NULL, $type, $attributes);
                    // Render nested list
                }
                if ($c == $num_items - 1) {
                    $attributes['class'] = empty($attributes['class']) ? 'first' : $attributes['class'] . ' first';
                }
                if ($c == 0) {
                    $attributes['class'] = empty($attributes['class']) ? 'last' : $attributes['class'] . ' last';
                }
                $attributes['class'] .= ' ' . ($c % 2 ? 'even' : 'odd');
                $output .= '<li' . drupal_attributes($attributes) . '>' . $data . "</li>\n";
            } else {
                if (count($children) > 0) {
                    $data .= theme_item_list($children, NULL, $type, $attributes);
                    // Render nested list
                }
                if ($i == 0) {
                    $attributes['class'] = empty($attributes['class']) ? 'first' : $attributes['class'] . ' first';
                }
                if ($i == $num_items - 1) {
                    $attributes['class'] = empty($attributes['class']) ? 'last' : $attributes['class'] . ' last';
                }
                $attributes['class'] .= ' ' . ($i % 2 ? 'even' : 'odd');
                $output .= '<li' . drupal_attributes($attributes) . '>' . $data . "</li>\n";
            }
        }
        $output .= "<{$type}>";
    }
    $output .= '</div>';
    return $output;
}
Example #25
0
function mothership_item_list($items = array(), $title = NULL, $type = 'ul', $attributes = NULL)
{
    //fix if the type is div-span
    if ($type == "div-span") {
        $type = "div";
        $item_type = "div-span";
    } else {
        $item_type = $type;
    }
    $attributes['class'] .= " item-list";
    //test if we have an title then add the div.item-list around the list
    if (isset($title)) {
        $output = '<div class="item-list">';
        if ($item_type == "span") {
            $output .= '<span class="title">' . $title . '</span>';
        } else {
            $output .= '<h3>' . $title . '</h3>';
        }
    }
    if (!empty($items)) {
        $output .= "<{$type}" . drupal_attributes($attributes) . '>';
        $num_items = count($items);
        foreach ($items as $i => $item) {
            $attributes = array();
            $children = array();
            if (is_array($item)) {
                foreach ($item as $key => $value) {
                    if ($key == 'data') {
                        $data = $value;
                    } elseif ($key == 'children') {
                        $children = $value;
                    } else {
                        $attributes[$key] = $value;
                    }
                }
            } else {
                $data = $item;
            }
            if (count($children) > 0) {
                $data .= theme_item_list($children, NULL, $type, $attributes);
                // Render nested list
            }
            //      $mothership_cleanup_itemlist = theme_get_setting('mothership_cleanup_itemlist');
            // zebra stribes
            if (theme_get_setting('mothership_item_list_zebra')) {
                if ($i & 1) {
                    $attributes['class'] = empty($attributes['class']) ? 'odd' : $attributes['class'] . ' odd';
                } else {
                    $attributes['class'] = empty($attributes['class']) ? 'even' : $attributes['class'] . ' even';
                }
            }
            //removed first / last fromt the item list?
            if (theme_get_setting('mothership_item_list_first_last')) {
                if ($i == 0) {
                    $attributes['class'] .= ' first';
                }
                if ($i == $num_items - 1) {
                    $attributes['class'] .= ' last';
                }
            }
            //is it a li or a span or a div ?
            if ($item_type == "ul" or $item_type == "ol") {
                $output .= '<li' . drupal_attributes($attributes) . '>' . $data . "</li>\n";
            } elseif ($item_type == "span" or $item_type == "div-span") {
                $output .= '<span' . drupal_attributes($attributes) . '>' . $data . "</span>\n";
            } elseif ($item_type == "div") {
                $output .= '<div' . drupal_attributes($attributes) . '>' . $data . "</div>\n";
            } else {
                $output .= '<li' . drupal_attributes($attributes) . '>' . $data . "</li>\n";
            }
        }
        $output .= "</{$type}>";
    }
    if (isset($title)) {
        $output .= '</div>';
    }
    return $output;
}
Example #26
0
function commons_connect_item_list($items = array(), $title = NULL, $type = 'ul', $attributes = NULL)
{
    $output = '<div class="item-list">';
    if (isset($title)) {
        $output .= '<h3>' . $title . '</h3>';
    }
    if (!empty($items)) {
        $output .= "<{$type}" . drupal_attributes($attributes) . '>';
        $num_items = count($items);
        $c = $num_items;
        foreach ($items as $i => $item) {
            $c--;
            $attributes = array();
            $children = array();
            if (is_array($item)) {
                foreach ($item as $key => $value) {
                    if ($key == 'data') {
                        $data = $value;
                    } elseif ($key == 'children') {
                        $children = $value;
                    } else {
                        $attributes[$key] = $value;
                    }
                }
            } else {
                $data = $item;
            }
            if (!is_numeric($i)) {
                if (count($children) > 0) {
                    $data .= theme_item_list($children, NULL, $type, $attributes);
                    // Render nested list
                }
                if ($c == $num_items - 1) {
                    $attributes['class'] = empty($attributes['class']) ? 'first' : $attributes['class'] . ' first';
                }
                if ($c == 0) {
                    $attributes['class'] = empty($attributes['class']) ? 'last' : $attributes['class'] . ' last';
                }
                $attributes['class'] .= ' ' . ($c % 2 ? 'even' : 'odd');
                $output .= '<li' . drupal_attributes($attributes) . '>' . $data . "</li>\n";
            } else {
                if (count($children) > 0) {
                    $data .= theme_item_list($children, NULL, $type, $attributes);
                    // Render nested list
                }
                if ($i == 0) {
                    $attributes['class'] = empty($attributes['class']) ? 'first' : $attributes['class'] . ' first';
                }
                if ($i == $num_items - 1) {
                    $attributes['class'] = empty($attributes['class']) ? 'last' : $attributes['class'] . ' last';
                }
                $attributes['class'] .= ' ' . ($i % 2 ? 'even' : 'odd');
                $output .= '<li' . drupal_attributes($attributes) . '>' . $data . "</li>\n";
            }
        }
        $output .= "<{$type}>";
    }
    $output .= '</div>';
    return $output;
}
Example #27
0
<?php

foreach ($links as $link => $url) {
    $items[] = array('data' => l($link, $url), 'id' => 'menu_' . $url);
}
$title = null;
$type = 'ul';
$attributes = array('id' => 'my-dashboard-menus', 'class' => 'dashboard-class');
echo theme_item_list(array('items' => $items, 'title' => $title, 'type' => $type, 'attributes' => $attributes));
Example #28
0
/**
 * Return current search block contents
 */
function tendu_apachesolr_currentsearch($total_found, $links)
{
    //$total_found == 1 ? $items = 'item' : $items = 'items';
    //$return = '<h2>Current Search</h2>';
    //$return .= '<div class="search-found">Found <span>' . $total_found . '</span> results</div>';
    $return .= '<div class="search-facet-title">' . t('You\'ve selected') . '</div>';
    $return .= '<div class="search-facet-links">' . theme_item_list($links) . '</div>';
    //$return .= '<div class="search-side-facet-bottom"></div>';
    return $return;
}