Пример #1
0
function _scratchy_forum_display($forums, $topics, $parents, $tid, $sortby, $forum_per_page)
{
    global $user;
    // forum list, topics list, topic browser and 'add new topic' link
    $vocabulary = taxonomy_get_vocabulary(variable_get('forum_nav_vocabulary', ''));
    $title = $vocabulary->name;
    // Breadcrumb navigation:
    $breadcrumb = array();
    if ($tid) {
        $breadcrumb[] = array('path' => 'forum', 'title' => $title);
    }
    if ($parents) {
        $parents = array_reverse($parents);
        foreach ($parents as $p) {
            if ($p->tid == $tid) {
                $title = $p->name;
            } else {
                $breadcrumb[] = array('path' => 'forum/' . $p->tid, 'title' => $p->name);
            }
        }
    }
    drupal_set_title(check_plain($title));
    $breadcrumb[] = array('path' => $_GET['q']);
    menu_set_location($breadcrumb);
    if (count($forums) || count($parents)) {
        $output = '<div class="node">
  <div class="boxtop"><div class="bc ctr"></div><div class="bc ctl"></div></div>
  <div class="boxcontent">
    <div class="subboxcontent"><div class="content"><div id="forum"><ul style="margin-top:0">';
        if (user_access('create forum topics')) {
            $output .= '<li>' . l(t('Post new forum topic.'), "node/add/forum/{$tid}") . '</li>';
        } else {
            if ($user->uid) {
                $output .= '<li>' . t('You are not allowed to post a new forum topic.') . '</li>';
            } else {
                $output .= '<li>' . t('<a href="@login">Login</a> to post a new forum topic.', array('@login' => url('user/login', drupal_get_destination()))) . '</li>';
            }
        }
        $output .= '</ul>';
        $output .= theme('forum_list', $forums, $parents, $tid);
        if ($tid && !in_array($tid, variable_get('forum_containers', array()))) {
            $output .= theme('forum_topic_list', $tid, $topics, $sortby, $forum_per_page);
            drupal_add_feed(url('taxonomy/term/' . $tid . '/0/feed'), 'RSS - ' . $title);
        }
        $output .= '</div></div></div>
  </div>
  <div class="boxbtm">
    <div class="bc cbr"></div>
    <div class="bc cbl"></div>
  </div>
</div>';
    } else {
        drupal_set_title(t('No forums defined'));
        $output = '';
    }
    return $output;
}
Пример #2
0
/**
 * Implements hook_preprocess_page().
 */
