コード例 #1
0
function export_startovka_csv()
{
    // note 1
    global $G;
    if (count($G["startovka"]) > 0) {
        #debug_log("Export štartovky do CSV");
        $dialog = new GtkFileChooserDialog("Export CSV", null, Gtk::FILE_CHOOSER_ACTION_SAVE, array(Gtk::STOCK_OK, Gtk::RESPONSE_OK), null);
        $dialog->show_all();
        if ($dialog->run() == Gtk::RESPONSE_OK) {
            $CSV = $dialog->get_filename();
            // get the input filename
            if (strtolower(substr($CSV, -4)) != ".csv") {
                $CSV .= ".csv";
            }
            #debug_log("CSV: ".$CSV);
            #echo "selected_file = $selected_file\n";
            $out = fopen($CSV, "w");
            for ($i = 0; $i < count($G["startovka"]); $i++) {
                fputs($out, join(";", $G["startovka"][$i]) . "\n");
            }
            fclose($out);
            #	  var_dump($G["startovka"]);
            #debug_log("Export ".($i+0)." záznamov");
        }
        $dialog->destroy();
    } else {
        #debug_log("EXPORT nemožný - prázdna štartovka");
    }
}
コード例 #2
0
ファイル: HashGen.php プロジェクト: nayanshah/phpBox
 public static function _Open()
 {
     // note 1
     global $window;
     $dialog = new GtkFileChooserDialog("File Open", null, Gtk::FILE_CHOOSER_ACTION_OPEN, array(Gtk::STOCK_OK, Gtk::RESPONSE_OK, Gtk::STOCK_CANCEL, Gtk::RESPONSE_CANCEL), null);
     // note 2
     $dialog->show_all();
     if ($dialog->run() == Gtk::RESPONSE_OK) {
         $selected_file = $dialog->get_filename();
         // note 3
         echo '';
         $window->file_choosen($selected_file);
     }
     $dialog->destroy();
 }