Wetland Conservation | Centre for Science and Environment


Wetland Conservation

<?php

function CSE_theme() {
return array(
'comment_form' => array(
'arguments' => array('form' => array()),
),
);
}

function CSE_comment_form($form)
{
$form['name']['#title'] = t('Your Name');
return drupal_render($form);
}

function cse_preprocess_page(&$vars) {
if(isset($vars['node'])){
foreach($vars['node']->taxonomy as $term)
{
$parents = taxonomy_get_parents($term->tid);
$isClimateChange=false;
foreach($parents as $parent)
if($parent->tid=="27")
$isClimateChange=true;
if($term->vid==1 && ($term->tid==27 || $isClimateChange) || $term->vid==32){
$vars['template_files'] = array();
$vars['template_files'][] = 'page-climate-change';
return;
}
}
}

if(arg(0)=="taxonomy" && arg(1)=="term"){
$term = taxonomy_get_term(arg(2));
if($term->vid==32){
$vars['template_files'] = array();
$vars['template_files'][] = 'page-climate-change';
return;
}
}

if(isset($vars['node'])){
if($vars['node']->type=='anil_agarwal_dialogue')
{
$vars['template_files'] = array();
$vars['template_files'][] = 'page-aagarwal-dialogue1';
return;
}
}

if (isset($vars['node']) && $vars['node']->type=="about_us") {

// Add template naming suggestion. It should alway use hyphens.
$vars['template_files'] = array();
$vars['template_files'][] = 'page-about_us';

}

if (isset($vars['node']) && $vars['node']->nid==3830) {

// Add template naming suggestion. It should alway use hyphens.
$vars['template_files'] = array();
$vars['template_files'][] = 'page-aagarwal-dialogue';

}

if (isset($vars['node']) && $vars['node']->nid==3759) {

// Add template naming suggestion. It should alway use hyphens.
$vars['template_files'] = array();
$vars['template_files'][] = 'page-climate-change';

}

if (isset($vars['node']) && $vars['node']->type=="volunteer") {

// Add template naming suggestion. It should alway use hyphens.
$vars['template_files'] = array();
$vars['template_files'][] = 'page-volunteer';

}

if (isset($vars['node']) && $vars['node']->type=="climate_change") {

// Add template naming suggestion. It should alway use hyphens.
$vars['template_files'] = array();
$vars['template_files'][] = 'page-durban';

}

if (isset($vars['node']) && $vars['node']->type=="alumni") {
// Add template naming suggestion. It should alway use hyphens.
$vars['template_files'] = array();
$vars['template_files'][] = 'page-alumni';

}

if(substr(arg(0),0,6)=="alumni")
{
$vars['template_files'] = array();
$vars['template_files'][] = 'page-alumni';
}

if (isset($vars['node']) && $vars['node']->type=="webform") {

// Add template naming suggestion. It should alway use hyphens.
$vars['template_files'] = array();
$vars['template_files'][] = 'page-webforms';

}

if (isset($vars['node']) && $vars['node']->type=="blog") {

// Add template naming suggestion. It should alway use hyphens.
$vars['template_files'] = array();
$vars['template_files'][] = 'page-blog';

}

if (isset($vars['node']) && $vars['node']->type=="forum") {

// Add template naming suggestion. It should alway use hyphens.
$vars['template_files'] = array();
$vars['template_files'][] = 'page-forum';

}

if (arg(1)=="durban") {

// Add template naming suggestion. It should alway use hyphens.
$vars['template_files'] = array();
$vars['template_files'][] = 'page-durban';

}

}

