public function testRenderNested()
 {
     $report = common_report_Report::createSuccess('Success!');
     $report->add(common_report_Report::createSuccess('Another success!'));
     $report->add(common_report_Report::createFailure('Failure!'));
     $expected = '<div class="feedback-success feedback-nesting-0 hierarchical tao-scope">';
     $expected .= '<span class="icon-success hierarchical-icon"></span>';
     $expected .= 'Success!';
     $expected .= '<div class="feedback-success feedback-nesting-1 leaf tao-scope">';
     $expected .= '<span class="icon-success leaf-icon"></span>';
     $expected .= 'Another success!';
     $expected .= '</div>';
     $expected .= '<div class="feedback-error feedback-nesting-1 leaf tao-scope">';
     $expected .= '<span class="icon-error leaf-icon"></span>';
     $expected .= 'Failure!';
     $expected .= '</div>';
     $expected .= '<p>';
     $expected .= '<button id="import-continue" class="btn-info"><span class="icon-right"></span>Continue</button>';
     $expected .= '</p>';
     $expected .= '</div>';
     $this->assertEquals($expected, tao_helpers_report_Rendering::render($report));
 }
<?php

use oat\Taskqueue\Action\InitRdsQueue;
use oat\oatbox\service\ServiceManager;
$parms = $argv;
array_shift($parms);
if (count($parms) != 2) {
    echo 'Usage: ' . __FILE__ . ' TAOROOT PERSISTENCE' . PHP_EOL;
    die(1);
}
$root = rtrim(array_shift($parms), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
$rawStart = $root . 'tao' . DIRECTORY_SEPARATOR . 'includes' . DIRECTORY_SEPARATOR . 'raw_start.php';
if (!file_exists($rawStart)) {
    echo 'Tao not found at "' . $rawStart . '"' . PHP_EOL;
    die(1);
}
require_once $rawStart;
$persistenceId = array_shift($parms);
$peristence = common_persistence_SqlPersistence::getPersistence($persistenceId);
$action = new InitRdsQueue();
$action->setServiceLocator(ServiceManager::getServiceManager());
$report = $action->__invoke(array($persistenceId));
echo tao_helpers_report_Rendering::renderToCommandline($report);
<?php

use oat\Taskqueue\Action\InitRdsQueue;
$parms = $argv;
array_shift($parms);
if (count($parms) != 2) {
    echo 'Usage: ' . __FILE__ . ' TAOROOT PERSISTENCE' . PHP_EOL;
    die(1);
}
$root = rtrim(array_shift($parms), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
$rawStart = $root . 'tao' . DIRECTORY_SEPARATOR . 'includes' . DIRECTORY_SEPARATOR . 'raw_start.php';
if (!file_exists($rawStart)) {
    echo 'Tao not found at "' . $rawStart . '"' . PHP_EOL;
    die(1);
}
require_once $rawStart;
$persistenceId = array_shift($parms);
$peristence = common_persistence_SqlPersistence::getPersistence($persistenceId);
$factory = new InitRdsQueue();
$report = $factory->__invoke(array($persistenceId));
tao_helpers_report_Rendering::render($report);
Esempio n. 4
0
 /**
  * Does EVERYTHING
  * @todo cleanup interface
  */
 public function index()
 {
     $formData = array();
     if ($this->hasRequestParameter('classUri')) {
         if (trim($this->getRequestParameter('classUri')) != '') {
             $formData['class'] = new core_kernel_classes_Class(tao_helpers_Uri::decode($this->getRequestParameter('classUri')));
         }
     }
     if ($this->hasRequestParameter('uri') && $this->hasRequestParameter('classUri')) {
         if (trim($this->getRequestParameter('uri')) != '') {
             $formData['instance'] = new core_kernel_classes_Resource(tao_helpers_Uri::decode($this->getRequestParameter('uri')));
         }
     }
     $formData['id'] = $this->getRequestParameter('id');
     if (!$this->isExportable($formData)) {
         $this->setData('message', $this->getNotExportableMessage($formData));
         $this->setView('form/export_error_feedback.tpl', 'tao');
         return;
     }
     $handlers = $this->getAvailableExportHandlers();
     $exporter = $this->getCurrentExporter();
     $selectedResource = isset($formData['instance']) ? $formData['instance'] : $formData['class'];
     $formFactory = new tao_actions_form_Export($handlers, $exporter->getExportForm($selectedResource), $formData);
     $myForm = $formFactory->getForm();
     if (!is_null($exporter)) {
         $myForm->setValues(array('exportHandler' => get_class($exporter)));
     }
     $this->setData('myForm', $myForm->render());
     if ($this->hasRequestParameter('exportChooser_sent') && $this->getRequestParameter('exportChooser_sent') == 1) {
         //use method GET to allow direct file download (not ajax compatible)
         $exportData = $_GET;
         if (isset($exportData['instances'])) {
             $instanceCount = count($exportData['instances']);
             for ($i = 0; $i < $instanceCount; $i++) {
                 $exportData['instances'][$i] = tao_helpers_Uri::decode($exportData['instances'][$i]);
             }
         } elseif (isset($exportData['exportInstance'])) {
             $exportData['exportInstance'] = tao_helpers_Uri::decode($exportData['exportInstance']);
         }
         $file = null;
         try {
             $report = $exporter->export($exportData, tao_helpers_Export::getExportPath());
             $file = $report;
         } catch (common_exception_UserReadableException $e) {
             $report = common_report_Report::createFailure($e->getUserMessage());
         }
         $html = '';
         if ($report instanceof common_report_Report) {
             $file = $report->getData();
             if ($report->getType() === common_report_Report::TYPE_ERROR) {
                 $html = tao_helpers_report_Rendering::render($report);
             }
         }
         if ($html !== '') {
             echo $html;
         } elseif (!is_null($file) && file_exists($file)) {
             $this->sendFileToClient($file, $selectedResource);
         }
         return;
     }
     $context = Context::getInstance();
     $this->setData('export_extension', $context->getExtensionName());
     $this->setData('export_module', $context->getModuleName());
     $this->setData('export_action', $context->getActionName());
     $this->setData('formTitle', __('Export '));
     $this->setView('form/export.tpl', 'tao');
 }