<?php

if ($extView = $this->getExtViewFile(__FILE__)) {
    include $extView;
    return helper::cd();
}
include 'header.lite.html.php';
?>
<nav class='navbar navbar-inverse navbar-fixed-top' role='navigation' id='mainNavbar'>
  <div class='navbar-header'>
    <button type='button' class='navbar-toggle' data-toggle='collapse' data-target='#mainNavbarCollapse'>
      <span class='icon-bar'></span>
      <span class='icon-bar'></span>
      <span class='icon-bar'></span>
    </button>
    <?php 
echo html::a($this->createLink($this->config->default->module), $lang->chanzhiEPSx, "class='navbar-brand'");
?>
    <div class='dropdown navbar-header-item'><?php 
include 'selectlang.html.php';
?>
</div>
  </div>
  <div class='collapse navbar-collapse' id='mainNavbarCollapse'>
    <?php 
echo commonModel::createMainMenu($this->moduleName);
?>
    <ul class='nav navbar-nav' id='navbarSwitcher'>
      <li><a href='###'><i class='icon-chevron-sign-right icon-large'></i></a></li>
    </ul>
    <?php 
Beispiel #2
0
 /**
  * Get the extension file of an view.
  * 
  * @param  string $viewFile 
  * @access public
  * @return string|bool  If extension view file exists, return the path. Else return fasle.
  */
 public function getExtViewFile($viewFile)
 {
     $extPath = dirname(realpath($viewFile)) . "/ext/_{$this->config->site->code}/";
     $extViewFile = $extPath . basename($viewFile);
     if (file_exists($extViewFile)) {
         helper::cd($extPath);
         return $extViewFile;
     }
     $extPath = RUN_MODE == 'front' ? dirname(realpath($viewFile)) . '/ext/' : dirname(dirname(realpath($viewFile))) . '/ext/view/';
     $extViewFile = $extPath . basename($viewFile);
     if (file_exists($extViewFile)) {
         helper::cd($extPath);
         return $extViewFile;
     }
     return false;
 }
 /**
  * Get the extension file of an view.
  * 
  * @param  string $viewFile 
  * @access public
  * @return string|bool  If extension view file exists, return the path. Else return fasle.
  */
 public function getExtViewFile($viewFile)
 {
     $extPath = dirname(dirname(realpath($viewFile))) . '/ext/view/';
     $extViewFile = $extPath . basename($viewFile);
     if (file_exists($extViewFile)) {
         helper::cd($extPath);
         return $extViewFile;
     }
     return false;
 }
