Пример #1
0
function phptemplate_preprocess_page(&$vars)
{
    $vars['tabs2'] = menu_secondary_local_tasks();
    if (module_exists('path')) {
        $alias = drupal_get_path_alias(str_replace('/edit', '', $_GET['q']));
        if ($alias != $_GET['q']) {
            $suggestions = array();
            $template_filename = 'page';
            foreach (explode('/', $alias) as $path_part) {
                $template_filename = $template_filename . '-' . $path_part;
                $suggestions[] = $template_filename;
            }
            $vars['template_files'] = array_merge((array) $suggestions, $vars['template_files']);
        }
    }
    //todo i think this can be deleted
    if (arg(0) == 'taxonomy' && arg(1) == 'term' && is_numeric(arg(2))) {
        $termid = arg(2);
        $parent_term = taxonomy_get_parents($termid);
        if (key($parent_term) == EMAILS_TERM_ID) {
            $term = taxonomy_get_term($termid);
            $vars['template_file'] = 'page-taxonomy-term-emails';
        }
    }
}
Пример #2
0
function lyden_preprocess_page(&$vars)
{
    $theme_path = base_path() . path_to_theme();
    $vars['ie_styles'] = '<link type="text/css" rel="stylesheet" media="all" href="' . $theme_path . '/css/ie.css" />' . "\n";
    if (arg(0) == 'lydavis') {
        $term = taxonomy_get_term(arg(1));
        if ($term->vid == 5) {
            $vars['body_classes'] .= ' external-' . $term->tid;
        }
    }
}
Пример #3
0
function migrate()
{
    global $term_dir;
    $completed = array();
    $names = $_POST['edit']['migrate'];
    foreach ($names as $name => $status) {
        $files = file_scan_directory($term_dir, $name);
        if (count($files) != 1) {
            print count($files) . " files match the name: {$name}";
            exit;
        }
        $image = array_pop($files);
        $image->filename_orig = $image->filename;
        if ($status == 1) {
            $image->tid = migrate_term_image_get_tid($image->name);
            if (!taxonomy_get_term($image->tid)) {
                print "cant find the tid: {$tid}";
                exit;
            }
            $t_i_image = db_fetch_object(db_query('SELECT path FROM {term_image} WHERE tid = %d', $image->tid));
            if ($t_i_image) {
                $term->has_image = true;
            }
            if ($term->has_image) {
                taxonomy_image_delete($image->tid);
            }
            if (file_copy($image->filename) != 1) {
                print "couldnt copy file: {$image->filename} to new location";
                exit;
            }
            db_query("INSERT INTO {term_image} (tid, path) VALUES (%d, '%s')", $image->tid, $image->filename);
            $completed[] = $image;
        }
        if ($_POST['edit']['delete'][$name] == 1) {
            file_delete($image->filename_orig);
            $deleted[] = $image;
        }
    }
    if ($c = count($completed)) {
        print "Updated {$c} terms";
    } else {
        print "No terms updated";
    }
    if ($c = count($deleted)) {
        print "Deleted {$c} node_image(s)";
    } else {
        print "No images deleted";
    }
}
Пример #4
0
function marinelli_taxonomy_term_page($tids, $result)
{
    drupal_add_css(drupal_get_path('module', 'taxonomy') . '/taxonomy.css');
    $output = '';
    // Only display the description if we have a single term, to avoid clutter and confusion.
    if (count($tids) == 1) {
        $term = taxonomy_get_term($tids[0]);
        $description = $term->description;
        // Check that a description is set.
        if (!empty($description)) {
            $output .= '<div class="terminfo"><p>';
            $output .= filter_xss_admin($description);
            $output .= '</p></div>';
        }
    }
    $output .= taxonomy_render_nodes($result);
    return $output;
}
Пример #5
0
/**
 * Return a themed breadcrumb trail.
 *
 * @param $breadcrumb
 *	 An array containing the breadcrumb links.
 * @return a string containing the breadcrumb output.
 */