function CSE_links($links, $attributes = array('class' => 'links')) {
global $language;
$output = '';
if (count($links) > 0) {
$output = '
';

$num_links = count($links);
$i = 1;

foreach ($links as $key => $link) {
$class = $key;

// Add first, last and active classes to the list of links to help out themers.
if ($i == 1) {
$class .= ' first';
}
if ($i == $num_links) {
$class .= ' last';
}
if (isset($link['href']) && ($link['href'] == $_GET['q'] || ($link['href'] == '' && drupal_is_front_page()))
&& (empty($link['language']) || $link['language']->language == $language->language)) {
$class .= ' active';
}
$output .= '
$class)) .'>';

if (isset($link['href'])) {
// Pass in $link as $options, they share the same keys.
$output .= l($link['title'], $link['href'], $link);
}
else if (!empty($link['title'])) {
// Some links are actually not links, but we wrap these in for adding title and class attributes
if (empty($link['html'])) {
$link['title'] = check_plain($link['title']);
}
$span_attributes = '';
if (isset($link['attributes'])) {
$span_attributes = drupal_attributes($link['attributes']);
}
$output .= ''. $link['title'] .'
';
}
if($attributes["class"]=="primaryLinks")
$output .= '

'.$link['attributes']['title'];
$i++;
$output .= "

\n";
}

$output .= '

';
}

return $output;
}

