예제 #1
0
 public static function parse($fileString)
 {
     // parse the file
     $lineArray = parseCSV($fileString);
     // get the indices per header line
     $header = array_map('stripslashes', $lineArray[0]);
     $firstNameIndex = self::searchHeader("FirstName", $header);
     $lastNameIndex = self::searchHeader("LastName", $header);
     $tagsIndex = self::searchHeader("Tags", $header);
     $phone1Index = self::searchHeader("Phone 1", $header);
     $phone2Index = self::searchHeader("Phone 2", $header);
     $phone3Index = self::searchHeader("Phone 3", $header);
     $email1Index = self::searchHeader("Email 1", $header);
     $email2Index = self::searchHeader("Email 2", $header);
     $email3Index = self::searchHeader("Email 3", $header);
     // get each line then
     $fiveDegreesArray = array();
     for ($index = 1; $index < count($lineArray); $index++) {
         $line = $lineArray[$index];
         $fifthDegree = new FiveDegreesCSV();
         $fifthDegree->firstName = self::trimQ($line[$firstNameIndex]);
         $fifthDegree->lastName = self::trimQ($line[$lastNameIndex]);
         $fifthDegree->skillArray = self::parseTags(self::trimQ($line[$tagsIndex]));
         $fifthDegree->phone = self::parsePhone3(self::trimQ($line[$phone1Index]), self::trimQ($line[$phone2Index]), self::trimQ($line[$phone3Index]));
         $fifthDegree->email = self::parseEmail3(self::trimQ($line[$email1Index]), self::trimQ($line[$email2Index]), self::trimQ($line[$email3Index]));
         $fifthDegree->index = $index;
         $fiveDegreesArray[] = $fifthDegree;
     }
     // $index
     return $fiveDegreesArray;
 }
예제 #2
0
 public function test_new_NounRoot()
 {
     $field_names = 'morpheme;variant;key;type;transitivity;nature;number;compositionRoot;intransSuffix;transSuffix;antipassive;OBSOLETE;OBSOLETE;engMean;freMean;composition;dialect;OBSOLETE;OBSOLETE;OBSOLETE';
     $field_values = 'taliaq;;;n;;;;;;;;;;wrist-watch;;;;;;';
     $attr_values = parseCSV($field_names, $field_values);
     $noun_root = new NounRoot($attr_values);
     $this->assertEquals(1, $noun_root->getNumericalKey(), "The attribute 'key' of the noun root should be 1");
 }
예제 #3
0
 public function testParseCSV()
 {
     $champs = 'morph;key;type;nature;freMean;engMean;description;source;dialect';
     $str = 'morph/1n;1;n;;"un morphème";a morpheme;desc;;';
     $champsValeurs = parseCSV($champs, $str);
     $att = array('morph' => 'morph/1n', 'key' => 1, 'type' => 'n', 'nature' => '', 'freMean' => 'un morphème', 'engMean' => 'a morpheme', 'description' => 'desc', 'source' => '', 'dialect' => '');
     $this->assertEquals($att, $champsValeurs, "");
 }
