Esempio n. 1
0
function convert_notice($notice)
{
    global $step;
    global $param_path;
    global $n_errors;
    global $message_convert;
    global $n_current;
    $r = texttoxml($notice, $step[0], "0", "1", $param_path);
    if (!$r['VALID']) {
        $n_errors++;
        $message_convert .= "<b>Notice " . $n_current . " : </b>" . $r['ERROR'] . "<br />\n";
        $notice = "";
        break;
    } else {
        $notice = $r['DATA'];
    }
    $r = toiso($notice, $step[1], "1", "0", $param_path);
    if (!$r['VALID']) {
        $n_errors++;
        $message_convert .= "<b>Notice " . $n_current . " : </b>" . $r['ERROR'] . "<br />\n";
        $notice = "";
        break;
    } else {
        $notice = $r['DATA'];
        if ($r['WARNING']) {
            $n_errors++;
            $message_convert .= "<b>Notice " . $n_current . " : </b>" . $r['WARNING'] . "<br />\n";
        }
    }
    return $notice;
}
Esempio n. 2
0
function convert_notice($notice, $encoding)
{
    global $step;
    global $param_path;
    global $n_errors;
    global $message_convert;
    global $n_current;
    global $z;
    for ($i = 0; $i < count($step); $i++) {
        $s = $step[$i];
        //si on a un encodage sur la notice, on le rajoute aux parametres
        if ($encoding) {
            $s['ENCODING'] = $encoding;
        }
        $islast = $i == count($step) - 1;
        $isfirst = $i == 0;
        switch ($s[TYPE]) {
            case "xmltransform":
                $r = perform_xslt($notice, $s, $islast, $isfirst, $param_path);
                break;
            case "toiso":
                $r = toiso($notice, $s, $islast, $isfirst, $param_path);
                break;
            case "isotoxml":
                $r = isotoxml($notice, $s, $islast, $isfirst, $param_path);
                break;
            case "texttoxml":
                $r = texttoxml($notice, $s, $islast, $isfirst, $param_path);
                break;
            case "custom":
                eval("\$r=" . $s['CALLBACK'][0][value] . "(\$notice, \$s, \$islast, \$isfirst, \$param_path);");
                break;
        }
        if (!$r['VALID']) {
            $n_errors++;
            $message_convert .= "<b>Notice " . ($n_current + $z) . " : </b>" . $r['ERROR'] . "<br />\n";
            $notice = "";
            break;
        } else {
            $notice = $r['DATA'];
            if ($r['WARNING']) {
                $n_errors++;
                $message_convert .= "<b>Notice " . ($n_current + $z) . " : </b>" . $r['WARNING'] . "<br />\n";
            }
        }
    }
    return $notice;
}
Esempio n. 3
0
 function transform()
 {
     global $step;
     global $param_path;
     global $n_errors;
     global $message_convert;
     global $input_type;
     global $base_path;
     global $include_path;
     global $class_path;
     global $input_params;
     global $msg;
     $notice = $this->prepared_notice;
     //Inclusion des librairies éventuelles
     for ($i = 0; $i < count($step); $i++) {
         if ($step[$i]['TYPE'] == "custom") {
             //echo "imports/".$param_path."/".$step[$i][SCRIPT][0][value];
             require_once "imports/" . $param_path . "/" . $step[$i]['SCRIPT'][0]['value'];
         }
     }
     require_once "xmltransform.php";
     //En fonction du type de fichier d'entrée, inclusion du script de gestion des entrées
     switch ($input_type) {
         case "xml":
             require_once "imports/input_xml.inc.php";
             break;
         case "iso_2709":
             require_once "imports/input_iso_2709.inc.php";
             break;
         case "text":
             require_once "imports/input_text.inc.php";
             break;
         case "custom":
             require_once "imports/{$param_path}/" . $input_params['SCRIPT'];
             break;
         default:
             die($msg["ie_import_entry_not_valid"]);
     }
     for ($i = 0; $i < count($step); $i++) {
         $s = $step[$i];
         $islast = $i == count($step) - 1;
         $isfirst = $i == 0;
         switch ($s[TYPE]) {
             case "xmltransform":
                 $r = perform_xslt($notice, $s, $islast, $isfirst, $param_path);
                 break;
             case "toiso":
                 $r = toiso($notice, $s, $islast, $isfirst, $param_path);
                 break;
             case "isotoxml":
                 $r = isotoxml($notice, $s, $islast, $isfirst, $param_path);
                 break;
             case "texttoxml":
                 $r = texttoxml($notice, $s, $islast, $isfirst, $param_path);
                 break;
             case "custom":
                 eval("\$r=" . $s['CALLBACK'][0][value] . "(\$notice, \$s, \$islast, \$isfirst, \$param_path);");
                 break;
         }
         if (!$r['VALID']) {
             $this->n_errors = true;
             $this->message_convert = $r['ERROR'];
             $notice = "";
             break;
         } else {
             $notice = $r['DATA'];
             if ($r['WARNING']) {
                 $this->message_convert = $r['WARNING'];
             }
         }
     }
     return $notice;
 }