/** * Overrides the theme_field for field_fb_tags to make it clickable and link to the Event Space (this will change). */ function storyscopezen_field__field_fb_tags($variables) { if ($node = menu_get_object()) { // Get the nid $nid = $node->nid; } $output = ''; $show_all = ''; $path = drupal_lookup_path('alias', current_path()); if (!empty($variables['items'][0])) { $show_all = l('<li class="tags">' . t('Show All') . '</li>', $path, array('html' => 'true', 'attributes' => array('target' => '_self'), 'query' => array('story' => $nid))); $output .= $show_all; } foreach ($variables['items'] as $item) { $fcid = key($item['entity']['field_collection_item']); if (!empty($item['entity']['field_collection_item'][$fcid]['field_mid'][0]['#markup'])) { $mid = $item['entity']['field_collection_item'][$fcid]['field_mid'][0]['#markup']; } if (!empty($item['entity']['field_collection_item'][$fcid]['field_topic'][0]['#markup'])) { $topic = $item['entity']['field_collection_item'][$fcid]['field_topic'][0]['#markup']; } if (!empty($mid) && !empty($topic)) { $id = explode('/', $mid); $lenth = count($id) - 1; $relative_mid = $id[$lenth]; $tags_link = l('<li class="tags">' . $topic . '</li>', $path, array('html' => TRUE, 'attributes' => array('target' => '_self'), 'query' => array('tag' => '/m/' . $relative_mid))); $output .= $tags_link; } elseif (empty($mid) && !empty($topic)) { $output .= '<li class="tags freebase-link">' . $topic . '</li>'; } } // Render the top-level UL. $output = '<ul class="' . $variables['classes'] . '"' . $variables['attributes'] . '>' . $output . '</ul>'; return $output; }
function libya_cron_subscription_mail($data) { // subscription node $mail = $data[0]; $nids = $data[1]; // watchdog('actions', 'Cron subscription vars', func_get_args()); global $siteName, $isMail, $base_url; $isMail = TRUE; $body = '<h1 style="font-size:1.25em;">Your alert subscription results from ' . $siteName . '</h1> <p class="no-margin">The following results match your subscription alert.</p>'; foreach ($nids as $nid) { $N = node_load($nid); $content = strip_tags($N->body['und'][0]['value']); if (strlen($content) > 200) { $content = substr($content, 0, 200); } $CL = strrpos($content, ' '); $content = substr($content, 0, $CL) . '...'; $body .= '<h2 style="font-size:1.25em;">' . l($N->title, 'node/' . $N->nid, array('attributes' => array('style' => array('text-decoration' => 'none')))) . '</h2><p>' . $content . '</p> <p>' . t('read more: ') . l($base_url . '/' . drupal_lookup_path('alias', 'node/' . $N->nid), 'node/' . $N->nid, array('absolute' => TRUE)) . '</p> <hr/>'; } $data['message'] = 'Mail sent'; $to = $mail['mail']; $from = variable_get('site_mail', '*****@*****.**'); $params = array('body' => $body, 'rand' => $mail['rand'], 'to' => $to); $sent = drupal_mail('libya', 'subscription_alert_mail', $to, language_default(), $params, $from, TRUE); }
/** * Implements hook_menu_breadcrumb_alter(). */ function unl_fourone_og_menu_breadcrumb_alter(&$active_trail, $item) { $group = unl_fourone_og_get_current_group(); if ($group) { $front_nid = unl_fourone_og_get_front_group_id(); // Only splice in the current group if the current group is not the main/front group. if ($group->nid !== $front_nid) { $group_breadcrumb = array('title' => $group->title, 'href' => 'node/' . $group->nid, 'link_path' => '', 'localized_options' => array(), 'type' => 0); } } else { // No group was found, use the default breadcrumbs. $base_path = theme_get_setting('unl_fourone_og_base_path', 'unl_fourone_og'); $title = ''; // Get the title and path to use. if (empty($base_path)) { $title = variable_get('site_name', 'Unknown Site name'); } else { $path = drupal_lookup_path("source", $base_path); $node = menu_get_object("node", 1, $path); $title = $node->title; } $group_breadcrumb = array('title' => $title, 'href' => $base_path, 'link_path' => '', 'localized_options' => array(), 'type' => 0); } if (isset($group_breadcrumb)) { array_splice($active_trail, 1, 0, array($group_breadcrumb)); } }
function moretour_corolla_preprocess(&$variables, $hook) { if ($hook != 'page' && $hook != 'html') { return; } if ($variables['is_front']) { $path = variable_get('site_frontpage'); $path_alias = drupal_lookup_path('alias', $path); if ($path_alias) { $path = $path_alias; } } else { $path = request_path(); } if (preg_match('#^(\\d{4})(/.*)?#', $path, $matches)) { $year = $matches[1]; // Append year to the site name/title. if ($hook == 'page') { $variables['site_name'] .= " {$year}"; } else { $variables['head_title'] .= " {$year}"; } // Use 2013 specific logo if (!empty($variables['site_logo'])) { $variables['site_logo'] = str_replace('NOYEAR', $year, $variables['site_logo']); } } }
function famelab_menu_item($link, $has_children, $menu = '', $in_active_trail = FALSE, $extra_class = NULL) { $class = $menu ? 'expanded' : ($has_children ? 'collapsed' : 'leaf'); if (!empty($extra_class)) { $class .= ' ' . $extra_class; } if ($in_active_trail) { $class .= ' active-trail'; } else { // Get the link's URL (sadly, this function doesn't include the link object) $url_pattern = '/<a\\s[^>]*href=\\"([^\\"]*)\\"[^>]*>.*<\\/a>/siU'; preg_match($url_pattern, $link, $matches); $link_path = substr_replace($matches[1], '', 0, 1); // remove first slash $contexts = context_get(); if (!empty($contexts)) { $active_paths = array(); foreach ($contexts['context'] as $context) { if (array_key_exists('menu', $context->reactions)) { $active_paths[$context->reactions['menu']] = $context->reactions['menu']; } } if (in_array(drupal_lookup_path('source', $link_path), $active_paths)) { $class .= ' active-trail'; } } } return '<li class="' . $class . '">' . $link . $menu . "</li>\n"; }
/** * */ function getPathAlias($nid) { $alias = $nid; // Check for an alias using drupal_lookup_path() if (drupal_lookup_path('alias', 'node/' . $nid) !== false) { $alias = drupal_lookup_path('alias', 'node/' . $nid); } return $alias; }
function mybasictheme_preprocess_node(&$variables) { // Check whether we have some comments present if (isset($variables['comment_count'])) { if ($variables['comment_count'] > 0) { // Add a new custom $commentlink variable $variables['commentlink'] = l(format_plural($variables['comment_count'], '1 comment', '@count comments'), drupal_lookup_path('alias', 'node/' . $variables['nid']), array('fragment' => 'comments')); } } // Re-write the $submitted variable the way we want it $variables['submitted'] = t('@datetime | by !username', array('!username' => $variables['name'], '@datetime' => date("j F Y", $variables['created']))); }
function hotel_preprocess_html(&$vars) { $node_id = drupal_lookup_path('source', 'page-404'); if (!empty($node_id)) { $parts = explode("/", $node_id); $n_id = false; if (count($parts) > 1) { $n_id = $parts[1]; } if (in_array("html__node__{$n_id}", $vars['theme_hook_suggestions'])) { $vars['classes_array'][] = 'page-404-body'; } } }
/** * Returns node currently being viewed. Assumes /node/[nid] URL. * * Using path-based loaders, like menu_load_object(), will not work. * * @return object * The currently viewed node. * * @throws Exceptionq */ public function getNodeFromUrl() { $path = $this->getCurrentPath(); $system_path = drupal_lookup_path('source', $path); if (!$system_path) { $system_path = $path; } $menu_item = menu_get_item($system_path); if ($menu_item['path'] == 'node/%') { $node = node_load($menu_item['original_map'][1]); } else { throw \Exception(sprintf("Node could not be loaded from URL '%s'", $path)); } return $node; }
/** * Preprocess variables for page.tpl.php * * @see page.tpl.php */ function klipfolio_theme_preprocess_page(&$vars) { $node = ""; if (isset($vars['node'])) { $node = $vars['node']; } elseif (arg(0) == 'node' && is_numeric(arg(1)) && arg(2) !== 'edit') { $node = node_load(arg(1)); } $type = ""; if ($node && isset($node->type)) { $type = $node->type; } $vars['node_type'] = $type; $vars['current_page'] = drupal_lookup_path("alias", current_path()); }
function hotel_preprocess_html(&$vars) { $node_id = drupal_lookup_path('source', 'page-404'); if (!empty($node_id)) { $parts = explode("/", $node_id); $n_id = false; if (count($parts) > 1) { $n_id = $parts[1]; } if (in_array("html__node__{$n_id}", $vars['theme_hook_suggestions'])) { $vars['classes_array'][] = 'page-404-body'; } } /* Add custom fonts */ drupal_add_css('http://fonts.googleapis.com/css?family=Oswald:400,300', array('type' => 'external')); }
function forum_plus_preprocess_html(&$vars) { $node_id = drupal_lookup_path('source', '404-page'); if (!empty($node_id)) { $parts = explode("/", $node_id); $n_id = false; if (count($parts) > 1) { $n_id = $parts[1]; } if (in_array("html__node__{$n_id}", $vars['theme_hook_suggestions'])) { $vars['theme_hook_suggestions'][] = 'html__404'; } } if (count($vars['theme_hook_suggestions']) == 1) { if (isset($vars['page']['content']['system_main']['main']['#markup']) && trim($vars['page']['content']['system_main']['main']['#markup']) == t('The requested page "@path" could not be found.', array('@path' => request_uri()))) { $vars['theme_hook_suggestions'][] = 'html__404'; } } }
protected function parseTags(array $tags, $attribute_name) { $result = array(); foreach ($tags as $tag) { if (isset($tag[$attribute_name])) { $original = (string) $tag[$attribute_name]; // Lookup the system path if we're dealing with an alias. $source_path = drupal_lookup_path('source', $original); $alias = false; if ($source_path) { $original = $source_path; $alias = true; } $entities = $this->entitiesFromUrl($original, $alias); $result[(string) $tag[$attribute_name]] = $entities; } } return $result; }
function main_preprocess_entity(&$variables) { if ($variables['elements']['#bundle'] == "project_image") { $current_path = substr($_SERVER['REQUEST_URI'], 1); $entity_id = $variables['elements']['#entity']->id; $current_delta = 0; $next_delta = 0; $path_arguments = explode('/', $current_path); // Check if 3 arguments are there if (count($path_arguments) == 3) { $node_alias = $path_arguments[0] . "/" . $path_arguments[1]; // Create node path out of the first two arguments to see if it's a node if ($node_path = drupal_lookup_path('source', $node_alias)) { $node = menu_get_object("node", 1, $node_path); // Check if node is of the right type if ($node->type == "project") { // Check if third argument is a number if (is_numeric($path_arguments[2])) { // Load images field $images = field_get_items('node', $node, 'field_project_images'); foreach ($images as $delta => $image) { if ($image['target_id'] == $entity_id) { $current_delta = $delta; break; } } // Check if the next delta is valid // if not, redirect to 1 if (array_key_exists($current_delta + 1, $images)) { $next_delta = $current_delta + 1; } else { $next_delta = 0; } $variables['next_link'] = '/' . $node_alias . '/' . ($next_delta + 1); } } } } } }
/** * Entities from Path * * Given a system path with entity references (node IDs, etc), returns the router url * and an array of entities represented in that path. * * @param string $path The path to break apart. * * @return array The router_url and an array of entities represented in the path. */ public static function entitiesFromPath($path) { if ($source = drupal_lookup_path('source', $path)) { $path = $source; } $entities = array('router_url' => '', 'entities' => array()); if ($router_item = self::getRouterItem($path)) { if (is_array($router_item) && array_key_exists('page_arguments', $router_item) && is_array($router_item['page_arguments'])) { $entities['router_url'] = $router_item['path']; foreach ($router_item['page_arguments'] as $drupal_entity) { $entity = Entity::convert($drupal_entity); if ($entity) { $entities['entities'][] = $entity; } } } } // If nothing came of that, we'll leave the URL be. if (!$entities['router_url']) { $entities['router_url'] = $path; } return $entities; }
?> <?php print $content_top; ?> </div><!-- /content-top-inner --> </div><!-- /content-top --> <?php } ?> <div id="content-region" class="content-region row nested"> <div id="content-region-inner" class="content-region-inner inner"> <a name="main-content-area" id="main-content-area"></a> <?php if (trim($tabs) and !in_array(drupal_lookup_path('alias', $_GET['q']), array("home", "user-management", "content/add-user", "add-user"))) { print theme('grid_block', $tabs, 'content-tabs'); } ?> <div id="content-inner" class="content-inner block"> <div id="content-inner-inner" class="content-inner-inner inner"> <?php if ($title) { ?> <h1 class="title"><?php print $title; ?> </h1> <?php }
function recent_users() { global $user; // Check to see if $user has the administrator role. if (!in_array('administrator', array_values($user->roles))) { if ($user->uid) { echo "You need to be an Administrator to see this page."; } exit; } //Counting Views $path = $_GET['q']; $differential = $_GET['uid']; $path_alias = drupal_get_path_alias($_GET["q"]); /* Pie Graph JS */ echo "<script type='text/javascript' src='https://www.google.com/jsapi'></script>"; echo "<script type='text/javascript'>"; echo " google.load('visualization', '1', {packages: ['corechart']});"; echo "</script>"; if ($differential) { $counter = 0; $total_downloads = 0; //Main Title and miscellaneous Information $result_user = db_query("\n\t\t \tSELECT\n\t\t\t f.field_full_n_value AS fullname, \n\t\t\t u.name AS username,\n\t\t\t u.mail AS email, \n\t\t\t u.created AS joindate,\n\t\t\t u.login AS lastlogin\n\t\t\tFROM\n\t\t\t {field_data_field_full_n} f, {users} u where f.entity_id = u.uid AND u.uid = :uid\n\t\t\t", array(':uid' => $_GET['uid']))->fetchAll(); // Finding all the Browsers Used $query_all_browsers = db_select('login_activity', 'a')->condition('a.uid', $_GET['uid'], '=')->distinct()->fields('a', array('host_user_agent')); $result_b = $query_all_browsers->execute(); /* $result = db_query(" SELECT a.url, a.title, a.uid, COUNT(*) AS times FROM {accesslog} a where a.uid = :uid GROUP BY a.url", array(':uid'=>$_GET['uid'])) -> fetchAll(); */ $result = db_query("\n\t\t \tSELECT\n\t\t\t n.title, n.nid,\n\t\t\t COUNT(*) AS times\n\t\t\tFROM\n\t\t\t {node_view_count} a, {node} n where a.nid = n.nid AND a.uid = :uid\n\t\t\tGROUP BY\n\t\t\t n.title\n\t\t\tORDER BY\n\t\t\t times desc", array(':uid' => $_GET['uid']))->fetchAll(); echo "<div class='data-container' id='profile-info'>"; echo "<span><a href=" . $GLOBALS['base_url'] . "/" . "user-statistics>← Back to Main Analytics Page</a></span>"; echo "</div>"; echo "<div class='data-container'>"; echo "<div class='left' style='width: 40%';>"; foreach ($result_user as $r) { $date = date('Y-m-d H:i:s', $r->joindate); $dtz = 'America/New_York'; $joinTimestamp = getNoteDateTimeZone($date, 'US/Central', $dtz); $ldate = date('Y-m-d H:i:s', $r->lastlogin); $loginTimestamp = getNoteDateTimeZone($ldate, 'US/Central', $dtz); echo "<h1>" . $r->fullname . "</h1>"; echo "<span> Username: </span><span class='content-span'>" . $r->username . "</span><br />"; echo "<span> Joining Date: </span><span class='content-span'>" . date("F jS, Y \\( h:i a \\)", strtotime($joinTimestamp)) . "</span><br />"; echo "<span> Last Login: </span><span class='content-span'>" . date("F jS, Y \\( h:i a \\)", strtotime($loginTimestamp)) . "</span><br /><br />"; echo "<span style='border-bottom: 1px solid #adadad; padding-bottom:5px; margin-bottom: 8px;'> Browsing History: </span><span class='content-span'><br />"; echo "<table id='ver-minimalist' summary='Browsing History'>"; echo "<tbody>"; while ($record_all_browsers = $result_b->fetchAssoc()) { $detail_arr = getBrowser($record_all_browsers['host_user_agent']); echo "<tr>"; echo "<td><img src ='" . $detail_arr['icon'] . "' width='20' height='20' />" . " | " . "<img src ='" . $detail_arr['os_icons'] . "' width='24' height='24' /> (" . $detail_arr['name'] . ", Version " . $detail_arr['version'] . " on " . $detail_arr['os'] . ") </td>"; echo "</tr>"; } echo "</tbody>"; echo "</table>"; echo "</span>"; } echo "</div>"; /* <Pie Graph JS */ echo "<script type='text/javascript'>"; echo "function drawVisualization_pages_visited() {"; echo "var options = { "; echo "\t width: 550,"; echo " height: 550,"; echo " chartArea:{left:7,top:5, width:'100%'},"; echo " fontName: 'Open Sans',"; echo " tooltip: { textStyle: { fontName: 'Tahoma', fontSize: 11 } },"; echo " colors: [ '#d8b71a', '#193153', '#9c2b11', '#e5760a', '#1d83ae', '#919b02', '#097092', '#ddb928', '#890c0c', '#5c6677', '#0fa7ad', '#ad560f', '#d41473' ]"; echo "};"; //echo "var options = {'title':'asdasdasd asd asd ','width':500,'height':450,'chartArea':{left:0,top:10,width:'100%'}}"; echo "var data = google.visualization.arrayToDataTable(["; echo "['Pages Visited', 'No. of Visits'],"; foreach ($result as $r) { //echo "['".$r->title."', ".$r->times."],"; $resultstr_pages_visited[] = "['" . $r->title . "', " . $r->times . "]"; } echo implode(",", $resultstr_pages_visited); echo "]);"; echo "new google.visualization.PieChart(document.getElementById('visualization_visit_graph'))."; echo "draw(data, options); "; echo " }"; echo "google.setOnLoadCallback(drawVisualization_pages_visited);"; echo "</script>"; /* </Pie Graph JS */ echo "<div class='right' style='width: 50%';>"; echo "<div id='holder'>"; /* Pie Graph Code */ echo "<div id='visualization_visit_graph'></div>"; echo "</div>"; echo "</div>"; echo "<div class='clear'></div>"; echo "</div>"; // Count the number of times the current logged in user has // visited the current page $query_count_visits = db_select('accesslog', 'a')->condition('a.uid', $_GET['uid'], '=')->condition('a.path', $path, '=')->fields('a', array('uid', 'title'))->execute()->rowCount(); // Finding all the Pages visited by the logged in User. // Also Count the number of times each Unique page is visited. echo "<div id='page-wrap' class='content_scroll'>"; echo "\n<table id='hor-minimalist-b'>"; echo "\n\n<thead>"; echo "\n\n\n<tr>"; echo "\n\n\n\n<th>Pages Visited</th>"; echo "\n\n\n\n<th>Visits</th>"; echo "\n\n\n</tr>"; echo "\n\n</thead>"; echo "\n\n<tbody>"; foreach ($result as $r) { //$string = (strlen($r->url) > 110) ? substr($r->url,0,107).'...' : $r->url; echo "<tr>" . "<td><a href=./" . drupal_lookup_path('alias', "node/" . $r->nid) . ">" . $r->title . "</a></td>" . "<td>" . $r->times . " times" . "</td>" . "</tr>"; } echo "\n\n</tbody>"; echo "\n</table>"; echo "</div>"; // Documents Downloaded $result_dl = db_query("\n\t\t \tSELECT\n\t\t\t d.name, d.url, n.title, d.count\n\t\t\tFROM\n\t\t\t {pubdlcnt} d, {node} n where n.nid = d.nid AND d.uid = :uid\n\t\t\tORDER BY\n\t\t\t d.count desc\n\t\t\t", array(':uid' => $_GET['uid']))->fetchAll(); foreach ($result_dl as $r) { $counter++; $total_downloads += $r->count; } /* Download Numbers PIE Graph */ echo "<div class='data-container'>"; echo "<div class='left sharewidth'>"; echo "<h2>Documents Downloaded</h2>"; echo "<span> Total Documents downloaded: </span><span class='content-span'>" . $counter . "</span><br />"; echo "<span> Total Downloaded Count: </span><span class='content-span'>" . $total_downloads . "</span><br />"; echo "<br />"; echo "<div id='page-wrap' class='document_scroll'>"; echo "\n<table id='hor-minimalist-c'>"; echo "\n\n<thead>"; echo "\n\n\n<tr>"; echo "\n\n\n\n<th>Document Name</th>"; echo "\n\n\n\n<th>Page</th>"; echo "\n\n\n\n<th>Type</th>"; echo "\n\n\n\n<th>Count</th>"; echo "\n\n\n</tr>"; echo "\n\n</thead>"; echo "\n\n<tbody>"; foreach ($result_dl as $r) { echo "<tr>" . "<td>" . cut_me_Short(preg_replace("/\\.[^.\\s]{3,4}\$/", "", str_replace("_", " ", $r->name)), 45, true) . "</td>" . "<td>" . $r->title . "</td>" . "<td>" . pathinfo($r->name, PATHINFO_EXTENSION) . "</td>" . "<td>" . $r->count . "</td>" . "</tr>"; } echo "\n\n</tbody>"; echo "\n</table>"; echo "</div>"; echo "</div>"; /* <Pie Graph JS */ echo "<script type='text/javascript'>"; echo "function drawVisualization() {"; echo "var options = { "; echo "\t width: 450,"; echo " height: 450,"; echo " fontName: 'Open Sans',"; echo " tooltip: { textStyle: { fontName: 'Tahoma', fontSize: 11 } },"; echo " chartArea:{left:10,top:10,width:'100%'},"; echo " colors: [ '#e5760a', '#d8b71a', '#ad560f', '#1ad8d1', '#193153', '#1d83ae', '#919b02', '#9c2b11', '#5c6677', '#0fa7ad', '#ad560f', '#d41473' ]"; echo "};"; //echo "var options = {'title':'asdasdasd asd asd ','width':500,'height':450,'chartArea':{left:0,top:10,width:'100%'}}"; echo "var data = google.visualization.arrayToDataTable(["; echo "['Document', 'No. of Downloads'],"; foreach ($result_dl as $r) { $string = strlen($r->name) > 55 ? substr($r->name, 0, 52) . '...' : $r->name; $resultstr_documents_downloaded[] = "['" . preg_replace("/\\.[^.\\s]{3,4}\$/", "", str_replace("_", " ", $string)) . "', " . $r->count . "]"; } echo implode(",", $resultstr_documents_downloaded); echo "]);"; echo "new google.visualization.PieChart(document.getElementById('visualization'))."; echo "draw(data, options); "; echo " }"; echo "google.setOnLoadCallback(drawVisualization);"; echo "</script>"; /* </Pie Graph JS */ echo "<div class='right'>"; echo "<div id='holder'>"; /* Pie Graph Code */ echo "<div id='visualization'></div>"; echo "</div>"; echo "</div>"; echo "<div class='clear'></div>"; echo "</div>"; // Documents Emailed $result_em = db_query("\n\t\t \tSELECT\n\t\t\t d.name, d.url, n.title, d.count\n\t\t\tFROM\n\t\t\t {pubdlcnt} d, {node} n where n.nid = d.nid AND d.uid = :uid\n\t\t\t", array(':uid' => $_GET['uid']))->fetchAll(); foreach ($result_em as $r) { $counter++; $total_downloads += $r->count; } /* Emailed Numbers PIE Graph */ echo "<div class='data-container' id='profile-info'>"; echo "<div class='left sharewidth'>"; echo "<h2>Documents Emailed (Disabled)</h2>"; echo "<span> Total Documents Emailed: </span><span class='content-span'>N/A</span><br />"; echo "<span> Total Emails Sent: </span><span class='content-span'>N/A</span><br />"; echo "<br />"; echo "<div id='page-wrap' class='document_scroll'>"; echo "\n<table id='hor-minimalist-c'>"; echo "\n\n<thead>"; echo "\n\n\n<tr>"; echo "\n\n\n\n<th>Document Name</th>"; echo "\n\n\n\n<th>Page</th>"; echo "\n\n\n\n<th>Count</th>"; echo "\n\n\n</tr>"; echo "\n\n</thead>"; echo "\n\n<tbody>"; foreach ($result_em as $r) { echo "<tr>" . "<td>" . cut_me_Short(preg_replace("/\\.[^.\\s]{3,4}\$/", "", str_replace("_", " ", $r->name)), 48, true) . "</td>" . "<td>" . $r->title . "</td>" . "<td>" . $r->count . "</td>" . "</tr>"; } echo "\n\n</tbody>"; echo "\n</table>"; echo "</div>"; echo "</div>"; /* <Pie Graph JS for Email */ echo "<script type='text/javascript'>"; echo "function drawVisualization_for_email() {"; echo "var options = { "; echo "\t width: 450,"; echo " height: 450,"; echo " fontName: 'Open Sans',"; echo " tooltip: { textStyle: { fontName: 'Tahoma', fontSize: 11 } },"; echo " chartArea:{left:10,top:10,width:'100%'},"; //echo " title: 'Toppings I Like On My Pizza',"; //echo " colors: ['#9c2b11', '#e5760a', '#1d83ae', '#193153', '#919b02' ]"; echo " colors: ['#dddddd' ]"; echo "};"; //echo "var options = {'title':'asdasdasd asd asd ','width':500,'height':450,'chartArea':{left:0,top:10,width:'100%'}}"; echo "var data = google.visualization.arrayToDataTable(["; echo "['Document', 'No. of Emails'],"; foreach ($result_em as $r) { $string = strlen($r->name) > 55 ? substr($r->name, 0, 52) . '...' : $r->name; $resultstr_documents_emailed[] = "['" . preg_replace("/\\.[^.\\s]{3,4}\$/", "", str_replace("_", " ", $string)) . "', " . $r->count . "]"; } echo implode(",", $resultstr_documents_emailed); echo "]);"; echo "new google.visualization.PieChart(document.getElementById('visualization_email'))."; echo "draw(data, options); "; echo " }"; echo "google.setOnLoadCallback(drawVisualization_for_email);"; echo "</script>"; /* </Pie Graph JS */ echo "<div class='right'>"; echo "<div id='holder'>"; /* Pie Graph Code */ echo "<div id='visualization_email'></div>"; echo "</div>"; echo "</div>"; echo "<div class='clear'></div>"; echo "<hr />"; echo "<span><a href=" . $GLOBALS['base_url'] . "/" . "user-statistics>← Back to Main Analytics Page</a></span>"; echo "</div>"; //echo "<br />"."Total number of Visits on all Pages: " . "1234" . "<br />"; } else { $result_at_glance = db_query("\n\t\t \tSELECT\n\t\t\t DISTINCT(n.title), n.nid, a.totalcount, a.daycount\n\t\t\t \n\t\t\tFROM\n\t\t\t {node_counter} a, {node_view_count} b, {node} n where a.nid = n.nid AND n.nid <> 83\n\t\t\tLIMIT 15\n\t\t\t")->fetchAll(); // 83 is the analytics page. $result_top_pages = db_query("\n\t\t \tSELECT\n\t\t\t n.title, n.nid,\n\t\t\t COUNT(*) AS times\n\t\t\tFROM\n\t\t\t {node_view_count} a, {node} n where a.nid = n.nid AND n.nid <> 83 \n\t\t\tGROUP BY\n\t\t\t n.title\n\t\t\tORDER BY\n\t\t\t times desc\n\t\t\tLIMIT 10\n\t\t\t ")->fetchAll(); $result_top_visitors = db_query("\n\t\t \tSELECT\n\t\t\t f.field_full_n_value, u.name, n.nid,\n\t\t\t COUNT(*) AS times\n\t\t\tFROM\n\t\t\t {node_view_count} a, {node} n, {users} u, {field_data_field_full_n} f where a.nid = n.nid AND u.uid = a.uid AND f.entity_id = u.uid and u.uid NOT IN (1,2,3,6,7,9,17,35,75,1133)\n\t\t\tGROUP BY\n\t\t\t u.name\n\t\t\tORDER BY\n\t\t\t times desc")->fetchAll(); $result_all_users = db_query("\n\t\t \tSELECT\n\t\t\t f.field_full_n_value as title, u.name , u.mail, u.created, u.access, u.uid, COUNT(a.uid) AS times\n\t\t\tFROM\n\t\t\t {users} u, {field_data_field_full_n} f, {node_view_count} a where f.entity_id = u.uid and a.uid = u.uid and u.uid NOT IN (1,2,3,6,7,9,17,35,75,1133)\n\t\t\tGROUP BY\n\t\t\t u.name\n\t\t\tORDER BY\n\t\t\t times desc")->fetchAll(); //u.access desc") -> fetchAll(); // Show Top Pages & Top Visitors Pie Chart in the first Row echo "<div class='data-container'>"; echo "<h1>At a Glance</h1><br />"; /* <Area Graph JS for At a Glance */ echo "<script type='text/javascript'>"; echo "function drawVisualization_for_glance() {"; echo "var options = { "; echo "\t width: 968,"; echo " height: 400,"; echo " fontName: 'Open Sans',"; echo " tooltip: { textStyle: { fontName: 'Tahoma', fontSize: 11 } },"; echo " chartArea:{width:'82%'},"; //echo " title: 'Recent Visits',"; echo " colors: ['#A2AD00', '#9c2b11', '#e5760a', '#1d83ae', '#193153', '#919b02' ],"; //echo " hAxis: {title: 'Pages', titleTextStyle: {color: 'blue'}}"; echo "\t vAxis: {title: 'No. of Visits', titleTextStyle: {color: 'olive'}}"; echo "};"; //echo "var options = {'title':'asdasdasd asd asd ','width':500,'height':450,'chartArea':{left:0,top:10,width:'100%'}}"; echo "var data = google.visualization.arrayToDataTable(["; // echo "['Day', 'Visits'],"; $resultstr_at_a_glance[] = "['Pages', 'No. of Visits']"; foreach ($result_at_glance as $r) { $resultstr_at_a_glance[] = "['" . $r->title . "', " . $r->totalcount . "]"; } echo implode(",", $resultstr_at_a_glance); echo "]);"; echo "new google.visualization.ColumnChart(document.getElementById('visualization_glance'))."; echo "draw(data, options); "; echo " }"; echo "google.setOnLoadCallback(drawVisualization_for_glance);"; echo "</script>"; /* </Pie Graph JS */ echo "<div class='right'>"; echo "<div id='holder'>"; /* Pie Graph Code */ echo "<div id='visualization_glance'></div>"; echo "</div>"; echo "</div>"; echo "<div class='clear' id='below-space'></div>"; /* <Pie Graph - Top Visits */ echo "<script type='text/javascript'>"; echo "function drawVisualization_pages_top() {"; echo "var options = { "; echo "\t width: 450,"; echo " height: 450,"; echo " fontName: 'Open Sans',"; echo " tooltip: { textStyle: { fontName: 'Tahoma', fontSize: 11 } },"; echo " chartArea:{left:7,top:5, width:'100%'},"; echo " colors: ['#0065BD', '#7D9AAA', '#D4BA00', '#A2AD00', '#00ACED', '#666666', '#E37222', '#CD202C', '#AD005B', '#66307C', '#009AA6', '#006699', '#B5B38C', '#939D98' ]"; echo "};"; //echo "var options = {'title':'asdasdasd asd asd ','width':500,'height':450,'chartArea':{left:0,top:10,width:'100%'}}"; echo "var data = google.visualization.arrayToDataTable(["; echo "['Top Pages', 'No. of Visits'],"; foreach ($result_top_pages as $r) { $resultstr_pages_top[] = "['" . $r->title . "', " . $r->times . "]"; } echo implode(",", $resultstr_pages_top); echo "]);"; echo "new google.visualization.PieChart(document.getElementById('visualization_top_visits'))."; echo "draw(data, options); "; echo " }"; echo "google.setOnLoadCallback(drawVisualization_pages_top);"; echo "</script>"; /* </Pie Graph JS */ echo "<div class='left' style='width: 45%';>"; echo "<h3>Top 10 Pages</h3>"; echo "<div id='holder' class='push-down'>"; /* Pie Graph Code */ echo "<div id='visualization_top_visits'></div>"; echo "</div>"; echo "</div>"; /* <Pie Graph JS */ echo "<script type='text/javascript'>"; echo "function drawVisualization_pages_visited() {"; echo "var options = { "; echo "\t width: 450,"; echo " height: 450,"; echo " fontName: 'Open Sans',"; echo " tooltip: { textStyle: { fontName: 'Tahoma', fontSize: 11 } },"; echo " chartArea:{left:7,top:5, width:'100%'},"; echo " colors: ['#d8b71a', '#193153', '#9c2b11', '#e5760a', '#1d83ae', '#919b02', '#097092', '#42239b', '#ddb928', '#890c0c', '#5c6677', '#0fa7ad', '#ad560f', '#d41473' ]"; echo "};"; //echo "var options = {'title':'asdasdasd asd asd ','width':500,'height':450,'chartArea':{left:0,top:10,width:'100%'}}"; echo "var data = google.visualization.arrayToDataTable(["; echo "['Pages Visited', 'No. of Visits'],"; foreach ($result_top_visitors as $r) { $resultstr_pages_visited[] = "['" . $r->field_full_n_value . "', " . $r->times . "]"; } echo implode(",", $resultstr_pages_visited); echo "]);"; echo "new google.visualization.PieChart(document.getElementById('visualization_visit_graph'))."; echo "draw(data, options); "; echo " }"; echo "google.setOnLoadCallback(drawVisualization_pages_visited);"; echo "</script>"; /* </Pie Graph JS */ echo "<div class='right' style='width: 45%';>"; echo "<h3>Top Visitors</h3>"; echo "<div id='holder' class='push-down'>"; /* Pie Graph Code */ echo "<div id='visualization_visit_graph'></div>"; echo "</div>"; echo "</div>"; echo "<div class='clear' id='push-up'></div>"; echo "</div>"; echo "<h3 class='analytics-heading'>Registered Users ( Total active registered members: " . count($result_all_users) . " )</h3><br />"; echo "<div id='page-wrap' class='content_scroll'>"; echo "\n<table id='hor-minimalist-b'>"; echo "\n\n<thead>"; echo "\n\n\n<tr>"; echo "\n\n\n\n<th>Name</th>"; echo "\n\n\n\n<th>Username</th>"; echo "\n\n\n\n<th>Registered On</th>"; echo "\n\n\n\n<th>Last Login</th>"; echo "\n\n\n</tr>"; echo "\n\n</thead>"; echo "\n\n<tbody>"; foreach ($result_all_users as $r) { $rdate = date('Y-m-d H:i:s', $r->created); $dtz = 'America/New_York'; $regTimestamp = getNoteDateTimeZone($rdate, 'US/Central', $dtz); $ldate = date('Y-m-d H:i:s', $r->access); $loginTimestamp = getNoteDateTimeZone($ldate, 'US/Central', $dtz); echo "<tr>" . "<td><a href =" . $path_alias . "?uid=" . $r->uid . ">" . $r->title . "</a></td>" . "<td>" . $r->name . "</td>" . "<td>" . date("F jS, Y \\( h:i a \\)", strtotime($regTimestamp)) . "</td>" . "<td>" . date("F jS, Y \\( h:i a \\)", strtotime($loginTimestamp)) . "</td>" . "</tr>"; } echo "\n\n</tbody>"; echo "\n</table>"; echo "</div>"; echo "<br /><br /><br />"; } }
$node3 = node_load($pagepath); $breadcrumbwritten = 1; echo '<a href="/">Home</a> » <a href="/community/' . $url[2] . '">' . $node2->title . '</a> » <a href="/community/' . $url[2] . '/' . $url[3] . '">Recent Discussions</a> » ' . $node3->title; } elseif (array_key_exists(3, $url) && $url[3] == 'resource') { $path = drupal_lookup_path('source', $url[1] . '/' . $url[2]); $path = explode('/', $path); $path = $path[1]; $node2 = node_load($path); $pagepath = drupal_get_normal_path(arg(0) . '/' . arg(1)); $pagepath = explode('/', $pagepath); $pagepath = $pagepath[1]; $node3 = node_load($pagepath); $breadcrumbwritten = 1; echo '<a href="/">Home</a> » <a href="/community/' . $url[2] . '">' . $node2->title . '</a> » <a href="/community/' . $url[2] . '/' . $url[3] . '">Recent Resources</a> » ' . $node3->title; } elseif (array_key_exists(3, $url) && $url[3] == 'links' && count($url) == 5) { $path = drupal_lookup_path('source', $url[1] . '/' . $url[2]); $path = explode('/', $path); $path = $path[1]; $node2 = node_load($path); $pagepath = drupal_get_normal_path(arg(0) . '/' . arg(1)); $pagepath = explode('/', $pagepath); $pagepath = $pagepath[1]; $node3 = node_load($pagepath); $breadcrumbwritten = 1; echo '<a href="/">Home</a> » <a href="/community/' . $url[2] . '">' . $node2->title . '</a> » <a href="/community/' . $url[2] . '/' . $url[3] . '">Recent Links</a> » ' . $node3->title; } } if ($breadcrumbwritten == 0) { print $breadcrumb; } ?>
<ul class="soc-links"> <li><a href="http://www.facebook.com/sharer/sharer.php?t=%23ItsMillerTime+<?php print urlencode($title); ?> &u=<?php $path = current_path(); $path_alias = drupal_lookup_path('alias', $path); echo url(NULL, array('absolute' => TRUE)), $path_alias; ?> " alt="facebook Miller Lite" title="Comparte en Facebook Miller Lite" target="_blank"><span class="icon-miller-fb s-i-2"> </span></a></li> <li><a href="https://twitter.com/intent/tweet?text=%23ItsMillerTime+<?php print urlencode($title); ?> &url=<?php $path = current_path(); $path_alias = drupal_lookup_path('alias', $path); echo url(NULL, array('absolute' => TRUE)), $path_alias; ?> &via=MillerLiteCol" alt="twitter Miller Lite" title="Comparte en Twitter Miller Lite" target="_blank"><span class="icon-miller-tw s-i-2"> </span></a></li> </ul> </p> </div> </div> <div class="row dam-l"> <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 "> <p class="slid-txt-2"> </p> </div> </div> <div class="row"> <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 dam-l-2">
$body = $view['0']->_field_data['nid']['entity']->body['und']['0']['value']; $body_str = ""; $body = explode(' ', $body); $counter = 0; foreach ($body as $row) { $body_str = $body_str . ' ' . $row; if ($counter == 50) { break; } $counter++; } $body = $body_str . '...'; $address = $view['0']->_field_data['nid']['entity']->field_address['und']['0']['value']; $image = $view['0']->_field_data['nid']['entity']->field_image['und']['0']['uri']; $url = image_style_url('large', $image); $link = drupal_lookup_path('alias', "node/" . $view['0']->nid); ?> <div class="<?php print $classes; ?> "> <div class="views-row views-row-1 views-row-odd views-row-first views-row-last"> <div class="views-field views-field-field-image"> <div class="field-content featured-brewery-image"> <a href="/preview/<?php echo $link; ?> "> <img typeof="foaf:Image" src="<?php print $url; ?>
$node = $element['#object']; ?> <?php $language = 'und'; if (isset($node->field_type[$node->language])) { $language = $node->language; } ?> <?php if ($element['#view_mode'] != 'full' && $node->field_type[$language][0]['value'] == 'fa-picture-o') { ?> <div class="ImageOverlayH"></div> <div class="Buttons StyleBe1"> <span class="WhiteRounded"> <a href="<?php print drupal_lookup_path('alias', "node/" . $node->nid); ?> " title="Read this article..."> <i class="fa fa-link"></i> </a> </span> </div> <?php } ?> </div> <?php } ?> </div> </div>
*/ $image = file_create_url($node->field_thumnail[LANGUAGE_NONE][0]['uri']); ?> <div class="video-tutorial-item"> <a class="video-tutorial-title" href="<?php print base_path() . drupal_lookup_path('alias', 'node/' . $node->nid); ?> " title="<?php echo $title; ?> "><?php echo $title; ?> </a> <a class="video-tutorial-image" href="<?php print base_path() . drupal_lookup_path('alias', 'node/' . $node->nid); ?> " title="<?php echo $title; ?> "> <img src="<?php print $image; ?> " alt="<?php echo $title; ?> " title="<?php echo $title; ?> " />
if (isset($entity->field_category['und'][0]['tid'])) { $termid = $entity->field_category['und'][0]['tid']; $term = taxonomy_term_load($termid); $url = drupal_lookup_path('alias', 'taxonomy/term/' . $term->tid); print '<div class="breadcrumb-list section-title"><div itemtype="http://data-vocabulary.org/Breadcrumb" itemscope="" class="breadcrumb-item"><span itemprop="title"><a href="/' . $url . '" itemprop="url">' . $term->name . '</a></span></div></div>'; } ?> <?php /* * Schema Category Breadcrumb * Top and Bottom level terms */ ?> <?php if (isset($entity->field_category['und'][1]['tid'])) { $termid = $entity->field_category['und'][0]['tid']; $termid2 = $entity->field_category['und'][1]['tid']; $term = taxonomy_term_load($termid); $term2 = taxonomy_term_load($termid2); $url = drupal_lookup_path('alias', 'taxonomy/term/' . $term->tid); $url2 = drupal_lookup_path('alias', 'taxonomy/term/' . $term2->tid); print '<div class="breadcrumb-list section-title"><div itemtype="http://data-vocabulary.org/Breadcrumb" itemscope="" class="breadcrumb-item"><span itemprop="title"><a href="/' . $url . '" itemprop="url">' . $term->name . '</a></span></div> | <div itemtype="http://data-vocabulary.org/Breadcrumb" itemscope="" class="breadcrumb-item"><span itemprop="title"><a href="/' . $url2 . '" itemprop="url">' . $term2->name . '</a></span></div></div>'; } elseif (isset($entity->field_category['und'][0]['tid'])) { $termid = $entity->field_category['und'][0]['tid']; $term = taxonomy_term_load($termid); $url = drupal_lookup_path('alias', 'taxonomy/term/' . $term->tid); print '<div class="breadcrumb-list"><div itemtype="http://data-vocabulary.org/Breadcrumb" itemscope="" class="breadcrumb-item"><span itemprop="title"><a href="/' . $url . '" itemprop="url">' . $term->name . '</a></span></div></div>'; }
function blendedmalts_changetab($label, &$vars) { $tabs = explode("\n", $vars['tabs']); $vars['tabs'] = ''; foreach ($tabs as $tab) { if (strpos($tab, '' . $label . '">') === FALSE) { $vars['tabs'] .= $tab . "\n"; } else { if (!module_exists('wisski_textmod')) { $text = $tab; $text = str_replace('Edit', 'Edit Text', $text); $node = $vars['node']; $indiv = $node->title; $obj = wisski_store_getObj(); $namespaces = $obj->wisski_ARCAdapter_getNamespaces(); $q = ""; foreach ($namespaces as $name => $val) { $q .= "PREFIX {$name}:\t<{$val}>\n"; } $pred = "ecrm:P129i_is_subject_of"; $q .= "SELECT * WHERE { <" . wisski_store_getObj()->wisski_ARCAdapter_delNamespace($indiv) . "> <" . wisski_store_getObj()->wisski_ARCAdapter_delNamespace($pred) . "> ?x . }"; $rows = wisski_store_getObj()->wisski_ARCAdapter_getStore()->query($q, 'rows'); // by Martin: if noo text found, search via Document group path if (!$rows && module_exists('wisski_textproc')) { $text_uris = wisski_textproc_get_texts(wisski_store_getObj()->wisski_ARCAdapter_delNamespace($indiv)); $rows = array(array('x' => $text_uris[0])); } // end by Martin $url = parse_url($rows[0]['x']); if ($rows[0]['x']) { $vars['tabs'] .= '<li><a href="' . url() . drupal_lookup_path('source', 'content/' . wisski_store_getObj()->wisski_ARCAdapter_addNamespace($rows[0]['x'])) . '/annotext?uri=' . urlencode(wisski_store_getObj()->wisski_ARCAdapter_delnamespace($indiv)) . '">Edit Text</a></li>'; } else { $q = ""; foreach ($namespaces as $name => $val) { $q .= "PREFIX {$name}:\t<{$val}>\n"; } $q .= "SELECT * WHERE { <" . wisski_store_getObj()->wisski_ARCAdapter_delNamespace($indiv) . "> " . "rdf:type ?x . }"; $rows = wisski_store_getObj()->wisski_ARCAdapter_getStore()->query($q, 'rows'); include_once 'sites/all/modules/wisski_pathbuilder/wisski_pathbuilder.inc'; $groups = wisski_pathbuilder_getGroups(); foreach ($groups as $group) { $samepart = _wisski_pathbuilder_calculate_group_samepart($group); if ($samepart["x" . floor(count($samepart) / 2)] == $rows[0]['x']) { $vars['tabs'] .= '<li><a href="' . url() . 'node/add/individual' . '/annotext/' . $group . '?uri=' . urlencode($indiv) . '">Create Text</a></li>'; break; } } } } $vars['tabs'] .= str_replace('Edit', 'Edit Form', $tab) . "\n"; } } }
function url_for_tid($tid) { $taxonomy_link = 'taxonomy/term/' . $tid; $url_path = drupal_lookup_path('alias', 'taxonomy/term/' . $tid); return $GLOBALS['base_url'] . '/' . (empty($url_path) ? $taxonomy_link : $url_path); }
if ($index == 0) { $str_next = $subcategory_nodes[$index + 1]->title; $next_path = $subcategory_nodes[$index + 1]->nid; $next_path = drupal_lookup_path('alias', "node/" . $next_path); } else { if ($index == $max - 1) { $str_prev = $subcategory_nodes[$max - 2]->title; $prev_path = $subcategory_nodes[$index - 1]->nid; $prev_path = drupal_lookup_path('alias', "node/" . $prev_path); } else { $str_next = $subcategory_nodes[$index + 1]->title; $next_path = $subcategory_nodes[$index + 1]->nid; $next_path = drupal_lookup_path('alias', "node/" . $next_path); $str_prev = $subcategory_nodes[$index - 1]->title; $prev_path = $subcategory_nodes[$index - 1]->nid; $prev_path = drupal_lookup_path('alias', "node/" . $prev_path); } } ?> <div id="services-nav"> <?php if ($index > 0) { ?> <a href="/<?php echo $prev_path; ?> " class="prev"><span>Previous</span><br><?php echo $str_prev; ?>
<?php if (isset($entity->field_section_new[$entity->language])) { ?> <?php $terms = array(); ?> <!-- Sets up an empty array called $terms --> <?php foreach ($entity->field_section_new[$entity->language] as $tid) { ?> <?php $term = taxonomy_term_load($tid['tid']); ?> <?php $url = drupal_lookup_path('alias', 'taxonomy/term/' . $term->tid, $lang_code); ?> <!-- lookup the alias URL part of the term by term ID --> <?php $fullURL = $GLOBALS['base_url'] . '/' . $url; ?> <!-- Combine the URL part with the base URL --> <?php print $fullURL; ?> <!-- Output the final URL --> <?php print $term->name; ?> <?php $terms[] = l($term->name, 'taxonomy/term/' . $term->tid);
/** * Define actions for search engines. * @param $op: * - form: * Add search engine to form at admin/settings/xmlsitemap. * - ping: * Submit site map to search engine. * - access: * Log search engine access. * @param $type: * If $op is 'access', one of the following strings will indicate what was * downloaded: * - Site map: * The site map was downloaded. * - Site map index * The site map index was downloaded. * - Site map $chunk * Chunk $chunk was downloaded. * @return * - form: * Array of form elements for search engine settings * - ping: * None * - access: * Message string for access log */ function hook_xmlsitemap_engines($op, $type = NULL) { switch ($op) { case 'form': $form['google'] = array('#type' => 'fieldset', '#title' => t('Google'), '#collapsible' => TRUE, '#collapsed' => TRUE); $form['google']['xmlsitemap_engines_google_submit'] = array('#type' => 'checkbox', '#title' => t('Submit site map to Google.'), '#default_value' => variable_get('xmlsitemap_engines_google_submit', TRUE)); $form['google']['xmlsitemap_engines_google_url'] = array('#type' => 'textfield', '#title' => t('Submission URL'), '#default_value' => variable_get('xmlsitemap_engines_google_url', 'http://www.google.com/webmasters/tools/ping?sitemap=' . xmlsitemap_url('sitemap.xml', drupal_lookup_path('alias', 'sitemap.xml') ? drupal_lookup_path('alias', 'sitemap.xml') : NULL, NULL, NULL, TRUE)), '#description' => t('The URL to submit the site map to.')); $form['google']['xmlsitemap_engines_google_verify'] = array('#type' => 'textfield', '#title' => t('Verification link'), '#default_value' => variable_get('xmlsitemap_engines_google_verify', ''), '#description' => t('In order to show statistics, Google will ask you to verify that you control this site by creating a file with a certain name. Enter that name here and the XML Sitemap module will create a path to that file name. This will only work if you have clean URLs enabled.')); return $form; case 'ping': if (variable_get('xmlsitemap_engines_google_submit', TRUE)) { $result = drupal_http_request(variable_get('xmlsitemap_engines_google_url', 'http://www.google.com/webmasters/tools/ping?sitemap=' . xmlsitemap_url('sitemap.xml', drupal_lookup_path('alias', 'sitemap.xml') ? drupal_lookup_path('alias', 'sitemap.xml') : NULL, NULL, NULL, TRUE))); if ($result->code == 200) { watchdog('xmlsitemap', t('Sitemap successfully submitted to Google.')); } else { watchdog('xmlsitemap', t('Error occurred submitting sitemap to Google: @code', array('@code' => $result->code)), WATCHDOG_ERROR); } } break; case 'access': if (strpos($_SERVER['HTTP_USER_AGENT'], 'Googlebot') !== FALSE) { return t('!sitemap downloaded by Google.', array('!sitemap' => $type)); } break; } }
if (isset($row->field_field_image[0])) { $image_default = file_create_url($row->field_field_image[0]['rendered']['#item']['uri']); } ?> <div class="item entry item-h2 <?php echo strip_tags(str_replace(',', ' ', $category)); ?> "> <a href="<?php echo drupal_lookup_path('alias', "node/" . $row->nid); ?> "><img src="<?php print $image_default; ?> " alt=""></a> <div class="magnifier"> <div class="buttons"> <a class="st btn btn-default" rel="bookmark" href="<?php echo drupal_lookup_path('alias', "node/" . $row->nid); ?> "><?php print theme_get_setting('project_text_button'); ?> </a> <h3><?php print $row->node_title; ?> </h3> </div> </div> </div>
function dandeleon_preprocess_block(&$vars, $hook) { // Add a striping class. global $base_url; $vars['classes_array'][] = 'block-' . $vars['zebra']; if ($vars['block_html_id'] == 'block-easy-breadcrumb-easy-breadcrumb') { $node = menu_get_object(); if ($node != null) { //dpm($node); if ($node->type == 'paquete_compuesto') { $breadcrumb = array(array('content' => 'Inicio', 'class' => array('easy-breadcrumb_segment', 'easy-breadcrumb_segment-front'), 'url' => '<front>'), array('content' => $node->title, 'class' => array('easy-easy-breadcrumb_segment', 'easy-breadcrumb_segment-title'))); $url = ''; $name = ''; $query = db_query('SELECT v.value FROM {variable} v WHERE v.name = :cn', array(':cn' => 'category_name')); if ($query->rowCount() != 0) { foreach ($query as $value) { //var_export($value->value); $datos_sesion = unserialize($value->value); $name = (string) $datos_sesion; } } $query2 = db_query('SELECT v.value FROM {variable} v WHERE v.name = :cn', array(':cn' => 'category_url')); if ($query2->rowCount() != 0) { foreach ($query2 as $value2) { //var_export($value->value); $datos_sesion = unserialize($value2->value); $url = (string) $datos_sesion; } } if ($name == 'none') { //buscar la primera categoria del nodo $field = field_view_field('node', $node, 'field_paquete_economico'); $name = $field['#items'][0]['taxonomy_term']->name; $taxonomy_id = $field['#items'][0]['taxonomy_term']->tid; $url = drupal_lookup_path('alias', 'taxonomy/term/' . $taxonomy_id); } else { //obtener el termino id de la categoria $taxonomy = drupal_lookup_path('source', $url); $arrayTaxonomy = explode('/', $taxonomy); $term = taxonomy_term_load($arrayTaxonomy[2]); $taxonomy_id = $term->tid; } $vars['elements']['easy_breadcrumb']['#breadcrumb'] = $breadcrumb; $content = '<div class="easy-breadcrumb"> <a href="/" class="easy-breadcrumb_segment easy-breadcrumb_segment-front">Inicio</a> <span class="easy-breadcrumb_segment-separator"> / </span> <a href="/catalogo-de-viajes-en-oferta" class="easy-breadcrumb_segment easy-breadcrumb_segment-1">Catálogo de viajes en oferta</a> <span class="easy-breadcrumb_segment-separator"> / </span> <a href="' . $base_url . '/' . $url . '" class="easy-breadcrumb_segment easy-breadcrumb_segment-2">' . $name . '</a> <span class="easy-breadcrumb_segment-separator"> / </span> <span class="easy-breadcrumb_segment easy-breadcrumb_segment-title">' . $node->title . '</span> </div>'; $vars['content'] = $content; } } } }