예제 #4
0
function getCSV($url, $method)
{
    global $mdb, $redis;
    $file = $redis->get("RC:{$url}");
    if ($file == null) {
        $file = file_get_contents($url);
        $redis->setex("RC:{$url}", 900, $file);
    }
    $csv = bzdecompress($file);
    Util::out("Parsing {$url}");
    parseCSV($csv, $method);
}
예제 #5
0
 public function test__construct()
 {
     $champs = 'morpheme;type;case;number;perPoss;numbPoss;V-form;V-actions;V-action1;V-action2;t-form;t-actions;t-action1;t-action2;k-form;k-actions;k-action1;k-action2;q-form;q-actions;q-action1;q-action2;condPrec;sources';
     $donnees = 'k;tn;nom;d;;;k;n-n-allV;allV;x;k;i(ii);iallV(i);;k;s-n-allV;sallV;x;k;s-n-allV;sallV;x;;H2';
     $champsValeurs = parseCSV($champs, $donnees);
     $tn = new NounEnding($champsValeurs);
     $this->assertEquals('tn', $tn->type(), "");
     $this->assertEquals('tn-nom-d', $tn->signature(), "");
     $this->assertEquals('k/tn-nom-d', $tn->id(), "");
     $context = 'V';
     $forms = $tn->surfaceForms($context);
     $forms_attendues = array('k');
     $this->assertEquals(count($forms_attendues), count($forms), "");
     $behaviours = $tn->behaviours_for_context($context);
     $nb_expected_behaviours = 1;
     $this->assertTrue($behaviours != null, "Erreur");
     $this->assertEquals($nb_expected_behaviours, count($behaviours), "");
     $behaviour = $behaviours[0];
     $this->assertEquals(Action::NEUTRAL, $behaviour->actionOnStem()->type(), "");
     $this->assertEquals(Action::NEUTRAL, $behaviour->actionVV()->type(), "");
     $this->assertEquals(Action::VOWELLENGTHENING, $behaviour->actionNotVV()->type(), "");
     $context = 't';
     $behaviours = $tn->behaviours_for_context($context);
     $nb_expected_behaviours = 1;
     $this->assertTrue($behaviours != null, "Erreur");
     $this->assertEquals($nb_expected_behaviours, count($behaviours), "");
     $behaviour = $behaviours[0];
     $this->assertEquals(Action::INSERTION, $behaviour->actionOnStem()->type(), "");
     $this->assertEquals(null, $behaviour->actionVV(), "");
     $this->assertEquals(null, $behaviour->actionNotVV(), "");
     $context = 'k';
     $behaviours = $tn->behaviours_for_context($context);
     $nb_expected_behaviours = 1;
     $this->assertTrue($behaviours != null, "Erreur");
     $this->assertEquals($nb_expected_behaviours, count($behaviours), "");
     $behaviour = $behaviours[0];
     $this->assertEquals(Action::DELETION, $behaviour->actionOnStem()->type(), "");
     $this->assertEquals(Action::NEUTRAL, $behaviour->actionVV()->type(), "");
     $this->assertEquals(Action::VOWELLENGTHENING, $behaviour->actionNotVV()->type(), "");
     $context = 'q';
     $behaviours = $tn->behaviours_for_context($context);
     $nb_expected_behaviours = 1;
     $this->assertTrue($behaviours != null, "Erreur");
     $this->assertEquals($nb_expected_behaviours, count($behaviours), "");
     $behaviour = $behaviours[0];
     $this->assertEquals(Action::DELETION, $behaviour->actionOnStem()->type(), "");
     $this->assertEquals(Action::NEUTRAL, $behaviour->actionVV()->type(), "");
     $this->assertEquals(Action::VOWELLENGTHENING, $behaviour->actionNotVV()->type(), "");
     $sources = $tn->sources();
     $this->assertEquals(1, count($sources), "");
     $this->assertEquals('H2', $sources[0], "");
 }
예제 #6
0
 public function readCSVDataForElement($id)
 {
     $fieldsAndValues = null;
     $index_data = $this->readIndexForElement($id);
     if ($index_data != null) {
         list($position, $file) = $index_data;
         $data_file = $this->directory . '/' . $file;
         $fh = fopen($data_file, 'r');
         $fields_line = rtrim(fgets($fh));
         fseek($fh, $position);
         $data_line = rtrim(fgets($fh));
         fclose($fh);
         $fieldsAndValues = parseCSV($fields_line, $data_line);
     }
     return $fieldsAndValues;
 }
 function _init()
 {
     $logger = Logger::getLogger('InuktitutLinguisticModel._init');
     $main_index_pathname = $this->data_model->index_pathname;
     $fd = fopen($main_index_pathname, 'r');
     $line_of_field_names = fgets($fd);
     while ($line_of_field_values = fgets($fd)) {
         $attr_values = parseCSV($line_of_field_names, $line_of_field_values);
         $attr_values['dbName'] = 'Inuktitut';
         $attr_values['tableName'] = $tableName;
         $object = $this->_make_linguistic_object($attr_values);
         if ($obj != NULL) {
             $this->objects[$obj->id()] = $obj;
         }
     }
     fclose($fd);
 }