Beispiel #4
0
 /**
  * Export data to Excel. This is main function.
  *
  * @param  object $data 
  * @param  string $savePath , define the path to save xlsx file
  * @access public
  * @return void
  */
 public function export($data, $savePath = '')
 {
     $this->init($data);
     $this->setDocProps();
     $this->excelKey = array();
     for ($i = 0; $i < count($this->fieldsKey); $i++) {
         $field = $this->fieldsKey[$i];
         $this->excelKey[$field] = $this->setExcelField($i);
         if (in_array($field, $this->config->excel->centerFields)) {
             $this->styleSetting['center'][$this->excelKey[$field]] = 1;
         }
         if (strpos($field, 'Date') !== false || in_array($field, $this->config->excel->dateField)) {
             $this->styleSetting['date'][$this->excelKey[$field]] = 1;
         }
     }
     /* Show header data. */
     $this->sheet1SheetData = '<row r="1" spans="1:%colspan%" ht="20" customHeight="1">';
     foreach ($this->fields as $key => $field) {
         $this->sheet1SheetData .= $this->setCellValue($this->excelKey[$key], '1', $field, !isset($this->rawExcelData->nocolor));
     }
     $this->sheet1SheetData .= '</row>';
     /* Write system data in excel.*/
     $this->writeSysData();
     $i = 1;
     $excelData = array();
     foreach ($this->rows as $num => $row) {
         $i++;
         $columnData = array();
         $this->sheet1SheetData .= '<row r="' . $i . '" spans="1:%colspan%" ht="20" customHeight="1">';
         foreach ($this->excelKey as $key => $letter) {
             $value = isset($row[$key]) ? $row[$key] : '';
             /* Merge Cells.*/
             if (isset($this->rawExcelData->rowspan[$num]) and strpos($this->rawExcelData->rowspan[$num]['rows'], ",{$key},") !== false) {
                 $this->mergeCells($letter . $i, $letter . ($i + $this->rawExcelData->rowspan[$num]['num'] - 1));
             }
             if (isset($this->rawExcelData->colspan[$num]) and strpos($this->rawExcelData->colspan[$num]['cols'], ",{$key},") !== false) {
                 $this->mergeCells($letter . $i, chr(ord($letter) + $this->rawExcelData->colspan[$num]['num'] - 1) . $i);
             }
             /* Wipe off html tags. Use to export html message like company->selfDesc via js::kindeditor */
             if (isset($this->config->excel->editor[$this->rawExcelData->kind]) and in_array($key, $this->config->excel->editor[$this->rawExcelData->kind])) {
                 $value = $this->file->excludeHtml($value);
             }
             if (isset($value[1])) {
                 $value = $value[1] == ':' ? $substr($value, 2) : $value;
             }
             $this->sheet1SheetData .= $this->setCellValue($letter, $i, $value, !isset($this->rawExcelData->nocolor));
             /* Build excel list.*/
             if (isset($this->rawExcelData->listStyle) and in_array($key, $this->rawExcelData->listStyle)) {
                 $this->buildList($key, $i);
             }
         }
         $this->sheet1SheetData .= '</row>';
     }
     $this->sheet1Params['colspan'] = count($this->excelKey) - 1;
     $this->setStyle($i);
     if (!empty($this->sheet1Params['cols'])) {
         $this->sheet1Params['cols'] = '<cols>' . $this->sheet1Params['cols'] . '</cols>';
     }
     if (!empty($this->sheet1Params['mergeCells'])) {
         $this->sheet1Params['mergeCells'] = '<mergeCells count="' . $this->counts['mergeCells'] . '">' . $this->sheet1Params['mergeCells'] . '</mergeCells>';
     }
     if (!empty($this->sheet1Params['dataValidations'])) {
         $this->sheet1Params['dataValidations'] = '<dataValidations count="' . $this->counts['dataValidations'] . '">' . $this->sheet1Params['dataValidations'] . '</dataValidations>';
     }
     if (!empty($this->sheet1Params['hyperlinks'])) {
         $this->sheet1Params['hyperlinks'] = '<hyperlinks>' . $this->sheet1Params['hyperlinks'] . '</hyperlinks>';
     }
     /* Save sheet1*/
     $sheet1 = file_get_contents($this->exportPath . 'xl/worksheets/sheet1.xml');
     $sheet1 = str_replace(array('%area%', '%xSplit%', '%topLeftCell%', '%cols%', '%sheetData%', '%mergeCells%', '%dataValidations%', '%hyperlinks%', '%colspan%'), array($this->sheet1Params['area'], $this->sheet1Params['xSplit'], $this->sheet1Params['topLeftCell'], $this->sheet1Params['cols'], $this->sheet1SheetData, $this->sheet1Params['mergeCells'], $this->sheet1Params['dataValidations'], $this->sheet1Params['hyperlinks'], $this->sheet1Params['colspan']), $sheet1);
     file_put_contents($this->exportPath . 'xl/worksheets/sheet1.xml', $sheet1);
     /* Save sharedStrings file. */
     $this->sharedStrings .= '</sst>';
     $this->sharedStrings = str_replace('%count%', $this->record, $this->sharedStrings);
     file_put_contents($this->exportPath . 'xl/sharedStrings.xml', $this->sharedStrings);
     /* Save link message. */
     if ($this->rels) {
         $this->rels = '<?xml version="1.0" encoding="UTF-8" standalone="yes"? ><Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">' . $this->rels . '</Relationships>';
         if (!is_dir($this->exportPath . 'xl/worksheets/_rels/')) {
             mkdir($this->exportPath . 'xl/worksheets/_rels/');
         }
         file_put_contents($this->exportPath . 'xl/worksheets/_rels/sheet1.xml.rels', $this->rels);
     }
     /* urlencode the filename for ie. */
     $fileName = $this->rawExcelData->fileName . '.xlsx';
     /* Zip to xlsx. */
     helper::cd($this->exportPath);
     $files = array('[Content_Types].xml', '_rels', 'docProps', 'xl');
     $zip = new pclzip($fileName);
     $zip->create($files);
     $fileData = file_get_contents($this->exportPath . $fileName);
     $this->zfile->removeDir($this->exportPath);
     if ($savePath == '') {
         $this->sendDownHeader($fileName, 'xlsx', $fileData);
     } else {
         file_put_contents($savePath, $fileData);
     }
 }