function CSE_child_terms($vid = 1) {

$term=0;
if(arg(0) == 'node')
{
$node = node_load(arg(1));
$term = $node->taxonomy->tid;
$t = taxonomy_node_get_terms_by_vocabulary($node,1);
foreach($t as $value)
{
$term = $value->tid;
$obj = taxonomy_get_term($term);
if(!$obj && $obj->vid!="1" && $obj->vid!=32)
return;
break;
}
$vid=32;
}

elseif(arg(0) == 'taxonomy' && arg(1) == 'term')
{
$term=arg(2);
$obj = taxonomy_get_term($term);
if(!$obj || ($obj->vid!="1" && $obj->vid!="32"))
return;
$vid=$obj->vid;
}
else
return;
if($term==0) return;
$children = taxonomy_get_children($term, $vid);
if(!$children) {
$custom_parent = taxonomy_get_parents($term);
$parent_tree = array();
foreach ($custom_parent as $custom_child => $key) {
$parent_tree = taxonomy_get_tree($vid, $key->tid);
}
$children = $parent_tree;
}

if($vid==32)
{
$children = taxonomy_get_tree($vid,0);
}

$output = '

    ';
    $output .= '
  • ';
    if(!$custom_parent)
    // for climate change Durban event
    if(taxonomy_get_term($term)->name=="Climate Change" && $vid==32)
    $output .= l(taxonomy_get_term($term)->name." Home", 'content/climatechange');
    elseif(taxonomy_get_term($term)->name=="Climate Change")
    $output .= l(taxonomy_get_term($term)->name." Home", 'taxonomy/term/27/menu/');
    else
    $output .= l(taxonomy_get_term($term)->name." Home", 'taxonomy/term/' . trim($term)."/menu");
    else
    {

foreach ($custom_parent as $parent)
$output .= l($parent->name." Home", 'taxonomy/term/' . $parent->tid."/menu");
}
$output .= '

';

foreach ($children as $term) {
$output .= '

  • ';
    /*Shekhar: hard coded URL for some texonomy terms :-( :-( */
    switch($term->tid)
    {
    case "20073": $output .= l($term->name,"node/322"); break;
    case "20072": $output .= l($term->name,"http://www.gobartimes.org",array('attributes'=> array('target'=>'_blank')) ); break;
    case "20096": $output .= l($term->name,"subsection/featureservice/20079"); break;
    case "20097": $output .= l($term->name,"subsection/askus/20079"); break;
    case "20256": $output .= l($term->name,"node/982"); break;
    /*FOOD SAFETY AND TOXINS SUB-SECTIONS-NODES-OVERWRITTEN*/
    case "20289": $output .= l($term->name,"node/1029"); break;
    case "20288": $output .= l($term->name,"node/938"); break;
    case "20290": $output .= l($term->name,"node/527"); break;
    case "20291": $output .= l($term->name,"node/532"); break;
    case "20292": $output .= l($term->name,"node/2179"); break;
    case "20293": $output .= l($term->name,"node/521"); break;
    case "20294": $output .= l($term->name,"node/524"); break;
    case "20295": $output .= l($term->name,"node/1031"); break;
    case "20296": $output .= l($term->name,"node/1040"); break;
    case "20297": $output .= l($term->name,"node/1030"); break;
    case "20202": $output .= l($term->name,"node/1394"); break;
    case "20370": $output .= l($term->name,"node/1727"); break;
    case "20477": $output .= l($term->name,"node/2011"); break;
    case "20480": $output .= l($term->name,"node/2188"); break;
    case "20481": $output .= l($term->name,"node/2012"); break;
    case "20483": $output .= l($term->name,"node/1740"); break;
    case "20493": $output .= l($term->name,"node/2896"); break;
    case "20622": $output .= l($term->name,"node/3800"); break;
    case "20544": $output .= l($term->name,"taxonomy/term/20362/menu"); break;
    case "20611": $output .= l($term->name,"node/2206"); break;
    case "20639": $output .= l($term->name,"node/2752"); break;
    case "20653": $output .= l($term->name,"node/3691"); break;
    case "20691": $output .= l($term->name,"node/2854"); break;
    case "20714": $output .= l($term->name,"node/3348"); break;
    case "20715": $output .= l($term->name,"node/3372"); break;
    case "20347": $output .= l($term->name,"node/1536"); break;
    case "20611": $output .= l($term->name,"node/2206"); break;
    case "20848": $output .= l($term->name,"node/2830"); break;
    case "20722": $output .= l($term->name,"http://cseindia.org/content/durban"); break;
    case "20331": $output .= l($term->name,"http://www.cseindia.org/bloggers"); break;
    case "20356": $output .= l($term->name,"http://cseindia.org/content/discuss-media-fellowships-cse"); break;
    default: $output .= l($term->name, 'taxonomy/term/' . $term->tid."/menu");
  • }
    $output .= '

    ';
    }
    $output .= '

    ';
    return $output;

    }

    function CSE_About_Us_Menu() {

    $aboutUsMenu = array();

    $aboutUsMenu["Overview"]=214;
    $aboutUsMenu["Anil Agarwal"]=216;
    $aboutUsMenu["Timeline"]=218;
    $aboutUsMenu["Executive Board"]=219;
    $aboutUsMenu["Programme Directors"]=220;
    $aboutUsMenu["Sunita Narain"]=221;
    $aboutUsMenu["Annual Reports"]=222;
    $aboutUsMenu["Financial Reports"]=223;
    $aboutUsMenu["Awards"]=1174;
    $aboutUsMenu["Green CSE"]=1169;

    $output = '

      ';

    foreach ($aboutUsMenu as $menuName=>$menuLink) {
    $output .= '

  • ';
    $output .= l($menuName, 'node/' . $menuLink);
    $output .= '
  • ';
    }
    $output .= '

    ';
    return $output;

    }

    function CSE_username($object) {

    if ($object->uid && $object->name) {
    // Shorten the name when it is too long or it will break many tables.
    if (drupal_strlen($object->name) > 20) {
    $name = drupal_substr($object->name, 0, 15) .'...';
    }
    else {
    $name = $object->name;
    }

    if (user_access('access user profiles')) {
    $output = l($name, 'user/'. $object->uid, array('attributes' => array('title' => t('View user profile.'))));
    }
    else {
    $output = check_plain($name);
    }
    }
    else if ($object->name) {
    // Sometimes modules display content composed by people who are
    // not registered members of the site (e.g. mailing list or news
    // aggregator modules). This clause enables modules to display
    // the true author of the content.
    if (!empty($object->homepage)) {
    $output = l($object->name, $object->homepage, array('attributes' => array('rel' => 'nofollow')));
    }
    else {
    $output = check_plain($object->name);
    }

    //$output .= ' ('. t('not verified') .')';
    }
    else {
    $output = variable_get('anonymous', t('Anonymous'));
    }

    return $output;
    }

    ?>

    Announcements

    • Currently, India is far off-track in achieving its sanitation targets. Apart from open defecation and lack of sanitation facilities in urban and rural areas; the management of septage has been largely neglected and is not a priority due to the lack of awareness of its heavy contribution to environmental degradation, poor sanitation and ill-effects to health. “Septage” is the waste that accumulates in onsite sanitation systems (OSS e.g.

    Follow us on 
     
     
     
     
     
     
     
     
     
     

     
     
     
     
     
     
    gobar times