本文整理汇总了PHP中Phpfox::getuserId方法的典型用法代码示例。如果您正苦于以下问题:PHP Phpfox::getuserId方法的具体用法?PHP Phpfox::getuserId怎么用?PHP Phpfox::getuserId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Phpfox
的用法示例。
在下文中一共展示了Phpfox::getuserId方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: process
public function process()
{
if (!Phpfox::getParam('friend.enable_birthday_notices')) {
return false;
}
if (!Phpfox::isUser()) {
return false;
}
$aBirthdays = Friend_Service_Friend::instance()->getBirthdays(Phpfox::getuserId());
$bIsEventSection = true;
/*
$bIsEventSection = (Phpfox_Module::instance()->getFullControllerName() == 'event.index' ? true : false);
if (!Phpfox::isModule('event'))
{
$bIsEventSection = true;
}
*/
if ($bIsEventSection && empty($aBirthdays) && Phpfox::getParam('friend.show_empty_birthdays') == false) {
return false;
}
$aUpcomingEvents = array();
if (!$bIsEventSection) {
if (Phpfox::isUser()) {
$sEventCacheId = Phpfox::getLib('cache')->set(array('events', Phpfox::getUserId()));
if (!($aUpcomingEvents = Phpfox::getLib('cache')->get($sEventCacheId, Phpfox::getParam('event.cache_upcoming_events_info') * 60))) {
$this->search()->set(array('type' => 'event', 'field' => 'm.event_id', 'search_tool' => array('default_when' => 'upcoming', 'when_field' => 'start_time', 'when_upcoming' => true, 'table_alias' => 'm', 'sort' => array('latest' => array('m.start_time', 'Latest', 'ASC')), 'show' => array(5))));
$aBrowseParams = array('module_id' => 'event', 'alias' => 'm', 'field' => 'event_id', 'table' => Phpfox::getT('event'), 'hide_view' => array('pending', 'my'));
$this->search()->setCondition('AND m.view_id = 0 AND m.privacy IN(%PRIVACY%)');
$this->search()->browse()->params($aBrowseParams)->execute();
$aUpcomingEvents = $this->search()->browse()->getRows();
// http://www.phpfox.com/tracker/view/14796/
// iterate among dates
foreach ($aUpcomingEvents as $sUpcomingDate => $aEvents) {
// iterate among events
foreach ($aEvents as $iKey => $aUpcomingEvent) {
// if the event is in a page
if (Phpfox::isModule('pages') && $aUpcomingEvent['module_id'] == 'pages') {
// if current user is not member or admin, remove the event from the upcoming block
if (!Phpfox::getService('pages')->isMember($aUpcomingEvent['profile_page_id']) && !Phpfox::getService('pages')->isAdmin($aUpcomingEvent['profile_page_id'])) {
// if only one event in the date, erase the date
if (count($aUpcomingEvents[$sUpcomingDate]) == 1) {
unset($aUpcomingEvents[$sUpcomingDate]);
} else {
unset($aUpcomingEvents[$sUpcomingDate][$iKey]);
}
}
}
}
}
Phpfox::getLib('cache')->save($sEventCacheId, $aUpcomingEvents);
}
}
}
$this->template()->assign(array('aSearchTool' => '', 'aUpcomingEvents' => is_bool($aUpcomingEvents) ? array() : $aUpcomingEvents, 'aBirthdays' => $aBirthdays, 'bIsEventSection' => $bIsEventSection, 'sHeader' => $bIsEventSection ? Phpfox::getPhrase('friend.birthdays') : Phpfox::getPhrase('event.upcoming_events')));
return 'block';
}
示例2: process
public function process()
{
if (!Phpfox::getParam('friend.enable_birthday_notices'))
{
return false;
}
if (!Phpfox::isUser())
{
return false;
}
$aBirthdays = Phpfox::getService('friend')->getBirthdays(Phpfox::getuserId());
$bIsEventSection = (Phpfox::getLib('module')->getFullControllerName() == 'event.index' ? true : false);
if (!Phpfox::isModule('event'))
{
$bIsEventSection = true;
}
if ($bIsEventSection && empty($aBirthdays) && (Phpfox::getParam('friend.show_empty_birthdays') == false))
{
return false;
}
$aUpcomingEvents = array();
if (!$bIsEventSection)
{
$this->search()->set(array(
'type' => 'event',
'field' => 'm.event_id',
'search_tool' => array(
'default_when' => 'upcoming',
'when_field' => 'start_time',
'when_upcoming' => true,
'table_alias' => 'm',
'sort' => array(
'latest' => array('m.start_time', 'Latest', 'ASC')
),
'show' => array(5)
)
)
);
$aBrowseParams = array(
'module_id' => 'event',
'alias' => 'm',
'field' => 'event_id',
'table' => Phpfox::getT('event'),
'hide_view' => array('pending', 'my')
);
$this->search()->setCondition('AND m.view_id = 0 AND m.privacy IN(%PRIVACY%) AND m.item_id = 0');
$this->search()->browse()->params($aBrowseParams)->execute();
$aUpcomingEvents = $this->search()->browse()->getRows();
}
$this->template()->assign(array(
'aUpcomingEvents' => $aUpcomingEvents,
'aBirthdays' => $aBirthdays,
'bIsEventSection' => $bIsEventSection,
'sHeader' => ($bIsEventSection ? Phpfox::getPhrase('friend.birthdays') : Phpfox::getPhrase('event.upcoming_events')),
//'sDeleteBlock' => 'dashboard'
)
);
return 'block';
}