* @see template_preprocess() * @see template_preprocess_node() * @see template_process() */ ?> <?php $start = NULL; if (!empty($node->node_announce_start_date['und'][0]['value'])) { $start = new DateObject($node->node_announce_start_date['und'][0]['value'], new DateTimeZone($node->node_announce_start_date['und'][0]['timezone_db']), 'Y-m-d\\TH:i:s'); $start->setTimeZone(new DateTimeZone($node->node_announce_start_date['und'][0]['timezone'])); } $end = NULL; if (!empty($node->node_announce_end_date['und'][0]['value'])) { $end = new DateObject($node->node_announce_end_date['und'][0]['value'], new DateTimeZone($node->node_announce_end_date['und'][0]['timezone_db']), 'Y-m-d\\TH:i:s'); $end->setTimeZone(new DateTimeZone($node->node_announce_end_date['und'][0]['timezone'])); } ?> <tr> <td valign="top"> <table cellspacing="0" cellpadding="0" border="0" align="center" width="100%"> <tbody> <tr> <td height="49" width="100%" valign="middle" bgcolor="#c8cfd8" background="<?php global $base_url; echo $base_url . "/"; echo drupal_get_path('module', 'amivannounce'); ?> /images/article-title-bg.png" style="vertical-align:middle; border-left-width: 1px; border-left-color: #BAC2CC; border-left-style: solid; border-right-width: 1px; border-right-color: #BAC2CC; border-right-style: solid; border-bottom-width: 1px; border-bottom-color: #98a3b4; border-bottom-style: solid; border-top-width: 1px; border-top-color: #BAC2CC; border-top-style: solid;"> <h3 class="textshadow" style="margin:0; margin-left: 17px; padding:0; font-size: 18px; font-weight: normal; color:#324258;"> <?php
function unity_lab_it_preprocess_paragraphs_item_system_status_section(&$vars, $hook) { if (arg(0) == 'node' && is_numeric(arg(1))) { // creating the node variable $node = node_load(arg(1), NULL, TRUE); } $vars['content']['show_all_link'] = false; $vars['content']['show_archive_link'] = false; if ($node->nid == 19906) { $vars['content']['system_status_html'] = doit_system_status_front_view_unity3(); $vars['content']['show_all_link'] = true; } else { if ($node->nid == 20616) { $vars['content']['system_status_html'] = doit_system_status_all_view_unity3(); $vars['content']['show_archive_link'] = true; } } $query = new EntityFieldQuery(); $query->entityCondition('entity_type', 'node')->entityCondition('bundle', 'system_status')->propertyCondition('status', 1)->fieldCondition('field_status_start_date', 'value', date("Y-m-d g:i:s"), '>')->fieldOrderBy('field_status_start_date', 'value', 'ASC')->range(0, 6); $result = $query->execute(); if (isset($result['node'])) { $nids = array_keys($result['node']); $nodes = entity_load('node', $nids); } $nodeItems = array(); $items = array(); foreach ($nodes as $node) { $item['title'] = 'Scheduled Maintenance'; $item['url'] = url('node/' . $node->nid); $start = field_get_items('node', $node, 'field_status_start_date'); $start = empty($start[0]['value']) ? '' : $start[0]['value']; if ($start) { $start = new DateObject($start, 'UTC'); $start->setTimeZone(new DateTimeZone('America/New_York')); $item['start-date'] = $start->format('F jS, Y g:i a'); $item['start-date-only'] = $start->format('F jS, Y'); $item['start-time-only'] = $start->format('g:i a'); } $end = field_get_items('node', $node, 'field_status_end_date'); $end = empty($end[0]['value']) ? '' : $end[0]['value']; if ($end) { $end = new DateObject($end, 'UTC'); $end->setTimeZone(new DateTimeZone('America/New_York')); $item['end-date'] = $end->format('F jS, Y g:i a'); $item['end-date-only'] = $end->format('F jS, Y'); $item['end-time-only'] = $end->format('g:i a'); } $systems = field_get_items('node', $node, 'field_system'); $system = empty($systems[0]['target_id']) ? '' : $systems[0]['target_id']; if ($system) { $system = node_load($system); $item['title'] = $system->title; } if (count($systems) > 1) { $item['title'] .= ' and Additional Services'; } $vars['content']['items'][] = $item; } }