» » » Последние события на странице профиля

Последние события на странице профиля

1. Идем по пути AdminCP(Админка) -> Extension -> Language -> Add Phrase. Добавим новую фразу

2. Заполняем форму следующим образом:
Product: phpfox
Module: Event
Varname: events_i_ve_created
Text: Events I've created

3. Далее Опять - AdminCP -> CMS -> Block -> Add New Block

*Product: phpfox
*Module: event
*Title: Events created
*Type: PHP Code
*Controller: profile.index
*Placement: Block 3
*Active: Yes
*PHP/HTML Code (Optional):

<?php 
// solves bug reported by totopietra
$aUser = $this->getParam('aUser');
$iUserId = $aUser['user_id'];
// Thanks!
$parser = Phpfox::getLib('parse.output');
$iTimeDisplay = Phpfox::getLib('date')->mktime(, , , Phpfox::getTime('m'), Phpfox::getTime('d'), Phpfox::getTime('Y'));

$sSelect = 'e.event_id, e.title, e.title_url, e.tag_line, e.image_path, e.start_time,
e.end_time, e.location, e.country_iso, e.city, e.privacy';
$sCond = "e.privacy = 0 AND e.view_id = 0 AND e.module_id = 'event' AND e.end_time >= '" . $iTimeDisplay . "' AND e.user_id = ". (int) $iUserId;
$sOrder = 'RAND()';
$db = Phpfox::getLib('database');

$aEvents = $db->select($sSelect)
->from(Phpfox::getT('event'), 'e')
->where($sCond)
->order($sOrder)
->limit('3')
->execute('getSlaveRows');

foreach ($aEvents as $iKey => $aRow)
{
$aEvents[$iKey]['event_url'] = Phpfox::getLib('url')->makeUrl('event', array('view', $aRow['title_url']));
$aEvents[$iKey]['image_path_parsed'] = Phpfox::getLib('phpfox.image.helper')->display(
array(
'title' => $aRow['title'],
'path' => 'event.url_image',
'file' => $aRow['image_path'],
'suffix' => '_50',
'max_width' => '50',
'max_height' => '50',
)
);
$aEvents[$iKey]['location_clean'] = $parser->split($parser->clean($aRow['location']), 10);
if (!empty($aRow['city']))
{
$aEvents[$iKey]['location_clean'] .= ', '. $aRow['city'];
}
if (!empty($aRow['country_iso']))
{
$aEvents[$iKey]['location_clean'] .= ', '. Phpfox::getService('core.country')->getCountry($aRow['country_iso']);
}

$aEvents[$iKey]['place'] = Phpfox::getPhrase('event.time_stamp_at_location',
array(
'time_stamp' => Phpfox::getLib('date')->convertTime($aRow['start_time'], 'event.event_view_time_stamp_profile'),
'location' => $aEvents[$iKey]['location_clean'],
)
);
}

$sAddEvent = Phpfox::getLib('url')->makeUrl('event', array('add'));
$sViewAll = $sViewAll = Phpfox::getLib('url')->makeUrl('event');

?>
<div class="block js_sortable" id="js_block_border_event_created_profile">
<div class="title js_sortable_header" style="cursor: move; ">
<?php echo Phpfox::getPhrase('event.events_i_ve_created'); ?>
</div>
<div class="content" id="js_block_content_profile_event_created">
<?php
if (!count($aEvents))
{
?>
<div class="extra_info">
<?php echo Phpfox::getPhrase('event.no_upcoming_events'); ?>
<ul class="action">
<li>
<a href="<?php echo $sAddEvent; ?>">
<?php echo Phpfox::getPhrase('event.add_an_event'); ?>
</a>
</li>
</ul>
</div>
<?php
}
else
{
foreach($aEvents as $aEvent)
{
?>
<div class="{if is_int($phpfox.iteration.events/2)}row1{else}row2{/if}{if $phpfox.iteration.events == 1} row_first{/if}">
<div style="width:55px; position:absolute; text-align:center; left:20px;">
<a href="<?php echo $aEvent['event_url']; ?>">
<?php echo $aEvent['image_path_parsed']; ?>
</a>
</div>
<div style="margin-left:60px; min-height:55px; height:auto !important; height:55px;">
<a href="<?php echo $aEvent['event_url']; ?>" title="<?php echo $parser->clean($aEvent['title'], true); ?>" >
<?php echo $parser->shorten($parser->clean($aEvent['title'], true), 30); ?>
</a>
<?php if (!empty($aEvent['tag_line'])) { ?>
<div class="extra_info">
<?php echo $parser->shorten($parser->clean($aEvent['tag_line'], true), 200); ?>
</div>
<div class="extra_info">
<?php echo $aEvent['place']; ?>
</div>
<?php } ?>
</div>
<div class="clear"></div>
<div class="bottom">
<ul>
<li id="js_block_bottom_1" class="first">
<a href="<?php echo $sViewAll; ?>" id="js_block_bottom_link_1">
<?php echo Phpfox::getPhrase('user.view_all'); ?>
</a>
</li>
</ul>
</div>
</div>

<?php
}
}
?>
</div>
</div>

Другие публикации по теме:

Комментарии