$build_id = $testcase['assigned_build_id'];
     }
 }
 if (!is_null($build_id)) {
     $exec_link = "<a href=\"javascript:openExecutionWindow(" . "{$testcase['tc_id']}, {$testcase['tcversion_id']}, {$build_id}, " . "{$args->tplan_id}, {$testcase['platform_id']});\">" . "<img title=\"{$labels['execution']}\" src=\"{$exec_img}\" /></a> ";
 }
 $edit_link = "<a href=\"javascript:openTCEditWindow({$testcase['tc_id']});\">" . "<img title=\"{$labels['design']}\" src=\"{$edit_img}\" /></a> ";
 $tcaseName = buildExternalIdString($tproject_info['prefix'], $testcase['external_id']) . ':' . $testcase['name'];
 // 20101007 - asimon - BUGID 3857
 $image_link = $exec_link . $edit_link . $tcaseName;
 $mail_link = "<a href=\"javascript:openTCEditWindow({$testcase['tc_id']});\">{$tcaseName}</a> ";
 $tcLink = $args->format == FORMAT_MAIL_HTML ? $mail_link : $image_link;
 //$tcLink = '<a href="lib/testcases/archiveData.php?edit=testcase&id=' .
 //          $testcase['tc_id'] . '">' . htmlspecialchars($tcaseName) . '</a>';
 if (!isset($pathCache[$testcase['tc_id']])) {
     $dummy = $tcase_mgr->getPathLayered(array($testcase['tc_id']));
     $pathCache[$testcase['tc_id']] = $dummy[$testcase['testsuite_id']]['value'];
     $levelCache[$testcase['tc_id']] = $dummy[$testcase['testsuite_id']]['level'];
     $ky = current(array_keys($dummy));
     $topCache[$testcase['tc_id']] = $ky;
 }
 $verbosePath = $pathCache[$testcase['tc_id']];
 $level = $levelCache[$testcase['tc_id']];
 if ($args->type == $statusCode['not_run']) {
     $build_mgr = new build_mgr($db);
     if (isset($testcase['assigned_build_id'])) {
         $build_info = $build_mgr->get_by_id($testcase['assigned_build_id']);
         $testcase['assigned_build_name'] = $build_info['name'];
     } else {
         $testcase['assigned_build_name'] = lang_get('unassigned');
     }
$exec_img = TL_THEME_IMG_DIR . "exec_icon.png";
$edit_img = TL_THEME_IMG_DIR . "edit_icon.png";
$tcase_mgr = new testcase($db);
$args = init_args($db);
$gui = initializeGui($db, $args);
if ($args->doIt) {
    // Get executions with custom field values
    buildResultSet($db, $gui, $args->tproject_id, $args->tplan_id);
    // Create column headers
    $columns = getColumnsDefinition($args->showPlatforms, $gui->cfields);
    // Extract the relevant data and build a matrix
    $matrixData = array();
    foreach ($gui->resultSet as $item) {
        $rowData = array();
        // Get test suite path
        $dummy = $tcase_mgr->getPathLayered(array($item['tcase_id']));
        $dummy = end($dummy);
        $rowData[] = $dummy['value'];
        // create linked icons
        $exec_link = "<a href=\"javascript:openExecutionWindow(" . "{$item['tcase_id']}, {$item['tcversion_id']}, {$item['builds_id']}, " . "{$args->tplan_id}, {$item['platform_id']});\">" . "<img title=\"{$labels['execution']}\" src=\"{$exec_img}\" /></a> ";
        $edit_link = "<a href=\"javascript:openTCEditWindow({$item['tcase_id']});\">" . "<img title=\"{$labels['design']}\" src=\"{$edit_img}\" /></a> ";
        $tcaseName = buildExternalIdString($gui->tcasePrefix, $item['tc_external_id']) . ' : ' . $item['tcase_name'];
        $tcLink = $exec_link . $edit_link . $tcaseName;
        $rowData[] = $tcLink;
        //$rowData[] = '<a href="lib/testcases/archiveData.php?edit=testcase&id=' . $item['tcase_id'] . '">' .
        //			 buildExternalIdString($gui->tcasePrefix, $item['tc_external_id']) .
        //			 ' : ' . $item['tcase_name'] . '</a>';
        $rowData[] = $item['tcversion_number'];
        if ($args->showPlatforms) {
            $rowData[] = $item['platform_name'];
        }