Пример #1
0
function sortFeedArray($feed, $key = false)
{
    if (!$key) {
        return false;
    }
    if (!is_array($feed)) {
        return false;
    }
    function build_sorter($key)
    {
        return function ($a, $b) use($key) {
            return strnatcmp($b[$key], $a[$key]);
        };
    }
    usort($feed, build_sorter($key));
    return $feed;
}
Пример #2
0
 /**
  * Autocomplete Search
  */
 public function fruitframeAutocompleteSearchHook()
 {
     global $post;
     $query = greenevolution_get_query();
     if ($query->have_posts()) {
         while ($query->have_posts()) {
             $query->the_post();
             $pt_names = array('post', 'blogs', 'analytics', 'multimedia', 'workshop', 'person');
             $pt_labels = array('Новости', 'Статьи блоггеров', 'Аналитика', 'Мультимедиа', 'Практикум', 'Персоналии');
             $category = str_replace($pt_names, $pt_labels, $post->post_type);
             $posts[] = array('label' => $post->post_title, 'category' => $category, 'permalink' => get_permalink($post));
         }
     }
     if (count($posts) == 0) {
         exit;
     }
     usort($posts, build_sorter('category'));
     exit(json_encode($posts));
 }
 public function get_order_list($list, $order, $seq)
 {
     if ($order) {
         if ($seq == 'desc') {
             function build_sorter($order)
             {
                 return function ($a, $b) use($order) {
                     if (is_numeric($a[$order])) {
                         return $b[$order] - $a[$order];
                     }
                     return strcmp($b[$order], $a[$order]);
                 };
             }
             usort($list, build_sorter($order));
         } else {
             function build_sorter($order)
             {
                 return function ($a, $b) use($order) {
                     if (is_numeric($a[$order])) {
                         return $a[$order] - $b[$order];
                     }
                     return strcmp($a[$order], $b[$order]);
                 };
             }
             usort($list, build_sorter($order));
         }
     }
     return $list;
 }
