Page MenuHomeIn-Portal Phabricator

in-link
No OneTemporary

File Metadata

Created
Mon, Feb 24, 9:34 PM
Index: branches/5.2.x/units/listings/listings_tag_processor.php
===================================================================
--- branches/5.2.x/units/listings/listings_tag_processor.php (revision 14957)
+++ branches/5.2.x/units/listings/listings_tag_processor.php (revision 14958)
@@ -1,88 +1,90 @@
<?php
/**
* @version $Id$
* @package In-Link
* @copyright Copyright (C) 1997 - 2009 Intechnic. All rights reserved.
* @license GNU/GPL
* In-Portal is Open Source software.
* This means that this software may have been modified pursuant
* the GNU General Public License, and as distributed it includes
* or is derivative of works licensed under the GNU General Public License
* or other free or open source software licenses.
* See http://www.in-portal.org/license for copyright notices and details.
*/
defined('FULL_PATH') or die('restricted access!');
class ListingsTagProcessor extends kDBTagProcessor {
/**
* Returns a link for editing product
*
* @param Array $params
* @return string
*/
function ListingTypeLink($params)
{
- $object =& $this->Application->recallObject($this->getPrefixSpecial(), $this->Prefix, $params);
+ $object =& $this->getObject($params);
+ /* @var $object kDBItem */
return $this->Application->HREF($params['edit_template'],'', Array(
'm_opener' => 'd',
'lst_mode' => 't',
'lst_event' => 'OnEdit',
'lst_id' => $object->GetDBField('ListingTypeId'),
'pass' => 'all,lst'
), 'index.php');
}
function LinkEditLink($params)
{
- $object =& $this->Application->recallObject( $this->getPrefixSpecial(), $this->Prefix, $params );
+ $object =& $this->getObject($params);
+ /* @var $object kDBItem */
$sql = 'SELECT '.$this->Application->getUnitOption('l', 'IDField').'
FROM '.$this->Application->getUnitOption('l', 'TableName').'
WHERE ResourceId = '.$object->GetDBField('ItemResourceId');
return $this->Application->HREF($params['edit_template'],'', Array(
'm_opener' => 'd',
'l_mode' => 't',
'l_event' => 'OnEdit',
'l_id' => $this->Conn->GetOne($sql),
'pass' => 'all,l'
));
}
protected function ExpirationDate($params)
{
return $this->_expirationField($params, 'DateFormat');
}
protected function ExpirationTime($params)
{
return $this->_expirationField($params, 'TimeFormat');
}
protected function _expirationField($params, $format_field)
{
$object =& $this->getObject($params);
/* @var $object kDBItem */
$listing_type =& $this->Application->recallObject( 'lst', 'lst', $params );
/* @var $listing_type kDBItem */
$dur_type_mapping = Array (
1 => 1, 2 => 60, 3 => 3600, 4 => 3600 * 24,
5 => 3600 * 24 * 7, 6 => 3600 * 24 * 365 / 12, 7 => 3600 * 24 * 365
);
$duration = $listing_type->GetDBField('Duration');
$duration_type = $listing_type->GetDBField('DurationType');
$expiration_interval = $duration * $dur_type_mapping[$duration_type];
$expiration_date = adodb_mktime() + $expiration_interval;
$lang =& $this->Application->recallObject('lang.current');
/* @var $lang LanguagesItem */
return adodb_date($lang->GetDBField($format_field), $expiration_date);
}
}
\ No newline at end of file

Event Timeline