Example #1
0
function init($file, $output)
{
    $originalCsv = array();
    $newCsv = array();
    $export = array();
    $allowKeys = count(file($output)) == 0 ? true : false;
    $csv = getCsv($file);
    if ($csv) {
        $csvArr = csv2Array($csv);
        foreach ($csvArr as $k => $c) {
            $address = returnAddress($c);
            $geo = getGeoLocation($address);
            if ($geo) {
                $csvArr[$k]['lat'] = $geo['lat'];
                $csvArr[$k]['lng'] = $geo['lng'];
                array_push($newCsv, $csvArr[$k]);
            } else {
                array_push($originalCsv, $csvArr[$k]);
            }
        }
        $originalCsv = convert2Csv($originalCsv);
        $newCsv = convert2Csv($newCsv, $allowKeys);
        export($file, $originalCsv);
        export($output, $newCsv, !$allowKeys);
    }
}
Example #2
0
 public function runGiven(&$world, $action, $arguments)
 {
     switch ($action) {
         case 'Construir com csv e titulos':
             $world['pst'] = new PlanilhaStore(getCsv(), getTitulos());
             break;
         default:
             return $this->notImplemented($action);
     }
 }
Example #3
0
function export()
{
    $errors = validateRequest();
    if ($errors != "") {
        exit($errors);
    }
    $entity = $_REQUEST['entity'];
    if (array_key_exists('entities', $_SESSION) && in_array($entity, $_SESSION['entities'])) {
        $metric = $_REQUEST['metric'];
        $endDate = $_REQUEST['endDate'];
        $period = $_REQUEST['period'];
        $csv = getCsv($entity, $metric, $endDate, $period);
        header("Content-type: text/csv; charset=UTF-8");
        header("Content-Disposition: attachment; filename=series.csv");
        echo $csv;
    } else {
        header("Content-type: text/plain; charset=UTF-8");
        echo "entity " . $entity . " is not allowed to current user.";
    }
}
Example #4
0
 /**
  * Sets up the fixture, for example, opens a network connection.
  * This method is called before a test is executed.
  */
 protected function setUp()
 {
     $this->object = new PlanilhaStore(getCsv(), getTitulos());
 }
$contestIDs = array(32, 33, 34, 35, 36, 37);
$year = 2014;
if (!isset($_REQUEST["nbAwards"])) {
    $_REQUEST["nbAwards"] = 0;
}
for ($level = 1; $level <= 6; $level++) {
    if (!isset($_REQUEST['nbAwardsLevel' . $level])) {
        $_REQUEST['nbAwardsLevel' . $level] = "";
    }
}
if (isset($_REQUEST["csv"])) {
    $levelNbAwards = array();
    for ($level = 1; $level <= 6; $level++) {
        $levelMaxRanks[] = $_REQUEST['levelMaxRank' . $level];
    }
    getCsv($db, $year, $levelMaxRanks);
}
?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<html>

<form name='form' method='get'>
Nombre total de lots attribués : <input type='text' name='nbAwards' value="<?php 
echo $_REQUEST['nbAwards'];
?>
"/><br/>
Nombre de lots 6e/5e : <input type='text' name='nbAwardsLevel1' value="<?php