本文整理汇总了PHP中JemHelper::getAttendeesNumbers方法的典型用法代码示例。如果您正苦于以下问题:PHP JemHelper::getAttendeesNumbers方法的具体用法?PHP JemHelper::getAttendeesNumbers怎么用?PHP JemHelper::getAttendeesNumbers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JemHelper
的用法示例。
在下文中一共展示了JemHelper::getAttendeesNumbers方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getItems
/**
* Method to get a list of events.
*/
public function getItems()
{
$items = parent::getItems();
if (empty($items)) {
return array();
}
$user = JemFactory::getUser();
$userId = $user->get('id');
$guest = $user->get('guest');
$groups = $user->getAuthorisedViewLevels();
$input = JFactory::getApplication()->input;
$calendarMultiday = $this->getState('filter.calendar_multiday');
# Get the global params
$globalParams = JComponentHelper::getParams('com_jem', true);
# Convert the parameter fields into objects.
foreach ($items as $index => $item)
{
$eventParams = new JRegistry;
$eventParams->loadString($item->attribs);
$item->params = clone $this->getState('params');
$item->params->merge($eventParams);
# adding categories
$item->categories = $this->getCategories($item->id);
# check if the item-categories is empty, if so the user has no access to that event at all.
if (empty($item->categories)) {
unset ($items[$index]);
} else {
# write access permissions.
$item->params->set('access-edit', $user->can('edit', 'event', $item->id, $item->created_by));
}
} // foreach
if ($items) {
/*$items =*/ JemHelper::getAttendeesNumbers($items);
if ($calendarMultiday) {
$items = self::calendarMultiday($items);
}
}
return $items;
}
示例2: getItems
/**
* Method to get a list of events.
*/
public function getItems()
{
$items = parent::getItems();
if ($items) {
$app = JFactory::getApplication();
$user = JFactory::getUser();
$userId = $user->get('id');
$guest = $user->get('guest');
$groups = $user->getAuthorisedViewLevels();
$input = JFactory::getApplication()->input;
$calendarMultiday = $this->getState('filter.calendar_multiday');
# Convert the parameter fields into objects.
foreach ($items as $index => $item) {
$eventParams = new JRegistry();
$eventParams->loadString($item->attribs);
if ($this->getState('params')) {
$item->params = clone $this->getState('params');
} else {
$params = new JRegistry();
$item->params = $params;
}
$item->params->merge($eventParams);
# access permissions.
if (!$guest) {
$asset = 'com_jem.event.' . $item->id;
# Check general edit permission first.
if ($user->authorise('core.edit', $asset)) {
$item->params->set('access-edit', true);
} elseif (!empty($userId) && $user->authorise('core.edit.own', $asset)) {
# Check for a valid user and that they are the owner.
if ($userId == $item->created_by) {
$item->params->set('access-edit', true);
}
}
}
# adding categories
$item->categories = $this->getCategories($item->id);
# retrieving filter-access
$access = $this->getState('filter.access');
if ($access) {
// If the access filter has been set, we already have only the events this user can view.
$item->params->set('access-view', true);
} else {
$user = JFactory::getUser();
$groups = $user->getAuthorisedViewLevels();
$item->params->set('access-view', in_array($item->access, $groups));
}
# check if the item-categories is empty, if so the user has no access to that event at all.
if (empty($item->categories)) {
unset($items[$index]);
}
}
if ($items) {
$items = JemHelper::getAttendeesNumbers($items);
if ($calendarMultiday) {
$items = self::calendarMultiday($items);
}
}
return $items;
} else {
return array();
}
}