Page MenuHomeIn-Portal Phabricator

addresses_tag_processor.php
No OneTemporary

File Metadata

Created
Thu, Sep 25, 6:35 PM

addresses_tag_processor.php

<?php
/**
* @version $Id: addresses_tag_processor.php 16516 2017-01-20 14:12:22Z alex $
* @package In-Commerce
* @copyright Copyright (C) 1997 - 2009 Intechnic. All rights reserved.
* @license Commercial License
* This software is protected by copyright law and international treaties.
* Unauthorized reproduction or unlicensed usage of the code of this program,
* or any portion of it may result in severe civil and criminal penalties,
* and will be prosecuted to the maximum extent possible under the law
* See http://www.in-portal.org/commercial-license for copyright notices and details.
*/
defined('FULL_PATH') or die('restricted access!');
class AddressesTagProcessor extends kDBTagProcessor {
function ListAddresses($params)
{
$ret = $this->PrintList2($params);
if ( !$ret ) {
$block_params = array ('name' => $params['empty_myaddresses_render_as']);
$ret = $this->Application->ParseBlock($block_params);
}
return $ret;
}
/**
* Print location using only filled in fields
*
* @param Array $params
* @return string
* @access protected
*/
protected function PrintLocation($params)
{
/** @var kDBItem $object */
$object = $this->getObject($params);
$ret = '';
$fields = Array ('City', 'State', 'Zip', 'Country');
foreach ($fields as $field) {
$value = $object->GetField($field);
if ( $field == 'Country' && $value ) {
$ret .= '<br/>';
}
if ( $value ) {
$ret .= $value . ', ';
}
}
return rtrim($ret, ', ');
}
function EditLink($params)
{
$tag_processor = $this->Application->recallTagProcessor('m');
$params['pass'] = 'm,addr';
return $tag_processor->Link($params);
}
function DeleteLink($params)
{
$params['addr_event'] = 'OnDelete';
return $this->EditLink($params);
}
function NewLink($params)
{
$params['addr_event'] = 'OnNew';
return $this->EditLink($params);
}
function IsProfileAddress($params)
{
/** @var kDBItem $object */
$object = $this->getObject($params);
return $object->GetDBField('IsProfileAddress');
}
function BuildListSpecial($params)
{
if ( $this->Special != '' ) {
return $this->Special;
}
$list_unique_key = $this->getUniqueListKey($params);
if ( $list_unique_key == '' ) {
return parent::BuildListSpecial($params);
}
return crc32($list_unique_key);
}
}

Event Timeline