'ascocelda' => 'Asco & Celda',
'wesco' => 'Wesco',
'mopec' => 'Mopec',
- 'intex' => 'Intex'];
+ 'intex' => 'Intex',
+ 'grosfillex'=>'Grosfillex'];
$options = array_flip($options);
ksort($options);
}
$exporter = new wsExporter();
- $exporter->export($_POST['book_id'], $x, $_POST['action'], $_POST['version'], $dest['dir'], $dest['file']);
+
+ file_put_contents(WS_CACHE . '/' . $_POST['book_id'] . '.post.options', print_r($_POST, true));
+ $exporter->export($_POST['book_id'], $x, $_POST['action'], $_POST['version'], $dest['dir'], $dest['file'], $_POST['options']);
$x->addClosePopup();
}
$this->xml->addChild('title', htmlspecialchars($book->nom));
$this->xml->addChild('date', $book->changedate);
$this->xml->addChild('lang', $book->lang);
+ $this->xml->addChild('settings', json_encode($book->parametres->toArray()));
}
public function getBookInfos()
$this->_compileLock = WS_BOOKS . '/locks/' . $lockId . '.lock';
-
while (file_exists($this->_compileLock) && filemtime($this->_compileLock) > (time() - 900)) {
sleep(10);
}
public $ftpPassiveMode = false;
const VINCENT = "paris.cubedesigners.com";
+
//const VINCENT = "tortuga.enhydra.fr";
public function exportCollection($collectionId, $os)
$cl->execute();
}
- public function export($book_id, &$x, $action = 'download', $version = 'online', $destinationDir = null, $destinationFile = null)
+ public function export($book_id, &$x, $action = 'download', $version = 'online', $destinationDir = null, $destinationFile = null, $options = [])
{
global $core;
set_time_limit(0);
$this->_saveDestination();
if ($this->metaAction == 'download') {
- $this->_download();
+ $this->_download($options);
} else if ($this->metaAction == 'phonegap') {
$this->_phonegap();
} else if ($this->metaAction == 'install') {
}
}
- protected function _download()
+ protected function _download($options = [])
{
- $r = wsPackager::package($this->book_id, $this->version);
+ $r = wsPackager::package($this->book_id, $this->version, true, true, $options);
$this->x->addRedirection($r);
}
{\r
if (is_null($version)) {\r
global $core;\r
- $dao = new wsDAOBook($core->con);\r
- $book = $dao->selectById($book_id);\r
+ if (null === $book) {\r
+ $dao = new wsDAOBook($core->con);\r
+ $book = $dao->selectById($book_id);\r
+ }\r
$version = $book->parametres->mobileLVersion;\r
}\r
\r
}
$this->vdir = new CubeIT_Files_VirtualDirectory($this->dir);
-
$this->daoBook = new wsDAOBook($core->con);
if (null === $book) {
$this->book = $this->daoBook->selectById($book_id);
$this->initMobileFirst();
}
-
$this->svgfiles = array_unique([$this->assets . '/images/symbols/interface.svg',
WS_ICONS . '/15/interface.svg']);
if ($this->theme->parametres->iconSet > 15) {
\r
class wsPackagerChromeOS extends wsPackagerHTML\r
{\r
- public function __construct($book_id, $vdir = null, $whole = true)\r
+ public function __construct($book_id, $vdir = null, $whole = true, $options = [])\r
{\r
- parent::__construct($book_id, $vdir, $whole);\r
+ parent::__construct($book_id, $vdir, $whole, $options);\r
$this->version = 'chromeos';\r
- $this->cleanOnDestruct = false;\r
+ $this->cleanOnDestruct = true;\r
}\r
\r
protected function preparePackage()\r
return $res;\r
}\r
\r
-// public function makePackage($zip)\r
-// {\r
-// $this->preparePackage();\r
-//\r
-// $chrome = new CubeIT_CommandLine('crx3');\r
-// $chrome->setArg('o', WS_PACKAGER . '/download/' . $this->getBaseFile() . '.crx');\r
-// $chrome->setArg(null, $this->vdir.'/m/');\r
-// $chrome->execute();\r
-// $chrome->debug();\r
-//\r
-// return $this->getURLBase('crx');\r
-// }\r
+ public function makePackage($zip)\r
+ {\r
+ $this->preparePackage();\r
+\r
+ $chrome = new CubeIT_CommandLine('crx3');\r
+ $chrome->setArg('o', WS_PACKAGER . '/download/' . $this->getBaseFile() . '.crx');\r
+ $chrome->setArg(null, $this->vdir . '/m/');\r
+ $chrome->execute();\r
+ $chrome->debug();\r
+\r
+ return $this->getURLBase('crx');\r
+ }\r
}
\ No newline at end of file
protected $_disableScorm = true;
protected $_compileOnConstruct = false;
- public function __construct($book_id, $vdir = null, $whole = true)
+ public function __construct($book_id, $vdir = null, $whole = true, $options = [])
{
- parent::__construct($book_id, $vdir, $whole);
+ parent::__construct($book_id, $vdir, $whole, $options);
$this->version = 'html';
}
protected function _compileHTML5($bookId, $book, $dest)
{
+
$this->daoBook->compile($bookId, 'html5', false, $book->parametres->forceCompileOnDownload, false, $book);
if (!file_exists($dest)) {
protected $node_platform = 'mac';\r
protected $exenameMaxlength = 28;\r
\r
- public function __construct($book_id)\r
+ public function __construct($book_id, $options = [])\r
{\r
- parent::__construct($book_id);\r
+ parent::__construct($book_id, $options);\r
$this->version = 'mac_exe_html';\r
}\r
\r
protected $workingDir;
protected $whole = true;
protected $_clean = true;
- protected $_compileOnConstruct = true;
+ protected $_compileOnConstruct = false;
public $cleanOnDestruct = true;
- public static function package($book_id, $version, $zip = true, $cleanOnDestruct = true)
+ public static function package($book_id, $version, $zip = true, $cleanOnDestruct = true, $options = [])
{
global $packager;
cubePHP::neverStop();
if ($version === 'html') {
- $packager = new wsPackagerHTML($book_id);
+ $packager = new wsPackagerHTML($book_id, null, true, $options);
} else if ($version === 'scorm') {
- $packager = new wsPackagerSCORM($book_id);
+ $packager = new wsPackagerSCORM($book_id, null, true, $options);
} else if ($version === 'sharepoint') {
- $packager = new wsPackagerSharepoint($book_id);
+ $packager = new wsPackagerSharepoint($book_id, null, true, $options);
} elseif ($version === 'win_html') {
- $packager = new wsPackagerWinHTML($book_id);
+ $packager = new wsPackagerWinHTML($book_id, null, true, $options);
} else if ($version === 'phonegap') {
- $packager = new wsPackagerPhonegap($book_id);
+ $packager = new wsPackagerPhonegap($book_id, null, true, $options);
} else if ($version === 'win_exe_html') {
- $packager = new wsPackagerWinEXEHTML($book_id);
+ $packager = new wsPackagerWinEXEHTML($book_id, $options);
} else if ($version === 'mac_exe_html') {
- $packager = new wsPackagerMacEXEHTML($book_id);
+ $packager = new wsPackagerMacEXEHTML($book_id, $options);
} else if ($version === 'win_ins_html') {
- $packager = new wsPackagerWinINSTHTML($book_id);
+ $packager = new wsPackagerWinINSTHTML($book_id, $options);
} else if ($version === 'win_inss_html') {
- $packager = new wsPackagerWinINSTSilentHTML($book_id);
+ $packager = new wsPackagerWinINSTSilentHTML($book_id, $options);
} else if ($version === 'win_cd_html') {
- $packager = new wsPackagerWinCDHTML($book_id);
+ $packager = new wsPackagerWinCDHTML($book_id, $options);
} else if ($version === 'precompiled') {
- $packager = new wsPackagerPrecompiled($book_id);
+ $packager = new wsPackagerPrecompiled($book_id, null, true, $options);
} else if ($version === 'chromeos') {
- $packager = new wsPackagerChromeOS($book_id);
+ $packager = new wsPackagerChromeOS($book_id, null, true, $options);
}
$packager->cleanOnDestruct = $packager->cleanOnDestruct && $cleanOnDestruct;
return $packager->makePackage($zip);
}
- public function __construct($book_id, $vdir = null, $whole = true)
+ public function __construct($book_id, $vdir = null, $whole = true, $options = [])
{
$this->_clean = (null === $vdir);
$this->daoBook = new wsDAOBook($core->con);
$this->book = $this->daoBook->selectById($book_id);
+ $forceCompile = false;
+ if (count($options)) {
+ $options['forceCompileOnDownload'] = true;
+ }
+ foreach ($options as $k => $v) {
+ $this->book->parametres->$k = $v;
+ }
+
$this->pages = $this->daoBook->getPagesOfBook($book_id, false);
$daoTheme = new wsDAOTheme($core->con);
$this->workingDir = $this->book->getAssetDir();
if ($this->_compileOnConstruct) {
- $this->compile();
+ $this->compile($forceCompile);
}
}
- protected function compile()
+
+ protected function compile($forceCompile = false)
{
- $this->daoBook->compile($this->book_id, '2', false, $this->book->parametres->forceCompileOnDownload, false, $this->book);
+ $this->daoBook->compile($this->book_id, '2', false, $this->book->parametres->forceCompileOnDownload || $forceCompile, false, $this->book);
}
protected function preparePackage()
\r
class wsPackagerPrecompiled extends wsPackagerHTML\r
{\r
- public function __construct($book_id, $vdir = null, $whole = true)\r
+ public function __construct($book_id, $vdir = null, $whole = true,$options=[])\r
{\r
- parent::__construct($book_id, $vdir, $whole);\r
+ parent::__construct($book_id, $vdir, $whole,$options);\r
$this->version = 'precompiled';\r
$this->book->parametres->embedAllLibraries = true;\r
}\r
\r
class wsPackagerSCORM extends wsPackagerHTML\r
{\r
- public function __construct($book_id, $vdir = null, $whole = true)\r
+ public function __construct($book_id, $vdir = null, $whole = true, $options = [])\r
{\r
- parent::__construct($book_id, $vdir, $whole);\r
+ parent::__construct($book_id, $vdir, $whole, $options);\r
$this->version = 'scorm';\r
$this->_disableScorm = false;\r
}\r
\r
class wsPackagerSharepoint extends wsPackagerHTML\r
{\r
- public function __construct($book_id, $vdir = null, $whole = true)\r
+ public function __construct($book_id, $vdir = null, $whole = true, $options = [])\r
{\r
- parent::__construct($book_id, $vdir, $whole);\r
+ parent::__construct($book_id, $vdir, $whole, $options);\r
$this->version = 'sharepoint';\r
$this->book->parametres->seoVersion = false;\r
$this->book->parametres->maxResolution = 150;\r
class wsPackagerWinCDHTML extends wsPackagerMacEXEHTML\r
{\r
\r
- public function __construct($book_id)\r
+ public function __construct($book_id,$options=[])\r
{\r
- parent::__construct($book_id);\r
+ parent::__construct($book_id,$options);\r
$this->book->parametres->alwaysHTML5 = true;\r
$this->version = 'win_cd_html';\r
}\r
protected $node_platform = 'win';\r
protected $exenameMaxlength = 30;\r
\r
- public function __construct($book_id)\r
+ public function __construct($book_id, $options = [])\r
{\r
- parent::__construct($book_id, null, true, true);\r
+ parent::__construct($book_id, null, true, $options);\r
$this->version = 'win_exe_html';\r
$this->appName = '';\r
$this->appversion = '1.0.' . time();\r
protected $nsi;\r
protected $nsifile = 'html';\r
\r
- public function __construct($book_id)\r
+ public function __construct($book_id, $options = [])\r
{\r
- parent::__construct($book_id);\r
+ parent::__construct($book_id, $options);\r
$this->version = 'win_ins_html';\r
}\r
\r
<?php\r
\r
-class wsPackagerWinINSTSilentHTML extends wsPackagerWinINSTHTML {\r
+class wsPackagerWinINSTSilentHTML extends wsPackagerWinINSTHTML\r
+{\r
\r
- protected $nsifile = 'html-silent';\r
+ protected $nsifile = 'html-silent';\r
\r
- public function __construct($book_id) {\r
- parent::__construct($book_id);\r
- $this->version = 'win_inss_html';\r
- }\r
+ public function __construct($book_id, $options = [])\r
+ {\r
+ parent::__construct($book_id, $options);\r
+ $this->version = 'win_inss_html';\r
+ }\r
}
\ No newline at end of file