コード例 #1
0
 /**
  *
  */
 public function apply()
 {
     $cssFileData = $file = \tao_helpers_Http::getUploadedFile('content');
     $batchTool = new CssBatchTool($cssFileData['tmp_name']);
     $report = $batchTool->applyToClass(\taoItems_models_classes_ItemsService::singleton()->getRootClass(), $cssFileData['name']);
     $this->returnJson($report);
 }
コード例 #2
0
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 *
 * Copyright (c) 2014 (original work) Open Assessment Technologies SA (under the project TAO-PRODUCT);
 *
 */
require_once dirname(dirname(__DIR__)) . '/taoQtiItem/includes/raw_start.php';
use oat\taoCssDevKit\model\CssBatchTool;
/**
 * Script to batch apply a stylesheet to a number of items
 */
try {
    // stylesheet can be either an argument...
    if (empty($argv[1])) {
        $localCss = glob(__DIR__ . '/*.css');
        if (!count($localCss)) {
            throw new Exception('No CSS file given');
        }
        $cssFile = array_shift($localCss);
    } else {
        if (!is_file($argv[1])) {
            throw new Exception('CSS file ' . $argv[1] . ' not found');
        }
        $cssFile = $argv[1];
    }
    $tool = new CssBatchTool($cssFile);
    $report = $tool->applyToClass(taoItems_models_classes_ItemsService::singleton()->getRootClass());
    echo tao_helpers_report_Rendering::renderToCommandline($report, true);
} catch (Exception $e) {
    print $e->getMessage();
}