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


PHP FRoute::getItemId方法代码示例

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


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

示例1: getUsers

 /**
  * Retrieves the list of users on the site.
  *
  * @since	1.0
  * @access	public
  */
 public function getUsers()
 {
     // Check for request forgeries
     FD::checkToken();
     // Get the current filter
     $filter = $this->input->get('filter', 'all', 'word');
     // Get the current sorting
     $sort = $this->input->get('sort', $this->config->get('users.listings.sorting'), 'word');
     $isSort = $this->input->get('isSort', false, 'bool');
     $showPagination = $this->input->get('showpagination', 0, 'default');
     $model = FD::model('Users');
     $options = array('exclusion' => $this->my->id);
     if ($sort == 'alphabetical') {
         $nameField = $this->config->get('users.displayName') == 'username' ? 'a.username' : 'a.name';
         $options['ordering'] = $nameField;
         $options['direction'] = 'ASC';
     } elseif ($sort == 'latest') {
         $options['ordering'] = 'a.id';
         $options['direction'] = 'DESC';
     } elseif ($sort == 'lastlogin') {
         $options['ordering'] = 'a.lastvisitDate';
         $options['direction'] = 'DESC';
     }
     if ($filter == 'online') {
         $options['login'] = true;
     }
     if ($filter == 'photos') {
         $options['picture'] = true;
     }
     // setup the limit
     $limit = FD::themes()->getConfig()->get('userslimit');
     $options['limit'] = $limit;
     // Determine if we should display admins
     $admin = $this->config->get('users.listings.admin') ? true : false;
     $options['includeAdmin'] = $admin;
     // we only want published user.
     $options['published'] = 1;
     // exclude users who blocked the current logged in user.
     $options['excludeblocked'] = 1;
     $result = $model->getUsers($options);
     $pagination = null;
     if ($showPagination) {
         $pagination = $model->getPagination();
         // Define those query strings here
         $pagination->setVar('Itemid', FRoute::getItemId('users'));
         $pagination->setVar('view', 'users');
         $pagination->setVar('filter', $filter);
         $pagination->setVar('sort', $sort);
     }
     $users = array();
     // preload users.
     $arrIds = array();
     foreach ($result as $obj) {
         $arrIds[] = FD::user($obj->id);
     }
     if ($arrIds) {
         FD::user($arrIds);
     }
     foreach ($result as $obj) {
         $users[] = FD::user($obj->id);
     }
     return $this->view->call(__FUNCTION__, $users, $isSort, $pagination);
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:69,代码来源:users.php

示例2:

			<?php 
if ($search) {
    ?>
			<div class="fd-navbar-search pull-right" data-nav-search>
				<form action="<?php 
    echo JRoute::_('index.php');
    ?>
" method="post">
					<i class="ies-search"></i>
					<input type="text" name="q" class="search-query" autocomplete="off" data-nav-search-input placeholder="<?php 
    echo JText::_('COM_EASYSOCIAL_TOOLBAR_SEARCH', true);
    ?>
" />

					<?php 
    echo $this->html('form.itemid', FRoute::getItemId('search'));
    ?>
					<input type="hidden" name="view" value="search" />
					<input type="hidden" name="option" value="com_easysocial" />
				</form>
			</div>
			<?php 
}
?>

			<ul class="fd-nav pull-right">
				<?php 
if ($this->my->guest && $login) {
    ?>
				<li class="dropdown_">
					<?php 
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:31,代码来源:default.php

示例3: getGroups

 /**
  * Allows caller to retrieve groups
  *
  * @since	1.2
  * @access	public
  * @param	string
  * @return
  */
 public function getGroups()
 {
     // Check for request forgeries
     FD::checkToken();
     // Get the current view
     $view = $this->getCurrentView();
     // Check if the caller passed us a category id.
     $categoryId = $this->input->get('categoryId', 0, 'int');
     // Load up the model
     $model = FD::model('Groups');
     // Filter
     $filter = $this->input->get('filter', '', 'cmd');
     // Options
     $options = array('state' => SOCIAL_CLUSTER_PUBLISHED);
     // Default values
     $groups = array();
     $featuredGroups = array();
     if ($filter == 'featured') {
         // Get a list of featured groups
         $options['featured'] = true;
         $featuredGroups = $model->getGroups($options);
     } else {
         // Determine the pagination limit
         $limit = FD::themes()->getConfig()->get('groups_limit', 20);
         $options['limit'] = $limit;
         if ($filter == 'mine') {
             $options['uid'] = FD::user()->id;
             $options['types'] = 'all';
         }
         if ($filter == 'invited') {
             $options['invited'] = FD::user()->id;
             $options['types'] = 'all';
         }
         if ($categoryId) {
             $options['category'] = $categoryId;
         }
         // Get the groups
         $groups = $model->getGroups($options);
     }
     // Get the pagination
     $pagination = $model->getPagination();
     // Define those query strings here
     $pagination->setVar('Itemid', FRoute::getItemId('groups'));
     $pagination->setVar('view', 'groups');
     $pagination->setVar('filter', $filter);
     if (isset($options['category'])) {
         $groupCat = FD::table('GroupCategory');
         $groupCat->load($options['category']);
         $pagination->setVar('categoryid', $groupCat->getAlias());
     }
     return $view->call(__FUNCTION__, $groups, $pagination, $featuredGroups);
 }
开发者ID:ppantilla,项目名称:bbninja,代码行数:60,代码来源:groups.php

示例4:

		<div class="es-widget">

			<div class="es-navbar-search" data-mod-search>
				<form action="<?php 
echo JRoute::_('index.php');
?>
" method="post">
					<input type="text" name="q" class="form-control input-sm" autocomplete="off" data-nav-search-input placeholder="<?php 
echo JText::_('MOD_EASYSOCIAL_SEARCH_PHASE', true);
?>
" />

					<input type="hidden" name="view" value="search" />
					<input type="hidden" name="option" value="com_easysocial" />
					<input type="hidden" name="Itemid" value="<?php 
echo FRoute::getItemId('search');
?>
" />
					<?php 
echo $modules->html('form.token');
?>
				</form>
			</div>
			<div class="mt-5 mr-10 fd-cf">
				<a class="pull-right fd-small" href="<?php 
echo FRoute::search(array('layout' => 'advanced'));
?>
"><?php 
echo JText::_('MOD_EASYSOCIAL_SEARCH_ADVANCED_SEARCH');
?>
</a>
开发者ID:ppantilla,项目名称:bbninja,代码行数:31,代码来源:default.php

示例5: search

 /**
  * Displays a list of users on the site from dating search module
  *
  * @access	public
  * @param	string	The name of the template file to parse; automatically searches through the template paths.
  * @return	null
  */
 public function search($tpl = null)
 {
     // Check for user profile completeness
     FD::checkCompleteProfile();
     // Retrieve the users model
     $model = FD::model('Users');
     $my = FD::user();
     $config = FD::config();
     $admin = $config->get('users.listings.admin') ? true : false;
     $options = array('includeAdmin' => $admin);
     $limit = FD::themes()->getConfig()->get('userslimit');
     $options['limit'] = $limit;
     // Default title
     $title = JText::_('COM_EASYSOCIAL_PAGE_TITLE_USERS');
     $post = JRequest::get('POSTS');
     // echo '<pre>';print_r( $post );echo '</pre>';
     // Get values from posted data
     $values = array();
     $values['criterias'] = JRequest::getVar('criterias');
     $values['datakeys'] = JRequest::getVar('datakeys');
     $values['operators'] = JRequest::getVar('operators');
     $values['conditions'] = JRequest::getVar('conditions');
     // echo '<pre>';print_r( $values );echo '</pre>';
     $searchOptions = array();
     // lets do some clean up here.
     for ($i = 0; $i < count($values['criterias']); $i++) {
         $criteria = $values['criterias'][$i];
         $condition = $values['conditions'][$i];
         $datakey = $values['datakeys'][$i];
         $operator = $values['operators'][$i];
         if (trim($condition)) {
             $searchOptions['criterias'][] = $criteria;
             $searchOptions['datakeys'][] = $datakey;
             $searchOptions['operators'][] = $operator;
             $field = explode('|', $criteria);
             $fieldCode = $field[0];
             $fieldType = $field[1];
             if ($fieldType == 'birthday') {
                 // currently the value from form is in age format. we need to convert it into date time.
                 $ages = explode('|', $condition);
                 if (!isset($ages[1])) {
                     // this happen when start has value and end has no value
                     $ages[1] = $ages[0];
                 }
                 if ($ages[1] && !$ages[0]) {
                     //this happen when start is empty and end has value
                     $ages[0] = $ages[1];
                 }
                 $startdate = '';
                 $enddate = '';
                 $currentTimeStamp = FD::date()->toUnix();
                 if ($ages[0] == $ages[1]) {
                     $start = strtotime('-' . $ages[0] . ' years', $currentTimeStamp);
                     $year = FD::date($start)->toFormat('Y');
                     $startdate = $year . '-01-01 00:00:01';
                     $enddate = FD::date($start)->toFormat('Y-m-d') . ' 23:59:59';
                 } else {
                     if ($ages[0]) {
                         $start = strtotime('-' . $ages[0] . ' years', $currentTimeStamp);
                         $year = FD::date($start)->toFormat('Y');
                         $enddate = $year . '-12-31 23:59:59';
                     }
                     if ($ages[1]) {
                         $end = strtotime('-' . $ages[1] . ' years', $currentTimeStamp);
                         $year = FD::date($end)->toFormat('Y');
                         $startdate = $year . '-01-01 00:00:01';
                     }
                 }
                 $condition = $startdate . '|' . $enddate;
             }
             $searchOptions['conditions'][] = $condition;
         }
     }
     $pagination = null;
     $result = null;
     $users = array();
     if ($searchOptions) {
         $searchOptions['match'] = 'all';
         $searchOptions['avatarOnly'] = false;
         // Retrieve the users
         $result = $model->getUsersByFilter('0', $options, $searchOptions);
         // $result		= array();
         $pagination = $model->getPagination();
         $pagination->setVar('Itemid', FRoute::getItemId('users'));
         $pagination->setVar('view', 'users');
         $pagination->setVar('layout', 'search');
         $pagination->setVar('filter', 'search');
         for ($i = 0; $i < count($values['criterias']); $i++) {
             $criteria = $values['criterias'][$i];
             $condition = $values['conditions'][$i];
             $datakey = $values['datakeys'][$i];
             $operator = $values['operators'][$i];
             $field = explode('|', $criteria);
//.........这里部分代码省略.........
开发者ID:ppantilla,项目名称:bbninja,代码行数:101,代码来源:view.html.php

示例6: getEvents


//.........这里部分代码省略.........
     if ($filter === 'date') {
         // Depending on the input format.
         // Could be by year, year-month or year-month-day
         $now = FD::date();
         list($nowYMD, $nowHMS) = explode(' ', $now->toSql(true));
         $input = $this->input->getString('date');
         // We need segments to be populated. If no input is passed, then it is today, and we use today as YMD then
         if (empty($input)) {
             $input = $nowYMD;
         }
         $segments = explode('-', $input);
         $start = $nowYMD;
         $end = $nowYMD;
         // Depending on the amount of segments
         // 1 = filter by year
         // 2 = filter by month
         // 3 = filter by day
         $mode = count($segments);
         switch ($mode) {
             case 1:
                 $start = $segments[0] . '-01-01';
                 $end = $segments[0] . '-12-31';
                 break;
             case 2:
                 $start = $segments[0] . '-' . $segments[1] . '-01';
                 // Need to get the month's maximum day
                 $monthDate = FD::date($start);
                 $maxDay = $monthDate->format('t');
                 $end = $segments[0] . '-' . $segments[1] . '-' . str_pad($maxDay, 2, '0', STR_PAD_LEFT);
                 break;
             default:
             case 3:
                 $start = $segments[0] . '-' . $segments[1] . '-' . $segments[2];
                 $end = $segments[0] . '-' . $segments[1] . '-' . $segments[2];
                 break;
         }
         $options['start-after'] = $start . ' 00:00:00';
         $options['start-before'] = $end . ' 23:59:59';
     }
     if ($filter === 'week1') {
         $now = FD::date();
         $week1 = FD::date($now->toUnix() + 60 * 60 * 24 * 7);
         $options['start-after'] = $now->toSql();
         $options['start-before'] = $week1->toSql();
     }
     if ($filter === 'week2') {
         $now = FD::date();
         $week2 = FD::date($now->toUnix() + 60 * 60 * 24 * 14);
         $options['start-after'] = $now->toSql();
         $options['start-before'] = $week2->toSql();
     }
     if ($filter === 'nearby') {
         $distance = $this->input->getString('distance');
         if (empty($distance)) {
             $distance = 10;
         }
         $options['location'] = true;
         $options['distance'] = $distance;
         $options['latitude'] = $this->input->getString('latitude');
         $options['longitude'] = $this->input->getString('longitude');
         $options['range'] = '<=';
         // We do not want to include past events here
         if (!$includePast) {
             $options['ongoing'] = true;
             $options['upcoming'] = true;
         }
         $session = JFactory::getSession();
         $userLocation = $session->get('events.userlocation', array(), SOCIAL_SESSION_NAMESPACE);
         $hasLocation = !empty($userLocation) && !empty($userLocation['latitude']) && !empty($userLocation['longitude']);
         if (!$hasLocation) {
             $userLocation['latitude'] = $options['latitude'];
             $userLocation['longitude'] = $options['longitude'];
             $session->set('events.userlocation', $userLocation, SOCIAL_SESSION_NAMESPACE);
         }
     }
     $events = $model->getEvents($options);
     // Load up the pagination
     $pagination = $model->getPagination();
     $pagination->setVar('Itemid', FRoute::getItemId('events'));
     $pagination->setVar('view', 'events');
     $pagination->setVar('filter', $filter);
     if ($includePast) {
         $pagination->setVar('includePast', $includePast);
     }
     if ($ordering != 'start') {
         $pagination->setVar('ordering', $ordering);
     }
     if ($activeCategory) {
         $pagination->setVar('categoryid', $activeCategory->id);
     }
     $dateInput = $this->input->getString('date');
     if (!empty($dateInput)) {
         $pagination->setVar('date', $dateInput);
     }
     $distanceInput = $this->input->getString('distance');
     if (!empty($distanceInput)) {
         $pagination->setVar('distance', $distanceInput);
     }
     return $this->view->call(__FUNCTION__, $filter, $events, $pagination, $activeCategory, $featuredEvents);
 }
开发者ID:knigherrant,项目名称:decopatio,代码行数:101,代码来源:events.php

示例7: route

 /**
  * Builds the URLs for apps view
  *
  * @since   1.0
  * @access  public
  * @param   array   An array of request arguments
  * @param   bool    Determines if the url should be xhtml compliant
  * @return  url     The string of the URL
  */
 public function route($options = array(), $xhtml = true)
 {
     $url = self::$base . '&view=' . $this->name;
     // Custom options
     $ssl = $options['ssl'];
     $tokenize = $options['tokenize'];
     $external = $options['external'];
     $tmpl = $options['tmpl'];
     $sef = $options['sef'];
     $layout = isset($options['layout']) ? $options['layout'] : '';
     // check if the current request is from feed page or not.
     // if yes, let set the external to always true.
     $pageFormat = FD::input()->get('format', '', 'var');
     if (!$external && $pageFormat == 'feed') {
         $external = true;
     }
     // Determines if this is a request to the controller
     $controller = $options['controller'];
     $data = array();
     unset($options['ssl'], $options['tokenize'], $options['external'], $options['tmpl'], $options['controller'], $options['sef']);
     if ($options) {
         foreach ($options as $key => $value) {
             $data[] = $key . '=' . $value;
         }
     }
     $query = $options;
     $options = implode('&', $data);
     $join = !empty($options) ? '&' : '';
     $url = $url . $join . $options;
     // Try to get the url from the adapter
     $overrideUrl = '';
     // Set temporary data
     $query['view'] = $this->name;
     $query['option'] = 'com_easysocial';
     // Ensure that all query values are lowercased
     $query = array_map(array('JString', 'strtolower'), $query);
     // Let's find for a suitable menu
     $view = $this->name;
     $layout = isset($query['layout']) ? $query['layout'] : '';
     $id = isset($query['id']) ? (int) $query['id'] : '';
     // For photos and albums, we want to fetch menu from "All Albums"
     if ($view == 'photos' || $view == 'albums') {
         $view = 'albums';
         $layout = 'all';
         $id = '';
     }
     $menuId = FRoute::getItemId($view, $layout, $id);
     if ($menuId) {
         $menu = JFactory::getApplication()->getMenu()->getItem($menuId);
         if ($menu) {
             $current = $menu->query;
             if (isset($current['id']) && !empty($current['id'])) {
                 $current['id'] = (int) $current['id'];
             }
             if (isset($query['id'])) {
                 $query['id'] = (int) $query['id'];
             }
             $hasDiff = array_diff($query, $current);
             // // If there's no difference in both sets of query, we can safely assume that there's already
             // // a menu for this link
             if (empty($hasDiff)) {
                 $overrideUrl = 'index.php?Itemid=' . $menuId;
             }
             //$overrideUrl    = 'index.php?Itemid=' . $menuId;
         }
     }
     // If there are no overriden url's, we append our own item id.
     if ($overrideUrl) {
         $url = $overrideUrl;
     } else {
         // If there is no getUrl method, we want to get the default item id.
         if ($menuId) {
             $url .= '&Itemid=' . $menuId;
         } else {
             $url .= '&Itemid=' . FRoute::getItemId($view, $layout);
         }
     }
     return FRoute::_($url, $xhtml, array(), $ssl, $tokenize, $external, $tmpl, $controller, $sef);
 }
开发者ID:BetterBetterBetter,项目名称:B3App,代码行数:88,代码来源:router.php


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