예제 #8
0
 public function test__construct()
 {
     $champs = 'morpheme;type;mode;perSubject;numbSubject;perObject;numbObject;V-form;V-actions;V-action1;V-action2;t-form;t-actions;t-action1;t-action2;k-form;k-actions;k-action1;k-action2;q-form;q-actions;q-action1;q-action2;SpecificCondOnPrecMorph;sources';
     $donnees = 'junga;tv;ger;1;s;;;junga;n;n;;tunga;n;n;;tunga;n;n;;tunga;n;n;;;?';
     $champsValeurs = parseCSV($champs, $donnees);
     $tv = new VerbEnding($champsValeurs);
     $this->assertEquals('tv', $tv->type(), "");
     $this->assertEquals('tv-ger-1s', $tv->signature(), "");
     $this->assertEquals('junga/tv-ger-1s', $tv->id(), "ERREUR Cas 'junga'");
     $champs = 'morpheme;type;mode;sameSubject;posneg;tense;dialect;perSubject;numbSubject;perObject;numbObject;V-form;V-actions;V-action1;V-action2;t-form;t-actions;t-action1;t-action2;k-form;k-actions;k-action1;k-action2;q-form;q-actions;q-action1;q-action2;SpecificCondOnPrecMorph;sources';
     $donnees = 'nak;tv;part;oui;neg;;North Baffin, Cumberland Peninsula;2;s;;;nak natit;n n;n;;nak natit;nas nas;nas nas;;nak natit;nas nas;nas nas;;nak rak natit ratit;nas s nas s;nas s nas s nas s;;;M1 H2';
     $champsValeurs = parseCSV($champs, $donnees);
     $tv = new VerbEnding($champsValeurs);
     $this->assertEquals('tv', $tv->type(), "");
     $this->assertEquals('tv-part-2s', $tv->signature(), "");
     $this->assertEquals('nak/tv-part-2s', $tv->id(), "ERREUR Cas 'nak'");
 }
예제 #9
0
<?php

require_once 'common-multi.php';
//Para descargar
//if ($depurar!=1)
//header('Content-Disposition: attachment; filename="per_honorarios.html"');
$csv = file($_FILES['archivo']['tmp_name']);
$_SESSION['data'] = parseCSV($csv, $_POST['tipo']);
// $_SESSION['personal_honorarios']="SI";
html_header("CSV: Generador de personal a honorarios");
?>


La informaci&oacute;n se descarga de
 <?php 
echo getNumPags($_SESSION['data']);
?>
 
p&aacute;gina(s).

<ul>
<li><a href="honorarios-c.php?pag=1">per_honorarios.html</a></li>
<?php 
for ($i = 2; $i <= getNumPags($_SESSION['data']); $i++) {
    echo "<li><a href=\"honorarios-c.php?pag={$i}\">per_honorarios-{$i}.html</a></li>\n";
}
?>
</ul>

<br/>
<?php 
 public static function makeLinguisticObject_from_FieldsAndValues($fieldsStr, $valuesStr)
 {
     $logger = Logger::getLogger('LinguisticObjects.makeLinguisticObject_from_FieldsAndValues');
     $fieldAndValues = parseCSV($fieldsStr, $valuesStr);
     $logger->debug("\$fieldsStr= '{$fieldsStr}'");
     $logger->debug("\$valuesStr= '{$valuesStr}'");
     return self::makeLinguisticObject($fieldAndValues);
 }
<?php

require_once 'common-multi.php';
$csv['remuneraciones'] = file($_FILES['archivo_remuneraciones']['tmp_name']);
$csv['bienios'] = file($_FILES['archivo_bienios']['tmp_name']);
$csv['incentivos'] = file($_FILES['archivo_incentivos']['tmp_name']);
$data['remuneraciones'] = parseCSV($csv['remuneraciones'], $_POST['tipo_remuneraciones']);
$data['bienios'] = parseCSV($csv['bienios'], $_POST['tipo_bienios']);
$data['incentivos'] = parseCSV($csv['incentivos'], $_POST['tipo_incentivos']);
//print_r($data);
foreach ($data as $key => $val) {
    $_SESSION['data'][$key] = $val;
    //for($i=1;$i<count($data);$i++) {
    //    if (eregi(utf8_decode($val),$data[$i][$filtro]))
    //        $_SESSION['data'][$sv][$key][]=$data[$i];
    //}
}
//print_r($_SESSION['data']);
// $_SESSION['personal_honorarios']="SI";
html_header("CSV: Generador de páginas");
//foreach($subsecciones as $key=>$val){
echo 'La información se descarga de 1 página';
echo '<ul>';
echo '<li><a href="remuneraciones-c.php">remuneraciones.html</a></li>';
echo '</ul>';
echo '<br />';
echo '<br />';
//}
?>

