Ejemplo n.º 1
0
function parseitem($dowrite, $plu, $itemdesc, $tare, $shelflife, $price, $bycount, $type, $exception, $text, $label, $graphics)
{
    global $FANNIE_ROOT, $FANNIE_SCALES;
    $CSV_dir = $FANNIE_ROOT . 'item/hobartcsv/csvfiles';
    $DGW_dir = $FANNIE_ROOT . 'item/hobartcsv/csv_output';
    if (!function_exists('writeitem')) {
        include 'writecsv.php';
    }
    $session_key = '';
    for ($i = 0; $i < 20; $i++) {
        $num = rand(97, 122);
        $session_key = $session_key . chr($num);
    }
    $i = 0;
    foreach ($FANNIE_SCALES as $f) {
        writeitem("{$CSV_dir}/{$session_key}_wi_scale_{$i}.csv", $f['type'], $f['host'], $f['dept'], $dowrite, $plu, $itemdesc, $tare, $shelflife, $price, $bycount, $type, $exception, $label, $graphics);
        writetext("{$CSV_dir}/{$session_key}_et_scale_{$i}.csv", $f['type'], $f['host'], $f['dept'], $plu, $text);
        $i++;
    }
    for ($i = 0; $i < count($FANNIE_SCALES); $i++) {
        copy($CSV_dir . "/" . $session_key . "_wi_scale_" . $i . ".csv", $DGW_dir . "/" . $session_key . "_wi_scale_" . $i . ".csv");
        unlink($CSV_dir . "/" . $session_key . "_wi_scale_" . $i . ".csv");
        copy($CSV_dir . "/" . $session_key . "_et_scale_" . $i . ".csv", $DGW_dir . "/" . $session_key . "_et_scale_" . $i . ".csv");
        unlink($CSV_dir . "/" . $session_key . "_et_scale_" . $i . ".csv");
    }
}
Ejemplo n.º 2
0
function parseitem($dowrite, $plu, $itemdesc, $tare, $shelflife, $price, $bycount, $type, $exception, $text, $label, $graphics)
{
    include 'ini.php';
    $session_key = '';
    for ($i = 0; $i < 20; $i++) {
        $num = rand(97, 122);
        $session_key = $session_key . chr($num);
    }
    for ($i = 0; $i < $num_scales; $i++) {
        writeitem("{$CSV_dir}/{$session_key}_wi_scale_{$i}.csv", $scale_types[$i], $scale_ips[$i], $department, $dowrite, $plu, $itemdesc, $tare, $shelflife, $price, $bycount, $type, $exception, $label, $graphics);
        writetext("{$CSV_dir}/{$session_key}_et_scale_{$i}.csv", $scale_types[$i], $scale_ips[$i], $department, $plu, $text);
    }
    for ($i = 0; $i < $num_scales; $i++) {
        exec("cp {$CSV_dir}/{$session_key}_wi_scale_{$i}.csv {$DGW_dir}");
        exec("rm -f {$CSV_dir}/{$session_key}_wi_scale_{$i}.csv");
        exec("cp {$CSV_dir}/{$session_key}_et_scale_{$i}.csv {$DGW_dir}");
        exec("rm -f {$CSV_dir}/{$session_key}_et_scale_{$i}.csv");
    }
}
Ejemplo n.º 3
0
function loadtext($texttag, $taglevel)
{
    global $settings;
    if (!preg_match('/^([0-9]+),([0-9]+)$/', $texttag->coords, $coords)) {
        return;
    }
    //not be able to set text properly without coords
    if (!isset($texttag->value)) {
        return;
    }
    //if no text is given
    loadsettings($texttag, $taglevel);
    writetext($texttag->value, $taglevel, $coords);
}
                    $distracter = $concepts2[$randkeys[$i - 1]];
                    $expout .= "      <answer fraction=\"{$percent}\">\n";
                    $expout .= writetext($distracter, 3, false) . "\n";
                    $expout .= "      <feedback>\n";
                    $expout .= "      <text>\n";
                    $expout .= "      </text>\n";
                    $expout .= "      </feedback>\n";
                    $expout .= "    </answer>\n";
                }
            }
        } else {
            // Shortanswer.
            $expout .= "    <usecase>{$usecase}</usecase>\n ";
            $percent = 100;
            $expout .= "    <answer fraction=\"{$percent}\">\n";
            $expout .= writetext($concept, 3, false);
            $expout .= "    </answer>\n";
        }
        // Close the question tag.
        $expout .= "</question>\n";
    }
}
// Initial string.
// Add the xml headers and footers.
$content = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" . "<quiz>\n" . $expout . "\n" . "</quiz>";
// Make the xml look nice.
$content = xmltidy($content);
// Reset glossary export.
$SESSION->block_glossary_export_to_quiz->status = '';
send_file($content, $filename, 0, 0, true, true);
/**