PageTitle = "Trading Card Central - Transactions for ".$member . $_POST['hash']; $template->PageTitle = "Trading Card Central - Transactions for ".$member; ?> <?=$template->PageTitle?> Start(); ?>
is_loggedin()) { // Look up the member name for the logged in user. $logged_in_member_data = $SDK->get_advinfo(); $logged_in_member_name = $logged_in_member_data['name']; if ($member == $logged_in_member_name) { $display_tools = 1; } } // Set the type of transactions to report on. $transaction_type = $_GET['type']; if ($transaction_type == "pending") { // Set to look at Sale Agreements forum. $forumid = 76; $box_text = "Pending Sales"; $header_text = "Last Activity"; $no_transactions_text = "This member does not have any pending sales."; } elseif ($transaction_type == "failed") { // Set to look at Failed Transactions forum. $forumid = 94; $box_text = "Failed Sales"; $header_text = "Last Activity"; $no_transactions_text = "This member does not have any failed sales."; } else { // Set to look at Completed Transactions forum. $forumid = 77; $box_text = "Completed Sales"; $header_text = "Completed"; $no_transactions_text = "This member has not yet completed any sales."; } // Get info about this forum. $foruminfo = $SDK->get_forum_info($forumid); // Determine total number of topics. $total_topics = $foruminfo['topics']; if (!$member) echo 'No member name was specified.

'; else { // Determine the member ID. $memberid = $SDK->name2id($member); // Provide link to create trade/sale agreement with this member. echo 'Create Transaction | View Trading and Marketplace Topics | View Forums | View Leaders

'; //Look up the member total transaction, awards and restrictions data. $member_data = $SDK->get_advinfo($memberid); $member_total_transactions = $member_data['field_1']; $member_awards = $member_data['field_2']; $member_restrictions = $member_data['field_9']; // If member has no transactions, set it to zero. if ($member_total_transactions == "") $member_total_transactions = "0"; // Calculate the number of days since the member joined. $joined_days = floor((time() - $member_data['joined'])/86400); // Calculate the member's days between transactions. $days_between_transactions = $joined_days / $member_total_transactions; $days_between_transactions = round($days_between_transactions, 2); echo 'Member: '.$member.'

Completed transactions: '.$member_total_transactions.' (averages a transaction every '.$days_between_transactions.' days)
Pending transactions: View
Failed transactions: View

'; } // Display awards. if ($member_awards) echo 'Awards: '.$member_awards.'

'; // Display restrictions. if ($member_restrictions) echo 'Restrictions: '.$member_restrictions.'

'; ?> Box->Start($box_text); ?> AgreementPosted'.$header_text.'Duration
(Days)Reason'; } else { if (($transaction_type == "pending") && ($display_tools == 1)) { echo ''; } else { echo '
AgreementPosted'.$header_text.'Duration
(Days)
Tools
'; } } $query_string = 'SELECT title, last_post, start_date, tid, description FROM ibf_topics WHERE forum_id='.$forumid.' ORDER BY last_post DESC'; $topics = $SDK->DB->query($query_string); $query_string = ""; // RSW 3/14/08 //if ($topics = $SDK->list_forum_topics($forumid, array("limit" => $total_topics, "start" => "0", "order" => "desc", "orderby" => "last_post"), "0")) { if (count($topics)) { // RSW 3/14/08 //foreach ($topics as $i) { // Loop through the results. while($i = $SDK->DB->fetch_row($topics)) { if ((strstr($i['title'], ' '.$member.' ') != FALSE) || (strpos($i['title'], ' '.$member, strlen($i['title']) - strlen(' '.$member)) != FALSE )) { $a = "Sale:"; if (strncmp("$a", $i['title'], 5) == 0) { // Counter for the number of sales by this member. $total_sales = $total_sales +1; // Determine how old the transaction is. if ($transaction_type == "pending") { $last_date = time(); } else { $last_date = $i['last_post']; } $difference = $last_date - $i['start_date']; $days = floor($difference/86400); // Avoid $days being zero for completed and failed transactions. if (($days < 1) && ($transaction_type != "pending")) { $days = 1; } // Set the background color of the duration cell based on the warning level and keep track of duration totals. if ($days < 15) { $warning_color = '#EEF2F7'; $total_under_15 = $total_under_15 + 1; } elseif ($days > 14 AND $days < 30) { $warning_color = '#FFFF33'; $total_between_15_29 = $total_between_15_29 + 1; } elseif ($days > 29 AND $days < 60) { $warning_color = '#FF9900'; $total_between_30_59 = $total_between_30_59 + 1; } elseif ($days > 59) { $warning_color = '#FF3300'; $total_over_59 = $total_over_59 + 1; } // For now, we only display warning-level colors for pending transactions. if ($transaction_type != "pending") { $warning_color = '#EEF2F7'; } // Counter for the total number of days. $total_days = $total_days + $days; // Check to see if the topic's last post is greater than the logged-in member's last visit. if (($i['last_post'] > $logged_in_member_data['last_visit']) && ($SDK->is_loggedin() == 1)) { $new_phrase = 'NEW POSTS! - '; } else { $new_phrase = ''; } // Get the start date of the topic and format it. $i['start_date'] = date('M j Y, h:i A', $i['start_date']); // Get the date of the last post and format it. $i['last_post'] = date('M j Y, h:i A', $i['last_post']); // Get the 2 member names from the transaction topic. $temp_str = substr($i['title'], 6); $members = explode(" to ", $temp_str); if ($member != $members[0]) { if (array_key_exists($members[0], $transactions_array)) { $transactions_array[$members[0]] = $transactions_array[$members[0]] +1; } else { $transactions_array[$members[0]] = 1; } } if ($member != $members[1]) { if (array_key_exists($members[1], $transactions_array)) { $transactions_array[$members[1]] = $transactions_array[$members[1]] +1; } else { $transactions_array[$members[1]] = 1; } } if ($transaction_type == "failed") { echo ''; } else { if (($transaction_type == "pending") && ($display_tools == 1)) { echo ''; } else { echo ''; } } } } } if ($total_sales != 0) echo 'Total sales: '.$total_sales.'
AgreementPosted'.$header_text.'Duration
(Days)
'.$i['title'].''.$i['start_date'].''.$i['last_post'].''.$days.''.$i['description'].'
'.$new_phrase.''.$i['title'].''.$i['start_date'].''.$i['last_post'].''.$days.'Payment Information
Address Information
'.$i['title'].''.$i['start_date'].''.$i['last_post'].''.$days.'
'; else echo '


'.$no_transactions_text.'
'; } // RSW 3/14/08 //} ?> Box->End(); ?>
get_forum_info($forumid); // Determine total number of topics. $total_topics = $foruminfo['topics']; ?> Box->Start($box_text); ?> AgreementPosted'.$header_text.'Duration
(Days)Reason'; } else { if (($transaction_type == "pending") && ($display_tools == 1)) { echo ''; } else { echo '
AgreementPosted'.$header_text.'Duration
(Days)
Tools
'; } } $query_string = 'SELECT title, last_post, start_date, tid, description FROM ibf_topics WHERE forum_id='.$forumid.' ORDER BY last_post DESC'; $topics = $SDK->DB->query($query_string); $query_string = ""; // RSW 3/14/08 //if ($topics = $SDK->list_forum_topics($forumid, array("limit" => $total_topics, "start" => "0", "order" => "desc", "orderby" => "last_post"), "0")) { if (count($topics)) { // RSW 3/14/08 //foreach ($topics as $i) { // Loop through the results. while($i = $SDK->DB->fetch_row($topics)) { if ((strstr($i['title'], ' '.$member.' ') != FALSE) || (strpos($i['title'], ' '.$member, strlen($i['title']) - strlen(' '.$member)) != FALSE )) { $a = "Trade:"; if (strncmp("$a", $i['title'], 5) == 0) { // Counter for the number of trades by this member. $total_trades = $total_trades +1; // Determine how old the transaction is. if ($transaction_type == "pending") { $last_date = time(); } else { $last_date = $i['last_post']; } $difference = $last_date - $i['start_date']; $days = floor($difference/86400); // Avoid $days being zero for completed and failed transactions. if (($days < 1) && ($transaction_type != "pending")) { $days = 1; } // Set the background color of the duration cell based on the warning level and keep track of duration totals. if ($days < 15) { $warning_color = '#EEF2F7'; $total_under_15 = $total_under_15 + 1; } elseif ($days > 14 AND $days < 30) { $warning_color = '#FFFF33'; $total_between_15_29 = $total_between_15_29 + 1; } elseif ($days > 29 AND $days < 60) { $warning_color = '#FF9900'; $total_between_30_59 = $total_between_30_59 + 1; } elseif ($days > 59) { $warning_color = '#FF3300'; $total_over_59 = $total_over_59 + 1; } // For now, we only display warning-level colors for pending transactions. if ($transaction_type != "pending") { $warning_color = '#EEF2F7'; } // Counter for the total number of days. $total_days = $total_days + $days; // Check to see if the topic's last post is greater than the logged-in member's last visit. if (($i['last_post'] > $logged_in_member_data['last_visit']) && ($SDK->is_loggedin() == 1)) { $new_phrase = 'NEW POSTS! - '; } else { $new_phrase = ''; } // Get the start date of the topic and format it. $i['start_date'] = date('M j Y, h:i A', $i['start_date']); // Get the date of the last post and format it. $i['last_post'] = date('M j Y, h:i A', $i['last_post']); // Get the 2 member names from the transaction topic. $temp_str = substr($i['title'], 7); $members = explode(" and ", $temp_str); if ($member != $members[0]) { if (array_key_exists($members[0], $transactions_array)) { $transactions_array[$members[0]] = $transactions_array[$members[0]] +1; } else { $transactions_array[$members[0]] = 1; } } if ($member != $members[1]) { if (array_key_exists($members[1], $transactions_array)) { $transactions_array[$members[1]] = $transactions_array[$members[1]] +1; } else { $transactions_array[$members[1]] = 1; } } if ($transaction_type == "failed") { echo ''; } else { if (($transaction_type == "pending") && ($display_tools == 1)) { echo ''; } else { echo ''; } } } } } if ($total_trades != 0) echo 'Total trades: '.$total_trades.'
AgreementPosted'.$header_text.'Duration
(Days)
'.$i['title'].''.$i['start_date'].''.$i['last_post'].''.$days.''.$i['description'].'
'.$new_phrase.''.$i['title'].''.$i['start_date'].''.$i['last_post'].''.$days.'Address Information
'.$i['title'].''.$i['start_date'].''.$i['last_post'].''.$days.'
'; else echo '


'.$no_transactions_text.'
'; } // RSW 3/14/08 //} ?> Box->End(); ?>
Total pending transactions: '.$total_transactions.''; } elseif ($transaction_type == "failed") { $total_transactions = $total_sales + $total_trades; //Calculate percentage of their transactions that have failed. $failed_percentage = ($total_transactions / ($total_transactions + $member_total_transactions)) * 100; $failed_percentage = round($failed_percentage, 2); echo 'Total failed transactions: '.$total_transactions.' (Percentage: ' .$failed_percentage.'%)'; } else { // Load the Open Flash Chart object. include 'charts/ofc-library/open_flash_chart_object.php'; $total_transactions = $total_sales + $total_trades; $percent_sales = ($total_sales / $total_transactions) * 100; $percent_sales = round($percent_sales, 2); $percent_trades = ($total_trades / $total_transactions) * 100; $percent_trades = round($percent_trades, 2); $values_string = $percent_sales .','. $percent_trades; echo '
'; // Create an Open Flash Chart object. open_flash_chart_object( 300, 300, 'http://www.tradingcardcentral.com/apps/charts/chart_general_by_range.php?title=Transactions By Type&labels=Sales,Trades&values='.$values_string ); echo '
'; $template->Box->Start('Legend for Transactions by Type'); echo ''; echo ''; echo ''; echo '
TypeTransactionsPercentage
Sales'.$total_sales.''.$percent_sales.'%
Trades'.$total_trades.''.$percent_trades.'%
'; $template->Box->End(); echo '
'; $percent_under_15 = ($total_under_15 / $total_transactions) * 100; $percent_under_15 = round($percent_under_15, 2); $percent_between_15_29 = ($total_between_15_29 / $total_transactions) * 100; $percent_between_15_29 = round($percent_between_15_29, 2); $percent_between_30_59 = ($total_between_30_59 / $total_transactions) * 100; $percent_between_30_59 = round($percent_between_30_59, 2); $percent_over_59 = ($total_over_59 / $total_transactions) * 100; $percent_over_59 = round($percent_over_59, 2); $values_string = $percent_under_15 .','. $percent_between_15_29 .','. $percent_between_30_59 .','. $percent_over_59; $average_days = $total_days / $total_transactions; $average_days = round($average_days, 2); echo '
'; // Create an Open Flash Chart object. open_flash_chart_object( 300, 300, 'http://www.tradingcardcentral.com/apps/charts/chart_general_by_range.php?title=Transactions By Duration (Days)&labels=0 - 14, 15 - 29, 30 - 59, 60 -&values='.$values_string ); echo '
'; $template->Box->Start('Legend for Transactions by Duration'); echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo '
Duration (Days)TransactionsPercentage
0 - 14'.$total_under_15.''.$percent_under_15.'%
15 - 29'.$total_between_15_29.''.$percent_between_15_29.'%
30 - 59'.$total_between_30_59.''.$percent_between_30_59.'%
60+'.$total_over_59.''.$percent_over_59.'%
Average duration (days)'.$average_days.'
'; $template->Box->End(); echo '
'; $template->Box->Start('Transactions by Member'); echo ''; arsort($transactions_array); reset($transactions_array); while (list($key, $value) = each($transactions_array)) { $percent_member = ($value / $total_transactions) * 100; $percent_member = round($percent_member, 2); echo ''; } $unique_members = count($transactions_array); echo ''; echo '
MemberTransactionsPercentage
'.$key.''.$value.''.$percent_member.'%
Unique Members'.$unique_members.'
'; $template->Box->End(); } ?> End(); ?>