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


PHP Horde_View::addTemplatePath方法代码示例

本文整理汇总了PHP中Horde_View::addTemplatePath方法的典型用法代码示例。如果您正苦于以下问题:PHP Horde_View::addTemplatePath方法的具体用法?PHP Horde_View::addTemplatePath怎么用?PHP Horde_View::addTemplatePath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Horde_View的用法示例。


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

示例1: __construct

 /**
  * Const'r
  *
  * @param array $params  Any parameters that the view might need.
  * <pre>
  *  In addition to the params taken by Ansel_View_Gallery, this view
  *  can also take:
  *
  *  groupby      -  Group the results (owner)
  *
  *  owner        -  The owner to group by
  *
  *  tags         -  Limit to galleries matching tags
  *
  *  gallery_ids  -  No fitering, just show these galleries
  *
  *  pager_url    -  The url for the pager to use see Ansel_Gallery for
  *                  more information on the url parameters.
  */
 public function __construct(array $params = array())
 {
     global $prefs, $notification, $registry;
     parent::__construct($params);
     $ansel_storage = $GLOBALS['injector']->getInstance('Ansel_Storage');
     // View
     $this->_view = $GLOBALS['injector']->createInstance('Horde_View');
     $this->_view->addTemplatePath(ANSEL_TEMPLATES . '/view');
     $this->_view->sortBy = !empty($this->_params['sort']) ? $this->_params['sort'] : 'name';
     $this->_view->sortDir = isset($this->_params['sort_dir']) ? $this->_params['sort_dir'] : 0;
     // Check for grouping.
     if (empty($this->_params['groupby'])) {
         $this->_view->groupby = Horde_Util::getFormData('groupby', $prefs->getValue('groupby'));
     } else {
         $this->_view->groupby = $this->_params['groupby'];
     }
     $this->_view->gPerPage = $prefs->getValue('tilesperpage');
     // Listing a single user?
     if (empty($this->_params['owner'])) {
         $this->_owner = Horde_Util::getFormData('owner');
         $this->_owner = empty($this->_owner) ? null : $this->_owner;
     } else {
         $this->_owner = $this->_params['owner'];
     }
     // Special?
     $this->_special = Horde_Util::getFormData('special');
     if (!$this->_owner && !$this->_special && $this->_view->groupby != 'none') {
         Ansel::getUrlFor('group', array('groupby' => $this->_view->groupby))->redirect();
         exit;
     }
     // If we aren't supplied with a page number, default to page 0.
     if (isset($this->_params['page'])) {
         $this->_page = $this->_params['page'];
     } else {
         $this->_page = Horde_Util::getFormData('page', 0);
     }
     // If we are calling from the api, we can just pass a list of ids
     if (!empty($this->_params['api']) && is_array($this->_params['gallery_ids'])) {
         $this->_view->start = $this->_page * $this->_view->gPerPage;
         $this->_view->numGalleries = count($this->_params['gallery_ids']);
         if ($this->_view->numGalleries > $this->_view->start) {
             $getThese = array_slice($this->_params['gallery_ids'], $this->_view->start, $this->_view->gPerPage);
             $this->_view->galleryList = $ansel_storage->getGalleries($getThese);
         } else {
             $this->_view->galleryList = array();
         }
     } else {
         // Set list filter/title
         $filter = array();
         if (!is_null($this->_owner)) {
             $filter['owner'] = $this->_owner;
         }
         $this->_view->numGalleries = $ansel_storage->countGalleries($registry->getAuth(), array('attributes' => $filter, 'all_levels' => false, 'tags' => !empty($params['tags']) ? $params['tags'] : null));
         if ($this->_view->numGalleries == 0 && empty($this->_params['api'])) {
             if ($this->_owner && $this->_owner == $registry->getAuth()) {
                 $notification->push(_("You have no photo galleries, add one!"), 'horde.message');
                 Horde::url('gallery.php')->add('actionID', 'add')->redirect();
                 exit;
             }
             $notification->push(_("There are no photo galleries available."), 'horde.message');
             $this->_view->galleryList = array();
         } else {
             $this->_view->galleryList = $ansel_storage->listGalleries(array('attributes' => $filter, 'all_levels' => false, 'from' => $this->_page * $this->_view->gPerPage, 'count' => $this->_view->gPerPage, 'sort_by' => $this->_view->sortBy, 'direction' => $this->_view->sortDir, 'tags' => !empty($params['tags']) ? $params['tags'] : null));
         }
     }
 }
开发者ID:horde,项目名称:horde,代码行数:85,代码来源:List.php


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