| 1 |
<?php
|
| 2 |
//template for sanqreal Theme
|
| 3 |
//author: slasant - www.slasant.ru
|
| 4 |
function sanqreal_width($left, $right) {
|
| 5 |
$width = 570;
|
| 6 |
if (!$left ) {
|
| 7 |
$width = $width +200;
|
| 8 |
}
|
| 9 |
|
| 10 |
if (!$right) {
|
| 11 |
$width = $width +200;
|
| 12 |
}
|
| 13 |
return $width;
|
| 14 |
}
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
/**
|
| 19 |
* Return a themed breadcrumb trail.
|
| 20 |
*
|
| 21 |
* @param $breadcrumb
|
| 22 |
* An array containing the breadcrumb links.
|
| 23 |
* @return a string containing the breadcrumb output.
|
| 24 |
*/
|
| 25 |
function phptemplate_breadcrumb($breadcrumb) {
|
| 26 |
if (!empty($breadcrumb)) {
|
| 27 |
return '<div class="path"><p>'. implode(' / ', $breadcrumb) .'</p></div>';
|
| 28 |
}
|
| 29 |
}
|
| 30 |
|
| 31 |
|
| 32 |
//overrides taxonomy term page function
|
| 33 |
function sanqreal_taxonomy_term_page($tids, $result) {
|
| 34 |
drupal_add_css(drupal_get_path('module', 'taxonomy') .'/taxonomy.css');
|
| 35 |
|
| 36 |
$output = '';
|
| 37 |
|
| 38 |
// Only display the description if we have a single term, to avoid clutter and confusion.
|
| 39 |
if (count($tids) == 1) {
|
| 40 |
$term = taxonomy_get_term($tids[0]);
|
| 41 |
$description = $term->description;
|
| 42 |
|
| 43 |
// Check that a description is set.
|
| 44 |
if (!empty($description)) {
|
| 45 |
$output .= '<div class="terminfo"><p>';
|
| 46 |
$output .= filter_xss_admin($description);
|
| 47 |
$output .= '</p></div>';
|
| 48 |
}
|
| 49 |
}
|
| 50 |
|
| 51 |
$output .= taxonomy_render_nodes($result);
|
| 52 |
|
| 53 |
return $output;
|
| 54 |
}
|
| 55 |
|
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
|
| 60 |
function sanqreal_admin_page($blocks) {
|
| 61 |
$stripe = 0;
|
| 62 |
$container = array();
|
| 63 |
|
| 64 |
foreach ($blocks as $block) {
|
| 65 |
if ($block_output = theme('admin_block', $block)) {
|
| 66 |
if (empty($block['position'])) {
|
| 67 |
// perform automatic striping.
|
| 68 |
$block['position'] = ++$stripe % 2 ? 'left' : 'right';
|
| 69 |
}
|
| 70 |
if (!isset($container[$block['position']])) {
|
| 71 |
$container[$block['position']] = '';
|
| 72 |
}
|
| 73 |
$container[$block['position']] .= $block_output;
|
| 74 |
}
|
| 75 |
}
|
| 76 |
|
| 77 |
$output = '<div class="admin clear-block">';
|
| 78 |
$output .= '<div class="compact-link"><p>'; // use <p> for hide/show anchor
|
| 79 |
if (system_admin_compact_mode()) {
|
| 80 |
$output .= l(t('Show descriptions'), 'admin/compact/off', array('title' => t('Expand layout to include descriptions.')));
|
| 81 |
}
|
| 82 |
else {
|
| 83 |
$output .= l(t('Hide descriptions'), 'admin/compact/on', array('title' => t('Compress layout by hiding descriptions.')));
|
| 84 |
}
|
| 85 |
$output .= '</p></div>';
|
| 86 |
|
| 87 |
foreach ($container as $id => $data) {
|
| 88 |
$output .= '<div class="'. $id .' clear-block">';
|
| 89 |
$output .= $data;
|
| 90 |
$output .= '</div>';
|
| 91 |
}
|
| 92 |
$output .= '</div>';
|
| 93 |
return $output;
|
| 94 |
}
|
| 95 |
|
| 96 |
function sanqreal_admin_block_content($content) {
|
| 97 |
if (!$content) {
|
| 98 |
return '';
|
| 99 |
}
|
| 100 |
|
| 101 |
if (system_admin_compact_mode()) {
|
| 102 |
$output = '<dl class="menu">';
|
| 103 |
foreach ($content as $item) {
|
| 104 |
$output .= '<dt>'. l($item['title'], $item['href'], $item['localized_options']) .'</dt>'; // use definition list per compact mode
|
| 105 |
}
|
| 106 |
$output .= '</dl>';
|
| 107 |
}
|
| 108 |
else {
|
| 109 |
$output = '<dl class="admin-list">';
|
| 110 |
foreach ($content as $item) {
|
| 111 |
$output .= '<dt>'. l($item['title'], $item['href'], $item['localized_options']) .'</dt>';
|
| 112 |
$output .= '<dd>'. $item['description'] .'</dd>';
|
| 113 |
}
|
| 114 |
$output .= '</dl>';
|
| 115 |
}
|
| 116 |
return $output;
|
| 117 |
}
|
| 118 |
|
| 119 |
function sanqreal_system_admin_by_module($menu_items) { // admin by module page
|
| 120 |
$stripe = 0;
|
| 121 |
$output = '';
|
| 122 |
$container = array('left' => '', 'right' => '');
|
| 123 |
$flip = array('left' => 'right', 'right' => 'left');
|
| 124 |
$position = 'left';
|
| 125 |
|
| 126 |
// Iterate over all modules
|
| 127 |
foreach ($menu_items as $module => $block) {
|
| 128 |
list($description, $items) = $block;
|
| 129 |
|
| 130 |
// Output links
|
| 131 |
if (count($items)) {
|
| 132 |
$block = array();
|
| 133 |
$block['title'] = $module;
|
| 134 |
$block['content'] = theme('item_list', $items);
|
| 135 |
$block['description'] = t($description);
|
| 136 |
|
| 137 |
if ($block_output = theme('admin_block', $block)) {
|
| 138 |
if (!isset($block['position'])) {
|
| 139 |
// Perform automatic striping.
|
| 140 |
$block['position'] = $position;
|
| 141 |
$position = $flip[$position];
|
| 142 |
}
|
| 143 |
$container[$block['position']] .= $block_output;
|
| 144 |
}
|
| 145 |
}
|
| 146 |
}
|
| 147 |
|
| 148 |
$output = '<div class="bymodule">';
|
| 149 |
foreach ($container as $id => $data) {
|
| 150 |
$output .= '<div class="'. $id .' clear-block">';
|
| 151 |
$output .= $data;
|
| 152 |
$output .= '</div>';
|
| 153 |
}
|
| 154 |
$output .= '</div>';
|
| 155 |
|
| 156 |
return $output;
|
| 157 |
}
|