function druio_theme_preprocess_page(&$variables)
{
    global $user;
    // Search form.
    $variables['header_search_form'] = format_string('<form action="@action" class="@form_class">
  <input name="s" value="" maxlength="128" class="@input_class" type="text"
         placeholder="@placeholder">
</form>', array('@action' => '/search', '@form_class' => 'search-form', '@input_class' => 'search-input', '@placeholder' => 'Поиск по сообществу'));
    // Simple menu for header top line. Such as tracker and GitHub.
    $header_links = array(array('title' => 'Трекер', 'href' => '/tracker', 'classes' => array('tracker', _druio_messages_status()), 'attributes' => array('data-new-count' => druio_tracker_count())), array('title' => 'GitHub', 'href' => 'https://github.com/dru-io/Dru.io', 'classes' => array('github'), 'attributes' => array('target' => '_blank')));
    $variables['header_links'] = theme('druio_theme_header_links', array('links' => $header_links));
    // Header profile data.
    $header_auth_template = $user->uid ? 'druio_theme_auth_user' : 'druio_theme_auth_anon';
    $variables['header_auth'] = theme($header_auth_template, array('user' => $user));
    $status = drupal_get_http_header("status");
    if ($status == "403 Forbidden") {
        _druio_theme_preprocess_page_403($variables);
    }
    drupal_add_feed(url('rss/questions', array('absolute' => TRUE)), variable_get('site_name') . ': Вопросы');
    drupal_add_feed(url('rss/posts', array('absolute' => TRUE)), variable_get('site_name') . ': Публикации');
}
Пример #3
0
            </div>
            <?php 
if ($right) {
    echo '<div class="sidebar1">' . $right . "</div>";
} else {
    if ($sidebar_right) {
        echo '<div class="sidebar1">' . $sidebar_right . "</div>";
    }
}
?>
          </div>
          <div class="cleared"></div>
          <div class="Footer">
            <div class="Footer-inner">
              <a href="<?php 
$feedsUrls = array_keys(drupal_add_feed());
if (isset($feedsUrls[0]) && strlen($feedsUrls[0]) > 0) {
    echo $feedsUrls[0];
}
?>
" class="rss-tag-icon" title="RSS"></a>
              <div class="Footer-text">
                <?php 
if ($footer) {
    echo $footer;
}
?>
              </div>
            </div>
            <div class="Footer-background"></div>
          </div>
Пример #4
0
/**
 * Prepares and returns the HTML for the SOPAC search page/hit list.
 * Uses the following templates: sopac_results.tpl.php, sopac_results_hitlist.tpl.php, sopac_results_nohits.tpl.php
 *
 * @return string SOPAC catalog search HTML
 */
function sopac_catalog_search()
{
    global $pager_page_array, $pager_total, $locum_results_all, $locum_cfg;
    global $user;
    $account = user_load(array('uid' => $user->uid));
    // Load Required JS libraries
    drupal_add_js(drupal_get_path('module', 'sopac') . '/js/jquery.treeview.js');
    drupal_add_js(drupal_get_path('module', 'sopac') . '/js/jquery.rating.js');
    drupal_add_js(drupal_get_path('module', 'sopac') . '/js/facet-browser.js');
    require_once 'sopac_social.php';
    $getvars = sopac_parse_get_vars();
    $actions = sopac_parse_uri();
    $locum = sopac_get_locum();
    $locum_cfg = $locum->locum_config;
    $no_circ = $locum->csv_parser($locum_cfg['location_limits']['no_request']);
    $valid_search_types = array('title', 'author', 'keyword', 'subject', 'series', 'callnum', 'tags', 'reviews');
    // TODO handle this more dynamically
    $output = $getvars['output'];
    $sort = $getvars['sort'];
    $format = $getvars['search_format'];
    $location = $getvars['location'];
    $limit_avail = $getvars['limit_avail'];
    $pager_page_array = explode(',', $getvars['page']);
    // temp for advanced page. should this be broken out
    if ($actions[1] == 'isn') {
        $actions[1] = 'keyword';
    }
    $search_type = $actions[1];
    if ($actions[3]) {
        $actions[2] = $actions[2] . "/" . $actions[3];
    }
    $search_term = $actions[2];
    // If there is a proper search query, we get that data here.
    if (in_array($actions[1], $valid_search_types)) {
        $valid_search = TRUE;
        // Save the search URL in a cookie
        $_SESSION['search_url'] = request_uri();
        if ($getvars['perpage']) {
            $limit = $getvars['perpage'];
        } elseif ($account->profile_perpage) {
            $limit = $account->profile_perpage;
        } else {
            $limit = variable_get('sopac_results_per_page', 10);
        }
        if ($user->uid && $limit != $account->profile_perpage) {
            $field = db_fetch_object(db_query("SELECT * FROM profile_fields WHERE name = 'profile_perpage'"));
            db_query("INSERT INTO profile_values (fid, uid, value) VALUES (%d, %d, '%s') ON DUPLICATE KEY UPDATE value = '%s'", $field->fid, $user->uid, $limit, $limit);
        }
        //if ($addl_search_args['limit']) {
        //  $limit = $addl_search_args['limit'];
        //}
        //else {
        //  $limit = variable_get('sopac_results_per_page', 20);
        //}
        // Initialize the pager if need be
        if ($pager_page_array[0]) {
            $page = $pager_page_array[0] + 1;
        } else {
            $page = 1;
        }
        $page_offset = $limit * ($page - 1);
        // Grab the faceted search arguments from the URL
        $facet_args = array();
        if (count($getvars['facet_series'])) {
            $facet_args['facet_series'] = $getvars['facet_series'];
        }
        if (count($getvars['facet_lang'])) {
            $facet_args['facet_lang'] = $getvars['facet_lang'];
        }
        if (count($getvars['facet_year'])) {
            $facet_args['facet_year'] = $getvars['facet_year'];
        }
        if (count($getvars['facet_decade'])) {
            $facet_args['facet_decade'] = $getvars['facet_decade'];
        }
        if (count($getvars['age'])) {
            $facet_args['age'] = $getvars['age'];
        }
        if (count($getvars['facet_subject'])) {
            $facet_args['facet_subject'] = $getvars['facet_subject'];
        }
        if (count($getvars['facet_lexile'])) {
            $facet_args['facet_lexile'] = $getvars['facet_lexile'];
        }
        // Hide suppressed records unless permission
        $show_inactive = user_access('show suppressed records');
        // Get the search results from Locum
        $locum_results_all = $locum->search($search_type, $search_term, $limit, $page_offset, $sort, $format, $location, $facet_args, FALSE, $limit_avail, $show_inactive);
        $num_results = $locum_results_all['num_hits'];
        $result_info['limit'] = $limit;
        $result_info['num_results'] = $num_results;
        $result_info['hit_lowest'] = $page_offset + 1;
        if ($page_offset + $limit < $num_results) {
            $result_info['hit_highest'] = $page_offset + $limit;
        } else {
            $result_info['hit_highest'] = $num_results;
        }
    }
    // Construct the search form
    $search_form_cfg = variable_get('sopac_search_form_cfg', 'both');
    $search_form = sopac_search_form($search_form_cfg);
    // If we get results back, we begin creating the hitlist
    if ($num_results > 0) {
        // We need to determine how many result pages there are.
        $pager_total[0] = ceil($num_results / $limit);
        $hitlist = '';
        $hitnum = $page_offset + 1;
        // When limiting to available, sometimes the "Last" link takes the user beyond the number of
        // available items and errors out.  This will step them back until they have at least 1 hit.
        if (!count($locum_results_all['results']) && $getvars['limit_avail']) {
            $uri_arr = explode('?', request_uri());
            $uri = $uri_arr[0];
            $getvars_tmp = $getvars;
            if ($getvars_tmp['page']) {
                if ($getvars_tmp['page'] == 1) {
                    $getvars_tmp['page'] = '';
                } else {
                    $getvars_tmp['page']--;
                }
                $pvars_tmp = trim(sopac_make_pagevars(sopac_parse_get_vars($getvars_tmp)));
                $gvar_indicator = $pvars_tmp ? '?' : '';
                $step_link = $uri . $gvar_indicator . $pvars_tmp;
                header('Location: ' . $step_link);
            }
        }
        // Loop through results.
        foreach ($locum_results_all['results'] as $locum_result) {
            // Grab Stdnum
            $stdnum = $locum_result['stdnum'][0];
            // Get the cover image
            $cover_img_url = $locum_result['cover_img'];
            $locum_result['sort'] = $sort;
            // Grab Syndetics reviews, etc..
            $review_links = $locum->get_syndetics($locum_result['stdnum'][0]);
            if (count($review_links)) {
                $locum_result['review_links'] = $review_links;
            }
            // Send it all off to the template
            if ($output == "rss") {
                $result_body .= theme('sopac_results_hitlist_rss', $hitnum, $cover_img_url, $locum_result, $locum_cfg, $no_circ);
            } else {
                if ($output == "xml") {
                    $result_body .= theme('sopac_results_hitlist_xml', $hitnum, $cover_img_url, $locum_result, $locum_cfg, $no_circ);
                } else {
                    $result_body .= theme('sopac_results_hitlist', $hitnum, $cover_img_url, $locum_result, $locum_cfg, $no_circ);
                }
            }
            $hitnum++;
        }
        $hitlist_pager = theme('pager', NULL, $limit, 0, NULL, 6);
    } else {
        if ($valid_search) {
            $result_body .= theme('sopac_results_nohits', $locum_results_all, $locum->locum_config);
        }
    }
    // Pull it all together into the search page template
    $result_page = $search_form . theme($output_template, $result_info, $hitlist_pager, $result_body, $locum_results_all, $locum->locum_config);
    // Check to see if we're doing RSS
    if ($output == "rss") {
        print theme('sopac_results_rss', $result_info, $search_term, $search_type, $result_body, $locum_results_all, $locum->locum_config);
        exit(0);
    } else {
        if ($output == "xml") {
            print theme('sopac_results_xml', $result_info, $hitlist_pager, $result_body, $locum_results_all, $locum->locum_config);
            exit(0);
        } else {
            $result_page = $search_form . theme('sopac_results', $result_info, $hitlist_pager, $result_body, $locum_results_all, $locum->locum_config);
        }
    }
    $search_feed_url = sopac_update_url(request_uri(), 'output', 'rss');
    drupal_add_feed($search_feed_url, 'Search for "' . $search_term . '"');
    return $result_page;
}
Пример #5
0
function aae_preprocess_html(&$variables)
{
    // Add theme-specific meta-tags to HTML-head
    $html_heads = array('viewport' => array('#tag' => 'meta', '#attributes' => array('name' => 'viewport', 'content' => 'width=device-width, initial-scale=1, maximum-scale=1')), 'theme-color' => array('#tag' => 'meta', '#attributes' => array('name' => 'theme-color', 'content' => '#2199E8')), 'manifest' => array('#tag' => 'meta', '#attributes' => array('name' => 'manifest', 'content' => base_path() . path_to_theme() . '/icons/manifest.json')), 'icon' => array('#tag' => 'link', '#attributes' => array('rel' => 'icon', 'type' => 'image/png', 'sizes' => '32x32', 'href' => base_path() . path_to_theme() . '/icons/favicon-32x32.png')), 'apple-touch-icon' => array('#tag' => 'link', '#attributes' => array('rel' => 'apple-touch-icon', 'sizes' => '60x60', 'href' => base_path() . path_to_theme() . '/icons/apple-icon-60x60.png')), 'msapplication-navbutton-color' => array('#tag' => 'meta', '#attributes' => array('name' => 'msapplication-navbutton-color', 'content' => '#2199E8')), 'msapplication-TileColor' => array('#tag' => 'meta', '#attributes' => array('name' => 'msapplication-TileColor', 'content' => '#2199E8')), 'msapplication-TileImage' => array('#tag' => 'meta', '#attributes' => array('name' => 'msapplication-TileImage', 'content' => base_path() . path_to_theme() . '/icons/ms-icon-144x144.png')), 'description' => array('#tag' => 'meta', '#attributes' => array('name' => 'description', 'content' => t('Deine Stadtteilplattform für den Leipziger Osten: Lerne Akteure & Events aus Deinem Bezirk kennen.'))));
    foreach ($html_heads as $key => $data) {
        drupal_add_html_head($data, $key);
    }
    drupal_add_feed(base_path() . 'rss.xml', t('Stadtteiljournal'));
    drupal_add_feed(base_path() . 'events/rss', t('Alle kommenden Veranstaltungen'));
    drupal_add_js(path_to_theme() . '/js/jquery-1.11.3.min.js', array('scope' => 'header'));
    drupal_add_js(path_to_theme() . '/js/pace.min.js');
    /* Would be better if it looked like <script data-pace-options="{'ajax':false}" src=".."></script> */
    drupal_add_js(path_to_theme() . '/js/app.js', array('scope' => 'footer'));
    drupal_add_css(path_to_theme() . '/css/foundation.min.css');
    drupal_add_css(path_to_theme() . '/css/app.css');
    drupal_add_js(path_to_theme() . '/js/foundation.min.js', array('scope' => 'footer'));
    drupal_add_js('$(document).foundation();', array('type' => 'inline', 'scope' => 'footer'));
    /* Checke Seitentyp, hänge entsprechendes CSS/JS an den Header: */
    $path = explode("/", current_path());
    // TODO: Call filter_xss()
    switch (strtolower(trim($path[0]))) {
        case 'node':
            $node = node_load(arg(1));
            if (drupal_is_front_page()) {
                drupal_add_css(path_to_theme() . '/css/page_front.css');
                drupal_add_js(path_to_theme() . '/js/jquery.fullPage.min.js', array('scope' => 'footer'));
                drupal_add_js(path_to_theme() . '/js/home.js', array('scope' => 'footer'));
            } else {
                if ($node->type == 'article') {
                    // Node--article.tpl.php
                    drupal_add_css(path_to_theme() . '/css/subpage.css');
                    drupal_add_css(path_to_theme() . '/css/article.css');
                } else {
                    drupal_add_css(path_to_theme() . '/css/subpage.css');
                }
            }
            break;
        case 'user':
            drupal_add_css(path_to_theme() . '/css/subpage.css');
            drupal_add_css(path_to_theme() . '/css/user.css');
            break;
        case 'akteurprofil':
        case 'eventprofil':
            drupal_add_css(path_to_theme() . '/css/subpage.css');
            drupal_add_css(path_to_theme() . '/css/project.css');
            if (trim($path[2]) == 'edit') {
                addAkteurEventsAddEditHead();
            }
            break;
        case 'events':
            drupal_add_css(path_to_theme() . '/css/subpage.css');
            if (trim($path[1]) == 'new') {
                addAkteurEventsAddEditHead();
            } else {
                $js = '$(window).ready(function(){$("#eventSpartenInput").tokenize({displayDropdownOnFocus:true,newElements:false,placeholder:"z.B. Jazz, Kultur,..."});});';
                $js .= '$(window).ready(function(){$("#eventBezirkInput").tokenize({displayDropdownOnFocus:true,newElements:false,placeholder:"z.B. Reudnitz..."});});';
                drupal_add_css(path_to_theme() . '/css/jquery.tokenize.css');
                drupal_add_js(path_to_theme() . '/js/jquery.tokenize.js', array('scope' => 'footer'));
                drupal_add_js($js, array('type' => 'inline', 'scope' => 'footer'));
            }
            break;
        case 'akteure':
            drupal_add_css(path_to_theme() . '/css/subpage.css');
            if (trim($path[1]) == 'new') {
                addAkteurEventsAddEditHead();
            } else {
                $js = '$(window).ready(function(){$(".tokenize").tokenize({displayDropdownOnFocus:true,newElements:false});$("#akteure-content").stalactite({cssPrep:false,loader:"",duration:50});});';
                drupal_add_css(path_to_theme() . '/css/jquery.tokenize.css');
                drupal_add_js(path_to_theme() . '/js/jquery.tokenize.js', array('scope' => 'footer'));
                drupal_add_js(path_to_theme() . '/js/stalactite.min.js', array('scope' => 'footer'));
                drupal_add_js($js, 'inline');
            }
            break;
        case 'festivals':
            addAkteurEventsAddEditHead();
            break;
        default:
            drupal_add_css(path_to_theme() . '/css/subpage.css');
            break;
    }
    global $user;
    if (array_intersect(array('festival', 'redakteur', 'administrator'), $user->roles)) {
        echo '<!-- IF IS_ADMIN --><style type="text/css">#mainnav{top: 65px !important;}#singlesite{margin-top:130px;}.aaeActionBar{margin-top:-230px !important;margin-bottom:160px !important;}</style><!-- /IF -->';
    }
}
?>
" xml:lang="<?php 
print $language->language;
?>
" dir="<?php 
print $language->dir;
?>
">
<head>
<title><?php 
print $head_title;
?>
</title>
<?php 
drupal_add_feed('http://feeds.feedburner.com/pandionblog', t('Pandion Blog'));
drupal_add_feed('http://twitter.com/statuses/user_timeline/pandion.rss', t('Pandion Tweets'));
$head = drupal_get_html_head();
print $head;
print $styles;
$js = drupal_add_js('misc/jquery.js', 'core', 'header');
print drupal_get_js('header', $js);
?>
<!--[if lt IE 7]>
	<script type="text/javascript" src="js/unitpngfix.js"></script>
<![endif]--> 
</head>
<body>

<?php 
// print($site_name)
// print($site_title)
Пример #7
0
function phptemplate_preprocess_node(&$vars)
{
    if ($vars['is_front']) {
        // This is homepage
        drupal_add_css(path_to_theme() . '/css/homepage.css', 'theme');
    } else {
        // Format nice blog dates
        $vars['blog_date'] = format_date($vars['node']->created, 'large');
        if ($vars['page']) {
            // To access regions in nodes
            //$vars['node_bottom'] = theme('blocks', 'node_bottom');
            // Add css for node pages
            drupal_add_css(path_to_theme() . '/css/node.css', 'theme');
            drupal_add_css(path_to_theme() . '/css/comments.css', 'theme');
            drupal_add_css(path_to_theme() . '/css/syntax_highlighting.css', 'theme');
            // Handle specific node types
            if ($vars['node']->type == 'blog') {
            } elseif ($vars['node']->type == 'update') {
                drupal_add_css(path_to_theme() . '/css/book.css', 'theme');
                drupal_add_css(path_to_theme() . '/css/node_project.css', 'theme');
                drupal_add_feed('/project_feed/rss.xml?project_id=' . $vars['node']->book['bid']);
            } elseif ($vars['node']->type == 'project') {
                drupal_add_css(path_to_theme() . '/css/book.css', 'theme');
                drupal_add_css(path_to_theme() . '/css/node_project.css', 'theme');
                drupal_add_feed('/project_feed/rss.xml?project_id=' . $vars['node']->nid);
                $vars['blog_date'] = null;
            } elseif ($vars['node']->type == 'zi') {
                drupal_add_css(path_to_theme() . '/css/node_zi.css', 'theme');
            } elseif ($vars['node']->type == 'page') {
                drupal_add_css(path_to_theme() . '/css/node_page.css', 'theme');
                unset($vars['blog_date']);
            } elseif ($vars['node']->type == 'webform') {
                drupal_add_css(path_to_theme() . '/css/node_page.css', 'theme');
                unset($vars['blog_date']);
            }
        }
        // different date for zi
        if ($vars['node']->type == 'zi') {
            $vars['blog_date'] = format_date_parts($vars['node']->created);
        }
    }
}
Пример #8
0
/**
 ***********************************************************************************
 * Preprocess page templates
 */
function leggy_preprocess(&$vars, $hook)
{
    if ($hook == 'page') {
        // Add a 'page-node' class if this is a node that is rendered as page
        if (isset($vars['node']) && $vars['node']->type) {
            $vars['body_classes'] .= ' page-node';
        }
        // remove 'Notification settings' tab from user page
        $array_q = explode('/', $_REQUEST['q']);
        if ($array_q[0] == 'user') {
            _leggy_removetab('Notification settings', $vars);
            _leggy_removetab('Track', $vars);
        }
        // Add Feed icon
        if ($array_q[0] == 'geek') {
            drupal_add_feed(url('geek/feed', array('absolute' => TRUE)), 'VictoriaC RSS | Geek');
        } elseif ($array_q[0] == 'life') {
            drupal_add_feed(url('life/feed', array('absolute' => TRUE)), 'VictoriaC RSS | Life');
        } elseif ($array_q[0] == 'today') {
            drupal_add_feed(url('today/feed', array('absolute' => TRUE)), 'VictoriaC RSS | Today');
        } elseif ($array_q[0] == '漢字感じ') {
            drupal_add_feed(url('漢字感じ/feed', array('absolute' => TRUE)), 'VictoriaC RSS | 漢字感じ');
        } else {
            drupal_add_feed(url('feed', array('absolute' => TRUE)), 'VictoriaC RSS | All');
        }
        $vars['head'] = drupal_get_html_head();
        // Refresh $head variable
        $vars['feed_icons'] = drupal_get_feeds();
        // Refresh $feed_icons variable
    }
    // Replace funny kanji characters in section name
    $vars['body_classes'] = str_replace('-e6-bc-a2-e5-ad-97-e6-84-9f-e3-81-98', 'kanjikanji', $vars['body_classes']);
}