Source for file openoffice_document.class.php
Documentation is available at openoffice_document.class.php
* Defines the OpenOfficeDocument class, which is meant as a mother class
* to help in the conversion of Office documents to learning paths
* @package dokeos.learnpath.openofficedocument
* @author Eric Marguin <eric.marguin@dokeos.com>
* @license GNU/GPL - See Dokeos license directory for details
* Defines the "OpenofficeDocument" child of class "learnpath"
* @package dokeos.learnpath.aicc
* Class constructor. Based on the parent constructor.
* @param string Course code
* @param integer Learnpath ID in DB
if($this->debug> 0){error_log('In OpenofficeDocument::OpenofficeDocument()',0);}
if(!empty($course_code) and !empty($resource_id) and !empty($user_id))
parent::learnpath($course_code, $resource_id, $user_id);
//do nothing but still build the presentation object
global $_course, $_user, $_configuration;
$this->file_name = (strrpos($file['name'],'.')> 0 ? substr($file['name'], 0, strrpos($file['name'],'.')) : $file['name']);
$this->file_path = $visio_dir. '/'. $this->file_name. '.'. pathinfo($file['name'],PATHINFO_EXTENSION);
$dir_name = $visio_dir. '/'. $this->file_name;
$classpath = '-cp .:jodconverter-2.2.1.jar:jodconverter-cli-2.2.1.jar';
if(strpos($_ENV['OS'],'Windows') !== false)
if(strpos($_ENV['OS'],'Windows') !== false)
// call to the function implemented by child
// to allow openoffice to manipulate docs.
chmod ($this->base_work_dir. $this->created_dir,0777);
chmod ($this->base_work_dir. '/'. $this->file_path,0777);
$locale = $this->original_locale; // TODO : improve it because we're not sure this locale is present everywhere
$shell = exec($cmd, $files, $return);
if($return != 0) { //if the java application returns an error code
// can't connect to openoffice
case 1 : $this->error = get_lang('CannotConnectToOpenOffice');break;
// conversion failed in openoffice
case 2 : $this->error = get_lang('OogieConversionFailed');break;
// conversion can't be launch because command failed
case 255 : $this->error = get_lang('OogieUnknownError');break;
// call to the function implemented by child following action_after_conversion parameter
switch ($action_after_conversion)
case 'make_lp': $this -> make_lp($files);
$perm = octdec(!empty($perm)? $perm: 0770);
chmod ($this->base_work_dir. $this->created_dir,$perm);
|