当前位置: 首页>>代码示例>>PHP>>正文


PHP views_get_view函数代码示例

本文整理汇总了PHP中views_get_view函数的典型用法代码示例。如果您正苦于以下问题:PHP views_get_view函数的具体用法?PHP views_get_view怎么用?PHP views_get_view使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了views_get_view函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: storyscopezen_preprocess_page

/**
 * 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);
            }
        }
    }
}
开发者ID:bridharr,项目名称:storyscope-lite,代码行数:38,代码来源:template.php

示例2: init

 /**
  * @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();
 }
开发者ID:akapivo,项目名称:www.dmi.be,代码行数:28,代码来源:Views.php

示例3: loadView

 /**
  * 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");
 }
开发者ID:pounard,项目名称:yamm,代码行数:16,代码来源:Views.php

示例4: __construct

 /**
  * 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!');
     }
 }
开发者ID:ryne-andal,项目名称:ablecore,代码行数:15,代码来源:View.php

示例5: getView

 /**
  * 
  */
 public function getView($name, $display)
 {
     $view = \views_get_view($name);
     $view->set_display($display);
     $view->pre_execute();
     $view->execute();
     return $view->render();
 }
开发者ID:saarmstrong,项目名称:erdiko-drupal,代码行数:11,代码来源:View.php

示例6: quick_search_example_qs_callback

/**
 * 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;
}
开发者ID:anselmbradford,项目名称:OpenSanMateo,代码行数:17,代码来源:quick_search.api.php

示例7: getCartView

 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;
 }
开发者ID:redcrackle,项目名称:redtest-core,代码行数:14,代码来源:CommerceCartForm.php

示例8: __construct

 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);
 }
开发者ID:vishalred,项目名称:redtest-core-pw,代码行数:15,代码来源:View.php

示例9: hook_coffee_commands

/**
 * 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;
}
开发者ID:Probo-Demos,项目名称:drupal_github,代码行数:24,代码来源:coffee.api.php

示例10: __construct

 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);
 }
开发者ID:redcrackle,项目名称:redtest-core,代码行数:20,代码来源:View.php

示例11: initializeView

 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;
 }
开发者ID:TabulaData,项目名称:donl_d7,代码行数:20,代码来源:EntityReference_SelectionHandler_Views.class.php

示例12: uconn_theme_preprocess_islandora_basic_collection_wrapper

/**
 * 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;
    }
}
开发者ID:CTDA,项目名称:uconn_theme,代码行数:23,代码来源:template.php

示例13: _objectLoad

 /**
  * (non-PHPdoc)
  * @see Yamm_Entity::_objectLoad()
  */
 protected function _objectLoad($identifier)
 {
     views_include('view');
     return views_get_view($identifier, TRUE)->export();
 }
开发者ID:pounard,项目名称:yamm,代码行数:9,代码来源:View.php

示例14: views_ui_clone_form

/**
 * 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;
}
开发者ID:e-gob,项目名称:GuiaDigital,代码行数:30,代码来源:views_ui.class.php

示例15: futurium_isa_theme_quant_page

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>';
}
开发者ID:ec-europa,项目名称:futurium-features,代码行数:67,代码来源:template.php


注:本文中的views_get_view函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。