Skip to content

Commit

Permalink
MDL-7996 Add ods export support - basic functions needed for 1.8 rele…
Browse files Browse the repository at this point in the history
…ase should be all working fine, more improvements later ;-)
  • Loading branch information
skodak committed Dec 25, 2006
1 parent c4f7267 commit aef5c10
Showing 1 changed file with 17 additions and 11 deletions.
28 changes: 17 additions & 11 deletions lib/odslib.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ function write($row, $col, $token, $format=0) {
function set_row($row, $height, $format = 0, $hidden = false, $level = 0) {
$this->rows[$row] = new object();
$this->rows[$row]->height = $height;
$this->rows[$row]->format = $format;
//$this->rows[$row]->format = $format; // TODO: fix and enable
$this->rows[$row]->hidden = $hidden;
}

Expand All @@ -267,9 +267,9 @@ function set_column($firstcol, $lastcol, $width, $format = 0, $hidden = false, $
for($i=$firstcol; $i<=$lastcol; $i++) {
$this->columns[$i] = new object();
$this->columns[$i]->width = $width;
$this->columns[$i]->format = $format;
//$this->columns[$i]->format = $format; // TODO: fix and enable
$this->columns[$i]->hidden = $hidden;

}
}

Expand All @@ -287,9 +287,15 @@ class MoodleODSFormat {
*/
function MoodleODSFormat($properties = array()) {
static $fid = 1;

$this->properties = $properties;

$this->id = $fid++;

foreach($properties as $property => $value) {
if(method_exists($this,"set_$property")) {
$aux = 'set_'.$property;
$this->$aux($value);
}
}
}

/* Set weight of the format
Expand Down Expand Up @@ -376,14 +382,14 @@ function set_text_wrap() {
function set_align($location) {
switch ($location) {
case 'start':
case 'left':
case 'left':
$this->properties['align'] = 'start';
break;
case 'center':
$this->properties['align'] = 'center';
break;
case 'end':
case 'right':
case 'right':
$this->properties['align'] = 'end';
break;
default:
Expand All @@ -403,7 +409,7 @@ function set_h_align($location) {
*/
function set_v_align($location) {
switch ($location) {
case 'top':
case 'top':
$this->properties['v_align'] = 'top';
break;
case 'bottom':
Expand Down Expand Up @@ -458,7 +464,7 @@ function _get_color($name_color = '') {
if (strpos($name_color, '#') === 0) {
return $name_color; // no conversion needed
}

$colors = array('aqua' => '#00FFFF',
'cyan' => '#00FFFF',
'black' => '#FFFFFF',
Expand All @@ -477,7 +483,7 @@ function _get_color($name_color = '') {
'silver' => '#DCDCDC',
'white' => '#FFFFFF',
'yellow' => '#FFFF00');

if(array_key_exists($name_color, $colors)) {
return $colors[$name_color];
} else {
Expand All @@ -491,7 +497,7 @@ function _get_color($name_color = '') {
// OpenDocument XML functions
//=============================
function get_ods_content(&$worksheets) {


// find out the size of worksheets and used styles
$formats = array();
Expand Down

0 comments on commit aef5c10

Please sign in to comment.