예제 #12
0
$ok = true;
//Check if file is CSV
if (!in_array(end(explode(".", $_FILES['uploadedfile']['name'])), $allowed)) {
    echo "Not a CSV file";
    $ok = false;
}
//Check file size
if ($_FILES['uploadedfile']['size'] > 15000) {
    echo "File is too large";
    $ok = false;
}
//Uploads if there is no error
if ($ok) {
    if (move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {
        echo "The file " . basename($_FILES['uploadedfile']['name']) . " has been uploaded<br>";
        parseCSV($target_path);
    } else {
        echo "There was an error uploading the file, please try again!";
    }
}
function parseCSV($file)
{
    $db = new SQLite3('band2.db');
    if ($_POST['tableOption'] == 2) {
        echo "Delete table<br>";
        $query = "DELETE FROM " . $_POST['tableSelect'] . ";";
        echo $query;
        $stmt = $db->prepare($query);
        $stmt->execute();
    }
    if ($_POST['tableOption'] !== 0) {
예제 #13
0
 function _do_index_this_file($csv_filename)
 {
     $logger = Logger::getLogger('Indexer._do_index_this_file');
     $full_data_filename = realpath($this->_data_root . DIRECTORY_SEPARATOR . $csv_filename);
     // 		$logger->debug("\$full_data_filename= '$full_data_filename");
     $this->_nb_indexed_files += 1;
     $fih = fopen("{$full_data_filename}", 'r');
     $index_file_name = "{$full_data_filename}" . '.index';
     $foh = fopen($index_file_name, 'w');
     preg_match("/(^|\\\\|\\/)([^\\\\\\/]+)\\.csv/", $full_data_filename, $matches);
     $tableName = $matches[2];
     // 		$logger->debug("nom de la table = '$tableName'");
     $ligne_champs = fgets($fih);
     // 		$logger->debug("\$ligne_champs = '$ligne_champs'");
     $position = ftell($fih);
     $this->_nb_indexed_entries_in_individual_file = 0;
     while (($ligne_valeurs = fgets($fih)) != NULL) {
         $this->_nb_indexed_entries += 1;
         $this->_nb_indexed_entries_in_individual_file += 1;
         $champsValeurs = parseCSV($ligne_champs, $ligne_valeurs);
         $champsValeurs['dbName'] = 'Inuktitut';
         $champsValeurs['tableName'] = $tableName;
         // 			$object = LinguisticObjects::makeLinguisticObject($champsValeurs);
         $object_ids = LinguisticObjects::make_object_ids($champsValeurs);
         // 			$logger->debug("\$object_ids= ".print_r($object_ids,TRUE));
         foreach ($object_ids as $an_id) {
             $entry = $an_id->toString() . ':' . $position . "\n";
             fputs($foh, $entry);
         }
         $position = ftell($fih);
     }
     fclose($fih);
     fclose($foh);
     return $index_file_name;
 }
<?php

require_once 'common-multi.php';
//Para descargar
//if ($depurar!=1)
//header('Content-Disposition: attachment; filename="per_honorarios.html"');
$csv = file($_FILES['archivo']['tmp_name']);
$data = parseCSV($csv, $_POST['tipo']);
$_SESSION['data']['planta'][] = $data[0];
$_SESSION['data']['contrata'][] = $data[0];
for ($i = 1; $i < count($data); $i++) {
    if (eregi("Planta", $data[$i][0])) {
        $_SESSION['data']['planta'][] = $data[$i];
    }
    if (eregi("Contrata", $data[$i][0])) {
        $_SESSION['data']['contrata'][] = $data[$i];
    }
}
$_SESSION['data']['planta'][0] = file('per_planta_rep.txt');
$_SESSION['data']['contrata'][0] = file('per_contrata_rep.txt');
$_SESSION['footnotes']['planta'] = $_POST['footnotes'];
$_SESSION['footnotes']['contrata'] = $_POST['footnotes'];
// $_SESSION['personal_honorarios']="SI";
html_header("CSV: Generador de Planta y a Contrata");
?>

<h2>Dotaci&oacute;n de Planta</h2>

La informaci&oacute;n se descarga de
 <?php 
echo getNumPags($_SESSION['data']['planta']);
예제 #15
0
$nom = "pagina";
if (isset($_FILES['archivo']['name'])) {
    $nom = $_FILES['archivo']['name'];
    $nom = explode(".", $nom);
    $nom = $nom[0];
}
if ($depurar != 1) {
    header("Content-Disposition: attachment; filename=\"{$nom}.html\"");
}
$tablas = "error";
// Esto evita problemas mayores
if (isset($_FILES['archivo']['tmp_name']) && is_uploaded_file($_FILES['archivo']['tmp_name'])) {
    $tablas = "";
    $init = 0;
    $csv = file($_FILES['archivo']['tmp_name']);
    $arr = parseCSV($csv, $_POST['tipo']);
    //thead
    $tablas = " <thead>\n";
    $x = $arr[0];
    if ($x != array()) {
        foreach ($x as $y) {
            $y = trim($y);
            $tablas = "{$tablas}<th>{$y}</th>";
        }
    }
    $tablas = "{$tablas}\n </thead>\n";
    //tbody
    $tablas = "{$tablas}\n <tbody>\n";
    for ($i = 1; $i < count($arr); $i++) {
        $x = $arr[$i];
        $tablas = "{$tablas}  <tr>\n   ";
예제 #16
0
 public function current()
 {
     $logger = Logger::getLogger('Data_Iterator.current');
     $line_of_data = $this->current_index_line;
     $logger->debug("\$line_of_data= '{$line_of_data}'");
     list($id, $position) = explode(':', $line_of_data);
     $data_file_pathname = $this->open_datafile_pathname;
     $logger->debug("\$data_file_pathname= '{$data_file_pathname}'");
     $tableName = $this->data_model->_extract_tablename_from_filename($data_file_pathname);
     $fd = fopen($data_file_pathname, 'r');
     $line_of_field_names = fgets($fd);
     fseek($fd, $position);
     $line_of_field_values = fgets($fd);
     $attr_values = parseCSV($line_of_field_names, $line_of_field_values);
     $attr_values['dbName'] = 'Inuktitut';
     $attr_values['tableName'] = $tableName;
     fclose($fd);
     return $attr_values;
 }
예제 #17
0
         }
         $i++;
     }
     fclose($handle);
     return $return;
 }
 $TIMETREX_URL = $api_url;
 $api_session = new TimeTrexClientAPI();
 $api_session->Login($username, $password);
 if ($TIMETREX_SESSION_ID == FALSE) {
     echo "API Username/Password is incorrect!\n";
     exit;
 }
 echo "Session ID: {$TIMETREX_SESSION_ID}\n";
 if ($object != '') {
     $column_map = parseCSV($column_map_file, TRUE, FALSE, ',', 9216);
     if (is_array($column_map)) {
         foreach ($column_map as $column_map_row) {
             $column_map_arr[$column_map_row['timetrex_column']] = array('map_column_name' => $column_map_row['csv_column'], 'default_value' => $column_map_row['default_value'], 'parse_hint' => $column_map_row['parse_hint']);
         }
     } else {
         echo "Column map is invalid!\n";
     }
     $obj = new TimeTrexClientAPI('Import' . $object);
     $obj->setRawData(file_get_contents($import_csv_file));
     //var_dump( $obj->getOptions('columns') );
     $retval = $obj->Import($column_map_arr, array('fuzzy_match' => TRUE), $dry_run);
     if ($retval->getResult() == TRUE) {
         echo "Import successful!\n";
     } else {
         echo $retval;
예제 #18
0
/**
 * Inputs: the filename of the segments; the file handle for feed output
 * Different inputs from precinct function because the size of the segments
 * data requires it to be written in chunks
 * Returns: TRUE on successful writing to feed file handle ($xmlHandle)
 *  
 * Note: Alter $maxSeg below for testing purposes. This value should be
 * greater than the number of segments
 */
function addSegments($datastr)
{
    $str = "";
    $house_num_saved = 0;
    $saved_street = "";
    $i = 0;
    $maxSeg = 7000000;
    addLogMessage("Start Segments");
    $segArray = parseCSV($datastr);
    addLogMessage("File parsed");
    foreach ($segArray as $seg) {
        if ($i % 10000 == 0 && $i > 0) {
            fwrite($xmlHandle, $str);
            addLogMessage("Segments to " . $i . " done");
            $str = "";
        }
        if ($i > $maxSeg) {
            break;
        }
        if (strlen($seg[0]) > 0 && strcmp($seg[0], "id") != 0) {
            $str .= "<street_segment id=\"" . $seg[0] . "\">\n";
            $str .= "<start_house_number>" . $seg[5] . "</start_house_number>\n";
            $str .= "<end_house_number>" . $seg[6] . "</end_house_number>\n";
            $oeb = strcmp($seg[7], "E") == 0 ? "Even" : (strcmp($seg[7], "O") == 0 ? "Odd" : "Both");
            $str .= " <odd_even_both>" . $oeb . "</odd_even_both>\n";
            $str .= "<precinct_split_id>" . (int) ((double) $seg[10] * 10) . "</precinct_split_id>\n";
            $str .= "<precinct_id>999" . (int) trim($seg[13]) . "</precinct_id>\n";
            $str .= "<non_house_address>\n";
            $str .= " <street_direction>" . $seg[1] . "</street_direction>\n";
            $str .= " <street_name>" . $seg[2] . "</street_name>\n";
            $str .= " <street_suffix>" . $seg[3] . "</street_suffix>\n";
            $str .= " <address_direction>" . $seg[4] . "</address_direction>\n";
            $str .= " <city>" . $seg[11] . "</city>\n";
            $str .= " <state>NM</state>\n";
            $str .= " <zip>" . trim($seg[12]) . "</zip>\n";
            $str .= "</non_house_address>\n";
            $str .= "</street_segment>\n";
        }
        $i = $i + 1;
    }
    addLogMessage("Segments done");
    return $str;
}
예제 #19
0
 public function test__construct()
 {
     $champs = 'morpheme;key;type;function;position;transitivity;nature;plural;antipassive;V-form;V-action1;V-action2;V-actions;t-form;t-action1;t-action2;t-actions;k-form;k-action1;k-action2;k-actions;q-form;q-action1;q-action2;q-actions;engMean;freMean;condPrec;condPrecTrans;condOnNext;sources;composition;dialect;mobility';
     $donnees = 'iq;2;sv;vv;m;n;;;;iq;n;i(ng);n-i(ng);iq;i(a);;i(a);iq;s;i(ng);s-i(ng);iq;s;i(ng);s-i(ng);no longer;ne plus;;;;H1;;;m';
     $champsValeurs = parseCSV($champs, $donnees);
     $suffixe = new Suffix($champsValeurs);
     $this->assertEquals('sv', $suffixe->type(), "");
     $this->assertEquals('2vv', $suffixe->signature(), "");
     $this->assertEquals('iq/2vv', $suffixe->id(), "");
     $context = 'V';
     $forms = $suffixe->surfaceForms($context);
     $this->assertEquals(1, count($forms), "");
     $action1s = $suffixe->actions1($context);
     $this->assertTrue($action1s != null, "Erreur : action1s dans le contexte '{$context}' est nul.");
     $this->assertEquals(1, count($action1s), "");
     $action1 = $action1s[0];
     $this->assertEquals(Action::NEUTRAL, $action1->type(), "");
     $action2s = $suffixe->actions2($context);
     $this->assertTrue($action2s != null, "Erreur : action2s dans le contexte '{$context}' est nul.");
     $this->assertEquals(1, count($action2s), "");
     $action2 = $action2s[0];
     $this->assertEquals(Action::INSERTION, $action2->type(), "");
     $context = 't';
     $action1s = $suffixe->actions1($context);
     $this->assertTrue($action1s != null, "Erreur : action1s dans le contexte '{$context}' est nul.");
     $this->assertEquals(1, count($action1s), "");
     $action1 = $action1s[0];
     $this->assertEquals(Action::INSERTION, $action1->type(), "");
     $action2s = $suffixe->actions2($context);
     $this->assertTrue($action2s != null, "Erreur : action2s dans le contexte '{$context}' est nul.");
     $this->assertEquals(1, count($action2s), "");
     $action2 = $action2s[0];
     $this->assertTrue($action2 == null, "Erreur : action2 dans le contexte '{$context}' n'est pas null");
     $context = 'k';
     $action1s = $suffixe->actions1($context);
     $this->assertTrue($action1s != null, "Erreur : action1s dans le contexte '{$context}' est nul.");
     $this->assertEquals(1, count($action1s), "");
     $action1 = $action1s[0];
     $this->assertEquals(Action::DELETION, $action1->type(), "");
     $action2s = $suffixe->actions2($context);
     $this->assertTrue($action2s != null, "Erreur : action2s dans le contexte '{$context}' est nul.");
     $this->assertEquals(1, count($action2s), "");
     $action2 = $action2s[0];
     $this->assertEquals(Action::INSERTION, $action2->type(), "");
     $context = 'q';
     $action1s = $suffixe->actions1($context);
     $this->assertTrue($action1s != null, "Erreur : action1s dans le contexte '{$context}' est nul.");
     $this->assertEquals(1, count($action1s), "");
     $action1 = $action1s[0];
     $this->assertEquals(Action::DELETION, $action1->type(), "");
     $action2s = $suffixe->actions2($context);
     $this->assertTrue($action2s != null, "Erreur : action2s dans le contexte '{$context}' est nul.");
     $this->assertEquals(1, count($action2s), "");
     $action2 = $action2s[0];
     $this->assertEquals(Action::INSERTION, $action2->type(), "");
     $sources = $suffixe->sources();
     $this->assertEquals(1, count($sources), "");
     $this->assertEquals('H1', $sources[0], "");
     $this->assertEquals(1, count($suffixe->behaviours_for_context('V')), "");
     $behaviours = $suffixe->behaviours_for_context('V');
     $behaviour = $behaviours[0];
     $this->assertEquals(Action::NEUTRAL, $behaviour->actionOnStem()->type(), "");
     $this->assertEquals(Action::INSERTION, $behaviour->actionVV()->type(), "contexte V");
     $this->assertEquals(1, count($suffixe->behaviours_for_context('t')), "");
     $behaviours = $suffixe->behaviours_for_context('t');
     $behaviour = $behaviours[0];
     $this->assertEquals(Action::INSERTION, $behaviour->actionOnStem()->type(), "");
     $this->assertEquals(null, $behaviour->actionVV(), "contexte t");
     $this->assertEquals(1, count($suffixe->behaviours_for_context('k')), "");
     $behaviours = $suffixe->behaviours_for_context('k');
     $behaviour = $behaviours[0];
     $this->assertEquals(Action::DELETION, $behaviour->actionOnStem()->type(), "");
     $this->assertEquals(Action::INSERTION, $behaviour->actionVV()->type(), "contexte k");
     $this->assertEquals(1, count($suffixe->behaviours_for_context('q')), "");
     $behaviours = $suffixe->behaviours_for_context('q');
     $behaviour = $behaviours[0];
     $this->assertEquals(Action::DELETION, $behaviour->actionOnStem()->type(), "");
     $this->assertEquals(Action::INSERTION, $behaviour->actionVV()->type(), "contexte q");
 }
<?php

/*
 * Created on 2010-11-10
 *
 * To change the template for this generated file go to
 * Window - Preferences - PHPeclipse - PHP - Code Templates
 */
set_include_path('..');
require_once "lib/parseCSV.php";
require_once "linguisticobjects/LinguisticObjects.php";
echo "Get French Meanings of Verb Roots\n";
$fd = fopen('c:/eclipse_workspace/InuktitutNew-PHP/linguisticdata/RootsSpalding.csv', 'r');
$premiereLigne = fgets($fd);
$champs = explode(',', trim($premiereLigne));
while (($ligne = fgets($fd)) != null) {
    //		echo "\$ligne= '$ligne'";
    $champsValeurs = parseCSV(trim($ligne), $champs);
    $champsValeurs['dbName'] = 'Inuktitut';
    $champsValeurs['tableName'] = $tableName;
    $object = LinguisticObjects::makeLinguisticObject($champsValeurs);
    if ($object != null) {
        if ($object->getType() == 'v') {
            echo $object->id() . ' : ' . $object->getFrenchMeaning() . "\n";
        }
    }
}
close($fd);
예제 #21
0
    if (isset($_REQUEST['sqlid'])) {
        if (isset($_SESSION[$_REQUEST['sqlid']])) {
            $sql = $_SESSION[$_REQUEST['sqlid']];
            $arr = parseSQL($sql);
            $out = exportArray($arr, $format, "datatable", ".datatable {margin:auto;width:100%;} .datatable tr td {min-width:75px;}");
        } else {
            displayLocalImage("images/warning.png", "view");
            exit;
        }
    } else {
        displayLocalImage("images/warning.png", "view");
        exit;
    }
} elseif ($_REQUEST['src'] == "csv") {
    if (isset($_REQUEST['data'])) {
        $arr = parseCSV($_REQUEST['data']);
        $out = exportArray($arr, $format);
    } else {
        displayLocalImage("images/warning.png", "view");
        exit;
    }
} elseif ($_REQUEST['src'] == "html") {
    if (isset($_REQUEST['data'])) {
        $out = $_REQUEST['data'];
    } else {
        displayLocalImage("images/warning.png", "view");
        exit;
    }
    if ($format == "pdf") {
        $out = exportPDF($out);
    } else {