Esempio n. 1
0
 /**
  * Displays the dialog and retreives a value from the user.
  * Displays the dialog and retreives the desired answer from the user. If
  * the a valid result is retrieved, it can be obtained using {@link
  * getResult()}. The method {@link hasValidResult()} can be used to check
  * if a valid result is available.
  * 
  * @return void
  * @throws ezcConsoleDialogAbortException
  *         if the user closes STDIN using <CTRL>-D.
  */
 public function display()
 {
     $this->reset();
     $this->output->outputText($this->options->text . ($this->options->showResults === true ? " " . $this->options->validator->getResultString() : "") . " ", $this->options->format);
     $result = $this->options->validator->fixup(ezcConsoleDialogViewer::readLine());
     if ($this->options->validator->validate($result)) {
         $this->result = $result;
     }
 }
Esempio n. 2
0
 /**
  * Displays the dialog and retreives a value from the user.
  * Displays the dialog and retreives the desired answer from the user. If
  * the a valid result is retrieved, it can be obtained using {@link
  * getResult()}. The method {@link hasValidResult()} can be used to check
  * if a valid result is available.
  * 
  * @return void
  * @throws ezcConsoleDialogAbortException
  *         if the user closes STDIN using <CTRL>-D.
  */
 public function display()
 {
     $this->reset();
     $text = "{$this->options->text}\n";
     foreach ($this->options->validator->getElements() as $key => $entry) {
         $text .= sprintf($this->options->formatString, $key, $entry);
     }
     $text .= "\n{$this->options->selectText}{$this->options->validator->getResultString()} ";
     $this->output->outputText($text, $this->options->format);
     $result = $this->options->validator->fixup(ezcConsoleDialogViewer::readLine());
     if ($this->options->validator->validate($result)) {
         $this->result = $result;
     }
 }