Пример #4
0
foreach ($productType as $rawIndexOfproductType => $product) {
    $productSort[$index]['rawIndexFromProductType'] = $rawIndexOfproductType;
    $productSort[$index]['productName'] = $product['GROUPNAME'] . ' ' . $product['GROUPNAME_DESCR'];
    $productSort[$index++]['SUM'] = $product['SUM'];
}
usort($productSort, build_sorter('SUM'));
/* 		6. product inner sort for the order of choosing equipment 					*/
/*			( By {equipment peek priority} && {EquipmentAvailableForProduct} )		*/
foreach ($productSort as $productIndex => $product_sort) {
    $productInnerSort = array();
    $index = 0;
    foreach ($equipmentType as $equipmentIndex => $equipment) {
        if ($productType[$product_sort['rawIndexFromProductType']][$equipment['EQUIPMENT']]) {
            $productInnerSort[$index]['rawIndexFromEquipmentType'] = $equipmentIndex;
            $productInnerSort[$index]['equipmentName'] = $equipment['EQUIPMENT'];
            $productInnerSort[$index++]['PRIORITY'] = $equipment['PRIORITY'];
        }
    }
    usort($productInnerSort, build_sorter('PRIORITY'));
    $productSort[$productIndex]['equipmentSort'] = $productInnerSort;
}
fputs(fopen("json/equipmentType.json", "w"), json_encode($equipmentType));
fputs(fopen("json/productType.json", "w"), json_encode($productType));
fputs(fopen("json/productSort.json", "w"), json_encode($productSort));
mysql_close($con);
function build_sorter($key)
{
    return function ($a, $b) use($key) {
        return strnatcmp($a[$key], $b[$key]);
    };
}
    if ($result) {
        while ($row = $result->fetch_assoc()) {
            $row['podkategorie'] = array();
            if ($row['id_nadrzednej'] === null) {
            } else {
                $row['nazwa'] = $kategorie_produkt[$row['id_nadrzednej']]['nazwa'] . ' > ' . $row['nazwa'];
            }
            $kategorie_produkt[$row['kategoria_id']] = $row;
        }
    }
    foreach ($kategorie_produkt as $kategoria_produkt) {
        if ($kategoria_produkt['produktow'] > 0) {
            $kategorie_produkt_sorted[] = $kategoria_produkt;
        }
    }
    usort($kategorie_produkt_sorted, build_sorter('nazwa'));
    $kategorie_produkt_sorted[] = array('kategoria_id' => 'NULL', 'nazwa' => 'Produkty bez kategorii');
} else {
    if (is_numeric($_GET['kategoria']) or $_GET['kategoria'] == 'NULL') {
        $id_kat = $_GET['kategoria'];
        if ($_GET['kategoria'] == 'NULL') {
            $result = $DB->query("SELECT produkt_id, nazwa FROM produkt WHERE kategoria_id IS NULL") or DBdie($DB->error);
        } else {
            $result = $DB->query("SELECT produkt_id, nazwa FROM produkt WHERE kategoria_id=" . $id_kat) or DBdie($DB->error);
        }
        if ($result) {
            while ($row = $result->fetch_assoc()) {
                $produkty[$row['produkt_id']] = $row['nazwa'];
            }
        }
    }
Пример #6
0
<article class="module width_full">
    <header><h3>Tracking, suivi des envois</h3></header>
    <?php 
$row_cnt = get_id_send($cnx, $list_id, $row_config_globale['table_send']);
if ($row_cnt['CPTID'] > 0) {
    $array_stats = get_stats_send($cnx, $list_id, $row_config_globale);
    switch ($data) {
        case 'co':
            echo '<div class="module_content">';
            reset($array_stats);
            usort($array_stats, build_sorter('date'));
            $tableau_sujet = array();
            $tableau_cpt = array();
            $tableau_error = array();
            $tableau_TID = array();
            $tableau_TOPEN = array();
            $tableau_leave = array();
            $TickLabels = array();
            define('PREFIX_DIR', 'tracking_graphs');
            define('PREFIX', 'jpgraph');
            define('TIME_LIMIT', 3 * 60);
            $tmpfname = tempnam(PREFIX_DIR, PREFIX);
            foreach ($array_stats as $row) {
                $tableau_sujet[] = $row['subject'] != '' ? $row['subject'] : 0;
                $tableau_cpt[] = $row['cpt'] != '' ? $row['cpt'] : 0;
                $tableau_error[] = $row['error'] != '' ? $row['error'] : 0;
                $tableau_TID[] = $row['TID'] != '' ? $row['TID'] : 0;
                $tableau_TOPEN[] = $row['TOPEN'] != '' ? $row['TOPEN'] : 0;
                $tableau_leave[] = $row['leave'] != '' ? $row['leave'] : 0;
                $TickLabels[] = $row['date'];
            }
Пример #7
0
 public function get_daily_stat($start, $end, $filters, $order, $seq, $page, $page_size)
 {
     $quote_service = new QuoteStat();
     $quote = $quote_service->get_ad_income($start, $end);
     $income = $quote_service->get_all_ad_income($start, $end);
     $rmb_change_service = new RmbChangeLog();
     $rmb_change = $rmb_change_service->get_all_ad_rmb_change($start, $end);
     $cut_service = new ADCut();
     $cut = $cut_service->get_cut_rmb($start, $end);
     $cut_rmb = $cut_service->get_all_cut_rmb($start, $end);
     $activity_service = new Activity();
     $activity = $activity_service->get_activity_rmb($start, $end);
     $activities = $activity_service->get_ads_activity_rmb($start, $end);
     $stat = $this->total_stat($start, $end);
     $ad_service = new AD();
     $ads = $ad_service->get_all_ad_info($filters);
     $ratio = ($stat['total']['rmb_out'] + $stat['total']['task_out'] + $stat['total']['transfer_cost'] + $stat['total']['happy_lock_total_cost'] - $stat['total']['happy_lock_rmb']) / ($stat['total']['rmb_out'] + $stat['total']['task_out']);
     $android_average_rmb = $stat['total']['android_transfer'] ? $stat['total']['android_rmb'] / $stat['total']['android_transfer'] : 0;
     $ios_average_rmb = $stat['total']['ios_transfer'] ? $stat['total']['ios_rmb'] / $stat['total']['ios_transfer'] : 0;
     if ($page_size) {
         $total['all']['amount'] = array('count' => count(array_unique(array_merge(array_keys($stat['ads']), array_keys($quote)))), 'transfer' => $stat['total']['transfer'], 'cpa' => $income['nums'], 'ratio' => $stat['total']['transfer'] ? round($income['nums'] / $stat['total']['transfer'] * 100, 2) : 0, 'out' => $stat['total']['rmb_out'] + $stat['total']['task_out'], 'operation_cost' => $stat['total']['happy_lock_total_cost'] - $stat['total']['happy_lock_rmb'] + $stat['total']['transfer_cost'] + $activity['outcome'], 'total_cost' => $stat['total']['rmb_out'] + $stat['total']['task_out'] + $stat['total']['transfer_cost'] + $stat['total']['happy_lock_total_cost'] - $stat['total']['happy_lock_rmb'] + $activity['outcome'], 'income' => ($income['income'] - $cut_rmb) / 100 + $activity['income'], 'average_rmb' => $stat['total']['transfer'] ? round(($stat['total']['rmb_out'] + $stat['total']['task_out'] + $stat['total']['transfer_cost'] + $stat['total']['happy_lock_total_cost'] - $stat['total']['happy_lock_rmb'] + $activity['outcome']) / $stat['total']['transfer'], 2) : 0, 'profit' => round($income['income'] / 100 * TAX_RATIO - ($stat['total']['rmb_out'] + $stat['total']['task_out'] + $stat['total']['transfer_cost'] + $stat['total']['happy_lock_total_cost'] - $stat['total']['happy_lock_rmb']), 2), 'profit_ratio' => $income['income'] ? round((TAX_RATIO - ($stat['total']['rmb_out'] + $stat['total']['task_out'] + $stat['total']['transfer_cost'] + $stat['total']['happy_lock_total_cost'] - $stat['total']['happy_lock_rmb']) / ($income['income'] / 100)) * 100, 2) : 0);
         $total['all']['happy_lock'] = array('transfer' => $stat['total']['happy_lock_transfer'], 'out' => $stat['total']['happy_lock_rmb'], 'operation_cost' => $stat['total']['happy_lock_total_cost'] - $stat['total']['happy_lock_rmb'], 'total_cost' => $stat['total']['happy_lock_total_cost'], 'average_rmb' => $stat['total']['happy_lock_transfer'] ? round($stat['total']['happy_lock_total_cost'] / $stat['total']['happy_lock_transfer'], 2) : 0);
         $total['all']['without_happy_lock'] = array('transfer' => $stat['total']['transfer'] - $stat['total']['happy_lock_transfer'], 'out' => $stat['total']['rmb_out'] + $stat['total']['task_out'] - $stat['total']['happy_lock_rmb'], 'operation_cost' => $stat['total']['transfer_cost'] + $activity['outcome'], 'total_cost' => $stat['total']['rmb_out'] + $stat['total']['task_out'] - $stat['total']['happy_lock_rmb'] + $stat['total']['transfer_cost'] + $activity['outcome'], 'average_rmb' => $stat['total']['transfer'] - $stat['total']['happy_lock_transfer'] ? round(($stat['total']['rmb_out'] + $stat['total']['task_out'] - $stat['total']['happy_lock_rmb'] + $stat['total']['transfer_cost'] + $activity['outcome']) / ($stat['total']['transfer'] - $stat['total']['happy_lock_transfer']), 2) : 0);
         $all_ad_ids = array_intersect(array_keys($stat['ads']), array_keys($quote));
         foreach ($all_ad_ids as $id) {
             $total['all']['happy_lock']['income'] += $stat['ads'][$id]['transfer'] ? round($quote[$id]['income'] * $stat['ads'][$id]['happy_lock_transfer'] / $stat['ads'][$id]['transfer'], 2) : 0;
         }
         $total['all']['without_happy_lock']['income'] = $total['all']['amount']['income'] - $total['all']['happy_lock']['income'];
     }
     $ids = array_unique(array_intersect(array_keys($ads), array_unique(array_merge(array_keys($quote), array_keys($stat['ads'])))));
     $total['show']['amount']['count'] = count($ids);
     if (!$order && $page_size) {
         $ids = array_slice($ids, $page * $page_size, $page_size);
     }
     $list = array();
     foreach ($ids as $id) {
         $real = $stat['ads'][$id]['transfer'] ? round($quote[$id]['income'] / $stat['ads'][$id]['transfer'], 2) : 0;
         $rmb_change_key = $ads[$id]['pack_name'] . $ads[$id]['ad_app_type'] . $ads[$id]['ad_sdk_type'] . $ads[$id]['cpc_cpa'];
         $ad = array_merge($ads[$id], array('id' => $id, 'step_rmb' => $rmb_change[$rmb_change_key] ? $rmb_change[$rmb_change_key]['min'] . '~' . $rmb_change[$rmb_change_key]['max'] : $ads[$id]['step_rmb'], 'quote_rmb' => isset($quote[$id]) ? $quote[$id]['max'] != $quote[$id]['min'] ? $quote[$id]['min'] / 100 . '~' . $quote[$id]['max'] / 100 : $quote[$id]['min'] / 100 : $ads[$id]['quote_rmb'] / 100, 'real' => $real, 'ratio' => $stat['ads'][$id]['transfer'] ? round($quote[$id]['nums'] / $stat['ads'][$id]['transfer'] * 100) : 0, 'cpa' => (int) $quote[$id]['nums'], 'income' => round($quote[$id]['income'] - $cut[$id] / 100 + $activities[$id]['income'], 2), 'profit' => round($quote[$id]['income'] * TAX_RATIO - ($stat['ads'][$id]['rmb_out'] + $stat['ads'][$id]['task_out']) * $ratio, 2), 'profit_ratio' => $quote[$id]['income'] ? round((TAX_RATIO - ($stat['ads'][$id]['rmb_out'] + $stat['ads'][$id]['task_out']) * $ratio / $quote[$id]['income']) * 100, 2) : 0, 'beprice' => $ads[$id]['ad_app_type'] == ADModel::ANDROID ? round($real * TAX_RATIO - $android_average_rmb * $ratio, 2) : round($real * TAX_RATIO - $ios_average_rmb * $ratio, 2), 'rmb_out' => (double) $stat['ads'][$id]['rmb_out'], 'task_out' => (double) $stat['ads'][$id]['task_out'], 'transfer' => (int) $stat['ads'][$id]['transfer'], 'happy_lock_rmb' => (double) $stat['ads'][$id]['happy_lock_rmb'], 'happy_lock_transfer' => (int) $stat['ads'][$id]['happy_lock_transfer'], 'happy_lock_income' => $stat['ads'][$id]['transfer'] ? round($quote[$id]['income'] * $stat['ads'][$id]['happy_lock_transfer'] / $stat['ads'][$id]['transfer'], 2) : 0, 'other_income' => round($quote[$id]['income'], 2) - ($stat['ads'][$id]['transfer'] ? round($quote[$id]['income'] * $stat['ads'][$id]['happy_lock_transfer'] / $stat['ads'][$id]['transfer'], 2) : 0), 'happy_lock_cut' => $stat['ads'][$id]['rmb_out'] ? $cut[$id] * $stat['ads'][$id]['happy_lock_rmb'] / $stat['ads'][$id]['rmb_out'] / 100 : 0, 'other_cut' => $stat['ads'][$id]['rmb_out'] ? $cut[$id] * (1 - $stat['ads'][$id]['happy_lock_rmb'] / $stat['ads'][$id]['rmb_out']) / 100 : 0, 'activity_out' => (double) $activities[$id]['outcome']));
         $list[] = $ad;
     }
     if ($order) {
         if ($seq == 'desc') {
             function build_sorter($order)
             {
                 return function ($a, $b) use($order) {
                     if (is_numeric($a[$order])) {
                         return $b[$order] - $a[$order];
                     }
                     return strcmp($b[$order], $a[$order]);
                 };
             }
             usort($list, build_sorter($order));
         } else {
             function build_sorter($order)
             {
                 return function ($a, $b) use($order) {
                     if (is_numeric($a[$order])) {
                         return $a[$order] - $b[$order];
                     }
                     return strcmp($a[$order], $b[$order]);
                 };
             }
             usort($list, build_sorter($order));
         }
         $list = array_slice($list, $page * $page_size, $page_size);
     }
     if ($page_size) {
         foreach ($list as $ad) {
             $total['show']['amount']['transfer'] += $ad['transfer'];
             $total['show']['amount']['cpa'] += $ad['cpa'];
             $total['show']['amount']['out'] += $ad['rmb_out'] + $ad['task_out'];
             $total['show']['amount']['income'] += $ad['income'];
             $total['show']['happy_lock']['transfer'] += $ad['happy_lock_transfer'];
             $total['show']['happy_lock']['out'] += $ad['happy_lock_rmb'];
             $total['show']['happy_lock']['income'] += $ad['happy_lock_income'];
             $total['show']['without_happy_lock']['out'] += $ad['rmb_out'] + $ad['task_out'] - $ad['happy_lock_rmb'];
             $total['show']['without_happy_lock']['transfer'] += $ad['transfer'] - $ad['happy_lock_transfer'];
             $total['show']['without_happy_lock']['income'] += $ad['other_income'];
         }
         $total['show']['amount']['ratio'] = $total['show']['amount']['transfer'] ? round($total['show']['amount']['cpa'] / $total['show']['amount']['transfer'] * 100, 2) : 0;
         $total['show']['amount']['total_cost'] = round($total['show']['amount']['out'] * $ratio, 2);
         $total['show']['amount']['average_rmb'] = $total['show']['amount']['transfer'] ? round($total['show']['amount']['out'] * $ratio / $total['show']['amount']['transfer'], 2) : 0;
         $total['show']['amount']['profit'] = round($total['show']['amount']['income'] * TAX_RATIO - $total['show']['amount']['total_cost'], 2);
         $total['show']['amount']['profit_ratio'] = $total['show']['amount']['income'] ? round((TAX_RATIO - $total['show']['amount']['total_cost'] / $total['show']['amount']['income']) * 100, 2) : 0;
     }
     $result = array('list' => $list, 'amount' => $total, 'total' => $total['show']['amount']['count']);
     return $result;
 }
Пример #8
0
 function exportData()
 {
     function build_sorter($key)
     {
         return function ($a, $b) use($key) {
             return strnatcmp($a->{$key}, $b->{$key});
         };
     }
     $permits = $this->session->userdata();
     $prod = array_merge($permits['foda']['view'], $permits['metaP']['view']);
     $finan = array_merge($permits['valorF']['view'], $permits['metaF']['view']);
     if (count($prod) + count($finan) <= 0) {
         redirect('inicio');
     }
     $this->form_validation->set_rules('graphic', 'Gráfico', 'required|numeric|greater_than_equal_to[0]');
     $this->form_validation->set_rules('all', 'Todo', 'required|numeric|in_list[0,1]');
     if (!$this->form_validation->run()) {
         redirect('inicio');
     }
     $graphic = $this->input->post('graphic');
     $all = strcmp($this->input->post('all'), "1") == 0 ? true : false;
     $graphic = $all ? $this->Dashboard_model->getAllGraphicData($graphic) : $this->Dashboard_model->getGraphicData($graphic);
     $key = $all ? 'year' : 'x';
     $data = [];
     $metric = (object) ["x_name" => "Año"];
     foreach ($graphic->series as $serie) {
         $prename = $all || strcmp($serie->aggregation, "") == 0 ? "" : $serie->aggregation . " de ";
         $metorg = $this->Metorg_model->getMetOrg(['id' => [$serie->metorg]])[0];
         $metric = $this->Metrics_model->getMetric(['id' => [$metorg->metric]])[0];
         foreach ($serie->values as $value) {
             if (!key_exists('target', $value)) {
                 continue;
             }
             $value->metric = $prename . $serie->name . " de " . $serie->org;
             $data[] = $value;
         }
     }
     $graphic->x_name = $all ? $metric->x_name : $graphic->x_name;
     $title = $graphic->title . " Periodo (" . $graphic->min_year . " - " . $graphic->max_year . ")";
     usort($data, build_sorter($key));
     download_send_headers(str_replace(" ", "_", $title) . "_" . date("d-m-Y") . ".csv");
     echo array2csv($data, $title, $graphic->x_name, $graphic->y_name, $all);
     return;
 }
 function array_multidim_sort(&$array, $key, $asc = TRUE)
 {
     /*
     $sorter=array();
     $ret=array();
     reset($array);
     foreach ($array as $ii => $va) {
     	$sorter[$ii]=$va[$key];
     }
     asort($sorter);
     foreach ($sorter as $ii => $va) {
     	$ret[$ii]=$array[$ii];
     }
     $array=$ret;
     */
     if (!function_exists('build_sorter')) {
         function build_sorter($key, $asc)
         {
             return function ($a, $b) use($key, $asc) {
                 if (is_object($a) && is_object($b)) {
                     $comparison = strcasecmp($a->{$key}, $b->{$key});
                     return $asc ? $comparison : -1 * $comparison;
                 } else {
                     $comparison = strcasecmp($a[$key], $b[$key]);
                     return $asc ? $comparison : -1 * $comparison;
                 }
             };
         }
     }
     usort($array, build_sorter($key, $asc));
 }
Пример #10
0
 public function get_competitor_ads_stat($order, $seq, $keyword)
 {
     $delivery_info = self::get_my_competitor_ads();
     $keys = array_keys($delivery_info);
     $data = file_get_contents(INNER_SERVICE . 'inner_api/potential_ad/' . implode(',', $keys));
     $data = json_decode($data, true);
     $ads = $data['data'];
     $result = array();
     $dj_status = $_REQUEST['dj_status'];
     $fund_status = $_REQUEST['fund_status'];
     foreach ($delivery_info as $pack_name => $value) {
         $info = $ads[$pack_name];
         if (!$info) {
             continue;
         }
         if ($keyword && strpos($info['app_name'], $keyword) === false) {
             continue;
         }
         if (isset($dj_status) && $info['dj_status'] != $dj_status) {
             continue;
         }
         if (isset($fund_status) && $info['fund_status'] != $fund_status) {
             continue;
         }
         $value = array_merge($value, $info);
         $result[] = $value;
     }
     if ($order) {
         if ($seq == 'desc') {
             function build_sorter($order)
             {
                 return function ($a, $b) use($order) {
                     if (is_numeric($a[$order])) {
                         return $b[$order] - $a[$order];
                     }
                     return strcmp($b[$order], $a[$order]);
                 };
             }
             usort($result, build_sorter($order));
         } else {
             function build_sorter($order)
             {
                 return function ($a, $b) use($order) {
                     if (is_numeric($a[$order])) {
                         return $a[$order] - $b[$order];
                     }
                     return strcmp($a[$order], $b[$order]);
                 };
             }
             usort($result, build_sorter($order));
         }
     } else {
         usort($result, function ($a, $b) {
             if ($a['important'] != $b['important']) {
                 return (int) $b['important'] - (int) $a['important'];
             }
             if ($a['source_num'] != $b['source_num']) {
                 return (int) $b['source_num'] - (int) $a['source_num'];
             }
             return strcmp($b['update_time'], $a['update_time']);
         });
     }
     return $result;
 }
Пример #11
0
 function array_multidim_sort(&$array, $key, $asc = TRUE)
 {
     if (!function_exists('build_sorter')) {
         function build_sorter($key, $asc)
         {
             return function ($a, $b) use($key, $asc) {
                 if (is_object($a) && is_object($b)) {
                     $comparison = strcasecmp($a->{$key}, $b->{$key});
                     return $asc ? $comparison : -1 * $comparison;
                 } else {
                     $comparison = strcasecmp($a[$key], $b[$key]);
                     return $asc ? $comparison : -1 * $comparison;
                 }
             };
         }
     }
     usort($array, build_sorter($key, $asc));
 }
Пример #12
0
  The multi-demensional array below contains packages with prices but
  they are all out of order and I want to present them to my customer
  in the correct order with the lowest price first
 -->

<?php 
$packagesArray = array(array('name' => 'Package 1', 'price' => 5.99), array('name' => 'Package 2', 'price' => 3.01), array('name' => 'Package 3', 'price' => 100.01), array('name' => 'Package 4', 'price' => 11.0), array('name' => 'Package 5', 'price' => 25.95), array('name' => 'Package 6', 'price' => 10.99), array('name' => 'Package 7', 'price' => 11.0));
function build_sorter($key)
{
    //build sorter creates function to sort array by specified key
    return function ($a, $b) use($key) {
        return strnatcmp($a[$key], $b[$key]);
    };
}
usort($packagesArray, build_sorter('price'));
//usort implements build_sorter to actually sort array
foreach ($packagesArray as $item) {
    echo $item['name'] . ', ' . $item['price'] . "<br />";
}
?>
<!DOCTYPE html>
<html>
  <head></head>
	<body>
      <h1>Packages</h1>
      <p>Here are all the packages we offer and their price:</p>
      <table>
        <th><td>Name</td><td>Price</td></th>
        <!-- 
          this for each loop will iterate over each item above and