Page MenuHomeIn-Portal Phabricator

in-portal
No OneTemporary

File Metadata

Created
Thu, Jul 10, 8:34 PM

in-portal

Index: branches/unlabeled/unlabeled-1.11.2/core/units/visits/visits_tag_processor.php
===================================================================
--- branches/unlabeled/unlabeled-1.11.2/core/units/visits/visits_tag_processor.php (revision 2762)
+++ branches/unlabeled/unlabeled-1.11.2/core/units/visits/visits_tag_processor.php (revision 2763)
@@ -1,167 +1,172 @@
<?php
class VisitsTagProcessor extends kDBTagProcessor {
function UserFound($params)
{
$virtual_users = Array(-1,-2, 0);
$object =& $this->Application->recallObject( $this->getPrefixSpecial(), $this->Prefix, $params );
return !in_array( $object->GetDBField( $params['user_field'] ) , $virtual_users );
}
function UserLink($params)
{
$object =& $this->Application->recallObject( $this->getPrefixSpecial(), $this->Prefix, $params );
$user_id = $object->GetDBField( $params['user_field'] );
if($user_id)
{
//return $this->Application->HREF('in-commerce/users/users_edit_general','', Array('u_id' => $user_id) );
$resource_id = $this->Conn->GetOne('SELECT ResourceId FROM '.TABLE_PREFIX.'PortalUser WHERE PortalUserId = '.$user_id);
return 'javascript:OpenUserEdit('.$resource_id.');';
}
}
function getDateLimitClause($field)
{
$search_filter = $this->Application->RecallVar( $this->getPrefixSpecial().'_search_filter');
if($search_filter)
{
$search_filter = unserialize($search_filter);
return $search_filter[$field]['value'];
}
return '';
}
function AffiliateOrderInfo($params)
{
$list =& $this->GetList($params);
$date_limit = str_replace($list->TableName, 'vis', $this->getDateLimitClause('VisitDate') );
$affil_table = $this->Application->getUnitOption('affil', 'TableName');
$affil_idfield = $this->Application->getUnitOption('affil', 'IDField');
$sql = 'SELECT '.$affil_idfield.' FROM '.$affil_table.' WHERE PortalUserId = '.$this->Application->GetVar('u_id');
$affiliate_id = $this->Conn->GetOne($sql);
- $sql = 'SELECT COUNT(DISTINCT vis.PortalUserId) AS TotalVisitors, COUNT(ord.OrderId) AS OrderCount
+ $sql = 'SELECT COUNT(ord.OrderId) AS OrderCount
FROM '.$list->TableName.' vis
LEFT JOIN '.TABLE_PREFIX.'Orders ord ON ord.VisitId = vis.VisitId
WHERE (vis.AffiliateId = '.$affiliate_id.') AND (ord.Status = '.ORDER_STATUS_PROCESSED.')'.($date_limit ? ' AND '.$date_limit : '');
$result = $this->Conn->GetRow($sql);
+
+ $sql = 'SELECT COUNT(*) FROM '.$list->TableName.' vis
+ WHERE AffiliateId = '.$affiliate_id.($date_limit ? ' AND '.$date_limit : '');
+
+ $result['TotalVisitors'] = $this->Conn->GetOne($sql);
$result['OrderTotalAmount'] = $list->getTotal('OrderTotalAmount', 'SUM');
$result['OrderAffiliateCommission'] = $list->getTotal('OrderAffiliateCommission', 'SUM');
$block_params = $this->prepareTagParams($params);
$block_params['name'] = $params['render_as'];
$format_fields = Array('OrderTotalAmount', 'OrderAffiliateCommission');
if( $this->HasParam($params, 'currency') )
{
$iso = $this->GetISO($params['currency']);
foreach($format_fields as $format_field)
{
$value = sprintf($list->Fields[$format_field]['format'], $result[$format_field]);
$value = $this->ConvertCurrency($value, $iso);
$value = $this->AddCurrencySymbol($value, $iso);
$result[$format_field] = $value;
}
}
$block_params = array_merge_recursive2($block_params, $result);
return $this->Application->ParseBlock($block_params);
}
/*function ShowTotals($params)
{
$list =& $this->GetList($params);
$block_params = $this->prepareTagParams($params);
$block_params = array_merge_recursive2($block_params, $list->Totals);
$block_params['name'] = $this->SelectParam($params, 'render_as,block');
return $this->Application->ParseBlock($block_params);
}*/
function ListVisitors($params)
{
$o = '';
$params['render_as'] = $params['item_render_as'];
$o_visitors = $this->PrintList2($params);
if($o_visitors)
{
$header = '';
$footer = '';
$block_params = $this->prepareTagParams($params);
$header_block = getArrayValue($params, 'header_render_as');
if($header_block)
{
$block_params['name'] = $header_block;
$header = $this->Application->ParseBlock($block_params);
}
$footer_block = getArrayValue($params, 'footer_render_as');
if($footer_block)
{
$block_params['name'] = $footer_block;
$footer = $this->Application->ParseBlock($block_params);
}
$o = $header.$o_visitors.$footer;
}
else
{
$visitors_params = array('name' => $params['empty_myvisitors_render_as']);
$o = $this->Application->ParseBlock($visitors_params);
}
return $o;
}
/*
function OrderLink($params){
$object = &$this->Application->recallObject($this->getPrefixSpecial());
$params['ord_id'] = $object->GetDBField('OrderId');
$main_processor =& $this->Application->recallObject('m_TagProcessor');
return $main_processor->T($params);
}
*/
/**
* Enter description here...
*
* @param unknown_type $params
* @return kDBList
*/
function &GetList($params)
{
$list_name = $this->SelectParam($params, 'list_name,name');
if (!$list_name) {
$list_name = $this->Application->Parser->GetParam('list_name');
}
$types = $this->SelectParam($params, 'types');
$special='';
if ($types=='myvisitororders' || $types=='myvisitors'){
$special = 'incommerce';
$names_mapping = $this->Application->GetVar('NamesToSpecialMapping');
$names_mapping[$list_name] = $special;
$this->Application->SetVar('NamesToSpecialMapping', $names_mapping);
}
return parent::GetList($params);
}
}
?>
\ No newline at end of file
Property changes on: branches/unlabeled/unlabeled-1.11.2/core/units/visits/visits_tag_processor.php
___________________________________________________________________
Modified: cvs2svn:cvs-rev
## -1 +1 ##
-1.11
\ No newline at end of property
+1.11.2.1
\ No newline at end of property

Event Timeline