X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;ds=sidebyside;f=classes%2Fcsvimporter.php;h=1b4258b412587f0f44e9abf88f4424c6d64bb3ef;hb=3ecd0a882aebbb539b4b0e507a360e961cd51c63;hp=34c6c082bcc01e66dc8cd727af1e08bf93ce3bae;hpb=b39f2e65166eb3d1b6ce180c85b9b809dd689839;p=platal.git diff --git a/classes/csvimporter.php b/classes/csvimporter.php index 34c6c08..1b4258b 100644 --- a/classes/csvimporter.php +++ b/classes/csvimporter.php @@ -64,12 +64,12 @@ class CSVImporter return true; } - private function getValue($line, $partial_ops, $key, $action) + static public function getValue($line, $key, $action, $relation = null) { if (@array_key_exists($action, $line)) { $value = $line[$action]; } elseif (is_callable($action, false)) { - $value = call_user_func($action, $line, $partial_ops, $key); + $value = call_user_func($action, $line, $key, $relation); } else { $value = $action; } @@ -83,7 +83,7 @@ class CSVImporter { $ops = array(); foreach ($relation as $key=>$ref) { - $ops[$key] = $this->getValue($line, $ops, $key, $ref); + $ops[$key] = $this->getValue($line, $key, $ref, $relation); } return $ops; } @@ -92,7 +92,7 @@ class CSVImporter { $ops = array(); foreach ($relation as $key=>$ref) { - $value = $this->getValue($line, $ops, $key, $ref); + $value = $this->getValue($line, $key, $ref, $relation); if (!is_null($value) && $value != 'NULL') { $value = "'" . addslashes($value) . "'"; }