コード例 #1
0
ファイル: index.php プロジェクト: elenatheodora/Collector
                        <?php 
if (count($userFlags) > 0) {
    ?>
                        <div class="BlockOptions">
                            <div class="Head">Flagged IDs</div>
                            <?php 
    foreach ($users as $user => $exps) {
        if (!isset($userFlags[$user])) {
            continue;
        }
        foreach ($exps as $exp => $conds) {
            foreach ($conds as $cond => $sessS) {
                foreach ($sessS as $sess => $ids) {
                    foreach ($ids as $id => $fileName) {
                        $i = 1;
                        $flags = SortArrayLikeArray($IDs[$id]['Error Flags'], $images);
                        echo '<label class="ChoiceLabel">
                                                            <div class="OutputTableCell"><input type="checkbox" name="IDs[]"    value="' . $id . '"     /></div>
                                                            <div class="OutputTableCell Username">' . $user . '</div>
                                                            <div class="OutputTableCell">' . date('M d, h:ia', strtotime($IDs[$id]['Date'])) . '</div>
                                                            <div class="OutputTableCell">C-' . $IDs[$id]['Cond'] . '</div>
                                                            <div class="OutputTableCell">S-' . $IDs[$id]['Sess'] . '</div>
                                                            <div class="OutputTableCell">' . $id . '</div>';
                        foreach ($flags as $name => $val) {
                            if ($val === '') {
                                echo '<div class="OutputTableCell"></div>';
                            } else {
                                echo '<div class="OutputTableCell WarningFlag" data-tooltip="' . $images[$name] . '"><img src="GetData/images/' . $images[$name] . '.png"></div>';
                            }
                            ++$i;
                        }
コード例 #2
0
/**
 * Writes a single row to a CSV file, merging headers before writing, if needed.
 * @param array $array The row to write to the file.
 * @param string $filename The path to the file to write to.
 * @param string $delim A single character noting the delimiter in the file.
 * @see readCsv()
 * @see writeCsv()
 */
function writeLineToFile(array $array, $filename, $delim = ',')
{
    if (!FileExists($filename)) {
        // file doesn't exist, write away
        $file = fForceOpen($filename, "wb");
        fputcsv($file, array_keys($array), $delim);
        fputcsv($file, $array, $delim);
    } else {
        // file already exists, need to merge headers before writing
        $data = readCsv($filename, $delim);
        $headers = array_flip($data[0]);
        $newHeaders = array_diff_key($array, $headers);
        if (count($newHeaders) > 0) {
            $headers = $headers + $newHeaders;
            $data[0] = array_keys($headers);
            $data[] = SortArrayLikeArray($array, $headers);
            writeCsv($filename, $data, $delim);
        } else {
            writeCsv($filename, array(SortArrayLikeArray($array, $headers)), $delim, true);
        }
    }
    return $array;
}
コード例 #3
0
ファイル: generate.php プロジェクト: elenatheodora/Collector
                        foreach ($fileFilters as $column => $allowed) {
                            if (!isset($allowed[$first[$column]])) {
                                continue 2;
                            }
                        }
                        $d = getFirstLine("{$path}/{$fileName}", $testHeader, true);
                        $file = fopen("{$path}/{$fileName}", "r");
                        $keys = fgetcsv($file, 0, $d);
                        while (($line = fgetcsv($file, 0, $d)) !== false) {
                            $row = array_combine_safely($keys, $line);
                            foreach ($rowFilters as $column => $allowed) {
                                if (!isset($allowed[$row[$column]])) {
                                    continue;
                                }
                            }
                            arrayToEcho(SortArrayLikeArray($output + AddPrefixToArray($expPrefix, $row), $allColumns), $ext);
                        }
                        fclose($file);
                    }
                }
            }
        }
    }
}
if ($ext === 'browser') {
    ?>
        </tbody>
    </table>
    <script>
    var staticH = $("thead tr");
    var columns = staticH.children().length;