Esempio n. 1
0
 function _save(TikiSheet &$sheet)
 {
     //		if ( $sheet->headerRow + $sheet->footerRow > $sheet->getRowCount() )
     //			return false;
     $beginRow = $sheet->getRangeBeginRow();
     $endRow = $sheet->getRangeEndRow();
     $beginCol = $sheet->getRangeBeginCol();
     $endCol = $sheet->getRangeEndCol();
     if ($beginRow > -1 && $beginRow == $endRow - 1 && $beginCol == $endCol - 1) {
         if (isset($sheet->dataGrid[$beginRow][$beginCol])) {
             $data = $sheet->dataGrid[$beginRow][$beginCol];
             if ($sheet->parseValues == 'y' && mb_ereg_match('[^A-Za-z0-9\\s]', $data)) {
                 // needs to be multibyte regex here
                 global $tikilib;
                 $data = $tikilib->parse_data($data, array('suppress_icons' => true));
             }
             $this->output = $data;
             return true;
         }
     }
     $class = empty($sheet->cssName) ? "" : " class='{$sheet->cssName}'";
     $id = empty($sheet->id) ? '' : " data-id='{$sheet->id}'";
     $title = " title='" . htmlspecialchars($sheet->name(), ENT_QUOTES) . "'";
     $type = !empty($sheet->type) ? ' data-type="' . $sheet->type . '" ' : '';
     $this->output = "<table" . $class . $id . $title . $type . ">\n";
     if (!is_null($this->heading)) {
         $this->output .= "\t<caption>{$this->heading}</caption>\n";
     }
     if ($sheet->headerRow > 0 && $beginRow < 0) {
         $this->output .= "\t<thead>\n";
         $this->drawRows($sheet);
         $this->output .= "\t</thead>\n";
     }
     $this->output .= "\t<colgroup>\n";
     $this->drawCols($sheet);
     $this->output .= "\t</colgroup>\n";
     $this->output .= "\t<tbody>\n";
     $this->drawRows($sheet);
     $this->output .= "\t</tbody>\n";
     if ($sheet->footerRow > 0 && $beginRow < 0) {
         $this->output .= "\t<tfoot>\n";
         $this->drawRows($sheet);
         $this->output .= "\t</tfoot>\n";
     }
     $this->output .= "</table>\n";
     return true;
 }