<?php

require_once "Base/src/base.php";
function __autoload($className)
{
    ezcBase::autoload($className);
}
$out = new ezcConsoleOutput();
$dialog = ezcConsoleQuestionDialog::YesNoQuestion($out, "Is the answer to everything 42?", "y");
if (($res = ezcConsoleDialogViewer::displayDialog($dialog)) === "y") {
    echo "You are so right! Don't forget your towel! :)\n";
} else {
    echo "You should better read some Douglas Adams!\n";
}
<?php

require_once 'tutorial_autoload.php';
$output = new ezcConsoleOutput();
$question = ezcConsoleQuestionDialog::YesNoQuestion($output, "Do you want to proceed?", "y");
do {
    echo "\nSome action performed...\n\n";
} while (ezcConsoleDialogViewer::displayDialog($question) !== "n");
echo "Goodbye!\n";
예제 #3
0
 public function testYesNoQuestionFactory()
 {
     $output = new ezcConsoleOutput();
     $dialog = ezcConsoleQuestionDialog::YesNoQuestion($output, "Is Jean-Luc a borg?", "y");
     $this->assertType("ezcConsoleQuestionDialogOptions", $dialog->options);
     $this->assertEquals("Is Jean-Luc a borg?", $dialog->options->text);
     $this->assertTrue($dialog->options->showResults);
     $this->assertType("ezcConsoleQuestionDialogCollectionValidator", $dialog->options->validator);
     $this->assertEquals(array("y", "n"), $dialog->options->validator->collection);
     $this->assertEquals("y", $dialog->options->validator->default);
     $this->assertEquals(ezcConsoleQuestionDialogCollectionValidator::CONVERT_LOWER, $dialog->options->validator->conversion);
 }
$script->initialize();
$script->setUseDebugAccumulators(true);
$user = eZUser::fetchByName('admin');
eZUser::setCurrentlyLoggedInUser($user, $user->attribute('contentobject_id'));
$varDir = eZSys::varDirectory();
if ($options['from_path']) {
    $path = $options['from_path'];
} else {
    $cli->error("Specifica il percorso da sostituire");
    $script->shutdown();
    eZExecution::cleanExit();
}
$path = rtrim($path, '/') . '/';
$varDir = rtrim($varDir, '/') . '/';
$output = new ezcConsoleOutput();
$question = ezcConsoleQuestionDialog::YesNoQuestion($output, "Correggo i percorsi per VarDir: da \"{$path}\" a \"{$varDir}\" ?", "y");
if (ezcConsoleDialogViewer::displayDialog($question) == "n") {
    $script->shutdown();
    eZExecution::cleanExit();
} else {
    $cli->output("Process ezimagefile table");
    $list = eZImageFile::fetchObjectList(eZImageFile::definition());
    foreach ($list as $item) {
        $newPath = str_replace($path, $varDir, $item->attribute('filepath'));
        if ($newPath != $item->attribute('filepath')) {
            $cli->output("Fix attribute " . $item->attribute('contentobject_attribute_id') . " " . $item->attribute('filepath'));
            eZImageFile::moveFilepath($item->attribute('contentobject_attribute_id'), $item->attribute('filepath'), $newPath);
        }
        $attributes = eZPersistentObject::fetchObjectList(eZContentObjectAttribute::definition(), null, array('id' => $item->attribute('contentobject_attribute_id')));
        foreach ($attributes as $attribute) {
            $newDataText = str_replace($path, $varDir, $attribute->attribute('data_text'));