/** * Override or insert variables into the page templates. * * @param $variables * An array of variables to pass to the theme template. * @param $hook * The name of the template being rendered ("page" in this case.) */ function storyscopezen_preprocess_page(&$variables, $hook) { global $user; if ($user->uid > 0) { $logout_string = '<div class="float_right" id="logout">' . t('You are signed in as ') . l(check_plain($user->name), 'user/' . $user->uid) . ' - '; $logout_string .= l(t('Sign out'), 'user/logout') . '</div>'; $variables['logout_string'] = $logout_string; } else { $logout_string = '<div class="button float_right" id="logout">' . l(t('Sign in'), 'user/') . '</div>'; $variables['logout_string'] = $logout_string; } // Add inline 'create new' buttons with title on certain pages. if (!empty($variables['page']['#views_contextual_links_info']['views_ui']['view']->name)) { $view_name = $variables['page']['#views_contextual_links_info']['views_ui']['view']->name; // We only need this inline create new button on certain views, so list them here. $create_new_views = array('dossier_stories_panel_pane'); // Create and add in the button if (in_array($view_name, $create_new_views)) { drupal_set_message($view_name); $view = views_get_view($view_name); $view_display = $variables['page']['#views_contextual_links_info']['views_ui']['view_display_id']; $view->set_display($view_display); $button_html = array(); $button_html = storyscope_listings_get_view_header_footer($view); if (!empty($button_html)) { $variables['title_suffix']['storyscope'] = array('#children' => $button_html); } } } }
/** * @inheritDoc */ public function init() { $features = array(); if ($view = $this->getOption('view', FALSE)) { list($views_id, $display_id) = explode(':', $view, 2); $view = views_get_view($views_id); if ($view && $view->access($display_id)) { $view->set_display($display_id); if (empty($view->current_display) || !empty($display_id) && $view->current_display != $display_id) { if (!$view->set_display($display_id)) { return FALSE; } } $view->pre_execute(); $view->init_style(); $view->execute(); // Do not render the map, just return the features. $view->style_plugin->options['skipMapRender'] = TRUE; $features = array_merge($features, $view->style_plugin->render()); $view->post_execute(); } } $this->setOption('features', $features); return parent::init(); }
/** * Load a view from its name. * * @param string $view_name * * @return view * * @throws Yamm_Sync_ProfileException */ public static function loadView($view_name) { if ($view = views_get_view($view_name)) { return $view; } throw new Yamm_Sync_ProfileException("View " . $view_name . " does not exists"); }
/** * Constructor * * Creates a new View instance. * * @param string $view_name The name of the view. */ public function __construct($view_name) { if ($view = views_get_view($view_name)) { $this->base = $view; } else { throw new \Exception('The base view: ' . $view_name . ' does not exist!'); } }
/** * */ public function getView($name, $display) { $view = \views_get_view($name); $view->set_display($display); $view->pre_execute(); $view->execute(); return $view->render(); }
/** * first one has to create a callback function that takes a search string as a param * PARAM $search: A string on which we are searching * RETURN an array of items to display (most likely links) */ function quick_search_example_qs_callback($search) { $view = views_get_view('quick_search_example_view'); $view->set_arguments(array($search)); $view->pre_execute(); $view->execute(); foreach ($view->result as $result) { $item = $result->_entity_properties; $rtn[] = l($item['title'], $item['url']); } return $rtn; }
private function getCartView() { // Load the specified View. $view = views_get_view('commerce_cart_form'); $view->set_display('default'); // Set the specific arguments passed in. $view->set_arguments(array($this->order_id)); // Override the view url, if an override was provided. $view->override_url = 'cart'; // Prepare and execute the View query. $view->pre_execute(); $view->execute(); return $view; }
public function __construct($view_name, $display_id = NULL) { $this->view = views_get_view($view_name); if (!$this->view) { $this->setErrors('View does not exist.'); $this->setInitialized(FALSE); return; } if (is_string($display_id)) { $this->view->set_display($display_id); } else { $this->view->init_display(); } $this->setInitialized(TRUE); }
/** * Extend the Coffee functionallity with your own commands and items. * * Here's an example of how to add content to Coffee. */ function hook_coffee_commands($op) { $commands = array(); // Basic example, for 1 result. $commands[] = array('value' => 'Simple', 'label' => 'node/example', 'command' => ':simple'); // More advanced example to include a view. $view = views_get_view('my_entities_view'); if ($view) { $view->set_display('default'); $view->pre_execute(); $view->execute(); if (count($view->result) > 0) { foreach ($view->result as $row) { $commands[] = array('value' => ltrim(url('node/' . $row->nid), '/'), 'label' => check_plain('Pub: ' . $row->node_title), 'command' => ':x'); } } } return $commands; }
public function __construct($view_name, $display_id = NULL) { if (!module_exists('views')) { $this->setErrors('Please enable the Views module.'); $this->setInitialized(FALSE); return; } $this->view = views_get_view($view_name); if (!$this->view) { $this->setErrors("View {$view_name} does not exist."); $this->setInitialized(FALSE); return; } if (is_string($display_id)) { $this->view->set_display($display_id); } else { $this->view->init_display(); } $this->setInitialized(TRUE); }
protected function initializeView($match = NULL, $match_operator = 'CONTAINS', $limit = 0, $ids = NULL) { $view_name = $this->field['settings']['handler_settings']['view']['view_name']; $display_name = $this->field['settings']['handler_settings']['view']['display_name']; $args = $this->field['settings']['handler_settings']['view']['args']; $entity_type = $this->field['settings']['target_type']; // Check that the view is valid and the display still exists. $this->view = views_get_view($view_name); if (!$this->view || !isset($this->view->display[$display_name]) || !$this->view->access($display_name)) { watchdog('entityreference', 'The view %view_name is no longer eligible for the %field_name field.', array('%view_name' => $view_name, '%field_name' => $this->instance['label']), WATCHDOG_WARNING); return FALSE; } $this->view->set_display($display_name); // Make sure the query is not cached. $this->view->is_cacheable = FALSE; // Pass options to the display handler to make them available later. $entityreference_options = array('match' => $match, 'match_operator' => $match_operator, 'limit' => $limit, 'ids' => $ids); $this->view->display_handler->set_option('entityreference_options', $entityreference_options); return TRUE; }
/** * Implements hook_preprocess(). */ function uconn_theme_preprocess_islandora_basic_collection_wrapper(&$variables) { $dsid = theme_get_setting('collection_image_ds'); if (isset($variables['islandora_object'][$dsid])) { $variables['collection_image_ds'] = theme_get_setting('collection_image_ds'); } module_load_include('module', 'islandora_solr_metadata', 'islandora_solr_metadata'); $variables['meta_description'] = islandora_solr_metadata_description_callback($variables['islandora_object']); $view = views_get_view('clone_of_islandora_usage_stats_for_collections'); if (isset($view)) { // If our view exists, then set the display. $view->set_display('block'); $view->pre_execute(); $view->execute(); // Rendering will return the HTML of the the view $output = $view->render(); // Passing this as array, perhaps add more, like custom title or the like? $variables['islandora_latest_objects'] = $output; } }
/** * (non-PHPdoc) * @see Yamm_Entity::_objectLoad() */ protected function _objectLoad($identifier) { views_include('view'); return views_get_view($identifier, TRUE)->export(); }
/** * Form callback to edit an exportable item using the wizard * * This simply loads the object defined in the plugin and hands it off. */ function views_ui_clone_form($form, &$form_state) { $counter = 1; if (!isset($form_state['item'])) { $view = views_get_view($form_state['original name']); } else { $view = $form_state['item']; } do { if (empty($form_state['item']->is_template)) { $name = format_plural($counter, 'Clone of', 'Clone @count of') . ' ' . $view->get_human_name(); } else { $name = $view->get_human_name(); if ($counter > 1) { $name .= ' ' . $counter; } } $counter++; $machine_name = preg_replace('/[^a-z0-9_]+/', '_', drupal_strtolower($name)); } while (ctools_export_crud_load($form_state['plugin']['schema'], $machine_name)); $form['human_name'] = array('#type' => 'textfield', '#title' => t('View name'), '#default_value' => $name, '#size' => 32, '#maxlength' => 255); $form['name'] = array('#title' => t('View name'), '#type' => 'machine_name', '#required' => TRUE, '#maxlength' => 32, '#size' => 32, '#machine_name' => array('exists' => 'ctools_export_ui_edit_name_exists', 'source' => array('human_name'))); $form['submit'] = array('#type' => 'submit', '#value' => t('Continue')); return $form; }
function futurium_isa_theme_quant_page($vars) { $content = ''; $content .= $vars['form']; //$content .= '<h1>Content stats</h1>'; if ($vars['charts']) { foreach ($vars['charts'] as $chart) { $content .= $chart; } } $views['users'] = array( 'title' => t('Users'), 'view' => 'statistics_users', 'class' => 'stats-user', 'displays' => array( 'most_active_users', ), ); $views['futures'] = array( 'title' => t('Futures'), 'view' => 'statistics', 'class' => 'stats-futures ', 'displays' => array( 'most_commented_futures', 'most_voted_futures', ), ); $views['ideas'] = array( 'title' => t('Ideas'), 'view' => 'statistics', 'class' => 'stats-ideas', 'displays' => array( 'most_commented_ideas', 'most_voted_ideas', ), ); foreach($views as $group => $data) { $view_name = $data['view']; $content .= '<div class="' . $data['class'] . '"><h1 class="element-invisible">' . $data['title'] . '</h1>'; foreach ($data['displays'] as $k => $display) { $view = views_get_view($view_name); $view->set_display($display); if (!empty($_GET['period'])) { $filters = $view->display_handler->get_option('filters'); if (isset($filters['timestamp']['value'])) { $p = '-' . str_replace('_', ' ', $_GET['period']); $filters['timestamp']['value']['value'] = $p; $view->display_handler->set_option('filters', $filters); $view->pre_execute(); } } $content .= '<div class="stats-block"><h2>' . $view->get_title() . '</h2>'; $content .= $view->preview($display); $content .= '</div>'; } $content .= '</div>'; } return '<div id="quant-page">' . $content . '</div>'; }
function phptemplate_faceted_search_ui_stage_select($search, $keyword_block_content, $guided_block_content, $description_content = '') { /* if ($description_content != '') { $form['description'] = array( '#type' => 'item', '#value' => check_markup($description_content, FILTER_FORMAT_DEFAULT, FALSE), '#weight' => -5, '#attributes' => array('class' => 'faceted-search-description'), ); } */ if (($search->_env_id == 4 || $search->_env_id == 5) && $search->ui_state['stage'] == 'select') { if ($search->_env_id == 5) { // village // $view = views_get_view('recent_active_tasks_'. $gtype); // $view = views_get_view('village_news_latest_all'); // print ' <pre>'. var_export($view,true) .'</pre>'; // $middle_one = views_build_view('block', $view, NULL, 0, 5); $description = check_markup($description_content, FILTER_FORMAT_DEFAULT, FALSE); $middle_one = nabuur_og_list_active_villages(); // $view = views_get_view('og_new_villages'); // $middle_two = views_build_view('block', $view, NULL, 0, 5); $middle_two = nabuur_og_new_active_villages(); $assist_img_link = l('<img height = "120px" align = "center" src="/files/static/connect-village.jpg"/>', '/assistance-your-community', null, null, null, null, true); $assist_link = l(t('Click here to register on NABUUR'), '/assistance-your-community'); $form['middle']['#value'] = '<div class="search-description">' . $description . '</div> <div class="village-assist"><div class="nabuur-box nabuur-beige"><div class="nabuur-content"><div class="content"><div class="picture">' . $assist_img_link . '</div><div style="text-align: center">' . $assist_link . '</div></div></div></div></div> <div class="search-middle-first nabuur-box nabuur-border"><h3 class="title">News from the villages</h3><div class="content">' . $middle_one . '</div> </div><div class=spacer> </div> <div class="search-middle-second nabuur-box nabuur-border"><h3>New Villages on NABUUR.com</h3>' . $middle_two . '</div> <div class=spacer> </div> <div class="search-middle"><div class="search-top"><div class="search-middle-map" ><img src="/files/furniture/worldmap-s.png" width="350" height="181" border="0" usemap="#map" /><map name="map"><area title="Africa" shape="poly" coords="138,70,165,51,199,60,208,85,219,85,217,103,211,110,223,116,217,139,203,136,190,151,179,151,169,125,171,111,164,100,147,100,138,82,139,76" href="/village/results/taxonomy%3A8" /> <area title="South America" shape="poly" coords="71,102,84,82,110,94,110,101,126,106,123,120,119,123,107,151,100,163,97,173,86,169,82,127,70,112" href="/village/results/taxonomy%3A10" /> <area title="North America" shape="poly" coords="66,98,76,93,91,78,118,36,56,7,15,24,14,36,32,31,35,38,30,53,33,68,34,68" href="/village/results/taxonomy%3A11" /> <area title="Asia" shape="poly" coords="223,86,231,75,251,99,257,91,255,80,262,80,265,92,294,89,286,79,297,61,288,53,263,38,211,40,196,36,198,59,209,74" href="/village/results/taxonomy%3A9" /> </map></div> <div class="search-middle-where nabuur-box nabuur-border"><h3>Where do you want to go?</h3><h4><a href="/village/results/taxonomy:8">Africa</a></h4> <p> <a href="/village/results/taxonomy:8.12">Burundi</a> | <a href="/village/results/taxonomy:8.195">Botswana</a> | <a href="/village/results/taxonomy:8.13">Cameroon</a> | <a href="/village/results/taxonomy:8.214">DR of the Congo</a> | <a href="/village/results/taxonomy:8.15">Gambia</a> | <a href="/village/results/taxonomy:8.16">Ghana</a> | <a href="/village/results/taxonomy:8.17">Kenya</a> | <a href="/village/results/taxonomy:8.283">Liberia</a> | <a href="/village/results/taxonomy:8.290">Madagascar</a> | <a href="/village/results/taxonomy:8.18">Mali</a> | <a href="/village/results/taxonomy:8.19">Morocco</a> | <a href="/village/results/taxonomy:8.20">Nigeria</a> | <a href="/village/results/taxonomy:8.21">Rwanda</a> | <a href="/village/results/taxonomy:8.22">Senegal</a> | <a href="/village/results/taxonomy:8.23">Sierra Leone</a> | <a href="/village/results/taxonomy:8.24">South Africa</a> | <a href="/village/results/taxonomy:8.25">Tanzania</a> | <a href="/village/results/taxonomy:8.26">Uganda</a> | <a href="/village/results/taxonomy:8.27">Zambia</a> </p> <h4><a href="/village/results/taxonomy:9">Asia</a></h4> <p> <a href="/village/results/taxonomy:9.30">Bangladesh</a> | <a href="/village/results/taxonomy:9.31">Cambodia</a> | <a href="/village/results/taxonomy:9.208">China</a> | <a href="/village/results/taxonomy:9.32">India</a> | <a href="/village/results/taxonomy:9.33">Nepal</a> | <a href="/village/results/taxonomy:9.320">Pakistan</a> | <a href="/village/results/taxonomy:9.326">Philippines</a> | <a href="/village/results/taxonomy:9.34">Sri Lanka</a> | <a href="/village/results/taxonomy:9.1215">Tibet</a> </p> <h4><a href="/village/results/taxonomy:10">Latin America</a></h4> <p> <a href="/village/results/taxonomy:10.226">Ecuador</a> | <a href="/village/results/taxonomy:10.29">Peru</a> | <a href="/village/results/taxonomy:11.35">Mexico</a> </p></div></div></div> <div class=spacer> </div> </div>'; } else { // id = 4 group $view = views_get_view('recent_needshelp_tasks_village'); $middle_two = views_build_view('block', $view, NULL, 0, 5); } } if ($description_content != '') { $form['description'] = array('#type' => 'item', '#weight' => -5, '#attributes' => array('class' => 'faceted-search-description')); } if ($keyword_block_content) { $form['keyword'] = array('#type' => 'fieldset', '#title' => t('Keyword search'), '#value' => $keyword_block_content, '#weight' => 0, '#attributes' => array('class' => 'faceted-search-keyword')); } if ($guided_block_content) { $form['guided'] = array('#type' => 'fieldset', '#title' => t('Guided search'), '#value' => $guided_block_content, '#weight' => 1, '#attributes' => array('class' => 'faceted-search-guided')); } return drupal_render($form); }
$output = $output . "</a>"; $output = $output . "</li>"; } $output = $output . "</ul>"; } $output = $output . "<!-- HVAD SIGER LOVEN? S**T -->"; // KONTAKT // Hvis noden ikke er en 'ledig stilling' if (taxonomy_term_load($node->field_indholdstype['und'][0]['tid'])->name != "Ledig stilling") { $output .= "<!-- KONTAKT START -->"; if ($node->field_url or $node->field_url_2 or $node->field_diverse_boks) { $output .= "<hr>"; } $output .= "<h2>Kontakt</h2>"; $args = array($node->field_os2web_base_field_kle_ref['und'][0][tid], $node->field_os2web_base_field_kle_ref['und'][0][tid]); $view = views_get_view('kontakt_kle'); $view->set_display('default'); $view->set_arguments($args); $view->execute(); if (count($view->result) > 0) { $output .= $view->render(); } else { $output .= views_embed_view('kontakt_kle', 'default', 1968); } $output .= "<!-- KONTAKT S**T -->"; } // DEL PÅ SOCIALE MEDIER // Hvis noden er en indholdsside, borger.dk-artikel eller en aktivitet if ($node->type == 'os2web_base_contentpage' or $node->type == 'os2web_borger_dk_article') { include_once drupal_get_path('theme', 'ishoj') . '/includes/del-paa-sociale-medier.php'; }
} ?> <?php $productnode = node_load($product->nid); $image_path = $productnode->field_image_cache[0]['filepath']; ?> <div style="float:left";> <?php print theme('imagecache', 'product', $image_path, $productnode->title, ''); ?> </div> <?php // print "<pre>".print_r($product)."</pre>"; if ($product->shippable == 0) { print $productnode->body; $view = views_get_view('uc_products'); $view->set_display('block_3'); $view->set_arguments(array($product->nid)); // change the amount of items to show $view->set_items_per_page(4); $view->pre_execute(); $view->execute(); print $view->render(); } ?> <br /> <?php // drupal_set_message("<pre>".print_r($productnode)."</pre>"); ?>
<?php $report= $field->content; ?> <?php endif; ?> <?php endforeach; ?> <?php /* $viewName1 = 'arabic_text'; print views_embed_view($viewName1 , $display_id = 'default', arg(4), arg(5), 'ARB');*/ if($_SESSION['qry']==1) { $_SESSION['qry']=0; $viewName = 'Hadith_Content_view'; $view_12 = views_get_view($viewName); $view_12->set_display('default'); $view_12->set_arguments(array(arg(2), arg(3))); $view_12->execute(); $result_12 = $view_12->result; $output1 = $result_12[0]->node_revisions_body; $output2 = $result_12[0]->nid; $_SESSION['nid']= $output2; } $nodid=$_SESSION['nid']; // $nodid=$output2; //print $nodid.$cid."lllllllllll"; // $com_nodid=find_comment_id($cid);
$displayMachineName = $_GET['display']; // Gather parameters - Any parameters to be queried with the view $viewParameterList = array(); $paramId = 1; while (isset($_GET["param{$paramId}"])) { $viewParameterList[] = $_GET["param{$paramId}"]; $paramId++; } // Gather parameters - Pager value $page = 0; // assume request for the first page of results from this view if (empty($_GET['page'])) { $page = intval($_GET['page']); } // Get this rendered-View's ($viewMachineName's) HTML under the display ($displayMachineName) with the parameters ($viewParameterList) $myview = views_get_view($viewMachineName); $myview->set_display($displayMachineName); $myview->set_arguments($viewParameterList); $myview->set_current_page($page); $myview->pre_execute(); $viewHTML = $myview->preview(); // Effectively, this returns views_embed_view($viewMachineName, $displayMachineName, $viewParameterList[0], $viewParameterList[1], $viewParameterList[2], $viewParameterList[3], [...]) for the given $page // Check if we are in Web-UI-Debug mode if (!empty($_GET['webuidebug']) && intval($_GET['webuidebug']) === 1) { // We are in Web-UI-Debug mode, use Kurumo to print $viewResults instead of just returning JSON dsm($viewResults); // Triggers Kurumo functionality (this function is part of the devel module) print '<b>In Web-UI-Debug mode</b>. See above for data and structure, see below for JSON output.'; print '<textarea style="width: 100%; min-height: 500px;">' . json_encode($viewResults) . '</textarea>'; print '<br/><br/><hr/>'; } else {
</div> </div> <?php if ($store['catalog'] == '1') { ?> <div id="store-catalog-block"> <?php if (function_exists('core_utilities_get_term_id')) { $argument[0] = 'magasin'; $term_name = $store['typology']; $vocabulary_machine_name = 'brandstore'; $argument[1] = core_utilities_get_term_id($term_name, $vocabulary_machine_name); $argument[2] = $argument[1]; $view = views_get_view('promotional_catalog_carousel'); if ($view) { print $view->preview('block_3', $argument); } } ?> </div> <?php } ?> <?php } ?> <div id="store-events-block" class="block-wrapper"> <?php
<div class="status context_item"> <em class="s5"> </em> </div> <div class="person context_item last"> <?php echo $submitted; ?> </div> </div> <div class="comments"> <div id="<?php echo $nid; ?> -comments" class="all-comments"> <?php $view = views_get_view('inline_comments_for'); $view->set_arguments(array($nid)); $view->execute(); if (count($view->result)) { foreach ($view->result as $comment) { $node = node_load($comment->nid); ?> <div class="comment"> <p><?php echo $node->body; ?> </p> <p class="by">by <a href="/user/<?php echo $node->uid; ?> /<?php
function _views_embed_view($name, $display_id = 'default', $args) { $view = views_get_view($name); return $view->preview($display_id, $args); }
} $output .= "</div></div>"; } $output .= "</div>"; $output .= "<!-- MIKROARTIKLER S**T -->"; } // SAMLET DOKUMENT if (!empty($content['field_os2web_meetings_full_doc'])) { if (strtolower($node->field_os2web_meetings_type['und'][0]['value']) == "dagsorden") { $output .= "<p><br /><a href=\"" . render($content['field_os2web_meetings_full_doc']) . "\" title=\"Hent dagsordenen for mødet som et samlet dokument\">Hent dagsordenen for mødet som et samlet dokument</a></p>"; } else { $output .= "<p><br /><a href=\"" . render($content['field_os2web_meetings_full_doc']) . "\" title=\"Hent referatet for mødet som et samlet dokument\">Hent referatet for mødet som et samlet dokument</a></p>"; } } // MIKROARTIKLER - TILLÆGSDAGSORDENPUNKTER $view = views_get_view('dagsorden'); $view->set_display('dagsorden_tillaeg', $node->nid); $tillaegspunkter = $view->render(); sizeof($view->result); //$tillaeg = views_embed_view('dagsorden','default', $node->nid); if (sizeof($view->result) > 0) { // Der returneres en eller flere records $output .= "<!-- MIKROARTIKLER TILLÆG START -->"; $output .= "<h2>Tillægssager</h2>"; $output .= "<div class=\"microArticleContainer\">"; $output .= $tillaegspunkter; $output .= "</div>"; $output .= "<!-- MIKROARTIKLER TILLÆG S**T -->"; } // MIDLERTIDIGT OUTPUT // $output .= "<p>field_os2web_meetings_id = " . $node->field_os2web_meetings_id['und'][0]['value'] . "</p>";
/** * Implements hook_preprocess(). */ function islandora_camp_preprocess_islandora_basic_collection_wrapper(&$variables) { // In the collection wrapper preprocess, we will add the collection thumb, // islandora simple search block, collection metadata and a view rendered // dynamically. // COLLECTION METADATA: // Include the required metadata functionality. module_load_include('inc', 'islandora', 'includes/metadata'); // Be sure to add the required Drupal libraries for the metadata form. drupal_add_js('misc/form.js'); drupal_add_js('misc/collapse.js'); // Set our metadata variable to be printed in the template. $variables['collection_metadata'] = islandora_retrieve_metadata_markup($variables['islandora_object']); // Grab our pid for use as we work in this preprocess function $pid = $variables['islandora_object']->{'id'}; // Add theme hook suggestions. // Theme hook suggestions are not provided in the islandora_basic_collection solution pack, so we // can add our own in the template. See the preprocessing function below // 'islandora_camp_preprocess_islandora_basic_collection_wrapper__islandora_sp_basic_image_collection' // to add custom variables to this template. $variables['theme_hook_suggestions'][] = 'islandora_basic_collection_wrapper__' . str_replace(':', '_', $pid); foreach ($variables['theme_hook_suggestions'] as $theme_hook_preprocess) { // Construct preprocess functions individually per theme hook suggestion, // As we may want to add more in the future. $function = 'islandora_camp_preprocess_' . $theme_hook_preprocess; if (function_exists($function)) { $function($variables); } } // Retrieve our theme settings $advanced_collection_pids = theme_get_setting('advanced_collection_view', 'islandora_camp'); $collection_pids = str_getcsv($advanced_collection_pids, ","); // Apply our intended 'Advanced collection' view to the selected pids, or to // All collections depending on the theme settings. if (in_array($pid, $collection_pids) || in_array("all", $collection_pids)) { // Set out as catch all, in-case our view is not around. if (module_exists('owlcarousel')) { //First create a view object for the given view // TODO: Could move this to the theme settings, specifying what view shows on the // collection level page why not? $view = views_get_view('collection_level_view'); if (isset($view)) { // If our view exists, then set the display. $view->set_display('block'); // Before applying filter we have got its structure and apply values on it. $filter1 = $view->get_item('block', 'filter', 'RELS_EXT_isMemberOfCollection_uri_mt'); // Only looking for members of this collection object. Do not need to check it's // CModels as we are already in the islandora_basic_collection_wrapper preprocess // function. $filter1['value'] = $pid; // Apply our dynamic filter to our view $view->set_item('block', 'filter', 'RELS_EXT_isMemberOfCollection_uri_mt', $filter1); // Execute and prepare the view. $view->pre_execute(); $view->execute(); // Rendering will return the HTML of the the view $output = $view->render(); // Passing this as array, perhaps add more, like custom title or the like? $variables['advanced_collection_view'] = $output; } } } // Show islandora simple search if selected in theme settings. $show_search = theme_get_setting('advanced_collection_search_view', 'islandora_camp'); if (isset($show_search) && $show_search > 0) { module_load_include('inc', 'islandora_solr', 'includes/blocks'); // Use native solr functionality in includes/blocks to render // 'islandora_solr_search' provided block CONTENT $simple_search_block = islandora_solr_block_view('simple'); // Render any old block with this theme's 'block render' helper function. $simple_search_block = islandora_camp_block_render('islandora_solr', 'simple'); $variables['islandora_custom_simple_search'] = $simple_search_block; //render($simple_search_block['content']); } }
/** * Helper function * used in covidien_theme_preprocess_person_node_form, covidien_theme_preprocess_user_register */ function getAccountNames($var) { if (empty($var)) { return array('' => ''); } $view = views_get_view('account_number_map_customer_file'); $view->init_display(); $view->pre_execute(array($var)); $view->execute(); $result = $view->result; $array[''] = ''; if (count($result) > 0) { foreach ($result as $rec) { $nid = $rec->nid; $account = $rec->node_data_field_customer_party_pk_field_bu_customer_account_number_value; $array[$nid] = $account; } } return $array; }
* When fetching output from the $row, this construct should be used: * $data = $row->{$field->field_alias} * * The above will guarantee that you'll always get the correct data, * regardless of any changes in the aliasing that might happen if * the view is modified. */ // Correcting the arabic text display in Chrome $var="<span class='sign1'> </span>"; if(arg(4)!=1 && arg(4)!=9 && !($_SESSION['arabicqry'])) { $_SESSION['arabicqry']=0; $viewName = 'arabic_text'; $view_11 = views_get_view($viewName); $view_11->set_display('default'); $view_11->set_arguments(array(1,1,arg(5))); $view_11->execute(); $result_11 = $view_11->result; $exp = explode($result_11[0]->node_revisions_body,$output); if($exp[1]!="") { print $exp[1]; // wrap the text } else { print $output; } } else
/** * {@inheritdoc} */ public function optionsForm(&$form, &$form_state) { $options = array(); $views = openalyers_views_get_views('openlayers_map_views'); foreach ($views as $view_settings) { list($view_name, $display) = $view_settings; $view = views_get_view($view_name); $view->set_display($display); $options[$view_name . ':' . $display] = t('View: @view - Display: @display', array('@view' => $view->name, '@display' => $display)); } $form['options']['views_display'] = array('#type' => 'select', '#title' => t('Source View'), '#options' => $options, '#default_value' => $this->getOption('views_display')); parent::optionsForm($form, $form_state); }
</div> </div> <!-- Rounded Top Brick --> <div class="container-fluid brick rounded-top"> <div class="row"> <!--count the number of programs in search result--> <?php /*getting the term id from term name */ $term_array = taxonomy_get_term_by_name($_GET['interest1']); $term = reset($term_array); # get the first element of the array which is our term object $arg1 = $term->tid; $term_array = taxonomy_get_term_by_name($_GET['interest2']); $term = reset($term_array); $arg2 = $term->tid; $view = views_get_view('ucgy_program_compare_view'); $view->set_display('block'); $view->set_arguments(array($arg1 . '+' . $arg2)); $current_student = _ucgy_programs_get_session('student'); $current_curriculum = _ucgy_programs_get_session('curriculum'); $view->exposed_input['field_requirement_student_type_target_id'] = $current_student; $view->exposed_input['field_requirement_curriculum_target_id'] = $current_curriculum; $view->execute(); $count = count($view->result); ?> <!-- Program List Brick (Large Tiles) --> <div class="container brick program-list"> <div class="row header"> <div class="col-md-6"> <h3>UCalgary’s programs <span class="counter">(viewing <span id="view-count"><?php print $count;
function unity_lab_it_preprocess_node_software_title(&$vars, $hook) { $relatedNodeIds = $vars['field_computer_lab_nodes']; $nodeIds = array(); foreach ($relatedNodeIds as $relatedNodeId) { $nodeIds[] = $relatedNodeId['target_id']; } if (count($nodeIds) > 0) { $relatedNodes = entity_load('node', $nodeIds); $items = array(); foreach ($relatedNodes as $relatedNode) { $logo = field_get_items('node', $relatedNode, 'field_logo'); if ($logo) { $logo_render = field_view_value('node', $relatedNode, 'field_logo', $logo[0]); //$logo_render['#item']["attributes"]["class"] = array('flat-circle-image'); $item['image'] = $logo_render; } else { $item['image'] = ''; } $item['url'] = url('node/' . $relatedNode->nid); $item['title'] = $relatedNode->title; $rnIntroduction = field_get_items('node', $relatedNode, 'field_introduction'); $rnIntroduction = empty($rnIntroduction[0]['value']) ? '' : $rnIntroduction[0]['value']; $item['introduction'] = $rnIntroduction; $vars['content']['labs'][] = $item; } } _unity_lab_paragraphs_item_column_classes($vars, $vars['content']['labs'], 1); $view = views_get_view('related_kb_articles'); $output = $view->preview('block_3'); // At least in $view->result is the result. if ($view->result) { $vars['content']['faqView'] = $output; } if (arg(0) == 'node' && is_numeric(arg(1))) { // creating the node variable $node = node_load(arg(1), NULL, TRUE); } $reportProbURL = field_get_items('node', $node, 'field_report_a_problem_url'); $reportProbURL = empty($reportProbURL[0]['url']) ? '' : $reportProbURL[0]['url']; if ($reportProbURL) { $vars['content']['reportProbURL'] = $reportProbURL; } }