Exemplo n.º 1
0
 function __construct(&$parent, $base_folder, $picked_filepath = NULL)
 {
     parent::__construct($parent, '選取影像檔案...', $base_folder, wxEmptyString, 'JPEG 檔案 (*.jpg)|*.jpg|JPEG 檔案 (*.jpeg)|*.jpg|PNG 檔案 (*.png)|*.png');
     $this->base_folder = $base_folder;
     if (empty($picked_filepath)) {
         foreach (array('photo', 'pic') as $folder) {
             $tgt = $base_folder . DIRECTORY_SEPARATOR . $folder;
             if (is_dir($tgt)) {
                 $this->SetDirectory($tgt);
                 break;
             }
         }
     } else {
         $folder_path = dirname($picked_filepath);
         $picked_filename = basename($picked_filepath);
         $this->SetDirectory($folder_path);
         $this->SetFilename($picked_filename);
     }
 }
Exemplo n.º 2
0
 function NotificationsCheckout($event)
 {
     foreach ($this->messages as $message) {
         $client_position = $message[0];
         $action = $message[1];
         $data = $message[2];
         switch ($action) {
             case "file_transfer":
                 if (wxMessageBox("Accept {$data}?", "File Transfer", wxYES_NO) == wxYES) {
                     $fileDialog = new wxFileDialog($this, "Select output file", "", "", "All Files(*.*)|*.*", wxFD_SAVE);
                     $fileDialog->SetFilename($data);
                     $fileDialog->ShowModal();
                     $this->files_to_store[$client_position] = $fileDialog->GetPath();
                     $message = "accept_file,";
                     socket_write($this->m_user_sockets[$client_position], $message, strlen($message));
                 } else {
                     $message = "cancel_file,";
                     socket_write($this->m_user_sockets[$client_position], $message, strlen($message));
                 }
                 break;
         }
     }
     $this->messages = array();
 }
Exemplo n.º 3
0
 function doDataImport($event)
 {
     $dialog = new wxFileDialog($this, '開啟檔案...', '', '', 'CSV 檔案 (*.csv)|*.csv', wxFD_OPEN | wxFD_FILE_MUST_EXIST);
     if (wxID_OK != $dialog->ShowModal()) {
         return;
     }
     $selected_path = $dialog->GetPath();
     $selected_folder = dirname($selected_path);
     echo "select: {$selected_path} at {$selected_folder}.\n";
     $this->loadCSVFile($selected_path);
 }
Exemplo n.º 4
0
 function onBackupCompany($event)
 {
     $fileDialog = new \wxFileDialog($this, _("Backup to output file"), "", "", "Xiaris Company File|*.xia", wxFD_SAVE);
     if ($fileDialog->ShowModal() != wxID_CANCEL) {
         $path = str_ireplace(".xia", "", $fileDialog->GetPath());
         $fileDialog->Destroy();
         $path .= ".xia";
         if (file_exists($path)) {
             if (wxMessageBox(_("The file already exists. Do you want to overwrite it?"), _("Warning!"), wxYES_NO) != wxYES) {
                 print "test";
                 return;
             }
         }
         copy($this->company->GetFilePath(), $path);
     }
 }