/** * Check if Sesstings tables exists in Configuration Database * @return boolean */ function checkSettings() { if (!checkTable('settings')) { createSettings(); } return true; }
$error = false; } } if ($error) { $mainError = true; echo 'settings.php - <font color="red">' . $word_not_writable . '</font>'; ?> <a class="helpbox2" href="javascript:void(0);" onmouseover="return overlib('<?php echo $word_settings_perm_error; ?> ');" onmouseout="return nd();">?</a> <?php echo '<br><br>'; } else { // Ok, now let's write out the settings file createSettings(true); } // Now let's let them know if (!$mainError) { } else { echo '<br><font color="red">' . $word_file_create_error . '</font>'; ?> <form action="<?php echo $form_action; ?> " name="setup8" method="post"> <?php $PostArray = $_POST; foreach ($PostArray as $key => $val) { if (!stristr($key, "submit") and !stristr($key, "save")) { echo '<input type="hidden" name="' . htmlentities($key) . '" value="' . htmlentities($val) . '">' . "\n";
$rs->free(); $mysqli->close(); } //getSettings if (isset($_POST['save']) && !$cancelProcess) { $userid = $_SESSION['UserID']; $bcc = $_POST['bcc']; $email = $_POST['email']; $friendlyemail = $_POST['friendlyemail']; $sql = "SELECT SettingID FROM tbl_Settings WHERE UserID = '" . $userid . "'"; $mysqli = new mysqli(db::dbserver, db::dbuser, db::dbpass, db::dbname); $rs = $mysqli->query($sql); while ($row = $rs->fetch_assoc()) { $settingid = $row['SettingID']; } if ($settingid == "") { $task = createSettings($userid, $bcc, $email, $friendlyemail); } else { $task = updateSettings($userid, $bcc, $email, $friendlyemail); } if (!$task) { $data = array("success" => false, "message" => "Error!"); } else { $data = array("success" => true, "message" => "Success!", "id" => $settingid, "email" => $email, "friendlyemail" => $friendlyemail, "bcc" => $bcc); } echo json_encode($data); $rs->free(); $mysqli->close(); } //getSettings mysql_close($db_con);
function ODS() { global $title, $subtitle, $odsfile, $numrow, $graph_formula_module, $output, $output_settings, $input, $document, $table0, $table1, $ids, $docs, $names, $weights, $msg, $lang, $template; $title = $this->title; $subtitle = $this->subtitle; $ids = $this->ids; $docs = $this->docs; $odsfile = "QSOS_" . $docs[0]->getkey("qsosappfamily") . ".ods"; $names = $this->names; $weights = $this->weights; $lang = $this->lang; $msg = $this->msg; $template = $this->template; function createCell($style, $type, $value, $formula = false, $validator = false) { global $output; //HACK: & caracter causes an error because of HTML entities $value = str_replace("&", "+", $value); $cell = $output->createElement('table:table-cell'); if ($style != "") { $cell->setAttribute("table:style-name", $style); } if (!$formula) { $cell->setAttribute("office:value-type", $type); $cell->setAttribute("office:value", $value); $text = $output->createElement('text:p', $value); $cell->appendChild($text); } else { $cell->setAttribute("table:formula", $formula); } if ($validator) { $cell->setAttribute("table:content-validation-name", $validator); } return $cell; } function getFormula($cells) { $quotient = ""; $dividend = ""; for ($i = 0; $i < count($cells); $i++) { if ($i != 0) { $quotient .= "+"; $dividend .= "+"; } $quotient .= "[.C" . $cells[$i] . "]*[.D" . $cells[$i] . "]"; $dividend .= "[.D" . $cells[$i] . "]"; } return "oooc:=IF(({$dividend})=0;0;({$quotient})/({$dividend}))"; } function createTreeCriteria($tree, $table0, $depth) { global $output; global $input; global $numrow; $children = array(); $new_depth = $depth + 1; $offset = $new_depth * 10; $idF = 0; switch ($depth) { case '0': //Section $style_row = 'ro1'; $style_title = 'ce2'; break; case '1': //Level 1 criterion $style_row = 'ro1'; $style_title = 'ce3'; break; case '2': //Level 2 criterion $style_row = 'ro1'; $style_title = ''; break; default: //Level N criterion, N > 2 $style_row = 'ro1'; $style_title = 'ce8'; break; } foreach ($tree as $element) { $name = $element->name; $title = $element->title; $subtree = $element->children; $comment = $input->getgeneric($name, "comment"); $numrow++; array_push($children, $numrow); //New row for first sheet (table0, criteria) $row = $output->createElement('table:table-row'); $row->setAttribute("table:style-name", $style_row); //Criterion $row->appendChild(createCell($style_title, "string", $title)); //Desc, Desc0, 1 and 2 $row->appendChild(createCell($style_title, "string", $input->getgeneric($name, "desc"))); $row->appendChild(createCell($style_title, "string", $input->getgeneric($name, "desc0"))); $row->appendChild(createCell($style_title, "string", $input->getgeneric($name, "desc1"))); $row->appendChild(createCell($style_title, "string", $input->getgeneric($name, "desc2"))); $table0->appendChild($row); //Recursivity if ($subtree) { //Subcriteria regrouping $group0 = $output->createElement('table:table-row-group'); $return = createTreeCriteria($subtree, $group0, $new_depth); $table0->appendChild($group0); } } return $children; } function createTreeSynthesis($tree, $table0, $depth) { global $output; global $input; global $numrow; global $ids; global $docs, $names; global $weights; $children = array(); $new_depth = $depth + 1; $offset = $new_depth * 10; $idF = 0; switch ($depth) { case '0': //Section $style_row = 'ro1'; $style_title = 'ce2'; $style_comment = 'ce2'; $style_score = 'ce5'; $style_weight = 'ce5c'; break; case '1': //Level 1 criterion $style_row = 'ro1'; $style_title = 'ce3'; $style_comment = 'ce3'; $style_score = 'ce6'; $style_weight = 'ce6c'; break; case '2': //Level 2 criterion $style_row = 'ro1'; $style_title = ''; $style_comment = ''; $style_score = ''; $style_weight = 'ce4c'; break; default: //Level N criterion, N > 2 $style_row = 'ro1'; $style_title = 'ce8'; $style_comment = 'ce8'; $style_score = 'ce9'; $style_weight = 'ce9c'; break; } foreach ($tree as $element) { $name = $element->name; $title = $element->title; $subtree = $element->children; $comment = $input->getgeneric($name, "comment"); $numrow++; array_push($children, $numrow); $row = $output->createElement('table:table-row'); $row->setAttribute("table:style-name", $style_row); //Criterion $row->appendChild(createCell($style_title, "string", $title)); $table0->appendChild($row); //Weight $weight = isset($weights[$name]) ? $weights[$name] : 1; $row->appendChild(createCell($style_weight, "float", $weight, false, "val1")); //Scores $i = 0; foreach ($ids as $id) { $input = $docs[$i]; $name = $names[$i]; $i++; $num = $numrow + 7; $row->appendChild(createCell($style_score, "string", null, "oooc:=['{$name}'.C{$num}]")); $table0->appendChild($row); } //Recursivity if ($subtree) { //Subcriteria regrouping $group0 = $output->createElement('table:table-row-group'); $return = createTreeSynthesis($subtree, $group0, $new_depth); $table0->appendChild($group0); } } return $children; } function createTreeEval($tree, $table1, $depth) { global $output; global $input; global $numrow; global $msg, $lang, $template; include "export/{$template}/settings-ods-{$lang}.php"; $children = array(); $new_depth = $depth + 1; $offset = $new_depth * 10; $idF = 0; switch ($depth) { case '0': //Section $style_row = 'ro1'; $style_title = 'ce2'; $style_comment = 'ce2'; $style_score = 'ce5'; $style_weight = 'ce5'; break; case '1': //Level 1 criterion $style_row = 'ro1'; $style_title = 'ce3'; $style_comment = 'ce3'; $style_score = 'ce6'; $style_weight = 'ce6'; break; case '2': //Level 2 criterion $style_row = 'ro1'; $style_title = ''; $style_comment = ''; $style_score = ''; $style_weight = ''; break; default: //Level N criterion, N > 2 $style_row = 'ro1'; $style_title = 'ce8'; $style_comment = 'ce8'; $style_score = 'ce9'; $style_weight = 'ce9'; break; } foreach ($tree as $element) { $name = $element->name; $title = $element->title; $subtree = $element->children; $comment = $input->getgeneric($name, "comment"); $numrow++; array_push($children, $numrow); //New row for second sheet (table1, evaluation) $row = $output->createElement('table:table-row'); $row->setAttribute("table:style-name", $style_row); //Criterion $row->appendChild(createCell($style_title, "string", $title)); //Comment $row->appendChild(createCell($style_comment, "string", $comment)); //Score $score = createCell($style_score, "float", $element->score); $row->appendChild($score); //Weight $num = $numrow - 7; $row->appendChild(createCell($style_weight, "float", null, "oooc:=['" . $tpl_msg['ods_synthesis'] . "'.B{$num}]")); $table1->appendChild($row); //Recursivity if ($subtree) { //Subcriteria regrouping $group = $output->createElement('table:table-row-group'); $return = createTreeEval($subtree, $group, $new_depth); //Set score formula $score->setAttribute("table:formula", getFormula($return)); $table1->appendChild($group); } } return $children; } function createColumn($style, $styledefault) { global $output; $column = $output->createElement('table:table-column'); $column->setAttribute("table:style-name", $style); $column->setAttribute("table:default-cell-style-name", $styledefault); return $column; } function createSimpleRow() { global $output; $row = $output->createElement('table:table-row'); $row->setAttribute("table:style-name", "ro1"); $cell = $output->createElement('table:table-cell'); $cell->setAttribute("table:style-name", "Default"); $cell->setAttribute("table:number-columns-repeated", "4"); $row->appendChild($cell); return $row; } function createHeaderRow($title, $value) { global $output; $row = $output->createElement('table:table-row'); $row->setAttribute("table:style-name", "ro1"); $cell = $output->createElement('table:table-cell'); $cell->setAttribute("table:style-name", "ce2"); $cell->setAttribute("office:value-type", "string"); $text = $output->createElement('text:p', $title); $cell->appendChild($text); $row->appendChild($cell); $cell = $output->createElement('table:table-cell'); $cell->setAttribute("table:style-name", "ce8"); $cell->setAttribute("office:value-type", "string"); $text = $output->createElement('text:p', $value); $cell->appendChild($text); $row->appendChild($cell); $cell = $output->createElement('table:table-cell'); $cell->setAttribute("table:style-name", "ce10"); $cell->setAttribute("table:number-columns-repeated", "2"); $row->appendChild($cell); return $row; } function createHomeDoubleRow($title, $value) { global $output; $row = $output->createElement('table:table-row'); $row->setAttribute("table:style-name", "ro1"); $cell = $output->createElement('table:table-cell'); $row->appendChild($cell); $cell = $output->createElement('table:table-cell'); $cell->setAttribute("table:style-name", "ce13"); $cell->setAttribute("office:value-type", "string"); $text = $output->createElement('text:p', $title); $cell->appendChild($text); $row->appendChild($cell); $cell = $output->createElement('table:table-cell'); $cell->setAttribute("table:style-name", "ce17"); $cell->setAttribute("office:value-type", "string"); $text = $output->createElement('text:p', $value); $cell->appendChild($text); $row->appendChild($cell); $cell = $output->createElement('table:table-cell'); $cell->setAttribute("table:style-name", "ce1"); $cell->setAttribute("table:number-columns-repeated", "2"); $row->appendChild($cell); return $row; } function createHomeItalicRow($value) { global $output; $row = $output->createElement('table:table-row'); $row->setAttribute("table:style-name", "ro1"); $cell = $output->createElement('table:table-cell'); $row->appendChild($cell); $cell = $output->createElement('table:table-cell'); $cell->setAttribute("table:style-name", "ce16"); $cell->setAttribute("office:value-type", "string"); $text = $output->createElement('text:p', $value); $cell->appendChild($text); $row->appendChild($cell); $cell = $output->createElement('table:table-cell'); $cell->setAttribute("table:style-name", "ce1"); $cell->setAttribute("table:number-columns-repeated", "3"); $row->appendChild($cell); return $row; } function createHomeUderlineRow($value) { global $output; $row = $output->createElement('table:table-row'); $row->setAttribute("table:style-name", "ro1"); $cell = $output->createElement('table:table-cell'); $row->appendChild($cell); $cell = $output->createElement('table:table-cell'); $cell->setAttribute("table:style-name", "ce18"); $cell->setAttribute("office:value-type", "string"); $text = $output->createElement('text:p', $value); $cell->appendChild($text); $row->appendChild($cell); $cell = $output->createElement('table:table-cell'); $cell->setAttribute("table:style-name", "ce1"); $cell->setAttribute("table:number-columns-repeated", "2"); $row->appendChild($cell); return $row; } function createTitleRow1() { global $output; global $msg; global $lang, $template; include "export/{$template}/settings-ods-{$lang}.php"; $title = $tpl_msg['ods_header']; $row = $output->createElement('table:table-row'); $row->setAttribute("table:style-name", "ro1"); $cell = $output->createElement('table:table-cell'); $cell->setAttribute("table:style-name", "ce15"); $cell->setAttribute("office:value-type", "string"); $text = $output->createElement('text:p', $title); $cell->appendChild($text); $row->appendChild($cell); return $row; } function createTitleRow2($title) { global $output; global $subtitle; if ($subtitle) { $title = $subtitle . " - " . $title; } $row = $output->createElement('table:table-row'); $row->setAttribute("table:style-name", "ro1"); $cell = $output->createElement('table:table-cell'); $cell->setAttribute("table:style-name", "ce14"); $cell->setAttribute("office:value-type", "string"); $text = $output->createElement('text:p', $title); $cell->appendChild($text); $row->appendChild($cell); return $row; } function createTitleRow3($title) { global $output; $row = $output->createElement('table:table-row'); $row->setAttribute("table:style-name", "ro1"); $cell = $output->createElement('table:table-cell'); $cell->setAttribute("table:style-name", "ce13"); $cell->setAttribute("office:value-type", "string"); $text = $output->createElement('text:p', $title); $cell->appendChild($text); $row->appendChild($cell); return $row; } function createValidator() { global $output; global $msg; $validators = $output->createElement('table:content-validations'); $validator = $output->createElement('table:content-validation'); $validator->setAttribute("table:name", "val1"); $validator->setAttribute("table:condition", "oooc:cell-content-is-whole-number() and cell-content()>=0"); $validator->setAttribute("table:allow-empty-cell", "false"); $validator->setAttribute("table:base-cell-address", $msg['ods_synthesis'] . "B6"); $help = $output->createElement('table:help-message'); $help->setAttribute("table:title", $msg['ods_val_title']); $help->setAttribute("table:display", "true"); $text = $output->createElement('text:p', $msg['ods_val_helpmsg']); $help->appendChild($text); $validator->appendChild($help); $error = $output->createElement('table:error-message'); $error->setAttribute("table:message-type", "stop"); $error->setAttribute("table:title", $msg['ods_val_error']); $error->setAttribute("table:display", "true"); $text = $output->createElement('text:p', $msg['ods_val_errormsg']); $error->appendChild($text); $validator->appendChild($error); $validators->appendChild($validator); return $validators; } function createFont($fontFamily) { global $output; $font = $output->createElement('style:font-face'); $font->setAttribute("style:name", $fontFamily); $font->setAttribute("svg:font-family", "'{$fontFamily}'"); $font->setAttribute("style:font-pitch", "variable"); return $font; } function createColumnStyle($name, $width) { global $output; $style = $output->createElement('style:style'); $style->setAttribute("style:name", $name); $style->setAttribute("style:family", "table-column"); $substyle = $output->createElement('style:table-column-properties'); $substyle->setAttribute("fo:break-before", "auto"); $substyle->setAttribute("style:column-width", $width); $style->appendChild($substyle); return $style; } function createRowStyle($name, $height) { global $output; $style = $output->createElement('style:style'); $style->setAttribute("style:name", $name); $style->setAttribute("style:family", "table-row"); $substyle = $output->createElement('style:table-row-properties'); $substyle->setAttribute("style:row-height", $height); $substyle->setAttribute("fo:break-before", "auto"); $substyle->setAttribute("style:use-optimal-row-height", "true"); $style->appendChild($substyle); return $style; } function createCellStyle($name, $wrap, $backgroundColor, $textAlignSource, $repeatContent, $verticalALign, $textAlign, $marginLeft, $fontColor, $fontWeight, $border, $fontSize, $fontStyle, $underline, $protected = true) { global $output; $style = $output->createElement('style:style'); $style->setAttribute("style:name", $name); $style->setAttribute("style:family", "table-cell"); $style->setAttribute("style:parent-style-name", "Default"); if (isset($wrap) || isset($backgroundColor) || isset($textAlignSource) || isset($repeatContent) || isset($verticalALign) || isset($border)) { $substyle = $output->createElement('style:table-cell-properties'); if (isset($wrap)) { $substyle->setAttribute("fo:wrap-option", $wrap); } if (isset($backgroundColor)) { $substyle->setAttribute("fo:background-color", $backgroundColor); } if (isset($border)) { $substyle->setAttribute("fo:border", "0.002cm solid #000000"); } if (isset($textAlignSource)) { $substyle->setAttribute("style:text-align-source", $textAlignSource); } if (isset($repeatContent)) { $substyle->setAttribute("style:repeat-content", $repeatContent); } if (isset($verticalALign)) { $substyle->setAttribute("style:vertical-align", $verticalALign); } if (!$protected) { $substyle->setAttribute("style:cell-protect", "none"); $substyle->setAttribute("fo:border", "0.06pt double #ff950e"); $substyle->setAttribute("style:border-line-width", "0.0008in 0.0138in 0.0008in"); } $style->appendChild($substyle); } if (isset($textAlign) || isset($marginLeft)) { $substyle = $output->createElement('style:paragraph-properties'); if (isset($textAlign)) { $substyle->setAttribute("fo:text-align", $textAlign); } if (isset($marginLeft)) { $substyle->setAttribute("fo:margin-left", $marginLeft); } $style->appendChild($substyle); } if (isset($fontColor) || isset($fontWeight) || isset($fontSize) || isset($fontStyle) || isset($underline)) { $substyle = $output->createElement('style:text-properties'); if (isset($fontColor)) { $substyle->setAttribute("fo:color", $fontColor); } if (isset($fontWeight)) { $substyle->setAttribute("fo:font-weight", $fontWeight); } if (isset($fontSize)) { $substyle->setAttribute("fo:font-size", $fontSize . "pt"); } if (isset($fontStyle)) { $substyle->setAttribute("fo:font-style", $fontStyle); } if (isset($underline)) { $substyle->setAttribute("style:text-underline-style", "solid"); $substyle->setAttribute("style:text-underline-width", "auto"); $substyle->setAttribute("style:text-underline-color", "font-color"); } $style->appendChild($substyle); } return $style; } function initSynthesisSheet() { global $output; global $input; global $table0; global $msg; global $ids; global $docs, $names, $lang, $template; include "export/{$template}/settings-ods-{$lang}.php"; $table0 = $output->createElement('table:table'); $table0->setAttribute("table:name", $tpl_msg['ods_synthesis']); $table0->setAttribute("table:style-name", "ta1"); $table0->setAttribute("table:print", "false"); $table0->setAttribute("table:protected", "true"); $protection = $output->createElement('table:table-protection'); $protection->setAttribute("table:select-protected-cells", "true"); $protection->setAttribute("table:select-unprotected-cells", "true"); $table0->appendChild($protection); $table0->appendChild(createColumn("co0", "ce4")); $table0->appendChild(createColumn("co4", "ce7")); foreach ($ids as $id) { $table0->appendChild(createColumn("co0", "ce7")); } //Title $table0->appendChild(createTitleRow1()); $table0->appendChild(createTitleRow2($input->getkey("qsosappfamily"))); $table0->appendChild(createTitleRow3($tpl_msg['ods_synthesis_title'])); $table0->appendChild(createSimpleRow()); //Note on weight modification $row = $output->createElement('table:table-row'); $row->setAttribute("table:style-name", "ro1"); $cell = $output->createElement('table:table-cell'); $cell->setAttribute("table:style-name", "ce16"); $cell->setAttribute("office:value-type", "string"); $text = $output->createElement('text:p', $tpl_msg['ods_note_weight']); $cell->appendChild($text); $row->appendChild($cell); $table0->appendChild($row); $table0->appendChild(createSimpleRow()); //Criteria $row = $output->createElement('table:table-row'); $row->setAttribute("table:style-name", "ro1"); $cell = $output->createElement('table:table-cell'); $cell->setAttribute("table:style-name", "ce11"); $cell->setAttribute("office:value-type", "string"); $text = $output->createElement('text:p', $tpl_msg['ods_criterion']); $cell->appendChild($text); $row->appendChild($cell); //Weight $cell = $output->createElement('table:table-cell'); $cell->setAttribute("table:style-name", "ce12"); $cell->setAttribute("office:value-type", "string"); $text = $output->createElement('text:p', $tpl_msg['ods_weight']); $cell->appendChild($text); $row->appendChild($cell); //Evaluations $i = 0; foreach ($ids as $id) { $input = $docs[$i]; $name = $names[$i]; $i++; $cell = $output->createElement('table:table-cell'); $cell->setAttribute("table:style-name", "ce12"); $cell->setAttribute("office:value-type", "string"); $text = $output->createElement('text:p', $name); $cell->appendChild($text); $row->appendChild($cell); } $table0->appendChild($row); } function initCriteriaSheet() { global $output; global $input; global $table0; global $msg, $lang, $template; include "export/{$template}/settings-ods-{$lang}.php"; //First sheet (Criteria) $table0 = $output->createElement('table:table'); $table0->setAttribute("table:name", $tpl_msg['ods_criteria']); $table0->setAttribute("table:style-name", "ta1"); $table0->setAttribute("table:print", "false"); $table0->setAttribute("table:protected", "true"); $protection = $output->createElement('table:table-protection'); $protection->setAttribute("table:select-protected-cells", "true"); $protection->setAttribute("table:select-unprotected-cells", "true"); $table0->appendChild($protection); $table0->appendChild(createColumn("co0", "ce4")); $table0->appendChild(createColumn("co0", "ce4")); $table0->appendChild(createColumn("co0", "ce4")); $table0->appendChild(createColumn("co0", "ce4")); $table0->appendChild(createColumn("co0", "ce4")); //Title $table0->appendChild(createTitleRow1()); $table0->appendChild(createTitleRow2($input->getkey("qsosappfamily"))); $table0->appendChild(createTitleRow3($tpl_msg['ods_citeria_title'])); $table0->appendChild(createSimpleRow()); //QSOS version $table0->appendChild(createHeaderRow($tpl_msg['ods_qsosversion'], $input->getkey("qsosformat"))); //Template version $table0->appendChild(createHeaderRow($tpl_msg['ods_templateversion'], $input->getkey("qsosspecificformat"))); $table0->appendChild(createSimpleRow()); //Criteria $row = $output->createElement('table:table-row'); $row->setAttribute("table:style-name", "ro1"); $cell = $output->createElement('table:table-cell'); $cell->setAttribute("table:style-name", "ce11"); $cell->setAttribute("office:value-type", "string"); $text = $output->createElement('text:p', $tpl_msg['ods_criterion']); $cell->appendChild($text); $row->appendChild($cell); $cell = $output->createElement('table:table-cell'); $cell->setAttribute("table:style-name", "ce11"); $cell->setAttribute("office:value-type", "string"); $text = $output->createElement('text:p', $tpl_msg['ods_desc']); $cell->appendChild($text); $row->appendChild($cell); $cell = $output->createElement('table:table-cell'); $cell->setAttribute("table:style-name", "ce12"); $cell->setAttribute("office:value-type", "string"); $text = $output->createElement('text:p', $tpl_msg['ods_score0']); $cell->appendChild($text); $row->appendChild($cell); $cell = $output->createElement('table:table-cell'); $cell->setAttribute("table:style-name", "ce12"); $cell->setAttribute("office:value-type", "string"); $text = $output->createElement('text:p', $tpl_msg['ods_score1']); $cell->appendChild($text); $row->appendChild($cell); $cell = $output->createElement('table:table-cell'); $cell->setAttribute("table:style-name", "ce12"); $cell->setAttribute("office:value-type", "string"); $text = $output->createElement('text:p', $tpl_msg['ods_score2']); $cell->appendChild($text); $row->appendChild($cell); $table0->appendChild($row); } function initEvaluationSheet($title) { global $output; global $input; global $table1; global $msg, $lang, $template; include "export/{$template}/settings-ods-{$lang}.php"; //Second sheet (Evaluation) $table1 = $output->createElement('table:table'); $table1->setAttribute("table:name", $title); $table1->setAttribute("table:style-name", "ta1"); $table1->setAttribute("table:print", "false"); $table1->setAttribute("table:protected", "true"); $protection = $output->createElement('table:table-protection'); $protection->setAttribute("table:select-protected-cells", "true"); $protection->setAttribute("table:select-unprotected-cells", "true"); $table1->appendChild($protection); $table1->appendChild(createColumn("co1", "ce4")); $table1->appendChild(createColumn("co2", "ce4")); $table1->appendChild(createColumn("co3", "ce7")); $table1->appendChild(createColumn("co4", "ce7")); //Title $header = $tpl_msg['ods_evaluation_title'] . $input->getkey("appname") . " " . $input->getkey("release"); $table1->appendChild(createTitleRow1()); $table1->appendChild(createTitleRow2($input->getkey("qsosappfamily"))); $table1->appendChild(createTitleRow3($header)); $table1->appendChild(createSimpleRow()); //Header //Application $table1->appendChild(createHeaderRow($tpl_msg['ods_application'], $input->getkey("appname"))); //Release $table1->appendChild(createHeaderRow($tpl_msg['ods_release'], $input->getkey("release"))); //License $table1->appendChild(createHeaderRow($tpl_msg['ods_license'], $input->getkey("licensedesc"))); //Url $table1->appendChild(createHeaderRow($tpl_msg['ods_website'], $input->getkey("url"))); //Description $table1->appendChild(createHeaderRow($tpl_msg['ods_description'], $input->getkey("desc"))); //Authors $authors = $input->getauthors(); $list = ""; for ($i = 0; $i < count($authors); $i++) { if ($i != 0) { $list .= ", "; } $list .= $authors[$i]->name . " (" . $authors[$i]->email . ")"; } $table1->appendChild(createHeaderRow($tpl_msg['ods_authors'], $list)); //Creation date $table1->appendChild(createHeaderRow($tpl_msg['ods_creationdate'], $input->getkey("creation"))); //Validation date $table1->appendChild(createHeaderRow($tpl_msg['ods_validationdate'], $input->getkey("validation"))); $table1->appendChild(createSimpleRow()); //Criteria $row = $output->createElement('table:table-row'); $row->setAttribute("table:style-name", "ro1"); $cell = $output->createElement('table:table-cell'); $cell->setAttribute("table:style-name", "ce11"); $cell->setAttribute("office:value-type", "string"); $text = $output->createElement('text:p', $tpl_msg['ods_criterion']); $cell->appendChild($text); $row->appendChild($cell); $cell = $output->createElement('table:table-cell'); $cell->setAttribute("table:style-name", "ce11"); $cell->setAttribute("office:value-type", "string"); $text = $output->createElement('text:p', $tpl_msg['ods_comment']); $cell->appendChild($text); $row->appendChild($cell); $cell = $output->createElement('table:table-cell'); $cell->setAttribute("table:style-name", "ce12"); $cell->setAttribute("office:value-type", "string"); $text = $output->createElement('text:p', $tpl_msg['ods_score']); $cell->appendChild($text); $row->appendChild($cell); $cell = $output->createElement('table:table-cell'); $cell->setAttribute("table:style-name", "ce12"); $cell->setAttribute("office:value-type", "string"); $text = $output->createElement('text:p', $tpl_msg['ods_weight']); $cell->appendChild($text); $row->appendChild($cell); $table1->appendChild($row); } function initDocument() { global $output; //MAIN DOCUMENT ELEMENT $document = $output->createElement('office:document-content'); $document->setAttribute("xmlns:office", "urn:oasis:names:tc:opendocument:xmlns:office:1.0"); $document->setAttribute("xmlns:style", "urn:oasis:names:tc:opendocument:xmlns:style:1.0"); $document->setAttribute("xmlns:text", "urn:oasis:names:tc:opendocument:xmlns:text:1.0"); $document->setAttribute("xmlns:table", "urn:oasis:names:tc:opendocument:xmlns:table:1.0"); $document->setAttribute("xmlns:draw", "urn:oasis:names:tc:opendocument:xmlns:drawing:1.0"); $document->setAttribute("xmlns:fo", "urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0"); $document->setAttribute("xmlns:xlink", "http://www.w3.org/1999/xlink"); $document->setAttribute("xmlns:dc", "http://purl.org/dc/elements/1.1/"); $document->setAttribute("xmlns:meta", "urn:oasis:names:tc:opendocument:xmlns:meta:1.0"); $document->setAttribute("xmlns:number", "urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0"); $document->setAttribute("xmlns:svg", "urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0"); $document->setAttribute("xmlns:chart", "urn:oasis:names:tc:opendocument:xmlns:chart:1.0"); $document->setAttribute("xmlns:dr3d", "urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0"); $document->setAttribute("xmlns:math", "http://www.w3.org/1998/Math/MathML"); $document->setAttribute("xmlns:form", "urn:oasis:names:tc:opendocument:xmlns:form:1.0"); $document->setAttribute("xmlns:script", "urn:oasis:names:tc:opendocument:xmlns:script:1.0"); $document->setAttribute("xmlns:ooo", "http://openoffice.org/2004/office"); $document->setAttribute("xmlns:ooow", "http://openoffice.org/2004/writer"); $document->setAttribute("xmlns:oooc", "http://openoffice.org/2004/calc"); $document->setAttribute("xmlns:dom", "http://www.w3.org/2001/xml-events"); $document->setAttribute("xmlns:xforms", "http://www.w3.org/2002/xforms"); $document->setAttribute("xmlns:xsd", "http://www.w3.org/2001/XMLSchema"); $document->setAttribute("xmlns:xsi", "http://www.w3.org/2001/XMLSchema-instance"); $document->setAttribute("office:version", "1.2"); //FONT DECLARATIONS $fontfaces = $output->createElement('office:font-face-decls'); $fontfaces->appendChild(createFont("Lucida Sans Unicode")); $fontfaces->appendChild(createFont("Tahoma")); $fontfaces->appendChild(createFont("Arial")); $document->appendChild($fontfaces); //STYLE DECLARATIONS $styles = $output->createElement('office:automatic-styles'); //Column styles $styles->appendChild(createColumnStyle("co0", "4.717cm")); $styles->appendChild(createColumnStyle("co1", "5.117cm")); $styles->appendChild(createColumnStyle("co2", "10.931cm")); $styles->appendChild(createColumnStyle("co3", "1.452cm")); $styles->appendChild(createColumnStyle("co4", "1.452cm")); //Row styles $styles->appendChild(createRowStyle("ro1", "0.453cm")); $styles->appendChild(createRowStyle("ro2", "0.453cm")); //ta1: basic table $style = $output->createElement('style:style'); $style->setAttribute("style:name", "ta1"); $style->setAttribute("style:family", "table"); $style->setAttribute("style:master-page-name", "Default"); $substyle = $output->createElement('style:table-properties'); $substyle->setAttribute("table:display", "true"); $substyle->setAttribute("style:writing-mode", "lr-tb"); $style->appendChild($substyle); $styles->appendChild($style); //Cell styles $styles->appendChild(createCellStyle("ce1", "wrap", null, null, null, "middle", null, null, "#ffffff", null, null, null, null, null, true)); $styles->appendChild(createCellStyle("ce2", "wrap", "#2323dc", null, null, "middle", null, null, "#ffffff", "bold", true, null, null, null, true)); $styles->appendChild(createCellStyle("ce3", "wrap", "#99ccff", null, null, "middle", null, null, null, null, true, null, null, null, true)); $styles->appendChild(createCellStyle("ce4", "wrap", "#ccffff", null, null, "middle", null, null, null, null, true, null, null, null, true)); $styles->appendChild(createCellStyle("ce4c", "wrap", "#ccffff", null, null, "middle", "center", null, null, null, true, null, null, null, false)); $styles->appendChild(createCellStyle("ce5", null, "#2323dc", "fix", "false", "middle", "center", "0cm", "#ffffff", "bold", true, null, null, null, true)); $styles->appendChild(createCellStyle("ce5c", null, "#2323dc", "fix", "false", "middle", "center", "0cm", "#ffffff", "bold", true, null, null, null, false)); $styles->appendChild(createCellStyle("ce6", null, "#99ccff", "fix", "false", "middle", "center", "0cm", null, null, true, null, null, null, true)); $styles->appendChild(createCellStyle("ce6c", null, "#99ccff", "fix", "false", "middle", "center", "0cm", null, null, true, null, null, null, false)); $styles->appendChild(createCellStyle("ce7", null, "#ccffff", "fix", "false", "middle", "center", "0cm", null, null, true, null, null, null, true)); $styles->appendChild(createCellStyle("ce8", "wrap", null, "fix", "false", "middle", null, null, null, null, true, null, null, null, true)); $styles->appendChild(createCellStyle("ce9", null, null, "fix", "false", "middle", "center", "0cm", null, null, true, null, null, null, true)); $styles->appendChild(createCellStyle("ce9c", null, null, "fix", "false", "middle", "center", "0cm", null, null, true, null, null, null, false)); $styles->appendChild(createCellStyle("ce10", "wrap", null, "fix", "false", "middle", null, null, null, null, null, null, null, null, true)); $styles->appendChild(createCellStyle("ce11", "wrap", "#000000", null, null, "middle", null, null, "#ffffff", "bold", true, null, null, null, true)); $styles->appendChild(createCellStyle("ce12", "wrap", "#000000", null, null, "middle", "center", null, "#ffffff", "bold", true, null, null, null, true)); $styles->appendChild(createCellStyle("ce13", null, null, null, null, "middle", null, null, "#000000", "bold", null, null, null, null, true)); $styles->appendChild(createCellStyle("ce14", null, null, null, null, "middle", null, null, "#000000", "bold", null, 12, null, null, true)); $styles->appendChild(createCellStyle("ce15", null, null, null, null, "middle", null, null, "#000000", "bold", null, 14, null, null, true)); $styles->appendChild(createCellStyle("ce16", null, null, null, null, "middle", null, null, "#000000", null, null, null, "italic", null, true)); $styles->appendChild(createCellStyle("ce17", null, null, null, null, "middle", null, null, "#000000", null, null, null, null, null, true)); $styles->appendChild(createCellStyle("ce18", null, null, null, null, "middle", null, null, "#000000", "bold", null, null, null, true, true)); $document->appendChild($styles); return $document; } function createMapEntry($name, $split) { global $output_settings; $table = $output_settings->createElement('config:config-item-map-entry'); $table->setAttribute("config:name", $name); $config_item = $output_settings->createElement('config:config-item', 0); $config_item->setAttribute("config:name", "CursorPositionX"); $config_item->setAttribute("config:type", "int"); $table->appendChild($config_item); $config_item = $output_settings->createElement('config:config-item', 0); $config_item->setAttribute("config:name", "CursorPositionY"); $config_item->setAttribute("config:type", "int"); $table->appendChild($config_item); $config_item = $output_settings->createElement('config:config-item', 0); $config_item->setAttribute("config:name", "HorizontalSplitMode"); $config_item->setAttribute("config:type", "short"); $table->appendChild($config_item); $config_item = $output_settings->createElement('config:config-item', 2); $config_item->setAttribute("config:name", "VerticalSplitMode"); $config_item->setAttribute("config:type", "short"); $table->appendChild($config_item); $config_item = $output_settings->createElement('config:config-item', 0); $config_item->setAttribute("config:name", "HorizontalSplitPosition"); $config_item->setAttribute("config:type", "int"); $table->appendChild($config_item); $config_item = $output_settings->createElement('config:config-item', $split); $config_item->setAttribute("config:name", "VerticalSplitPosition"); $config_item->setAttribute("config:type", "int"); $table->appendChild($config_item); $config_item = $output_settings->createElement('config:config-item', 0); $config_item->setAttribute("config:name", "ActiveSplitRange"); $config_item->setAttribute("config:type", "short"); $table->appendChild($config_item); $config_item = $output_settings->createElement('config:config-item', 0); $config_item->setAttribute("config:name", "PositionLeft"); $config_item->setAttribute("config:type", "int"); $table->appendChild($config_item); $config_item = $output_settings->createElement('config:config-item', 0); $config_item->setAttribute("config:name", "PositionRight"); $config_item->setAttribute("config:type", "int"); $table->appendChild($config_item); $config_item = $output_settings->createElement('config:config-item', 0); $config_item->setAttribute("config:name", "PositionTop"); $config_item->setAttribute("config:type", "int"); $table->appendChild($config_item); $config_item = $output_settings->createElement('config:config-item', $split); $config_item->setAttribute("config:name", "PositionBottom"); $config_item->setAttribute("config:type", "int"); $table->appendChild($config_item); $config_item = $output_settings->createElement('config:config-item', 0); $config_item->setAttribute("config:name", "ZoomType"); $config_item->setAttribute("config:type", "short"); $table->appendChild($config_item); $config_item = $output_settings->createElement('config:config-item', 100); $config_item->setAttribute("config:name", "ZoomValue"); $config_item->setAttribute("config:type", "int"); $table->appendChild($config_item); $config_item = $output_settings->createElement('config:config-item', 60); $config_item->setAttribute("config:name", "PageViewZoomValue"); $config_item->setAttribute("config:type", "int"); $table->appendChild($config_item); $config_item = $output_settings->createElement('config:config-item', 'true'); $config_item->setAttribute("config:name", "ShowGrid"); $config_item->setAttribute("config:type", "boolean"); $table->appendChild($config_item); return $table; } function createSettings() { global $output_settings, $ids, $docs, $names, $msg, $input, $lang, $template; include "export/{$template}/settings-ods-{$lang}.php"; //SETTINGS $settings = $output_settings->createElement('office:document-settings'); $settings->setAttribute("xmlns:office", "urn:oasis:names:tc:opendocument:xmlns:office:1.0"); $settings->setAttribute("xmlns:xlink", "http://www.w3.org/1999/xlink"); $settings->setAttribute("xmlns:config", "urn:oasis:names:tc:opendocument:xmlns:config:1.0"); $settings->setAttribute("xmlns:ooo", "http://openoffice.org/2004/office"); $settings->setAttribute("office:version", "1.2"); $office_settings = $output_settings->createElement('office:settings'); $view_settings = $output_settings->createElement('config:config-item-set'); $view_settings->setAttribute("config:name", "ooo:view-settings"); $config_item = $output_settings->createElement('config:config-item', 0); $config_item->setAttribute("config:name", "VisibleAreaTop"); $config_item->setAttribute("config:type", "int"); $view_settings->appendChild($config_item); $config_item = $output_settings->createElement('config:config-item', 0); $config_item->setAttribute("config:name", "VisibleAreaLeft"); $config_item->setAttribute("config:type", "int"); $view_settings->appendChild($config_item); $config_item = $output_settings->createElement('config:config-item', 2257); $config_item->setAttribute("config:name", "VisibleAreaWidth"); $config_item->setAttribute("config:type", "int"); $view_settings->appendChild($config_item); $config_item = $output_settings->createElement('config:config-item', 4268); $config_item->setAttribute("config:name", "VisibleAreaHeight"); $config_item->setAttribute("config:type", "int"); $view_settings->appendChild($config_item); $views = $output_settings->createElement('config:config-item-map-indexed'); $views->setAttribute("config:name", "Views"); $map_entry = $output_settings->createElement('config:config-item-map-entry'); $view1 = $output_settings->createElement('config:config-item', 'view1'); $view1->setAttribute("config:name", "ViewId"); $view1->setAttribute("config:type", "string"); $map_entry->appendChild($view1); $tables = $output_settings->createElement('config:config-item-map-named'); $tables->setAttribute("config:name", "Tables"); //Freeze of synthesis sheet $tables->appendChild(createMapEntry($tpl_msg['ods_synthesis'], 7)); //Freeze of criteria sheet $tables->appendChild(createMapEntry($tpl_msg['ods_criteria'], 8)); //Freeze of evaluation sheets $i = 0; foreach ($ids as $id) { $input = $docs[$i]; $name = $names[$i]; $i++; $tables->appendChild(createMapEntry($name, 14)); } $map_entry->appendChild($tables); $config_item = $output_settings->createElement('config:config-item', $tpl_msg['ods_home']); $config_item->setAttribute("config:name", "ActiveTable"); $config_item->setAttribute("config:type", "string"); $map_entry->appendChild($config_item); $config_item = $output_settings->createElement('config:config-item', 270); $config_item->setAttribute("config:name", "HorizontalScrollbarWidth"); $config_item->setAttribute("config:type", "int"); $map_entry->appendChild($config_item); $config_item = $output_settings->createElement('config:config-item', 0); $config_item->setAttribute("config:name", "ZoomType"); $config_item->setAttribute("config:type", "short"); $map_entry->appendChild($config_item); $config_item = $output_settings->createElement('config:config-item', 100); $config_item->setAttribute("config:name", "ZoomValue"); $config_item->setAttribute("config:type", "int"); $map_entry->appendChild($config_item); $config_item = $output_settings->createElement('config:config-item', 60); $config_item->setAttribute("config:name", "PageViewZoomValue"); $config_item->setAttribute("config:type", "int"); $map_entry->appendChild($config_item); $config_item = $output_settings->createElement('config:config-item', 'false'); $config_item->setAttribute("config:name", "ShowPageBreakPreview"); $config_item->setAttribute("config:type", "boolean"); $map_entry->appendChild($config_item); $config_item = $output_settings->createElement('config:config-item', 'true'); $config_item->setAttribute("config:name", "ShowZeroValues"); $config_item->setAttribute("config:type", "boolean"); $map_entry->appendChild($config_item); $config_item = $output_settings->createElement('config:config-item', 'true'); $config_item->setAttribute("config:name", "ShowNotes"); $config_item->setAttribute("config:type", "boolean"); $map_entry->appendChild($config_item); $config_item = $output_settings->createElement('config:config-item', 'true'); $config_item->setAttribute("config:name", "ShowGrid"); $config_item->setAttribute("config:type", "boolean"); $map_entry->appendChild($config_item); $config_item = $output_settings->createElement('config:config-item', 12632256); $config_item->setAttribute("config:name", "GridColor"); $config_item->setAttribute("config:type", "long"); $map_entry->appendChild($config_item); $config_item = $output_settings->createElement('config:config-item', 'true'); $config_item->setAttribute("config:name", "ShowPageBreaks"); $config_item->setAttribute("config:type", "boolean"); $map_entry->appendChild($config_item); $config_item = $output_settings->createElement('config:config-item', 'true'); $config_item->setAttribute("config:name", "HasColumnRowHeaders"); $config_item->setAttribute("config:type", "boolean"); $map_entry->appendChild($config_item); $config_item = $output_settings->createElement('config:config-item', 'true'); $config_item->setAttribute("config:name", "HasSheetTabs"); $config_item->setAttribute("config:type", "boolean"); $map_entry->appendChild($config_item); $config_item = $output_settings->createElement('config:config-item', 'true'); $config_item->setAttribute("config:name", "IsOutlineSymbolsSet"); $config_item->setAttribute("config:type", "boolean"); $map_entry->appendChild($config_item); $config_item = $output_settings->createElement('config:config-item', 'false'); $config_item->setAttribute("config:name", "IsSnapToRaster"); $config_item->setAttribute("config:type", "boolean"); $map_entry->appendChild($config_item); $config_item = $output_settings->createElement('config:config-item', 'false'); $config_item->setAttribute("config:name", "RasterIsVisible"); $config_item->setAttribute("config:type", "boolean"); $map_entry->appendChild($config_item); $config_item = $output_settings->createElement('config:config-item', 1270); $config_item->setAttribute("config:name", "RasterResolutionX"); $config_item->setAttribute("config:type", "int"); $map_entry->appendChild($config_item); $config_item = $output_settings->createElement('config:config-item', 1270); $config_item->setAttribute("config:name", "RasterResolutionY"); $config_item->setAttribute("config:type", "int"); $map_entry->appendChild($config_item); $config_item = $output_settings->createElement('config:config-item', 1); $config_item->setAttribute("config:name", "RasterSubdivisionX"); $config_item->setAttribute("config:type", "int"); $map_entry->appendChild($config_item); $config_item = $output_settings->createElement('config:config-item', 1); $config_item->setAttribute("config:name", "RasterSubdivisionY"); $config_item->setAttribute("config:type", "int"); $map_entry->appendChild($config_item); $config_item = $output_settings->createElement('config:config-item', 'true'); $config_item->setAttribute("config:name", "IsRasterAxisSynchronized"); $config_item->setAttribute("config:type", "boolean"); $map_entry->appendChild($config_item); $views->appendChild($map_entry); $view_settings->appendChild($views); $office_settings->appendChild($view_settings); $conf_settings = $output_settings->createElement('config:config-item-set'); $conf_settings->setAttribute("config:name", "ooo:configuration-settings"); $config_item = $output_settings->createElement('config:config-item', 'false'); $config_item->setAttribute("config:name", "IsKernAsianPunctuation"); $config_item->setAttribute("config:type", "boolean"); $conf_settings->appendChild($config_item); $config_item = $output_settings->createElement('config:config-item', 'true'); $config_item->setAttribute("config:name", "UpdateFromTemplate"); $config_item->setAttribute("config:type", "boolean"); $conf_settings->appendChild($config_item); $config_item = $output_settings->createElement('config:config-item', 'false'); $config_item->setAttribute("config:name", "LoadReadonly"); $config_item->setAttribute("config:type", "boolean"); $conf_settings->appendChild($config_item); $config_item = $output_settings->createElement('config:config-item', 'false'); $config_item->setAttribute("config:name", "IsDocumentShared"); $config_item->setAttribute("config:type", "boolean"); $conf_settings->appendChild($config_item); $config_item = $output_settings->createElement('config:config-item', 'true'); $config_item->setAttribute("config:name", "AutoCalculate"); $config_item->setAttribute("config:type", "boolean"); $conf_settings->appendChild($config_item); $config_item = $output_settings->createElement('config:config-item'); $config_item->setAttribute("config:name", "PrinterSetup"); $config_item->setAttribute("config:type", "base64Binary"); $conf_settings->appendChild($config_item); $config_item = $output_settings->createElement('config:config-item', 'false'); $config_item->setAttribute("config:name", "RasterIsVisible"); $config_item->setAttribute("config:type", "boolean"); $conf_settings->appendChild($config_item); $config_item = $output_settings->createElement('config:config-item'); $config_item->setAttribute("config:name", "PrinterName"); $config_item->setAttribute("config:type", "string"); $conf_settings->appendChild($config_item); $config_item = $output_settings->createElement('config:config-item', 1270); $config_item->setAttribute("config:name", "RasterResolutionY"); $config_item->setAttribute("config:type", "int"); $conf_settings->appendChild($config_item); $config_item = $output_settings->createElement('config:config-item', 'true'); $config_item->setAttribute("config:name", "IsRasterAxisSynchronized"); $config_item->setAttribute("config:type", "boolean"); $conf_settings->appendChild($config_item); $config_item = $output_settings->createElement('config:config-item', 0); $config_item->setAttribute("config:name", "CharacterCompressionType"); $config_item->setAttribute("config:type", "short"); $conf_settings->appendChild($config_item); $config_item = $output_settings->createElement('config:config-item', 1270); $config_item->setAttribute("config:name", "RasterResolutionX"); $config_item->setAttribute("config:type", "int"); $conf_settings->appendChild($config_item); $config_item = $output_settings->createElement('config:config-item', 'false'); $config_item->setAttribute("config:name", "IsSnapToRaster"); $config_item->setAttribute("config:type", "boolean"); $conf_settings->appendChild($config_item); $config_item = $output_settings->createElement('config:config-item', 'true'); $config_item->setAttribute("config:name", "HasColumnRowHeaders"); $config_item->setAttribute("config:type", "boolean"); $conf_settings->appendChild($config_item); $config_item = $output_settings->createElement('config:config-item', 1); $config_item->setAttribute("config:name", "RasterSubdivisionX"); $config_item->setAttribute("config:type", "int"); $conf_settings->appendChild($config_item); $config_item = $output_settings->createElement('config:config-item', 12632256); $config_item->setAttribute("config:name", "GridColor"); $config_item->setAttribute("config:type", "long"); $conf_settings->appendChild($config_item); $config_item = $output_settings->createElement('config:config-item', 'true'); $config_item->setAttribute("config:name", "ShowZeroValues"); $config_item->setAttribute("config:type", "boolean"); $conf_settings->appendChild($config_item); $config_item = $output_settings->createElement('config:config-item', 1); $config_item->setAttribute("config:name", "RasterSubdivisionY"); $config_item->setAttribute("config:type", "int"); $conf_settings->appendChild($config_item); $config_item = $output_settings->createElement('config:config-item', 'false'); $config_item->setAttribute("config:name", "SaveVersionOnClose"); $config_item->setAttribute("config:type", "boolean"); $conf_settings->appendChild($config_item); $config_item = $output_settings->createElement('config:config-item', 'true'); $config_item->setAttribute("config:name", "ShowPageBreaks"); $config_item->setAttribute("config:type", "boolean"); $conf_settings->appendChild($config_item); $config_item = $output_settings->createElement('config:config-item', 'true'); $config_item->setAttribute("config:name", "ShowGrid"); $config_item->setAttribute("config:type", "boolean"); $conf_settings->appendChild($config_item); $config_item = $output_settings->createElement('config:config-item', 'true'); $config_item->setAttribute("config:name", "IsOutlineSymbolsSet"); $config_item->setAttribute("config:type", "boolean"); $conf_settings->appendChild($config_item); $config_item = $output_settings->createElement('config:config-item', 'true'); $config_item->setAttribute("config:name", "AllowPrintJobCancel"); $config_item->setAttribute("config:type", "boolean"); $conf_settings->appendChild($config_item); $config_item = $output_settings->createElement('config:config-item', 'true'); $config_item->setAttribute("config:name", "ApplyUserData"); $config_item->setAttribute("config:type", "boolean"); $conf_settings->appendChild($config_item); $config_item = $output_settings->createElement('config:config-item', 3); $config_item->setAttribute("config:name", "LinkUpdateMode"); $config_item->setAttribute("config:type", "short"); $conf_settings->appendChild($config_item); $config_item = $output_settings->createElement('config:config-item', 'true'); $config_item->setAttribute("config:name", "ShowNotes"); $config_item->setAttribute("config:type", "boolean"); $conf_settings->appendChild($config_item); $config_item = $output_settings->createElement('config:config-item', 'true'); $config_item->setAttribute("config:name", "HasSheetTabs"); $config_item->setAttribute("config:type", "boolean"); $conf_settings->appendChild($config_item); $office_settings->appendChild($conf_settings); $settings->appendChild($office_settings); return $settings; } function createHomeSheet() { global $docs, $ids, $names; global $table0; global $output, $input; global $msg, $lang, $template; include "export/{$template}/settings-ods-{$lang}.php"; //First sheet (Criteria) $table0 = $output->createElement('table:table'); $table0->setAttribute("table:name", $tpl_msg['ods_home']); $table0->setAttribute("table:style-name", "ta1"); $table0->setAttribute("table:print", "false"); $table0->setAttribute("table:protected", "true"); $protection = $output->createElement('table:table-protection'); $protection->setAttribute("table:select-protected-cells", "true"); $protection->setAttribute("table:select-unprotected-cells", "true"); $table0->appendChild($protection); $table0->appendChild(createColumn("co4", "ce1")); $table0->appendChild(createColumn("co0", "ce1")); $table0->appendChild(createColumn("co0", "ce1")); $table0->appendChild(createColumn("co0", "ce1")); $table0->appendChild(createColumn("co0", "ce1")); //Title $table0->appendChild(createTitleRow1()); $table0->appendChild(createTitleRow2($input->getkey("qsosappfamily"))); $table0->appendChild(createTitleRow3($tpl_msg['ods_home_subtitle'])); $table0->appendChild(createSimpleRow()); $table0->appendChild(createSimpleRow()); //Text $table0->appendChild(createHomeDoubleRow("Version", "1.0")); $table0->appendChild(createHomeDoubleRow("Date", date('d/m/Y'))); $table0->appendChild(createSimpleRow()); $table0->appendChild(createSimpleRow()); $table0->appendChild(createHomeUderlineRow($tpl_msg['ods_home_text1'])); $table0->appendChild(createHomeDoubleRow($tpl_msg['ods_home'], $tpl_msg['ods_home_text2'])); $table0->appendChild(createHomeDoubleRow($tpl_msg['ods_synthesis'], $tpl_msg['ods_home_text3'])); $table0->appendChild(createHomeDoubleRow($tpl_msg['ods_criteria'], $tpl_msg['ods_home_text4'])); $i = 0; foreach ($ids as $id) { $input = $docs[$i]; $title = $names[$i]; $i++; $value = $tpl_msg['ods_home_text6'] . $title; $table0->appendChild(createHomeDoubleRow($title, $value)); } $table0->appendChild(createSimpleRow()); $table0->appendChild(createSimpleRow()); $table0->appendChild(createHomeUderlineRow("NB :")); $table0->appendChild(createHomeItalicRow($tpl_msg['ods_home_text5'])); if ($tpl_msg['ods_home_license']) { $table0->appendChild(createSimpleRow()); $table0->appendChild(createSimpleRow()); $table0->appendChild(createHomeUderlineRow($tpl_msg['ods_home_license'])); } } $output = new DOMDocument(); $output_settings = new DOMDocument('1.0', 'UTF-8'); //Init document $document = initDocument(); $body = $output->createElement('office:body'); $spreadsheet = $output->createElement('office:spreadsheet'); //Create settings $settings = createSettings(); $output_settings->appendChild($settings); //Validator for weight values $spreadsheet->appendChild(createValidator()); //Home sheet $input = $docs[0]; createHomeSheet(); $spreadsheet->appendChild($table0); //Synthesis Sheet initSynthesisSheet(); $numrow = 7; //Reinit row counter createTreeSynthesis($input->getTree(), $table0, 0); $spreadsheet->appendChild($table0); //Criteria Sheet initCriteriaSheet(); createTreeCriteria($input->getTree(), $table0, 0); $spreadsheet->appendChild($table0); //Evaluation Sheets $i = 0; foreach ($ids as $id) { $input = $docs[$i]; $name = $names[$i]; $i++; initEvaluationSheet($name); $numrow = 14; //Reinit row counter createTreeEval($input->getTree(), $table1, 0); $spreadsheet->appendChild($table1); } //Finalize Document (in memory) $body->appendChild($spreadsheet); $document->appendChild($body); $output->appendChild($document); //Finalize Document (on disk) $tempdir = $this->temp . uniqid(); mkdir($tempdir, 0755); $output->save("{$tempdir}/content.xml"); $output_settings->save("{$tempdir}/settings.xml"); copy("export/{$template}/template_ods.zip", "odf/{$odsfile}"); include 'libs/pclzip.lib.php'; $oofile = new PclZip("odf/{$odsfile}"); $v_list = $oofile->add("{$tempdir}/content.xml", PCLZIP_OPT_REMOVE_PATH, $tempdir); if ($v_list == 0) { die("Error 01: ODS generation " . $oofile->errorInfo(true)); } $v_list = $oofile->add("{$tempdir}/settings.xml", PCLZIP_OPT_REMOVE_PATH, $tempdir); if ($v_list == 0) { die("Error 02: ODS generation " . $oofile->errorInfo(true)); } //Return ODS file to the browser header("Location: odf/{$odsfile}"); exit; }