function phptemplate_breadcrumb($breadcrumb)
{
    if (!empty($breadcrumb)) {
        // We need a special BC for forum topics and blog
        if (arg(0) == 'node' || arg(0) == 'comment' && arg(1) == 'reply') {
            if (arg(0) == 'node' && is_numeric(arg(1))) {
                $node = node_load(arg(1));
                // let's load the current node
            } elseif (is_numeric(arg(2))) {
                $node = node_load(arg(2));
                // commented node
            }
            if ($node->type == 'forum') {
                // is it a forum topic?
                $breadcrumb[] = l('Forums', 'forum');
                $par = array_keys($node->taxonomy);
                // ok, let's get the immediate parent term TID
                $par_tid = $par[0];
                $all_pars = taxonomy_get_parents_all($par_tid);
                $all_pars = array_reverse($all_pars);
                foreach ($all_pars as $this_par) {
                    $breadcrumb[] = l($this_par->name, drupal_get_path_alias('forum/' . $this_par->tid));
                }
                if (arg(0) == 'comment' && arg(1) == 'reply') {
                    $breadcrumb[] = l($node->title, drupal_get_path_alias('node/' . $node->nid));
                }
            }
        } elseif (arg(0) == 'blog') {
            $breadcrumb[] = l('Stay in Touch', 'stay-in-touch');
        } elseif (arg(0) == 'month') {
            $breadcrumb[] = l('Stay in Touch', 'stay-in-touch');
            $breadcrumb[] = l('Captain\'s Blog', 'stay-in-touch/blog');
        } elseif (arg(0) == 'taxonomy') {
            $this_term = taxonomy_get_term(arg(2));
            if ($this_term->vid == 2) {
                $breadcrumb[] = l('Stay in Touch', 'stay-in-touch');
                $breadcrumb[] = l('Captain\'s Blog Tags', 'stay-in-touch/blog');
            }
        }
        return implode(' <span>&gt</span> ', $breadcrumb);
    }
}
Пример #6
0
if ($team_exists != FALSE && db_fetch_object($team_exists) == FALSE) {
    $boincteam->description = _boincimport_text_sanitize($boincteam->description);
    $teaser = node_teaser($boincteam->description);
    // Construct the team as an organic group node
    $node = array('type' => 'team', 'title' => $boincteam->name, 'body' => $boincteam->description, 'teaser' => $teaser, 'uid' => boincuser_lookup_uid($boincteam->userid), 'path' => null, 'status' => 1, 'promote' => 0, 'created' => $boincteam->create_time, 'comment' => 0, 'moderate' => 0, 'sticky' => 0, 'format' => $input_format);
    // Use pathauto function, if available, to clean up the path
    if (module_exists('pathauto')) {
        module_load_include('inc', 'pathauto', 'pathauto');
        $node['path'] = pathauto_cleanstring($boincteam->name);
    } else {
        echo 'Pathauto module is required!';
        exit;
    }
    $node = (object) $node;
    // node_save requires an object form
    $node->taxonomy[] = taxonomy_get_term($team_type_tid);
    // Save the team node
    node_save($node);
    // Save the team IDs to a BOINC <--> Drupal reference table.
    db_query('INSERT INTO {boincteam} (team_id, nid) VALUES (%d, %d)', $boincteam->id, $node->nid);
}
// Determine team membership
db_set_active('boinc');
$boincteam_member_ids = array();
while ($boincuser = db_fetch_object($boincteam_members)) {
    $boincteam_member_ids[] = $boincuser->id;
}
db_set_active('default');
if ($boincteam_member_ids) {
    $team_members = db_query('SELECT uid FROM {boincuser} WHERE boinc_id IN(%s)', implode(',', $boincteam_member_ids));
    $team_admin = (int) db_result(db_query('SELECT uid FROM {boincuser} WHERE boinc_id=%d', $boincteam_admin));
Пример #7
0
 *   last replied to.
 * - $topic->timestamp: The raw timestamp this topic was posted.
 *
 * @see template_preprocess_forum_topic_list()
 * @see theme_forum_topic_list()
 */
?>
<table id="forum-topic-<?php 
print $topic_id;
?>
">
  
  <?php 
// Get vocabulary name and use that as the title
$topic = current($topics);
$taxonomy = taxonomy_get_term($topic->tid);
if (module_exists('internationalization')) {
    $imv = i18ntaxonomy_localize_terms(array($taxonomy));
    $taxonomy = reset($imv);
}
if ($forum_vocab = taxonomy_vocabulary_load($taxonomy->vid)) {
    if (module_exists('internationalization')) {
        $forum_vocab->name = i18ntaxonomy_translate_vocabulary_name($forum_vocab);
    }
    drupal_set_title($forum_vocab->name);
}
// Get the count of topics on this page
$topic_count = count($topics);
$topic_index = 0;
$first_non_sticky = FALSE;
?>
Пример #8
0
function ciclo20v2_taxonomy_term_page($tids, $result)
{
    $str_tids = arg(2);
    $terms = taxonomy_terms_parse_string($str_tids);
    $title_result = db_query(db_rewrite_sql('SELECT t.tid, t.name FROM {term_data} t WHERE t.tid IN (' . db_placeholders($terms['tids']) . ')', 't', 'tid'), $terms['tids']);
    $title_tids = array();
    // we rebuild the $tids-array so it only contains terms the user has access to.
    $names = array();
    while ($term = db_fetch_object($title_result)) {
        $title_tids[] = $term->tid;
        $names[] = $term->name;
    }
    $last_name = array_pop($names);
    if (count($names) == 0) {
        $title = t("Pages containing '@tag'", array('@tag' => $last_name));
    } elseif ($terms['operator'] == "or") {
        $title = t("Pages containing '@tags or @last_tag'", array('@tags' => implode(", ", $names), '@last_tag' => $last_name));
    } else {
        $title = t("Pages containing '@tags and @last_tag'", array('@tags' => implode(", ", $names), '@last_tag' => $last_name));
    }
    drupal_set_title($title);
    drupal_add_css(drupal_get_path('module', 'taxonomy') . '/taxonomy.css');
    $output = '';
    // Only display the description if we have a single term, to avoid clutter and confusion.
    if (count($tids) == 1) {
        $term = taxonomy_get_term($tids[0]);
        $description = $term->description;
        // Check that a description is set.
        if (!empty($description)) {
            $output .= '<div class="taxonomy-term-description">';
            $output .= filter_xss_admin($description);
            $output .= '</div>';
        }
    }
    $output .= commons_connect_taxonomy_render_nodes($result);
    return $output;
}
Пример #9
0
<?php

$tid = arg(2);
if (is_numeric($tid)) {
    $term = taxonomy_get_term($tid);
    $termname = '';
    if (!empty($term->name)) {
        $termname = $term->name;
    }
}
tattlerui_embed_asset(path_to_theme() . '/js/mentions.listing.js', 'js');
tattlerui_embed_asset(path_to_theme() . '/js/tattlerui.flagging.js', 'js');
?>
  
<?php 
print custompage_view_tile('mention', $title = FALSE, 'block_1');
?>
          
        
 * - $css_name: A css-safe version of the view name.
 * - $css_class: The user-specified classes names, if any
 * - $header: The view header
 * - $footer: The view footer
 * - $rows: The results of the view query, if any
 * - $empty: The empty text to display if the view is empty
 * - $pager: The pager next/prev links to display, if any
 * - $exposed: Exposed widget form/info to display
 * - $feed_icon: Feed icon to display, if any
 * - $more: A link to view more, if any
 * - $admin_links: A rendered list of administrative links
 * - $admin_links_raw: A list of administrative links suitable for theme('links')
 *
 * @ingroup views_templates
 */
$term = taxonomy_get_term(arg(2));
if ($term->tid) {
    ?>
<div class="category category-term-<?php 
    print $term->tid;
    ?>
">
  
  <div class="term-description">
    
	  <?php 
    print $term->description;
    ?>
	
  </div>
</div>
Пример #11
0
      <?php 
if ($site_slogan && $is_front) {
    ?>
        <h4 id="site-slogan"><?php 
    print $site_slogan;
    ?>
</h4>
      <?php 
}
?>

        <div id="content-area">

<!-- Print taxonomy description -->
<?php 
$current = taxonomy_get_term(arg(2));
$term_desc = $current->description;
if ($term_desc != '') {
    ?>
  <div class="view-taxonomy-term">
    <div class="views-row">
	  <?php 
    print $term_desc;
    ?>
    </div>
  </div>
<?php 
}
?>

          <?php 
 if (!$place_node || strpos($node->field_dealtype[0]['value'], 'Tour') === TRUE || strpos($node->field_dealtype[0]['value'], 'Flight') === TRUE) {
     //if we don't have place_node from address,or this is not a Hotel Deal, we use mainplace
     $place_node = node_load($node->field_mainplace[0]['nid']);
 }
 if (!$place_node) {
     watchdog('alehap', 'missing any place');
 }
 //Get all terms
 $parents = taxonomy_get_parents_all($place_node->field_placeterm[0]['value']);
 $places = "";
 $first = TRUE;
 foreach ($parents as $parent) {
     //Get place node by term ID -  related to "place_by_term" view
     $place_by_term = sqrl('place_by_term', $parent->tid);
     //Load correspoding term object
     $term_obj = taxonomy_get_term($place_by_term[0]['field_placeterm_value']);
     //Append to places string
     //If this is the first item of object, do not append the ','
     if ($first) {
         $places .= $term_obj ? $term_obj->name : '';
         $first = FALSE;
     } else {
         $places .= $term_obj ? ', ' . $term_obj->name : '';
     }
     //IF we reach "Country" place node, break loop
     if ($place_by_term[0]['field_placetype_value'] == "Country") {
         break;
     }
 }
 //if street address is available, append ',' to it.
 //if not, $street_address blank
Пример #13
0
if ($node->type != 'product_info_page' && $node->type != 'alacarte_article' && !drupal_is_front_page()) {
    ?>
								
						<div class="single-post">
							<div class="post-content-type">
								<div class="main-heading">
        <?php 
    if (!$user->uid) {
        ?>
									<strong class="note">Unlock up-to-the-minute financial news. <a href="/user/register">Sign up today.</a></strong>
        <?php 
    }
    ?>
        <?php 
    if (!$node || $node->type == 'page') {
        $page_title = $title;
        if (!$page_title && arg(0) == 'taxonomy') {
            $tax_term = taxonomy_get_term(check_plain(arg(2)));
            if ($tax_term) {
                $page_title = $tax_term->name;
            }
        }
        print '<h2>' . $page_title . '</h2>';
    } else {
        print '<h2>' . MNI_taxonomy_subhed($node) . '</h2>';
    }
    ?>
								</div>

								<?php 
    if ($node && ($node->type == 'alacarte_article' || $node->type == 'free_article' || $node->type == 'page' || $node->type == 'product_info_page')) {
Пример #14
0
 /**
  * (non-PHPdoc)
  * @see Entity::_objectLoad()
  */
 protected function _objectLoad($tid)
 {
     return taxonomy_get_term((int) $tid);
 }
Пример #15
0
/**
* Modifyied Theme Function theme_taxonomy_term_page
*  render tags 
**/ 
function alim_taxonomy_term_page($tids, $result) {
  drupal_add_css(drupal_get_path('module', 'taxonomy') .'/taxonomy.css');

  $output = '';
	$new = '';
  // Only display the description if we have a single term, to avoid clutter and confusion.
  if (count($tids) == 1) {
    $term = taxonomy_get_term($tids[0]);
    $description = $term->description;
	 /*if($term->vid == 9 ){ // check this is a community tag
			
	  
	  	 $count = taxonomy_term_count_nodes($term->tid);
			$new = "<h4>Tag : $term->name ( $count )</h4>";
	  }*/
    // Check that a description is set.
    if (!empty($description)) {
      $output .= '<div class="taxonomy-term-description">';
      $output .= filter_xss_admin($description);
      $output .= '</div>';
	 
    }
  }
	//$output .= $new ;
  $output .= taxonomy_render_nodes($result);

  return $output;
}
  <?php 
}
?>

  <?php 
if ($rows or $empty) {
    ?>
    <div class="view-content">
      <?php 
    $team_forum_id = arg(4);
    $team_forum = boincteam_forum_load($team_forum_id);
    // Grab a sample forum topic node to get the forum vocabulary name
    $sample = db_result(db_query("\n          SELECT nid FROM {node} WHERE type = 'forum' LIMIT 1"));
    $forum_node = node_load($sample);
    // Get vocabulary name and use that as the page title
    $taxonomy = taxonomy_get_term($forum_node->tid);
    if (module_exists('internationalization')) {
        $taxonomy = reset(i18ntaxonomy_localize_terms(array($taxonomy)));
    }
    if ($forum_vocab = taxonomy_vocabulary_load($taxonomy->vid)) {
        if (module_exists('internationalization')) {
            $forum_vocab->name = i18ntaxonomy_translate_vocabulary_name($forum_vocab);
        }
        drupal_set_title($forum_vocab->name);
    }
    ?>

      <h1 class="title"><?php 
    print $forum_vocab->name;
    ?>
</h1>
Пример #17
0
/**
 * Override or insert variables into the page templates.
 *
 * @param $vars
 *   An array of variables to pass to the theme template.
 * @param $hook
 *   The name of the template being rendered ("page" in this case.)
 */
function ncc_preprocess_page(&$vars, $hook) {
  //print_r($vars);
  $vars['sample_variable'] = t('em ipsum.');
  $term = taxonomy_get_term(arg(0));
  $vars['taxonomy_term_description'] = filter_xss_admin($term->name);
  
  //Homepage
  if ($vars['is_front']) {
	
  	//This is loading the main_page called homepage or nodeid=216
	// It has some homepage content and contains:
	// 		* video, video title, video description
	//		* footer links.
	$homepagenode = node_load("3229");
	$vars['homepagenode'] = $homepagenode; 	
  	
  	//Get Homepage News
  	$vars['news_listing'] = views_embed_view('news_listing_homepage', 'block_1', 1981);
	$vars['more_news_link'] = "/news/1981"; // homepage tag taxonomy id
	$vars['more_news_text'] = $news_view->display['default']->display_options['use_more_text'];
	
	//Get Homepage Buttons
	$vars['button_listing'] = views_embed_view('main_button_list', 'block_1', 1981);
	
	//Get Homepage Slideshow
	$vars['slideshow'] = views_embed_view('slideshow', 'block_1');
	
	//Get Homepage Events
	$remoteResponse = drupal_http_request("http://calendar.northcentralcollege.edu/feed/jsonfeed.php?calname=spotlight");
	$data = json_decode($remoteResponse->data);
	$vars['event_data'] = $data;
  }

  

}