Example #1
0
function wistar_preprocess_page(&$vars) {
	jquery_ui_add(array('effects.slide'));

	if( $vars['is_front'] ) {
		$vars['homepage'] = wistar_theme_get_active('homepage');
		$vars['head_title'] = $vars['homepage']->title;

		// load up the quicktabs
		$quicktabs = quicktabs_load(1);
		$vars['quicktabs'] = theme('quicktabs', $quicktabs);

		// load the alert
		$vars['alert'] = wistar_theme_get_alert();

		// we need to re-render the js, since qt relies on it's own
		$vars['css'] = drupal_add_css();
		$vars['styles'] = drupal_get_css();
		$vars['scripts'] = drupal_get_js();

		// rebuild the less files - this sucks, but is needed beacuse of how
		// quicktabs adds the required files in a theme function
		// this shouldn't be a problem in production, since this function only builds
		// the less files if they aren't built already. Otherwise, it just modifies the
		// css array to include the built files.
		_less_build($vars, 'page');
	}

	if( isset($vars['title']) && $vars['title'] ) {
		$vars['body_classes'] .= ' ' . wistar_str2class($vars['title']);
	}
	if(isset($_SESSION['donation_form'])&&arg(0)!='give'&&arg(1)!='confirmation'){
		unset($_SESSION['donation_form']);
	}

	$node = $vars['node'];
	if ($node->type=='microsite_subpage') {
		if ($node->field_template_type[0]['value'] == 1) {
			$vars['body_classes'] .= ' microsite-subpage-fullwidth';
		}
	}
}
			<div id="node-<?php print $node->nid;?>" class="node">
				<?php $is_first = true; ?>
				<?php if(isset($node->field_intro_text[0]['value']) && $node->field_intro_text[0]['value']): ?>
					<div class="section<?php if($is_first) { echo ' first'; $is_first = false;}?>">
						<?php print $node->field_intro_text[0]['value'] ?>
					</div>
				<?php endif;?>
				
				<?php print theme('wistar_content_callouts', $node); ?>					
				
				<div class="section">				
					<div id="wistar_wire_container">
						<div id="wistar_wire_elements">
							<div class="main_column" style="width: 522px;">
								<h3 class="with_borders with_plus">From the Wistar Wire</h3>
								<?php print views_embed_view('wistar_wire', 'block_1'); ?>
							</div>
							<div class="side_column" style="width: 229px;">
								<?php 
									$quicktabs = quicktabs_load(1);
									print theme('quicktabs', $quicktabs); 
								?>
							</div>
						</div>
					</div>
				</div>					
			</div>
		</div>
	</div>
</div>
Example #3
0
/**
 * Node preprocessing
 */
function arquideasprod_preprocess_node(&$vars)
{
    // Add node_right region content
    $vars['node_right'] = theme('blocks', 'node_right');
    //PREPROCESS CONTEST NODE
    if (isset($vars['type']) && $vars['type'] == 'contest') {
        $qt_name = 'quicktabs_contest_open';
        if (isset($vars['field_contest_state'])) {
            if (intval($vars['field_contest_state'][0]['value']) === ContestState::OPEN) {
                $vars['template_files'][] = 'node-contest-open';
            }
            if (intval($vars['field_contest_state'][0]['value']) >= ContestState::PRIZE) {
                $qt_name = 'quicktabs_contest_closed';
            }
        }
        $quicktabs = quicktabs_load($qt_name);
        $vars['contest_quicktab'] = theme('quicktabs', $quicktabs);
        if (isset($vars['links'])) {
            unset($vars['links']);
        }
    }
    $arr_types_og = og_get_types('group');
    if (isset($vars['node']) && in_array($vars['node']->type, $arr_types_og)) {
        if ($_GET['q'] == 'node/' . $vars['nid'] . '/edit') {
            $vars['is_edit'] = TRUE;
        } else {
            $vars['is_edit'] = FALSE;
        }
    }
    //PREPROCESS INSCRIPTION NODE
    if (isset($vars['node']) && $vars['node']->type == 'inscription') {
        $vars['picture'] = '';
        $cnid = $vars['node']->field_contest[0]['nid'];
        $cnode = node_load($cnid);
        $cnode_trans = NULL;
        if (!empty($cnode->tnid) && $cnode->tnid != 0) {
            $translations = translation_node_get_translations($cnode->tnid);
            if (!empty($translations[$user->language])) {
                $cnode_trans = node_load($translations[$user->language]->nid);
            }
        }
        if ($cnode) {
            $vars['contest'] = $cnode;
            if (!empty($cnode_trans)) {
                $vars['contest_translation'] = $cnode_trans;
                $vars['contest_title'] = $cnode_trans->title;
                $vars['field_contest_image'] = $cnode_trans->field_contest_image;
            } else {
                $vars['contest_title'] = $cnode->title;
                $vars['field_contest_image'] = $cnode->field_contest_image;
            }
            $vars['inscription_mission'] = $vars['node']->content['og_mission']['#value'];
        }
        $pattern = '/^inscription\\/\\d+$/';
        $match = preg_match($pattern, $_GET['q']);
        if ($match == 1) {
            $vars['template_files'][] = 'node-inscription-public';
        }
        $members = contest_notifications_get_group_members($vars['node']);
        $vars['num_members'] = count($members);
        if (count($members) > 1) {
            $vars['node_classes'] .= ' only-groups';
        }
    }
    //PREPROCESS WEBFORM NODE
    if (isset($vars['type']) && $vars['type'] == 'webform') {
        $vars['submitted'] = '';
        if (isset($vars['links'])) {
            unset($vars['links']);
        }
    }
    //PREPROCESS GROUP NODE (KM)
    if (isset($vars['type']) && $vars['type'] == 'group') {
        if (isset($vars['links'])) {
            unset($vars['links']);
        }
        $vars['group_attributes_rendered'] = '';
    }
    //PREPROCESS PROJECT NODE
    if (isset($vars['node']) && $vars['node']->type == 'project') {
        if ($_GET['q'] == 'node/' . $vars['nid'] . '/edit') {
            $vars['is_edit'] = TRUE;
        } else {
            $vars['is_edit'] = FALSE;
        }
    }
    //PREPROCESS NEWSLETTER ISSUE NODE
    if (isset($vars['node']) && $vars['node']->type == 'simplenews') {
        if ($_GET['q'] == 'node/' . $vars['nid'] . '/edit') {
            $vars['is_edit'] = TRUE;
        } else {
            $vars['is_edit'] = FALSE;
        }
        $generaltid = variable_get('nivaria_contests_base_newslettertid', 0);
        $node = $vars['node'];
        $vars['general_newsletter'] = FALSE;
        if (isset($node->taxonomy[$generaltid]) && $node->taxonomy[$generaltid]->tid == $generaltid) {
            $vars['general_newsletter'] = TRUE;
        }
    }
}