@ -0,0 +1,106 @@ |
|||
<?php |
|||
ini_set('display_errors', '1'); |
|||
error_reporting(E_ALL ^ E_NOTICE); |
|||
set_time_limit(0); |
|||
|
|||
// 定义站点目录 |
|||
define('APP_PATH', __DIR__ . '/'); |
|||
|
|||
$_GPC = array(); |
|||
$_GPC = array_merge($_GET, $_POST); |
|||
|
|||
$actions = array('files', 'download'); |
|||
$action = in_array($_GPC['do'], $actions) ? $_GPC['do'] : 'files'; |
|||
call_user_func(array('WeliamCheck', $action)); |
|||
|
|||
class WeliamCheck |
|||
{ |
|||
|
|||
//获取所有文件路径和md5 |
|||
static function files() |
|||
{ |
|||
//获取更新文件 |
|||
$my_scenfiles = self::files_tree(substr(APP_PATH, 0, -1)); |
|||
$files = array(); |
|||
foreach ($my_scenfiles as $sf) { |
|||
if (self::files_filter($sf)) { |
|||
$files[] = array('path' => str_replace(APP_PATH, "", $sf), 'md5' => md5_file($sf)); |
|||
} |
|||
} |
|||
self::message(0, '', $files); |
|||
} |
|||
|
|||
//下载文件 |
|||
static function download() |
|||
{ |
|||
global $_GPC; |
|||
$entry = APP_PATH . trim($_GPC['path']); |
|||
if (is_file($entry) && self::files_filter($entry)) { |
|||
$content = file_get_contents($entry); |
|||
self::message(0, '', array('path' => $_GPC['path'], 'content' => base64_encode($content))); |
|||
} |
|||
self::message(1, '路径错误,文件不存在'); |
|||
} |
|||
|
|||
//移除无需更新文件 |
|||
static function files_filter($file) |
|||
{ |
|||
$file_type = [ |
|||
'.log', |
|||
'.txt', |
|||
'.zip', |
|||
'check.php', |
|||
'install.php', |
|||
'.md', |
|||
'LICENSE', |
|||
APP_PATH . 'addons/weliam_smartcity/data/', |
|||
'manifest.xml', |
|||
APP_PATH . 'addons/weliam_smartcity/plugin/weliam_house/house/runtime/', |
|||
'/attachment/',//临时附件文件 |
|||
'/data/tpl',//页面模板缓存文件 |
|||
'/data/log',//日志文件 |
|||
]; |
|||
foreach ($file_type as $value) { |
|||
if (strpos($file, $value) !== FALSE) { |
|||
return FALSE; |
|||
} |
|||
} |
|||
return TRUE; |
|||
} |
|||
|
|||
//根据路径返回当前路径下所有文件 |
|||
static function files_tree($path) |
|||
{ |
|||
$files = array(); |
|||
$ds = glob($path . '/*'); |
|||
if (is_array($ds)) { |
|||
foreach ($ds as $entry) { |
|||
if (is_file($entry)) { |
|||
$files[] = $entry; |
|||
} |
|||
if (is_dir($entry)) { |
|||
$rs = self::files_tree($entry); |
|||
foreach ($rs as $f) { |
|||
$files[] = $f; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
return $files; |
|||
} |
|||
|
|||
//调试函数 |
|||
static function wl_debug($array = array()) |
|||
{ |
|||
echo "<pre>"; |
|||
print_r($array); |
|||
exit(); |
|||
} |
|||
|
|||
//数据输出函数 |
|||
static function message($code = 0, $message = array(), $data = array()) |
|||
{ |
|||
die(json_encode(array('code' => $code, 'message' => $message, 'data' => $data))); |
|||
} |
|||
} |
|||
|
|||
@ -0,0 +1,251 @@ |
|||
<?php |
|||
|
|||
/** |
|||
* PHPExcel |
|||
* |
|||
* Copyright (c) 2006 - 2013 PHPExcel |
|||
* |
|||
* This library is free software; you can redistribute it and/or |
|||
* modify it under the terms of the GNU Lesser General Public |
|||
* License as published by the Free Software Foundation; either |
|||
* version 2.1 of the License, or (at your option) any later version. |
|||
* |
|||
* This library is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|||
* Lesser General Public License for more details. |
|||
* |
|||
* You should have received a copy of the GNU Lesser General Public |
|||
* License along with this library; if not, write to the Free Software |
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|||
* |
|||
* @category PHPExcel |
|||
* @package PHPExcel_CachedObjectStorage |
|||
* @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) |
|||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL |
|||
* @version 1.7.9, 2013-06-02 |
|||
*/ |
|||
|
|||
|
|||
/** |
|||
* PHPExcel_CachedObjectStorageFactory |
|||
* |
|||
* @category PHPExcel |
|||
* @package PHPExcel_CachedObjectStorage |
|||
* @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) |
|||
*/ |
|||
class PHPExcel_CachedObjectStorageFactory |
|||
{ |
|||
const cache_in_memory = 'Memory'; |
|||
const cache_in_memory_gzip = 'MemoryGZip'; |
|||
const cache_in_memory_serialized = 'MemorySerialized'; |
|||
const cache_igbinary = 'Igbinary'; |
|||
const cache_to_discISAM = 'DiscISAM'; |
|||
const cache_to_apc = 'APC'; |
|||
const cache_to_memcache = 'Memcache'; |
|||
const cache_to_phpTemp = 'PHPTemp'; |
|||
const cache_to_wincache = 'Wincache'; |
|||
const cache_to_sqlite = 'SQLite'; |
|||
const cache_to_sqlite3 = 'SQLite3'; |
|||
|
|||
|
|||
/** |
|||
* Name of the method used for cell cacheing |
|||
* |
|||
* @var string |
|||
*/ |
|||
private static $_cacheStorageMethod = NULL; |
|||
|
|||
/** |
|||
* Name of the class used for cell cacheing |
|||
* |
|||
* @var string |
|||
*/ |
|||
private static $_cacheStorageClass = NULL; |
|||
|
|||
|
|||
/** |
|||
* List of all possible cache storage methods |
|||
* |
|||
* @var string[] |
|||
*/ |
|||
private static $_storageMethods = array( |
|||
self::cache_in_memory, |
|||
self::cache_in_memory_gzip, |
|||
self::cache_in_memory_serialized, |
|||
self::cache_igbinary, |
|||
self::cache_to_phpTemp, |
|||
self::cache_to_discISAM, |
|||
self::cache_to_apc, |
|||
self::cache_to_memcache, |
|||
self::cache_to_wincache, |
|||
self::cache_to_sqlite, |
|||
self::cache_to_sqlite3, |
|||
); |
|||
|
|||
|
|||
/** |
|||
* Default arguments for each cache storage method |
|||
* |
|||
* @var array of mixed array |
|||
*/ |
|||
private static $_storageMethodDefaultParameters = array( |
|||
self::cache_in_memory => array( |
|||
), |
|||
self::cache_in_memory_gzip => array( |
|||
), |
|||
self::cache_in_memory_serialized => array( |
|||
), |
|||
self::cache_igbinary => array( |
|||
), |
|||
self::cache_to_phpTemp => array( 'memoryCacheSize' => '1MB' |
|||
), |
|||
self::cache_to_discISAM => array( 'dir' => NULL |
|||
), |
|||
self::cache_to_apc => array( 'cacheTime' => 600 |
|||
), |
|||
self::cache_to_memcache => array( 'memcacheServer' => 'localhost', |
|||
'memcachePort' => 11211, |
|||
'cacheTime' => 600 |
|||
), |
|||
self::cache_to_wincache => array( 'cacheTime' => 600 |
|||
), |
|||
self::cache_to_sqlite => array( |
|||
), |
|||
self::cache_to_sqlite3 => array( |
|||
), |
|||
); |
|||
|
|||
|
|||
/** |
|||
* Arguments for the active cache storage method |
|||
* |
|||
* @var array of mixed array |
|||
*/ |
|||
private static $_storageMethodParameters = array(); |
|||
|
|||
|
|||
/** |
|||
* Return the current cache storage method |
|||
* |
|||
* @return string|NULL |
|||
**/ |
|||
public static function getCacheStorageMethod() |
|||
{ |
|||
return self::$_cacheStorageMethod; |
|||
} // function getCacheStorageMethod() |
|||
|
|||
|
|||
/** |
|||
* Return the current cache storage class |
|||
* |
|||
* @return PHPExcel_CachedObjectStorage_ICache|NULL |
|||
**/ |
|||
public static function getCacheStorageClass() |
|||
{ |
|||
return self::$_cacheStorageClass; |
|||
} // function getCacheStorageClass() |
|||
|
|||
|
|||
/** |
|||
* Return the list of all possible cache storage methods |
|||
* |
|||
* @return string[] |
|||
**/ |
|||
public static function getAllCacheStorageMethods() |
|||
{ |
|||
return self::$_storageMethods; |
|||
} // function getCacheStorageMethods() |
|||
|
|||
|
|||
/** |
|||
* Return the list of all available cache storage methods |
|||
* |
|||
* @return string[] |
|||
**/ |
|||
public static function getCacheStorageMethods() |
|||
{ |
|||
$activeMethods = array(); |
|||
foreach(self::$_storageMethods as $storageMethod) { |
|||
$cacheStorageClass = 'PHPExcel_CachedObjectStorage_' . $storageMethod; |
|||
if (call_user_func(array($cacheStorageClass, 'cacheMethodIsAvailable'))) { |
|||
$activeMethods[] = $storageMethod; |
|||
} |
|||
} |
|||
return $activeMethods; |
|||
} // function getCacheStorageMethods() |
|||
|
|||
|
|||
/** |
|||
* Identify the cache storage method to use |
|||
* |
|||
* @param string $method Name of the method to use for cell cacheing |
|||
* @param array of mixed $arguments Additional arguments to pass to the cell caching class |
|||
* when instantiating |
|||
* @return boolean |
|||
**/ |
|||
public static function initialize($method = self::cache_in_memory, $arguments = array()) |
|||
{ |
|||
if (!in_array($method,self::$_storageMethods)) { |
|||
return FALSE; |
|||
} |
|||
|
|||
$cacheStorageClass = 'PHPExcel_CachedObjectStorage_'.$method; |
|||
if (!call_user_func(array( $cacheStorageClass, |
|||
'cacheMethodIsAvailable'))) { |
|||
return FALSE; |
|||
} |
|||
|
|||
self::$_storageMethodParameters[$method] = self::$_storageMethodDefaultParameters[$method]; |
|||
foreach($arguments as $k => $v) { |
|||
if (array_key_exists($k, self::$_storageMethodParameters[$method])) { |
|||
self::$_storageMethodParameters[$method][$k] = $v; |
|||
} |
|||
} |
|||
|
|||
if (self::$_cacheStorageMethod === NULL) { |
|||
self::$_cacheStorageClass = 'PHPExcel_CachedObjectStorage_' . $method; |
|||
self::$_cacheStorageMethod = $method; |
|||
} |
|||
return TRUE; |
|||
} // function initialize() |
|||
|
|||
|
|||
/** |
|||
* Initialise the cache storage |
|||
* |
|||
* @param PHPExcel_Worksheet $parent Enable cell caching for this worksheet |
|||
* @return PHPExcel_CachedObjectStorage_ICache |
|||
**/ |
|||
public static function getInstance(PHPExcel_Worksheet $parent) |
|||
{ |
|||
$cacheMethodIsAvailable = TRUE; |
|||
if (self::$_cacheStorageMethod === NULL) { |
|||
$cacheMethodIsAvailable = self::initialize(); |
|||
} |
|||
|
|||
if ($cacheMethodIsAvailable) { |
|||
$instance = new self::$_cacheStorageClass( $parent, |
|||
self::$_storageMethodParameters[self::$_cacheStorageMethod] |
|||
); |
|||
if ($instance !== NULL) { |
|||
return $instance; |
|||
} |
|||
} |
|||
|
|||
return FALSE; |
|||
} // function getInstance() |
|||
|
|||
|
|||
/** |
|||
* Clear the cache storage |
|||
* |
|||
**/ |
|||
public static function finalize() |
|||
{ |
|||
self::$_cacheStorageMethod = NULL; |
|||
self::$_cacheStorageClass = NULL; |
|||
self::$_storageMethodParameters = array(); |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,978 @@ |
|||
<?php |
|||
/** |
|||
* PHPExcel |
|||
* |
|||
* Copyright (c) 2006 - 2013 PHPExcel |
|||
* |
|||
* This library is free software; you can redistribute it and/or |
|||
* modify it under the terms of the GNU Lesser General Public |
|||
* License as published by the Free Software Foundation; either |
|||
* version 2.1 of the License, or (at your option) any later version. |
|||
* |
|||
* This library is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|||
* Lesser General Public License for more details. |
|||
* |
|||
* You should have received a copy of the GNU Lesser General Public |
|||
* License along with this library; if not, write to the Free Software |
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|||
* |
|||
* @category PHPExcel |
|||
* @package PHPExcel_Cell |
|||
* @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) |
|||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL |
|||
* @version 1.7.9, 2013-06-02 |
|||
*/ |
|||
|
|||
|
|||
/** |
|||
* PHPExcel_Cell |
|||
* |
|||
* @category PHPExcel |
|||
* @package PHPExcel_Cell |
|||
* @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) |
|||
*/ |
|||
class PHPExcel_Cell |
|||
{ |
|||
|
|||
/** |
|||
* Default range variable constant |
|||
* |
|||
* @var string |
|||
*/ |
|||
const DEFAULT_RANGE = 'A1:A1'; |
|||
|
|||
/** |
|||
* Value binder to use |
|||
* |
|||
* @var PHPExcel_Cell_IValueBinder |
|||
*/ |
|||
private static $_valueBinder = NULL; |
|||
|
|||
/** |
|||
* Value of the cell |
|||
* |
|||
* @var mixed |
|||
*/ |
|||
private $_value; |
|||
|
|||
/** |
|||
* Calculated value of the cell (used for caching) |
|||
* This returns the value last calculated by MS Excel or whichever spreadsheet program was used to |
|||
* create the original spreadsheet file. |
|||
* Note that this value is not guaranteed to reflect the actual calculated value because it is |
|||
* possible that auto-calculation was disabled in the original spreadsheet, and underlying data |
|||
* values used by the formula have changed since it was last calculated. |
|||
* |
|||
* @var mixed |
|||
*/ |
|||
private $_calculatedValue = NULL; |
|||
|
|||
/** |
|||
* Type of the cell data |
|||
* |
|||
* @var string |
|||
*/ |
|||
private $_dataType; |
|||
|
|||
/** |
|||
* Parent worksheet |
|||
* |
|||
* @var PHPExcel_CachedObjectStorage_CacheBase |
|||
*/ |
|||
private $_parent; |
|||
|
|||
/** |
|||
* Index to cellXf |
|||
* |
|||
* @var int |
|||
*/ |
|||
private $_xfIndex; |
|||
|
|||
/** |
|||
* Attributes of the formula |
|||
* |
|||
*/ |
|||
private $_formulaAttributes; |
|||
|
|||
|
|||
/** |
|||
* Send notification to the cache controller |
|||
* |
|||
* @return void |
|||
**/ |
|||
public function notifyCacheController() { |
|||
$this->_parent->updateCacheData($this); |
|||
|
|||
return $this; |
|||
} |
|||
|
|||
public function detach() { |
|||
$this->_parent = NULL; |
|||
} |
|||
|
|||
public function attach(PHPExcel_CachedObjectStorage_CacheBase $parent) { |
|||
|
|||
|
|||
$this->_parent = $parent; |
|||
} |
|||
|
|||
|
|||
/** |
|||
* Create a new Cell |
|||
* |
|||
* @param mixed $pValue |
|||
* @param string $pDataType |
|||
* @param PHPExcel_Worksheet $pSheet |
|||
* @throws PHPExcel_Exception |
|||
*/ |
|||
public function __construct($pValue = NULL, $pDataType = NULL, PHPExcel_Worksheet $pSheet = NULL) |
|||
{ |
|||
// Initialise cell value |
|||
$this->_value = $pValue; |
|||
|
|||
// Set worksheet cache |
|||
$this->_parent = $pSheet->getCellCacheController(); |
|||
|
|||
// Set datatype? |
|||
if ($pDataType !== NULL) { |
|||
if ($pDataType == PHPExcel_Cell_DataType::TYPE_STRING2) |
|||
$pDataType = PHPExcel_Cell_DataType::TYPE_STRING; |
|||
$this->_dataType = $pDataType; |
|||
} else { |
|||
if (!self::getValueBinder()->bindValue($this, $pValue)) { |
|||
throw new PHPExcel_Exception("Value could not be bound to cell."); |
|||
} |
|||
} |
|||
|
|||
// set default index to cellXf |
|||
$this->_xfIndex = 0; |
|||
} |
|||
|
|||
/** |
|||
* Get cell coordinate column |
|||
* |
|||
* @return string |
|||
*/ |
|||
public function getColumn() |
|||
{ |
|||
return $this->_parent->getCurrentColumn(); |
|||
} |
|||
|
|||
/** |
|||
* Get cell coordinate row |
|||
* |
|||
* @return int |
|||
*/ |
|||
public function getRow() |
|||
{ |
|||
return $this->_parent->getCurrentRow(); |
|||
} |
|||
|
|||
/** |
|||
* Get cell coordinate |
|||
* |
|||
* @return string |
|||
*/ |
|||
public function getCoordinate() |
|||
{ |
|||
return $this->_parent->getCurrentAddress(); |
|||
} |
|||
|
|||
/** |
|||
* Get cell value |
|||
* |
|||
* @return mixed |
|||
*/ |
|||
public function getValue() |
|||
{ |
|||
return $this->_value; |
|||
} |
|||
|
|||
/** |
|||
* Get cell value with formatting |
|||
* |
|||
* @return string |
|||
*/ |
|||
public function getFormattedValue() |
|||
{ |
|||
return (string) PHPExcel_Style_NumberFormat::toFormattedString( |
|||
$this->getCalculatedValue(), |
|||
$this->getWorksheet()->getParent()->getCellXfByIndex($this->getXfIndex()) |
|||
->getNumberFormat()->getFormatCode() |
|||
); |
|||
} |
|||
|
|||
/** |
|||
* Set cell value |
|||
* |
|||
* Sets the value for a cell, automatically determining the datatype using the value binder |
|||
* |
|||
* @param mixed $pValue Value |
|||
* @return PHPExcel_Cell |
|||
* @throws PHPExcel_Exception |
|||
*/ |
|||
public function setValue($pValue = NULL) |
|||
{ |
|||
if (!self::getValueBinder()->bindValue($this, $pValue)) { |
|||
throw new PHPExcel_Exception("Value could not be bound to cell."); |
|||
} |
|||
return $this; |
|||
} |
|||
|
|||
/** |
|||
* Set the value for a cell, with the explicit data type passed to the method (bypassing any use of the value binder) |
|||
* |
|||
* @param mixed $pValue Value |
|||
* @param string $pDataType Explicit data type |
|||
* @return PHPExcel_Cell |
|||
* @throws PHPExcel_Exception |
|||
*/ |
|||
public function setValueExplicit($pValue = NULL, $pDataType = PHPExcel_Cell_DataType::TYPE_STRING) |
|||
{ |
|||
// set the value according to data type |
|||
switch ($pDataType) { |
|||
case PHPExcel_Cell_DataType::TYPE_STRING2: |
|||
$pDataType = PHPExcel_Cell_DataType::TYPE_STRING; |
|||
case PHPExcel_Cell_DataType::TYPE_STRING: |
|||
case PHPExcel_Cell_DataType::TYPE_NULL: |
|||
case PHPExcel_Cell_DataType::TYPE_INLINE: |
|||
$this->_value = PHPExcel_Cell_DataType::checkString($pValue); |
|||
break; |
|||
case PHPExcel_Cell_DataType::TYPE_NUMERIC: |
|||
$this->_value = (float)$pValue; |
|||
break; |
|||
case PHPExcel_Cell_DataType::TYPE_FORMULA: |
|||
$this->_value = (string)$pValue; |
|||
break; |
|||
case PHPExcel_Cell_DataType::TYPE_BOOL: |
|||
$this->_value = (bool)$pValue; |
|||
break; |
|||
case PHPExcel_Cell_DataType::TYPE_ERROR: |
|||
$this->_value = PHPExcel_Cell_DataType::checkErrorCode($pValue); |
|||
break; |
|||
default: |
|||
throw new PHPExcel_Exception('Invalid datatype: ' . $pDataType); |
|||
break; |
|||
} |
|||
|
|||
// set the datatype |
|||
$this->_dataType = $pDataType; |
|||
|
|||
return $this->notifyCacheController(); |
|||
} |
|||
|
|||
/** |
|||
* Get calculated cell value |
|||
* |
|||
* @deprecated Since version 1.7.8 for planned changes to cell for array formula handling |
|||
* |
|||
* @param boolean $resetLog Whether the calculation engine logger should be reset or not |
|||
* @return mixed |
|||
* @throws PHPExcel_Exception |
|||
*/ |
|||
public function getCalculatedValue($resetLog = TRUE) |
|||
{ |
|||
//echo 'Cell '.$this->getCoordinate().' value is a '.$this->_dataType.' with a value of '.$this->getValue().PHP_EOL; |
|||
if ($this->_dataType == PHPExcel_Cell_DataType::TYPE_FORMULA) { |
|||
try { |
|||
//echo 'Cell value for '.$this->getCoordinate().' is a formula: Calculating value'.PHP_EOL; |
|||
$result = PHPExcel_Calculation::getInstance( |
|||
$this->getWorksheet()->getParent() |
|||
)->calculateCellValue($this,$resetLog); |
|||
//echo $this->getCoordinate().' calculation result is '.$result.PHP_EOL; |
|||
// We don't yet handle array returns |
|||
if (is_array($result)) { |
|||
while (is_array($result)) { |
|||
$result = array_pop($result); |
|||
} |
|||
} |
|||
} catch ( PHPExcel_Exception $ex ) { |
|||
if (($ex->getMessage() === 'Unable to access External Workbook') && ($this->_calculatedValue !== NULL)) { |
|||
//echo 'Returning fallback value of '.$this->_calculatedValue.' for cell '.$this->getCoordinate().PHP_EOL; |
|||
return $this->_calculatedValue; // Fallback for calculations referencing external files. |
|||
} |
|||
//echo 'Calculation Exception: '.$ex->getMessage().PHP_EOL; |
|||
$result = '#N/A'; |
|||
throw new PHPExcel_Calculation_Exception( |
|||
$this->getWorksheet()->getTitle().'!'.$this->getCoordinate().' -> '.$ex->getMessage() |
|||
); |
|||
} |
|||
|
|||
if ($result === '#Not Yet Implemented') { |
|||
//echo 'Returning fallback value of '.$this->_calculatedValue.' for cell '.$this->getCoordinate().PHP_EOL; |
|||
return $this->_calculatedValue; // Fallback if calculation engine does not support the formula. |
|||
} |
|||
//echo 'Returning calculated value of '.$result.' for cell '.$this->getCoordinate().PHP_EOL; |
|||
return $result; |
|||
} elseif($this->_value instanceof PHPExcel_RichText) { |
|||
// echo 'Cell value for '.$this->getCoordinate().' is rich text: Returning data value of '.$this->_value.'<br />'; |
|||
return $this->_value->getPlainText(); |
|||
} |
|||
// echo 'Cell value for '.$this->getCoordinate().' is not a formula: Returning data value of '.$this->_value.'<br />'; |
|||
return $this->_value; |
|||
} |
|||
|
|||
/** |
|||
* Set old calculated value (cached) |
|||
* |
|||
* @param mixed $pValue Value |
|||
* @return PHPExcel_Cell |
|||
*/ |
|||
public function setCalculatedValue($pValue = NULL) |
|||
{ |
|||
if ($pValue !== NULL) { |
|||
$this->_calculatedValue = (is_numeric($pValue)) ? (float) $pValue : $pValue; |
|||
} |
|||
|
|||
return $this->notifyCacheController(); |
|||
} |
|||
|
|||
/** |
|||
* Get old calculated value (cached) |
|||
* This returns the value last calculated by MS Excel or whichever spreadsheet program was used to |
|||
* create the original spreadsheet file. |
|||
* Note that this value is not guaranteed to refelect the actual calculated value because it is |
|||
* possible that auto-calculation was disabled in the original spreadsheet, and underlying data |
|||
* values used by the formula have changed since it was last calculated. |
|||
* |
|||
* @return mixed |
|||
*/ |
|||
public function getOldCalculatedValue() |
|||
{ |
|||
return $this->_calculatedValue; |
|||
} |
|||
|
|||
/** |
|||
* Get cell data type |
|||
* |
|||
* @return string |
|||
*/ |
|||
public function getDataType() |
|||
{ |
|||
return $this->_dataType; |
|||
} |
|||
|
|||
/** |
|||
* Set cell data type |
|||
* |
|||
* @param string $pDataType |
|||
* @return PHPExcel_Cell |
|||
*/ |
|||
public function setDataType($pDataType = PHPExcel_Cell_DataType::TYPE_STRING) |
|||
{ |
|||
if ($pDataType == PHPExcel_Cell_DataType::TYPE_STRING2) |
|||
$pDataType = PHPExcel_Cell_DataType::TYPE_STRING; |
|||
|
|||
$this->_dataType = $pDataType; |
|||
|
|||
return $this->notifyCacheController(); |
|||
} |
|||
|
|||
/** |
|||
* Does this cell contain Data validation rules? |
|||
* |
|||
* @return boolean |
|||
* @throws PHPExcel_Exception |
|||
*/ |
|||
public function hasDataValidation() |
|||
{ |
|||
if (!isset($this->_parent)) { |
|||
throw new PHPExcel_Exception('Cannot check for data validation when cell is not bound to a worksheet'); |
|||
} |
|||
|
|||
return $this->getWorksheet()->dataValidationExists($this->getCoordinate()); |
|||
} |
|||
|
|||
/** |
|||
* Get Data validation rules |
|||
* |
|||
* @return PHPExcel_Cell_DataValidation |
|||
* @throws PHPExcel_Exception |
|||
*/ |
|||
public function getDataValidation() |
|||
{ |
|||
if (!isset($this->_parent)) { |
|||
throw new PHPExcel_Exception('Cannot get data validation for cell that is not bound to a worksheet'); |
|||
} |
|||
|
|||
return $this->getWorksheet()->getDataValidation($this->getCoordinate()); |
|||
} |
|||
|
|||
/** |
|||
* Set Data validation rules |
|||
* |
|||
* @param PHPExcel_Cell_DataValidation $pDataValidation |
|||
* @return PHPExcel_Cell |
|||
* @throws PHPExcel_Exception |
|||
*/ |
|||
public function setDataValidation(PHPExcel_Cell_DataValidation $pDataValidation = NULL) |
|||
{ |
|||
if (!isset($this->_parent)) { |
|||
throw new PHPExcel_Exception('Cannot set data validation for cell that is not bound to a worksheet'); |
|||
} |
|||
|
|||
$this->getWorksheet()->setDataValidation($this->getCoordinate(), $pDataValidation); |
|||
|
|||
return $this->notifyCacheController(); |
|||
} |
|||
|
|||
/** |
|||
* Does this cell contain a Hyperlink? |
|||
* |
|||
* @return boolean |
|||
* @throws PHPExcel_Exception |
|||
*/ |
|||
public function hasHyperlink() |
|||
{ |
|||
if (!isset($this->_parent)) { |
|||
throw new PHPExcel_Exception('Cannot check for hyperlink when cell is not bound to a worksheet'); |
|||
} |
|||
|
|||
return $this->getWorksheet()->hyperlinkExists($this->getCoordinate()); |
|||
} |
|||
|
|||
/** |
|||
* Get Hyperlink |
|||
* |
|||
* @return PHPExcel_Cell_Hyperlink |
|||
* @throws PHPExcel_Exception |
|||
*/ |
|||
public function getHyperlink() |
|||
{ |
|||
if (!isset($this->_parent)) { |
|||
throw new PHPExcel_Exception('Cannot get hyperlink for cell that is not bound to a worksheet'); |
|||
} |
|||
|
|||
return $this->getWorksheet()->getHyperlink($this->getCoordinate()); |
|||
} |
|||
|
|||
/** |
|||
* Set Hyperlink |
|||
* |
|||
* @param PHPExcel_Cell_Hyperlink $pHyperlink |
|||
* @return PHPExcel_Cell |
|||
* @throws PHPExcel_Exception |
|||
*/ |
|||
public function setHyperlink(PHPExcel_Cell_Hyperlink $pHyperlink = NULL) |
|||
{ |
|||
if (!isset($this->_parent)) { |
|||
throw new PHPExcel_Exception('Cannot set hyperlink for cell that is not bound to a worksheet'); |
|||
} |
|||
|
|||
$this->getWorksheet()->setHyperlink($this->getCoordinate(), $pHyperlink); |
|||
|
|||
return $this->notifyCacheController(); |
|||
} |
|||
|
|||
/** |
|||
* Get parent worksheet |
|||
* |
|||
* @return PHPExcel_Worksheet |
|||
*/ |
|||
public function getParent() { |
|||
return $this->_parent; |
|||
} |
|||
|
|||
/** |
|||
* Get parent worksheet |
|||
* |
|||
* @return PHPExcel_Worksheet |
|||
*/ |
|||
public function getWorksheet() { |
|||
return $this->_parent->getParent(); |
|||
} |
|||
|
|||
/** |
|||
* Get cell style |
|||
* |
|||
* @return PHPExcel_Style |
|||
*/ |
|||
public function getStyle() |
|||
{ |
|||
return $this->getWorksheet()->getParent()->getCellXfByIndex($this->getXfIndex()); |
|||
} |
|||
|
|||
/** |
|||
* Re-bind parent |
|||
* |
|||
* @param PHPExcel_Worksheet $parent |
|||
* @return PHPExcel_Cell |
|||
*/ |
|||
public function rebindParent(PHPExcel_Worksheet $parent) { |
|||
$this->_parent = $parent->getCellCacheController(); |
|||
|
|||
return $this->notifyCacheController(); |
|||
} |
|||
|
|||
/** |
|||
* Is cell in a specific range? |
|||
* |
|||
* @param string $pRange Cell range (e.g. A1:A1) |
|||
* @return boolean |
|||
*/ |
|||
public function isInRange($pRange = 'A1:A1') |
|||
{ |
|||
list($rangeStart,$rangeEnd) = self::rangeBoundaries($pRange); |
|||
|
|||
// Translate properties |
|||
$myColumn = self::columnIndexFromString($this->getColumn()); |
|||
$myRow = $this->getRow(); |
|||
|
|||
// Verify if cell is in range |
|||
return (($rangeStart[0] <= $myColumn) && ($rangeEnd[0] >= $myColumn) && |
|||
($rangeStart[1] <= $myRow) && ($rangeEnd[1] >= $myRow) |
|||
); |
|||
} |
|||
|
|||
/** |
|||
* Coordinate from string |
|||
* |
|||
* @param string $pCoordinateString |
|||
* @return array Array containing column and row (indexes 0 and 1) |
|||
* @throws PHPExcel_Exception |
|||
*/ |
|||
public static function coordinateFromString($pCoordinateString = 'A1') |
|||
{ |
|||
if (preg_match("/^([$]?[A-Z]{1,3})([$]?\d{1,7})$/", $pCoordinateString, $matches)) { |
|||
return array($matches[1],$matches[2]); |
|||
} elseif ((strpos($pCoordinateString,':') !== FALSE) || (strpos($pCoordinateString,',') !== FALSE)) { |
|||
throw new PHPExcel_Exception('Cell coordinate string can not be a range of cells'); |
|||
} elseif ($pCoordinateString == '') { |
|||
throw new PHPExcel_Exception('Cell coordinate can not be zero-length string'); |
|||
} |
|||
|
|||
throw new PHPExcel_Exception('Invalid cell coordinate '.$pCoordinateString); |
|||
} |
|||
|
|||
/** |
|||
* Make string row, column or cell coordinate absolute |
|||
* |
|||
* @param string $pCoordinateString e.g. 'A' or '1' or 'A1' |
|||
* Note that this value can be a row or column reference as well as a cell reference |
|||
* @return string Absolute coordinate e.g. '$A' or '$1' or '$A$1' |
|||
* @throws PHPExcel_Exception |
|||
*/ |
|||
public static function absoluteReference($pCoordinateString = 'A1') |
|||
{ |
|||
if (strpos($pCoordinateString,':') === FALSE && strpos($pCoordinateString,',') === FALSE) { |
|||
// Split out any worksheet name from the reference |
|||
$worksheet = ''; |
|||
$cellAddress = explode('!',$pCoordinateString); |
|||
if (count($cellAddress) > 1) { |
|||
list($worksheet,$pCoordinateString) = $cellAddress; |
|||
} |
|||
if ($worksheet > '') $worksheet .= '!'; |
|||
|
|||
// Create absolute coordinate |
|||
if (ctype_digit($pCoordinateString)) { |
|||
return $worksheet . '$' . $pCoordinateString; |
|||
} elseif (ctype_alpha($pCoordinateString)) { |
|||
return $worksheet . '$' . strtoupper($pCoordinateString); |
|||
} |
|||
return $worksheet . self::absoluteCoordinate($pCoordinateString); |
|||
} |
|||
|
|||
throw new PHPExcel_Exception('Cell coordinate string can not be a range of cells'); |
|||
} |
|||
|
|||
/** |
|||
* Make string coordinate absolute |
|||
* |
|||
* @param string $pCoordinateString e.g. 'A1' |
|||
* @return string Absolute coordinate e.g. '$A$1' |
|||
* @throws PHPExcel_Exception |
|||
*/ |
|||
public static function absoluteCoordinate($pCoordinateString = 'A1') |
|||
{ |
|||
if (strpos($pCoordinateString,':') === FALSE && strpos($pCoordinateString,',') === FALSE) { |
|||
// Split out any worksheet name from the coordinate |
|||
$worksheet = ''; |
|||
$cellAddress = explode('!',$pCoordinateString); |
|||
if (count($cellAddress) > 1) { |
|||
list($worksheet,$pCoordinateString) = $cellAddress; |
|||
} |
|||
if ($worksheet > '') $worksheet .= '!'; |
|||
|
|||
// Create absolute coordinate |
|||
list($column, $row) = self::coordinateFromString($pCoordinateString); |
|||
$column = ltrim($column,'$'); |
|||
$row = ltrim($row,'$'); |
|||
return $worksheet . '$' . $column . '$' . $row; |
|||
} |
|||
|
|||
throw new PHPExcel_Exception('Cell coordinate string can not be a range of cells'); |
|||
} |
|||
|
|||
/** |
|||
* Split range into coordinate strings |
|||
* |
|||
* @param string $pRange e.g. 'B4:D9' or 'B4:D9,H2:O11' or 'B4' |
|||
* @return array Array containg one or more arrays containing one or two coordinate strings |
|||
* e.g. array('B4','D9') or array(array('B4','D9'),array('H2','O11')) |
|||
* or array('B4') |
|||
*/ |
|||
public static function splitRange($pRange = 'A1:A1') |
|||
{ |
|||
// Ensure $pRange is a valid range |
|||
if(empty($pRange)) { |
|||
$pRange = self::DEFAULT_RANGE; |
|||
} |
|||
|
|||
$exploded = explode(',', $pRange); |
|||
$counter = count($exploded); |
|||
for ($i = 0; $i < $counter; ++$i) { |
|||
$exploded[$i] = explode(':', $exploded[$i]); |
|||
} |
|||
return $exploded; |
|||
} |
|||
|
|||
/** |
|||
* Build range from coordinate strings |
|||
* |
|||
* @param array $pRange Array containg one or more arrays containing one or two coordinate strings |
|||
* @return string String representation of $pRange |
|||
* @throws PHPExcel_Exception |
|||
*/ |
|||
public static function buildRange($pRange) |
|||
{ |
|||
// Verify range |
|||
if (!is_array($pRange) || empty($pRange) || !is_array($pRange[0])) { |
|||
throw new PHPExcel_Exception('Range does not contain any information'); |
|||
} |
|||
|
|||
// Build range |
|||
$imploded = array(); |
|||
$counter = count($pRange); |
|||
for ($i = 0; $i < $counter; ++$i) { |
|||
$pRange[$i] = implode(':', $pRange[$i]); |
|||
} |
|||
$imploded = implode(',', $pRange); |
|||
|
|||
return $imploded; |
|||
} |
|||
|
|||
/** |
|||
* Calculate range boundaries |
|||
* |
|||
* @param string $pRange Cell range (e.g. A1:A1) |
|||
* @return array Range coordinates array(Start Cell, End Cell) |
|||
* where Start Cell and End Cell are arrays (Column Number, Row Number) |
|||
*/ |
|||
public static function rangeBoundaries($pRange = 'A1:A1') |
|||
{ |
|||
// Ensure $pRange is a valid range |
|||
if(empty($pRange)) { |
|||
$pRange = self::DEFAULT_RANGE; |
|||
} |
|||
|
|||
// Uppercase coordinate |
|||
$pRange = strtoupper($pRange); |
|||
|
|||
// Extract range |
|||
if (strpos($pRange, ':') === FALSE) { |
|||
$rangeA = $rangeB = $pRange; |
|||
} else { |
|||
list($rangeA, $rangeB) = explode(':', $pRange); |
|||
} |
|||
|
|||
// Calculate range outer borders |
|||
$rangeStart = self::coordinateFromString($rangeA); |
|||
$rangeEnd = self::coordinateFromString($rangeB); |
|||
|
|||
// Translate column into index |
|||
$rangeStart[0] = self::columnIndexFromString($rangeStart[0]); |
|||
$rangeEnd[0] = self::columnIndexFromString($rangeEnd[0]); |
|||
|
|||
return array($rangeStart, $rangeEnd); |
|||
} |
|||
|
|||
/** |
|||
* Calculate range dimension |
|||
* |
|||
* @param string $pRange Cell range (e.g. A1:A1) |
|||
* @return array Range dimension (width, height) |
|||
*/ |
|||
public static function rangeDimension($pRange = 'A1:A1') |
|||
{ |
|||
// Calculate range outer borders |
|||
list($rangeStart,$rangeEnd) = self::rangeBoundaries($pRange); |
|||
|
|||
return array( ($rangeEnd[0] - $rangeStart[0] + 1), ($rangeEnd[1] - $rangeStart[1] + 1) ); |
|||
} |
|||
|
|||
/** |
|||
* Calculate range boundaries |
|||
* |
|||
* @param string $pRange Cell range (e.g. A1:A1) |
|||
* @return array Range coordinates array(Start Cell, End Cell) |
|||
* where Start Cell and End Cell are arrays (Column ID, Row Number) |
|||
*/ |
|||
public static function getRangeBoundaries($pRange = 'A1:A1') |
|||
{ |
|||
// Ensure $pRange is a valid range |
|||
if(empty($pRange)) { |
|||
$pRange = self::DEFAULT_RANGE; |
|||
} |
|||
|
|||
// Uppercase coordinate |
|||
$pRange = strtoupper($pRange); |
|||
|
|||
// Extract range |
|||
if (strpos($pRange, ':') === FALSE) { |
|||
$rangeA = $rangeB = $pRange; |
|||
} else { |
|||
list($rangeA, $rangeB) = explode(':', $pRange); |
|||
} |
|||
|
|||
return array( self::coordinateFromString($rangeA), self::coordinateFromString($rangeB)); |
|||
} |
|||
|
|||
/** |
|||
* Column index from string |
|||
* |
|||
* @param string $pString |
|||
* @return int Column index (base 1 !!!) |
|||
*/ |
|||
public static function columnIndexFromString($pString = 'A') |
|||
{ |
|||
// Using a lookup cache adds a slight memory overhead, but boosts speed |
|||
// caching using a static within the method is faster than a class static, |
|||
// though it's additional memory overhead |
|||
static $_indexCache = array(); |
|||
|
|||
if (isset($_indexCache[$pString])) |
|||
return $_indexCache[$pString]; |
|||
|
|||
// It's surprising how costly the strtoupper() and ord() calls actually are, so we use a lookup array rather than use ord() |
|||
// and make it case insensitive to get rid of the strtoupper() as well. Because it's a static, there's no significant |
|||
// memory overhead either |
|||
static $_columnLookup = array( |
|||
'A' => 1, 'B' => 2, 'C' => 3, 'D' => 4, 'E' => 5, 'F' => 6, 'G' => 7, 'H' => 8, 'I' => 9, 'J' => 10, 'K' => 11, 'L' => 12, 'M' => 13, |
|||
'N' => 14, 'O' => 15, 'P' => 16, 'Q' => 17, 'R' => 18, 'S' => 19, 'T' => 20, 'U' => 21, 'V' => 22, 'W' => 23, 'X' => 24, 'Y' => 25, 'Z' => 26, |
|||
'a' => 1, 'b' => 2, 'c' => 3, 'd' => 4, 'e' => 5, 'f' => 6, 'g' => 7, 'h' => 8, 'i' => 9, 'j' => 10, 'k' => 11, 'l' => 12, 'm' => 13, |
|||
'n' => 14, 'o' => 15, 'p' => 16, 'q' => 17, 'r' => 18, 's' => 19, 't' => 20, 'u' => 21, 'v' => 22, 'w' => 23, 'x' => 24, 'y' => 25, 'z' => 26 |
|||
); |
|||
|
|||
// We also use the language construct isset() rather than the more costly strlen() function to match the length of $pString |
|||
// for improved performance |
|||
if (isset($pString{0})) { |
|||
if (!isset($pString{1})) { |
|||
$_indexCache[$pString] = $_columnLookup[$pString]; |
|||
return $_indexCache[$pString]; |
|||
} elseif(!isset($pString{2})) { |
|||
$_indexCache[$pString] = $_columnLookup[$pString{0}] * 26 + $_columnLookup[$pString{1}]; |
|||
return $_indexCache[$pString]; |
|||
} elseif(!isset($pString{3})) { |
|||
$_indexCache[$pString] = $_columnLookup[$pString{0}] * 676 + $_columnLookup[$pString{1}] * 26 + $_columnLookup[$pString{2}]; |
|||
return $_indexCache[$pString]; |
|||
} |
|||
} |
|||
throw new PHPExcel_Exception("Column string index can not be " . ((isset($pString{0})) ? "longer than 3 characters" : "empty")); |
|||
} |
|||
|
|||
/** |
|||
* String from columnindex |
|||
* |
|||
* @param int $pColumnIndex Column index (base 0 !!!) |
|||
* @return string |
|||
*/ |
|||
public static function stringFromColumnIndex($pColumnIndex = 0) |
|||
{ |
|||
// Using a lookup cache adds a slight memory overhead, but boosts speed |
|||
// caching using a static within the method is faster than a class static, |
|||
// though it's additional memory overhead |
|||
static $_indexCache = array(); |
|||
|
|||
if (!isset($_indexCache[$pColumnIndex])) { |
|||
// Determine column string |
|||
if ($pColumnIndex < 26) { |
|||
$_indexCache[$pColumnIndex] = chr(65 + $pColumnIndex); |
|||
} elseif ($pColumnIndex < 702) { |
|||
$_indexCache[$pColumnIndex] = chr(64 + ($pColumnIndex / 26)) . |
|||
chr(65 + $pColumnIndex % 26); |
|||
} else { |
|||
$_indexCache[$pColumnIndex] = chr(64 + (($pColumnIndex - 26) / 676)) . |
|||
chr(65 + ((($pColumnIndex - 26) % 676) / 26)) . |
|||
chr(65 + $pColumnIndex % 26); |
|||
} |
|||
} |
|||
return $_indexCache[$pColumnIndex]; |
|||
} |
|||
|
|||
/** |
|||
* Extract all cell references in range |
|||
* |
|||
* @param string $pRange Range (e.g. A1 or A1:C10 or A1:E10 A20:E25) |
|||
* @return array Array containing single cell references |
|||
*/ |
|||
public static function extractAllCellReferencesInRange($pRange = 'A1') { |
|||
// Returnvalue |
|||
$returnValue = array(); |
|||
|
|||
// Explode spaces |
|||
$cellBlocks = explode(' ', str_replace('$', '', strtoupper($pRange))); |
|||
foreach ($cellBlocks as $cellBlock) { |
|||
// Single cell? |
|||
if (strpos($cellBlock,':') === FALSE && strpos($cellBlock,',') === FALSE) { |
|||
$returnValue[] = $cellBlock; |
|||
continue; |
|||
} |
|||
|
|||
// Range... |
|||
$ranges = self::splitRange($cellBlock); |
|||
foreach($ranges as $range) { |
|||
// Single cell? |
|||
if (!isset($range[1])) { |
|||
$returnValue[] = $range[0]; |
|||
continue; |
|||
} |
|||
|
|||
// Range... |
|||
list($rangeStart, $rangeEnd) = $range; |
|||
sscanf($rangeStart,'%[A-Z]%d', $startCol, $startRow); |
|||
sscanf($rangeEnd,'%[A-Z]%d', $endCol, $endRow); |
|||
$endCol++; |
|||
|
|||
// Current data |
|||
$currentCol = $startCol; |
|||
$currentRow = $startRow; |
|||
|
|||
// Loop cells |
|||
while ($currentCol != $endCol) { |
|||
while ($currentRow <= $endRow) { |
|||
$returnValue[] = $currentCol.$currentRow; |
|||
++$currentRow; |
|||
} |
|||
++$currentCol; |
|||
$currentRow = $startRow; |
|||
} |
|||
} |
|||
} |
|||
|
|||
// Sort the result by column and row |
|||
$sortKeys = array(); |
|||
foreach (array_unique($returnValue) as $coord) { |
|||
sscanf($coord,'%[A-Z]%d', $column, $row); |
|||
$sortKeys[sprintf('%3s%09d',$column,$row)] = $coord; |
|||
} |
|||
ksort($sortKeys); |
|||
|
|||
// Return value |
|||
return array_values($sortKeys); |
|||
} |
|||
|
|||
/** |
|||
* Compare 2 cells |
|||
* |
|||
* @param PHPExcel_Cell $a Cell a |
|||
* @param PHPExcel_Cell $b Cell b |
|||
* @return int Result of comparison (always -1 or 1, never zero!) |
|||
*/ |
|||
public static function compareCells(PHPExcel_Cell $a, PHPExcel_Cell $b) |
|||
{ |
|||
if ($a->getRow() < $b->getRow()) { |
|||
return -1; |
|||
} elseif ($a->getRow() > $b->getRow()) { |
|||
return 1; |
|||
} elseif (self::columnIndexFromString($a->getColumn()) < self::columnIndexFromString($b->getColumn())) { |
|||
return -1; |
|||
} else { |
|||
return 1; |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* Get value binder to use |
|||
* |
|||
* @return PHPExcel_Cell_IValueBinder |
|||
*/ |
|||
public static function getValueBinder() { |
|||
if (self::$_valueBinder === NULL) { |
|||
self::$_valueBinder = new PHPExcel_Cell_DefaultValueBinder(); |
|||
} |
|||
|
|||
return self::$_valueBinder; |
|||
} |
|||
|
|||
/** |
|||
* Set value binder to use |
|||
* |
|||
* @param PHPExcel_Cell_IValueBinder $binder |
|||
* @throws PHPExcel_Exception |
|||
*/ |
|||
public static function setValueBinder(PHPExcel_Cell_IValueBinder $binder = NULL) { |
|||
if ($binder === NULL) { |
|||
throw new PHPExcel_Exception("A PHPExcel_Cell_IValueBinder is required for PHPExcel to function correctly."); |
|||
} |
|||
|
|||
self::$_valueBinder = $binder; |
|||
} |
|||
|
|||
/** |
|||
* Implement PHP __clone to create a deep clone, not just a shallow copy. |
|||
*/ |
|||
public function __clone() { |
|||
$vars = get_object_vars($this); |
|||
foreach ($vars as $key => $value) { |
|||
if ((is_object($value)) && ($key != '_parent')) { |
|||
$this->$key = clone $value; |
|||
} else { |
|||
$this->$key = $value; |
|||
} |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* Get index to cellXf |
|||
* |
|||
* @return int |
|||
*/ |
|||
public function getXfIndex() |
|||
{ |
|||
return $this->_xfIndex; |
|||
} |
|||
|
|||
/** |
|||
* Set index to cellXf |
|||
* |
|||
* @param int $pValue |
|||
* @return PHPExcel_Cell |
|||
*/ |
|||
public function setXfIndex($pValue = 0) |
|||
{ |
|||
$this->_xfIndex = $pValue; |
|||
|
|||
return $this->notifyCacheController(); |
|||
} |
|||
|
|||
/** |
|||
* @deprecated Since version 1.7.8 for planned changes to cell for array formula handling |
|||
*/ |
|||
public function setFormulaAttributes($pAttributes) |
|||
{ |
|||
$this->_formulaAttributes = $pAttributes; |
|||
return $this; |
|||
} |
|||
|
|||
/** |
|||
* @deprecated Since version 1.7.8 for planned changes to cell for array formula handling |
|||
*/ |
|||
public function getFormulaAttributes() |
|||
{ |
|||
return $this->_formulaAttributes; |
|||
} |
|||
|
|||
/** |
|||
* Convert to string |
|||
* |
|||
* @return string |
|||
*/ |
|||
public function __toString() |
|||
{ |
|||
return (string) $this->getValue(); |
|||
} |
|||
|
|||
} |
|||
|
|||
@ -0,0 +1,551 @@ |
|||
<?php |
|||
/** |
|||
* PHPExcel |
|||
* |
|||
* Copyright (c) 2006 - 2013 PHPExcel |
|||
* |
|||
* This library is free software; you can redistribute it and/or |
|||
* modify it under the terms of the GNU Lesser General Public |
|||
* License as published by the Free Software Foundation; either |
|||
* version 2.1 of the License, or (at your option) any later version. |
|||
* |
|||
* This library is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|||
* Lesser General Public License for more details. |
|||
* |
|||
* You should have received a copy of the GNU Lesser General Public |
|||
* License along with this library; if not, write to the Free Software |
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|||
* |
|||
* @category PHPExcel |
|||
* @package PHPExcel_Chart |
|||
* @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) |
|||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL |
|||
* @version 1.7.9, 2013-06-02 |
|||
*/ |
|||
|
|||
|
|||
/** |
|||
* PHPExcel_Chart |
|||
* |
|||
* @category PHPExcel |
|||
* @package PHPExcel_Chart |
|||
* @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) |
|||
*/ |
|||
class PHPExcel_Chart |
|||
{ |
|||
/** |
|||
* Chart Name |
|||
* |
|||
* @var string |
|||
*/ |
|||
private $_name = ''; |
|||
|
|||
/** |
|||
* Worksheet |
|||
* |
|||
* @var PHPExcel_Worksheet |
|||
*/ |
|||
private $_worksheet = null; |
|||
|
|||
/** |
|||
* Chart Title |
|||
* |
|||
* @var PHPExcel_Chart_Title |
|||
*/ |
|||
private $_title = null; |
|||
|
|||
/** |
|||
* Chart Legend |
|||
* |
|||
* @var PHPExcel_Chart_Legend |
|||
*/ |
|||
private $_legend = null; |
|||
|
|||
/** |
|||
* X-Axis Label |
|||
* |
|||
* @var PHPExcel_Chart_Title |
|||
*/ |
|||
private $_xAxisLabel = null; |
|||
|
|||
/** |
|||
* Y-Axis Label |
|||
* |
|||
* @var PHPExcel_Chart_Title |
|||
*/ |
|||
private $_yAxisLabel = null; |
|||
|
|||
/** |
|||
* Chart Plot Area |
|||
* |
|||
* @var PHPExcel_Chart_PlotArea |
|||
*/ |
|||
private $_plotArea = null; |
|||
|
|||
/** |
|||
* Plot Visible Only |
|||
* |
|||
* @var boolean |
|||
*/ |
|||
private $_plotVisibleOnly = true; |
|||
|
|||
/** |
|||
* Display Blanks as |
|||
* |
|||
* @var string |
|||
*/ |
|||
private $_displayBlanksAs = '0'; |
|||
|
|||
|
|||
/** |
|||
* Top-Left Cell Position |
|||
* |
|||
* @var string |
|||
*/ |
|||
private $_topLeftCellRef = 'A1'; |
|||
|
|||
|
|||
/** |
|||
* Top-Left X-Offset |
|||
* |
|||
* @var integer |
|||
*/ |
|||
private $_topLeftXOffset = 0; |
|||
|
|||
|
|||
/** |
|||
* Top-Left Y-Offset |
|||
* |
|||
* @var integer |
|||
*/ |
|||
private $_topLeftYOffset = 0; |
|||
|
|||
|
|||
/** |
|||
* Bottom-Right Cell Position |
|||
* |
|||
* @var string |
|||
*/ |
|||
private $_bottomRightCellRef = 'A1'; |
|||
|
|||
|
|||
/** |
|||
* Bottom-Right X-Offset |
|||
* |
|||
* @var integer |
|||
*/ |
|||
private $_bottomRightXOffset = 10; |
|||
|
|||
|
|||
/** |
|||
* Bottom-Right Y-Offset |
|||
* |
|||
* @var integer |
|||
*/ |
|||
private $_bottomRightYOffset = 10; |
|||
|
|||
|
|||
/** |
|||
* Create a new PHPExcel_Chart |
|||
*/ |
|||
public function __construct($name, PHPExcel_Chart_Title $title = null, PHPExcel_Chart_Legend $legend = null, PHPExcel_Chart_PlotArea $plotArea = null, $plotVisibleOnly = true, $displayBlanksAs = '0', PHPExcel_Chart_Title $xAxisLabel = null, PHPExcel_Chart_Title $yAxisLabel = null) |
|||
{ |
|||
$this->_name = $name; |
|||
$this->_title = $title; |
|||
$this->_legend = $legend; |
|||
$this->_xAxisLabel = $xAxisLabel; |
|||
$this->_yAxisLabel = $yAxisLabel; |
|||
$this->_plotArea = $plotArea; |
|||
$this->_plotVisibleOnly = $plotVisibleOnly; |
|||
$this->_displayBlanksAs = $displayBlanksAs; |
|||
} |
|||
|
|||
/** |
|||
* Get Name |
|||
* |
|||
* @return string |
|||
*/ |
|||
public function getName() { |
|||
return $this->_name; |
|||
} |
|||
|
|||
/** |
|||
* Get Worksheet |
|||
* |
|||
* @return PHPExcel_Worksheet |
|||
*/ |
|||
public function getWorksheet() { |
|||
return $this->_worksheet; |
|||
} |
|||
|
|||
/** |
|||
* Set Worksheet |
|||
* |
|||
* @param PHPExcel_Worksheet $pValue |
|||
* @throws PHPExcel_Chart_Exception |
|||
* @return PHPExcel_Chart |
|||
*/ |
|||
public function setWorksheet(PHPExcel_Worksheet $pValue = null) { |
|||
$this->_worksheet = $pValue; |
|||
|
|||
return $this; |
|||
} |
|||
|
|||
/** |
|||
* Get Title |
|||
* |
|||
* @return PHPExcel_Chart_Title |
|||
*/ |
|||
public function getTitle() { |
|||
return $this->_title; |
|||
} |
|||
|
|||
/** |
|||
* Set Title |
|||
* |
|||
* @param PHPExcel_Chart_Title $title |
|||
* @return PHPExcel_Chart |
|||
*/ |
|||
public function setTitle(PHPExcel_Chart_Title $title) { |
|||
$this->_title = $title; |
|||
|
|||
return $this; |
|||
} |
|||
|
|||
/** |
|||
* Get Legend |
|||
* |
|||
* @return PHPExcel_Chart_Legend |
|||
*/ |
|||
public function getLegend() { |
|||
return $this->_legend; |
|||
} |
|||
|
|||
/** |
|||
* Set Legend |
|||
* |
|||
* @param PHPExcel_Chart_Legend $legend |
|||
* @return PHPExcel_Chart |
|||
*/ |
|||
public function setLegend(PHPExcel_Chart_Legend $legend) { |
|||
$this->_legend = $legend; |
|||
|
|||
return $this; |
|||
} |
|||
|
|||
/** |
|||
* Get X-Axis Label |
|||
* |
|||
* @return PHPExcel_Chart_Title |
|||
*/ |
|||
public function getXAxisLabel() { |
|||
return $this->_xAxisLabel; |
|||
} |
|||
|
|||
/** |
|||
* Set X-Axis Label |
|||
* |
|||
* @param PHPExcel_Chart_Title $label |
|||
* @return PHPExcel_Chart |
|||
*/ |
|||
public function setXAxisLabel(PHPExcel_Chart_Title $label) { |
|||
$this->_xAxisLabel = $label; |
|||
|
|||
return $this; |
|||
} |
|||
|
|||
/** |
|||
* Get Y-Axis Label |
|||
* |
|||
* @return PHPExcel_Chart_Title |
|||
*/ |
|||
public function getYAxisLabel() { |
|||
return $this->_yAxisLabel; |
|||
} |
|||
|
|||
/** |
|||
* Set Y-Axis Label |
|||
* |
|||
* @param PHPExcel_Chart_Title $label |
|||
* @return PHPExcel_Chart |
|||
*/ |
|||
public function setYAxisLabel(PHPExcel_Chart_Title $label) { |
|||
$this->_yAxisLabel = $label; |
|||
|
|||
return $this; |
|||
} |
|||
|
|||
/** |
|||
* Get Plot Area |
|||
* |
|||
* @return PHPExcel_Chart_PlotArea |
|||
*/ |
|||
public function getPlotArea() { |
|||
return $this->_plotArea; |
|||
} |
|||
|
|||
/** |
|||
* Get Plot Visible Only |
|||
* |
|||
* @return boolean |
|||
*/ |
|||
public function getPlotVisibleOnly() { |
|||
return $this->_plotVisibleOnly; |
|||
} |
|||
|
|||
/** |
|||
* Set Plot Visible Only |
|||
* |
|||
* @param boolean $plotVisibleOnly |
|||
* @return PHPExcel_Chart |
|||
*/ |
|||
public function setPlotVisibleOnly($plotVisibleOnly = true) { |
|||
$this->_plotVisibleOnly = $plotVisibleOnly; |
|||
|
|||
return $this; |
|||
} |
|||
|
|||
/** |
|||
* Get Display Blanks as |
|||
* |
|||
* @return string |
|||
*/ |
|||
public function getDisplayBlanksAs() { |
|||
return $this->_displayBlanksAs; |
|||
} |
|||
|
|||
/** |
|||
* Set Display Blanks as |
|||
* |
|||
* @param string $displayBlanksAs |
|||
* @return PHPExcel_Chart |
|||
*/ |
|||
public function setDisplayBlanksAs($displayBlanksAs = '0') { |
|||
$this->_displayBlanksAs = $displayBlanksAs; |
|||
} |
|||
|
|||
|
|||
/** |
|||
* Set the Top Left position for the chart |
|||
* |
|||
* @param string $cell |
|||
* @param integer $xOffset |
|||
* @param integer $yOffset |
|||
* @return PHPExcel_Chart |
|||
*/ |
|||
public function setTopLeftPosition($cell, $xOffset=null, $yOffset=null) { |
|||
$this->_topLeftCellRef = $cell; |
|||
if (!is_null($xOffset)) |
|||
$this->setTopLeftXOffset($xOffset); |
|||
if (!is_null($yOffset)) |
|||
$this->setTopLeftYOffset($yOffset); |
|||
|
|||
return $this; |
|||
} |
|||
|
|||
/** |
|||
* Get the top left position of the chart |
|||
* |
|||
* @return array an associative array containing the cell address, X-Offset and Y-Offset from the top left of that cell |
|||
*/ |
|||
public function getTopLeftPosition() { |
|||
return array( 'cell' => $this->_topLeftCellRef, |
|||
'xOffset' => $this->_topLeftXOffset, |
|||
'yOffset' => $this->_topLeftYOffset |
|||
); |
|||
} |
|||
|
|||
/** |
|||
* Get the cell address where the top left of the chart is fixed |
|||
* |
|||
* @return string |
|||
*/ |
|||
public function getTopLeftCell() { |
|||
return $this->_topLeftCellRef; |
|||
} |
|||
|
|||
/** |
|||
* Set the Top Left cell position for the chart |
|||
* |
|||
* @param string $cell |
|||
* @return PHPExcel_Chart |
|||
*/ |
|||
public function setTopLeftCell($cell) { |
|||
$this->_topLeftCellRef = $cell; |
|||
|
|||
return $this; |
|||
} |
|||
|
|||
/** |
|||
* Set the offset position within the Top Left cell for the chart |
|||
* |
|||
* @param integer $xOffset |
|||
* @param integer $yOffset |
|||
* @return PHPExcel_Chart |
|||
*/ |
|||
public function setTopLeftOffset($xOffset=null,$yOffset=null) { |
|||
if (!is_null($xOffset)) |
|||
$this->setTopLeftXOffset($xOffset); |
|||
if (!is_null($yOffset)) |
|||
$this->setTopLeftYOffset($yOffset); |
|||
|
|||
return $this; |
|||
} |
|||
|
|||
/** |
|||
* Get the offset position within the Top Left cell for the chart |
|||
* |
|||
* @return integer[] |
|||
*/ |
|||
public function getTopLeftOffset() { |
|||
return array( 'X' => $this->_topLeftXOffset, |
|||
'Y' => $this->_topLeftYOffset |
|||
); |
|||
} |
|||
|
|||
public function setTopLeftXOffset($xOffset) { |
|||
$this->_topLeftXOffset = $xOffset; |
|||
|
|||
return $this; |
|||
} |
|||
|
|||
public function getTopLeftXOffset() { |
|||
return $this->_topLeftXOffset; |
|||
} |
|||
|
|||
public function setTopLeftYOffset($yOffset) { |
|||
$this->_topLeftYOffset = $yOffset; |
|||
|
|||
return $this; |
|||
} |
|||
|
|||
public function getTopLeftYOffset() { |
|||
return $this->_topLeftYOffset; |
|||
} |
|||
|
|||
/** |
|||
* Set the Bottom Right position of the chart |
|||
* |
|||
* @param string $cell |
|||
* @param integer $xOffset |
|||
* @param integer $yOffset |
|||
* @return PHPExcel_Chart |
|||
*/ |
|||
public function setBottomRightPosition($cell, $xOffset=null, $yOffset=null) { |
|||
$this->_bottomRightCellRef = $cell; |
|||
if (!is_null($xOffset)) |
|||
$this->setBottomRightXOffset($xOffset); |
|||
if (!is_null($yOffset)) |
|||
$this->setBottomRightYOffset($yOffset); |
|||
|
|||
return $this; |
|||
} |
|||
|
|||
/** |
|||
* Get the bottom right position of the chart |
|||
* |
|||
* @return array an associative array containing the cell address, X-Offset and Y-Offset from the top left of that cell |
|||
*/ |
|||
public function getBottomRightPosition() { |
|||
return array( 'cell' => $this->_bottomRightCellRef, |
|||
'xOffset' => $this->_bottomRightXOffset, |
|||
'yOffset' => $this->_bottomRightYOffset |
|||
); |
|||
} |
|||
|
|||
public function setBottomRightCell($cell) { |
|||
$this->_bottomRightCellRef = $cell; |
|||
|
|||
return $this; |
|||
} |
|||
|
|||
/** |
|||
* Get the cell address where the bottom right of the chart is fixed |
|||
* |
|||
* @return string |
|||
*/ |
|||
public function getBottomRightCell() { |
|||
return $this->_bottomRightCellRef; |
|||
} |
|||
|
|||
/** |
|||
* Set the offset position within the Bottom Right cell for the chart |
|||
* |
|||
* @param integer $xOffset |
|||
* @param integer $yOffset |
|||
* @return PHPExcel_Chart |
|||
*/ |
|||
public function setBottomRightOffset($xOffset=null,$yOffset=null) { |
|||
if (!is_null($xOffset)) |
|||
$this->setBottomRightXOffset($xOffset); |
|||
if (!is_null($yOffset)) |
|||
$this->setBottomRightYOffset($yOffset); |
|||
|
|||
return $this; |
|||
} |
|||
|
|||
/** |
|||
* Get the offset position within the Bottom Right cell for the chart |
|||
* |
|||
* @return integer[] |
|||
*/ |
|||
public function getBottomRightOffset() { |
|||
return array( 'X' => $this->_bottomRightXOffset, |
|||
'Y' => $this->_bottomRightYOffset |
|||
); |
|||
} |
|||
|
|||
public function setBottomRightXOffset($xOffset) { |
|||
$this->_bottomRightXOffset = $xOffset; |
|||
|
|||
return $this; |
|||
} |
|||
|
|||
public function getBottomRightXOffset() { |
|||
return $this->_bottomRightXOffset; |
|||
} |
|||
|
|||
public function setBottomRightYOffset($yOffset) { |
|||
$this->_bottomRightYOffset = $yOffset; |
|||
|
|||
return $this; |
|||
} |
|||
|
|||
public function getBottomRightYOffset() { |
|||
return $this->_bottomRightYOffset; |
|||
} |
|||
|
|||
|
|||
public function refresh() { |
|||
if ($this->_worksheet !== NULL) { |
|||
$this->_plotArea->refresh($this->_worksheet); |
|||
} |
|||
} |
|||
|
|||
public function render($outputDestination = null) { |
|||
$libraryName = PHPExcel_Settings::getChartRendererName(); |
|||
if (is_null($libraryName)) { |
|||
return false; |
|||
} |
|||
// Ensure that data series values are up-to-date before we render |
|||
$this->refresh(); |
|||
|
|||
$libraryPath = PHPExcel_Settings::getChartRendererPath(); |
|||
$includePath = str_replace('\\','/',get_include_path()); |
|||
$rendererPath = str_replace('\\','/',$libraryPath); |
|||
if (strpos($rendererPath,$includePath) === false) { |
|||
set_include_path(get_include_path() . PATH_SEPARATOR . $libraryPath); |
|||
} |
|||
|
|||
$rendererName = 'PHPExcel_Chart_Renderer_'.$libraryName; |
|||
$renderer = new $rendererName($this); |
|||
|
|||
if ($outputDestination == 'php://output') { |
|||
$outputDestination = null; |
|||
} |
|||
return $renderer->render($outputDestination); |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,327 @@ |
|||
<?php |
|||
/** |
|||
* PHPExcel |
|||
* |
|||
* Copyright (c) 2006 - 2013 PHPExcel |
|||
* |
|||
* This library is free software; you can redistribute it and/or |
|||
* modify it under the terms of the GNU Lesser General Public |
|||
* License as published by the Free Software Foundation; either |
|||
* version 2.1 of the License, or (at your option) any later version. |
|||
* |
|||
* This library is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|||
* Lesser General Public License for more details. |
|||
* |
|||
* You should have received a copy of the GNU Lesser General Public |
|||
* License along with this library; if not, write to the Free Software |
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|||
* |
|||
* @category PHPExcel |
|||
* @package PHPExcel |
|||
* @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) |
|||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL |
|||
* @version 1.7.9, 2013-06-02 |
|||
*/ |
|||
|
|||
|
|||
/** |
|||
* PHPExcel_Comment |
|||
* |
|||
* @category PHPExcel |
|||
* @package PHPExcel |
|||
* @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) |
|||
*/ |
|||
class PHPExcel_Comment implements PHPExcel_IComparable |
|||
{ |
|||
/** |
|||
* Author |
|||
* |
|||
* @var string |
|||
*/ |
|||
private $_author; |
|||
|
|||
/** |
|||
* Rich text comment |
|||
* |
|||
* @var PHPExcel_RichText |
|||
*/ |
|||
private $_text; |
|||
|
|||
/** |
|||
* Comment width (CSS style, i.e. XXpx or YYpt) |
|||
* |
|||
* @var string |
|||
*/ |
|||
private $_width = '96pt'; |
|||
|
|||
/** |
|||
* Left margin (CSS style, i.e. XXpx or YYpt) |
|||
* |
|||
* @var string |
|||
*/ |
|||
private $_marginLeft = '59.25pt'; |
|||
|
|||
/** |
|||
* Top margin (CSS style, i.e. XXpx or YYpt) |
|||
* |
|||
* @var string |
|||
*/ |
|||
private $_marginTop = '1.5pt'; |
|||
|
|||
/** |
|||
* Visible |
|||
* |
|||
* @var boolean |
|||
*/ |
|||
private $_visible = false; |
|||
|
|||
/** |
|||
* Comment height (CSS style, i.e. XXpx or YYpt) |
|||
* |
|||
* @var string |
|||
*/ |
|||
private $_height = '55.5pt'; |
|||
|
|||
/** |
|||
* Comment fill color |
|||
* |
|||
* @var PHPExcel_Style_Color |
|||
*/ |
|||
private $_fillColor; |
|||
|
|||
/** |
|||
* Alignment |
|||
* |
|||
* @var string |
|||
*/ |
|||
private $_alignment; |
|||
|
|||
/** |
|||
* Create a new PHPExcel_Comment |
|||
* |
|||
* @throws PHPExcel_Exception |
|||
*/ |
|||
public function __construct() |
|||
{ |
|||
// Initialise variables |
|||
$this->_author = 'Author'; |
|||
$this->_text = new PHPExcel_RichText(); |
|||
$this->_fillColor = new PHPExcel_Style_Color('FFFFFFE1'); |
|||
$this->_alignment = PHPExcel_Style_Alignment::HORIZONTAL_GENERAL; |
|||
} |
|||
|
|||
/** |
|||
* Get Author |
|||
* |
|||
* @return string |
|||
*/ |
|||
public function getAuthor() { |
|||
return $this->_author; |
|||
} |
|||
|
|||
/** |
|||
* Set Author |
|||
* |
|||
* @param string $pValue |
|||
* @return PHPExcel_Comment |
|||
*/ |
|||
public function setAuthor($pValue = '') { |
|||
$this->_author = $pValue; |
|||
return $this; |
|||
} |
|||
|
|||
/** |
|||
* Get Rich text comment |
|||
* |
|||
* @return PHPExcel_RichText |
|||
*/ |
|||
public function getText() { |
|||
return $this->_text; |
|||
} |
|||
|
|||
/** |
|||
* Set Rich text comment |
|||
* |
|||
* @param PHPExcel_RichText $pValue |
|||
* @return PHPExcel_Comment |
|||
*/ |
|||
public function setText(PHPExcel_RichText $pValue) { |
|||
$this->_text = $pValue; |
|||
return $this; |
|||
} |
|||
|
|||
/** |
|||
* Get comment width (CSS style, i.e. XXpx or YYpt) |
|||
* |
|||
* @return string |
|||
*/ |
|||
public function getWidth() { |
|||
return $this->_width; |
|||
} |
|||
|
|||
/** |
|||
* Set comment width (CSS style, i.e. XXpx or YYpt) |
|||
* |
|||
* @param string $value |
|||
* @return PHPExcel_Comment |
|||
*/ |
|||
public function setWidth($value = '96pt') { |
|||
$this->_width = $value; |
|||
return $this; |
|||
} |
|||
|
|||
/** |
|||
* Get comment height (CSS style, i.e. XXpx or YYpt) |
|||
* |
|||
* @return string |
|||
*/ |
|||
public function getHeight() { |
|||
return $this->_height; |
|||
} |
|||
|
|||
/** |
|||
* Set comment height (CSS style, i.e. XXpx or YYpt) |
|||
* |
|||
* @param string $value |
|||
* @return PHPExcel_Comment |
|||
*/ |
|||
public function setHeight($value = '55.5pt') { |
|||
$this->_height = $value; |
|||
return $this; |
|||
} |
|||
|
|||
/** |
|||
* Get left margin (CSS style, i.e. XXpx or YYpt) |
|||
* |
|||
* @return string |
|||
*/ |
|||
public function getMarginLeft() { |
|||
return $this->_marginLeft; |
|||
} |
|||
|
|||
/** |
|||
* Set left margin (CSS style, i.e. XXpx or YYpt) |
|||
* |
|||
* @param string $value |
|||
* @return PHPExcel_Comment |
|||
*/ |
|||
public function setMarginLeft($value = '59.25pt') { |
|||
$this->_marginLeft = $value; |
|||
return $this; |
|||
} |
|||
|
|||
/** |
|||
* Get top margin (CSS style, i.e. XXpx or YYpt) |
|||
* |
|||
* @return string |
|||
*/ |
|||
public function getMarginTop() { |
|||
return $this->_marginTop; |
|||
} |
|||
|
|||
/** |
|||
* Set top margin (CSS style, i.e. XXpx or YYpt) |
|||
* |
|||
* @param string $value |
|||
* @return PHPExcel_Comment |
|||
*/ |
|||
public function setMarginTop($value = '1.5pt') { |
|||
$this->_marginTop = $value; |
|||
return $this; |
|||
} |
|||
|
|||
/** |
|||
* Is the comment visible by default? |
|||
* |
|||
* @return boolean |
|||
*/ |
|||
public function getVisible() { |
|||
return $this->_visible; |
|||
} |
|||
|
|||
/** |
|||
* Set comment default visibility |
|||
* |
|||
* @param boolean $value |
|||
* @return PHPExcel_Comment |
|||
*/ |
|||
public function setVisible($value = false) { |
|||
$this->_visible = $value; |
|||
return $this; |
|||
} |
|||
|
|||
/** |
|||
* Get fill color |
|||
* |
|||
* @return PHPExcel_Style_Color |
|||
*/ |
|||
public function getFillColor() { |
|||
return $this->_fillColor; |
|||
} |
|||
|
|||
/** |
|||
* Set Alignment |
|||
* |
|||
* @param string $pValue |
|||
* @return PHPExcel_Comment |
|||
*/ |
|||
public function setAlignment($pValue = PHPExcel_Style_Alignment::HORIZONTAL_GENERAL) { |
|||
$this->_alignment = $pValue; |
|||
return $this; |
|||
} |
|||
|
|||
/** |
|||
* Get Alignment |
|||
* |
|||
* @return string |
|||
*/ |
|||
public function getAlignment() { |
|||
return $this->_alignment; |
|||
} |
|||
|
|||
/** |
|||
* Get hash code |
|||
* |
|||
* @return string Hash code |
|||
*/ |
|||
public function getHashCode() { |
|||
return md5( |
|||
$this->_author |
|||
. $this->_text->getHashCode() |
|||
. $this->_width |
|||
. $this->_height |
|||
. $this->_marginLeft |
|||
. $this->_marginTop |
|||
. ($this->_visible ? 1 : 0) |
|||
. $this->_fillColor->getHashCode() |
|||
. $this->_alignment |
|||
. __CLASS__ |
|||
); |
|||
} |
|||
|
|||
/** |
|||
* Implement PHP __clone to create a deep clone, not just a shallow copy. |
|||
*/ |
|||
public function __clone() { |
|||
$vars = get_object_vars($this); |
|||
foreach ($vars as $key => $value) { |
|||
if (is_object($value)) { |
|||
$this->$key = clone $value; |
|||
} else { |
|||
$this->$key = $value; |
|||
} |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* Convert to string |
|||
* |
|||
* @return string |
|||
*/ |
|||
public function __toString() { |
|||
return $this->_text->getPlainText(); |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,429 @@ |
|||
<?php |
|||
/** |
|||
* PHPExcel |
|||
* |
|||
* Copyright (c) 2006 - 2013 PHPExcel |
|||
* |
|||
* This library is free software; you can redistribute it and/or |
|||
* modify it under the terms of the GNU Lesser General Public |
|||
* License as published by the Free Software Foundation; either |
|||
* version 2.1 of the License, or (at your option) any later version. |
|||
* |
|||
* This library is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|||
* Lesser General Public License for more details. |
|||
* |
|||
* You should have received a copy of the GNU Lesser General Public |
|||
* License along with this library; if not, write to the Free Software |
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|||
* |
|||
* @category PHPExcel |
|||
* @package PHPExcel_Style |
|||
* @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) |
|||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL |
|||
* @version 1.7.9, 2013-06-02 |
|||
*/ |
|||
|
|||
|
|||
/** |
|||
* PHPExcel_Style_Color |
|||
* |
|||
* @category PHPExcel |
|||
* @package PHPExcel_Style |
|||
* @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) |
|||
*/ |
|||
class PHPExcel_Style_Color extends PHPExcel_Style_Supervisor implements PHPExcel_IComparable |
|||
{ |
|||
/* Colors */ |
|||
const COLOR_BLACK = 'FF000000'; |
|||
const COLOR_WHITE = 'FFFFFFFF'; |
|||
const COLOR_RED = 'FFFF0000'; |
|||
const COLOR_DARKRED = 'FF800000'; |
|||
const COLOR_BLUE = 'FF0000FF'; |
|||
const COLOR_DARKBLUE = 'FF000080'; |
|||
const COLOR_GREEN = 'FF00FF00'; |
|||
const COLOR_DARKGREEN = 'FF008000'; |
|||
const COLOR_YELLOW = 'FFFFFF00'; |
|||
const COLOR_DARKYELLOW = 'FF808000'; |
|||
|
|||
/** |
|||
* Indexed colors array |
|||
* |
|||
* @var array |
|||
*/ |
|||
protected static $_indexedColors; |
|||
|
|||
/** |
|||
* ARGB - Alpha RGB |
|||
* |
|||
* @var string |
|||
*/ |
|||
protected $_argb = NULL; |
|||
|
|||
/** |
|||
* Parent property name |
|||
* |
|||
* @var string |
|||
*/ |
|||
protected $_parentPropertyName; |
|||
|
|||
|
|||
/** |
|||
* Create a new PHPExcel_Style_Color |
|||
* |
|||
* @param string $pARGB ARGB value for the colour |
|||
* @param boolean $isSupervisor Flag indicating if this is a supervisor or not |
|||
* Leave this value at default unless you understand exactly what |
|||
* its ramifications are |
|||
* @param boolean $isConditional Flag indicating if this is a conditional style or not |
|||
* Leave this value at default unless you understand exactly what |
|||
* its ramifications are |
|||
*/ |
|||
public function __construct($pARGB = PHPExcel_Style_Color::COLOR_BLACK, $isSupervisor = FALSE, $isConditional = FALSE) |
|||
{ |
|||
// Supervisor? |
|||
parent::__construct($isSupervisor); |
|||
|
|||
// Initialise values |
|||
if (!$isConditional) { |
|||
$this->_argb = $pARGB; |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* Bind parent. Only used for supervisor |
|||
* |
|||
* @param mixed $parent |
|||
* @param string $parentPropertyName |
|||
* @return PHPExcel_Style_Color |
|||
*/ |
|||
public function bindParent($parent, $parentPropertyName=NULL) |
|||
{ |
|||
$this->_parent = $parent; |
|||
$this->_parentPropertyName = $parentPropertyName; |
|||
return $this; |
|||
} |
|||
|
|||
/** |
|||
* Get the shared style component for the currently active cell in currently active sheet. |
|||
* Only used for style supervisor |
|||
* |
|||
* @return PHPExcel_Style_Color |
|||
*/ |
|||
public function getSharedComponent() |
|||
{ |
|||
switch ($this->_parentPropertyName) { |
|||
case '_endColor': |
|||
return $this->_parent->getSharedComponent()->getEndColor(); break; |
|||
case '_color': |
|||
return $this->_parent->getSharedComponent()->getColor(); break; |
|||
case '_startColor': |
|||
return $this->_parent->getSharedComponent()->getStartColor(); break; |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* Build style array from subcomponents |
|||
* |
|||
* @param array $array |
|||
* @return array |
|||
*/ |
|||
public function getStyleArray($array) |
|||
{ |
|||
switch ($this->_parentPropertyName) { |
|||
case '_endColor': |
|||
$key = 'endcolor'; |
|||
break; |
|||
case '_color': |
|||
$key = 'color'; |
|||
break; |
|||
case '_startColor': |
|||
$key = 'startcolor'; |
|||
break; |
|||
|
|||
} |
|||
return $this->_parent->getStyleArray(array($key => $array)); |
|||
} |
|||
|
|||
/** |
|||
* Apply styles from array |
|||
* |
|||
* <code> |
|||
* $objPHPExcel->getActiveSheet()->getStyle('B2')->getFont()->getColor()->applyFromArray( array('rgb' => '808080') ); |
|||
* </code> |
|||
* |
|||
* @param array $pStyles Array containing style information |
|||
* @throws PHPExcel_Exception |
|||
* @return PHPExcel_Style_Color |
|||
*/ |
|||
public function applyFromArray($pStyles = NULL) { |
|||
if (is_array($pStyles)) { |
|||
if ($this->_isSupervisor) { |
|||
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($this->getStyleArray($pStyles)); |
|||
} else { |
|||
if (array_key_exists('rgb', $pStyles)) { |
|||
$this->setRGB($pStyles['rgb']); |
|||
} |
|||
if (array_key_exists('argb', $pStyles)) { |
|||
$this->setARGB($pStyles['argb']); |
|||
} |
|||
} |
|||
} else { |
|||
throw new PHPExcel_Exception("Invalid style array passed."); |
|||
} |
|||
return $this; |
|||
} |
|||
|
|||
/** |
|||
* Get ARGB |
|||
* |
|||
* @return string |
|||
*/ |
|||
public function getARGB() { |
|||
if ($this->_isSupervisor) { |
|||
return $this->getSharedComponent()->getARGB(); |
|||
} |
|||
return $this->_argb; |
|||
} |
|||
|
|||
/** |
|||
* Set ARGB |
|||
* |
|||
* @param string $pValue |
|||
* @return PHPExcel_Style_Color |
|||
*/ |
|||
public function setARGB($pValue = PHPExcel_Style_Color::COLOR_BLACK) { |
|||
if ($pValue == '') { |
|||
$pValue = PHPExcel_Style_Color::COLOR_BLACK; |
|||
} |
|||
if ($this->_isSupervisor) { |
|||
$styleArray = $this->getStyleArray(array('argb' => $pValue)); |
|||
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray); |
|||
} else { |
|||
$this->_argb = $pValue; |
|||
} |
|||
return $this; |
|||
} |
|||
|
|||
/** |
|||
* Get RGB |
|||
* |
|||
* @return string |
|||
*/ |
|||
public function getRGB() { |
|||
if ($this->_isSupervisor) { |
|||
return $this->getSharedComponent()->getRGB(); |
|||
} |
|||
return substr($this->_argb, 2); |
|||
} |
|||
|
|||
/** |
|||
* Set RGB |
|||
* |
|||
* @param string $pValue RGB value |
|||
* @return PHPExcel_Style_Color |
|||
*/ |
|||
public function setRGB($pValue = '000000') { |
|||
if ($pValue == '') { |
|||
$pValue = '000000'; |
|||
} |
|||
if ($this->_isSupervisor) { |
|||
$styleArray = $this->getStyleArray(array('argb' => 'FF' . $pValue)); |
|||
$this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray); |
|||
} else { |
|||
$this->_argb = 'FF' . $pValue; |
|||
} |
|||
return $this; |
|||
} |
|||
|
|||
/** |
|||
* Get a specified colour component of an RGB value |
|||
* |
|||
* @private |
|||
* @param string $RGB The colour as an RGB value (e.g. FF00CCCC or CCDDEE |
|||
* @param int $offset Position within the RGB value to extract |
|||
* @param boolean $hex Flag indicating whether the component should be returned as a hex or a |
|||
* decimal value |
|||
* @return string The extracted colour component |
|||
*/ |
|||
private static function _getColourComponent($RGB,$offset,$hex=TRUE) { |
|||
$colour = substr($RGB, $offset, 2); |
|||
if (!$hex) |
|||
$colour = hexdec($colour); |
|||
return $colour; |
|||
} |
|||
|
|||
/** |
|||
* Get the red colour component of an RGB value |
|||
* |
|||
* @param string $RGB The colour as an RGB value (e.g. FF00CCCC or CCDDEE |
|||
* @param boolean $hex Flag indicating whether the component should be returned as a hex or a |
|||
* decimal value |
|||
* @return string The red colour component |
|||
*/ |
|||
public static function getRed($RGB,$hex=TRUE) { |
|||
return self::_getColourComponent($RGB, strlen($RGB) - 6, $hex); |
|||
} |
|||
|
|||
/** |
|||
* Get the green colour component of an RGB value |
|||
* |
|||
* @param string $RGB The colour as an RGB value (e.g. FF00CCCC or CCDDEE |
|||
* @param boolean $hex Flag indicating whether the component should be returned as a hex or a |
|||
* decimal value |
|||
* @return string The green colour component |
|||
*/ |
|||
public static function getGreen($RGB,$hex=TRUE) { |
|||
return self::_getColourComponent($RGB, strlen($RGB) - 4, $hex); |
|||
} |
|||
|
|||
/** |
|||
* Get the blue colour component of an RGB value |
|||
* |
|||
* @param string $RGB The colour as an RGB value (e.g. FF00CCCC or CCDDEE |
|||
* @param boolean $hex Flag indicating whether the component should be returned as a hex or a |
|||
* decimal value |
|||
* @return string The blue colour component |
|||
*/ |
|||
public static function getBlue($RGB,$hex=TRUE) { |
|||
return self::_getColourComponent($RGB, strlen($RGB) - 2, $hex); |
|||
} |
|||
|
|||
/** |
|||
* Adjust the brightness of a color |
|||
* |
|||
* @param string $hex The colour as an RGBA or RGB value (e.g. FF00CCCC or CCDDEE) |
|||
* @param float $adjustPercentage The percentage by which to adjust the colour as a float from -1 to 1 |
|||
* @return string The adjusted colour as an RGBA or RGB value (e.g. FF00CCCC or CCDDEE) |
|||
*/ |
|||
public static function changeBrightness($hex, $adjustPercentage) { |
|||
$rgba = (strlen($hex) == 8); |
|||
|
|||
$red = self::getRed($hex, FALSE); |
|||
$green = self::getGreen($hex, FALSE); |
|||
$blue = self::getBlue($hex, FALSE); |
|||
if ($adjustPercentage > 0) { |
|||
$red += (255 - $red) * $adjustPercentage; |
|||
$green += (255 - $green) * $adjustPercentage; |
|||
$blue += (255 - $blue) * $adjustPercentage; |
|||
} else { |
|||
$red += $red * $adjustPercentage; |
|||
$green += $green * $adjustPercentage; |
|||
$blue += $blue * $adjustPercentage; |
|||
} |
|||
|
|||
if ($red < 0) $red = 0; |
|||
elseif ($red > 255) $red = 255; |
|||
if ($green < 0) $green = 0; |
|||
elseif ($green > 255) $green = 255; |
|||
if ($blue < 0) $blue = 0; |
|||
elseif ($blue > 255) $blue = 255; |
|||
|
|||
$rgb = strtoupper( str_pad(dechex($red), 2, '0', 0) . |
|||
str_pad(dechex($green), 2, '0', 0) . |
|||
str_pad(dechex($blue), 2, '0', 0) |
|||
); |
|||
return (($rgba) ? 'FF' : '') . $rgb; |
|||
} |
|||
|
|||
/** |
|||
* Get indexed color |
|||
* |
|||
* @param int $pIndex Index entry point into the colour array |
|||
* @param boolean $background Flag to indicate whether default background or foreground colour |
|||
* should be returned if the indexed colour doesn't exist |
|||
* @return PHPExcel_Style_Color |
|||
*/ |
|||
public static function indexedColor($pIndex, $background=FALSE) { |
|||
// Clean parameter |
|||
$pIndex = intval($pIndex); |
|||
|
|||
// Indexed colors |
|||
if (is_null(self::$_indexedColors)) { |
|||
self::$_indexedColors = array( |
|||
1 => 'FF000000', // System Colour #1 - Black |
|||
2 => 'FFFFFFFF', // System Colour #2 - White |
|||
3 => 'FFFF0000', // System Colour #3 - Red |
|||
4 => 'FF00FF00', // System Colour #4 - Green |
|||
5 => 'FF0000FF', // System Colour #5 - Blue |
|||
6 => 'FFFFFF00', // System Colour #6 - Yellow |
|||
7 => 'FFFF00FF', // System Colour #7- Magenta |
|||
8 => 'FF00FFFF', // System Colour #8- Cyan |
|||
9 => 'FF800000', // Standard Colour #9 |
|||
10 => 'FF008000', // Standard Colour #10 |
|||
11 => 'FF000080', // Standard Colour #11 |
|||
12 => 'FF808000', // Standard Colour #12 |
|||
13 => 'FF800080', // Standard Colour #13 |
|||
14 => 'FF008080', // Standard Colour #14 |
|||
15 => 'FFC0C0C0', // Standard Colour #15 |
|||
16 => 'FF808080', // Standard Colour #16 |
|||
17 => 'FF9999FF', // Chart Fill Colour #17 |
|||
18 => 'FF993366', // Chart Fill Colour #18 |
|||
19 => 'FFFFFFCC', // Chart Fill Colour #19 |
|||
20 => 'FFCCFFFF', // Chart Fill Colour #20 |
|||
21 => 'FF660066', // Chart Fill Colour #21 |
|||
22 => 'FFFF8080', // Chart Fill Colour #22 |
|||
23 => 'FF0066CC', // Chart Fill Colour #23 |
|||
24 => 'FFCCCCFF', // Chart Fill Colour #24 |
|||
25 => 'FF000080', // Chart Line Colour #25 |
|||
26 => 'FFFF00FF', // Chart Line Colour #26 |
|||
27 => 'FFFFFF00', // Chart Line Colour #27 |
|||
28 => 'FF00FFFF', // Chart Line Colour #28 |
|||
29 => 'FF800080', // Chart Line Colour #29 |
|||
30 => 'FF800000', // Chart Line Colour #30 |
|||
31 => 'FF008080', // Chart Line Colour #31 |
|||
32 => 'FF0000FF', // Chart Line Colour #32 |
|||
33 => 'FF00CCFF', // Standard Colour #33 |
|||
34 => 'FFCCFFFF', // Standard Colour #34 |
|||
35 => 'FFCCFFCC', // Standard Colour #35 |
|||
36 => 'FFFFFF99', // Standard Colour #36 |
|||
37 => 'FF99CCFF', // Standard Colour #37 |
|||
38 => 'FFFF99CC', // Standard Colour #38 |
|||
39 => 'FFCC99FF', // Standard Colour #39 |
|||
40 => 'FFFFCC99', // Standard Colour #40 |
|||
41 => 'FF3366FF', // Standard Colour #41 |
|||
42 => 'FF33CCCC', // Standard Colour #42 |
|||
43 => 'FF99CC00', // Standard Colour #43 |
|||
44 => 'FFFFCC00', // Standard Colour #44 |
|||
45 => 'FFFF9900', // Standard Colour #45 |
|||
46 => 'FFFF6600', // Standard Colour #46 |
|||
47 => 'FF666699', // Standard Colour #47 |
|||
48 => 'FF969696', // Standard Colour #48 |
|||
49 => 'FF003366', // Standard Colour #49 |
|||
50 => 'FF339966', // Standard Colour #50 |
|||
51 => 'FF003300', // Standard Colour #51 |
|||
52 => 'FF333300', // Standard Colour #52 |
|||
53 => 'FF993300', // Standard Colour #53 |
|||
54 => 'FF993366', // Standard Colour #54 |
|||
55 => 'FF333399', // Standard Colour #55 |
|||
56 => 'FF333333' // Standard Colour #56 |
|||
); |
|||
} |
|||
|
|||
if (array_key_exists($pIndex, self::$_indexedColors)) { |
|||
return new PHPExcel_Style_Color(self::$_indexedColors[$pIndex]); |
|||
} |
|||
|
|||
if ($background) { |
|||
return new PHPExcel_Style_Color('FFFFFFFF'); |
|||
} |
|||
return new PHPExcel_Style_Color('FF000000'); |
|||
} |
|||
|
|||
/** |
|||
* Get hash code |
|||
* |
|||
* @return string Hash code |
|||
*/ |
|||
public function getHashCode() { |
|||
if ($this->_isSupervisor) { |
|||
return $this->getSharedComponent()->getHashCode(); |
|||
} |
|||
return md5( |
|||
$this->_argb |
|||
. __CLASS__ |
|||
); |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,277 @@ |
|||
<?php |
|||
/** |
|||
* PHPExcel |
|||
* |
|||
* Copyright (c) 2006 - 2013 PHPExcel |
|||
* |
|||
* This library is free software; you can redistribute it and/or |
|||
* modify it under the terms of the GNU Lesser General Public |
|||
* License as published by the Free Software Foundation; either |
|||
* version 2.1 of the License, or (at your option) any later version. |
|||
* |
|||
* This library is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|||
* Lesser General Public License for more details. |
|||
* |
|||
* You should have received a copy of the GNU Lesser General Public |
|||
* License along with this library; if not, write to the Free Software |
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|||
* |
|||
* @category PHPExcel |
|||
* @package PHPExcel_Style |
|||
* @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) |
|||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL |
|||
* @version 1.7.9, 2013-06-02 |
|||
*/ |
|||
|
|||
|
|||
/** |
|||
* PHPExcel_Style_Conditional |
|||
* |
|||
* @category PHPExcel |
|||
* @package PHPExcel_Style |
|||
* @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) |
|||
*/ |
|||
class PHPExcel_Style_Conditional implements PHPExcel_IComparable |
|||
{ |
|||
/* Condition types */ |
|||
const CONDITION_NONE = 'none'; |
|||
const CONDITION_CELLIS = 'cellIs'; |
|||
const CONDITION_CONTAINSTEXT = 'containsText'; |
|||
const CONDITION_EXPRESSION = 'expression'; |
|||
|
|||
/* Operator types */ |
|||
const OPERATOR_NONE = ''; |
|||
const OPERATOR_BEGINSWITH = 'beginsWith'; |
|||
const OPERATOR_ENDSWITH = 'endsWith'; |
|||
const OPERATOR_EQUAL = 'equal'; |
|||
const OPERATOR_GREATERTHAN = 'greaterThan'; |
|||
const OPERATOR_GREATERTHANOREQUAL = 'greaterThanOrEqual'; |
|||
const OPERATOR_LESSTHAN = 'lessThan'; |
|||
const OPERATOR_LESSTHANOREQUAL = 'lessThanOrEqual'; |
|||
const OPERATOR_NOTEQUAL = 'notEqual'; |
|||
const OPERATOR_CONTAINSTEXT = 'containsText'; |
|||
const OPERATOR_NOTCONTAINS = 'notContains'; |
|||
const OPERATOR_BETWEEN = 'between'; |
|||
|
|||
/** |
|||
* Condition type |
|||
* |
|||
* @var int |
|||
*/ |
|||
private $_conditionType; |
|||
|
|||
/** |
|||
* Operator type |
|||
* |
|||
* @var int |
|||
*/ |
|||
private $_operatorType; |
|||
|
|||
/** |
|||
* Text |
|||
* |
|||
* @var string |
|||
*/ |
|||
private $_text; |
|||
|
|||
/** |
|||
* Condition |
|||
* |
|||
* @var string[] |
|||
*/ |
|||
private $_condition = array(); |
|||
|
|||
/** |
|||
* Style |
|||
* |
|||
* @var PHPExcel_Style |
|||
*/ |
|||
private $_style; |
|||
|
|||
/** |
|||
* Create a new PHPExcel_Style_Conditional |
|||
*/ |
|||
public function __construct() |
|||
{ |
|||
// Initialise values |
|||
$this->_conditionType = PHPExcel_Style_Conditional::CONDITION_NONE; |
|||
$this->_operatorType = PHPExcel_Style_Conditional::OPERATOR_NONE; |
|||
$this->_text = null; |
|||
$this->_condition = array(); |
|||
$this->_style = new PHPExcel_Style(FALSE, TRUE); |
|||
} |
|||
|
|||
/** |
|||
* Get Condition type |
|||
* |
|||
* @return string |
|||
*/ |
|||
public function getConditionType() { |
|||
return $this->_conditionType; |
|||
} |
|||
|
|||
/** |
|||
* Set Condition type |
|||
* |
|||
* @param string $pValue PHPExcel_Style_Conditional condition type |
|||
* @return PHPExcel_Style_Conditional |
|||
*/ |
|||
public function setConditionType($pValue = PHPExcel_Style_Conditional::CONDITION_NONE) { |
|||
$this->_conditionType = $pValue; |
|||
return $this; |
|||
} |
|||
|
|||
/** |
|||
* Get Operator type |
|||
* |
|||
* @return string |
|||
*/ |
|||
public function getOperatorType() { |
|||
return $this->_operatorType; |
|||
} |
|||
|
|||
/** |
|||
* Set Operator type |
|||
* |
|||
* @param string $pValue PHPExcel_Style_Conditional operator type |
|||
* @return PHPExcel_Style_Conditional |
|||
*/ |
|||
public function setOperatorType($pValue = PHPExcel_Style_Conditional::OPERATOR_NONE) { |
|||
$this->_operatorType = $pValue; |
|||
return $this; |
|||
} |
|||
|
|||
/** |
|||
* Get text |
|||
* |
|||
* @return string |
|||
*/ |
|||
public function getText() { |
|||
return $this->_text; |
|||
} |
|||
|
|||
/** |
|||
* Set text |
|||
* |
|||
* @param string $value |
|||
* @return PHPExcel_Style_Conditional |
|||
*/ |
|||
public function setText($value = null) { |
|||
$this->_text = $value; |
|||
return $this; |
|||
} |
|||
|
|||
/** |
|||
* Get Condition |
|||
* |
|||
* @deprecated Deprecated, use getConditions instead |
|||
* @return string |
|||
*/ |
|||
public function getCondition() { |
|||
if (isset($this->_condition[0])) { |
|||
return $this->_condition[0]; |
|||
} |
|||
|
|||
return ''; |
|||
} |
|||
|
|||
/** |
|||
* Set Condition |
|||
* |
|||
* @deprecated Deprecated, use setConditions instead |
|||
* @param string $pValue Condition |
|||
* @return PHPExcel_Style_Conditional |
|||
*/ |
|||
public function setCondition($pValue = '') { |
|||
if (!is_array($pValue)) |
|||
$pValue = array($pValue); |
|||
|
|||
return $this->setConditions($pValue); |
|||
} |
|||
|
|||
/** |
|||
* Get Conditions |
|||
* |
|||
* @return string[] |
|||
*/ |
|||
public function getConditions() { |
|||
return $this->_condition; |
|||
} |
|||
|
|||
/** |
|||
* Set Conditions |
|||
* |
|||
* @param string[] $pValue Condition |
|||
* @return PHPExcel_Style_Conditional |
|||
*/ |
|||
public function setConditions($pValue) { |
|||
if (!is_array($pValue)) |
|||
$pValue = array($pValue); |
|||
|
|||
$this->_condition = $pValue; |
|||
return $this; |
|||
} |
|||
|
|||
/** |
|||
* Add Condition |
|||
* |
|||
* @param string $pValue Condition |
|||
* @return PHPExcel_Style_Conditional |
|||
*/ |
|||
public function addCondition($pValue = '') { |
|||
$this->_condition[] = $pValue; |
|||
return $this; |
|||
} |
|||
|
|||
/** |
|||
* Get Style |
|||
* |
|||
* @return PHPExcel_Style |
|||
*/ |
|||
public function getStyle() { |
|||
return $this->_style; |
|||
} |
|||
|
|||
/** |
|||
* Set Style |
|||
* |
|||
* @param PHPExcel_Style $pValue |
|||
* @throws PHPExcel_Exception |
|||
* @return PHPExcel_Style_Conditional |
|||
*/ |
|||
public function setStyle(PHPExcel_Style $pValue = null) { |
|||
$this->_style = $pValue; |
|||
return $this; |
|||
} |
|||
|
|||
/** |
|||
* Get hash code |
|||
* |
|||
* @return string Hash code |
|||
*/ |
|||
public function getHashCode() { |
|||
return md5( |
|||
$this->_conditionType |
|||
. $this->_operatorType |
|||
. implode(';', $this->_condition) |
|||
. $this->_style->getHashCode() |
|||
. __CLASS__ |
|||
); |
|||
} |
|||
|
|||
/** |
|||
* Implement PHP __clone to create a deep clone, not just a shallow copy. |
|||
*/ |
|||
public function __clone() { |
|||
$vars = get_object_vars($this); |
|||
foreach ($vars as $key => $value) { |
|||
if (is_object($value)) { |
|||
$this->$key = clone $value; |
|||
} else { |
|||
$this->$key = $value; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,394 @@ |
|||
<?php |
|||
/** |
|||
* PHPExcel |
|||
* |
|||
* Copyright (c) 2006 - 2013 PHPExcel |
|||
* |
|||
* This library is free software; you can redistribute it and/or |
|||
* modify it under the terms of the GNU Lesser General Public |
|||
* License as published by the Free Software Foundation; either |
|||
* version 2.1 of the License, or (at your option) any later version. |
|||
* |
|||
* This library is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|||
* Lesser General Public License for more details. |
|||
* |
|||
* You should have received a copy of the GNU Lesser General Public |
|||
* License along with this library; if not, write to the Free Software |
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|||
* |
|||
* @category PHPExcel |
|||
* @package PHPExcel_Worksheet |
|||
* @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) |
|||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL |
|||
* @version 1.7.9, 2013-06-02 |
|||
*/ |
|||
|
|||
|
|||
/** |
|||
* PHPExcel_Worksheet_AutoFilter_Column |
|||
* |
|||
* @category PHPExcel |
|||
* @package PHPExcel_Worksheet |
|||
* @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) |
|||
*/ |
|||
class PHPExcel_Worksheet_AutoFilter_Column |
|||
{ |
|||
const AUTOFILTER_FILTERTYPE_FILTER = 'filters'; |
|||
const AUTOFILTER_FILTERTYPE_CUSTOMFILTER = 'customFilters'; |
|||
// Supports no more than 2 rules, with an And/Or join criteria |
|||
// if more than 1 rule is defined |
|||
const AUTOFILTER_FILTERTYPE_DYNAMICFILTER = 'dynamicFilter'; |
|||
// Even though the filter rule is constant, the filtered data can vary |
|||
// e.g. filtered by date = TODAY |
|||
const AUTOFILTER_FILTERTYPE_TOPTENFILTER = 'top10'; |
|||
|
|||
/** |
|||
* Types of autofilter rules |
|||
* |
|||
* @var string[] |
|||
*/ |
|||
private static $_filterTypes = array( |
|||
// Currently we're not handling |
|||
// colorFilter |
|||
// extLst |
|||
// iconFilter |
|||
self::AUTOFILTER_FILTERTYPE_FILTER, |
|||
self::AUTOFILTER_FILTERTYPE_CUSTOMFILTER, |
|||
self::AUTOFILTER_FILTERTYPE_DYNAMICFILTER, |
|||
self::AUTOFILTER_FILTERTYPE_TOPTENFILTER, |
|||
); |
|||
|
|||
/* Multiple Rule Connections */ |
|||
const AUTOFILTER_COLUMN_JOIN_AND = 'and'; |
|||
const AUTOFILTER_COLUMN_JOIN_OR = 'or'; |
|||
|
|||
/** |
|||
* Join options for autofilter rules |
|||
* |
|||
* @var string[] |
|||
*/ |
|||
private static $_ruleJoins = array( |
|||
self::AUTOFILTER_COLUMN_JOIN_AND, |
|||
self::AUTOFILTER_COLUMN_JOIN_OR, |
|||
); |
|||
|
|||
/** |
|||
* Autofilter |
|||
* |
|||
* @var PHPExcel_Worksheet_AutoFilter |
|||
*/ |
|||
private $_parent = NULL; |
|||
|
|||
|
|||
/** |
|||
* Autofilter Column Index |
|||
* |
|||
* @var string |
|||
*/ |
|||
private $_columnIndex = ''; |
|||
|
|||
|
|||
/** |
|||
* Autofilter Column Filter Type |
|||
* |
|||
* @var string |
|||
*/ |
|||
private $_filterType = self::AUTOFILTER_FILTERTYPE_FILTER; |
|||
|
|||
|
|||
/** |
|||
* Autofilter Multiple Rules And/Or |
|||
* |
|||
* @var string |
|||
*/ |
|||
private $_join = self::AUTOFILTER_COLUMN_JOIN_OR; |
|||
|
|||
|
|||
/** |
|||
* Autofilter Column Rules |
|||
* |
|||
* @var array of PHPExcel_Worksheet_AutoFilter_Column_Rule |
|||
*/ |
|||
private $_ruleset = array(); |
|||
|
|||
|
|||
/** |
|||
* Autofilter Column Dynamic Attributes |
|||
* |
|||
* @var array of mixed |
|||
*/ |
|||
private $_attributes = array(); |
|||
|
|||
|
|||
/** |
|||
* Create a new PHPExcel_Worksheet_AutoFilter_Column |
|||
* |
|||
* @param string $pColumn Column (e.g. A) |
|||
* @param PHPExcel_Worksheet_AutoFilter $pParent Autofilter for this column |
|||
*/ |
|||
public function __construct($pColumn, PHPExcel_Worksheet_AutoFilter $pParent = NULL) |
|||
{ |
|||
$this->_columnIndex = $pColumn; |
|||
$this->_parent = $pParent; |
|||
} |
|||
|
|||
/** |
|||
* Get AutoFilter Column Index |
|||
* |
|||
* @return string |
|||
*/ |
|||
public function getColumnIndex() { |
|||
return $this->_columnIndex; |
|||
} |
|||
|
|||
/** |
|||
* Set AutoFilter Column Index |
|||
* |
|||
* @param string $pColumn Column (e.g. A) |
|||
* @throws PHPExcel_Exception |
|||
* @return PHPExcel_Worksheet_AutoFilter_Column |
|||
*/ |
|||
public function setColumnIndex($pColumn) { |
|||
// Uppercase coordinate |
|||
$pColumn = strtoupper($pColumn); |
|||
if ($this->_parent !== NULL) { |
|||
$this->_parent->testColumnInRange($pColumn); |
|||
} |
|||
|
|||
$this->_columnIndex = $pColumn; |
|||
|
|||
return $this; |
|||
} |
|||
|
|||
/** |
|||
* Get this Column's AutoFilter Parent |
|||
* |
|||
* @return PHPExcel_Worksheet_AutoFilter |
|||
*/ |
|||
public function getParent() { |
|||
return $this->_parent; |
|||
} |
|||
|
|||
/** |
|||
* Set this Column's AutoFilter Parent |
|||
* |
|||
* @param PHPExcel_Worksheet_AutoFilter |
|||
* @return PHPExcel_Worksheet_AutoFilter_Column |
|||
*/ |
|||
public function setParent(PHPExcel_Worksheet_AutoFilter $pParent = NULL) { |
|||
$this->_parent = $pParent; |
|||
|
|||
return $this; |
|||
} |
|||
|
|||
/** |
|||
* Get AutoFilter Type |
|||
* |
|||
* @return string |
|||
*/ |
|||
public function getFilterType() { |
|||
return $this->_filterType; |
|||
} |
|||
|
|||
/** |
|||
* Set AutoFilter Type |
|||
* |
|||
* @param string $pFilterType |
|||
* @throws PHPExcel_Exception |
|||
* @return PHPExcel_Worksheet_AutoFilter_Column |
|||
*/ |
|||
public function setFilterType($pFilterType = self::AUTOFILTER_FILTERTYPE_FILTER) { |
|||
if (!in_array($pFilterType,self::$_filterTypes)) { |
|||
throw new PHPExcel_Exception('Invalid filter type for column AutoFilter.'); |
|||
} |
|||
|
|||
$this->_filterType = $pFilterType; |
|||
|
|||
return $this; |
|||
} |
|||
|
|||
/** |
|||
* Get AutoFilter Multiple Rules And/Or Join |
|||
* |
|||
* @return string |
|||
*/ |
|||
public function getJoin() { |
|||
return $this->_join; |
|||
} |
|||
|
|||
/** |
|||
* Set AutoFilter Multiple Rules And/Or |
|||
* |
|||
* @param string $pJoin And/Or |
|||
* @throws PHPExcel_Exception |
|||
* @return PHPExcel_Worksheet_AutoFilter_Column |
|||
*/ |
|||
public function setJoin($pJoin = self::AUTOFILTER_COLUMN_JOIN_OR) { |
|||
// Lowercase And/Or |
|||
$pJoin = strtolower($pJoin); |
|||
if (!in_array($pJoin,self::$_ruleJoins)) { |
|||
throw new PHPExcel_Exception('Invalid rule connection for column AutoFilter.'); |
|||
} |
|||
|
|||
$this->_join = $pJoin; |
|||
|
|||
return $this; |
|||
} |
|||
|
|||
/** |
|||
* Set AutoFilter Attributes |
|||
* |
|||
* @param string[] $pAttributes |
|||
* @throws PHPExcel_Exception |
|||
* @return PHPExcel_Worksheet_AutoFilter_Column |
|||
*/ |
|||
public function setAttributes($pAttributes = array()) { |
|||
$this->_attributes = $pAttributes; |
|||
|
|||
return $this; |
|||
} |
|||
|
|||
/** |
|||
* Set An AutoFilter Attribute |
|||
* |
|||
* @param string $pName Attribute Name |
|||
* @param string $pValue Attribute Value |
|||
* @throws PHPExcel_Exception |
|||
* @return PHPExcel_Worksheet_AutoFilter_Column |
|||
*/ |
|||
public function setAttribute($pName, $pValue) { |
|||
$this->_attributes[$pName] = $pValue; |
|||
|
|||
return $this; |
|||
} |
|||
|
|||
/** |
|||
* Get AutoFilter Column Attributes |
|||
* |
|||
* @return string |
|||
*/ |
|||
public function getAttributes() { |
|||
return $this->_attributes; |
|||
} |
|||
|
|||
/** |
|||
* Get specific AutoFilter Column Attribute |
|||
* |
|||
* @param string $pName Attribute Name |
|||
* @return string |
|||
*/ |
|||
public function getAttribute($pName) { |
|||
if (isset($this->_attributes[$pName])) |
|||
return $this->_attributes[$pName]; |
|||
return NULL; |
|||
} |
|||
|
|||
/** |
|||
* Get all AutoFilter Column Rules |
|||
* |
|||
* @throws PHPExcel_Exception |
|||
* @return array of PHPExcel_Worksheet_AutoFilter_Column_Rule |
|||
*/ |
|||
public function getRules() { |
|||
return $this->_ruleset; |
|||
} |
|||
|
|||
/** |
|||
* Get a specified AutoFilter Column Rule |
|||
* |
|||
* @param integer $pIndex Rule index in the ruleset array |
|||
* @return PHPExcel_Worksheet_AutoFilter_Column_Rule |
|||
*/ |
|||
public function getRule($pIndex) { |
|||
if (!isset($this->_ruleset[$pIndex])) { |
|||
$this->_ruleset[$pIndex] = new PHPExcel_Worksheet_AutoFilter_Column_Rule($this); |
|||
} |
|||
return $this->_ruleset[$pIndex]; |
|||
} |
|||
|
|||
/** |
|||
* Create a new AutoFilter Column Rule in the ruleset |
|||
* |
|||
* @return PHPExcel_Worksheet_AutoFilter_Column_Rule |
|||
*/ |
|||
public function createRule() { |
|||
$this->_ruleset[] = new PHPExcel_Worksheet_AutoFilter_Column_Rule($this); |
|||
|
|||
return end($this->_ruleset); |
|||
} |
|||
|
|||
/** |
|||
* Add a new AutoFilter Column Rule to the ruleset |
|||
* |
|||
* @param PHPExcel_Worksheet_AutoFilter_Column_Rule $pRule |
|||
* @param boolean $returnRule Flag indicating whether the rule object or the column object should be returned |
|||
* @return PHPExcel_Worksheet_AutoFilter_Column|PHPExcel_Worksheet_AutoFilter_Column_Rule |
|||
*/ |
|||
public function addRule(PHPExcel_Worksheet_AutoFilter_Column_Rule $pRule, $returnRule=TRUE) { |
|||
$pRule->setParent($this); |
|||
$this->_ruleset[] = $pRule; |
|||
|
|||
return ($returnRule) ? $pRule : $this; |
|||
} |
|||
|
|||
/** |
|||
* Delete a specified AutoFilter Column Rule |
|||
* If the number of rules is reduced to 1, then we reset And/Or logic to Or |
|||
* |
|||
* @param integer $pIndex Rule index in the ruleset array |
|||
* @return PHPExcel_Worksheet_AutoFilter_Column |
|||
*/ |
|||
public function deleteRule($pIndex) { |
|||
if (isset($this->_ruleset[$pIndex])) { |
|||
unset($this->_ruleset[$pIndex]); |
|||
// If we've just deleted down to a single rule, then reset And/Or joining to Or |
|||
if (count($this->_ruleset) <= 1) { |
|||
$this->setJoin(self::AUTOFILTER_COLUMN_JOIN_OR); |
|||
} |
|||
} |
|||
|
|||
return $this; |
|||
} |
|||
|
|||
/** |
|||
* Delete all AutoFilter Column Rules |
|||
* |
|||
* @return PHPExcel_Worksheet_AutoFilter_Column |
|||
*/ |
|||
public function clearRules() { |
|||
$this->_ruleset = array(); |
|||
$this->setJoin(self::AUTOFILTER_COLUMN_JOIN_OR); |
|||
|
|||
return $this; |
|||
} |
|||
|
|||
/** |
|||
* Implement PHP __clone to create a deep clone, not just a shallow copy. |
|||
*/ |
|||
public function __clone() { |
|||
$vars = get_object_vars($this); |
|||
foreach ($vars as $key => $value) { |
|||
if (is_object($value)) { |
|||
if ($key == '_parent') { |
|||
// Detach from autofilter parent |
|||
$this->$key = NULL; |
|||
} else { |
|||
$this->$key = clone $value; |
|||
} |
|||
} elseif ((is_array($value)) && ($key == '_ruleset')) { |
|||
// The columns array of PHPExcel_Worksheet_AutoFilter objects |
|||
$this->$key = array(); |
|||
foreach ($value as $k => $v) { |
|||
$this->$key[$k] = clone $v; |
|||
// attach the new cloned Rule to this new cloned Autofilter Cloned object |
|||
$this->$key[$k]->setParent($this); |
|||
} |
|||
} else { |
|||
$this->$key = $value; |
|||
} |
|||
} |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,161 @@ |
|||
<?php |
|||
/** |
|||
* PHPExcel |
|||
* |
|||
* Copyright (c) 2006 - 2013 PHPExcel |
|||
* |
|||
* This library is free software; you can redistribute it and/or |
|||
* modify it under the terms of the GNU Lesser General Public |
|||
* License as published by the Free Software Foundation; either |
|||
* version 2.1 of the License, or (at your option) any later version. |
|||
* |
|||
* This library is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|||
* Lesser General Public License for more details. |
|||
* |
|||
* You should have received a copy of the GNU Lesser General Public |
|||
* License along with this library; if not, write to the Free Software |
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|||
* |
|||
* @category PHPExcel |
|||
* @package PHPExcel_Worksheet |
|||
* @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) |
|||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL |
|||
* @version 1.7.9, 2013-06-02 |
|||
*/ |
|||
|
|||
|
|||
/** |
|||
* PHPExcel_Worksheet_CellIterator |
|||
* |
|||
* Used to iterate rows in a PHPExcel_Worksheet |
|||
* |
|||
* @category PHPExcel |
|||
* @package PHPExcel_Worksheet |
|||
* @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) |
|||
*/ |
|||
class PHPExcel_Worksheet_CellIterator implements Iterator |
|||
{ |
|||
/** |
|||
* PHPExcel_Worksheet to iterate |
|||
* |
|||
* @var PHPExcel_Worksheet |
|||
*/ |
|||
private $_subject; |
|||
|
|||
/** |
|||
* Row index |
|||
* |
|||
* @var int |
|||
*/ |
|||
private $_rowIndex; |
|||
|
|||
/** |
|||
* Current iterator position |
|||
* |
|||
* @var int |
|||
*/ |
|||
private $_position = 0; |
|||
|
|||
/** |
|||
* Loop only existing cells |
|||
* |
|||
* @var boolean |
|||
*/ |
|||
private $_onlyExistingCells = true; |
|||
|
|||
/** |
|||
* Create a new cell iterator |
|||
* |
|||
* @param PHPExcel_Worksheet $subject |
|||
* @param int $rowIndex |
|||
*/ |
|||
public function __construct(PHPExcel_Worksheet $subject = null, $rowIndex = 1) { |
|||
// Set subject and row index |
|||
$this->_subject = $subject; |
|||
$this->_rowIndex = $rowIndex; |
|||
} |
|||
|
|||
/** |
|||
* Destructor |
|||
*/ |
|||
public function __destruct() { |
|||
unset($this->_subject); |
|||
} |
|||
|
|||
/** |
|||
* Rewind iterator |
|||
*/ |
|||
public function rewind() { |
|||
$this->_position = 0; |
|||
} |
|||
|
|||
/** |
|||
* Current PHPExcel_Cell |
|||
* |
|||
* @return PHPExcel_Cell |
|||
*/ |
|||
public function current() { |
|||
return $this->_subject->getCellByColumnAndRow($this->_position, $this->_rowIndex); |
|||
} |
|||
|
|||
/** |
|||
* Current key |
|||
* |
|||
* @return int |
|||
*/ |
|||
public function key() { |
|||
return $this->_position; |
|||
} |
|||
|
|||
/** |
|||
* Next value |
|||
*/ |
|||
public function next() { |
|||
++$this->_position; |
|||
} |
|||
|
|||
/** |
|||
* Are there any more PHPExcel_Cell instances available? |
|||
* |
|||
* @return boolean |
|||
*/ |
|||
public function valid() { |
|||
// columnIndexFromString() returns an index based at one, |
|||
// treat it as a count when comparing it to the base zero |
|||
// position. |
|||
$columnCount = PHPExcel_Cell::columnIndexFromString($this->_subject->getHighestColumn()); |
|||
|
|||
if ($this->_onlyExistingCells) { |
|||
// If we aren't looking at an existing cell, either |
|||
// because the first column doesn't exist or next() has |
|||
// been called onto a nonexistent cell, then loop until we |
|||
// find one, or pass the last column. |
|||
while ($this->_position < $columnCount && |
|||
!$this->_subject->cellExistsByColumnAndRow($this->_position, $this->_rowIndex)) { |
|||
++$this->_position; |
|||
} |
|||
} |
|||
|
|||
return $this->_position < $columnCount; |
|||
} |
|||
|
|||
/** |
|||
* Get loop only existing cells |
|||
* |
|||
* @return boolean |
|||
*/ |
|||
public function getIterateOnlyExistingCells() { |
|||
return $this->_onlyExistingCells; |
|||
} |
|||
|
|||
/** |
|||
* Set the iterator to loop only existing cells |
|||
* |
|||
* @param boolean $value |
|||
*/ |
|||
public function setIterateOnlyExistingCells($value = true) { |
|||
$this->_onlyExistingCells = $value; |
|||
} |
|||
} |
|||
@ -0,0 +1,86 @@ |
|||
<?php |
|||
|
|||
/** |
|||
* PHPExcel_Worksheet_Column |
|||
* |
|||
* Copyright (c) 2006 - 2015 PHPExcel |
|||
* |
|||
* This library is free software; you can redistribute it and/or |
|||
* modify it under the terms of the GNU Lesser General Public |
|||
* License as published by the Free Software Foundation; either |
|||
* version 2.1 of the License, or (at your option) any later version. |
|||
* |
|||
* This library is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|||
* Lesser General Public License for more details. |
|||
* |
|||
* You should have received a copy of the GNU Lesser General Public |
|||
* License along with this library; if not, write to the Free Software |
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|||
* |
|||
* @category PHPExcel |
|||
* @package PHPExcel_Worksheet |
|||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel) |
|||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL |
|||
* @version ##VERSION##, ##DATE## |
|||
*/ |
|||
class PHPExcel_Worksheet_Column |
|||
{ |
|||
/** |
|||
* PHPExcel_Worksheet |
|||
* |
|||
* @var PHPExcel_Worksheet |
|||
*/ |
|||
private $parent; |
|||
|
|||
/** |
|||
* Column index |
|||
* |
|||
* @var string |
|||
*/ |
|||
private $columnIndex; |
|||
|
|||
/** |
|||
* Create a new column |
|||
* |
|||
* @param PHPExcel_Worksheet $parent |
|||
* @param string $columnIndex |
|||
*/ |
|||
public function __construct(PHPExcel_Worksheet $parent = null, $columnIndex = 'A') |
|||
{ |
|||
// Set parent and column index |
|||
$this->parent = $parent; |
|||
$this->columnIndex = $columnIndex; |
|||
} |
|||
|
|||
/** |
|||
* Destructor |
|||
*/ |
|||
public function __destruct() |
|||
{ |
|||
unset($this->parent); |
|||
} |
|||
|
|||
/** |
|||
* Get column index |
|||
* |
|||
* @return string |
|||
*/ |
|||
public function getColumnIndex() |
|||
{ |
|||
return $this->columnIndex; |
|||
} |
|||
|
|||
/** |
|||
* Get cell iterator |
|||
* |
|||
* @param integer $startRow The row number at which to start iterating |
|||
* @param integer $endRow Optionally, the row number at which to stop iterating |
|||
* @return PHPExcel_Worksheet_CellIterator |
|||
*/ |
|||
public function getCellIterator($startRow = 1, $endRow = null) |
|||
{ |
|||
return new PHPExcel_Worksheet_ColumnCellIterator($this->parent, $this->columnIndex, $startRow, $endRow); |
|||
} |
|||
} |
|||
@ -0,0 +1,216 @@ |
|||
<?php |
|||
|
|||
/** |
|||
* PHPExcel_Worksheet_ColumnCellIterator |
|||
* |
|||
* Copyright (c) 2006 - 2015 PHPExcel |
|||
* |
|||
* This library is free software; you can redistribute it and/or |
|||
* modify it under the terms of the GNU Lesser General Public |
|||
* License as published by the Free Software Foundation; either |
|||
* version 2.1 of the License, or (at your option) any later version. |
|||
* |
|||
* This library is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|||
* Lesser General Public License for more details. |
|||
* |
|||
* You should have received a copy of the GNU Lesser General Public |
|||
* License along with this library; if not, write to the Free Software |
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|||
* |
|||
* @category PHPExcel |
|||
* @package PHPExcel_Worksheet |
|||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel) |
|||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL |
|||
* @version ##VERSION##, ##DATE## |
|||
*/ |
|||
class PHPExcel_Worksheet_ColumnCellIterator extends PHPExcel_Worksheet_CellIterator implements Iterator |
|||
{ |
|||
/** |
|||
* Column index |
|||
* |
|||
* @var string |
|||
*/ |
|||
protected $columnIndex; |
|||
|
|||
/** |
|||
* Start position |
|||
* |
|||
* @var int |
|||
*/ |
|||
protected $startRow = 1; |
|||
|
|||
/** |
|||
* End position |
|||
* |
|||
* @var int |
|||
*/ |
|||
protected $endRow = 1; |
|||
|
|||
/** |
|||
* Create a new row iterator |
|||
* |
|||
* @param PHPExcel_Worksheet $subject The worksheet to iterate over |
|||
* @param string $columnIndex The column that we want to iterate |
|||
* @param integer $startRow The row number at which to start iterating |
|||
* @param integer $endRow Optionally, the row number at which to stop iterating |
|||
*/ |
|||
public function __construct(PHPExcel_Worksheet $subject = null, $columnIndex = 'A', $startRow = 1, $endRow = null) |
|||
{ |
|||
// Set subject |
|||
$this->subject = $subject; |
|||
$this->columnIndex = PHPExcel_Cell::columnIndexFromString($columnIndex) - 1; |
|||
$this->resetEnd($endRow); |
|||
$this->resetStart($startRow); |
|||
} |
|||
|
|||
/** |
|||
* Destructor |
|||
*/ |
|||
public function __destruct() |
|||
{ |
|||
unset($this->subject); |
|||
} |
|||
|
|||
/** |
|||
* (Re)Set the start row and the current row pointer |
|||
* |
|||
* @param integer $startRow The row number at which to start iterating |
|||
* @return PHPExcel_Worksheet_ColumnCellIterator |
|||
* @throws PHPExcel_Exception |
|||
*/ |
|||
public function resetStart($startRow = 1) |
|||
{ |
|||
$this->startRow = $startRow; |
|||
$this->adjustForExistingOnlyRange(); |
|||
$this->seek($startRow); |
|||
|
|||
return $this; |
|||
} |
|||
|
|||
/** |
|||
* (Re)Set the end row |
|||
* |
|||
* @param integer $endRow The row number at which to stop iterating |
|||
* @return PHPExcel_Worksheet_ColumnCellIterator |
|||
* @throws PHPExcel_Exception |
|||
*/ |
|||
public function resetEnd($endRow = null) |
|||
{ |
|||
$this->endRow = ($endRow) ? $endRow : $this->subject->getHighestRow(); |
|||
$this->adjustForExistingOnlyRange(); |
|||
|
|||
return $this; |
|||
} |
|||
|
|||
/** |
|||
* Set the row pointer to the selected row |
|||
* |
|||
* @param integer $row The row number to set the current pointer at |
|||
* @return PHPExcel_Worksheet_ColumnCellIterator |
|||
* @throws PHPExcel_Exception |
|||
*/ |
|||
public function seek($row = 1) |
|||
{ |
|||
if (($row < $this->startRow) || ($row > $this->endRow)) { |
|||
throw new PHPExcel_Exception("Row $row is out of range ({$this->startRow} - {$this->endRow})"); |
|||
} elseif ($this->onlyExistingCells && !($this->subject->cellExistsByColumnAndRow($this->columnIndex, $row))) { |
|||
throw new PHPExcel_Exception('In "IterateOnlyExistingCells" mode and Cell does not exist'); |
|||
} |
|||
$this->position = $row; |
|||
|
|||
return $this; |
|||
} |
|||
|
|||
/** |
|||
* Rewind the iterator to the starting row |
|||
*/ |
|||
public function rewind() |
|||
{ |
|||
$this->position = $this->startRow; |
|||
} |
|||
|
|||
/** |
|||
* Return the current cell in this worksheet column |
|||
* |
|||
* @return PHPExcel_Worksheet_Row |
|||
*/ |
|||
public function current() |
|||
{ |
|||
return $this->subject->getCellByColumnAndRow($this->columnIndex, $this->position); |
|||
} |
|||
|
|||
/** |
|||
* Return the current iterator key |
|||
* |
|||
* @return int |
|||
*/ |
|||
public function key() |
|||
{ |
|||
return $this->position; |
|||
} |
|||
|
|||
/** |
|||
* Set the iterator to its next value |
|||
*/ |
|||
public function next() |
|||
{ |
|||
do { |
|||
++$this->position; |
|||
} while (($this->onlyExistingCells) && |
|||
(!$this->subject->cellExistsByColumnAndRow($this->columnIndex, $this->position)) && |
|||
($this->position <= $this->endRow)); |
|||
} |
|||
|
|||
/** |
|||
* Set the iterator to its previous value |
|||
*/ |
|||
public function prev() |
|||
{ |
|||
if ($this->position <= $this->startRow) { |
|||
throw new PHPExcel_Exception("Row is already at the beginning of range ({$this->startRow} - {$this->endRow})"); |
|||
} |
|||
|
|||
do { |
|||
--$this->position; |
|||
} while (($this->onlyExistingCells) && |
|||
(!$this->subject->cellExistsByColumnAndRow($this->columnIndex, $this->position)) && |
|||
($this->position >= $this->startRow)); |
|||
} |
|||
|
|||
/** |
|||
* Indicate if more rows exist in the worksheet range of rows that we're iterating |
|||
* |
|||
* @return boolean |
|||
*/ |
|||
public function valid() |
|||
{ |
|||
return $this->position <= $this->endRow; |
|||
} |
|||
|
|||
/** |
|||
* Validate start/end values for "IterateOnlyExistingCells" mode, and adjust if necessary |
|||
* |
|||
* @throws PHPExcel_Exception |
|||
*/ |
|||
protected function adjustForExistingOnlyRange() |
|||
{ |
|||
if ($this->onlyExistingCells) { |
|||
while ((!$this->subject->cellExistsByColumnAndRow($this->columnIndex, $this->startRow)) && |
|||
($this->startRow <= $this->endRow)) { |
|||
++$this->startRow; |
|||
} |
|||
if ($this->startRow > $this->endRow) { |
|||
throw new PHPExcel_Exception('No cells exist within the specified range'); |
|||
} |
|||
while ((!$this->subject->cellExistsByColumnAndRow($this->columnIndex, $this->endRow)) && |
|||
($this->endRow >= $this->startRow)) { |
|||
--$this->endRow; |
|||
} |
|||
if ($this->endRow < $this->startRow) { |
|||
throw new PHPExcel_Exception('No cells exist within the specified range'); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,266 @@ |
|||
<?php |
|||
/** |
|||
* PHPExcel |
|||
* |
|||
* Copyright (c) 2006 - 2013 PHPExcel |
|||
* |
|||
* This library is free software; you can redistribute it and/or |
|||
* modify it under the terms of the GNU Lesser General Public |
|||
* License as published by the Free Software Foundation; either |
|||
* version 2.1 of the License, or (at your option) any later version. |
|||
* |
|||
* This library is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|||
* Lesser General Public License for more details. |
|||
* |
|||
* You should have received a copy of the GNU Lesser General Public |
|||
* License along with this library; if not, write to the Free Software |
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|||
* |
|||
* @category PHPExcel |
|||
* @package PHPExcel_Worksheet |
|||
* @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) |
|||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL |
|||
* @version 1.7.9, 2013-06-02 |
|||
*/ |
|||
|
|||
|
|||
/** |
|||
* PHPExcel_Worksheet_ColumnDimension |
|||
* |
|||
* @category PHPExcel |
|||
* @package PHPExcel_Worksheet |
|||
* @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) |
|||
*/ |
|||
class PHPExcel_Worksheet_ColumnDimension |
|||
{ |
|||
/** |
|||
* Column index |
|||
* |
|||
* @var int |
|||
*/ |
|||
private $_columnIndex; |
|||
|
|||
/** |
|||
* Column width |
|||
* |
|||
* When this is set to a negative value, the column width should be ignored by IWriter |
|||
* |
|||
* @var double |
|||
*/ |
|||
private $_width = -1; |
|||
|
|||
/** |
|||
* Auto size? |
|||
* |
|||
* @var bool |
|||
*/ |
|||
private $_autoSize = false; |
|||
|
|||
/** |
|||
* Visible? |
|||
* |
|||
* @var bool |
|||
*/ |
|||
private $_visible = true; |
|||
|
|||
/** |
|||
* Outline level |
|||
* |
|||
* @var int |
|||
*/ |
|||
private $_outlineLevel = 0; |
|||
|
|||
/** |
|||
* Collapsed |
|||
* |
|||
* @var bool |
|||
*/ |
|||
private $_collapsed = false; |
|||
|
|||
/** |
|||
* Index to cellXf |
|||
* |
|||
* @var int |
|||
*/ |
|||
private $_xfIndex; |
|||
|
|||
/** |
|||
* Create a new PHPExcel_Worksheet_ColumnDimension |
|||
* |
|||
* @param string $pIndex Character column index |
|||
*/ |
|||
public function __construct($pIndex = 'A') |
|||
{ |
|||
// Initialise values |
|||
$this->_columnIndex = $pIndex; |
|||
|
|||
// set default index to cellXf |
|||
$this->_xfIndex = 0; |
|||
} |
|||
|
|||
/** |
|||
* Get ColumnIndex |
|||
* |
|||
* @return string |
|||
*/ |
|||
public function getColumnIndex() { |
|||
return $this->_columnIndex; |
|||
} |
|||
|
|||
/** |
|||
* Set ColumnIndex |
|||
* |
|||
* @param string $pValue |
|||
* @return PHPExcel_Worksheet_ColumnDimension |
|||
*/ |
|||
public function setColumnIndex($pValue) { |
|||
$this->_columnIndex = $pValue; |
|||
return $this; |
|||
} |
|||
|
|||
/** |
|||
* Get Width |
|||
* |
|||
* @return double |
|||
*/ |
|||
public function getWidth() { |
|||
return $this->_width; |
|||
} |
|||
|
|||
/** |
|||
* Set Width |
|||
* |
|||
* @param double $pValue |
|||
* @return PHPExcel_Worksheet_ColumnDimension |
|||
*/ |
|||
public function setWidth($pValue = -1) { |
|||
$this->_width = $pValue; |
|||
return $this; |
|||
} |
|||
|
|||
/** |
|||
* Get Auto Size |
|||
* |
|||
* @return bool |
|||
*/ |
|||
public function getAutoSize() { |
|||
return $this->_autoSize; |
|||
} |
|||
|
|||
/** |
|||
* Set Auto Size |
|||
* |
|||
* @param bool $pValue |
|||
* @return PHPExcel_Worksheet_ColumnDimension |
|||
*/ |
|||
public function setAutoSize($pValue = false) { |
|||
$this->_autoSize = $pValue; |
|||
return $this; |
|||
} |
|||
|
|||
/** |
|||
* Get Visible |
|||
* |
|||
* @return bool |
|||
*/ |
|||
public function getVisible() { |
|||
return $this->_visible; |
|||
} |
|||
|
|||
/** |
|||
* Set Visible |
|||
* |
|||
* @param bool $pValue |
|||
* @return PHPExcel_Worksheet_ColumnDimension |
|||
*/ |
|||
public function setVisible($pValue = true) { |
|||
$this->_visible = $pValue; |
|||
return $this; |
|||
} |
|||
|
|||
/** |
|||
* Get Outline Level |
|||
* |
|||
* @return int |
|||
*/ |
|||
public function getOutlineLevel() { |
|||
return $this->_outlineLevel; |
|||
} |
|||
|
|||
/** |
|||
* Set Outline Level |
|||
* |
|||
* Value must be between 0 and 7 |
|||
* |
|||
* @param int $pValue |
|||
* @throws PHPExcel_Exception |
|||
* @return PHPExcel_Worksheet_ColumnDimension |
|||
*/ |
|||
public function setOutlineLevel($pValue) { |
|||
if ($pValue < 0 || $pValue > 7) { |
|||
throw new PHPExcel_Exception("Outline level must range between 0 and 7."); |
|||
} |
|||
|
|||
$this->_outlineLevel = $pValue; |
|||
return $this; |
|||
} |
|||
|
|||
/** |
|||
* Get Collapsed |
|||
* |
|||
* @return bool |
|||
*/ |
|||
public function getCollapsed() { |
|||
return $this->_collapsed; |
|||
} |
|||
|
|||
/** |
|||
* Set Collapsed |
|||
* |
|||
* @param bool $pValue |
|||
* @return PHPExcel_Worksheet_ColumnDimension |
|||
*/ |
|||
public function setCollapsed($pValue = true) { |
|||
$this->_collapsed = $pValue; |
|||
return $this; |
|||
} |
|||
|
|||
/** |
|||
* Get index to cellXf |
|||
* |
|||
* @return int |
|||
*/ |
|||
public function getXfIndex() |
|||
{ |
|||
return $this->_xfIndex; |
|||
} |
|||
|
|||
/** |
|||
* Set index to cellXf |
|||
* |
|||
* @param int $pValue |
|||
* @return PHPExcel_Worksheet_ColumnDimension |
|||
*/ |
|||
public function setXfIndex($pValue = 0) |
|||
{ |
|||
$this->_xfIndex = $pValue; |
|||
return $this; |
|||
} |
|||
|
|||
/** |
|||
* Implement PHP __clone to create a deep clone, not just a shallow copy. |
|||
*/ |
|||
public function __clone() { |
|||
$vars = get_object_vars($this); |
|||
foreach ($vars as $key => $value) { |
|||
if (is_object($value)) { |
|||
$this->$key = clone $value; |
|||
} else { |
|||
$this->$key = $value; |
|||
} |
|||
} |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,201 @@ |
|||
<?php |
|||
|
|||
/** |
|||
* PHPExcel_Worksheet_ColumnIterator |
|||
* |
|||
* Copyright (c) 2006 - 2015 PHPExcel |
|||
* |
|||
* This library is free software; you can redistribute it and/or |
|||
* modify it under the terms of the GNU Lesser General Public |
|||
* License as published by the Free Software Foundation; either |
|||
* version 2.1 of the License, or (at your option) any later version. |
|||
* |
|||
* This library is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|||
* Lesser General Public License for more details. |
|||
* |
|||
* You should have received a copy of the GNU Lesser General Public |
|||
* License along with this library; if not, write to the Free Software |
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|||
* |
|||
* @category PHPExcel |
|||
* @package PHPExcel_Worksheet |
|||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel) |
|||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL |
|||
* @version ##VERSION##, ##DATE## |
|||
*/ |
|||
class PHPExcel_Worksheet_ColumnIterator implements Iterator |
|||
{ |
|||
/** |
|||
* PHPExcel_Worksheet to iterate |
|||
* |
|||
* @var PHPExcel_Worksheet |
|||
*/ |
|||
private $subject; |
|||
|
|||
/** |
|||
* Current iterator position |
|||
* |
|||
* @var int |
|||
*/ |
|||
private $position = 0; |
|||
|
|||
/** |
|||
* Start position |
|||
* |
|||
* @var int |
|||
*/ |
|||
private $startColumn = 0; |
|||
|
|||
|
|||
/** |
|||
* End position |
|||
* |
|||
* @var int |
|||
*/ |
|||
private $endColumn = 0; |
|||
|
|||
|
|||
/** |
|||
* Create a new column iterator |
|||
* |
|||
* @param PHPExcel_Worksheet $subject The worksheet to iterate over |
|||
* @param string $startColumn The column address at which to start iterating |
|||
* @param string $endColumn Optionally, the column address at which to stop iterating |
|||
*/ |
|||
public function __construct(PHPExcel_Worksheet $subject = null, $startColumn = 'A', $endColumn = null) |
|||
{ |
|||
// Set subject |
|||
$this->subject = $subject; |
|||
$this->resetEnd($endColumn); |
|||
$this->resetStart($startColumn); |
|||
} |
|||
|
|||
/** |
|||
* Destructor |
|||
*/ |
|||
public function __destruct() |
|||
{ |
|||
unset($this->subject); |
|||
} |
|||
|
|||
/** |
|||
* (Re)Set the start column and the current column pointer |
|||
* |
|||
* @param integer $startColumn The column address at which to start iterating |
|||
* @return PHPExcel_Worksheet_ColumnIterator |
|||
* @throws PHPExcel_Exception |
|||
*/ |
|||
public function resetStart($startColumn = 'A') |
|||
{ |
|||
$startColumnIndex = PHPExcel_Cell::columnIndexFromString($startColumn) - 1; |
|||
if ($startColumnIndex > PHPExcel_Cell::columnIndexFromString($this->subject->getHighestColumn()) - 1) { |
|||
throw new PHPExcel_Exception("Start column ({$startColumn}) is beyond highest column ({$this->subject->getHighestColumn()})"); |
|||
} |
|||
|
|||
$this->startColumn = $startColumnIndex; |
|||
if ($this->endColumn < $this->startColumn) { |
|||
$this->endColumn = $this->startColumn; |
|||
} |
|||
$this->seek($startColumn); |
|||
|
|||
return $this; |
|||
} |
|||
|
|||
/** |
|||
* (Re)Set the end column |
|||
* |
|||
* @param string $endColumn The column address at which to stop iterating |
|||
* @return PHPExcel_Worksheet_ColumnIterator |
|||
*/ |
|||
public function resetEnd($endColumn = null) |
|||
{ |
|||
$endColumn = ($endColumn) ? $endColumn : $this->subject->getHighestColumn(); |
|||
$this->endColumn = PHPExcel_Cell::columnIndexFromString($endColumn) - 1; |
|||
|
|||
return $this; |
|||
} |
|||
|
|||
/** |
|||
* Set the column pointer to the selected column |
|||
* |
|||
* @param string $column The column address to set the current pointer at |
|||
* @return PHPExcel_Worksheet_ColumnIterator |
|||
* @throws PHPExcel_Exception |
|||
*/ |
|||
public function seek($column = 'A') |
|||
{ |
|||
$column = PHPExcel_Cell::columnIndexFromString($column) - 1; |
|||
if (($column < $this->startColumn) || ($column > $this->endColumn)) { |
|||
throw new PHPExcel_Exception("Column $column is out of range ({$this->startColumn} - {$this->endColumn})"); |
|||
} |
|||
$this->position = $column; |
|||
|
|||
return $this; |
|||
} |
|||
|
|||
/** |
|||
* Rewind the iterator to the starting column |
|||
*/ |
|||
public function rewind() |
|||
{ |
|||
$this->position = $this->startColumn; |
|||
} |
|||
|
|||
/** |
|||
* Return the current column in this worksheet |
|||
* |
|||
* @return PHPExcel_Worksheet_Column |
|||
*/ |
|||
public function current() |
|||
{ |
|||
return new PHPExcel_Worksheet_Column($this->subject, PHPExcel_Cell::stringFromColumnIndex($this->position)); |
|||
} |
|||
|
|||
/** |
|||
* Return the current iterator key |
|||
* |
|||
* @return string |
|||
*/ |
|||
public function key() |
|||
{ |
|||
return PHPExcel_Cell::stringFromColumnIndex($this->position); |
|||
} |
|||
|
|||
/** |
|||
* Set the iterator to its next value |
|||
*/ |
|||
public function next() |
|||
{ |
|||
++$this->position; |
|||
} |
|||
|
|||
/** |
|||
* Set the iterator to its previous value |
|||
* |
|||
* @throws PHPExcel_Exception |
|||
*/ |
|||
public function prev() |
|||
{ |
|||
if ($this->position <= $this->startColumn) { |
|||
throw new PHPExcel_Exception( |
|||
"Column is already at the beginning of range (" . |
|||
PHPExcel_Cell::stringFromColumnIndex($this->endColumn) . " - " . |
|||
PHPExcel_Cell::stringFromColumnIndex($this->endColumn) . ")" |
|||
); |
|||
} |
|||
|
|||
--$this->position; |
|||
} |
|||
|
|||
/** |
|||
* Indicate if more columns exist in the worksheet range of columns that we're iterating |
|||
* |
|||
* @return boolean |
|||
*/ |
|||
public function valid() |
|||
{ |
|||
return $this->position <= $this->endColumn; |
|||
} |
|||
} |
|||
@ -0,0 +1,178 @@ |
|||
<?php |
|||
|
|||
/** |
|||
* PHPExcel_Worksheet_Dimension |
|||
* |
|||
* Copyright (c) 2006 - 2015 PHPExcel |
|||
* |
|||
* This library is free software; you can redistribute it and/or |
|||
* modify it under the terms of the GNU Lesser General Public |
|||
* License as published by the Free Software Foundation; either |
|||
* version 2.1 of the License, or (at your option) any later version. |
|||
* |
|||
* This library is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|||
* Lesser General Public License for more details. |
|||
* |
|||
* You should have received a copy of the GNU Lesser General Public |
|||
* License along with this library; if not, write to the Free Software |
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|||
* |
|||
* @category PHPExcel |
|||
* @package PHPExcel_Worksheet |
|||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel) |
|||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL |
|||
* @version ##VERSION##, ##DATE## |
|||
*/ |
|||
abstract class PHPExcel_Worksheet_Dimension |
|||
{ |
|||
/** |
|||
* Visible? |
|||
* |
|||
* @var bool |
|||
*/ |
|||
private $visible = true; |
|||
|
|||
/** |
|||
* Outline level |
|||
* |
|||
* @var int |
|||
*/ |
|||
private $outlineLevel = 0; |
|||
|
|||
/** |
|||
* Collapsed |
|||
* |
|||
* @var bool |
|||
*/ |
|||
private $collapsed = false; |
|||
|
|||
/** |
|||
* Index to cellXf. Null value means row has no explicit cellXf format. |
|||
* |
|||
* @var int|null |
|||
*/ |
|||
private $xfIndex; |
|||
|
|||
/** |
|||
* Create a new PHPExcel_Worksheet_Dimension |
|||
* |
|||
* @param int $pIndex Numeric row index |
|||
*/ |
|||
public function __construct($initialValue = null) |
|||
{ |
|||
// set dimension as unformatted by default |
|||
$this->xfIndex = $initialValue; |
|||
} |
|||
|
|||
/** |
|||
* Get Visible |
|||
* |
|||
* @return bool |
|||
*/ |
|||
public function getVisible() |
|||
{ |
|||
return $this->visible; |
|||
} |
|||
|
|||
/** |
|||
* Set Visible |
|||
* |
|||
* @param bool $pValue |
|||
* @return PHPExcel_Worksheet_Dimension |
|||
*/ |
|||
public function setVisible($pValue = true) |
|||
{ |
|||
$this->visible = $pValue; |
|||
return $this; |
|||
} |
|||
|
|||
/** |
|||
* Get Outline Level |
|||
* |
|||
* @return int |
|||
*/ |
|||
public function getOutlineLevel() |
|||
{ |
|||
return $this->outlineLevel; |
|||
} |
|||
|
|||
/** |
|||
* Set Outline Level |
|||
* |
|||
* Value must be between 0 and 7 |
|||
* |
|||
* @param int $pValue |
|||
* @throws PHPExcel_Exception |
|||
* @return PHPExcel_Worksheet_Dimension |
|||
*/ |
|||
public function setOutlineLevel($pValue) |
|||
{ |
|||
if ($pValue < 0 || $pValue > 7) { |
|||
throw new PHPExcel_Exception("Outline level must range between 0 and 7."); |
|||
} |
|||
|
|||
$this->outlineLevel = $pValue; |
|||
return $this; |
|||
} |
|||
|
|||
/** |
|||
* Get Collapsed |
|||
* |
|||
* @return bool |
|||
*/ |
|||
public function getCollapsed() |
|||
{ |
|||
return $this->collapsed; |
|||
} |
|||
|
|||
/** |
|||
* Set Collapsed |
|||
* |
|||
* @param bool $pValue |
|||
* @return PHPExcel_Worksheet_Dimension |
|||
*/ |
|||
public function setCollapsed($pValue = true) |
|||
{ |
|||
$this->collapsed = $pValue; |
|||
return $this; |
|||
} |
|||
|
|||
/** |
|||
* Get index to cellXf |
|||
* |
|||
* @return int |
|||
*/ |
|||
public function getXfIndex() |
|||
{ |
|||
return $this->xfIndex; |
|||
} |
|||
|
|||
/** |
|||
* Set index to cellXf |
|||
* |
|||
* @param int $pValue |
|||
* @return PHPExcel_Worksheet_Dimension |
|||
*/ |
|||
public function setXfIndex($pValue = 0) |
|||
{ |
|||
$this->xfIndex = $pValue; |
|||
return $this; |
|||
} |
|||
|
|||
/** |
|||
* Implement PHP __clone to create a deep clone, not just a shallow copy. |
|||
*/ |
|||
public function __clone() |
|||
{ |
|||
$vars = get_object_vars($this); |
|||
foreach ($vars as $key => $value) { |
|||
if (is_object($value)) { |
|||
$this->$key = clone $value; |
|||
} else { |
|||
$this->$key = $value; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,313 @@ |
|||
<?php |
|||
/** |
|||
* PHPExcel |
|||
* |
|||
* Copyright (c) 2006 - 2013 PHPExcel |
|||
* |
|||
* This library is free software; you can redistribute it and/or |
|||
* modify it under the terms of the GNU Lesser General Public |
|||
* License as published by the Free Software Foundation; either |
|||
* version 2.1 of the License, or (at your option) any later version. |
|||
* |
|||
* This library is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|||
* Lesser General Public License for more details. |
|||
* |
|||
* You should have received a copy of the GNU Lesser General Public |
|||
* License along with this library; if not, write to the Free Software |
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|||
* |
|||
* @category PHPExcel |
|||
* @package PHPExcel_Writer_CSV |
|||
* @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) |
|||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL |
|||
* @version 1.7.9, 2013-06-02 |
|||
*/ |
|||
|
|||
|
|||
/** |
|||
* PHPExcel_Writer_CSV |
|||
* |
|||
* @category PHPExcel |
|||
* @package PHPExcel_Writer_CSV |
|||
* @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) |
|||
*/ |
|||
class PHPExcel_Writer_CSV extends PHPExcel_Writer_Abstract implements PHPExcel_Writer_IWriter { |
|||
/** |
|||
* PHPExcel object |
|||
* |
|||
* @var PHPExcel |
|||
*/ |
|||
private $_phpExcel; |
|||
|
|||
/** |
|||
* Delimiter |
|||
* |
|||
* @var string |
|||
*/ |
|||
private $_delimiter = ','; |
|||
|
|||
/** |
|||
* Enclosure |
|||
* |
|||
* @var string |
|||
*/ |
|||
private $_enclosure = '"'; |
|||
|
|||
/** |
|||
* Line ending |
|||
* |
|||
* @var string |
|||
*/ |
|||
private $_lineEnding = PHP_EOL; |
|||
|
|||
/** |
|||
* Sheet index to write |
|||
* |
|||
* @var int |
|||
*/ |
|||
private $_sheetIndex = 0; |
|||
|
|||
/** |
|||
* Whether to write a BOM (for UTF8). |
|||
* |
|||
* @var boolean |
|||
*/ |
|||
private $_useBOM = false; |
|||
|
|||
/** |
|||
* Whether to write a fully Excel compatible CSV file. |
|||
* |
|||
* @var boolean |
|||
*/ |
|||
private $_excelCompatibility = false; |
|||
|
|||
/** |
|||
* Create a new PHPExcel_Writer_CSV |
|||
* |
|||
* @param PHPExcel $phpExcel PHPExcel object |
|||
*/ |
|||
public function __construct(PHPExcel $phpExcel) { |
|||
$this->_phpExcel = $phpExcel; |
|||
} |
|||
|
|||
/** |
|||
* Save PHPExcel to file |
|||
* |
|||
* @param string $pFilename |
|||
* @throws PHPExcel_Writer_Exception |
|||
*/ |
|||
public function save($pFilename = null) { |
|||
// Fetch sheet |
|||
$sheet = $this->_phpExcel->getSheet($this->_sheetIndex); |
|||
|
|||
$saveDebugLog = PHPExcel_Calculation::getInstance($this->_phpExcel)->getDebugLog()->getWriteDebugLog(); |
|||
PHPExcel_Calculation::getInstance($this->_phpExcel)->getDebugLog()->setWriteDebugLog(FALSE); |
|||
$saveArrayReturnType = PHPExcel_Calculation::getArrayReturnType(); |
|||
PHPExcel_Calculation::setArrayReturnType(PHPExcel_Calculation::RETURN_ARRAY_AS_VALUE); |
|||
|
|||
// Open file |
|||
$fileHandle = fopen($pFilename, 'wb+'); |
|||
if ($fileHandle === false) { |
|||
throw new PHPExcel_Writer_Exception("Could not open file $pFilename for writing."); |
|||
} |
|||
|
|||
if ($this->_excelCompatibility) { |
|||
// Write the UTF-16LE BOM code |
|||
fwrite($fileHandle, "\xFF\xFE"); // Excel uses UTF-16LE encoding |
|||
$this->setEnclosure(); // Default enclosure is " |
|||
$this->setDelimiter("\t"); // Excel delimiter is a TAB |
|||
} elseif ($this->_useBOM) { |
|||
// Write the UTF-8 BOM code |
|||
fwrite($fileHandle, "\xEF\xBB\xBF"); |
|||
} |
|||
|
|||
// Identify the range that we need to extract from the worksheet |
|||
$maxCol = $sheet->getHighestColumn(); |
|||
$maxRow = $sheet->getHighestRow(); |
|||
|
|||
// Write rows to file |
|||
for($row = 1; $row <= $maxRow; ++$row) { |
|||
// Convert the row to an array... |
|||
$cellsArray = $sheet->rangeToArray('A'.$row.':'.$maxCol.$row,'', $this->_preCalculateFormulas); |
|||
// ... and write to the file |
|||
$this->_writeLine($fileHandle, $cellsArray[0]); |
|||
} |
|||
|
|||
// Close file |
|||
fclose($fileHandle); |
|||
|
|||
PHPExcel_Calculation::setArrayReturnType($saveArrayReturnType); |
|||
PHPExcel_Calculation::getInstance($this->_phpExcel)->getDebugLog()->setWriteDebugLog($saveDebugLog); |
|||
} |
|||
|
|||
/** |
|||
* Get delimiter |
|||
* |
|||
* @return string |
|||
*/ |
|||
public function getDelimiter() { |
|||
return $this->_delimiter; |
|||
} |
|||
|
|||
/** |
|||
* Set delimiter |
|||
* |
|||
* @param string $pValue Delimiter, defaults to , |
|||
* @return PHPExcel_Writer_CSV |
|||
*/ |
|||
public function setDelimiter($pValue = ',') { |
|||
$this->_delimiter = $pValue; |
|||
return $this; |
|||
} |
|||
|
|||
/** |
|||
* Get enclosure |
|||
* |
|||
* @return string |
|||
*/ |
|||
public function getEnclosure() { |
|||
return $this->_enclosure; |
|||
} |
|||
|
|||
/** |
|||
* Set enclosure |
|||
* |
|||
* @param string $pValue Enclosure, defaults to " |
|||
* @return PHPExcel_Writer_CSV |
|||
*/ |
|||
public function setEnclosure($pValue = '"') { |
|||
if ($pValue == '') { |
|||
$pValue = null; |
|||
} |
|||
$this->_enclosure = $pValue; |
|||
return $this; |
|||
} |
|||
|
|||
/** |
|||
* Get line ending |
|||
* |
|||
* @return string |
|||
*/ |
|||
public function getLineEnding() { |
|||
return $this->_lineEnding; |
|||
} |
|||
|
|||
/** |
|||
* Set line ending |
|||
* |
|||
* @param string $pValue Line ending, defaults to OS line ending (PHP_EOL) |
|||
* @return PHPExcel_Writer_CSV |
|||
*/ |
|||
public function setLineEnding($pValue = PHP_EOL) { |
|||
$this->_lineEnding = $pValue; |
|||
return $this; |
|||
} |
|||
|
|||
/** |
|||
* Get whether BOM should be used |
|||
* |
|||
* @return boolean |
|||
*/ |
|||
public function getUseBOM() { |
|||
return $this->_useBOM; |
|||
} |
|||
|
|||
/** |
|||
* Set whether BOM should be used |
|||
* |
|||
* @param boolean $pValue Use UTF-8 byte-order mark? Defaults to false |
|||
* @return PHPExcel_Writer_CSV |
|||
*/ |
|||
public function setUseBOM($pValue = false) { |
|||
$this->_useBOM = $pValue; |
|||
return $this; |
|||
} |
|||
|
|||
/** |
|||
* Get whether the file should be saved with full Excel Compatibility |
|||
* |
|||
* @return boolean |
|||
*/ |
|||
public function getExcelCompatibility() { |
|||
return $this->_excelCompatibility; |
|||
} |
|||
|
|||
/** |
|||
* Set whether the file should be saved with full Excel Compatibility |
|||
* |
|||
* @param boolean $pValue Set the file to be written as a fully Excel compatible csv file |
|||
* Note that this overrides other settings such as useBOM, enclosure and delimiter |
|||
* @return PHPExcel_Writer_CSV |
|||
*/ |
|||
public function setExcelCompatibility($pValue = false) { |
|||
$this->_excelCompatibility = $pValue; |
|||
return $this; |
|||
} |
|||
|
|||
/** |
|||
* Get sheet index |
|||
* |
|||
* @return int |
|||
*/ |
|||
public function getSheetIndex() { |
|||
return $this->_sheetIndex; |
|||
} |
|||
|
|||
/** |
|||
* Set sheet index |
|||
* |
|||
* @param int $pValue Sheet index |
|||
* @return PHPExcel_Writer_CSV |
|||
*/ |
|||
public function setSheetIndex($pValue = 0) { |
|||
$this->_sheetIndex = $pValue; |
|||
return $this; |
|||
} |
|||
|
|||
/** |
|||
* Write line to CSV file |
|||
* |
|||
* @param mixed $pFileHandle PHP filehandle |
|||
* @param array $pValues Array containing values in a row |
|||
* @throws PHPExcel_Writer_Exception |
|||
*/ |
|||
private function _writeLine($pFileHandle = null, $pValues = null) { |
|||
if (is_array($pValues)) { |
|||
// No leading delimiter |
|||
$writeDelimiter = false; |
|||
|
|||
// Build the line |
|||
$line = ''; |
|||
|
|||
foreach ($pValues as $element) { |
|||
// Escape enclosures |
|||
$element = str_replace($this->_enclosure, $this->_enclosure . $this->_enclosure, $element); |
|||
|
|||
// Add delimiter |
|||
if ($writeDelimiter) { |
|||
$line .= $this->_delimiter; |
|||
} else { |
|||
$writeDelimiter = true; |
|||
} |
|||
|
|||
// Add enclosed string |
|||
$line .= $this->_enclosure . $element . $this->_enclosure; |
|||
} |
|||
|
|||
// Add line ending |
|||
$line .= $this->_lineEnding; |
|||
|
|||
// Write to file |
|||
if ($this->_excelCompatibility) { |
|||
fwrite($pFileHandle, mb_convert_encoding($line,"UTF-16LE","UTF-8")); |
|||
} else { |
|||
fwrite($pFileHandle, $line); |
|||
} |
|||
} else { |
|||
throw new PHPExcel_Writer_Exception("Invalid data row passed to CSV writer."); |
|||
} |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,268 @@ |
|||
<?php |
|||
/** |
|||
* PHPExcel |
|||
* |
|||
* Copyright (c) 2006 - 2013 PHPExcel |
|||
* |
|||
* This library is free software; you can redistribute it and/or |
|||
* modify it under the terms of the GNU Lesser General Public |
|||
* License as published by the Free Software Foundation; either |
|||
* version 2.1 of the License, or (at your option) any later version. |
|||
* |
|||
* This library is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|||
* Lesser General Public License for more details. |
|||
* |
|||
* You should have received a copy of the GNU Lesser General Public |
|||
* License along with this library; if not, write to the Free Software |
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|||
* |
|||
* @category PHPExcel |
|||
* @package PHPExcel_Writer_Excel2007 |
|||
* @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) |
|||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL |
|||
* @version 1.7.9, 2013-06-02 |
|||
*/ |
|||
|
|||
|
|||
/** |
|||
* PHPExcel_Writer_Excel2007_Comments |
|||
* |
|||
* @category PHPExcel |
|||
* @package PHPExcel_Writer_Excel2007 |
|||
* @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) |
|||
*/ |
|||
class PHPExcel_Writer_Excel2007_Comments extends PHPExcel_Writer_Excel2007_WriterPart |
|||
{ |
|||
/** |
|||
* Write comments to XML format |
|||
* |
|||
* @param PHPExcel_Worksheet $pWorksheet |
|||
* @return string XML Output |
|||
* @throws PHPExcel_Writer_Exception |
|||
*/ |
|||
public function writeComments(PHPExcel_Worksheet $pWorksheet = null) |
|||
{ |
|||
// Create XML writer |
|||
$objWriter = null; |
|||
if ($this->getParentWriter()->getUseDiskCaching()) { |
|||
$objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); |
|||
} else { |
|||
$objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_MEMORY); |
|||
} |
|||
|
|||
// XML header |
|||
$objWriter->startDocument('1.0','UTF-8','yes'); |
|||
|
|||
// Comments cache |
|||
$comments = $pWorksheet->getComments(); |
|||
|
|||
// Authors cache |
|||
$authors = array(); |
|||
$authorId = 0; |
|||
foreach ($comments as $comment) { |
|||
if (!isset($authors[$comment->getAuthor()])) { |
|||
$authors[$comment->getAuthor()] = $authorId++; |
|||
} |
|||
} |
|||
|
|||
// comments |
|||
$objWriter->startElement('comments'); |
|||
$objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/spreadsheetml/2006/main'); |
|||
|
|||
// Loop through authors |
|||
$objWriter->startElement('authors'); |
|||
foreach ($authors as $author => $index) { |
|||
$objWriter->writeElement('author', $author); |
|||
} |
|||
$objWriter->endElement(); |
|||
|
|||
// Loop through comments |
|||
$objWriter->startElement('commentList'); |
|||
foreach ($comments as $key => $value) { |
|||
$this->_writeComment($objWriter, $key, $value, $authors); |
|||
} |
|||
$objWriter->endElement(); |
|||
|
|||
$objWriter->endElement(); |
|||
|
|||
// Return |
|||
return $objWriter->getData(); |
|||
} |
|||
|
|||
/** |
|||
* Write comment to XML format |
|||
* |
|||
* @param PHPExcel_Shared_XMLWriter $objWriter XML Writer |
|||
* @param string $pCellReference Cell reference |
|||
* @param PHPExcel_Comment $pComment Comment |
|||
* @param array $pAuthors Array of authors |
|||
* @throws PHPExcel_Writer_Exception |
|||
*/ |
|||
public function _writeComment(PHPExcel_Shared_XMLWriter $objWriter = null, $pCellReference = 'A1', PHPExcel_Comment $pComment = null, $pAuthors = null) |
|||
{ |
|||
// comment |
|||
$objWriter->startElement('comment'); |
|||
$objWriter->writeAttribute('ref', $pCellReference); |
|||
$objWriter->writeAttribute('authorId', $pAuthors[$pComment->getAuthor()]); |
|||
|
|||
// text |
|||
$objWriter->startElement('text'); |
|||
$this->getParentWriter()->getWriterPart('stringtable')->writeRichText($objWriter, $pComment->getText()); |
|||
$objWriter->endElement(); |
|||
|
|||
$objWriter->endElement(); |
|||
} |
|||
|
|||
/** |
|||
* Write VML comments to XML format |
|||
* |
|||
* @param PHPExcel_Worksheet $pWorksheet |
|||
* @return string XML Output |
|||
* @throws PHPExcel_Writer_Exception |
|||
*/ |
|||
public function writeVMLComments(PHPExcel_Worksheet $pWorksheet = null) |
|||
{ |
|||
// Create XML writer |
|||
$objWriter = null; |
|||
if ($this->getParentWriter()->getUseDiskCaching()) { |
|||
$objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); |
|||
} else { |
|||
$objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_MEMORY); |
|||
} |
|||
|
|||
// XML header |
|||
$objWriter->startDocument('1.0','UTF-8','yes'); |
|||
|
|||
// Comments cache |
|||
$comments = $pWorksheet->getComments(); |
|||
|
|||
// xml |
|||
$objWriter->startElement('xml'); |
|||
$objWriter->writeAttribute('xmlns:v', 'urn:schemas-microsoft-com:vml'); |
|||
$objWriter->writeAttribute('xmlns:o', 'urn:schemas-microsoft-com:office:office'); |
|||
$objWriter->writeAttribute('xmlns:x', 'urn:schemas-microsoft-com:office:excel'); |
|||
|
|||
// o:shapelayout |
|||
$objWriter->startElement('o:shapelayout'); |
|||
$objWriter->writeAttribute('v:ext', 'edit'); |
|||
|
|||
// o:idmap |
|||
$objWriter->startElement('o:idmap'); |
|||
$objWriter->writeAttribute('v:ext', 'edit'); |
|||
$objWriter->writeAttribute('data', '1'); |
|||
$objWriter->endElement(); |
|||
|
|||
$objWriter->endElement(); |
|||
|
|||
// v:shapetype |
|||
$objWriter->startElement('v:shapetype'); |
|||
$objWriter->writeAttribute('id', '_x0000_t202'); |
|||
$objWriter->writeAttribute('coordsize', '21600,21600'); |
|||
$objWriter->writeAttribute('o:spt', '202'); |
|||
$objWriter->writeAttribute('path', 'm,l,21600r21600,l21600,xe'); |
|||
|
|||
// v:stroke |
|||
$objWriter->startElement('v:stroke'); |
|||
$objWriter->writeAttribute('joinstyle', 'miter'); |
|||
$objWriter->endElement(); |
|||
|
|||
// v:path |
|||
$objWriter->startElement('v:path'); |
|||
$objWriter->writeAttribute('gradientshapeok', 't'); |
|||
$objWriter->writeAttribute('o:connecttype', 'rect'); |
|||
$objWriter->endElement(); |
|||
|
|||
$objWriter->endElement(); |
|||
|
|||
// Loop through comments |
|||
foreach ($comments as $key => $value) { |
|||
$this->_writeVMLComment($objWriter, $key, $value); |
|||
} |
|||
|
|||
$objWriter->endElement(); |
|||
|
|||
// Return |
|||
return $objWriter->getData(); |
|||
} |
|||
|
|||
/** |
|||
* Write VML comment to XML format |
|||
* |
|||
* @param PHPExcel_Shared_XMLWriter $objWriter XML Writer |
|||
* @param string $pCellReference Cell reference |
|||
* @param PHPExcel_Comment $pComment Comment |
|||
* @throws PHPExcel_Writer_Exception |
|||
*/ |
|||
public function _writeVMLComment(PHPExcel_Shared_XMLWriter $objWriter = null, $pCellReference = 'A1', PHPExcel_Comment $pComment = null) |
|||
{ |
|||
// Metadata |
|||
list($column, $row) = PHPExcel_Cell::coordinateFromString($pCellReference); |
|||
$column = PHPExcel_Cell::columnIndexFromString($column); |
|||
$id = 1024 + $column + $row; |
|||
$id = substr($id, 0, 4); |
|||
|
|||
// v:shape |
|||
$objWriter->startElement('v:shape'); |
|||
$objWriter->writeAttribute('id', '_x0000_s' . $id); |
|||
$objWriter->writeAttribute('type', '#_x0000_t202'); |
|||
$objWriter->writeAttribute('style', 'position:absolute;margin-left:' . $pComment->getMarginLeft() . ';margin-top:' . $pComment->getMarginTop() . ';width:' . $pComment->getWidth() . ';height:' . $pComment->getHeight() . ';z-index:1;visibility:' . ($pComment->getVisible() ? 'visible' : 'hidden')); |
|||
$objWriter->writeAttribute('fillcolor', '#' . $pComment->getFillColor()->getRGB()); |
|||
$objWriter->writeAttribute('o:insetmode', 'auto'); |
|||
|
|||
// v:fill |
|||
$objWriter->startElement('v:fill'); |
|||
$objWriter->writeAttribute('color2', '#' . $pComment->getFillColor()->getRGB()); |
|||
$objWriter->endElement(); |
|||
|
|||
// v:shadow |
|||
$objWriter->startElement('v:shadow'); |
|||
$objWriter->writeAttribute('on', 't'); |
|||
$objWriter->writeAttribute('color', 'black'); |
|||
$objWriter->writeAttribute('obscured', 't'); |
|||
$objWriter->endElement(); |
|||
|
|||
// v:path |
|||
$objWriter->startElement('v:path'); |
|||
$objWriter->writeAttribute('o:connecttype', 'none'); |
|||
$objWriter->endElement(); |
|||
|
|||
// v:textbox |
|||
$objWriter->startElement('v:textbox'); |
|||
$objWriter->writeAttribute('style', 'mso-direction-alt:auto'); |
|||
|
|||
// div |
|||
$objWriter->startElement('div'); |
|||
$objWriter->writeAttribute('style', 'text-align:left'); |
|||
$objWriter->endElement(); |
|||
|
|||
$objWriter->endElement(); |
|||
|
|||
// x:ClientData |
|||
$objWriter->startElement('x:ClientData'); |
|||
$objWriter->writeAttribute('ObjectType', 'Note'); |
|||
|
|||
// x:MoveWithCells |
|||
$objWriter->writeElement('x:MoveWithCells', ''); |
|||
|
|||
// x:SizeWithCells |
|||
$objWriter->writeElement('x:SizeWithCells', ''); |
|||
|
|||
// x:Anchor |
|||
//$objWriter->writeElement('x:Anchor', $column . ', 15, ' . ($row - 2) . ', 10, ' . ($column + 4) . ', 15, ' . ($row + 5) . ', 18'); |
|||
|
|||
// x:AutoFill |
|||
$objWriter->writeElement('x:AutoFill', 'False'); |
|||
|
|||
// x:Row |
|||
$objWriter->writeElement('x:Row', ($row - 1)); |
|||
|
|||
// x:Column |
|||
$objWriter->writeElement('x:Column', ($column - 1)); |
|||
|
|||
$objWriter->endElement(); |
|||
|
|||
$objWriter->endElement(); |
|||
} |
|||
} |
|||
@ -0,0 +1,261 @@ |
|||
<?php |
|||
/** |
|||
* PHPExcel |
|||
* |
|||
* Copyright (c) 2006 - 2013 PHPExcel |
|||
* |
|||
* This library is free software; you can redistribute it and/or |
|||
* modify it under the terms of the GNU Lesser General Public |
|||
* License as published by the Free Software Foundation; either |
|||
* version 2.1 of the License, or (at your option) any later version. |
|||
* |
|||
* This library is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|||
* Lesser General Public License for more details. |
|||
* |
|||
* You should have received a copy of the GNU Lesser General Public |
|||
* License along with this library; if not, write to the Free Software |
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|||
* |
|||
* @category PHPExcel |
|||
* @package PHPExcel_Writer_Excel2007 |
|||
* @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) |
|||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL |
|||
* @version 1.7.9, 2013-06-02 |
|||
*/ |
|||
|
|||
|
|||
/** |
|||
* PHPExcel_Writer_Excel2007_ContentTypes |
|||
* |
|||
* @category PHPExcel |
|||
* @package PHPExcel_Writer_Excel2007 |
|||
* @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) |
|||
*/ |
|||
class PHPExcel_Writer_Excel2007_ContentTypes extends PHPExcel_Writer_Excel2007_WriterPart |
|||
{ |
|||
/** |
|||
* Write content types to XML format |
|||
* |
|||
* @param PHPExcel $pPHPExcel |
|||
* @param boolean $includeCharts Flag indicating if we should include drawing details for charts |
|||
* @return string XML Output |
|||
* @throws PHPExcel_Writer_Exception |
|||
*/ |
|||
public function writeContentTypes(PHPExcel $pPHPExcel = null, $includeCharts = FALSE) |
|||
{ |
|||
// Create XML writer |
|||
$objWriter = null; |
|||
if ($this->getParentWriter()->getUseDiskCaching()) { |
|||
$objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); |
|||
} else { |
|||
$objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_MEMORY); |
|||
} |
|||
|
|||
// XML header |
|||
$objWriter->startDocument('1.0','UTF-8','yes'); |
|||
|
|||
// Types |
|||
$objWriter->startElement('Types'); |
|||
$objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/package/2006/content-types'); |
|||
|
|||
// Theme |
|||
$this->_writeOverrideContentType( |
|||
$objWriter, '/xl/theme/theme1.xml', 'application/vnd.openxmlformats-officedocument.theme+xml' |
|||
); |
|||
|
|||
// Styles |
|||
$this->_writeOverrideContentType( |
|||
$objWriter, '/xl/styles.xml', 'application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml' |
|||
); |
|||
|
|||
// Rels |
|||
$this->_writeDefaultContentType( |
|||
$objWriter, 'rels', 'application/vnd.openxmlformats-package.relationships+xml' |
|||
); |
|||
|
|||
// XML |
|||
$this->_writeDefaultContentType( |
|||
$objWriter, 'xml', 'application/xml' |
|||
); |
|||
|
|||
// VML |
|||
$this->_writeDefaultContentType( |
|||
$objWriter, 'vml', 'application/vnd.openxmlformats-officedocument.vmlDrawing' |
|||
); |
|||
|
|||
// Workbook |
|||
$this->_writeOverrideContentType( |
|||
$objWriter, '/xl/workbook.xml', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml' |
|||
); |
|||
|
|||
// DocProps |
|||
$this->_writeOverrideContentType( |
|||
$objWriter, '/docProps/app.xml', 'application/vnd.openxmlformats-officedocument.extended-properties+xml' |
|||
); |
|||
|
|||
$this->_writeOverrideContentType( |
|||
$objWriter, '/docProps/core.xml', 'application/vnd.openxmlformats-package.core-properties+xml' |
|||
); |
|||
|
|||
$customPropertyList = $pPHPExcel->getProperties()->getCustomProperties(); |
|||
if (!empty($customPropertyList)) { |
|||
$this->_writeOverrideContentType( |
|||
$objWriter, '/docProps/custom.xml', 'application/vnd.openxmlformats-officedocument.custom-properties+xml' |
|||
); |
|||
} |
|||
|
|||
// Worksheets |
|||
$sheetCount = $pPHPExcel->getSheetCount(); |
|||
for ($i = 0; $i < $sheetCount; ++$i) { |
|||
$this->_writeOverrideContentType( |
|||
$objWriter, '/xl/worksheets/sheet' . ($i + 1) . '.xml', 'application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml' |
|||
); |
|||
} |
|||
|
|||
// Shared strings |
|||
$this->_writeOverrideContentType( |
|||
$objWriter, '/xl/sharedStrings.xml', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml' |
|||
); |
|||
|
|||
// Add worksheet relationship content types |
|||
$chart = 1; |
|||
for ($i = 0; $i < $sheetCount; ++$i) { |
|||
$drawings = $pPHPExcel->getSheet($i)->getDrawingCollection(); |
|||
$drawingCount = count($drawings); |
|||
$chartCount = ($includeCharts) ? $pPHPExcel->getSheet($i)->getChartCount() : 0; |
|||
|
|||
// We need a drawing relationship for the worksheet if we have either drawings or charts |
|||
if (($drawingCount > 0) || ($chartCount > 0)) { |
|||
$this->_writeOverrideContentType( |
|||
$objWriter, '/xl/drawings/drawing' . ($i + 1) . '.xml', 'application/vnd.openxmlformats-officedocument.drawing+xml' |
|||
); |
|||
} |
|||
|
|||
// If we have charts, then we need a chart relationship for every individual chart |
|||
if ($chartCount > 0) { |
|||
for ($c = 0; $c < $chartCount; ++$c) { |
|||
$this->_writeOverrideContentType( |
|||
$objWriter, '/xl/charts/chart' . $chart++ . '.xml', 'application/vnd.openxmlformats-officedocument.drawingml.chart+xml' |
|||
); |
|||
} |
|||
} |
|||
} |
|||
|
|||
// Comments |
|||
for ($i = 0; $i < $sheetCount; ++$i) { |
|||
if (count($pPHPExcel->getSheet($i)->getComments()) > 0) { |
|||
$this->_writeOverrideContentType( |
|||
$objWriter, '/xl/comments' . ($i + 1) . '.xml', 'application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml' |
|||
); |
|||
} |
|||
} |
|||
|
|||
// Add media content-types |
|||
$aMediaContentTypes = array(); |
|||
$mediaCount = $this->getParentWriter()->getDrawingHashTable()->count(); |
|||
for ($i = 0; $i < $mediaCount; ++$i) { |
|||
$extension = ''; |
|||
$mimeType = ''; |
|||
|
|||
if ($this->getParentWriter()->getDrawingHashTable()->getByIndex($i) instanceof PHPExcel_Worksheet_Drawing) { |
|||
$extension = strtolower($this->getParentWriter()->getDrawingHashTable()->getByIndex($i)->getExtension()); |
|||
$mimeType = $this->_getImageMimeType( $this->getParentWriter()->getDrawingHashTable()->getByIndex($i)->getPath() ); |
|||
} else if ($this->getParentWriter()->getDrawingHashTable()->getByIndex($i) instanceof PHPExcel_Worksheet_MemoryDrawing) { |
|||
$extension = strtolower($this->getParentWriter()->getDrawingHashTable()->getByIndex($i)->getMimeType()); |
|||
$extension = explode('/', $extension); |
|||
$extension = $extension[1]; |
|||
|
|||
$mimeType = $this->getParentWriter()->getDrawingHashTable()->getByIndex($i)->getMimeType(); |
|||
} |
|||
|
|||
if (!isset( $aMediaContentTypes[$extension]) ) { |
|||
$aMediaContentTypes[$extension] = $mimeType; |
|||
|
|||
$this->_writeDefaultContentType( |
|||
$objWriter, $extension, $mimeType |
|||
); |
|||
} |
|||
} |
|||
|
|||
$sheetCount = $pPHPExcel->getSheetCount(); |
|||
for ($i = 0; $i < $sheetCount; ++$i) { |
|||
if (count($pPHPExcel->getSheet()->getHeaderFooter()->getImages()) > 0) { |
|||
foreach ($pPHPExcel->getSheet()->getHeaderFooter()->getImages() as $image) { |
|||
if (!isset( $aMediaContentTypes[strtolower($image->getExtension())]) ) { |
|||
$aMediaContentTypes[strtolower($image->getExtension())] = $this->_getImageMimeType( $image->getPath() ); |
|||
|
|||
$this->_writeDefaultContentType( |
|||
$objWriter, strtolower($image->getExtension()), $aMediaContentTypes[strtolower($image->getExtension())] |
|||
); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
$objWriter->endElement(); |
|||
|
|||
// Return |
|||
return $objWriter->getData(); |
|||
} |
|||
|
|||
/** |
|||
* Get image mime type |
|||
* |
|||
* @param string $pFile Filename |
|||
* @return string Mime Type |
|||
* @throws PHPExcel_Writer_Exception |
|||
*/ |
|||
private function _getImageMimeType($pFile = '') |
|||
{ |
|||
if (PHPExcel_Shared_File::file_exists($pFile)) { |
|||
$image = getimagesize($pFile); |
|||
return image_type_to_mime_type($image[2]); |
|||
} else { |
|||
throw new PHPExcel_Writer_Exception("File $pFile does not exist"); |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* Write Default content type |
|||
* |
|||
* @param PHPExcel_Shared_XMLWriter $objWriter XML Writer |
|||
* @param string $pPartname Part name |
|||
* @param string $pContentType Content type |
|||
* @throws PHPExcel_Writer_Exception |
|||
*/ |
|||
private function _writeDefaultContentType(PHPExcel_Shared_XMLWriter $objWriter = null, $pPartname = '', $pContentType = '') |
|||
{ |
|||
if ($pPartname != '' && $pContentType != '') { |
|||
// Write content type |
|||
$objWriter->startElement('Default'); |
|||
$objWriter->writeAttribute('Extension', $pPartname); |
|||
$objWriter->writeAttribute('ContentType', $pContentType); |
|||
$objWriter->endElement(); |
|||
} else { |
|||
throw new PHPExcel_Writer_Exception("Invalid parameters passed."); |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* Write Override content type |
|||
* |
|||
* @param PHPExcel_Shared_XMLWriter $objWriter XML Writer |
|||
* @param string $pPartname Part name |
|||
* @param string $pContentType Content type |
|||
* @throws PHPExcel_Writer_Exception |
|||
*/ |
|||
private function _writeOverrideContentType(PHPExcel_Shared_XMLWriter $objWriter = null, $pPartname = '', $pContentType = '') |
|||
{ |
|||
if ($pPartname != '' && $pContentType != '') { |
|||
// Write content type |
|||
$objWriter->startElement('Override'); |
|||
$objWriter->writeAttribute('PartName', $pPartname); |
|||
$objWriter->writeAttribute('ContentType', $pContentType); |
|||
$objWriter->endElement(); |
|||
} else { |
|||
throw new PHPExcel_Writer_Exception("Invalid parameters passed."); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,63 @@ |
|||
<?php |
|||
/** |
|||
* PHPExcel |
|||
* |
|||
* Copyright (c) 2006 - 2015 PHPExcel |
|||
* |
|||
* This library is free software; you can redistribute it and/or |
|||
* modify it under the terms of the GNU Lesser General Public |
|||
* License as published by the Free Software Foundation; either |
|||
* version 2.1 of the License, or (at your option) any later version. |
|||
* |
|||
* This library is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|||
* Lesser General Public License for more details. |
|||
* |
|||
* You should have received a copy of the GNU Lesser General Public |
|||
* License along with this library; if not, write to the Free Software |
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|||
* |
|||
* @category PHPExcel |
|||
* @package PHPExcel_Writer_OpenDocument |
|||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel) |
|||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL |
|||
* @version ##VERSION##, ##DATE## |
|||
*/ |
|||
|
|||
|
|||
/** |
|||
* PHPExcel_Writer_OpenDocument_Cell_Comment |
|||
* |
|||
* @category PHPExcel |
|||
* @package PHPExcel_Writer_OpenDocument |
|||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel) |
|||
* @author Alexander Pervakov <frost-nzcr4@jagmort.com> |
|||
*/ |
|||
class PHPExcel_Writer_OpenDocument_Cell_Comment |
|||
{ |
|||
public static function write(PHPExcel_Shared_XMLWriter $objWriter, PHPExcel_Cell $cell) |
|||
{ |
|||
$comments = $cell->getWorksheet()->getComments(); |
|||
if (!isset($comments[$cell->getCoordinate()])) { |
|||
return; |
|||
} |
|||
$comment = $comments[$cell->getCoordinate()]; |
|||
|
|||
$objWriter->startElement('office:annotation'); |
|||
//$objWriter->writeAttribute('draw:style-name', 'gr1'); |
|||
//$objWriter->writeAttribute('draw:text-style-name', 'P1'); |
|||
$objWriter->writeAttribute('svg:width', $comment->getWidth()); |
|||
$objWriter->writeAttribute('svg:height', $comment->getHeight()); |
|||
$objWriter->writeAttribute('svg:x', $comment->getMarginLeft()); |
|||
$objWriter->writeAttribute('svg:y', $comment->getMarginTop()); |
|||
//$objWriter->writeAttribute('draw:caption-point-x', $comment->getMarginLeft()); |
|||
//$objWriter->writeAttribute('draw:caption-point-y', $comment->getMarginTop()); |
|||
$objWriter->writeElement('dc:creator', $comment->getAuthor()); |
|||
// TODO: Not realized in PHPExcel_Comment yet. |
|||
//$objWriter->writeElement('dc:date', $comment->getDate()); |
|||
$objWriter->writeElement('text:p', $comment->getText()->getPlainText()); |
|||
//$objWriter->writeAttribute('draw:text-style-name', 'P1'); |
|||
$objWriter->endElement(); |
|||
} |
|||
} |
|||
@ -0,0 +1,272 @@ |
|||
<?php |
|||
/** |
|||
* PHPExcel |
|||
* |
|||
* Copyright (c) 2006 - 2015 PHPExcel |
|||
* |
|||
* This library is free software; you can redistribute it and/or |
|||
* modify it under the terms of the GNU Lesser General Public |
|||
* License as published by the Free Software Foundation; either |
|||
* version 2.1 of the License, or (at your option) any later version. |
|||
* |
|||
* This library is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|||
* Lesser General Public License for more details. |
|||
* |
|||
* You should have received a copy of the GNU Lesser General Public |
|||
* License along with this library; if not, write to the Free Software |
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|||
* |
|||
* @category PHPExcel |
|||
* @package PHPExcel_Writer_OpenDocument |
|||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel) |
|||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL |
|||
* @version ##VERSION##, ##DATE## |
|||
*/ |
|||
|
|||
|
|||
/** |
|||
* PHPExcel_Writer_OpenDocument_Content |
|||
* |
|||
* @category PHPExcel |
|||
* @package PHPExcel_Writer_OpenDocument |
|||
* @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel) |
|||
* @author Alexander Pervakov <frost-nzcr4@jagmort.com> |
|||
*/ |
|||
class PHPExcel_Writer_OpenDocument_Content extends PHPExcel_Writer_OpenDocument_WriterPart |
|||
{ |
|||
const NUMBER_COLS_REPEATED_MAX = 1024; |
|||
const NUMBER_ROWS_REPEATED_MAX = 1048576; |
|||
|
|||
/** |
|||
* Write content.xml to XML format |
|||
* |
|||
* @param PHPExcel $pPHPExcel |
|||
* @return string XML Output |
|||
* @throws PHPExcel_Writer_Exception |
|||
*/ |
|||
public function write(PHPExcel $pPHPExcel = null) |
|||
{ |
|||
if (!$pPHPExcel) { |
|||
$pPHPExcel = $this->getParentWriter()->getPHPExcel(); /* @var $pPHPExcel PHPExcel */ |
|||
} |
|||
|
|||
$objWriter = null; |
|||
if ($this->getParentWriter()->getUseDiskCaching()) { |
|||
$objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); |
|||
} else { |
|||
$objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_MEMORY); |
|||
} |
|||
|
|||
// XML header |
|||
$objWriter->startDocument('1.0', 'UTF-8'); |
|||
|
|||
// Content |
|||
$objWriter->startElement('office:document-content'); |
|||
$objWriter->writeAttribute('xmlns:office', 'urn:oasis:names:tc:opendocument:xmlns:office:1.0'); |
|||
$objWriter->writeAttribute('xmlns:style', 'urn:oasis:names:tc:opendocument:xmlns:style:1.0'); |
|||
$objWriter->writeAttribute('xmlns:text', 'urn:oasis:names:tc:opendocument:xmlns:text:1.0'); |
|||
$objWriter->writeAttribute('xmlns:table', 'urn:oasis:names:tc:opendocument:xmlns:table:1.0'); |
|||
$objWriter->writeAttribute('xmlns:draw', 'urn:oasis:names:tc:opendocument:xmlns:drawing:1.0'); |
|||
$objWriter->writeAttribute('xmlns:fo', 'urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0'); |
|||
$objWriter->writeAttribute('xmlns:xlink', 'http://www.w3.org/1999/xlink'); |
|||
$objWriter->writeAttribute('xmlns:dc', 'http://purl.org/dc/elements/1.1/'); |
|||
$objWriter->writeAttribute('xmlns:meta', 'urn:oasis:names:tc:opendocument:xmlns:meta:1.0'); |
|||
$objWriter->writeAttribute('xmlns:number', 'urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0'); |
|||
$objWriter->writeAttribute('xmlns:presentation', 'urn:oasis:names:tc:opendocument:xmlns:presentation:1.0'); |
|||
$objWriter->writeAttribute('xmlns:svg', 'urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0'); |
|||
$objWriter->writeAttribute('xmlns:chart', 'urn:oasis:names:tc:opendocument:xmlns:chart:1.0'); |
|||
$objWriter->writeAttribute('xmlns:dr3d', 'urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0'); |
|||
$objWriter->writeAttribute('xmlns:math', 'http://www.w3.org/1998/Math/MathML'); |
|||
$objWriter->writeAttribute('xmlns:form', 'urn:oasis:names:tc:opendocument:xmlns:form:1.0'); |
|||
$objWriter->writeAttribute('xmlns:script', 'urn:oasis:names:tc:opendocument:xmlns:script:1.0'); |
|||
$objWriter->writeAttribute('xmlns:ooo', 'http://openoffice.org/2004/office'); |
|||
$objWriter->writeAttribute('xmlns:ooow', 'http://openoffice.org/2004/writer'); |
|||
$objWriter->writeAttribute('xmlns:oooc', 'http://openoffice.org/2004/calc'); |
|||
$objWriter->writeAttribute('xmlns:dom', 'http://www.w3.org/2001/xml-events'); |
|||
$objWriter->writeAttribute('xmlns:xforms', 'http://www.w3.org/2002/xforms'); |
|||
$objWriter->writeAttribute('xmlns:xsd', 'http://www.w3.org/2001/XMLSchema'); |
|||
$objWriter->writeAttribute('xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance'); |
|||
$objWriter->writeAttribute('xmlns:rpt', 'http://openoffice.org/2005/report'); |
|||
$objWriter->writeAttribute('xmlns:of', 'urn:oasis:names:tc:opendocument:xmlns:of:1.2'); |
|||
$objWriter->writeAttribute('xmlns:xhtml', 'http://www.w3.org/1999/xhtml'); |
|||
$objWriter->writeAttribute('xmlns:grddl', 'http://www.w3.org/2003/g/data-view#'); |
|||
$objWriter->writeAttribute('xmlns:tableooo', 'http://openoffice.org/2009/table'); |
|||
$objWriter->writeAttribute('xmlns:field', 'urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0'); |
|||
$objWriter->writeAttribute('xmlns:formx', 'urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0'); |
|||
$objWriter->writeAttribute('xmlns:css3t', 'http://www.w3.org/TR/css3-text/'); |
|||
$objWriter->writeAttribute('office:version', '1.2'); |
|||
|
|||
$objWriter->writeElement('office:scripts'); |
|||
$objWriter->writeElement('office:font-face-decls'); |
|||
$objWriter->writeElement('office:automatic-styles'); |
|||
|
|||
$objWriter->startElement('office:body'); |
|||
$objWriter->startElement('office:spreadsheet'); |
|||
$objWriter->writeElement('table:calculation-settings'); |
|||
$this->writeSheets($objWriter); |
|||
$objWriter->writeElement('table:named-expressions'); |
|||
$objWriter->endElement(); |
|||
$objWriter->endElement(); |
|||
$objWriter->endElement(); |
|||
|
|||
return $objWriter->getData(); |
|||
} |
|||
|
|||
/** |
|||
* Write sheets |
|||
* |
|||
* @param PHPExcel_Shared_XMLWriter $objWriter |
|||
*/ |
|||
private function writeSheets(PHPExcel_Shared_XMLWriter $objWriter) |
|||
{ |
|||
$pPHPExcel = $this->getParentWriter()->getPHPExcel(); /* @var $pPHPExcel PHPExcel */ |
|||
|
|||
$sheet_count = $pPHPExcel->getSheetCount(); |
|||
for ($i = 0; $i < $sheet_count; $i++) { |
|||
//$this->getWriterPart('Worksheet')->writeWorksheet()); |
|||
$objWriter->startElement('table:table'); |
|||
$objWriter->writeAttribute('table:name', $pPHPExcel->getSheet($i)->getTitle()); |
|||
$objWriter->writeElement('office:forms'); |
|||
$objWriter->startElement('table:table-column'); |
|||
$objWriter->writeAttribute('table:number-columns-repeated', self::NUMBER_COLS_REPEATED_MAX); |
|||
$objWriter->endElement(); |
|||
$this->writeRows($objWriter, $pPHPExcel->getSheet($i)); |
|||
$objWriter->endElement(); |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* Write rows of the specified sheet |
|||
* |
|||
* @param PHPExcel_Shared_XMLWriter $objWriter |
|||
* @param PHPExcel_Worksheet $sheet |
|||
*/ |
|||
private function writeRows(PHPExcel_Shared_XMLWriter $objWriter, PHPExcel_Worksheet $sheet) |
|||
{ |
|||
$number_rows_repeated = self::NUMBER_ROWS_REPEATED_MAX; |
|||
$span_row = 0; |
|||
$rows = $sheet->getRowIterator(); |
|||
while ($rows->valid()) { |
|||
$number_rows_repeated--; |
|||
$row = $rows->current(); |
|||
if ($row->getCellIterator()->valid()) { |
|||
if ($span_row) { |
|||
$objWriter->startElement('table:table-row'); |
|||
if ($span_row > 1) { |
|||
$objWriter->writeAttribute('table:number-rows-repeated', $span_row); |
|||
} |
|||
$objWriter->startElement('table:table-cell'); |
|||
$objWriter->writeAttribute('table:number-columns-repeated', self::NUMBER_COLS_REPEATED_MAX); |
|||
$objWriter->endElement(); |
|||
$objWriter->endElement(); |
|||
$span_row = 0; |
|||
} |
|||
$objWriter->startElement('table:table-row'); |
|||
$this->writeCells($objWriter, $row); |
|||
$objWriter->endElement(); |
|||
} else { |
|||
$span_row++; |
|||
} |
|||
$rows->next(); |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* Write cells of the specified row |
|||
* |
|||
* @param PHPExcel_Shared_XMLWriter $objWriter |
|||
* @param PHPExcel_Worksheet_Row $row |
|||
* @throws PHPExcel_Writer_Exception |
|||
*/ |
|||
private function writeCells(PHPExcel_Shared_XMLWriter $objWriter, PHPExcel_Worksheet_Row $row) |
|||
{ |
|||
$number_cols_repeated = self::NUMBER_COLS_REPEATED_MAX; |
|||
$prev_column = -1; |
|||
$cells = $row->getCellIterator(); |
|||
while ($cells->valid()) { |
|||
$cell = $cells->current(); |
|||
$column = PHPExcel_Cell::columnIndexFromString($cell->getColumn()) - 1; |
|||
|
|||
$this->writeCellSpan($objWriter, $column, $prev_column); |
|||
$objWriter->startElement('table:table-cell'); |
|||
|
|||
switch ($cell->getDataType()) { |
|||
case PHPExcel_Cell_DataType::TYPE_BOOL: |
|||
$objWriter->writeAttribute('office:value-type', 'boolean'); |
|||
$objWriter->writeAttribute('office:value', $cell->getValue()); |
|||
$objWriter->writeElement('text:p', $cell->getValue()); |
|||
break; |
|||
|
|||
case PHPExcel_Cell_DataType::TYPE_ERROR: |
|||
throw new PHPExcel_Writer_Exception('Writing of error not implemented yet.'); |
|||
break; |
|||
|
|||
case PHPExcel_Cell_DataType::TYPE_FORMULA: |
|||
try { |
|||
$formula_value = $cell->getCalculatedValue(); |
|||
} catch (Exception $e) { |
|||
$formula_value = $cell->getValue(); |
|||
} |
|||
$objWriter->writeAttribute('table:formula', 'of:' . $cell->getValue()); |
|||
if (is_numeric($formula_value)) { |
|||
$objWriter->writeAttribute('office:value-type', 'float'); |
|||
} else { |
|||
$objWriter->writeAttribute('office:value-type', 'string'); |
|||
} |
|||
$objWriter->writeAttribute('office:value', $formula_value); |
|||
$objWriter->writeElement('text:p', $formula_value); |
|||
break; |
|||
|
|||
case PHPExcel_Cell_DataType::TYPE_INLINE: |
|||
throw new PHPExcel_Writer_Exception('Writing of inline not implemented yet.'); |
|||
break; |
|||
|
|||
case PHPExcel_Cell_DataType::TYPE_NUMERIC: |
|||
$objWriter->writeAttribute('office:value-type', 'float'); |
|||
$objWriter->writeAttribute('office:value', $cell->getValue()); |
|||
$objWriter->writeElement('text:p', $cell->getValue()); |
|||
break; |
|||
|
|||
case PHPExcel_Cell_DataType::TYPE_STRING: |
|||
$objWriter->writeAttribute('office:value-type', 'string'); |
|||
$objWriter->writeElement('text:p', $cell->getValue()); |
|||
break; |
|||
} |
|||
PHPExcel_Writer_OpenDocument_Cell_Comment::write($objWriter, $cell); |
|||
$objWriter->endElement(); |
|||
$prev_column = $column; |
|||
$cells->next(); |
|||
} |
|||
$number_cols_repeated = $number_cols_repeated - $prev_column - 1; |
|||
if ($number_cols_repeated > 0) { |
|||
if ($number_cols_repeated > 1) { |
|||
$objWriter->startElement('table:table-cell'); |
|||
$objWriter->writeAttribute('table:number-columns-repeated', $number_cols_repeated); |
|||
$objWriter->endElement(); |
|||
} else { |
|||
$objWriter->writeElement('table:table-cell'); |
|||
} |
|||
} |
|||
} |
|||
|
|||
/** |
|||
* Write span |
|||
* |
|||
* @param PHPExcel_Shared_XMLWriter $objWriter |
|||
* @param integer $curColumn |
|||
* @param integer $prevColumn |
|||
*/ |
|||
private function writeCellSpan(PHPExcel_Shared_XMLWriter $objWriter, $curColumn, $prevColumn) |
|||
{ |
|||
$diff = $curColumn - $prevColumn - 1; |
|||
if (1 === $diff) { |
|||
$objWriter->writeElement('table:table-cell'); |
|||
} elseif ($diff > 1) { |
|||
$objWriter->startElement('table:table-cell'); |
|||
$objWriter->writeAttribute('table:number-columns-repeated', $diff); |
|||
$objWriter->endElement(); |
|||
} |
|||
} |
|||
} |
|||
@ -0,0 +1,364 @@ |
|||
<?php |
|||
/** |
|||
* PHPExcel |
|||
* |
|||
* Copyright (c) 2006 - 2013 PHPExcel |
|||
* |
|||
* This library is free software; you can redistribute it and/or |
|||
* modify it under the terms of the GNU Lesser General Public |
|||
* License as published by the Free Software Foundation; either |
|||
* version 2.1 of the License, or (at your option) any later version. |
|||
* |
|||
* This library is distributed in the hope that it will be useful, |
|||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|||
* Lesser General Public License for more details. |
|||
* |
|||
* You should have received a copy of the GNU Lesser General Public |
|||
* License along with this library; if not, write to the Free Software |
|||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
|||
* |
|||
* @category PHPExcel |
|||
* @package PHPExcel_Writer_PDF |
|||
* @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) |
|||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL |
|||
* @version 1.7.9, 2013-06-02 |
|||
*/ |
|||
|
|||
|
|||
/** |
|||
* PHPExcel_Writer_PDF_Core |
|||
* |
|||
* @category PHPExcel |
|||
* @package PHPExcel_Writer_PDF |
|||
* @copyright Copyright (c) 2006 - 2013 PHPExcel (http://www.codeplex.com/PHPExcel) |
|||
*/ |
|||
abstract class PHPExcel_Writer_PDF_Core extends PHPExcel_Writer_HTML |
|||
{ |
|||
/** |
|||
* Temporary storage directory |
|||
* |
|||
* @var string |
|||
*/ |
|||
protected $_tempDir = ''; |
|||
|
|||
/** |
|||
* Font |
|||
* |
|||
* @var string |
|||
*/ |
|||
protected $_font = 'freesans'; |
|||
|
|||
/** |
|||
* Orientation (Over-ride) |
|||
* |
|||
* @var string |
|||
*/ |
|||
protected $_orientation = NULL; |
|||
|
|||
/** |
|||
* Paper size (Over-ride) |
|||
* |
|||
* @var int |
|||
*/ |
|||
protected $_paperSize = NULL; |
|||
|
|||
|
|||
/** |
|||
* Temporary storage for Save Array Return type |
|||
* |
|||
* @var string |
|||
*/ |
|||
private $_saveArrayReturnType; |
|||
|
|||
/** |
|||
* Paper Sizes xRef List |
|||
* |
|||
* @var array |
|||
*/ |
|||
protected static $_paperSizes = array( |
|||
PHPExcel_Worksheet_PageSetup::PAPERSIZE_LETTER |
|||
=> 'LETTER', // (8.5 in. by 11 in.) |
|||
PHPExcel_Worksheet_PageSetup::PAPERSIZE_LETTER_SMALL |
|||
=> 'LETTER', // (8.5 in. by 11 in.) |
|||
PHPExcel_Worksheet_PageSetup::PAPERSIZE_TABLOID |
|||
=> array(792.00, 1224.00), // (11 in. by 17 in.) |
|||
PHPExcel_Worksheet_PageSetup::PAPERSIZE_LEDGER |
|||
=> array(1224.00, 792.00), // (17 in. by 11 in.) |
|||
PHPExcel_Worksheet_PageSetup::PAPERSIZE_LEGAL |
|||
=> 'LEGAL', // (8.5 in. by 14 in.) |
|||
PHPExcel_Worksheet_PageSetup::PAPERSIZE_STATEMENT |
|||
=> array(396.00, 612.00), // (5.5 in. by 8.5 in.) |
|||
PHPExcel_Worksheet_PageSetup::PAPERSIZE_EXECUTIVE |
|||
=> 'EXECUTIVE', // (7.25 in. by 10.5 in.) |
|||
PHPExcel_Worksheet_PageSetup::PAPERSIZE_A3 |
|||
=> 'A3', // (297 mm by 420 mm) |
|||
PHPExcel_Worksheet_PageSetup::PAPERSIZE_A4 |
|||
=> 'A4', // (210 mm by 297 mm) |
|||
PHPExcel_Worksheet_PageSetup::PAPERSIZE_A4_SMALL |
|||
=> 'A4', // (210 mm by 297 mm) |
|||
PHPExcel_Worksheet_PageSetup::PAPERSIZE_A5 |
|||
=> 'A5', // (148 mm by 210 mm) |
|||
PHPExcel_Worksheet_PageSetup::PAPERSIZE_B4 |
|||
=> 'B4', // (250 mm by 353 mm) |
|||
PHPExcel_Worksheet_PageSetup::PAPERSIZE_B5 |
|||
=> 'B5', // (176 mm by 250 mm) |
|||
PHPExcel_Worksheet_PageSetup::PAPERSIZE_FOLIO |
|||
=> 'FOLIO', // (8.5 in. by 13 in.) |
|||
PHPExcel_Worksheet_PageSetup::PAPERSIZE_QUARTO |
|||
=> array(609.45, 779.53), // (215 mm by 275 mm) |
|||
PHPExcel_Worksheet_PageSetup::PAPERSIZE_STANDARD_1 |
|||
=> array(720.00, 1008.00), // (10 in. by 14 in.) |
|||
PHPExcel_Worksheet_PageSetup::PAPERSIZE_STANDARD_2 |
|||
=> array(792.00, 1224.00), // (11 in. by 17 in.) |
|||
PHPExcel_Worksheet_PageSetup::PAPERSIZE_NOTE |
|||
=> 'LETTER', // (8.5 in. by 11 in.) |
|||
PHPExcel_Worksheet_PageSetup::PAPERSIZE_NO9_ENVELOPE |
|||
=> array(279.00, 639.00), // (3.875 in. by 8.875 in.) |
|||
PHPExcel_Worksheet_PageSetup::PAPERSIZE_NO10_ENVELOPE |
|||
=> array(297.00, 684.00), // (4.125 in. by 9.5 in.) |
|||
PHPExcel_Worksheet_PageSetup::PAPERSIZE_NO11_ENVELOPE |
|||
=> array(324.00, 747.00), // (4.5 in. by 10.375 in.) |
|||
PHPExcel_Worksheet_PageSetup::PAPERSIZE_NO12_ENVELOPE |
|||
=> array(342.00, 792.00), // (4.75 in. by 11 in.) |
|||
PHPExcel_Worksheet_PageSetup::PAPERSIZE_NO14_ENVELOPE |
|||
=> array(360.00, 828.00), // (5 in. by 11.5 in.) |
|||
PHPExcel_Worksheet_PageSetup::PAPERSIZE_C |
|||
=> array(1224.00, 1584.00), // (17 in. by 22 in.) |
|||
PHPExcel_Worksheet_PageSetup::PAPERSIZE_D |
|||
=> array(1584.00, 2448.00), // (22 in. by 34 in.) |
|||
PHPExcel_Worksheet_PageSetup::PAPERSIZE_E |
|||
=> array(2448.00, 3168.00), // (34 in. by 44 in.) |
|||
PHPExcel_Worksheet_PageSetup::PAPERSIZE_DL_ENVELOPE |
|||
=> array(311.81, 623.62), // (110 mm by 220 mm) |
|||
PHPExcel_Worksheet_PageSetup::PAPERSIZE_C5_ENVELOPE |
|||
=> 'C5', // (162 mm by 229 mm) |
|||
PHPExcel_Worksheet_PageSetup::PAPERSIZE_C3_ENVELOPE |
|||
=> 'C3', // (324 mm by 458 mm) |
|||
PHPExcel_Worksheet_PageSetup::PAPERSIZE_C4_ENVELOPE |
|||
=> 'C4', // (229 mm by 324 mm) |
|||
PHPExcel_Worksheet_PageSetup::PAPERSIZE_C6_ENVELOPE |
|||
=> 'C6', // (114 mm by 162 mm) |
|||
PHPExcel_Worksheet_PageSetup::PAPERSIZE_C65_ENVELOPE |
|||
=> array(323.15, 649.13), // (114 mm by 229 mm) |
|||
PHPExcel_Worksheet_PageSetup::PAPERSIZE_B4_ENVELOPE |
|||
=> 'B4', // (250 mm by 353 mm) |
|||
PHPExcel_Worksheet_PageSetup::PAPERSIZE_B5_ENVELOPE |
|||
=> 'B5', // (176 mm by 250 mm) |
|||
PHPExcel_Worksheet_PageSetup::PAPERSIZE_B6_ENVELOPE |
|||
=> array(498.90, 354.33), // (176 mm by 125 mm) |
|||
PHPExcel_Worksheet_PageSetup::PAPERSIZE_ITALY_ENVELOPE |
|||
=> array(311.81, 651.97), // (110 mm by 230 mm) |
|||
PHPExcel_Worksheet_PageSetup::PAPERSIZE_MONARCH_ENVELOPE |
|||
=> array(279.00, 540.00), // (3.875 in. by 7.5 in.) |
|||
PHPExcel_Worksheet_PageSetup::PAPERSIZE_6_3_4_ENVELOPE |
|||
=> array(261.00, 468.00), // (3.625 in. by 6.5 in.) |
|||
PHPExcel_Worksheet_PageSetup::PAPERSIZE_US_STANDARD_FANFOLD |
|||
=> array(1071.00, 792.00), // (14.875 in. by 11 in.) |
|||
PHPExcel_Worksheet_PageSetup::PAPERSIZE_GERMAN_STANDARD_FANFOLD |
|||
=> array(612.00, 864.00), // (8.5 in. by 12 in.) |
|||
PHPExcel_Worksheet_PageSetup::PAPERSIZE_GERMAN_LEGAL_FANFOLD |
|||
=> 'FOLIO', // (8.5 in. by 13 in.) |
|||
PHPExcel_Worksheet_PageSetup::PAPERSIZE_ISO_B4 |
|||
=> 'B4', // (250 mm by 353 mm) |
|||
PHPExcel_Worksheet_PageSetup::PAPERSIZE_JAPANESE_DOUBLE_POSTCARD |
|||
=> array(566.93, 419.53), // (200 mm by 148 mm) |
|||
PHPExcel_Worksheet_PageSetup::PAPERSIZE_STANDARD_PAPER_1 |
|||
=> array(648.00, 792.00), // (9 in. by 11 in.) |
|||
PHPExcel_Worksheet_PageSetup::PAPERSIZE_STANDARD_PAPER_2 |
|||
=> array(720.00, 792.00), // (10 in. by 11 in.) |
|||
PHPExcel_Worksheet_PageSetup::PAPERSIZE_STANDARD_PAPER_3 |
|||
=> array(1080.00, 792.00), // (15 in. by 11 in.) |
|||
PHPExcel_Worksheet_PageSetup::PAPERSIZE_INVITE_ENVELOPE |
|||
=> array(623.62, 623.62), // (220 mm by 220 mm) |
|||
PHPExcel_Worksheet_PageSetup::PAPERSIZE_LETTER_EXTRA_PAPER |
|||
=> array(667.80, 864.00), // (9.275 in. by 12 in.) |
|||
PHPExcel_Worksheet_PageSetup::PAPERSIZE_LEGAL_EXTRA_PAPER |
|||
=> array(667.80, 1080.00), // (9.275 in. by 15 in.) |
|||
PHPExcel_Worksheet_PageSetup::PAPERSIZE_TABLOID_EXTRA_PAPER |
|||
=> array(841.68, 1296.00), // (11.69 in. by 18 in.) |
|||
PHPExcel_Worksheet_PageSetup::PAPERSIZE_A4_EXTRA_PAPER |
|||
=> array(668.98, 912.76), // (236 mm by 322 mm) |
|||
PHPExcel_Worksheet_PageSetup::PAPERSIZE_LETTER_TRANSVERSE_PAPER |
|||
=> array(595.80, 792.00), // (8.275 in. by 11 in.) |
|||
PHPExcel_Worksheet_PageSetup::PAPERSIZE_A4_TRANSVERSE_PAPER |
|||
=> 'A4', // (210 mm by 297 mm) |
|||
PHPExcel_Worksheet_PageSetup::PAPERSIZE_LETTER_EXTRA_TRANSVERSE_PAPER |
|||
=> array(667.80, 864.00), // (9.275 in. by 12 in.) |
|||
PHPExcel_Worksheet_PageSetup::PAPERSIZE_SUPERA_SUPERA_A4_PAPER |
|||
=> array(643.46, 1009.13), // (227 mm by 356 mm) |
|||
PHPExcel_Worksheet_PageSetup::PAPERSIZE_SUPERB_SUPERB_A3_PAPER |
|||
=> array(864.57, 1380.47), // (305 mm by 487 mm) |
|||
PHPExcel_Worksheet_PageSetup::PAPERSIZE_LETTER_PLUS_PAPER |
|||
=> array(612.00, 913.68), // (8.5 in. by 12.69 in.) |
|||
PHPExcel_Worksheet_PageSetup::PAPERSIZE_A4_PLUS_PAPER |
|||
=> array(595.28, 935.43), // (210 mm by 330 mm) |
|||
PHPExcel_Worksheet_PageSetup::PAPERSIZE_A5_TRANSVERSE_PAPER |
|||
=> 'A5', // (148 mm by 210 mm) |
|||
PHPExcel_Worksheet_PageSetup::PAPERSIZE_JIS_B5_TRANSVERSE_PAPER |
|||
=> array(515.91, 728.50), // (182 mm by 257 mm) |
|||
PHPExcel_Worksheet_PageSetup::PAPERSIZE_A3_EXTRA_PAPER |
|||
=> array(912.76, 1261.42), // (322 mm by 445 mm) |
|||
PHPExcel_Worksheet_PageSetup::PAPERSIZE_A5_EXTRA_PAPER |
|||
=> array(493.23, 666.14), // (174 mm by 235 mm) |
|||
PHPExcel_Worksheet_PageSetup::PAPERSIZE_ISO_B5_EXTRA_PAPER |
|||
=> array(569.76, 782.36), // (201 mm by 276 mm) |
|||
PHPExcel_Worksheet_PageSetup::PAPERSIZE_A2_PAPER |
|||
=> 'A2', // (420 mm by 594 mm) |
|||
PHPExcel_Worksheet_PageSetup::PAPERSIZE_A3_TRANSVERSE_PAPER |
|||
=> 'A3', // (297 mm by 420 mm) |
|||
PHPExcel_Worksheet_PageSetup::PAPERSIZE_A3_EXTRA_TRANSVERSE_PAPER |
|||
=> array(912.76, 1261.42) // (322 mm by 445 mm) |
|||
); |
|||
|
|||
/** |
|||
* Create a new PHPExcel_Writer_PDF |
|||
* |
|||
* @param PHPExcel $phpExcel PHPExcel object |
|||
*/ |
|||
public function __construct(PHPExcel $phpExcel) |
|||
{ |
|||
parent::__construct($phpExcel); |
|||
$this->setUseInlineCss(TRUE); |
|||
$this->_tempDir = PHPExcel_Shared_File::sys_get_temp_dir(); |
|||
} |
|||
|
|||
/** |
|||
* Get Font |
|||
* |
|||
* @return string |
|||
*/ |
|||
public function getFont() |
|||
{ |
|||
return $this->_font; |
|||
} |
|||
|
|||
/** |
|||
* Set font. Examples: |
|||
* 'arialunicid0-chinese-simplified' |
|||
* 'arialunicid0-chinese-traditional' |
|||
* 'arialunicid0-korean' |
|||
* 'arialunicid0-japanese' |
|||
* |
|||
* @param string $fontName |
|||
*/ |
|||
public function setFont($fontName) |
|||
{ |
|||
$this->_font = $fontName; |
|||
return $this; |
|||
} |
|||
|
|||
/** |
|||
* Get Paper Size |
|||
* |
|||
* @return int |
|||
*/ |
|||
public function getPaperSize() |
|||
{ |
|||
return $this->_paperSize; |
|||
} |
|||
|
|||
/** |
|||
* Set Paper Size |
|||
* |
|||
* @param string $pValue Paper size |
|||
* @return PHPExcel_Writer_PDF |
|||
*/ |
|||
public function setPaperSize($pValue = PHPExcel_Worksheet_PageSetup::PAPERSIZE_LETTER) |
|||
{ |
|||
$this->_paperSize = $pValue; |
|||
return $this; |
|||
} |
|||
|
|||
/** |
|||
* Get Orientation |
|||
* |
|||
* @return string |
|||
*/ |
|||
public function getOrientation() |
|||
{ |
|||
return $this->_orientation; |
|||
} |
|||
|
|||
/** |
|||
* Set Orientation |
|||
* |
|||
* @param string $pValue Page orientation |
|||
* @return PHPExcel_Writer_PDF |
|||
*/ |
|||
public function setOrientation($pValue = PHPExcel_Worksheet_PageSetup::ORIENTATION_DEFAULT) |
|||
{ |
|||
$this->_orientation = $pValue; |
|||
return $this; |
|||
} |
|||
|
|||
/** |
|||
* Get temporary storage directory |
|||
* |
|||
* @return string |
|||
*/ |
|||
public function getTempDir() |
|||
{ |
|||
return $this->_tempDir; |
|||
} |
|||
|
|||
/** |
|||
* Set temporary storage directory |
|||
* |
|||
* @param string $pValue Temporary storage directory |
|||
* @throws PHPExcel_Writer_Exception when directory does not exist |
|||
* @return PHPExcel_Writer_PDF |
|||
*/ |
|||
public function setTempDir($pValue = '') |
|||
{ |
|||
if (is_dir($pValue)) { |
|||
$this->_tempDir = $pValue; |
|||
} else { |
|||
throw new PHPExcel_Writer_Exception("Directory does not exist: $pValue"); |
|||
} |
|||
return $this; |
|||
} |
|||
|
|||
/** |
|||
* Save PHPExcel to PDF file, pre-save |
|||
* |
|||
* @param string $pFilename Name of the file to save as |
|||
* @throws PHPExcel_Writer_Exception |
|||
*/ |
|||
protected function prepareForSave($pFilename = NULL) |
|||
{ |
|||
// garbage collect |
|||
$this->_phpExcel->garbageCollect(); |
|||
|
|||
$this->_saveArrayReturnType = PHPExcel_Calculation::getArrayReturnType(); |
|||
PHPExcel_Calculation::setArrayReturnType(PHPExcel_Calculation::RETURN_ARRAY_AS_VALUE); |
|||
|
|||
// Open file |
|||
$fileHandle = fopen($pFilename, 'w'); |
|||
if ($fileHandle === FALSE) { |
|||
throw new PHPExcel_Writer_Exception("Could not open file $pFilename for writing."); |
|||
} |
|||
|
|||
// Set PDF |
|||
$this->_isPdf = TRUE; |
|||
// Build CSS |
|||
$this->buildCSS(TRUE); |
|||
|
|||
return $fileHandle; |
|||
} |
|||
|
|||
/** |
|||
* Save PHPExcel to PDF file, post-save |
|||
* |
|||
* @param resource $fileHandle |
|||
* @throws PHPExcel_Writer_Exception |
|||
*/ |
|||
protected function restoreStateAfterSave($fileHandle) |
|||
{ |
|||
// Close file |
|||
fclose($fileHandle); |
|||
|
|||
PHPExcel_Calculation::setArrayReturnType($this->_saveArrayReturnType); |
|||
} |
|||
|
|||
} |
|||
@ -0,0 +1,23 @@ |
|||
<?php |
|||
define('IN_WEB', true); |
|||
if(is_file('../wlversion.txt')){ |
|||
$version = file_get_contents('../wlversion.txt'); |
|||
define("MODULE_NAME",$version); |
|||
}else{ |
|||
define("MODULE_NAME",'weliam_smartcity'); |
|||
} |
|||
require '../framework/bootstrap.inc.php'; |
|||
require_once IA_ROOT . "/addons/".MODULE_NAME."/core/common/defines.php"; |
|||
require_once PATH_CORE . "common/autoload.php"; |
|||
Func_loader::core('global'); |
|||
load()->model('attachment'); |
|||
|
|||
$_W['catalog'] = 'web'; |
|||
$_W['plugin'] = $plugin = !empty($_GPC['p']) ? $_GPC['p'] : 'dashboard'; |
|||
$_W['controller'] = $controller = !empty($_GPC['ac']) ? $_GPC['ac'] : 'dashboard'; |
|||
$_W['method'] = $method = !empty($_GPC['do']) ? $_GPC['do'] : 'index'; |
|||
Func_loader::web('cover'); |
|||
$_W['wlsetting'] = Setting::wlsetting_load(); |
|||
$_W['attachurl'] = attachment_set_attach_url(); |
|||
|
|||
wl_new_method($plugin, $controller, $method, $_W['catalog']); |
|||
@ -0,0 +1,23 @@ |
|||
<?php |
|||
define('IN_STORE', true); |
|||
if(is_file('../wlversion.txt')){ |
|||
$version = file_get_contents('../wlversion.txt'); |
|||
define("MODULE_NAME",$version); |
|||
}else{ |
|||
define("MODULE_NAME",'weliam_smartcity'); |
|||
} |
|||
require '../framework/bootstrap.inc.php'; |
|||
require_once IA_ROOT . "/addons/".MODULE_NAME."/core/common/defines.php"; |
|||
require_once PATH_CORE . "common/autoload.php"; |
|||
Func_loader::core('global'); |
|||
load()->model('attachment'); |
|||
|
|||
$_W['catalog'] = 'web'; |
|||
$_W['plugin'] = $plugin = !empty($_GPC['p']) ? $_GPC['p'] : 'dashboard'; |
|||
$_W['controller'] = $controller = !empty($_GPC['ac']) ? $_GPC['ac'] : 'dashboard'; |
|||
$_W['method'] = $method = !empty($_GPC['do']) ? $_GPC['do'] : 'index'; |
|||
Func_loader::web('storecover'); |
|||
$_W['wlsetting'] = Setting::wlsetting_load(); |
|||
$_W['attachurl'] = attachment_set_attach_url(); |
|||
|
|||
wl_new_method($plugin, $controller, $method, $_W['catalog']); |
|||
@ -0,0 +1,24 @@ |
|||
<?php |
|||
define('IN_STAFF', true); |
|||
if(is_file('../wlversion.txt')){ |
|||
$version = file_get_contents('../wlversion.txt'); |
|||
define("MODULE_NAME",$version); |
|||
}else{ |
|||
define("MODULE_NAME",'weliam_smartcity'); |
|||
} |
|||
require '../framework/bootstrap.inc.php'; |
|||
require_once IA_ROOT . "/addons/".MODULE_NAME."/core/common/defines.php"; |
|||
require_once PATH_CORE . "common/autoload.php"; |
|||
Func_loader::core('global'); |
|||
load()->model('attachment'); |
|||
|
|||
$_W['token'] = token(); |
|||
$_W['catalog'] = 'sys'; |
|||
$_W['plugin'] = $plugin = !empty($_GPC['p']) ? $_GPC['p'] : 'dashboard'; |
|||
$_W['controller'] = $controller = !empty($_GPC['ac']) ? $_GPC['ac'] : 'dashboard'; |
|||
$_W['method'] = $method = !empty($_GPC['do']) ? $_GPC['do'] : 'index'; |
|||
Func_loader::web('syscover'); |
|||
$_W['wlsetting'] = Setting::wlsetting_load(); |
|||
$_W['attachurl'] = attachment_set_attach_url(); |
|||
|
|||
wl_new_method($plugin, $controller, $method, $_W['catalog']); |
|||
@ -0,0 +1,323 @@ |
|||
<?php |
|||
|
|||
defined('IN_IA') or exit('Access Denied'); |
|||
|
|||
load()->model('module'); |
|||
load()->model('miniapp'); |
|||
|
|||
function current_operate_is_controller() |
|||
{ |
|||
global $_W, $_GPC; |
|||
$result = 0; |
|||
if (!$_W['isfounder']) { |
|||
return $result; |
|||
} |
|||
$result = igetcookie('__iscontroller'); |
|||
if (isset($_GPC['iscontroller'])) { |
|||
if (1 == $_GPC['iscontroller']) { |
|||
$result = 1; |
|||
isetcookie('__iscontroller', $result); |
|||
return $result; |
|||
} |
|||
if (0 == $_GPC['iscontroller']) { |
|||
$result = 0; |
|||
} |
|||
} |
|||
|
|||
if (in_array(FRAME, array('welcome', 'module_manage', 'user_manage', 'permission', 'system', 'site'))) { |
|||
$result = 1; |
|||
} |
|||
if (in_array(FRAME, array('account', 'wxapp')) && (($_GPC['m'] || $_GPC['module_name']) != 'store')) { |
|||
$result = 0; |
|||
} |
|||
isetcookie('__iscontroller', $result); |
|||
return $result; |
|||
} |
|||
|
|||
function system_modules() |
|||
{ |
|||
return module_system(); |
|||
} |
|||
|
|||
|
|||
function url($segment, $params = array(), $contain_domain = false) |
|||
{ |
|||
return wurl($segment, $params, $contain_domain); |
|||
} |
|||
|
|||
|
|||
function message($msg, $redirect = '', $type = '', $tips = false, $extend = array()) |
|||
{ |
|||
global $_W, $_GPC; |
|||
|
|||
if ('refresh' == $redirect) { |
|||
$redirect = $_W['script_name'] . '?' . $_SERVER['QUERY_STRING']; |
|||
} |
|||
if ('referer' == $redirect) { |
|||
$redirect = referer(); |
|||
} |
|||
$redirect = safe_gpc_url($redirect); |
|||
|
|||
if ('' == $redirect) { |
|||
$type = in_array($type, array('success', 'error', 'info', 'warning', 'ajax', 'sql', 'expired')) ? $type : 'info'; |
|||
} else { |
|||
$type = in_array($type, array('success', 'error', 'info', 'warning', 'ajax', 'sql', 'expired')) ? $type : 'success'; |
|||
} |
|||
if ($_W['isajax'] || !empty($_GET['isajax']) || 'ajax' == $type) { |
|||
if ('ajax' != $type && !empty($_GPC['target'])) { |
|||
exit(' |
|||
<script type="text/javascript"> |
|||
var url = ' . (!empty($redirect) ? 'parent.location.href' : "''") . "; |
|||
var modalobj = util.message('" . $msg . "', '', '" . $type . "'); |
|||
if (url) { |
|||
modalobj.on('hide.bs.modal', function(){\$('.modal').each(function(){if(\$(this).attr('id') != 'modal-message') {\$(this).modal('hide');}});top.location.reload()}); |
|||
} |
|||
</script>"); |
|||
} else { |
|||
$vars = array(); |
|||
$vars['message'] = $msg; |
|||
$vars['redirect'] = $redirect; |
|||
$vars['type'] = $type; |
|||
exit(json_encode($vars)); |
|||
} |
|||
} |
|||
if (empty($msg) && !empty($redirect)) { |
|||
header('Location: ' . $redirect); |
|||
exit; |
|||
} |
|||
$label = $type; |
|||
if ('error' == $type || 'expired' == $type) { |
|||
$label = 'danger'; |
|||
} |
|||
if ('ajax' == $type || 'sql' == $type) { |
|||
$label = 'warning'; |
|||
} |
|||
|
|||
if ($tips) { |
|||
if (is_array($msg)) { |
|||
$message_cookie['title'] = 'MYSQL 错误'; |
|||
$message_cookie['msg'] = 'php echo cutstr(' . $msg['sql'] . ', 300, 1);'; |
|||
} else { |
|||
$message_cookie['title'] = $caption; |
|||
$message_cookie['msg'] = $msg; |
|||
} |
|||
$message_cookie['type'] = $label; |
|||
$message_cookie['redirect'] = $redirect ? $redirect : referer(); |
|||
$message_cookie['msg'] = rawurlencode($message_cookie['msg']); |
|||
$extend_button = array(); |
|||
if (!empty($extend) && is_array($extend)) { |
|||
foreach ($extend as $button) { |
|||
if (!empty($button['title']) && !empty($button['url'])) { |
|||
$button['url'] = safe_gpc_url($button['url'], false); |
|||
$button['title'] = rawurlencode($button['title']); |
|||
$extend_button[] = $button; |
|||
} |
|||
} |
|||
} |
|||
$message_cookie['extend'] = !empty($extend_button) ? $extend_button : ''; |
|||
|
|||
isetcookie('message', stripslashes(json_encode($message_cookie, JSON_UNESCAPED_UNICODE))); |
|||
header('Location: ' . $message_cookie['redirect']); |
|||
} else { |
|||
include template('common/message', TEMPLATE_INCLUDEPATH); |
|||
} |
|||
exit; |
|||
} |
|||
|
|||
function iajax($code = 0, $message = '', $redirect = '') |
|||
{ |
|||
message(error($code, $message), $redirect, 'ajax', false); |
|||
} |
|||
|
|||
function itoast($message, $redirect = '', $type = '', $extend = array()) |
|||
{ |
|||
message($message, $redirect, $type, true, $extend); |
|||
} |
|||
|
|||
|
|||
function checklogin($url = '') |
|||
{ |
|||
global $_W; |
|||
if (empty($_W['uid'])) { |
|||
$url = safe_gpc_url($url); |
|||
if (!empty($_W['setting']['copyright']['showhomepage'])) { |
|||
itoast('', url('account/welcome'), 'warning'); |
|||
} else { |
|||
itoast('', url('user/login', $url ? array('referer' => urlencode($url)) : ''), 'warning'); |
|||
} |
|||
} |
|||
$cookie = json_decode(authcode(igetcookie('__session'), 'DECODE'), true); |
|||
if (empty($cookie['rember'])) { |
|||
$session = authcode(json_encode($cookie), 'encode'); |
|||
$autosignout = (int)$_W['setting']['copyright']['autosignout'] > 0 ? (int)$_W['setting']['copyright']['autosignout'] * 60 : 0; |
|||
isetcookie('__session', $session, $autosignout, true); |
|||
} |
|||
|
|||
return true; |
|||
} |
|||
|
|||
function get_position_by_ip($ip = '') |
|||
{ |
|||
global $_W; |
|||
$ip = $ip ? $ip : $_W['clientip']; |
|||
$url = 'http://ip.taobao.com/outGetIpInfo?ip=' . $ip . '&accessKey=alibaba-inc'; |
|||
$ip_content = file_get_contents($url); |
|||
$ip_content = json_decode($ip_content, true); |
|||
if (empty($ip_content) || $ip_content['code'] != 0) { |
|||
$res = @file_get_contents('https://whois.pconline.com.cn/ipJson.jsp'); |
|||
$res = strtoutf8($res); |
|||
$json_matches = array(); |
|||
preg_match('/{IPCallBack\((.+?)\);\}/', $res, $json_matches); |
|||
if (empty($json_matches[1])) { |
|||
return error(-1, '获取地址失败,请重新配置Ip查询接口'); |
|||
} |
|||
$ip_content = array( |
|||
'code' => 0, |
|||
'data' => json_decode($json_matches[1], true) |
|||
); |
|||
} |
|||
return $ip_content; |
|||
} |
|||
|
|||
function buildframes($framename = '') |
|||
{ |
|||
global $_W, $_GPC; |
|||
$frames = system_menu_permission_list(); |
|||
$frames = frames_top_menu($frames); |
|||
|
|||
return !empty($framename) ? ('system_welcome' == $framename ? $frames['account'] : $frames[$framename]) : $frames; |
|||
} |
|||
|
|||
function frames_top_menu($frames) |
|||
{ |
|||
global $_W, $top_nav; |
|||
if (empty($frames)) { |
|||
return array(); |
|||
} |
|||
|
|||
foreach ($frames as $menuid => $menu) { |
|||
// if ((!empty($menu['founder']) || in_array($menuid, array('module_manage', 'site', 'advertisement', 'appmarket'))) && !$_W['isadmin'] || |
|||
// ACCOUNT_MANAGE_NAME_CLERK == $_W['highest_role'] && in_array($menuid, array('account', 'wxapp', 'system', 'platform', 'welcome', 'account_manage')) && !$_W['isadmin'] && in_array($menuid, array('user_manage', 'permission')) || |
|||
// 'myself' == $menuid && $_W['isadmin'] || |
|||
// !$menu['is_display']) { |
|||
// continue; |
|||
// } |
|||
|
|||
$top_nav[] = array( |
|||
'title' => $menu['title'], |
|||
'name' => $menuid, |
|||
'url' => $menu['url'], |
|||
'blank' => $menu['blank'], |
|||
'icon' => $menu['icon'], |
|||
'is_display' => $menu['is_display'], |
|||
'is_system' => $menu['is_system'], |
|||
); |
|||
} |
|||
return $frames; |
|||
} |
|||
|
|||
|
|||
function filter_url($params) |
|||
{ |
|||
global $_W; |
|||
if (empty($params)) { |
|||
return ''; |
|||
} |
|||
$query_arr = array(); |
|||
$parse = parse_url($_W['siteurl']); |
|||
if (!empty($parse['query'])) { |
|||
$query = $parse['query']; |
|||
parse_str($query, $query_arr); |
|||
} |
|||
$params = explode(',', $params); |
|||
foreach ($params as $val) { |
|||
if (!empty($val)) { |
|||
$data = explode(':', $val); |
|||
$query_arr[$data[0]] = trim($data[1]); |
|||
} |
|||
} |
|||
$query_arr['page'] = 1; |
|||
$query = http_build_query($query_arr); |
|||
|
|||
return './index.php?' . $query; |
|||
} |
|||
|
|||
function url_params($url) |
|||
{ |
|||
$result = array(); |
|||
if (empty($url)) { |
|||
return $result; |
|||
} |
|||
$components = parse_url($url); |
|||
$params = explode('&', $components['query']); |
|||
foreach ($params as $param) { |
|||
if (!empty($param)) { |
|||
$param_array = explode('=', $param); |
|||
$result[$param_array[0]] = $param_array[1]; |
|||
} |
|||
} |
|||
|
|||
return $result; |
|||
} |
|||
|
|||
function frames_menu_append() |
|||
{ |
|||
$system_menu_default_permission = array( |
|||
'founder' => array(), |
|||
'vice_founder' => array( |
|||
'system_setting_updatecache', |
|||
), |
|||
'owner' => array( |
|||
'system_setting_updatecache', |
|||
), |
|||
'manager' => array( |
|||
'system_setting_updatecache', |
|||
), |
|||
'operator' => array( |
|||
'system_setting_updatecache', |
|||
), |
|||
'clerk' => array(), |
|||
'expired' => array( |
|||
'system_setting_updatecache', |
|||
), |
|||
); |
|||
|
|||
return $system_menu_default_permission; |
|||
} |
|||
|
|||
|
|||
function site_profile_perfect_tips() |
|||
{ |
|||
global $_W; |
|||
|
|||
if ($_W['isfounder'] && (empty($_W['setting']['site']) || empty($_W['setting']['site']['profile_perfect']))) { |
|||
if (!defined('SITE_PROFILE_PERFECT_TIPS')) { |
|||
$url = url('cloud/profile'); |
|||
|
|||
return <<<EOF |
|||
$(function() { |
|||
var html = |
|||
'<div class="we7-body-alert">'+ |
|||
'<div class="container">'+ |
|||
'<div class="alert alert-info">'+ |
|||
'<i class="wi wi-info-sign"></i>'+ |
|||
'<button type="button" class="close" data-dismiss="alert"><span aria-hidden="true" class="wi wi-error-sign"></span><span class="sr-only">Close</span></button>'+ |
|||
'<a href="{$url}" target="_blank">请尽快完善您在微擎云服务平台的站点注册信息。</a>'+ |
|||
'</div>'+ |
|||
'</div>'+ |
|||
'</div>'; |
|||
$('body').prepend(html); |
|||
}); |
|||
EOF; |
|||
define('SITE_PROFILE_PERFECT_TIPS', true); |
|||
} |
|||
} |
|||
|
|||
return ''; |
|||
} |
|||
|
|||
function strtoutf8($str) |
|||
{ |
|||
$current_encode = mb_detect_encoding($str, array('ASCII', 'GB2312', 'GBK', 'BIG5', 'UTF-8')); |
|||
return mb_convert_encoding($str, 'UTF-8', $current_encode); |
|||
} |
|||
@ -0,0 +1,166 @@ |
|||
/** |
|||
* @name jQuery Cascdejs plugin |
|||
* @author zdy |
|||
* @version 1.0 |
|||
*/ |
|||
|
|||
//首先需要初始化
|
|||
var xmlDoc; |
|||
var TopnodeList; |
|||
var citys; |
|||
var countyNodes; |
|||
var nodeindex = 0; |
|||
var childnodeindex = 0; |
|||
//获取xml文件
|
|||
function cascdeInit(v1,v2,v3) { |
|||
//打开xlmdocm文档
|
|||
xmlDoc = loadXmlFile('./resource/components/area/Area.xml'); |
|||
var dropElement1 = document.getElementById("sel-provance"); |
|||
var dropElement2 = document.getElementById("sel-city"); |
|||
var dropElement3 = document.getElementById("sel-area"); |
|||
RemoveDropDownList(dropElement1); |
|||
RemoveDropDownList(dropElement2); |
|||
RemoveDropDownList(dropElement3); |
|||
if (window.ActiveXObject) { |
|||
TopnodeList = xmlDoc.selectSingleNode("address").childNodes; |
|||
} |
|||
else { |
|||
TopnodeList = xmlDoc.childNodes[0].getElementsByTagName("province"); |
|||
} |
|||
if (TopnodeList.length > 0) { |
|||
//省份列表
|
|||
var county; |
|||
var province; |
|||
var city; |
|||
for (var i = 0; i < TopnodeList.length; i++) { |
|||
//添加列表项目
|
|||
county = TopnodeList[i]; |
|||
var option = document.createElement("option"); |
|||
option.value = county.getAttribute("name"); |
|||
option.text = county.getAttribute("name"); |
|||
if (v1 == option.value) { |
|||
option.selected = true; |
|||
nodeindex = i; |
|||
} |
|||
dropElement1.add(option); |
|||
} |
|||
if (TopnodeList.length > 0) { |
|||
//城市列表
|
|||
citys = TopnodeList[nodeindex].getElementsByTagName("city") |
|||
for (var i = 0; i < citys.length; i++) { |
|||
var id = dropElement1.options[nodeindex].value; |
|||
//默认为第一个省份的城市
|
|||
province = TopnodeList[nodeindex].getElementsByTagName("city"); |
|||
var option = document.createElement("option"); |
|||
option.value = province[i] .getAttribute("name"); |
|||
option.text = province[i].getAttribute("name"); |
|||
if (v2 == option.value) { |
|||
option.selected = true; |
|||
childnodeindex = i; |
|||
} |
|||
dropElement2.add(option); |
|||
} |
|||
selectcounty(v3); |
|||
} |
|||
} |
|||
} |
|||
|
|||
/* |
|||
//依据省设置城市,县
|
|||
*/ |
|||
function selectCity() { |
|||
var dropElement1 = document.getElementById("sel-provance"); |
|||
var name = dropElement1.options[dropElement1.selectedIndex].value; |
|||
countyNodes = TopnodeList[dropElement1.selectedIndex]; |
|||
var province = document.getElementById("sel-city"); |
|||
var city = document.getElementById("sel-area"); |
|||
RemoveDropDownList(province); |
|||
RemoveDropDownList(city); |
|||
var citynodes; |
|||
var countycodes; |
|||
if (window.ActiveXObject) { |
|||
citynodes = xmlDoc.selectSingleNode('//address/province [@name="' + name + '"]').childNodes; |
|||
} else { |
|||
citynodes = countyNodes.getElementsByTagName("city") |
|||
} |
|||
if (window.ActiveXObject) { |
|||
countycodes = citynodes[0].childNodes; |
|||
} else { |
|||
countycodes = citynodes[0].getElementsByTagName("county") |
|||
} |
|||
|
|||
if (citynodes.length > 0) { |
|||
//城市
|
|||
for (var i = 0; i < citynodes.length; i++) { |
|||
var provinceNode = citynodes[i]; |
|||
var option = document.createElement("option"); |
|||
option.value = provinceNode.getAttribute("name"); |
|||
option.text = provinceNode.getAttribute("name"); |
|||
province.add(option); |
|||
} |
|||
if (countycodes.length > 0) { |
|||
//填充选择省份的第一个城市的县列表
|
|||
for (var i = 0; i < countycodes.length; i++) { |
|||
var dropElement2 = document.getElementById("sel-city"); |
|||
var dropElement3 = document.getElementById("sel-area"); |
|||
//取当天省份下第一个城市列表
|
|||
|
|||
//alert(cityNode.childNodes.length);
|
|||
var option = document.createElement("option"); |
|||
option.value = countycodes[i].getAttribute("name"); |
|||
option.text = countycodes[i].getAttribute("name"); |
|||
dropElement3.add(option); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
/* |
|||
//设置县,区
|
|||
*/ |
|||
function selectcounty(v3) { |
|||
var dropElement1 = document.getElementById("sel-provance"); |
|||
var dropElement2 = document.getElementById("sel-city"); |
|||
var name = dropElement2.options[dropElement2.selectedIndex].value; |
|||
var city = document.getElementById("sel-area"); |
|||
var countys = TopnodeList[dropElement1.selectedIndex].getElementsByTagName("city")[dropElement2.selectedIndex].getElementsByTagName("county") |
|||
RemoveDropDownList(city); |
|||
for (var i = 0; i < countys.length; i++) { |
|||
var countyNode = countys[i]; |
|||
var option = document.createElement("option"); |
|||
option.value = countyNode.getAttribute("name"); |
|||
option.text = countyNode.getAttribute("name"); |
|||
if(v3==option.value){ |
|||
option.selected=true; |
|||
} |
|||
city.add(option); |
|||
} |
|||
} |
|||
function RemoveDropDownList(obj) { |
|||
if (obj) { |
|||
var len = obj.options.length; |
|||
if (len > 0) { |
|||
for (var i = len; i >= 0; i--) { |
|||
obj.remove(i); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
/* |
|||
//读取xml文件
|
|||
*/ |
|||
function loadXmlFile(xmlFile) { |
|||
var xmlDom = null; |
|||
if (window.ActiveXObject) { |
|||
xmlDom = new ActiveXObject("Microsoft.XMLDOM"); |
|||
xmlDom.async = false; |
|||
xmlDom.load(xmlFile) || xmlDom.loadXML(xmlFile);//如果用的是XML字符串//如果用的是xml文件
|
|||
} else if (document.implementation && document.implementation.createDocument) { |
|||
var xmlhttp = new window.XMLHttpRequest(); |
|||
xmlhttp.open("GET", xmlFile, false); |
|||
xmlhttp.send(null); |
|||
xmlDom = xmlhttp.responseXML; |
|||
} else { |
|||
xmlDom = null; |
|||
} |
|||
return xmlDom; |
|||
} |
|||
@ -0,0 +1 @@ |
|||
.clockpicker-moving{cursor:move}.clockpicker-align-left.popover>.arrow{left:25px}.clockpicker-align-top.popover>.arrow{top:17px}.clockpicker-align-right.popover>.arrow{left:auto;right:25px}.clockpicker-align-bottom.popover>.arrow{top:auto;bottom:6px}.clockpicker-popover .popover-title{background-color:#fff;color:#999;font-size:24px;font-weight:700;line-height:30px;text-align:center}.clockpicker-popover .popover-content{background-color:#f8f8f8;padding:12px}.popover-content:last-child{border-bottom-left-radius:5px;border-bottom-right-radius:5px}.clockpicker-plate{background-color:#fff;border:1px solid #ccc;border-radius:50%;width:200px;height:200px;overflow:visible;position:relative;-webkit-touch-callout:none;-webkit-user-select:none;-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.clockpicker-canvas,.clockpicker-dial{width:200px;height:200px;position:absolute;left:-1px;top:-1px}.clockpicker-minutes{visibility:hidden}.clockpicker-tick{border-radius:50%;color:#666;line-height:26px;text-align:center;width:26px;height:26px;position:absolute;cursor:pointer}.clockpicker-tick.active,.clockpicker-tick:hover{background-color:rgba(0,149,221,.25)}.clockpicker-button{background-image:none;background-color:#fff;border-top-left-radius:0;border-top-right-radius:0;border-width:1px 0 0;margin:0;padding:10px 0}.clockpicker-button:hover{background-image:none;background-color:#ebebeb}.clockpicker-button:focus{outline:0!important}.clockpicker-dial{-webkit-transition:0 350ms opacity 350ms;-moz-transition:0 350ms opacity 350ms;-ms-transition:0 350ms opacity 350ms;-o-transition:0 350ms opacity 350ms;transition:transform 350ms opacity 350ms}.clockpicker-dial-out{opacity:0}.clockpicker-hours.clockpicker-dial-out{-webkit-transform:scale(1.2,1.2);-moz-transform:scale(1.2,1.2);-ms-transform:scale(1.2,1.2);-o-transform:scale(1.2,1.2);transform:scale(1.2,1.2)}.clockpicker-minutes.clockpicker-dial-out{-webkit-transform:scale(.8,.8);-moz-transform:scale(.8,.8);-ms-transform:scale(.8,.8);-o-transform:scale(.8,.8);transform:scale(.8,.8)}.clockpicker-canvas{-webkit-transition:opacity 175ms;-moz-transition:opacity 175ms;-ms-transition:opacity 175ms;-o-transition:opacity 175ms;transition:opacity 175ms}.clockpicker-canvas-out{opacity:.25}.clockpicker-canvas-bearing,.clockpicker-canvas-fg{stroke:none;fill:#0095dd}.clockpicker-canvas-bg{stroke:none;fill:#c0e5f7}.clockpicker-canvas-bg-trans{fill:rgba(0,149,221,.25)}.clockpicker-canvas line{stroke:#0095dd;stroke-width:1;stroke-linecap:round}.clockpicker-button.am-button{border:1px solid rgba(0,0,0,.2);border-radius:4px;margin:1px;padding:5px}.clockpicker-button.pm-button{border:1px solid rgba(0,0,0,.2);border-radius:4px;margin:1px 1px 1px 136px;padding:5px}.clockpicker .input-group-addon,.clockpicker-popover .popover-title span{cursor:pointer} |
|||
@ -0,0 +1,9 @@ |
|||
/*! |
|||
* Stylesheet for the Date Range Picker, for use with Bootstrap 3.x |
|||
* |
|||
* Copyright 2013 Dan Grossman ( http://www.dangrossman.info ) |
|||
* Licensed under the Apache License v2.0 |
|||
* http://www.apache.org/licenses/LICENSE-2.0 |
|||
* |
|||
* Built for http://www.improvely.com |
|||
*/.daterangepicker.dropdown-menu{max-width:none;z-index:3000}.daterangepicker.opensleft .calendar,.daterangepicker.opensleft .ranges{float:left;margin:4px}.daterangepicker.opensright .calendar,.daterangepicker.opensright .ranges{float:right;margin:4px}.daterangepicker .ranges .range_inputs>div,.daterangepicker_start_input{float:left}.daterangepicker .ranges{width:175px;text-align:left}.daterangepicker .ranges .range_inputs>div:nth-child(2){padding-left:11px}.daterangepicker .calendar{display:none;max-width:270px}.daterangepicker.show-calendar .calendar{display:block}.daterangepicker .calendar.single .calendar-date{border:none}.daterangepicker .calendar td,.daterangepicker .calendar th{font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;white-space:nowrap;text-align:center;min-width:32px}.daterangepicker .daterangepicker_end_input label,.daterangepicker .daterangepicker_start_input label{color:#333;display:block;font-size:11px;font-weight:400;height:20px;line-height:20px;margin-bottom:2px;text-shadow:#fff 1px 1px 0;text-transform:uppercase;width:74px}.daterangepicker .ranges input{font-size:11px}.daterangepicker .ranges .input-mini{background-color:#eee;border:1px solid #ccc;border-radius:4px;color:#555;display:block;font-size:11px;height:30px;line-height:30px;vertical-align:middle;margin:0 0 10px;padding:0 6px;width:82px}.daterangepicker.opensleft:after,.daterangepicker.opensleft:before,.daterangepicker.opensright:after,.daterangepicker.opensright:before{position:absolute;display:inline-block;content:''}.daterangepicker .ranges ul{list-style:none;margin:0;padding:0}.daterangepicker .ranges li{font-size:13px;background:#f5f5f5;border:1px solid #f5f5f5;color:#08c;padding:3px 12px;margin-bottom:8px;-webkit-border-radius:5px;-moz-border-radius:5px;border-radius:5px;cursor:pointer}.daterangepicker .ranges li.active,.daterangepicker .ranges li:hover{background:#08c;border:1px solid #08c;color:#fff}.daterangepicker .calendar-date{border:1px solid #ddd;padding:4px;border-radius:4px;background:#fff}.daterangepicker .calendar-time{text-align:center;margin:8px auto 0;line-height:30px}.daterangepicker{position:absolute;background:#fff;top:100px;left:20px;padding:4px;margin-top:1px;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px}.daterangepicker.opensleft:before{top:-7px;right:9px;border-right:7px solid transparent;border-bottom:7px solid #ccc;border-left:7px solid transparent;border-bottom-color:rgba(0,0,0,.2)}.daterangepicker.opensleft:after{top:-6px;right:10px;border-right:6px solid transparent;border-bottom:6px solid #fff;border-left:6px solid transparent}.daterangepicker.opensright:before{top:-7px;left:9px;border-right:7px solid transparent;border-bottom:7px solid #ccc;border-left:7px solid transparent;border-bottom-color:rgba(0,0,0,.2)}.daterangepicker.opensright:after{top:-6px;left:10px;border-right:6px solid transparent;border-bottom:6px solid #fff;border-left:6px solid transparent}.daterangepicker table{width:100%;margin:0}.daterangepicker td,.daterangepicker th{text-align:center;width:20px;height:20px;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;cursor:pointer;white-space:nowrap}.daterangepicker td.disabled,.daterangepicker td.off{color:#999}.daterangepicker td.available:hover,.daterangepicker th.available:hover{background:#eee}.daterangepicker td.in-range{background:#ebf4f8;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0}.daterangepicker td.active,.daterangepicker td.active:hover{background-color:#357ebd;border-color:#3071a9;color:#fff}.daterangepicker td.week,.daterangepicker th.week{font-size:80%;color:#ccc}.daterangepicker select.monthselect,.daterangepicker select.yearselect{font-size:12px;padding:1px;height:auto;margin:0;cursor:default}.daterangepicker select.monthselect{margin-right:2%;width:56%}.daterangepicker select.yearselect{width:40%}.daterangepicker select.ampmselect,.daterangepicker select.hourselect,.daterangepicker select.minuteselect{width:50px;margin-bottom:0}.daterangepicker_end_input{float:left;padding-left:11px}.daterangepicker th.month{width:auto} |
|||
@ -0,0 +1,29 @@ |
|||
/******************************************************************************* |
|||
* KindEditor - WYSIWYG HTML Editor for Internet |
|||
* Copyright (C) 2006-2011 kindsoft.net |
|||
* |
|||
* @author Roddy <luolonghao@gmail.com> |
|||
* @site http://www.kindsoft.net/
|
|||
* @licence http://www.kindsoft.net/license.php
|
|||
*******************************************************************************/ |
|||
|
|||
KindEditor.plugin('clearhtml', function(K) { |
|||
var self = this, name = 'clearhtml'; |
|||
self.clickToolbar(name, function() { |
|||
self.focus(); |
|||
var html = self.html(); |
|||
html = html.replace(/(<script[^>]*>)([\s\S]*?)(<\/script>)/ig, ''); |
|||
html = html.replace(/(<style[^>]*>)([\s\S]*?)(<\/style>)/ig, ''); |
|||
html = K.formatHtml(html, { |
|||
a : ['href', 'target'], |
|||
embed : ['src', 'width', 'height', 'type', 'loop', 'autostart', 'quality', '.width', '.height', 'align', 'allowscriptaccess'], |
|||
img : ['src', 'width', 'height', 'border', 'alt', 'title', '.width', '.height'], |
|||
table : ['border'], |
|||
'td,th' : ['rowspan', 'colspan'], |
|||
'div,hr,br,tbody,tr,p,ol,ul,li,blockquote,h1,h2,h3,h4,h5,h6' : [] |
|||
}); |
|||
self.html(html); |
|||
self.cmd.selection(true); |
|||
self.addBookmark(); |
|||
}); |
|||
}); |
|||
@ -0,0 +1,62 @@ |
|||
/******************************************************************************* |
|||
* KindEditor - WYSIWYG HTML Editor for Internet |
|||
* Copyright (C) 2006-2011 kindsoft.net |
|||
* |
|||
* @author Roddy <luolonghao@gmail.com> |
|||
* @site http://www.kindsoft.net/
|
|||
* @licence http://www.kindsoft.net/license.php
|
|||
*******************************************************************************/ |
|||
|
|||
// google code prettify: http://google-code-prettify.googlecode.com/
|
|||
// http://google-code-prettify.googlecode.com/
|
|||
|
|||
KindEditor.plugin('code', function(K) { |
|||
var self = this, name = 'code'; |
|||
self.clickToolbar(name, function() { |
|||
var lang = self.lang(name + '.'), |
|||
html = ['<div style="padding:10px 20px;">', |
|||
'<div class="ke-dialog-row">', |
|||
'<select class="ke-code-type">', |
|||
'<option value="js">JavaScript</option>', |
|||
'<option value="html">HTML</option>', |
|||
'<option value="css">CSS</option>', |
|||
'<option value="php">PHP</option>', |
|||
'<option value="pl">Perl</option>', |
|||
'<option value="py">Python</option>', |
|||
'<option value="rb">Ruby</option>', |
|||
'<option value="java">Java</option>', |
|||
'<option value="vb">ASP/VB</option>', |
|||
'<option value="cpp">C/C++</option>', |
|||
'<option value="cs">C#</option>', |
|||
'<option value="xml">XML</option>', |
|||
'<option value="bsh">Shell</option>', |
|||
'<option value="">Other</option>', |
|||
'</select>', |
|||
'</div>', |
|||
'<textarea class="ke-textarea" style="width:408px;height:260px;"></textarea>', |
|||
'</div>'].join(''), |
|||
dialog = self.createDialog({ |
|||
name : name, |
|||
width : 450, |
|||
title : self.lang(name), |
|||
body : html, |
|||
yesBtn : { |
|||
name : self.lang('yes'), |
|||
click : function(e) { |
|||
var type = K('.ke-code-type', dialog.div).val(), |
|||
code = textarea.val(), |
|||
cls = type === '' ? '' : ' lang-' + type, |
|||
html = '<pre class="prettyprint' + cls + '">\n' + K.escape(code) + '</pre> '; |
|||
if (K.trim(code) === '') { |
|||
alert(lang.pleaseInput); |
|||
textarea[0].focus(); |
|||
return; |
|||
} |
|||
self.insertHtml(html).hideDialog().focus(); |
|||
} |
|||
} |
|||
}), |
|||
textarea = K('textarea', dialog.div); |
|||
textarea[0].focus(); |
|||
}); |
|||
}); |
|||
|
After Width: | Height: | Size: 8.1 KiB |
@ -0,0 +1,8 @@ |
|||
<!DOCTYPE html> |
|||
<html> |
|||
<body> |
|||
<h3>Custom dialog</h3> |
|||
Input some text: <input id="content"> |
|||
<button onclick="top.tinymce.activeEditor.windowManager.getWindows()[0].close();">Close window</button> |
|||
</body> |
|||
</html> |
|||
@ -0,0 +1 @@ |
|||
.mce-object{border:1px dotted #3A3A3A;background:#d5d5d5 url(img/object.gif) no-repeat center}.mce-pagebreak{cursor:default;display:block;border:0;width:100%;height:5px;border:1px dashed #666;margin-top:15px;page-break-before:always}@media print{.mce-pagebreak{border:0px}}.mce-item-anchor{cursor:default;display:inline-block;-webkit-user-select:all;-webkit-user-modify:read-only;-moz-user-select:all;-moz-user-modify:read-only;user-select:all;user-modify:read-only;width:9px !important;height:9px !important;border:1px dotted #3A3A3A;background:#d5d5d5 url(img/anchor.gif) no-repeat center}.mce-nbsp{background:#AAA}hr{cursor:default}.mce-match-marker{background:#AAA;color:#fff}.mce-match-marker-selected{background:#3399ff;color:#fff}.mce-spellchecker-word{border-bottom:2px solid #F00;cursor:default}.mce-spellchecker-grammar{border-bottom:2px solid #008000;cursor:default}.mce-item-table,.mce-item-table td,.mce-item-table th,.mce-item-table caption{border:1px dashed #BBB}td.mce-item-selected,th.mce-item-selected{background-color:#3399ff !important}.mce-edit-focus{outline:1px dotted #333} |
|||
@ -0,0 +1 @@ |
|||
body{background-color:#FFFFFF;color:#000000;font-family:Verdana,Arial,Helvetica,sans-serif;scrollbar-3dlight-color:#F0F0EE;scrollbar-arrow-color:#676662;scrollbar-base-color:#F0F0EE;scrollbar-darkshadow-color:#DDDDDD;scrollbar-face-color:#E0E0DD;scrollbar-highlight-color:#F0F0EE;scrollbar-shadow-color:#F0F0EE;scrollbar-track-color:#F5F5F5}td,th{font-family:Verdana,Arial,Helvetica,sans-serif;font-size:11px}.mce-object{border:1px dotted #3A3A3A;background:#d5d5d5 url(img/object.gif) no-repeat center}.mce-pagebreak{cursor:default;display:block;border:0;width:100%;height:5px;border:1px dashed #666;margin-top:15px;page-break-before:always}@media print{.mce-pagebreak{border:0px}}.mce-item-anchor{cursor:default;display:inline-block;-webkit-user-select:all;-webkit-user-modify:read-only;-moz-user-select:all;-moz-user-modify:read-only;user-select:all;user-modify:read-only;width:9px !important;height:9px !important;border:1px dotted #3A3A3A;background:#d5d5d5 url(img/anchor.gif) no-repeat center}.mce-nbsp{background:#AAA}hr{cursor:default}.mce-match-marker{background:#AAA;color:#fff}.mce-match-marker-selected{background:#3399ff;color:#fff}.mce-spellchecker-word{border-bottom:2px solid #F00;cursor:default}.mce-spellchecker-grammar{border-bottom:2px solid #008000;cursor:default}.mce-item-table,.mce-item-table td,.mce-item-table th,.mce-item-table caption{border:1px dashed #BBB}td.mce-item-selected,th.mce-item-selected{background-color:#3399ff !important}.mce-edit-focus{outline:1px dotted #333} |
|||
@ -0,0 +1,65 @@ |
|||
/* |
|||
* 图表配置文件 |
|||
* */ |
|||
|
|||
|
|||
//不同类型的配置
|
|||
var typeConfig = [ |
|||
{ |
|||
chart: { |
|||
type: 'line' |
|||
}, |
|||
plotOptions: { |
|||
line: { |
|||
dataLabels: { |
|||
enabled: false |
|||
}, |
|||
enableMouseTracking: true |
|||
} |
|||
} |
|||
}, { |
|||
chart: { |
|||
type: 'line' |
|||
}, |
|||
plotOptions: { |
|||
line: { |
|||
dataLabels: { |
|||
enabled: true |
|||
}, |
|||
enableMouseTracking: false |
|||
} |
|||
} |
|||
}, { |
|||
chart: { |
|||
type: 'area' |
|||
} |
|||
}, { |
|||
chart: { |
|||
type: 'bar' |
|||
} |
|||
}, { |
|||
chart: { |
|||
type: 'column' |
|||
} |
|||
}, { |
|||
chart: { |
|||
plotBackgroundColor: null, |
|||
plotBorderWidth: null, |
|||
plotShadow: false |
|||
}, |
|||
plotOptions: { |
|||
pie: { |
|||
allowPointSelect: true, |
|||
cursor: 'pointer', |
|||
dataLabels: { |
|||
enabled: true, |
|||
color: '#000000', |
|||
connectorColor: '#000000', |
|||
formatter: function() { |
|||
return '<b>'+ this.point.name +'</b>: '+ ( Math.round( this.point.percentage*100 ) / 100 ) +' %'; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||
]; |
|||
@ -0,0 +1 @@ |
|||
body,html{width:100%;height:100%;margin:0;padding:0;overflow-x:hidden}.main{width:100%;overflow:hidden}.table-view{height:100%;float:left;margin:20px;width:40%}.table-view .table-container{width:100%;margin-bottom:50px;overflow:scroll}.table-view th{padding:5px 10px;background-color:#F7F7F7}.table-view td{width:50px;text-align:center;padding:0}.table-container input{width:40px;padding:5px;border:none;outline:0}.table-view caption{font-size:18px;text-align:left}.charts-view{width:50%;margin-left:49%;height:400px}.charts-container{border-left:1px solid #c3c3c3}.charts-format fieldset{padding-left:20px;margin-bottom:50px}.charts-format legend{padding-left:10px;padding-right:10px}.format-item-container{padding:20px}.format-item-container label{display:block;margin:10px 0}.charts-format .data-item{border:1px solid #000;outline:0;padding:2px 3px}.charts-type{margin-top:50px;height:300px}.scroll-view{border:1px solid #c3c3c3;border-left:none;border-right:none;overflow:hidden}.scroll-container{margin:20px;width:100%;overflow:hidden}.scroll-bed{width:10000px;-webkit-transition:margin-left .5s ease;-moz-transition:margin-left .5s ease;transition:margin-left .5s ease}.view-box{display:inline-block;margin-right:20px;border:2px solid #fff;line-height:0;overflow:hidden;cursor:pointer}.view-box img{border:1px solid #cecece}.view-box.selected{border-color:#7274A7}.button-container{margin-bottom:20px;text-align:center}.button-container a{display:inline-block;width:100px;height:25px;line-height:25px;border:1px solid #c2ccd1;margin-right:30px;text-decoration:none;color:#000;-webkit-border-radius:2px;-moz-border-radius:2px;border-radius:2px}.button-container a:HOVER{background:#fcfcfc}.button-container a:ACTIVE{border-top-color:#c2ccd1;box-shadow:inset 0 5px 4px -4px rgba(49,49,64,.1)}.edui-charts-not-data{height:100px;line-height:100px;text-align:center} |
|||
@ -0,0 +1,89 @@ |
|||
<!DOCTYPE html> |
|||
<html> |
|||
<head> |
|||
<title>chart</title> |
|||
<meta chartset="utf-8"> |
|||
<link rel="stylesheet" type="text/css" href="charts.css"> |
|||
<script type="text/javascript" src="../internal.js"></script> |
|||
</head> |
|||
<body> |
|||
<div class="main"> |
|||
<div class="table-view"> |
|||
<h3><var id="lang_data_source"></var></h3> |
|||
<div id="tableContainer" class="table-container"></div> |
|||
<h3><var id="lang_chart_format"></var></h3> |
|||
<form name="data-form"> |
|||
<div class="charts-format"> |
|||
<fieldset> |
|||
<legend><var id="lang_data_align"></var></legend> |
|||
<div class="format-item-container"> |
|||
<label> |
|||
<input type="radio" class="format-ctrl not-pie-item" name="charts-format" value="1" checked="checked"> |
|||
<var id="lang_chart_align_same"></var> |
|||
</label> |
|||
<label> |
|||
<input type="radio" class="format-ctrl not-pie-item" name="charts-format" value="-1"> |
|||
<var id="lang_chart_align_reverse"></var> |
|||
</label> |
|||
<br> |
|||
</div> |
|||
</fieldset> |
|||
<fieldset> |
|||
<legend><var id="lang_chart_title"></var></legend> |
|||
<div class="format-item-container"> |
|||
<label> |
|||
<var id="lang_chart_main_title"></var><input type="text" name="title" class="data-item"> |
|||
</label> |
|||
<label> |
|||
<var id="lang_chart_sub_title"></var><input type="text" name="sub-title" class="data-item not-pie-item"> |
|||
</label> |
|||
<label> |
|||
<var id="lang_chart_x_title"></var><input type="text" name="x-title" class="data-item not-pie-item"> |
|||
</label> |
|||
<label> |
|||
<var id="lang_chart_y_title"></var><input type="text" name="y-title" class="data-item not-pie-item"> |
|||
</label> |
|||
</div> |
|||
</fieldset> |
|||
<fieldset> |
|||
<legend><var id="lang_chart_tip"></var></legend> |
|||
<div class="format-item-container"> |
|||
<label> |
|||
<var id="lang_cahrt_tip_prefix"></var> |
|||
<input type="text" id="tipInput" name="tip" class="data-item" disabled="disabled"> |
|||
</label> |
|||
<p><var id="lang_cahrt_tip_description"></var></p> |
|||
</div> |
|||
</fieldset> |
|||
<fieldset> |
|||
<legend><var id="lang_chart_data_unit"></var></legend> |
|||
<div class="format-item-container"> |
|||
<label><var id="lang_chart_data_unit_title"></var><input type="text" name="unit" class="data-item"></label> |
|||
<p><var id="lang_chart_data_unit_description"></var></p> |
|||
</div> |
|||
</fieldset> |
|||
</div> |
|||
</form> |
|||
</div> |
|||
<div class="charts-view"> |
|||
<div id="chartsContainer" class="charts-container"></div> |
|||
<div id="chartsType" class="charts-type"> |
|||
<h3><var id="lang_chart_type"></var></h3> |
|||
<div class="scroll-view"> |
|||
<div class="scroll-container"> |
|||
<div id="scrollBed" class="scroll-bed"></div> |
|||
</div> |
|||
<div id="buttonContainer" class="button-container"> |
|||
<a href="#" data-title="prev"><var id="lang_prev_btn"></var></a> |
|||
<a href="#" data-title="next"><var id="lang_next_btn"></var></a> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
</div> |
|||
<script src="../../third-party/jquery-1.10.2.min.js"></script> |
|||
<script src="../../third-party/highcharts/highcharts.js"></script> |
|||
<script src="chart.config.js"></script> |
|||
<script src="charts.js"></script> |
|||
</body> |
|||
</html> |
|||
@ -0,0 +1,519 @@ |
|||
/* |
|||
* 图片转换对话框脚本 |
|||
**/ |
|||
|
|||
var tableData = [], |
|||
//编辑器页面table
|
|||
editorTable = null, |
|||
chartsConfig = window.typeConfig, |
|||
resizeTimer = null, |
|||
//初始默认图表类型
|
|||
currentChartType = 0; |
|||
|
|||
window.onload = function () { |
|||
|
|||
editorTable = domUtils.findParentByTagName( editor.selection.getRange().startContainer, 'table', true); |
|||
|
|||
//未找到表格, 显示错误页面
|
|||
if ( !editorTable ) { |
|||
document.body.innerHTML = "<div class='edui-charts-not-data'>未找到数据</div>"; |
|||
return; |
|||
} |
|||
|
|||
//初始化图表类型选择
|
|||
initChartsTypeView(); |
|||
renderTable( editorTable ); |
|||
initEvent(); |
|||
initUserConfig( editorTable.getAttribute( "data-chart" ) ); |
|||
$( "#scrollBed .view-box:eq("+ currentChartType +")" ).trigger( "click" ); |
|||
updateViewType( currentChartType ); |
|||
|
|||
dialog.addListener( "resize", function () { |
|||
|
|||
if ( resizeTimer != null ) { |
|||
window.clearTimeout( resizeTimer ); |
|||
} |
|||
|
|||
resizeTimer = window.setTimeout( function () { |
|||
|
|||
resizeTimer = null; |
|||
|
|||
renderCharts(); |
|||
|
|||
}, 500 ); |
|||
|
|||
} ); |
|||
|
|||
}; |
|||
|
|||
function initChartsTypeView () { |
|||
|
|||
var contents = []; |
|||
|
|||
for ( var i = 0, len = chartsConfig.length; i<len; i++ ) { |
|||
|
|||
contents.push( '<div class="view-box" data-chart-type="'+ i +'"><img width="300" src="images/charts'+ i +'.png"></div>' ); |
|||
|
|||
} |
|||
|
|||
$( "#scrollBed" ).html( contents.join( "" ) ); |
|||
|
|||
} |
|||
|
|||
//渲染table, 以便用户修改数据
|
|||
function renderTable ( table ) { |
|||
|
|||
var tableHtml = []; |
|||
|
|||
//构造数据
|
|||
for ( var i = 0, row; row = table.rows[ i ]; i++ ) { |
|||
|
|||
tableData[ i ] = []; |
|||
tableHtml[ i ] = []; |
|||
|
|||
for ( var j = 0, cell; cell = row.cells[ j ]; j++ ) { |
|||
|
|||
var value = getCellValue( cell ); |
|||
|
|||
if ( i > 0 && j > 0 ) { |
|||
value = +value; |
|||
} |
|||
|
|||
if ( i === 0 || j === 0 ) { |
|||
tableHtml[ i ].push( '<th>'+ value +'</th>' ); |
|||
} else { |
|||
tableHtml[ i ].push( '<td><input type="text" class="data-item" value="'+ value +'"></td>' ); |
|||
} |
|||
|
|||
tableData[ i ][ j ] = value; |
|||
|
|||
} |
|||
|
|||
tableHtml[ i ] = tableHtml[ i ].join( "" ); |
|||
|
|||
} |
|||
|
|||
//draw 表格
|
|||
$( "#tableContainer" ).html( '<table id="showTable" border="1"><tbody><tr>'+ tableHtml.join( "</tr><tr>" ) +'</tr></tbody></table>' ); |
|||
|
|||
} |
|||
|
|||
/* |
|||
* 根据表格已有的图表属性初始化当前图表属性 |
|||
*/ |
|||
function initUserConfig ( config ) { |
|||
|
|||
var parsedConfig = {}; |
|||
|
|||
if ( !config ) { |
|||
return; |
|||
} |
|||
|
|||
config = config.split( ";" ); |
|||
|
|||
$.each( config, function ( index, item ) { |
|||
|
|||
item = item.split( ":" ); |
|||
parsedConfig[ item[ 0 ] ] = item[ 1 ]; |
|||
|
|||
} ); |
|||
|
|||
setUserConfig( parsedConfig ); |
|||
|
|||
} |
|||
|
|||
function initEvent () { |
|||
|
|||
var cacheValue = null, |
|||
//图表类型数
|
|||
typeViewCount = chartsConfig.length- 1, |
|||
$chartsTypeViewBox = $( '#scrollBed .view-box' ); |
|||
|
|||
$( ".charts-format" ).delegate( ".format-ctrl", "change", function () { |
|||
|
|||
renderCharts(); |
|||
|
|||
} ) |
|||
|
|||
$( ".table-view" ).delegate( ".data-item", "focus", function () { |
|||
|
|||
cacheValue = this.value; |
|||
|
|||
} ).delegate( ".data-item", "blur", function () { |
|||
|
|||
if ( this.value !== cacheValue ) { |
|||
renderCharts(); |
|||
} |
|||
|
|||
cacheValue = null; |
|||
|
|||
} ); |
|||
|
|||
$( "#buttonContainer" ).delegate( "a", "click", function (e) { |
|||
|
|||
e.preventDefault(); |
|||
|
|||
if ( this.getAttribute( "data-title" ) === 'prev' ) { |
|||
|
|||
if ( currentChartType > 0 ) { |
|||
currentChartType--; |
|||
updateViewType( currentChartType ); |
|||
} |
|||
|
|||
} else { |
|||
|
|||
if ( currentChartType < typeViewCount ) { |
|||
currentChartType++; |
|||
updateViewType( currentChartType ); |
|||
} |
|||
|
|||
} |
|||
|
|||
} ); |
|||
|
|||
//图表类型变化
|
|||
$( '#scrollBed' ).delegate( ".view-box", "click", function (e) { |
|||
|
|||
var index = $( this ).attr( "data-chart-type" ); |
|||
$chartsTypeViewBox.removeClass( "selected" ); |
|||
$( $chartsTypeViewBox[ index ] ).addClass( "selected" ); |
|||
|
|||
currentChartType = index | 0; |
|||
|
|||
//饼图, 禁用部分配置
|
|||
if ( currentChartType === chartsConfig.length - 1 ) { |
|||
|
|||
disableNotPieConfig(); |
|||
|
|||
//启用完整配置
|
|||
} else { |
|||
|
|||
enableNotPieConfig(); |
|||
|
|||
} |
|||
|
|||
renderCharts(); |
|||
|
|||
} ); |
|||
|
|||
} |
|||
|
|||
function renderCharts () { |
|||
|
|||
var data = collectData(); |
|||
|
|||
$('#chartsContainer').highcharts( $.extend( {}, chartsConfig[ currentChartType ], { |
|||
|
|||
credits: { |
|||
enabled: false |
|||
}, |
|||
exporting: { |
|||
enabled: false |
|||
}, |
|||
title: { |
|||
text: data.title, |
|||
x: -20 //center
|
|||
}, |
|||
subtitle: { |
|||
text: data.subTitle, |
|||
x: -20 |
|||
}, |
|||
xAxis: { |
|||
title: { |
|||
text: data.xTitle |
|||
}, |
|||
categories: data.categories |
|||
}, |
|||
yAxis: { |
|||
title: { |
|||
text: data.yTitle |
|||
}, |
|||
plotLines: [{ |
|||
value: 0, |
|||
width: 1, |
|||
color: '#808080' |
|||
}] |
|||
}, |
|||
tooltip: { |
|||
enabled: true, |
|||
valueSuffix: data.suffix |
|||
}, |
|||
legend: { |
|||
layout: 'vertical', |
|||
align: 'right', |
|||
verticalAlign: 'middle', |
|||
borderWidth: 1 |
|||
}, |
|||
series: data.series |
|||
|
|||
} )); |
|||
|
|||
} |
|||
|
|||
function updateViewType ( index ) { |
|||
|
|||
$( "#scrollBed" ).css( 'marginLeft', -index*324+'px' ); |
|||
|
|||
} |
|||
|
|||
function collectData () { |
|||
|
|||
var form = document.forms[ 'data-form' ], |
|||
data = null; |
|||
|
|||
if ( currentChartType !== chartsConfig.length - 1 ) { |
|||
|
|||
data = getSeriesAndCategories(); |
|||
$.extend( data, getUserConfig() ); |
|||
|
|||
//饼图数据格式
|
|||
} else { |
|||
data = getSeriesForPieChart(); |
|||
data.title = form[ 'title' ].value; |
|||
data.suffix = form[ 'unit' ].value; |
|||
} |
|||
|
|||
return data; |
|||
|
|||
} |
|||
|
|||
/** |
|||
* 获取用户配置信息 |
|||
*/ |
|||
function getUserConfig () { |
|||
|
|||
var form = document.forms[ 'data-form' ], |
|||
info = { |
|||
title: form[ 'title' ].value, |
|||
subTitle: form[ 'sub-title' ].value, |
|||
xTitle: form[ 'x-title' ].value, |
|||
yTitle: form[ 'y-title' ].value, |
|||
suffix: form[ 'unit' ].value, |
|||
//数据对齐方式
|
|||
tableDataFormat: getTableDataFormat (), |
|||
//饼图提示文字
|
|||
tip: $( "#tipInput" ).val() |
|||
}; |
|||
|
|||
return info; |
|||
|
|||
} |
|||
|
|||
function setUserConfig ( config ) { |
|||
|
|||
var form = document.forms[ 'data-form' ]; |
|||
|
|||
config.title && ( form[ 'title' ].value = config.title ); |
|||
config.subTitle && ( form[ 'sub-title' ].value = config.subTitle ); |
|||
config.xTitle && ( form[ 'x-title' ].value = config.xTitle ); |
|||
config.yTitle && ( form[ 'y-title' ].value = config.yTitle ); |
|||
config.suffix && ( form[ 'unit' ].value = config.suffix ); |
|||
config.dataFormat == "-1" && ( form[ 'charts-format' ][ 1 ].checked = true ); |
|||
config.tip && ( form[ 'tip' ].value = config.tip ); |
|||
currentChartType = config.chartType || 0; |
|||
|
|||
} |
|||
|
|||
function getSeriesAndCategories () { |
|||
|
|||
var form = document.forms[ 'data-form' ], |
|||
series = [], |
|||
categories = [], |
|||
tmp = [], |
|||
tableData = getTableData(); |
|||
|
|||
//反转数据
|
|||
if ( getTableDataFormat() === "-1" ) { |
|||
|
|||
for ( var i = 0, len = tableData.length; i < len; i++ ) { |
|||
|
|||
for ( var j = 0, jlen = tableData[ i ].length; j < jlen; j++ ) { |
|||
|
|||
if ( !tmp[ j ] ) { |
|||
tmp[ j ] = []; |
|||
} |
|||
|
|||
tmp[ j ][ i ] = tableData[ i ][ j ]; |
|||
|
|||
} |
|||
|
|||
} |
|||
|
|||
tableData = tmp; |
|||
|
|||
} |
|||
|
|||
categories = tableData[0].slice( 1 ); |
|||
|
|||
for ( var i = 1, data; data = tableData[ i ]; i++ ) { |
|||
|
|||
series.push( { |
|||
name: data[ 0 ], |
|||
data: data.slice( 1 ) |
|||
} ); |
|||
|
|||
} |
|||
|
|||
return { |
|||
series: series, |
|||
categories: categories |
|||
}; |
|||
|
|||
} |
|||
|
|||
/* |
|||
* 获取数据源数据对齐方式 |
|||
*/ |
|||
function getTableDataFormat () { |
|||
|
|||
var form = document.forms[ 'data-form' ], |
|||
items = form['charts-format']; |
|||
|
|||
return items[ 0 ].checked ? items[ 0 ].value : items[ 1 ].value; |
|||
|
|||
} |
|||
|
|||
/* |
|||
* 禁用非饼图类型的配置项 |
|||
*/ |
|||
function disableNotPieConfig() { |
|||
|
|||
updateConfigItem( 'disable' ); |
|||
|
|||
} |
|||
|
|||
/* |
|||
* 启用非饼图类型的配置项 |
|||
*/ |
|||
function enableNotPieConfig() { |
|||
|
|||
updateConfigItem( 'enable' ); |
|||
|
|||
} |
|||
|
|||
function updateConfigItem ( value ) { |
|||
|
|||
var table = $( "#showTable" )[ 0 ], |
|||
isDisable = value === 'disable' ? true : false; |
|||
|
|||
//table中的input处理
|
|||
for ( var i = 2 , row; row = table.rows[ i ]; i++ ) { |
|||
|
|||
for ( var j = 1, cell; cell = row.cells[ j ]; j++ ) { |
|||
|
|||
$( "input", cell ).attr( "disabled", isDisable ); |
|||
|
|||
} |
|||
|
|||
} |
|||
|
|||
//其他项处理
|
|||
$( "input.not-pie-item" ).attr( "disabled", isDisable ); |
|||
$( "#tipInput" ).attr( "disabled", !isDisable ) |
|||
|
|||
} |
|||
|
|||
/* |
|||
* 获取饼图数据 |
|||
* 饼图的数据只取第一行的 |
|||
**/ |
|||
function getSeriesForPieChart () { |
|||
|
|||
var series = { |
|||
type: 'pie', |
|||
name: $("#tipInput").val(), |
|||
data: [] |
|||
}, |
|||
tableData = getTableData(); |
|||
|
|||
|
|||
for ( var j = 1, jlen = tableData[ 0 ].length; j < jlen; j++ ) { |
|||
|
|||
var title = tableData[ 0 ][ j ], |
|||
val = tableData[ 1 ][ j ]; |
|||
|
|||
series.data.push( [ title, val ] ); |
|||
|
|||
} |
|||
|
|||
return { |
|||
series: [ series ] |
|||
}; |
|||
|
|||
} |
|||
|
|||
function getTableData () { |
|||
|
|||
var table = document.getElementById( "showTable" ), |
|||
xCount = table.rows[0].cells.length - 1, |
|||
values = getTableInputValue(); |
|||
|
|||
for ( var i = 0, value; value = values[ i ]; i++ ) { |
|||
|
|||
tableData[ Math.floor( i / xCount ) + 1 ][ i % xCount + 1 ] = values[ i ]; |
|||
|
|||
} |
|||
|
|||
return tableData; |
|||
|
|||
} |
|||
|
|||
function getTableInputValue () { |
|||
|
|||
var table = document.getElementById( "showTable" ), |
|||
inputs = table.getElementsByTagName( "input" ), |
|||
values = []; |
|||
|
|||
for ( var i = 0, input; input = inputs[ i ]; i++ ) { |
|||
values.push( input.value | 0 ); |
|||
} |
|||
|
|||
return values; |
|||
|
|||
} |
|||
|
|||
function getCellValue ( cell ) { |
|||
|
|||
var value = utils.trim( ( cell.innerText || cell.textContent || '' ) ); |
|||
|
|||
return value.replace( new RegExp( UE.dom.domUtils.fillChar, 'g' ), '' ).replace( /^\s+|\s+$/g, '' ); |
|||
|
|||
} |
|||
|
|||
|
|||
//dialog确认事件
|
|||
dialog.onok = function () { |
|||
|
|||
//收集信息
|
|||
var form = document.forms[ 'data-form' ], |
|||
info = getUserConfig(); |
|||
|
|||
//添加图表类型
|
|||
info.chartType = currentChartType; |
|||
|
|||
//同步表格数据到编辑器
|
|||
syncTableData(); |
|||
|
|||
//执行图表命令
|
|||
editor.execCommand( 'charts', info ); |
|||
|
|||
}; |
|||
|
|||
/* |
|||
* 同步图表编辑视图的表格数据到编辑器里的原始表格 |
|||
*/ |
|||
function syncTableData () { |
|||
|
|||
var tableData = getTableData(); |
|||
|
|||
for ( var i = 1, row; row = editorTable.rows[ i ]; i++ ) { |
|||
|
|||
for ( var j = 1, cell; cell = row.cells[ j ]; j++ ) { |
|||
|
|||
cell.innerHTML = tableData[ i ] [ j ]; |
|||
|
|||
} |
|||
|
|||
} |
|||
|
|||
} |
|||
|
After Width: | Height: | Size: 25 KiB |
|
After Width: | Height: | Size: 19 KiB |
|
After Width: | Height: | Size: 22 KiB |
|
After Width: | Height: | Size: 7.6 KiB |
|
After Width: | Height: | Size: 8.1 KiB |
|
After Width: | Height: | Size: 46 KiB |
|
After Width: | Height: | Size: 8.4 KiB |
|
After Width: | Height: | Size: 516 B |
|
After Width: | Height: | Size: 578 B |
@ -0,0 +1,42 @@ |
|||
/** |
|||
* Created with JetBrains PhpStorm. |
|||
* User: xuheng |
|||
* Date: 12-8-8 |
|||
* Time: 下午2:00 |
|||
* To change this template use File | Settings | File Templates. |
|||
*/ |
|||
var templates = [ |
|||
{ |
|||
"pre":"pre0.png", |
|||
'title':lang.blank, |
|||
'preHtml':'<p class="ue_t"> 欢迎使用UEditor!</p>', |
|||
"html":'<p class="ue_t">欢迎使用UEditor!</p>' |
|||
|
|||
}, |
|||
{ |
|||
"pre":"pre1.png", |
|||
'title':lang.blog, |
|||
'preHtml':'<h1 label="Title center" name="tc" style="border-bottom-color:#cccccc;border-bottom-width:2px;border-bottom-style:solid;padding:0px 4px 0px 0px;text-align:center;margin:0px 0px 20px;"><span style="color:#c0504d;">深入理解Range</span></h1><p style="text-align:center;"><strong class=" ">UEditor二次开发</strong></p><h3><span class=" " style="font-family:幼圆">什么是Range</span></h3><p style="text-indent:2em;">对于“插入”选项卡上的库,在设计时都充分考虑了其中的项与文档整体外观的协调性。 </p><br /><h3><span class=" " style="font-family:幼圆">Range能干什么</span></h3><p style="text-indent:2em;">在“开始”选项卡上,通过从快速样式库中为所选文本选择一种外观,您可以方便地更改文档中所选文本的格式。</p>', |
|||
"html":'<h1 class="ue_t" label="Title center" name="tc" style="border-bottom-color:#cccccc;border-bottom-width:2px;border-bottom-style:solid;padding:0px 4px 0px 0px;text-align:center;margin:0px 0px 20px;"><span style="color:#c0504d;">[键入文档标题]</span></h1><p style="text-align:center;"><strong class="ue_t">[键入文档副标题]</strong></p><h3><span class="ue_t" style="font-family:幼圆">[标题 1]</span></h3><p class="ue_t" style="text-indent:2em;">对于“插入”选项卡上的库,在设计时都充分考虑了其中的项与文档整体外观的协调性。 您可以使用这些库来插入表格、页眉、页脚、列表、封面以及其他文档构建基块。 您创建的图片、图表或关系图也将与当前的文档外观协调一致。</p><h3><span class="ue_t" style="font-family:幼圆">[标题 2]</span></h3><p class="ue_t" style="text-indent:2em;">在“开始”选项卡上,通过从快速样式库中为所选文本选择一种外观,您可以方便地更改文档中所选文本的格式。 您还可以使用“开始”选项卡上的其他控件来直接设置文本格式。大多数控件都允许您选择是使用当前主题外观,还是使用某种直接指定的格式。 </p><h3><span class="ue_t" style="font-family:幼圆">[标题 3]</span></h3><p class="ue_t">对于“插入”选项卡上的库,在设计时都充分考虑了其中的项与文档整体外观的协调性。 您可以使用这些库来插入表格、页眉、页脚、列表、封面以及其他文档构建基块。 您创建的图片、图表或关系图也将与当前的文档外观协调一致。</p><p class="ue_t"><br /></p>' |
|||
|
|||
}, |
|||
{ |
|||
"pre":"pre2.png", |
|||
'title':lang.resume, |
|||
'preHtml':'<h1 label="Title left" name="tl" style="border-bottom-color:#cccccc;border-bottom-width:2px;border-bottom-style:solid;padding:0px 4px 0px 0px;margin:0px 0px 10px;"><span style="color:#e36c09;" class=" ">WEB前端开发简历</span></h1><table width="100%" border="1" bordercolor="#95B3D7" style="border-collapse:collapse;"><tbody><tr><td width="100" style="text-align:center;"><p><span style="background-color:transparent;">插</span><br /></p><p>入</p><p>照</p><p>片</p></td><td><p><span style="background-color:transparent;"> 联系电话:</span><span class="ue_t" style="background-color:transparent;">[键入您的电话]</span><br /></p><p><span style="background-color:transparent;"> 电子邮件:</span><span class="ue_t" style="background-color:transparent;">[键入您的电子邮件地址]</span><br /></p><p><span style="background-color:transparent;"> 家庭住址:</span><span class="ue_t" style="background-color:transparent;">[键入您的地址]</span><br /></p></td></tr></tbody></table><h3><span style="color:#E36C09;font-size:20px;">目标职位</span></h3><p style="text-indent:2em;" class=" ">WEB前端研发工程师</p><h3><span style="color:#e36c09;font-size:20px;">学历</span></h3><p><span style="display:none;line-height:0px;" id="_baidu_bookmark_start_26"></span></p><ol style="list-style-type:decimal;"><li><p><span class="ue_t">[起止时间]</span> <span class="ue_t">[学校名称] </span> <span class="ue_t">[所学专业]</span> <span class="ue_t">[所获学位]</span></p></li></ol><h3><span style="color:#e36c09;font-size:20px;" class="ue_t">工作经验</span></h3><p><br /></p>', |
|||
"html":'<h1 label="Title left" name="tl" style="border-bottom-color:#cccccc;border-bottom-width:2px;border-bottom-style:solid;padding:0px 4px 0px 0px;margin:0px 0px 10px;"><span style="color:#e36c09;" class="ue_t">[此处键入简历标题]</span></h1><p><span style="color:#e36c09;"><br /></span></p><table width="100%" border="1" bordercolor="#95B3D7" style="border-collapse:collapse;"><tbody><tr><td width="200" style="text-align:center;" class="ue_t">【此处插入照片】</td><td><p><br /></p><p> 联系电话:<span class="ue_t">[键入您的电话]</span></p><p><br /></p><p> 电子邮件:<span class="ue_t">[键入您的电子邮件地址]</span></p><p><br /></p><p> 家庭住址:<span class="ue_t">[键入您的地址]</span></p><p><br /></p></td></tr></tbody></table><h3><span style="color:#e36c09;font-size:20px;">目标职位</span></h3><p style="text-indent:2em;" class="ue_t">[此处键入您的期望职位]</p><h3><span style="color:#e36c09;font-size:20px;">学历</span></h3><p><span style="display:none;line-height:0px;" id="_baidu_bookmark_start_26"></span></p><ol style="list-style-type:decimal;"><li><p><span class="ue_t">[键入起止时间]</span> <span class="ue_t">[键入学校名称] </span> <span class="ue_t">[键入所学专业]</span> <span class="ue_t">[键入所获学位]</span></p></li><li><p><span class="ue_t">[键入起止时间]</span> <span class="ue_t">[键入学校名称]</span> <span class="ue_t">[键入所学专业]</span> <span class="ue_t">[键入所获学位]</span></p></li></ol><h3><span style="color:#e36c09;font-size:20px;" class="ue_t">工作经验</span></h3><ol style="list-style-type:decimal;"><li><p><span class="ue_t">[键入起止时间]</span> <span class="ue_t">[键入公司名称]</span> <span class="ue_t">[键入职位名称]</span> </p></li><ol style="list-style-type:lower-alpha;"><li><p><span class="ue_t">[键入负责项目]</span> <span class="ue_t">[键入项目简介]</span></p></li><li><p><span class="ue_t">[键入负责项目]</span> <span class="ue_t">[键入项目简介]</span></p></li></ol><li><p><span class="ue_t">[键入起止时间]</span> <span class="ue_t">[键入公司名称]</span> <span class="ue_t">[键入职位名称]</span> </p></li><ol style="list-style-type:lower-alpha;"><li><p><span class="ue_t">[键入负责项目]</span> <span class="ue_t">[键入项目简介]</span></p></li></ol></ol><p><span style="color:#e36c09;font-size:20px;">掌握技能</span></p><p style="text-indent:2em;"> <span class="ue_t">[这里可以键入您所掌握的技能]</span><br /></p>' |
|||
|
|||
}, |
|||
{ |
|||
"pre":"pre3.png", |
|||
'title':lang.richText, |
|||
'preHtml':'<h1 label="Title center" name="tc" style="border-bottom-color:#cccccc;border-bottom-width:2px;border-bottom-style:solid;padding:0px 4px 0px 0px;text-align:center;margin:0px 0px 20px;" class="ue_t">[此处键入文章标题]</h1><p><img src="http://img.baidu.com/hi/youa/y_0034.gif" width="150" height="100" border="0" hspace="0" vspace="0" style="width:150px;height:100px;float:left;" />图文混排方法</p><p>图片居左,文字围绕图片排版</p><p>方法:在文字前面插入图片,设置居左对齐,然后即可在右边输入多行文</p><p><br /></p><p><img src="http://img.baidu.com/hi/youa/y_0040.gif" width="100" height="100" border="0" hspace="0" vspace="0" style="width:100px;height:100px;float:right;" /></p><p>还有没有什么其他的环绕方式呢?这里是居右环绕</p><p><br /></p><p>欢迎大家多多尝试,为UEditor提供更多高质量模板!</p>', |
|||
"html":'<p><br /></p><h1 label="Title center" name="tc" style="border-bottom-color:#cccccc;border-bottom-width:2px;border-bottom-style:solid;padding:0px 4px 0px 0px;text-align:center;margin:0px 0px 20px;" class="ue_t">[此处键入文章标题]</h1><p><img src="http://img.baidu.com/hi/youa/y_0034.gif" width="300" height="200" border="0" hspace="0" vspace="0" style="width:300px;height:200px;float:left;" />图文混排方法</p><p>1. 图片居左,文字围绕图片排版</p><p>方法:在文字前面插入图片,设置居左对齐,然后即可在右边输入多行文本</p><p><br /></p><p>2. 图片居右,文字围绕图片排版</p><p>方法:在文字前面插入图片,设置居右对齐,然后即可在左边输入多行文本</p><p><br /></p><p>3. 图片居中环绕排版</p><p>方法:亲,这个真心没有办法。。。</p><p><br /></p><p><br /></p><p><img src="http://img.baidu.com/hi/youa/y_0040.gif" width="300" height="300" border="0" hspace="0" vspace="0" style="width:300px;height:300px;float:right;" /></p><p>还有没有什么其他的环绕方式呢?这里是居右环绕</p><p><br /></p><p>欢迎大家多多尝试,为UEditor提供更多高质量模板!</p><p><br /></p><p>占位</p><p><br /></p><p>占位</p><p><br /></p><p>占位</p><p><br /></p><p>占位</p><p><br /></p><p>占位</p><p><br /></p><p><br /></p>' |
|||
}, |
|||
{ |
|||
"pre":"pre4.png", |
|||
'title':lang.sciPapers, |
|||
'preHtml':'<h2 style="border-bottom-color:#cccccc;border-bottom-width:2px;border-bottom-style:solid;padding:0px 4px 0px 0px;margin:0px 0px 10px;text-align:center;" class="ue_t">[键入文章标题]</h2><p><strong><span style="font-size:12px;">摘要</span></strong><span style="font-size:12px;" class="ue_t">:这里可以输入很长很长很长很长很长很长很长很长很差的摘要</span></p><p style="line-height:1.5em;"><strong>标题 1</strong></p><p style="text-indent:2em;"><span style="font-size:14px;" class="ue_t">这里可以输入很多内容,可以图文混排,可以有列表等。</span></p><p style="line-height:1.5em;"><strong>标题 2</strong></p><ol style="list-style-type:lower-alpha;"><li><p class="ue_t">列表 1</p></li><li><p class="ue_t">列表 2</p></li><ol style="list-style-type:lower-roman;"><li><p class="ue_t">多级列表 1</p></li><li><p class="ue_t">多级列表 2</p></li></ol><li><p class="ue_t">列表 3<br /></p></li></ol><p style="line-height:1.5em;"><strong>标题 3</strong></p><p style="text-indent:2em;"><span style="font-size:14px;" class="ue_t">来个文字图文混排的</span></p><p style="text-indent:2em;"><br /></p>', |
|||
'html':'<h2 style="border-bottom-color:#cccccc;border-bottom-width:2px;border-bottom-style:solid;padding:0px 4px 0px 0px;margin:0px 0px 10px;text-align:center;" class="ue_t">[键入文章标题]</h2><p><strong><span style="font-size:12px;">摘要</span></strong><span style="font-size:12px;" class="ue_t">:这里可以输入很长很长很长很长很长很长很长很长很差的摘要</span></p><p style="line-height:1.5em;"><strong>标题 1</strong></p><p style="text-indent:2em;"><span style="font-size:14px;" class="ue_t">这里可以输入很多内容,可以图文混排,可以有列表等。</span></p><p style="line-height:1.5em;"><strong>标题 2</strong></p><p style="text-indent:2em;"><span style="font-size:14px;" class="ue_t">来个列表瞅瞅:</span></p><ol style="list-style-type:lower-alpha;"><li><p class="ue_t">列表 1</p></li><li><p class="ue_t">列表 2</p></li><ol style="list-style-type:lower-roman;"><li><p class="ue_t">多级列表 1</p></li><li><p class="ue_t">多级列表 2</p></li></ol><li><p class="ue_t">列表 3<br /></p></li></ol><p style="line-height:1.5em;"><strong>标题 3</strong></p><p style="text-indent:2em;"><span style="font-size:14px;" class="ue_t">来个文字图文混排的</span></p><p style="text-indent:2em;"><span style="font-size:14px;" class="ue_t">这里可以多行</span></p><p style="text-indent:2em;"><span style="font-size:14px;" class="ue_t">右边是图片</span></p><p style="text-indent:2em;"><span style="font-size:14px;" class="ue_t">绝对没有问题的,不信你也可以试试看</span></p><p><br /></p>' |
|||
} |
|||
]; |
|||
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 649 B |
|
After Width: | Height: | Size: 664 B |
|
After Width: | Height: | Size: 4.2 KiB |
@ -0,0 +1 @@ |
|||
.tabbody,.tabhead{position:relative}a,abbr,acronym,address,applet,b,big,blockquote,body,caption,center,cite,code,dd,del,dfn,div,dl,dt,em,fieldset,font,form,h1,h2,h3,h4,h5,h6,html,i,iframe,img,ins,kbd,label,legend,li,object,ol,p,pre,q,s,samp,small,span,strike,strong,sub,sup,table,tbody,td,tfoot,th,thead,tr,tt,u,ul,var{margin:0;padding:0;outline:0;font-size:100%}body{line-height:1;background-color:#fff;font:12px/1.5 sans-serif,"宋体","Arial Narrow",HELVETICA;color:#646464}ol,ul{list-style:none}blockquote,q{quotes:none}ins{text-decoration:none}del{text-decoration:line-through}table{border-collapse:collapse;border-spacing:0}.tabhead{z-index:10}.tabhead span{display:inline-block;padding:0 5px;height:30px;border:1px solid #ccc;background:url(images/dialog-title-bg.png) repeat-x;text-align:center;line-height:30px;cursor:pointer}.tabhead span.focus{height:31px;border-bottom:none;background:#fff}.tabbody{top:-1px;margin:0 auto;border:1px solid #ccc}a.button{display:block;text-align:center;line-height:24px;text-decoration:none;height:24px;width:95px;border:0;color:#838383;background:url(../../themes/default/images/icons-all.gif) no-repeat}a.button:hover{background-position:0 -30px} |
|||
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 518 B |
|
After Width: | Height: | Size: 253 B |
|
After Width: | Height: | Size: 175 B |
|
After Width: | Height: | Size: 370 B |
|
After Width: | Height: | Size: 177 B |
|
After Width: | Height: | Size: 938 B |
@ -0,0 +1 @@ |
|||
span.cm-em,span.cm-emstrong{font-style:italic}.CodeMirror{line-height:1em;font-family:monospace}.CodeMirror-scroll{overflow:auto;height:300px;position:relative}.CodeMirror-gutter{position:absolute;left:0;top:0;z-index:10;background-color:#f7f7f7;border-right:1px solid #eee;min-width:2em;height:100%}.CodeMirror-gutter-text{color:#aaa;text-align:right;padding:.4em .2em .4em .4em;white-space:pre!important}.CodeMirror-lines{padding:.4em}.CodeMirror pre{-moz-border-radius:0;-webkit-border-radius:0;-o-border-radius:0;border-radius:0;border-width:0;background:0 0;font-family:inherit;font-size:inherit;padding:0;margin:0;white-space:pre;word-wrap:normal}.CodeMirror-wrap pre{word-wrap:break-word;white-space:pre-wrap}.CodeMirror-wrap .CodeMirror-scroll{overflow-x:hidden}.CodeMirror textarea{outline:0!important}.CodeMirror pre.CodeMirror-cursor{z-index:10;position:absolute;visibility:hidden;border-left:1px solid #000}.CodeMirror-focused pre.CodeMirror-cursor{visibility:visible}span.CodeMirror-selected{background:#d9d9d9}.CodeMirror-focused span.CodeMirror-selected{background:#d2dcf8}.CodeMirror-searching{background:#ffa}.cm-s-default span.cm-keyword{color:#708}.cm-s-default span.cm-atom{color:#219}.cm-s-default span.cm-number{color:#164}.cm-s-default span.cm-def{color:#00f}.cm-s-default span.cm-variable{color:#000}.cm-s-default span.cm-variable-2{color:#05a}.cm-s-default span.cm-variable-3{color:#085}.cm-s-default span.cm-operator,.cm-s-default span.cm-property{color:#000}.cm-s-default span.cm-comment{color:#a50}.cm-s-default span.cm-string{color:#a11}.cm-s-default span.cm-string-2{color:#f50}.cm-s-default span.cm-meta{color:#555}.cm-s-default span.cm-error{color:red}.cm-s-default span.cm-qualifier{color:#555}.cm-s-default span.cm-builtin{color:#30a}.cm-s-default span.cm-bracket{color:#cc7}.cm-s-default span.cm-tag{color:#170}.cm-s-default span.cm-attribute{color:#00c}.cm-s-default span.cm-header{color:#a0a}.cm-s-default span.cm-quote{color:#090}.cm-s-default span.cm-hr{color:#999}.cm-s-default span.cm-link{color:#00c}span.cm-header,span.cm-strong{font-weight:700}span.cm-emstrong{font-weight:700}span.cm-link{text-decoration:underline}div.CodeMirror span.CodeMirror-matchingbracket{color:#0f0}div.CodeMirror span.CodeMirror-nonmatchingbracket{color:#f22} |
|||
@ -0,0 +1,133 @@ |
|||
/* |
|||
A class to parse color values |
|||
@author Stoyan Stefanov <sstoo@gmail.com> |
|||
@link http://www.phpied.com/rgb-color-parser-in-javascript/
|
|||
Use it if you like it |
|||
|
|||
canvg.js - Javascript SVG parser and renderer on Canvas |
|||
MIT Licensed |
|||
Gabe Lerner (gabelerner@gmail.com) |
|||
http://code.google.com/p/canvg/
|
|||
|
|||
Requires: rgbcolor.js - http://www.phpied.com/rgb-color-parser-in-javascript/
|
|||
|
|||
Highcharts JS v3.0.6 (2013-10-04) |
|||
CanVGRenderer Extension module |
|||
|
|||
(c) 2011-2012 Torstein Hønsi, Erik Olsson |
|||
|
|||
License: www.highcharts.com/license |
|||
*/ |
|||
function RGBColor(m){this.ok=!1;m.charAt(0)=="#"&&(m=m.substr(1,6));var m=m.replace(/ /g,""),m=m.toLowerCase(),a={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"00ffff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000000",blanchedalmond:"ffebcd",blue:"0000ff",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"00ffff",darkblue:"00008b", |
|||
darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dodgerblue:"1e90ff",feldspar:"d19275",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"ff00ff", |
|||
gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgrey:"d3d3d3",lightgreen:"90ee90",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa", |
|||
lightslateblue:"8470ff",lightslategray:"778899",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"00ff00",limegreen:"32cd32",linen:"faf0e6",magenta:"ff00ff",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370d8",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080", |
|||
oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"d87093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",red:"ff0000",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd", |
|||
slategray:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",violetred:"d02090",wheat:"f5deb3",white:"ffffff",whitesmoke:"f5f5f5",yellow:"ffff00",yellowgreen:"9acd32"},c;for(c in a)m==c&&(m=a[c]);var d=[{re:/^rgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)$/,example:["rgb(123, 234, 45)","rgb(255,234,245)"],process:function(b){return[parseInt(b[1]),parseInt(b[2]),parseInt(b[3])]}},{re:/^(\w{2})(\w{2})(\w{2})$/, |
|||
example:["#00ff00","336699"],process:function(b){return[parseInt(b[1],16),parseInt(b[2],16),parseInt(b[3],16)]}},{re:/^(\w{1})(\w{1})(\w{1})$/,example:["#fb0","f0f"],process:function(b){return[parseInt(b[1]+b[1],16),parseInt(b[2]+b[2],16),parseInt(b[3]+b[3],16)]}}];for(c=0;c<d.length;c++){var b=d[c].process,k=d[c].re.exec(m);if(k)channels=b(k),this.r=channels[0],this.g=channels[1],this.b=channels[2],this.ok=!0}this.r=this.r<0||isNaN(this.r)?0:this.r>255?255:this.r;this.g=this.g<0||isNaN(this.g)?0: |
|||
this.g>255?255:this.g;this.b=this.b<0||isNaN(this.b)?0:this.b>255?255:this.b;this.toRGB=function(){return"rgb("+this.r+", "+this.g+", "+this.b+")"};this.toHex=function(){var b=this.r.toString(16),a=this.g.toString(16),d=this.b.toString(16);b.length==1&&(b="0"+b);a.length==1&&(a="0"+a);d.length==1&&(d="0"+d);return"#"+b+a+d};this.getHelpXML=function(){for(var b=[],k=0;k<d.length;k++)for(var c=d[k].example,j=0;j<c.length;j++)b[b.length]=c[j];for(var h in a)b[b.length]=h;c=document.createElement("ul"); |
|||
c.setAttribute("id","rgbcolor-examples");for(k=0;k<b.length;k++)try{var l=document.createElement("li"),o=new RGBColor(b[k]),n=document.createElement("div");n.style.cssText="margin: 3px; border: 1px solid black; background:"+o.toHex()+"; color:"+o.toHex();n.appendChild(document.createTextNode("test"));var q=document.createTextNode(" "+b[k]+" -> "+o.toRGB()+" -> "+o.toHex());l.appendChild(n);l.appendChild(q);c.appendChild(l)}catch(p){}return c}} |
|||
if(!window.console)window.console={},window.console.log=function(){},window.console.dir=function(){};if(!Array.prototype.indexOf)Array.prototype.indexOf=function(m){for(var a=0;a<this.length;a++)if(this[a]==m)return a;return-1}; |
|||
(function(){function m(){var a={FRAMERATE:30,MAX_VIRTUAL_PIXELS:3E4};a.init=function(c){a.Definitions={};a.Styles={};a.Animations=[];a.Images=[];a.ctx=c;a.ViewPort=new function(){this.viewPorts=[];this.Clear=function(){this.viewPorts=[]};this.SetCurrent=function(a,b){this.viewPorts.push({width:a,height:b})};this.RemoveCurrent=function(){this.viewPorts.pop()};this.Current=function(){return this.viewPorts[this.viewPorts.length-1]};this.width=function(){return this.Current().width};this.height=function(){return this.Current().height}; |
|||
this.ComputeSize=function(a){return a!=null&&typeof a=="number"?a:a=="x"?this.width():a=="y"?this.height():Math.sqrt(Math.pow(this.width(),2)+Math.pow(this.height(),2))/Math.sqrt(2)}}};a.init();a.ImagesLoaded=function(){for(var c=0;c<a.Images.length;c++)if(!a.Images[c].loaded)return!1;return!0};a.trim=function(a){return a.replace(/^\s+|\s+$/g,"")};a.compressSpaces=function(a){return a.replace(/[\s\r\t\n]+/gm," ")};a.ajax=function(a){var d;return(d=window.XMLHttpRequest?new XMLHttpRequest:new ActiveXObject("Microsoft.XMLHTTP"))? |
|||
(d.open("GET",a,!1),d.send(null),d.responseText):null};a.parseXml=function(a){if(window.DOMParser)return(new DOMParser).parseFromString(a,"text/xml");else{var a=a.replace(/<!DOCTYPE svg[^>]*>/,""),d=new ActiveXObject("Microsoft.XMLDOM");d.async="false";d.loadXML(a);return d}};a.Property=function(c,d){this.name=c;this.value=d;this.hasValue=function(){return this.value!=null&&this.value!==""};this.numValue=function(){if(!this.hasValue())return 0;var b=parseFloat(this.value);(this.value+"").match(/%$/)&& |
|||
(b/=100);return b};this.valueOrDefault=function(b){return this.hasValue()?this.value:b};this.numValueOrDefault=function(b){return this.hasValue()?this.numValue():b};var b=this;this.Color={addOpacity:function(d){var c=b.value;if(d!=null&&d!=""){var f=new RGBColor(b.value);f.ok&&(c="rgba("+f.r+", "+f.g+", "+f.b+", "+d+")")}return new a.Property(b.name,c)}};this.Definition={getDefinition:function(){var d=b.value.replace(/^(url\()?#([^\)]+)\)?$/,"$2");return a.Definitions[d]},isUrl:function(){return b.value.indexOf("url(")== |
|||
0},getFillStyle:function(b){var d=this.getDefinition();return d!=null&&d.createGradient?d.createGradient(a.ctx,b):d!=null&&d.createPattern?d.createPattern(a.ctx,b):null}};this.Length={DPI:function(){return 96},EM:function(b){var d=12,c=new a.Property("fontSize",a.Font.Parse(a.ctx.font).fontSize);c.hasValue()&&(d=c.Length.toPixels(b));return d},toPixels:function(d){if(!b.hasValue())return 0;var c=b.value+"";return c.match(/em$/)?b.numValue()*this.EM(d):c.match(/ex$/)?b.numValue()*this.EM(d)/2:c.match(/px$/)? |
|||
b.numValue():c.match(/pt$/)?b.numValue()*1.25:c.match(/pc$/)?b.numValue()*15:c.match(/cm$/)?b.numValue()*this.DPI(d)/2.54:c.match(/mm$/)?b.numValue()*this.DPI(d)/25.4:c.match(/in$/)?b.numValue()*this.DPI(d):c.match(/%$/)?b.numValue()*a.ViewPort.ComputeSize(d):b.numValue()}};this.Time={toMilliseconds:function(){if(!b.hasValue())return 0;var a=b.value+"";if(a.match(/s$/))return b.numValue()*1E3;a.match(/ms$/);return b.numValue()}};this.Angle={toRadians:function(){if(!b.hasValue())return 0;var a=b.value+ |
|||
"";return a.match(/deg$/)?b.numValue()*(Math.PI/180):a.match(/grad$/)?b.numValue()*(Math.PI/200):a.match(/rad$/)?b.numValue():b.numValue()*(Math.PI/180)}}};a.Font=new function(){this.Styles=["normal","italic","oblique","inherit"];this.Variants=["normal","small-caps","inherit"];this.Weights="normal,bold,bolder,lighter,100,200,300,400,500,600,700,800,900,inherit".split(",");this.CreateFont=function(d,b,c,e,f,g){g=g!=null?this.Parse(g):this.CreateFont("","","","","",a.ctx.font);return{fontFamily:f|| |
|||
g.fontFamily,fontSize:e||g.fontSize,fontStyle:d||g.fontStyle,fontWeight:c||g.fontWeight,fontVariant:b||g.fontVariant,toString:function(){return[this.fontStyle,this.fontVariant,this.fontWeight,this.fontSize,this.fontFamily].join(" ")}}};var c=this;this.Parse=function(d){for(var b={},d=a.trim(a.compressSpaces(d||"")).split(" "),k=!1,e=!1,f=!1,g=!1,j="",h=0;h<d.length;h++)if(!e&&c.Styles.indexOf(d[h])!=-1){if(d[h]!="inherit")b.fontStyle=d[h];e=!0}else if(!g&&c.Variants.indexOf(d[h])!=-1){if(d[h]!="inherit")b.fontVariant= |
|||
d[h];e=g=!0}else if(!f&&c.Weights.indexOf(d[h])!=-1){if(d[h]!="inherit")b.fontWeight=d[h];e=g=f=!0}else if(k)d[h]!="inherit"&&(j+=d[h]);else{if(d[h]!="inherit")b.fontSize=d[h].split("/")[0];e=g=f=k=!0}if(j!="")b.fontFamily=j;return b}};a.ToNumberArray=function(c){for(var c=a.trim(a.compressSpaces((c||"").replace(/,/g," "))).split(" "),d=0;d<c.length;d++)c[d]=parseFloat(c[d]);return c};a.Point=function(a,d){this.x=a;this.y=d;this.angleTo=function(b){return Math.atan2(b.y-this.y,b.x-this.x)};this.applyTransform= |
|||
function(b){var a=this.x*b[1]+this.y*b[3]+b[5];this.x=this.x*b[0]+this.y*b[2]+b[4];this.y=a}};a.CreatePoint=function(c){c=a.ToNumberArray(c);return new a.Point(c[0],c[1])};a.CreatePath=function(c){for(var c=a.ToNumberArray(c),d=[],b=0;b<c.length;b+=2)d.push(new a.Point(c[b],c[b+1]));return d};a.BoundingBox=function(a,d,b,k){this.y2=this.x2=this.y1=this.x1=Number.NaN;this.x=function(){return this.x1};this.y=function(){return this.y1};this.width=function(){return this.x2-this.x1};this.height=function(){return this.y2- |
|||
this.y1};this.addPoint=function(b,a){if(b!=null){if(isNaN(this.x1)||isNaN(this.x2))this.x2=this.x1=b;if(b<this.x1)this.x1=b;if(b>this.x2)this.x2=b}if(a!=null){if(isNaN(this.y1)||isNaN(this.y2))this.y2=this.y1=a;if(a<this.y1)this.y1=a;if(a>this.y2)this.y2=a}};this.addX=function(b){this.addPoint(b,null)};this.addY=function(b){this.addPoint(null,b)};this.addBoundingBox=function(b){this.addPoint(b.x1,b.y1);this.addPoint(b.x2,b.y2)};this.addQuadraticCurve=function(b,a,d,c,k,l){d=b+2/3*(d-b);c=a+2/3*(c- |
|||
a);this.addBezierCurve(b,a,d,d+1/3*(k-b),c,c+1/3*(l-a),k,l)};this.addBezierCurve=function(b,a,d,c,k,l,o,n){var q=[b,a],p=[d,c],t=[k,l],m=[o,n];this.addPoint(q[0],q[1]);this.addPoint(m[0],m[1]);for(i=0;i<=1;i++)b=function(b){return Math.pow(1-b,3)*q[i]+3*Math.pow(1-b,2)*b*p[i]+3*(1-b)*Math.pow(b,2)*t[i]+Math.pow(b,3)*m[i]},a=6*q[i]-12*p[i]+6*t[i],d=-3*q[i]+9*p[i]-9*t[i]+3*m[i],c=3*p[i]-3*q[i],d==0?a!=0&&(a=-c/a,0<a&&a<1&&(i==0&&this.addX(b(a)),i==1&&this.addY(b(a)))):(c=Math.pow(a,2)-4*c*d,c<0||(k= |
|||
(-a+Math.sqrt(c))/(2*d),0<k&&k<1&&(i==0&&this.addX(b(k)),i==1&&this.addY(b(k))),a=(-a-Math.sqrt(c))/(2*d),0<a&&a<1&&(i==0&&this.addX(b(a)),i==1&&this.addY(b(a)))))};this.isPointInBox=function(b,a){return this.x1<=b&&b<=this.x2&&this.y1<=a&&a<=this.y2};this.addPoint(a,d);this.addPoint(b,k)};a.Transform=function(c){var d=this;this.Type={};this.Type.translate=function(b){this.p=a.CreatePoint(b);this.apply=function(b){b.translate(this.p.x||0,this.p.y||0)};this.applyToPoint=function(b){b.applyTransform([1, |
|||
0,0,1,this.p.x||0,this.p.y||0])}};this.Type.rotate=function(b){b=a.ToNumberArray(b);this.angle=new a.Property("angle",b[0]);this.cx=b[1]||0;this.cy=b[2]||0;this.apply=function(b){b.translate(this.cx,this.cy);b.rotate(this.angle.Angle.toRadians());b.translate(-this.cx,-this.cy)};this.applyToPoint=function(b){var a=this.angle.Angle.toRadians();b.applyTransform([1,0,0,1,this.p.x||0,this.p.y||0]);b.applyTransform([Math.cos(a),Math.sin(a),-Math.sin(a),Math.cos(a),0,0]);b.applyTransform([1,0,0,1,-this.p.x|| |
|||
0,-this.p.y||0])}};this.Type.scale=function(b){this.p=a.CreatePoint(b);this.apply=function(b){b.scale(this.p.x||1,this.p.y||this.p.x||1)};this.applyToPoint=function(b){b.applyTransform([this.p.x||0,0,0,this.p.y||0,0,0])}};this.Type.matrix=function(b){this.m=a.ToNumberArray(b);this.apply=function(b){b.transform(this.m[0],this.m[1],this.m[2],this.m[3],this.m[4],this.m[5])};this.applyToPoint=function(b){b.applyTransform(this.m)}};this.Type.SkewBase=function(b){this.base=d.Type.matrix;this.base(b);this.angle= |
|||
new a.Property("angle",b)};this.Type.SkewBase.prototype=new this.Type.matrix;this.Type.skewX=function(b){this.base=d.Type.SkewBase;this.base(b);this.m=[1,0,Math.tan(this.angle.Angle.toRadians()),1,0,0]};this.Type.skewX.prototype=new this.Type.SkewBase;this.Type.skewY=function(b){this.base=d.Type.SkewBase;this.base(b);this.m=[1,Math.tan(this.angle.Angle.toRadians()),0,1,0,0]};this.Type.skewY.prototype=new this.Type.SkewBase;this.transforms=[];this.apply=function(b){for(var a=0;a<this.transforms.length;a++)this.transforms[a].apply(b)}; |
|||
this.applyToPoint=function(b){for(var a=0;a<this.transforms.length;a++)this.transforms[a].applyToPoint(b)};for(var c=a.trim(a.compressSpaces(c)).split(/\s(?=[a-z])/),b=0;b<c.length;b++){var k=c[b].split("(")[0],e=c[b].split("(")[1].replace(")","");this.transforms.push(new this.Type[k](e))}};a.AspectRatio=function(c,d,b,k,e,f,g,j,h,l){var d=a.compressSpaces(d),d=d.replace(/^defer\s/,""),o=d.split(" ")[0]||"xMidYMid",d=d.split(" ")[1]||"meet",n=b/k,q=e/f,p=Math.min(n,q),m=Math.max(n,q);d=="meet"&&(k*= |
|||
p,f*=p);d=="slice"&&(k*=m,f*=m);h=new a.Property("refX",h);l=new a.Property("refY",l);h.hasValue()&&l.hasValue()?c.translate(-p*h.Length.toPixels("x"),-p*l.Length.toPixels("y")):(o.match(/^xMid/)&&(d=="meet"&&p==q||d=="slice"&&m==q)&&c.translate(b/2-k/2,0),o.match(/YMid$/)&&(d=="meet"&&p==n||d=="slice"&&m==n)&&c.translate(0,e/2-f/2),o.match(/^xMax/)&&(d=="meet"&&p==q||d=="slice"&&m==q)&&c.translate(b-k,0),o.match(/YMax$/)&&(d=="meet"&&p==n||d=="slice"&&m==n)&&c.translate(0,e-f));o=="none"?c.scale(n, |
|||
q):d=="meet"?c.scale(p,p):d=="slice"&&c.scale(m,m);c.translate(g==null?0:-g,j==null?0:-j)};a.Element={};a.Element.ElementBase=function(c){this.attributes={};this.styles={};this.children=[];this.attribute=function(b,d){var c=this.attributes[b];if(c!=null)return c;c=new a.Property(b,"");d==!0&&(this.attributes[b]=c);return c};this.style=function(b,d){var c=this.styles[b];if(c!=null)return c;c=this.attribute(b);if(c!=null&&c.hasValue())return c;c=this.parent;if(c!=null&&(c=c.style(b),c!=null&&c.hasValue()))return c; |
|||
c=new a.Property(b,"");d==!0&&(this.styles[b]=c);return c};this.render=function(b){if(this.style("display").value!="none"&&this.attribute("visibility").value!="hidden"){b.save();this.setContext(b);if(this.attribute("mask").hasValue()){var a=this.attribute("mask").Definition.getDefinition();a!=null&&a.apply(b,this)}else this.style("filter").hasValue()?(a=this.style("filter").Definition.getDefinition(),a!=null&&a.apply(b,this)):this.renderChildren(b);this.clearContext(b);b.restore()}};this.setContext= |
|||
function(){};this.clearContext=function(){};this.renderChildren=function(b){for(var a=0;a<this.children.length;a++)this.children[a].render(b)};this.addChild=function(b,d){var c=b;d&&(c=a.CreateElement(b));c.parent=this;this.children.push(c)};if(c!=null&&c.nodeType==1){for(var d=0;d<c.childNodes.length;d++){var b=c.childNodes[d];b.nodeType==1&&this.addChild(b,!0)}for(d=0;d<c.attributes.length;d++)b=c.attributes[d],this.attributes[b.nodeName]=new a.Property(b.nodeName,b.nodeValue);b=a.Styles[c.nodeName]; |
|||
if(b!=null)for(var k in b)this.styles[k]=b[k];if(this.attribute("class").hasValue())for(var d=a.compressSpaces(this.attribute("class").value).split(" "),e=0;e<d.length;e++){b=a.Styles["."+d[e]];if(b!=null)for(k in b)this.styles[k]=b[k];b=a.Styles[c.nodeName+"."+d[e]];if(b!=null)for(k in b)this.styles[k]=b[k]}if(this.attribute("style").hasValue()){b=this.attribute("style").value.split(";");for(d=0;d<b.length;d++)a.trim(b[d])!=""&&(c=b[d].split(":"),k=a.trim(c[0]),c=a.trim(c[1]),this.styles[k]=new a.Property(k, |
|||
c))}this.attribute("id").hasValue()&&a.Definitions[this.attribute("id").value]==null&&(a.Definitions[this.attribute("id").value]=this)}};a.Element.RenderedElementBase=function(c){this.base=a.Element.ElementBase;this.base(c);this.setContext=function(d){if(this.style("fill").Definition.isUrl()){var b=this.style("fill").Definition.getFillStyle(this);if(b!=null)d.fillStyle=b}else if(this.style("fill").hasValue())b=this.style("fill"),this.style("fill-opacity").hasValue()&&(b=b.Color.addOpacity(this.style("fill-opacity").value)), |
|||
d.fillStyle=b.value=="none"?"rgba(0,0,0,0)":b.value;if(this.style("stroke").Definition.isUrl()){if(b=this.style("stroke").Definition.getFillStyle(this),b!=null)d.strokeStyle=b}else if(this.style("stroke").hasValue())b=this.style("stroke"),this.style("stroke-opacity").hasValue()&&(b=b.Color.addOpacity(this.style("stroke-opacity").value)),d.strokeStyle=b.value=="none"?"rgba(0,0,0,0)":b.value;if(this.style("stroke-width").hasValue())d.lineWidth=this.style("stroke-width").Length.toPixels();if(this.style("stroke-linecap").hasValue())d.lineCap= |
|||
this.style("stroke-linecap").value;if(this.style("stroke-linejoin").hasValue())d.lineJoin=this.style("stroke-linejoin").value;if(this.style("stroke-miterlimit").hasValue())d.miterLimit=this.style("stroke-miterlimit").value;if(typeof d.font!="undefined")d.font=a.Font.CreateFont(this.style("font-style").value,this.style("font-variant").value,this.style("font-weight").value,this.style("font-size").hasValue()?this.style("font-size").Length.toPixels()+"px":"",this.style("font-family").value).toString(); |
|||
this.attribute("transform").hasValue()&&(new a.Transform(this.attribute("transform").value)).apply(d);this.attribute("clip-path").hasValue()&&(b=this.attribute("clip-path").Definition.getDefinition(),b!=null&&b.apply(d));if(this.style("opacity").hasValue())d.globalAlpha=this.style("opacity").numValue()}};a.Element.RenderedElementBase.prototype=new a.Element.ElementBase;a.Element.PathElementBase=function(c){this.base=a.Element.RenderedElementBase;this.base(c);this.path=function(d){d!=null&&d.beginPath(); |
|||
return new a.BoundingBox};this.renderChildren=function(d){this.path(d);a.Mouse.checkPath(this,d);d.fillStyle!=""&&d.fill();d.strokeStyle!=""&&d.stroke();var b=this.getMarkers();if(b!=null){if(this.style("marker-start").Definition.isUrl()){var c=this.style("marker-start").Definition.getDefinition();c.render(d,b[0][0],b[0][1])}if(this.style("marker-mid").Definition.isUrl())for(var c=this.style("marker-mid").Definition.getDefinition(),e=1;e<b.length-1;e++)c.render(d,b[e][0],b[e][1]);this.style("marker-end").Definition.isUrl()&& |
|||
(c=this.style("marker-end").Definition.getDefinition(),c.render(d,b[b.length-1][0],b[b.length-1][1]))}};this.getBoundingBox=function(){return this.path()};this.getMarkers=function(){return null}};a.Element.PathElementBase.prototype=new a.Element.RenderedElementBase;a.Element.svg=function(c){this.base=a.Element.RenderedElementBase;this.base(c);this.baseClearContext=this.clearContext;this.clearContext=function(d){this.baseClearContext(d);a.ViewPort.RemoveCurrent()};this.baseSetContext=this.setContext; |
|||
this.setContext=function(d){d.strokeStyle="rgba(0,0,0,0)";d.lineCap="butt";d.lineJoin="miter";d.miterLimit=4;this.baseSetContext(d);this.attribute("x").hasValue()&&this.attribute("y").hasValue()&&d.translate(this.attribute("x").Length.toPixels("x"),this.attribute("y").Length.toPixels("y"));var b=a.ViewPort.width(),c=a.ViewPort.height();if(typeof this.root=="undefined"&&this.attribute("width").hasValue()&&this.attribute("height").hasValue()){var b=this.attribute("width").Length.toPixels("x"),c=this.attribute("height").Length.toPixels("y"), |
|||
e=0,f=0;this.attribute("refX").hasValue()&&this.attribute("refY").hasValue()&&(e=-this.attribute("refX").Length.toPixels("x"),f=-this.attribute("refY").Length.toPixels("y"));d.beginPath();d.moveTo(e,f);d.lineTo(b,f);d.lineTo(b,c);d.lineTo(e,c);d.closePath();d.clip()}a.ViewPort.SetCurrent(b,c);if(this.attribute("viewBox").hasValue()){var e=a.ToNumberArray(this.attribute("viewBox").value),f=e[0],g=e[1],b=e[2],c=e[3];a.AspectRatio(d,this.attribute("preserveAspectRatio").value,a.ViewPort.width(),b,a.ViewPort.height(), |
|||
c,f,g,this.attribute("refX").value,this.attribute("refY").value);a.ViewPort.RemoveCurrent();a.ViewPort.SetCurrent(e[2],e[3])}}};a.Element.svg.prototype=new a.Element.RenderedElementBase;a.Element.rect=function(c){this.base=a.Element.PathElementBase;this.base(c);this.path=function(d){var b=this.attribute("x").Length.toPixels("x"),c=this.attribute("y").Length.toPixels("y"),e=this.attribute("width").Length.toPixels("x"),f=this.attribute("height").Length.toPixels("y"),g=this.attribute("rx").Length.toPixels("x"), |
|||
j=this.attribute("ry").Length.toPixels("y");this.attribute("rx").hasValue()&&!this.attribute("ry").hasValue()&&(j=g);this.attribute("ry").hasValue()&&!this.attribute("rx").hasValue()&&(g=j);d!=null&&(d.beginPath(),d.moveTo(b+g,c),d.lineTo(b+e-g,c),d.quadraticCurveTo(b+e,c,b+e,c+j),d.lineTo(b+e,c+f-j),d.quadraticCurveTo(b+e,c+f,b+e-g,c+f),d.lineTo(b+g,c+f),d.quadraticCurveTo(b,c+f,b,c+f-j),d.lineTo(b,c+j),d.quadraticCurveTo(b,c,b+g,c),d.closePath());return new a.BoundingBox(b,c,b+e,c+f)}};a.Element.rect.prototype= |
|||
new a.Element.PathElementBase;a.Element.circle=function(c){this.base=a.Element.PathElementBase;this.base(c);this.path=function(d){var b=this.attribute("cx").Length.toPixels("x"),c=this.attribute("cy").Length.toPixels("y"),e=this.attribute("r").Length.toPixels();d!=null&&(d.beginPath(),d.arc(b,c,e,0,Math.PI*2,!0),d.closePath());return new a.BoundingBox(b-e,c-e,b+e,c+e)}};a.Element.circle.prototype=new a.Element.PathElementBase;a.Element.ellipse=function(c){this.base=a.Element.PathElementBase;this.base(c); |
|||
this.path=function(d){var b=4*((Math.sqrt(2)-1)/3),c=this.attribute("rx").Length.toPixels("x"),e=this.attribute("ry").Length.toPixels("y"),f=this.attribute("cx").Length.toPixels("x"),g=this.attribute("cy").Length.toPixels("y");d!=null&&(d.beginPath(),d.moveTo(f,g-e),d.bezierCurveTo(f+b*c,g-e,f+c,g-b*e,f+c,g),d.bezierCurveTo(f+c,g+b*e,f+b*c,g+e,f,g+e),d.bezierCurveTo(f-b*c,g+e,f-c,g+b*e,f-c,g),d.bezierCurveTo(f-c,g-b*e,f-b*c,g-e,f,g-e),d.closePath());return new a.BoundingBox(f-c,g-e,f+c,g+e)}};a.Element.ellipse.prototype= |
|||
new a.Element.PathElementBase;a.Element.line=function(c){this.base=a.Element.PathElementBase;this.base(c);this.getPoints=function(){return[new a.Point(this.attribute("x1").Length.toPixels("x"),this.attribute("y1").Length.toPixels("y")),new a.Point(this.attribute("x2").Length.toPixels("x"),this.attribute("y2").Length.toPixels("y"))]};this.path=function(d){var b=this.getPoints();d!=null&&(d.beginPath(),d.moveTo(b[0].x,b[0].y),d.lineTo(b[1].x,b[1].y));return new a.BoundingBox(b[0].x,b[0].y,b[1].x,b[1].y)}; |
|||
this.getMarkers=function(){var a=this.getPoints(),b=a[0].angleTo(a[1]);return[[a[0],b],[a[1],b]]}};a.Element.line.prototype=new a.Element.PathElementBase;a.Element.polyline=function(c){this.base=a.Element.PathElementBase;this.base(c);this.points=a.CreatePath(this.attribute("points").value);this.path=function(d){var b=new a.BoundingBox(this.points[0].x,this.points[0].y);d!=null&&(d.beginPath(),d.moveTo(this.points[0].x,this.points[0].y));for(var c=1;c<this.points.length;c++)b.addPoint(this.points[c].x, |
|||
this.points[c].y),d!=null&&d.lineTo(this.points[c].x,this.points[c].y);return b};this.getMarkers=function(){for(var a=[],b=0;b<this.points.length-1;b++)a.push([this.points[b],this.points[b].angleTo(this.points[b+1])]);a.push([this.points[this.points.length-1],a[a.length-1][1]]);return a}};a.Element.polyline.prototype=new a.Element.PathElementBase;a.Element.polygon=function(c){this.base=a.Element.polyline;this.base(c);this.basePath=this.path;this.path=function(a){var b=this.basePath(a);a!=null&&(a.lineTo(this.points[0].x, |
|||
this.points[0].y),a.closePath());return b}};a.Element.polygon.prototype=new a.Element.polyline;a.Element.path=function(c){this.base=a.Element.PathElementBase;this.base(c);c=this.attribute("d").value;c=c.replace(/,/gm," ");c=c.replace(/([MmZzLlHhVvCcSsQqTtAa])([MmZzLlHhVvCcSsQqTtAa])/gm,"$1 $2");c=c.replace(/([MmZzLlHhVvCcSsQqTtAa])([MmZzLlHhVvCcSsQqTtAa])/gm,"$1 $2");c=c.replace(/([MmZzLlHhVvCcSsQqTtAa])([^\s])/gm,"$1 $2");c=c.replace(/([^\s])([MmZzLlHhVvCcSsQqTtAa])/gm,"$1 $2");c=c.replace(/([0-9])([+\-])/gm, |
|||
"$1 $2");c=c.replace(/(\.[0-9]*)(\.)/gm,"$1 $2");c=c.replace(/([Aa](\s+[0-9]+){3})\s+([01])\s*([01])/gm,"$1 $3 $4 ");c=a.compressSpaces(c);c=a.trim(c);this.PathParser=new function(d){this.tokens=d.split(" ");this.reset=function(){this.i=-1;this.previousCommand=this.command="";this.start=new a.Point(0,0);this.control=new a.Point(0,0);this.current=new a.Point(0,0);this.points=[];this.angles=[]};this.isEnd=function(){return this.i>=this.tokens.length-1};this.isCommandOrEnd=function(){return this.isEnd()? |
|||
!0:this.tokens[this.i+1].match(/^[A-Za-z]$/)!=null};this.isRelativeCommand=function(){return this.command==this.command.toLowerCase()};this.getToken=function(){this.i+=1;return this.tokens[this.i]};this.getScalar=function(){return parseFloat(this.getToken())};this.nextCommand=function(){this.previousCommand=this.command;this.command=this.getToken()};this.getPoint=function(){return this.makeAbsolute(new a.Point(this.getScalar(),this.getScalar()))};this.getAsControlPoint=function(){var b=this.getPoint(); |
|||
return this.control=b};this.getAsCurrentPoint=function(){var b=this.getPoint();return this.current=b};this.getReflectedControlPoint=function(){return this.previousCommand.toLowerCase()!="c"&&this.previousCommand.toLowerCase()!="s"?this.current:new a.Point(2*this.current.x-this.control.x,2*this.current.y-this.control.y)};this.makeAbsolute=function(b){if(this.isRelativeCommand())b.x=this.current.x+b.x,b.y=this.current.y+b.y;return b};this.addMarker=function(b,a,d){d!=null&&this.angles.length>0&&this.angles[this.angles.length- |
|||
1]==null&&(this.angles[this.angles.length-1]=this.points[this.points.length-1].angleTo(d));this.addMarkerAngle(b,a==null?null:a.angleTo(b))};this.addMarkerAngle=function(b,a){this.points.push(b);this.angles.push(a)};this.getMarkerPoints=function(){return this.points};this.getMarkerAngles=function(){for(var b=0;b<this.angles.length;b++)if(this.angles[b]==null)for(var a=b+1;a<this.angles.length;a++)if(this.angles[a]!=null){this.angles[b]=this.angles[a];break}return this.angles}}(c);this.path=function(d){var b= |
|||
this.PathParser;b.reset();var c=new a.BoundingBox;for(d!=null&&d.beginPath();!b.isEnd();)switch(b.nextCommand(),b.command.toUpperCase()){case "M":var e=b.getAsCurrentPoint();b.addMarker(e);c.addPoint(e.x,e.y);d!=null&&d.moveTo(e.x,e.y);for(b.start=b.current;!b.isCommandOrEnd();)e=b.getAsCurrentPoint(),b.addMarker(e,b.start),c.addPoint(e.x,e.y),d!=null&&d.lineTo(e.x,e.y);break;case "L":for(;!b.isCommandOrEnd();){var f=b.current,e=b.getAsCurrentPoint();b.addMarker(e,f);c.addPoint(e.x,e.y);d!=null&& |
|||
d.lineTo(e.x,e.y)}break;case "H":for(;!b.isCommandOrEnd();)e=new a.Point((b.isRelativeCommand()?b.current.x:0)+b.getScalar(),b.current.y),b.addMarker(e,b.current),b.current=e,c.addPoint(b.current.x,b.current.y),d!=null&&d.lineTo(b.current.x,b.current.y);break;case "V":for(;!b.isCommandOrEnd();)e=new a.Point(b.current.x,(b.isRelativeCommand()?b.current.y:0)+b.getScalar()),b.addMarker(e,b.current),b.current=e,c.addPoint(b.current.x,b.current.y),d!=null&&d.lineTo(b.current.x,b.current.y);break;case "C":for(;!b.isCommandOrEnd();){var g= |
|||
b.current,f=b.getPoint(),j=b.getAsControlPoint(),e=b.getAsCurrentPoint();b.addMarker(e,j,f);c.addBezierCurve(g.x,g.y,f.x,f.y,j.x,j.y,e.x,e.y);d!=null&&d.bezierCurveTo(f.x,f.y,j.x,j.y,e.x,e.y)}break;case "S":for(;!b.isCommandOrEnd();)g=b.current,f=b.getReflectedControlPoint(),j=b.getAsControlPoint(),e=b.getAsCurrentPoint(),b.addMarker(e,j,f),c.addBezierCurve(g.x,g.y,f.x,f.y,j.x,j.y,e.x,e.y),d!=null&&d.bezierCurveTo(f.x,f.y,j.x,j.y,e.x,e.y);break;case "Q":for(;!b.isCommandOrEnd();)g=b.current,j=b.getAsControlPoint(), |
|||
e=b.getAsCurrentPoint(),b.addMarker(e,j,j),c.addQuadraticCurve(g.x,g.y,j.x,j.y,e.x,e.y),d!=null&&d.quadraticCurveTo(j.x,j.y,e.x,e.y);break;case "T":for(;!b.isCommandOrEnd();)g=b.current,j=b.getReflectedControlPoint(),b.control=j,e=b.getAsCurrentPoint(),b.addMarker(e,j,j),c.addQuadraticCurve(g.x,g.y,j.x,j.y,e.x,e.y),d!=null&&d.quadraticCurveTo(j.x,j.y,e.x,e.y);break;case "A":for(;!b.isCommandOrEnd();){var g=b.current,h=b.getScalar(),l=b.getScalar(),f=b.getScalar()*(Math.PI/180),o=b.getScalar(),j=b.getScalar(), |
|||
e=b.getAsCurrentPoint(),n=new a.Point(Math.cos(f)*(g.x-e.x)/2+Math.sin(f)*(g.y-e.y)/2,-Math.sin(f)*(g.x-e.x)/2+Math.cos(f)*(g.y-e.y)/2),q=Math.pow(n.x,2)/Math.pow(h,2)+Math.pow(n.y,2)/Math.pow(l,2);q>1&&(h*=Math.sqrt(q),l*=Math.sqrt(q));o=(o==j?-1:1)*Math.sqrt((Math.pow(h,2)*Math.pow(l,2)-Math.pow(h,2)*Math.pow(n.y,2)-Math.pow(l,2)*Math.pow(n.x,2))/(Math.pow(h,2)*Math.pow(n.y,2)+Math.pow(l,2)*Math.pow(n.x,2)));isNaN(o)&&(o=0);var p=new a.Point(o*h*n.y/l,o*-l*n.x/h),g=new a.Point((g.x+e.x)/2+Math.cos(f)* |
|||
p.x-Math.sin(f)*p.y,(g.y+e.y)/2+Math.sin(f)*p.x+Math.cos(f)*p.y),m=function(b,a){return(b[0]*a[0]+b[1]*a[1])/(Math.sqrt(Math.pow(b[0],2)+Math.pow(b[1],2))*Math.sqrt(Math.pow(a[0],2)+Math.pow(a[1],2)))},s=function(b,a){return(b[0]*a[1]<b[1]*a[0]?-1:1)*Math.acos(m(b,a))},o=s([1,0],[(n.x-p.x)/h,(n.y-p.y)/l]),q=[(n.x-p.x)/h,(n.y-p.y)/l],p=[(-n.x-p.x)/h,(-n.y-p.y)/l],n=s(q,p);if(m(q,p)<=-1)n=Math.PI;m(q,p)>=1&&(n=0);j==0&&n>0&&(n-=2*Math.PI);j==1&&n<0&&(n+=2*Math.PI);q=new a.Point(g.x-h*Math.cos((o+n)/ |
|||
2),g.y-l*Math.sin((o+n)/2));b.addMarkerAngle(q,(o+n)/2+(j==0?1:-1)*Math.PI/2);b.addMarkerAngle(e,n+(j==0?1:-1)*Math.PI/2);c.addPoint(e.x,e.y);d!=null&&(m=h>l?h:l,e=h>l?1:h/l,h=h>l?l/h:1,d.translate(g.x,g.y),d.rotate(f),d.scale(e,h),d.arc(0,0,m,o,o+n,1-j),d.scale(1/e,1/h),d.rotate(-f),d.translate(-g.x,-g.y))}break;case "Z":d!=null&&d.closePath(),b.current=b.start}return c};this.getMarkers=function(){for(var a=this.PathParser.getMarkerPoints(),b=this.PathParser.getMarkerAngles(),c=[],e=0;e<a.length;e++)c.push([a[e], |
|||
b[e]]);return c}};a.Element.path.prototype=new a.Element.PathElementBase;a.Element.pattern=function(c){this.base=a.Element.ElementBase;this.base(c);this.createPattern=function(d){var b=new a.Element.svg;b.attributes.viewBox=new a.Property("viewBox",this.attribute("viewBox").value);b.attributes.x=new a.Property("x",this.attribute("x").value);b.attributes.y=new a.Property("y",this.attribute("y").value);b.attributes.width=new a.Property("width",this.attribute("width").value);b.attributes.height=new a.Property("height", |
|||
this.attribute("height").value);b.children=this.children;var c=document.createElement("canvas");c.width=this.attribute("width").Length.toPixels("x");c.height=this.attribute("height").Length.toPixels("y");b.render(c.getContext("2d"));return d.createPattern(c,"repeat")}};a.Element.pattern.prototype=new a.Element.ElementBase;a.Element.marker=function(c){this.base=a.Element.ElementBase;this.base(c);this.baseRender=this.render;this.render=function(d,b,c){d.translate(b.x,b.y);this.attribute("orient").valueOrDefault("auto")== |
|||
"auto"&&d.rotate(c);this.attribute("markerUnits").valueOrDefault("strokeWidth")=="strokeWidth"&&d.scale(d.lineWidth,d.lineWidth);d.save();var e=new a.Element.svg;e.attributes.viewBox=new a.Property("viewBox",this.attribute("viewBox").value);e.attributes.refX=new a.Property("refX",this.attribute("refX").value);e.attributes.refY=new a.Property("refY",this.attribute("refY").value);e.attributes.width=new a.Property("width",this.attribute("markerWidth").value);e.attributes.height=new a.Property("height", |
|||
this.attribute("markerHeight").value);e.attributes.fill=new a.Property("fill",this.attribute("fill").valueOrDefault("black"));e.attributes.stroke=new a.Property("stroke",this.attribute("stroke").valueOrDefault("none"));e.children=this.children;e.render(d);d.restore();this.attribute("markerUnits").valueOrDefault("strokeWidth")=="strokeWidth"&&d.scale(1/d.lineWidth,1/d.lineWidth);this.attribute("orient").valueOrDefault("auto")=="auto"&&d.rotate(-c);d.translate(-b.x,-b.y)}};a.Element.marker.prototype= |
|||
new a.Element.ElementBase;a.Element.defs=function(c){this.base=a.Element.ElementBase;this.base(c);this.render=function(){}};a.Element.defs.prototype=new a.Element.ElementBase;a.Element.GradientBase=function(c){this.base=a.Element.ElementBase;this.base(c);this.gradientUnits=this.attribute("gradientUnits").valueOrDefault("objectBoundingBox");this.stops=[];for(c=0;c<this.children.length;c++)this.stops.push(this.children[c]);this.getGradient=function(){};this.createGradient=function(d,b){var c=this;this.attribute("xlink:href").hasValue()&& |
|||
(c=this.attribute("xlink:href").Definition.getDefinition());for(var e=this.getGradient(d,b),f=0;f<c.stops.length;f++)e.addColorStop(c.stops[f].offset,c.stops[f].color);if(this.attribute("gradientTransform").hasValue()){c=a.ViewPort.viewPorts[0];f=new a.Element.rect;f.attributes.x=new a.Property("x",-a.MAX_VIRTUAL_PIXELS/3);f.attributes.y=new a.Property("y",-a.MAX_VIRTUAL_PIXELS/3);f.attributes.width=new a.Property("width",a.MAX_VIRTUAL_PIXELS);f.attributes.height=new a.Property("height",a.MAX_VIRTUAL_PIXELS); |
|||
var g=new a.Element.g;g.attributes.transform=new a.Property("transform",this.attribute("gradientTransform").value);g.children=[f];f=new a.Element.svg;f.attributes.x=new a.Property("x",0);f.attributes.y=new a.Property("y",0);f.attributes.width=new a.Property("width",c.width);f.attributes.height=new a.Property("height",c.height);f.children=[g];g=document.createElement("canvas");g.width=c.width;g.height=c.height;c=g.getContext("2d");c.fillStyle=e;f.render(c);return c.createPattern(g,"no-repeat")}return e}}; |
|||
a.Element.GradientBase.prototype=new a.Element.ElementBase;a.Element.linearGradient=function(c){this.base=a.Element.GradientBase;this.base(c);this.getGradient=function(a,b){var c=b.getBoundingBox(),e=this.gradientUnits=="objectBoundingBox"?c.x()+c.width()*this.attribute("x1").numValue():this.attribute("x1").Length.toPixels("x"),f=this.gradientUnits=="objectBoundingBox"?c.y()+c.height()*this.attribute("y1").numValue():this.attribute("y1").Length.toPixels("y"),g=this.gradientUnits=="objectBoundingBox"? |
|||
c.x()+c.width()*this.attribute("x2").numValue():this.attribute("x2").Length.toPixels("x"),c=this.gradientUnits=="objectBoundingBox"?c.y()+c.height()*this.attribute("y2").numValue():this.attribute("y2").Length.toPixels("y");return a.createLinearGradient(e,f,g,c)}};a.Element.linearGradient.prototype=new a.Element.GradientBase;a.Element.radialGradient=function(c){this.base=a.Element.GradientBase;this.base(c);this.getGradient=function(a,b){var c=b.getBoundingBox(),e=this.gradientUnits=="objectBoundingBox"? |
|||
c.x()+c.width()*this.attribute("cx").numValue():this.attribute("cx").Length.toPixels("x"),f=this.gradientUnits=="objectBoundingBox"?c.y()+c.height()*this.attribute("cy").numValue():this.attribute("cy").Length.toPixels("y"),g=e,j=f;this.attribute("fx").hasValue()&&(g=this.gradientUnits=="objectBoundingBox"?c.x()+c.width()*this.attribute("fx").numValue():this.attribute("fx").Length.toPixels("x"));this.attribute("fy").hasValue()&&(j=this.gradientUnits=="objectBoundingBox"?c.y()+c.height()*this.attribute("fy").numValue(): |
|||
this.attribute("fy").Length.toPixels("y"));c=this.gradientUnits=="objectBoundingBox"?(c.width()+c.height())/2*this.attribute("r").numValue():this.attribute("r").Length.toPixels();return a.createRadialGradient(g,j,0,e,f,c)}};a.Element.radialGradient.prototype=new a.Element.GradientBase;a.Element.stop=function(c){this.base=a.Element.ElementBase;this.base(c);this.offset=this.attribute("offset").numValue();c=this.style("stop-color");this.style("stop-opacity").hasValue()&&(c=c.Color.addOpacity(this.style("stop-opacity").value)); |
|||
this.color=c.value};a.Element.stop.prototype=new a.Element.ElementBase;a.Element.AnimateBase=function(c){this.base=a.Element.ElementBase;this.base(c);a.Animations.push(this);this.duration=0;this.begin=this.attribute("begin").Time.toMilliseconds();this.maxDuration=this.begin+this.attribute("dur").Time.toMilliseconds();this.getProperty=function(){var a=this.attribute("attributeType").value,b=this.attribute("attributeName").value;return a=="CSS"?this.parent.style(b,!0):this.parent.attribute(b,!0)};this.initialValue= |
|||
null;this.removed=!1;this.calcValue=function(){return""};this.update=function(a){if(this.initialValue==null)this.initialValue=this.getProperty().value;if(this.duration>this.maxDuration)if(this.attribute("repeatCount").value=="indefinite")this.duration=0;else return this.attribute("fill").valueOrDefault("remove")=="remove"&&!this.removed?(this.removed=!0,this.getProperty().value=this.initialValue,!0):!1;this.duration+=a;a=!1;if(this.begin<this.duration)a=this.calcValue(),this.attribute("type").hasValue()&& |
|||
(a=this.attribute("type").value+"("+a+")"),this.getProperty().value=a,a=!0;return a};this.progress=function(){return(this.duration-this.begin)/(this.maxDuration-this.begin)}};a.Element.AnimateBase.prototype=new a.Element.ElementBase;a.Element.animate=function(c){this.base=a.Element.AnimateBase;this.base(c);this.calcValue=function(){var a=this.attribute("from").numValue(),b=this.attribute("to").numValue();return a+(b-a)*this.progress()}};a.Element.animate.prototype=new a.Element.AnimateBase;a.Element.animateColor= |
|||
function(c){this.base=a.Element.AnimateBase;this.base(c);this.calcValue=function(){var a=new RGBColor(this.attribute("from").value),b=new RGBColor(this.attribute("to").value);if(a.ok&&b.ok){var c=a.r+(b.r-a.r)*this.progress(),e=a.g+(b.g-a.g)*this.progress(),a=a.b+(b.b-a.b)*this.progress();return"rgb("+parseInt(c,10)+","+parseInt(e,10)+","+parseInt(a,10)+")"}return this.attribute("from").value}};a.Element.animateColor.prototype=new a.Element.AnimateBase;a.Element.animateTransform=function(c){this.base= |
|||
a.Element.animate;this.base(c)};a.Element.animateTransform.prototype=new a.Element.animate;a.Element.font=function(c){this.base=a.Element.ElementBase;this.base(c);this.horizAdvX=this.attribute("horiz-adv-x").numValue();this.isArabic=this.isRTL=!1;this.missingGlyph=this.fontFace=null;this.glyphs=[];for(c=0;c<this.children.length;c++){var d=this.children[c];if(d.type=="font-face")this.fontFace=d,d.style("font-family").hasValue()&&(a.Definitions[d.style("font-family").value]=this);else if(d.type=="missing-glyph")this.missingGlyph= |
|||
d;else if(d.type=="glyph")d.arabicForm!=""?(this.isArabic=this.isRTL=!0,typeof this.glyphs[d.unicode]=="undefined"&&(this.glyphs[d.unicode]=[]),this.glyphs[d.unicode][d.arabicForm]=d):this.glyphs[d.unicode]=d}};a.Element.font.prototype=new a.Element.ElementBase;a.Element.fontface=function(c){this.base=a.Element.ElementBase;this.base(c);this.ascent=this.attribute("ascent").value;this.descent=this.attribute("descent").value;this.unitsPerEm=this.attribute("units-per-em").numValue()};a.Element.fontface.prototype= |
|||
new a.Element.ElementBase;a.Element.missingglyph=function(c){this.base=a.Element.path;this.base(c);this.horizAdvX=0};a.Element.missingglyph.prototype=new a.Element.path;a.Element.glyph=function(c){this.base=a.Element.path;this.base(c);this.horizAdvX=this.attribute("horiz-adv-x").numValue();this.unicode=this.attribute("unicode").value;this.arabicForm=this.attribute("arabic-form").value};a.Element.glyph.prototype=new a.Element.path;a.Element.text=function(c){this.base=a.Element.RenderedElementBase; |
|||
this.base(c);if(c!=null){this.children=[];for(var d=0;d<c.childNodes.length;d++){var b=c.childNodes[d];b.nodeType==1?this.addChild(b,!0):b.nodeType==3&&this.addChild(new a.Element.tspan(b),!1)}}this.baseSetContext=this.setContext;this.setContext=function(b){this.baseSetContext(b);if(this.style("dominant-baseline").hasValue())b.textBaseline=this.style("dominant-baseline").value;if(this.style("alignment-baseline").hasValue())b.textBaseline=this.style("alignment-baseline").value};this.renderChildren= |
|||
function(b){for(var a=this.style("text-anchor").valueOrDefault("start"),c=this.attribute("x").Length.toPixels("x"),d=this.attribute("y").Length.toPixels("y"),j=0;j<this.children.length;j++){var h=this.children[j];h.attribute("x").hasValue()?h.x=h.attribute("x").Length.toPixels("x"):(h.attribute("dx").hasValue()&&(c+=h.attribute("dx").Length.toPixels("x")),h.x=c);c=h.measureText(b);if(a!="start"&&(j==0||h.attribute("x").hasValue())){for(var l=c,o=j+1;o<this.children.length;o++){var n=this.children[o]; |
|||
if(n.attribute("x").hasValue())break;l+=n.measureText(b)}h.x-=a=="end"?l:l/2}c=h.x+c;h.attribute("y").hasValue()?h.y=h.attribute("y").Length.toPixels("y"):(h.attribute("dy").hasValue()&&(d+=h.attribute("dy").Length.toPixels("y")),h.y=d);d=h.y;h.render(b)}}};a.Element.text.prototype=new a.Element.RenderedElementBase;a.Element.TextElementBase=function(c){this.base=a.Element.RenderedElementBase;this.base(c);this.getGlyph=function(a,b,c){var e=b[c],f=null;if(a.isArabic){var g="isolated";if((c==0||b[c- |
|||
1]==" ")&&c<b.length-2&&b[c+1]!=" ")g="terminal";c>0&&b[c-1]!=" "&&c<b.length-2&&b[c+1]!=" "&&(g="medial");if(c>0&&b[c-1]!=" "&&(c==b.length-1||b[c+1]==" "))g="initial";typeof a.glyphs[e]!="undefined"&&(f=a.glyphs[e][g],f==null&&a.glyphs[e].type=="glyph"&&(f=a.glyphs[e]))}else f=a.glyphs[e];if(f==null)f=a.missingGlyph;return f};this.renderChildren=function(c){var b=this.parent.style("font-family").Definition.getDefinition();if(b!=null){var k=this.parent.style("font-size").numValueOrDefault(a.Font.Parse(a.ctx.font).fontSize), |
|||
e=this.parent.style("font-style").valueOrDefault(a.Font.Parse(a.ctx.font).fontStyle),f=this.getText();b.isRTL&&(f=f.split("").reverse().join(""));for(var g=a.ToNumberArray(this.parent.attribute("dx").value),j=0;j<f.length;j++){var h=this.getGlyph(b,f,j),l=k/b.fontFace.unitsPerEm;c.translate(this.x,this.y);c.scale(l,-l);var o=c.lineWidth;c.lineWidth=c.lineWidth*b.fontFace.unitsPerEm/k;e=="italic"&&c.transform(1,0,0.4,1,0,0);h.render(c);e=="italic"&&c.transform(1,0,-0.4,1,0,0);c.lineWidth=o;c.scale(1/ |
|||
l,-1/l);c.translate(-this.x,-this.y);this.x+=k*(h.horizAdvX||b.horizAdvX)/b.fontFace.unitsPerEm;typeof g[j]!="undefined"&&!isNaN(g[j])&&(this.x+=g[j])}}else c.strokeStyle!=""&&c.strokeText(a.compressSpaces(this.getText()),this.x,this.y),c.fillStyle!=""&&c.fillText(a.compressSpaces(this.getText()),this.x,this.y)};this.getText=function(){};this.measureText=function(c){var b=this.parent.style("font-family").Definition.getDefinition();if(b!=null){var c=this.parent.style("font-size").numValueOrDefault(a.Font.Parse(a.ctx.font).fontSize), |
|||
k=0,e=this.getText();b.isRTL&&(e=e.split("").reverse().join(""));for(var f=a.ToNumberArray(this.parent.attribute("dx").value),g=0;g<e.length;g++){var j=this.getGlyph(b,e,g);k+=(j.horizAdvX||b.horizAdvX)*c/b.fontFace.unitsPerEm;typeof f[g]!="undefined"&&!isNaN(f[g])&&(k+=f[g])}return k}b=a.compressSpaces(this.getText());if(!c.measureText)return b.length*10;c.save();this.setContext(c);b=c.measureText(b).width;c.restore();return b}};a.Element.TextElementBase.prototype=new a.Element.RenderedElementBase; |
|||
a.Element.tspan=function(c){this.base=a.Element.TextElementBase;this.base(c);this.text=c.nodeType==3?c.nodeValue:c.childNodes.length>0?c.childNodes[0].nodeValue:c.text;this.getText=function(){return this.text}};a.Element.tspan.prototype=new a.Element.TextElementBase;a.Element.tref=function(c){this.base=a.Element.TextElementBase;this.base(c);this.getText=function(){var a=this.attribute("xlink:href").Definition.getDefinition();if(a!=null)return a.children[0].getText()}};a.Element.tref.prototype=new a.Element.TextElementBase; |
|||
a.Element.a=function(c){this.base=a.Element.TextElementBase;this.base(c);this.hasText=!0;for(var d=0;d<c.childNodes.length;d++)if(c.childNodes[d].nodeType!=3)this.hasText=!1;this.text=this.hasText?c.childNodes[0].nodeValue:"";this.getText=function(){return this.text};this.baseRenderChildren=this.renderChildren;this.renderChildren=function(b){if(this.hasText){this.baseRenderChildren(b);var c=new a.Property("fontSize",a.Font.Parse(a.ctx.font).fontSize);a.Mouse.checkBoundingBox(this,new a.BoundingBox(this.x, |
|||
this.y-c.Length.toPixels("y"),this.x+this.measureText(b),this.y))}else c=new a.Element.g,c.children=this.children,c.parent=this,c.render(b)};this.onclick=function(){window.open(this.attribute("xlink:href").value)};this.onmousemove=function(){a.ctx.canvas.style.cursor="pointer"}};a.Element.a.prototype=new a.Element.TextElementBase;a.Element.image=function(c){this.base=a.Element.RenderedElementBase;this.base(c);a.Images.push(this);this.img=document.createElement("img");this.loaded=!1;var d=this;this.img.onload= |
|||
function(){d.loaded=!0};this.img.src=this.attribute("xlink:href").value;this.renderChildren=function(b){var c=this.attribute("x").Length.toPixels("x"),d=this.attribute("y").Length.toPixels("y"),f=this.attribute("width").Length.toPixels("x"),g=this.attribute("height").Length.toPixels("y");f==0||g==0||(b.save(),b.translate(c,d),a.AspectRatio(b,this.attribute("preserveAspectRatio").value,f,this.img.width,g,this.img.height,0,0),b.drawImage(this.img,0,0),b.restore())}};a.Element.image.prototype=new a.Element.RenderedElementBase; |
|||
a.Element.g=function(c){this.base=a.Element.RenderedElementBase;this.base(c);this.getBoundingBox=function(){for(var c=new a.BoundingBox,b=0;b<this.children.length;b++)c.addBoundingBox(this.children[b].getBoundingBox());return c}};a.Element.g.prototype=new a.Element.RenderedElementBase;a.Element.symbol=function(c){this.base=a.Element.RenderedElementBase;this.base(c);this.baseSetContext=this.setContext;this.setContext=function(c){this.baseSetContext(c);if(this.attribute("viewBox").hasValue()){var b= |
|||
a.ToNumberArray(this.attribute("viewBox").value),k=b[0],e=b[1];width=b[2];height=b[3];a.AspectRatio(c,this.attribute("preserveAspectRatio").value,this.attribute("width").Length.toPixels("x"),width,this.attribute("height").Length.toPixels("y"),height,k,e);a.ViewPort.SetCurrent(b[2],b[3])}}};a.Element.symbol.prototype=new a.Element.RenderedElementBase;a.Element.style=function(c){this.base=a.Element.ElementBase;this.base(c);for(var c=c.childNodes[0].nodeValue+(c.childNodes.length>1?c.childNodes[1].nodeValue: |
|||
""),c=c.replace(/(\/\*([^*]|[\r\n]|(\*+([^*\/]|[\r\n])))*\*+\/)|(^[\s]*\/\/.*)/gm,""),c=a.compressSpaces(c),c=c.split("}"),d=0;d<c.length;d++)if(a.trim(c[d])!="")for(var b=c[d].split("{"),k=b[0].split(","),b=b[1].split(";"),e=0;e<k.length;e++){var f=a.trim(k[e]);if(f!=""){for(var g={},j=0;j<b.length;j++){var h=b[j].indexOf(":"),l=b[j].substr(0,h),h=b[j].substr(h+1,b[j].length-h);l!=null&&h!=null&&(g[a.trim(l)]=new a.Property(a.trim(l),a.trim(h)))}a.Styles[f]=g;if(f=="@font-face"){f=g["font-family"].value.replace(/"/g, |
|||
"");g=g.src.value.split(",");for(j=0;j<g.length;j++)if(g[j].indexOf('format("svg")')>0){l=g[j].indexOf("url");h=g[j].indexOf(")",l);l=g[j].substr(l+5,h-l-6);l=a.parseXml(a.ajax(l)).getElementsByTagName("font");for(h=0;h<l.length;h++){var o=a.CreateElement(l[h]);a.Definitions[f]=o}}}}}};a.Element.style.prototype=new a.Element.ElementBase;a.Element.use=function(c){this.base=a.Element.RenderedElementBase;this.base(c);this.baseSetContext=this.setContext;this.setContext=function(a){this.baseSetContext(a); |
|||
this.attribute("x").hasValue()&&a.translate(this.attribute("x").Length.toPixels("x"),0);this.attribute("y").hasValue()&&a.translate(0,this.attribute("y").Length.toPixels("y"))};this.getDefinition=function(){var a=this.attribute("xlink:href").Definition.getDefinition();if(this.attribute("width").hasValue())a.attribute("width",!0).value=this.attribute("width").value;if(this.attribute("height").hasValue())a.attribute("height",!0).value=this.attribute("height").value;return a};this.path=function(a){var b= |
|||
this.getDefinition();b!=null&&b.path(a)};this.renderChildren=function(a){var b=this.getDefinition();b!=null&&b.render(a)}};a.Element.use.prototype=new a.Element.RenderedElementBase;a.Element.mask=function(c){this.base=a.Element.ElementBase;this.base(c);this.apply=function(a,b){var c=this.attribute("x").Length.toPixels("x"),e=this.attribute("y").Length.toPixels("y"),f=this.attribute("width").Length.toPixels("x"),g=this.attribute("height").Length.toPixels("y"),j=b.attribute("mask").value;b.attribute("mask").value= |
|||
"";var h=document.createElement("canvas");h.width=c+f;h.height=e+g;var l=h.getContext("2d");this.renderChildren(l);var o=document.createElement("canvas");o.width=c+f;o.height=e+g;var n=o.getContext("2d");b.render(n);n.globalCompositeOperation="destination-in";n.fillStyle=l.createPattern(h,"no-repeat");n.fillRect(0,0,c+f,e+g);a.fillStyle=n.createPattern(o,"no-repeat");a.fillRect(0,0,c+f,e+g);b.attribute("mask").value=j};this.render=function(){}};a.Element.mask.prototype=new a.Element.ElementBase;a.Element.clipPath= |
|||
function(c){this.base=a.Element.ElementBase;this.base(c);this.apply=function(a){for(var b=0;b<this.children.length;b++)this.children[b].path&&(this.children[b].path(a),a.clip())};this.render=function(){}};a.Element.clipPath.prototype=new a.Element.ElementBase;a.Element.filter=function(c){this.base=a.Element.ElementBase;this.base(c);this.apply=function(a,b){var c=b.getBoundingBox(),e=this.attribute("x").Length.toPixels("x"),f=this.attribute("y").Length.toPixels("y");if(e==0||f==0)e=c.x1,f=c.y1;var g= |
|||
this.attribute("width").Length.toPixels("x"),j=this.attribute("height").Length.toPixels("y");if(g==0||j==0)g=c.width(),j=c.height();c=b.style("filter").value;b.style("filter").value="";var h=0.2*g,l=0.2*j,o=document.createElement("canvas");o.width=g+2*h;o.height=j+2*l;var n=o.getContext("2d");n.translate(-e+h,-f+l);b.render(n);for(var q=0;q<this.children.length;q++)this.children[q].apply(n,0,0,g+2*h,j+2*l);a.drawImage(o,0,0,g+2*h,j+2*l,e-h,f-l,g+2*h,j+2*l);b.style("filter",!0).value=c};this.render= |
|||
function(){}};a.Element.filter.prototype=new a.Element.ElementBase;a.Element.feGaussianBlur=function(c){function d(a,c,d,f,g){for(var j=0;j<g;j++)for(var h=0;h<f;h++)for(var l=a[j*f*4+h*4+3]/255,o=0;o<4;o++){for(var n=d[0]*(l==0?255:a[j*f*4+h*4+o])*(l==0||o==3?1:l),q=1;q<d.length;q++){var p=Math.max(h-q,0),m=a[j*f*4+p*4+3]/255,p=Math.min(h+q,f-1),p=a[j*f*4+p*4+3]/255,s=d[q],r;m==0?r=255:(r=Math.max(h-q,0),r=a[j*f*4+r*4+o]);m=r*(m==0||o==3?1:m);p==0?r=255:(r=Math.min(h+q,f-1),r=a[j*f*4+r*4+o]);n+= |
|||
s*(m+r*(p==0||o==3?1:p))}c[h*g*4+j*4+o]=n}}this.base=a.Element.ElementBase;this.base(c);this.apply=function(a,c,e,f,g){var e=this.attribute("stdDeviation").numValue(),c=a.getImageData(0,0,f,g),e=Math.max(e,0.01),j=Math.ceil(e*4)+1;mask=[];for(var h=0;h<j;h++)mask[h]=Math.exp(-0.5*(h/e)*(h/e));e=mask;j=0;for(h=1;h<e.length;h++)j+=Math.abs(e[h]);j=2*j+Math.abs(e[0]);for(h=0;h<e.length;h++)e[h]/=j;tmp=[];d(c.data,tmp,e,f,g);d(tmp,c.data,e,g,f);a.clearRect(0,0,f,g);a.putImageData(c,0,0)}};a.Element.filter.prototype= |
|||
new a.Element.feGaussianBlur;a.Element.title=function(){};a.Element.title.prototype=new a.Element.ElementBase;a.Element.desc=function(){};a.Element.desc.prototype=new a.Element.ElementBase;a.Element.MISSING=function(a){console.log("ERROR: Element '"+a.nodeName+"' not yet implemented.")};a.Element.MISSING.prototype=new a.Element.ElementBase;a.CreateElement=function(c){var d=c.nodeName.replace(/^[^:]+:/,""),d=d.replace(/\-/g,""),b=null,b=typeof a.Element[d]!="undefined"?new a.Element[d](c):new a.Element.MISSING(c); |
|||
b.type=c.nodeName;return b};a.load=function(c,d){a.loadXml(c,a.ajax(d))};a.loadXml=function(c,d){a.loadXmlDoc(c,a.parseXml(d))};a.loadXmlDoc=function(c,d){a.init(c);var b=function(a){for(var b=c.canvas;b;)a.x-=b.offsetLeft,a.y-=b.offsetTop,b=b.offsetParent;window.scrollX&&(a.x+=window.scrollX);window.scrollY&&(a.y+=window.scrollY);return a};if(a.opts.ignoreMouse!=!0)c.canvas.onclick=function(c){c=b(new a.Point(c!=null?c.clientX:event.clientX,c!=null?c.clientY:event.clientY));a.Mouse.onclick(c.x,c.y)}, |
|||
c.canvas.onmousemove=function(c){c=b(new a.Point(c!=null?c.clientX:event.clientX,c!=null?c.clientY:event.clientY));a.Mouse.onmousemove(c.x,c.y)};var k=a.CreateElement(d.documentElement),e=k.root=!0,f=function(){a.ViewPort.Clear();c.canvas.parentNode&&a.ViewPort.SetCurrent(c.canvas.parentNode.clientWidth,c.canvas.parentNode.clientHeight);if(a.opts.ignoreDimensions!=!0){if(k.style("width").hasValue())c.canvas.width=k.style("width").Length.toPixels("x"),c.canvas.style.width=c.canvas.width+"px";if(k.style("height").hasValue())c.canvas.height= |
|||
k.style("height").Length.toPixels("y"),c.canvas.style.height=c.canvas.height+"px"}var b=c.canvas.clientWidth||c.canvas.width,d=c.canvas.clientHeight||c.canvas.height;a.ViewPort.SetCurrent(b,d);if(a.opts!=null&&a.opts.offsetX!=null)k.attribute("x",!0).value=a.opts.offsetX;if(a.opts!=null&&a.opts.offsetY!=null)k.attribute("y",!0).value=a.opts.offsetY;if(a.opts!=null&&a.opts.scaleWidth!=null&&a.opts.scaleHeight!=null){var f=1,g=1;k.attribute("width").hasValue()&&(f=k.attribute("width").Length.toPixels("x")/ |
|||
a.opts.scaleWidth);k.attribute("height").hasValue()&&(g=k.attribute("height").Length.toPixels("y")/a.opts.scaleHeight);k.attribute("width",!0).value=a.opts.scaleWidth;k.attribute("height",!0).value=a.opts.scaleHeight;k.attribute("viewBox",!0).value="0 0 "+b*f+" "+d*g;k.attribute("preserveAspectRatio",!0).value="none"}a.opts.ignoreClear!=!0&&c.clearRect(0,0,b,d);k.render(c);e&&(e=!1,a.opts!=null&&typeof a.opts.renderCallback=="function"&&a.opts.renderCallback())},g=!0;a.ImagesLoaded()&&(g=!1,f()); |
|||
a.intervalID=setInterval(function(){var b=!1;g&&a.ImagesLoaded()&&(g=!1,b=!0);a.opts.ignoreMouse!=!0&&(b|=a.Mouse.hasEvents());if(a.opts.ignoreAnimation!=!0)for(var c=0;c<a.Animations.length;c++)b|=a.Animations[c].update(1E3/a.FRAMERATE);a.opts!=null&&typeof a.opts.forceRedraw=="function"&&a.opts.forceRedraw()==!0&&(b=!0);b&&(f(),a.Mouse.runEvents())},1E3/a.FRAMERATE)};a.stop=function(){a.intervalID&&clearInterval(a.intervalID)};a.Mouse=new function(){this.events=[];this.hasEvents=function(){return this.events.length!= |
|||
0};this.onclick=function(a,d){this.events.push({type:"onclick",x:a,y:d,run:function(a){if(a.onclick)a.onclick()}})};this.onmousemove=function(a,d){this.events.push({type:"onmousemove",x:a,y:d,run:function(a){if(a.onmousemove)a.onmousemove()}})};this.eventElements=[];this.checkPath=function(a,d){for(var b=0;b<this.events.length;b++){var k=this.events[b];d.isPointInPath&&d.isPointInPath(k.x,k.y)&&(this.eventElements[b]=a)}};this.checkBoundingBox=function(a,d){for(var b=0;b<this.events.length;b++){var k= |
|||
this.events[b];d.isPointInBox(k.x,k.y)&&(this.eventElements[b]=a)}};this.runEvents=function(){a.ctx.canvas.style.cursor="";for(var c=0;c<this.events.length;c++)for(var d=this.events[c],b=this.eventElements[c];b;)d.run(b),b=b.parent;this.events=[];this.eventElements=[]}};return a}this.canvg=function(a,c,d){if(a==null&&c==null&&d==null)for(var c=document.getElementsByTagName("svg"),b=0;b<c.length;b++){a=c[b];d=document.createElement("canvas");d.width=a.clientWidth;d.height=a.clientHeight;a.parentNode.insertBefore(d, |
|||
a);a.parentNode.removeChild(a);var k=document.createElement("div");k.appendChild(a);canvg(d,k.innerHTML)}else d=d||{},typeof a=="string"&&(a=document.getElementById(a)),a.svg==null?(b=m(),a.svg=b):(b=a.svg,b.stop()),b.opts=d,a=a.getContext("2d"),typeof c.documentElement!="undefined"?b.loadXmlDoc(a,c):c.substr(0,1)=="<"?b.loadXml(a,c):b.load(a,c)}})(); |
|||
if(CanvasRenderingContext2D)CanvasRenderingContext2D.prototype.drawSvg=function(m,a,c,d,b){canvg(this.canvas,m,{ignoreMouse:!0,ignoreAnimation:!0,ignoreDimensions:!0,ignoreClear:!0,offsetX:a,offsetY:c,scaleWidth:d,scaleHeight:b})}; |
|||
(function(m){var a=m.css,c=m.CanVGRenderer,d=m.SVGRenderer,b=m.extend,k=m.merge,e=m.addEvent,f=m.createElement,g=m.discardElement;b(c.prototype,d.prototype);b(c.prototype,{create:function(a,b,c,d){this.setContainer(b,c,d);this.configure(a)},setContainer:function(a,b,c){var d=a.style,e=a.parentNode,g=d.left,d=d.top,k=a.offsetWidth,m=a.offsetHeight,s={visibility:"hidden",position:"absolute"};this.init.apply(this,[a,b,c]);this.canvas=f("canvas",{width:k,height:m},{position:"relative",left:g,top:d},a); |
|||
this.ttLine=f("div",null,s,e);this.ttDiv=f("div",null,s,e);this.ttTimer=void 0;this.hiddenSvg=a=f("div",{width:k,height:m},{visibility:"hidden",left:g,top:d},e);a.appendChild(this.box)},configure:function(b){var c=this,d=b.options.tooltip,f=d.borderWidth,g=c.ttDiv,m=d.style,p=c.ttLine,t=parseInt(m.padding,10),m=k(m,{padding:t+"px","background-color":d.backgroundColor,"border-style":"solid","border-width":f+"px","border-radius":d.borderRadius+"px"});d.shadow&&(m=k(m,{"box-shadow":"1px 1px 3px gray", |
|||
"-webkit-box-shadow":"1px 1px 3px gray"}));a(g,m);a(p,{"border-left":"1px solid darkgray"});e(b,"tooltipRefresh",function(d){var e=b.container,f=e.offsetLeft,e=e.offsetTop,k;g.innerHTML=d.text;k=b.tooltip.getPosition(g.offsetWidth,g.offsetHeight,{plotX:d.x,plotY:d.y});a(g,{visibility:"visible",left:k.x+"px",top:k.y+"px","border-color":d.borderColor});a(p,{visibility:"visible",left:f+d.x+"px",top:e+b.plotTop+"px",height:b.plotHeight+"px"});c.ttTimer!==void 0&&clearTimeout(c.ttTimer);c.ttTimer=setTimeout(function(){a(g, |
|||
{visibility:"hidden"});a(p,{visibility:"hidden"})},3E3)})},destroy:function(){g(this.canvas);this.ttTimer!==void 0&&clearTimeout(this.ttTimer);g(this.ttLine);g(this.ttDiv);g(this.hiddenSvg);return d.prototype.destroy.apply(this)},color:function(a,b,c){a&&a.linearGradient&&(a=a.stops[a.stops.length-1][1]);return d.prototype.color.call(this,a,b,c)},draw:function(){window.canvg(this.canvas,this.hiddenSvg.innerHTML)}})})(Highcharts); |
|||
@ -0,0 +1,17 @@ |
|||
/* |
|||
Data plugin for Highcharts |
|||
|
|||
(c) 2012-2013 Torstein Hønsi |
|||
Last revision 2013-06-07 |
|||
|
|||
License: www.highcharts.com/license |
|||
*/ |
|||
(function(h){var k=h.each,m=function(b,a){this.init(b,a)};h.extend(m.prototype,{init:function(b,a){this.options=b;this.chartOptions=a;this.columns=b.columns||this.rowsToColumns(b.rows)||[];this.columns.length?this.dataFound():(this.parseCSV(),this.parseTable(),this.parseGoogleSpreadsheet())},getColumnDistribution:function(){var b=this.chartOptions,a=b&&b.chart&&b.chart.type,c=[];k(b&&b.series||[],function(b){c.push((h.seriesTypes[b.type||a||"line"].prototype.pointArrayMap||[0]).length)});this.valueCount= |
|||
{global:(h.seriesTypes[a||"line"].prototype.pointArrayMap||[0]).length,individual:c}},dataFound:function(){this.parseTypes();this.findHeaderRow();this.parsed();this.complete()},parseCSV:function(){var b=this,a=this.options,c=a.csv,d=this.columns,f=a.startRow||0,i=a.endRow||Number.MAX_VALUE,j=a.startColumn||0,e=a.endColumn||Number.MAX_VALUE,g=0;c&&(c=c.replace(/\r\n/g,"\n").replace(/\r/g,"\n").split(a.lineDelimiter||"\n"),k(c,function(c,h){var n=b.trim(c),p=n.indexOf("#")===0;h>=f&&h<=i&&!p&&n!==""&& |
|||
(n=c.split(a.itemDelimiter||","),k(n,function(b,a){a>=j&&a<=e&&(d[a-j]||(d[a-j]=[]),d[a-j][g]=b)}),g+=1)}),this.dataFound())},parseTable:function(){var b=this.options,a=b.table,c=this.columns,d=b.startRow||0,f=b.endRow||Number.MAX_VALUE,i=b.startColumn||0,j=b.endColumn||Number.MAX_VALUE,e;a&&(typeof a==="string"&&(a=document.getElementById(a)),k(a.getElementsByTagName("tr"),function(a,b){e=0;b>=d&&b<=f&&k(a.childNodes,function(a){if((a.tagName==="TD"||a.tagName==="TH")&&e>=i&&e<=j)c[e]||(c[e]=[]), |
|||
c[e][b-d]=a.innerHTML,e+=1})}),this.dataFound())},parseGoogleSpreadsheet:function(){var b=this,a=this.options,c=a.googleSpreadsheetKey,d=this.columns,f=a.startRow||0,i=a.endRow||Number.MAX_VALUE,j=a.startColumn||0,e=a.endColumn||Number.MAX_VALUE,g,h;c&&jQuery.getJSON("https://spreadsheets.google.com/feeds/cells/"+c+"/"+(a.googleSpreadsheetWorksheet||"od6")+"/public/values?alt=json-in-script&callback=?",function(a){var a=a.feed.entry,c,k=a.length,m=0,o=0,l;for(l=0;l<k;l++)c=a[l],m=Math.max(m,c.gs$cell.col), |
|||
o=Math.max(o,c.gs$cell.row);for(l=0;l<m;l++)if(l>=j&&l<=e)d[l-j]=[],d[l-j].length=Math.min(o,i-f);for(l=0;l<k;l++)if(c=a[l],g=c.gs$cell.row-1,h=c.gs$cell.col-1,h>=j&&h<=e&&g>=f&&g<=i)d[h-j][g-f]=c.content.$t;b.dataFound()})},findHeaderRow:function(){k(this.columns,function(){});this.headerRow=0},trim:function(b){return typeof b==="string"?b.replace(/^\s+|\s+$/g,""):b},parseTypes:function(){for(var b=this.columns,a=b.length,c,d,f,i;a--;)for(c=b[a].length;c--;)d=b[a][c],f=parseFloat(d),i=this.trim(d), |
|||
i==f?(b[a][c]=f,f>31536E6?b[a].isDatetime=!0:b[a].isNumeric=!0):(d=this.parseDate(d),a===0&&typeof d==="number"&&!isNaN(d)?(b[a][c]=d,b[a].isDatetime=!0):b[a][c]=i===""?null:i)},dateFormats:{"YYYY-mm-dd":{regex:"^([0-9]{4})-([0-9]{2})-([0-9]{2})$",parser:function(b){return Date.UTC(+b[1],b[2]-1,+b[3])}}},parseDate:function(b){var a=this.options.parseDate,c,d,f;a&&(c=a(b));if(typeof b==="string")for(d in this.dateFormats)a=this.dateFormats[d],(f=b.match(a.regex))&&(c=a.parser(f));return c},rowsToColumns:function(b){var a, |
|||
c,d,f,i;if(b){i=[];c=b.length;for(a=0;a<c;a++){f=b[a].length;for(d=0;d<f;d++)i[d]||(i[d]=[]),i[d][a]=b[a][d]}}return i},parsed:function(){this.options.parsed&&this.options.parsed.call(this,this.columns)},complete:function(){var b=this.columns,a,c,d=this.options,f,i,j,e,g,k;if(d.complete){this.getColumnDistribution();b.length>1&&(a=b.shift(),this.headerRow===0&&a.shift(),a.isDatetime?c="datetime":a.isNumeric||(c="category"));for(e=0;e<b.length;e++)if(this.headerRow===0)b[e].name=b[e].shift();i=[]; |
|||
for(e=0,k=0;e<b.length;k++){f=h.pick(this.valueCount.individual[k],this.valueCount.global);j=[];for(g=0;g<b[e].length;g++)j[g]=[a[g],b[e][g]!==void 0?b[e][g]:null],f>1&&j[g].push(b[e+1][g]!==void 0?b[e+1][g]:null),f>2&&j[g].push(b[e+2][g]!==void 0?b[e+2][g]:null),f>3&&j[g].push(b[e+3][g]!==void 0?b[e+3][g]:null),f>4&&j[g].push(b[e+4][g]!==void 0?b[e+4][g]:null);i[k]={name:b[e].name,data:j};e+=f}d.complete({xAxis:{type:c},series:i})}}});h.Data=m;h.data=function(b,a){return new m(b,a)};h.wrap(h.Chart.prototype, |
|||
"init",function(b,a,c){var d=this;a&&a.data?h.data(h.extend(a.data,{complete:function(f){a.series&&k(a.series,function(b,c){a.series[c]=h.merge(b,f.series[c])});a=h.merge(f,a);b.call(d,a,c)}}),a):b.call(d,a,c)})})(Highcharts); |
|||
@ -0,0 +1,582 @@ |
|||
/** |
|||
* @license Data plugin for Highcharts |
|||
* |
|||
* (c) 2012-2013 Torstein Hønsi |
|||
* Last revision 2013-06-07 |
|||
* |
|||
* License: www.highcharts.com/license |
|||
*/ |
|||
|
|||
/* |
|||
* The Highcharts Data plugin is a utility to ease parsing of input sources like |
|||
* CSV, HTML tables or grid views into basic configuration options for use |
|||
* directly in the Highcharts constructor. |
|||
* |
|||
* Demo: http://jsfiddle.net/highcharts/SnLFj/
|
|||
* |
|||
* --- OPTIONS --- |
|||
* |
|||
* - columns : Array<Array<Mixed>> |
|||
* A two-dimensional array representing the input data on tabular form. This input can |
|||
* be used when the data is already parsed, for example from a grid view component. |
|||
* Each cell can be a string or number. If not switchRowsAndColumns is set, the columns |
|||
* are interpreted as series. See also the rows option. |
|||
* |
|||
* - complete : Function(chartOptions) |
|||
* The callback that is evaluated when the data is finished loading, optionally from an |
|||
* external source, and parsed. The first argument passed is a finished chart options |
|||
* object, containing series and an xAxis with categories if applicable. Thise options |
|||
* can be extended with additional options and passed directly to the chart constructor. |
|||
* |
|||
* - csv : String |
|||
* A comma delimited string to be parsed. Related options are startRow, endRow, startColumn |
|||
* and endColumn to delimit what part of the table is used. The lineDelimiter and |
|||
* itemDelimiter options define the CSV delimiter formats. |
|||
* |
|||
* - endColumn : Integer |
|||
* In tabular input data, the first row (indexed by 0) to use. Defaults to the last |
|||
* column containing data. |
|||
* |
|||
* - endRow : Integer |
|||
* In tabular input data, the last row (indexed by 0) to use. Defaults to the last row |
|||
* containing data. |
|||
* |
|||
* - googleSpreadsheetKey : String |
|||
* A Google Spreadsheet key. See https://developers.google.com/gdata/samples/spreadsheet_sample
|
|||
* for general information on GS. |
|||
* |
|||
* - googleSpreadsheetWorksheet : String |
|||
* The Google Spreadsheet worksheet. The available id's can be read from |
|||
* https://spreadsheets.google.com/feeds/worksheets/{key}/public/basic
|
|||
* |
|||
* - itemDelimiter : String |
|||
* Item or cell delimiter for parsing CSV. Defaults to ",". |
|||
* |
|||
* - lineDelimiter : String |
|||
* Line delimiter for parsing CSV. Defaults to "\n". |
|||
* |
|||
* - parsed : Function |
|||
* A callback function to access the parsed columns, the two-dimentional input data |
|||
* array directly, before they are interpreted into series data and categories. |
|||
* |
|||
* - parseDate : Function |
|||
* A callback function to parse string representations of dates into JavaScript timestamps. |
|||
* Return an integer on success. |
|||
* |
|||
* - rows : Array<Array<Mixed>> |
|||
* The same as the columns input option, but defining rows intead of columns. |
|||
* |
|||
* - startColumn : Integer |
|||
* In tabular input data, the first column (indexed by 0) to use. |
|||
* |
|||
* - startRow : Integer |
|||
* In tabular input data, the first row (indexed by 0) to use. |
|||
* |
|||
* - table : String|HTMLElement |
|||
* A HTML table or the id of such to be parsed as input data. Related options ara startRow, |
|||
* endRow, startColumn and endColumn to delimit what part of the table is used. |
|||
*/ |
|||
|
|||
// JSLint options:
|
|||
/*global jQuery */ |
|||
|
|||
(function (Highcharts) { |
|||
|
|||
// Utilities
|
|||
var each = Highcharts.each; |
|||
|
|||
|
|||
// The Data constructor
|
|||
var Data = function (dataOptions, chartOptions) { |
|||
this.init(dataOptions, chartOptions); |
|||
}; |
|||
|
|||
// Set the prototype properties
|
|||
Highcharts.extend(Data.prototype, { |
|||
|
|||
/** |
|||
* Initialize the Data object with the given options |
|||
*/ |
|||
init: function (options, chartOptions) { |
|||
this.options = options; |
|||
this.chartOptions = chartOptions; |
|||
this.columns = options.columns || this.rowsToColumns(options.rows) || []; |
|||
|
|||
// No need to parse or interpret anything
|
|||
if (this.columns.length) { |
|||
this.dataFound(); |
|||
|
|||
// Parse and interpret
|
|||
} else { |
|||
|
|||
// Parse a CSV string if options.csv is given
|
|||
this.parseCSV(); |
|||
|
|||
// Parse a HTML table if options.table is given
|
|||
this.parseTable(); |
|||
|
|||
// Parse a Google Spreadsheet
|
|||
this.parseGoogleSpreadsheet(); |
|||
} |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* Get the column distribution. For example, a line series takes a single column for |
|||
* Y values. A range series takes two columns for low and high values respectively, |
|||
* and an OHLC series takes four columns. |
|||
*/ |
|||
getColumnDistribution: function () { |
|||
var chartOptions = this.chartOptions, |
|||
getValueCount = function (type) { |
|||
return (Highcharts.seriesTypes[type || 'line'].prototype.pointArrayMap || [0]).length; |
|||
}, |
|||
globalType = chartOptions && chartOptions.chart && chartOptions.chart.type, |
|||
individualCounts = []; |
|||
|
|||
each((chartOptions && chartOptions.series) || [], function (series) { |
|||
individualCounts.push(getValueCount(series.type || globalType)); |
|||
}); |
|||
|
|||
this.valueCount = { |
|||
global: getValueCount(globalType), |
|||
individual: individualCounts |
|||
}; |
|||
}, |
|||
|
|||
|
|||
dataFound: function () { |
|||
// Interpret the values into right types
|
|||
this.parseTypes(); |
|||
|
|||
// Use first row for series names?
|
|||
this.findHeaderRow(); |
|||
|
|||
// Handle columns if a handleColumns callback is given
|
|||
this.parsed(); |
|||
|
|||
// Complete if a complete callback is given
|
|||
this.complete(); |
|||
|
|||
}, |
|||
|
|||
/** |
|||
* Parse a CSV input string |
|||
*/ |
|||
parseCSV: function () { |
|||
var self = this, |
|||
options = this.options, |
|||
csv = options.csv, |
|||
columns = this.columns, |
|||
startRow = options.startRow || 0, |
|||
endRow = options.endRow || Number.MAX_VALUE, |
|||
startColumn = options.startColumn || 0, |
|||
endColumn = options.endColumn || Number.MAX_VALUE, |
|||
lines, |
|||
activeRowNo = 0; |
|||
|
|||
if (csv) { |
|||
|
|||
lines = csv |
|||
.replace(/\r\n/g, "\n") // Unix
|
|||
.replace(/\r/g, "\n") // Mac
|
|||
.split(options.lineDelimiter || "\n"); |
|||
|
|||
each(lines, function (line, rowNo) { |
|||
var trimmed = self.trim(line), |
|||
isComment = trimmed.indexOf('#') === 0, |
|||
isBlank = trimmed === '', |
|||
items; |
|||
|
|||
if (rowNo >= startRow && rowNo <= endRow && !isComment && !isBlank) { |
|||
items = line.split(options.itemDelimiter || ','); |
|||
each(items, function (item, colNo) { |
|||
if (colNo >= startColumn && colNo <= endColumn) { |
|||
if (!columns[colNo - startColumn]) { |
|||
columns[colNo - startColumn] = []; |
|||
} |
|||
|
|||
columns[colNo - startColumn][activeRowNo] = item; |
|||
} |
|||
}); |
|||
activeRowNo += 1; |
|||
} |
|||
}); |
|||
|
|||
this.dataFound(); |
|||
} |
|||
}, |
|||
|
|||
/** |
|||
* Parse a HTML table |
|||
*/ |
|||
parseTable: function () { |
|||
var options = this.options, |
|||
table = options.table, |
|||
columns = this.columns, |
|||
startRow = options.startRow || 0, |
|||
endRow = options.endRow || Number.MAX_VALUE, |
|||
startColumn = options.startColumn || 0, |
|||
endColumn = options.endColumn || Number.MAX_VALUE, |
|||
colNo; |
|||
|
|||
if (table) { |
|||
|
|||
if (typeof table === 'string') { |
|||
table = document.getElementById(table); |
|||
} |
|||
|
|||
each(table.getElementsByTagName('tr'), function (tr, rowNo) { |
|||
colNo = 0; |
|||
if (rowNo >= startRow && rowNo <= endRow) { |
|||
each(tr.childNodes, function (item) { |
|||
if ((item.tagName === 'TD' || item.tagName === 'TH') && colNo >= startColumn && colNo <= endColumn) { |
|||
if (!columns[colNo]) { |
|||
columns[colNo] = []; |
|||
} |
|||
columns[colNo][rowNo - startRow] = item.innerHTML; |
|||
|
|||
colNo += 1; |
|||
} |
|||
}); |
|||
} |
|||
}); |
|||
|
|||
this.dataFound(); // continue
|
|||
} |
|||
}, |
|||
|
|||
/** |
|||
* TODO: |
|||
* - switchRowsAndColumns |
|||
*/ |
|||
parseGoogleSpreadsheet: function () { |
|||
var self = this, |
|||
options = this.options, |
|||
googleSpreadsheetKey = options.googleSpreadsheetKey, |
|||
columns = this.columns, |
|||
startRow = options.startRow || 0, |
|||
endRow = options.endRow || Number.MAX_VALUE, |
|||
startColumn = options.startColumn || 0, |
|||
endColumn = options.endColumn || Number.MAX_VALUE, |
|||
gr, // google row
|
|||
gc; // google column
|
|||
|
|||
if (googleSpreadsheetKey) { |
|||
jQuery.getJSON('https://spreadsheets.google.com/feeds/cells/' + |
|||
googleSpreadsheetKey + '/' + (options.googleSpreadsheetWorksheet || 'od6') + |
|||
'/public/values?alt=json-in-script&callback=?', |
|||
function (json) { |
|||
|
|||
// Prepare the data from the spreadsheat
|
|||
var cells = json.feed.entry, |
|||
cell, |
|||
cellCount = cells.length, |
|||
colCount = 0, |
|||
rowCount = 0, |
|||
i; |
|||
|
|||
// First, find the total number of columns and rows that
|
|||
// are actually filled with data
|
|||
for (i = 0; i < cellCount; i++) { |
|||
cell = cells[i]; |
|||
colCount = Math.max(colCount, cell.gs$cell.col); |
|||
rowCount = Math.max(rowCount, cell.gs$cell.row); |
|||
} |
|||
|
|||
// Set up arrays containing the column data
|
|||
for (i = 0; i < colCount; i++) { |
|||
if (i >= startColumn && i <= endColumn) { |
|||
// Create new columns with the length of either end-start or rowCount
|
|||
columns[i - startColumn] = []; |
|||
|
|||
// Setting the length to avoid jslint warning
|
|||
columns[i - startColumn].length = Math.min(rowCount, endRow - startRow); |
|||
} |
|||
} |
|||
|
|||
// Loop over the cells and assign the value to the right
|
|||
// place in the column arrays
|
|||
for (i = 0; i < cellCount; i++) { |
|||
cell = cells[i]; |
|||
gr = cell.gs$cell.row - 1; // rows start at 1
|
|||
gc = cell.gs$cell.col - 1; // columns start at 1
|
|||
|
|||
// If both row and col falls inside start and end
|
|||
// set the transposed cell value in the newly created columns
|
|||
if (gc >= startColumn && gc <= endColumn && |
|||
gr >= startRow && gr <= endRow) { |
|||
columns[gc - startColumn][gr - startRow] = cell.content.$t; |
|||
} |
|||
} |
|||
self.dataFound(); |
|||
}); |
|||
} |
|||
}, |
|||
|
|||
/** |
|||
* Find the header row. For now, we just check whether the first row contains |
|||
* numbers or strings. Later we could loop down and find the first row with |
|||
* numbers. |
|||
*/ |
|||
findHeaderRow: function () { |
|||
var headerRow = 0; |
|||
each(this.columns, function (column) { |
|||
if (typeof column[0] !== 'string') { |
|||
headerRow = null; |
|||
} |
|||
}); |
|||
this.headerRow = 0; |
|||
}, |
|||
|
|||
/** |
|||
* Trim a string from whitespace |
|||
*/ |
|||
trim: function (str) { |
|||
return typeof str === 'string' ? str.replace(/^\s+|\s+$/g, '') : str; |
|||
}, |
|||
|
|||
/** |
|||
* Parse numeric cells in to number types and date types in to true dates. |
|||
* @param {Object} columns |
|||
*/ |
|||
parseTypes: function () { |
|||
var columns = this.columns, |
|||
col = columns.length, |
|||
row, |
|||
val, |
|||
floatVal, |
|||
trimVal, |
|||
dateVal; |
|||
|
|||
while (col--) { |
|||
row = columns[col].length; |
|||
while (row--) { |
|||
val = columns[col][row]; |
|||
floatVal = parseFloat(val); |
|||
trimVal = this.trim(val); |
|||
|
|||
/*jslint eqeq: true*/ |
|||
if (trimVal == floatVal) { // is numeric
|
|||
/*jslint eqeq: false*/ |
|||
columns[col][row] = floatVal; |
|||
|
|||
// If the number is greater than milliseconds in a year, assume datetime
|
|||
if (floatVal > 365 * 24 * 3600 * 1000) { |
|||
columns[col].isDatetime = true; |
|||
} else { |
|||
columns[col].isNumeric = true; |
|||
} |
|||
|
|||
} else { // string, continue to determine if it is a date string or really a string
|
|||
dateVal = this.parseDate(val); |
|||
|
|||
if (col === 0 && typeof dateVal === 'number' && !isNaN(dateVal)) { // is date
|
|||
columns[col][row] = dateVal; |
|||
columns[col].isDatetime = true; |
|||
|
|||
} else { // string
|
|||
columns[col][row] = trimVal === '' ? null : trimVal; |
|||
} |
|||
} |
|||
|
|||
} |
|||
} |
|||
}, |
|||
//*
|
|||
dateFormats: { |
|||
'YYYY-mm-dd': { |
|||
regex: '^([0-9]{4})-([0-9]{2})-([0-9]{2})$', |
|||
parser: function (match) { |
|||
return Date.UTC(+match[1], match[2] - 1, +match[3]); |
|||
} |
|||
} |
|||
}, |
|||
// */
|
|||
/** |
|||
* Parse a date and return it as a number. Overridable through options.parseDate. |
|||
*/ |
|||
parseDate: function (val) { |
|||
var parseDate = this.options.parseDate, |
|||
ret, |
|||
key, |
|||
format, |
|||
match; |
|||
|
|||
if (parseDate) { |
|||
ret = parseDate(val); |
|||
} |
|||
|
|||
if (typeof val === 'string') { |
|||
for (key in this.dateFormats) { |
|||
format = this.dateFormats[key]; |
|||
match = val.match(format.regex); |
|||
if (match) { |
|||
ret = format.parser(match); |
|||
} |
|||
} |
|||
} |
|||
return ret; |
|||
}, |
|||
|
|||
/** |
|||
* Reorganize rows into columns |
|||
*/ |
|||
rowsToColumns: function (rows) { |
|||
var row, |
|||
rowsLength, |
|||
col, |
|||
colsLength, |
|||
columns; |
|||
|
|||
if (rows) { |
|||
columns = []; |
|||
rowsLength = rows.length; |
|||
for (row = 0; row < rowsLength; row++) { |
|||
colsLength = rows[row].length; |
|||
for (col = 0; col < colsLength; col++) { |
|||
if (!columns[col]) { |
|||
columns[col] = []; |
|||
} |
|||
columns[col][row] = rows[row][col]; |
|||
} |
|||
} |
|||
} |
|||
return columns; |
|||
}, |
|||
|
|||
/** |
|||
* A hook for working directly on the parsed columns |
|||
*/ |
|||
parsed: function () { |
|||
if (this.options.parsed) { |
|||
this.options.parsed.call(this, this.columns); |
|||
} |
|||
}, |
|||
|
|||
/** |
|||
* If a complete callback function is provided in the options, interpret the |
|||
* columns into a Highcharts options object. |
|||
*/ |
|||
complete: function () { |
|||
|
|||
var columns = this.columns, |
|||
firstCol, |
|||
type, |
|||
options = this.options, |
|||
valueCount, |
|||
series, |
|||
data, |
|||
i, |
|||
j, |
|||
seriesIndex; |
|||
|
|||
|
|||
if (options.complete) { |
|||
|
|||
this.getColumnDistribution(); |
|||
|
|||
// Use first column for X data or categories?
|
|||
if (columns.length > 1) { |
|||
firstCol = columns.shift(); |
|||
if (this.headerRow === 0) { |
|||
firstCol.shift(); // remove the first cell
|
|||
} |
|||
|
|||
|
|||
if (firstCol.isDatetime) { |
|||
type = 'datetime'; |
|||
} else if (!firstCol.isNumeric) { |
|||
type = 'category'; |
|||
} |
|||
} |
|||
|
|||
// Get the names and shift the top row
|
|||
for (i = 0; i < columns.length; i++) { |
|||
if (this.headerRow === 0) { |
|||
columns[i].name = columns[i].shift(); |
|||
} |
|||
} |
|||
|
|||
// Use the next columns for series
|
|||
series = []; |
|||
for (i = 0, seriesIndex = 0; i < columns.length; seriesIndex++) { |
|||
|
|||
// This series' value count
|
|||
valueCount = Highcharts.pick(this.valueCount.individual[seriesIndex], this.valueCount.global); |
|||
|
|||
// Iterate down the cells of each column and add data to the series
|
|||
data = []; |
|||
for (j = 0; j < columns[i].length; j++) { |
|||
data[j] = [ |
|||
firstCol[j], |
|||
columns[i][j] !== undefined ? columns[i][j] : null |
|||
]; |
|||
if (valueCount > 1) { |
|||
data[j].push(columns[i + 1][j] !== undefined ? columns[i + 1][j] : null); |
|||
} |
|||
if (valueCount > 2) { |
|||
data[j].push(columns[i + 2][j] !== undefined ? columns[i + 2][j] : null); |
|||
} |
|||
if (valueCount > 3) { |
|||
data[j].push(columns[i + 3][j] !== undefined ? columns[i + 3][j] : null); |
|||
} |
|||
if (valueCount > 4) { |
|||
data[j].push(columns[i + 4][j] !== undefined ? columns[i + 4][j] : null); |
|||
} |
|||
} |
|||
|
|||
// Add the series
|
|||
series[seriesIndex] = { |
|||
name: columns[i].name, |
|||
data: data |
|||
}; |
|||
|
|||
i += valueCount; |
|||
} |
|||
|
|||
// Do the callback
|
|||
options.complete({ |
|||
xAxis: { |
|||
type: type |
|||
}, |
|||
series: series |
|||
}); |
|||
} |
|||
} |
|||
}); |
|||
|
|||
// Register the Data prototype and data function on Highcharts
|
|||
Highcharts.Data = Data; |
|||
Highcharts.data = function (options, chartOptions) { |
|||
return new Data(options, chartOptions); |
|||
}; |
|||
|
|||
// Extend Chart.init so that the Chart constructor accepts a new configuration
|
|||
// option group, data.
|
|||
Highcharts.wrap(Highcharts.Chart.prototype, 'init', function (proceed, userOptions, callback) { |
|||
var chart = this; |
|||
|
|||
if (userOptions && userOptions.data) { |
|||
Highcharts.data(Highcharts.extend(userOptions.data, { |
|||
complete: function (dataOptions) { |
|||
|
|||
// Merge series configs
|
|||
if (userOptions.series) { |
|||
each(userOptions.series, function (series, i) { |
|||
userOptions.series[i] = Highcharts.merge(series, dataOptions.series[i]); |
|||
}); |
|||
} |
|||
|
|||
// Do the merge
|
|||
userOptions = Highcharts.merge(dataOptions, userOptions); |
|||
|
|||
proceed.call(chart, userOptions, callback); |
|||
} |
|||
}), userOptions); |
|||
} else { |
|||
proceed.call(chart, userOptions, callback); |
|||
} |
|||
}); |
|||
|
|||
}(Highcharts)); |
|||
@ -0,0 +1,254 @@ |
|||
/** |
|||
* Dark blue theme for Highcharts JS |
|||
* @author Torstein Hønsi |
|||
*/ |
|||
|
|||
Highcharts.theme = { |
|||
colors: ["#DDDF0D", "#55BF3B", "#DF5353", "#7798BF", "#aaeeee", "#ff0066", "#eeaaee", |
|||
"#55BF3B", "#DF5353", "#7798BF", "#aaeeee"], |
|||
chart: { |
|||
backgroundColor: { |
|||
linearGradient: { x1: 0, y1: 0, x2: 1, y2: 1 }, |
|||
stops: [ |
|||
[0, 'rgb(48, 48, 96)'], |
|||
[1, 'rgb(0, 0, 0)'] |
|||
] |
|||
}, |
|||
borderColor: '#000000', |
|||
borderWidth: 2, |
|||
className: 'dark-container', |
|||
plotBackgroundColor: 'rgba(255, 255, 255, .1)', |
|||
plotBorderColor: '#CCCCCC', |
|||
plotBorderWidth: 1 |
|||
}, |
|||
title: { |
|||
style: { |
|||
color: '#C0C0C0', |
|||
font: 'bold 16px "Trebuchet MS", Verdana, sans-serif' |
|||
} |
|||
}, |
|||
subtitle: { |
|||
style: { |
|||
color: '#666666', |
|||
font: 'bold 12px "Trebuchet MS", Verdana, sans-serif' |
|||
} |
|||
}, |
|||
xAxis: { |
|||
gridLineColor: '#333333', |
|||
gridLineWidth: 1, |
|||
labels: { |
|||
style: { |
|||
color: '#A0A0A0' |
|||
} |
|||
}, |
|||
lineColor: '#A0A0A0', |
|||
tickColor: '#A0A0A0', |
|||
title: { |
|||
style: { |
|||
color: '#CCC', |
|||
fontWeight: 'bold', |
|||
fontSize: '12px', |
|||
fontFamily: 'Trebuchet MS, Verdana, sans-serif' |
|||
|
|||
} |
|||
} |
|||
}, |
|||
yAxis: { |
|||
gridLineColor: '#333333', |
|||
labels: { |
|||
style: { |
|||
color: '#A0A0A0' |
|||
} |
|||
}, |
|||
lineColor: '#A0A0A0', |
|||
minorTickInterval: null, |
|||
tickColor: '#A0A0A0', |
|||
tickWidth: 1, |
|||
title: { |
|||
style: { |
|||
color: '#CCC', |
|||
fontWeight: 'bold', |
|||
fontSize: '12px', |
|||
fontFamily: 'Trebuchet MS, Verdana, sans-serif' |
|||
} |
|||
} |
|||
}, |
|||
tooltip: { |
|||
backgroundColor: 'rgba(0, 0, 0, 0.75)', |
|||
style: { |
|||
color: '#F0F0F0' |
|||
} |
|||
}, |
|||
toolbar: { |
|||
itemStyle: { |
|||
color: 'silver' |
|||
} |
|||
}, |
|||
plotOptions: { |
|||
line: { |
|||
dataLabels: { |
|||
color: '#CCC' |
|||
}, |
|||
marker: { |
|||
lineColor: '#333' |
|||
} |
|||
}, |
|||
spline: { |
|||
marker: { |
|||
lineColor: '#333' |
|||
} |
|||
}, |
|||
scatter: { |
|||
marker: { |
|||
lineColor: '#333' |
|||
} |
|||
}, |
|||
candlestick: { |
|||
lineColor: 'white' |
|||
} |
|||
}, |
|||
legend: { |
|||
itemStyle: { |
|||
font: '9pt Trebuchet MS, Verdana, sans-serif', |
|||
color: '#A0A0A0' |
|||
}, |
|||
itemHoverStyle: { |
|||
color: '#FFF' |
|||
}, |
|||
itemHiddenStyle: { |
|||
color: '#444' |
|||
} |
|||
}, |
|||
credits: { |
|||
style: { |
|||
color: '#666' |
|||
} |
|||
}, |
|||
labels: { |
|||
style: { |
|||
color: '#CCC' |
|||
} |
|||
}, |
|||
|
|||
navigation: { |
|||
buttonOptions: { |
|||
symbolStroke: '#DDDDDD', |
|||
hoverSymbolStroke: '#FFFFFF', |
|||
theme: { |
|||
fill: { |
|||
linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 }, |
|||
stops: [ |
|||
[0.4, '#606060'], |
|||
[0.6, '#333333'] |
|||
] |
|||
}, |
|||
stroke: '#000000' |
|||
} |
|||
} |
|||
}, |
|||
|
|||
// scroll charts
|
|||
rangeSelector: { |
|||
buttonTheme: { |
|||
fill: { |
|||
linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 }, |
|||
stops: [ |
|||
[0.4, '#888'], |
|||
[0.6, '#555'] |
|||
] |
|||
}, |
|||
stroke: '#000000', |
|||
style: { |
|||
color: '#CCC', |
|||
fontWeight: 'bold' |
|||
}, |
|||
states: { |
|||
hover: { |
|||
fill: { |
|||
linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 }, |
|||
stops: [ |
|||
[0.4, '#BBB'], |
|||
[0.6, '#888'] |
|||
] |
|||
}, |
|||
stroke: '#000000', |
|||
style: { |
|||
color: 'white' |
|||
} |
|||
}, |
|||
select: { |
|||
fill: { |
|||
linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 }, |
|||
stops: [ |
|||
[0.1, '#000'], |
|||
[0.3, '#333'] |
|||
] |
|||
}, |
|||
stroke: '#000000', |
|||
style: { |
|||
color: 'yellow' |
|||
} |
|||
} |
|||
} |
|||
}, |
|||
inputStyle: { |
|||
backgroundColor: '#333', |
|||
color: 'silver' |
|||
}, |
|||
labelStyle: { |
|||
color: 'silver' |
|||
} |
|||
}, |
|||
|
|||
navigator: { |
|||
handles: { |
|||
backgroundColor: '#666', |
|||
borderColor: '#AAA' |
|||
}, |
|||
outlineColor: '#CCC', |
|||
maskFill: 'rgba(16, 16, 16, 0.5)', |
|||
series: { |
|||
color: '#7798BF', |
|||
lineColor: '#A6C7ED' |
|||
} |
|||
}, |
|||
|
|||
scrollbar: { |
|||
barBackgroundColor: { |
|||
linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 }, |
|||
stops: [ |
|||
[0.4, '#888'], |
|||
[0.6, '#555'] |
|||
] |
|||
}, |
|||
barBorderColor: '#CCC', |
|||
buttonArrowColor: '#CCC', |
|||
buttonBackgroundColor: { |
|||
linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 }, |
|||
stops: [ |
|||
[0.4, '#888'], |
|||
[0.6, '#555'] |
|||
] |
|||
}, |
|||
buttonBorderColor: '#CCC', |
|||
rifleColor: '#FFF', |
|||
trackBackgroundColor: { |
|||
linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 }, |
|||
stops: [ |
|||
[0, '#000'], |
|||
[1, '#333'] |
|||
] |
|||
}, |
|||
trackBorderColor: '#666' |
|||
}, |
|||
|
|||
// special colors for some of the
|
|||
legendBackgroundColor: 'rgba(0, 0, 0, 0.5)', |
|||
legendBackgroundColorSolid: 'rgb(35, 35, 70)', |
|||
dataLabelsColor: '#444', |
|||
textColor: '#C0C0C0', |
|||
maskColor: 'rgba(255,255,255,0.3)' |
|||
}; |
|||
|
|||
// Apply the theme
|
|||
var highchartsOptions = Highcharts.setOptions(Highcharts.theme); |
|||
@ -0,0 +1,255 @@ |
|||
/** |
|||
* Dark blue theme for Highcharts JS |
|||
* @author Torstein Hønsi |
|||
*/ |
|||
|
|||
Highcharts.theme = { |
|||
colors: ["#DDDF0D", "#55BF3B", "#DF5353", "#7798BF", "#aaeeee", "#ff0066", "#eeaaee", |
|||
"#55BF3B", "#DF5353", "#7798BF", "#aaeeee"], |
|||
chart: { |
|||
backgroundColor: { |
|||
linearGradient: [0, 0, 250, 500], |
|||
stops: [ |
|||
[0, 'rgb(48, 96, 48)'], |
|||
[1, 'rgb(0, 0, 0)'] |
|||
] |
|||
}, |
|||
borderColor: '#000000', |
|||
borderWidth: 2, |
|||
className: 'dark-container', |
|||
plotBackgroundColor: 'rgba(255, 255, 255, .1)', |
|||
plotBorderColor: '#CCCCCC', |
|||
plotBorderWidth: 1 |
|||
}, |
|||
title: { |
|||
style: { |
|||
color: '#C0C0C0', |
|||
font: 'bold 16px "Trebuchet MS", Verdana, sans-serif' |
|||
} |
|||
}, |
|||
subtitle: { |
|||
style: { |
|||
color: '#666666', |
|||
font: 'bold 12px "Trebuchet MS", Verdana, sans-serif' |
|||
} |
|||
}, |
|||
xAxis: { |
|||
gridLineColor: '#333333', |
|||
gridLineWidth: 1, |
|||
labels: { |
|||
style: { |
|||
color: '#A0A0A0' |
|||
} |
|||
}, |
|||
lineColor: '#A0A0A0', |
|||
tickColor: '#A0A0A0', |
|||
title: { |
|||
style: { |
|||
color: '#CCC', |
|||
fontWeight: 'bold', |
|||
fontSize: '12px', |
|||
fontFamily: 'Trebuchet MS, Verdana, sans-serif' |
|||
|
|||
} |
|||
} |
|||
}, |
|||
yAxis: { |
|||
gridLineColor: '#333333', |
|||
labels: { |
|||
style: { |
|||
color: '#A0A0A0' |
|||
} |
|||
}, |
|||
lineColor: '#A0A0A0', |
|||
minorTickInterval: null, |
|||
tickColor: '#A0A0A0', |
|||
tickWidth: 1, |
|||
title: { |
|||
style: { |
|||
color: '#CCC', |
|||
fontWeight: 'bold', |
|||
fontSize: '12px', |
|||
fontFamily: 'Trebuchet MS, Verdana, sans-serif' |
|||
} |
|||
} |
|||
}, |
|||
tooltip: { |
|||
backgroundColor: 'rgba(0, 0, 0, 0.75)', |
|||
style: { |
|||
color: '#F0F0F0' |
|||
} |
|||
}, |
|||
toolbar: { |
|||
itemStyle: { |
|||
color: 'silver' |
|||
} |
|||
}, |
|||
plotOptions: { |
|||
line: { |
|||
dataLabels: { |
|||
color: '#CCC' |
|||
}, |
|||
marker: { |
|||
lineColor: '#333' |
|||
} |
|||
}, |
|||
spline: { |
|||
marker: { |
|||
lineColor: '#333' |
|||
} |
|||
}, |
|||
scatter: { |
|||
marker: { |
|||
lineColor: '#333' |
|||
} |
|||
}, |
|||
candlestick: { |
|||
lineColor: 'white' |
|||
} |
|||
}, |
|||
legend: { |
|||
itemStyle: { |
|||
font: '9pt Trebuchet MS, Verdana, sans-serif', |
|||
color: '#A0A0A0' |
|||
}, |
|||
itemHoverStyle: { |
|||
color: '#FFF' |
|||
}, |
|||
itemHiddenStyle: { |
|||
color: '#444' |
|||
} |
|||
}, |
|||
credits: { |
|||
style: { |
|||
color: '#666' |
|||
} |
|||
}, |
|||
labels: { |
|||
style: { |
|||
color: '#CCC' |
|||
} |
|||
}, |
|||
|
|||
|
|||
navigation: { |
|||
buttonOptions: { |
|||
symbolStroke: '#DDDDDD', |
|||
hoverSymbolStroke: '#FFFFFF', |
|||
theme: { |
|||
fill: { |
|||
linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 }, |
|||
stops: [ |
|||
[0.4, '#606060'], |
|||
[0.6, '#333333'] |
|||
] |
|||
}, |
|||
stroke: '#000000' |
|||
} |
|||
} |
|||
}, |
|||
|
|||
// scroll charts
|
|||
rangeSelector: { |
|||
buttonTheme: { |
|||
fill: { |
|||
linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 }, |
|||
stops: [ |
|||
[0.4, '#888'], |
|||
[0.6, '#555'] |
|||
] |
|||
}, |
|||
stroke: '#000000', |
|||
style: { |
|||
color: '#CCC', |
|||
fontWeight: 'bold' |
|||
}, |
|||
states: { |
|||
hover: { |
|||
fill: { |
|||
linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 }, |
|||
stops: [ |
|||
[0.4, '#BBB'], |
|||
[0.6, '#888'] |
|||
] |
|||
}, |
|||
stroke: '#000000', |
|||
style: { |
|||
color: 'white' |
|||
} |
|||
}, |
|||
select: { |
|||
fill: { |
|||
linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 }, |
|||
stops: [ |
|||
[0.1, '#000'], |
|||
[0.3, '#333'] |
|||
] |
|||
}, |
|||
stroke: '#000000', |
|||
style: { |
|||
color: 'yellow' |
|||
} |
|||
} |
|||
} |
|||
}, |
|||
inputStyle: { |
|||
backgroundColor: '#333', |
|||
color: 'silver' |
|||
}, |
|||
labelStyle: { |
|||
color: 'silver' |
|||
} |
|||
}, |
|||
|
|||
navigator: { |
|||
handles: { |
|||
backgroundColor: '#666', |
|||
borderColor: '#AAA' |
|||
}, |
|||
outlineColor: '#CCC', |
|||
maskFill: 'rgba(16, 16, 16, 0.5)', |
|||
series: { |
|||
color: '#7798BF', |
|||
lineColor: '#A6C7ED' |
|||
} |
|||
}, |
|||
|
|||
scrollbar: { |
|||
barBackgroundColor: { |
|||
linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 }, |
|||
stops: [ |
|||
[0.4, '#888'], |
|||
[0.6, '#555'] |
|||
] |
|||
}, |
|||
barBorderColor: '#CCC', |
|||
buttonArrowColor: '#CCC', |
|||
buttonBackgroundColor: { |
|||
linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 }, |
|||
stops: [ |
|||
[0.4, '#888'], |
|||
[0.6, '#555'] |
|||
] |
|||
}, |
|||
buttonBorderColor: '#CCC', |
|||
rifleColor: '#FFF', |
|||
trackBackgroundColor: { |
|||
linearGradient: { x1: 0, y1: 0, x2: 0, y2: 1 }, |
|||
stops: [ |
|||
[0, '#000'], |
|||
[1, '#333'] |
|||
] |
|||
}, |
|||
trackBorderColor: '#666' |
|||
}, |
|||
|
|||
// special colors for some of the
|
|||
legendBackgroundColor: 'rgba(0, 0, 0, 0.5)', |
|||
legendBackgroundColorSolid: 'rgb(35, 35, 70)', |
|||
dataLabelsColor: '#444', |
|||
textColor: '#C0C0C0', |
|||
maskColor: 'rgba(255,255,255,0.3)' |
|||
}; |
|||
|
|||
// Apply the theme
|
|||
var highchartsOptions = Highcharts.setOptions(Highcharts.theme); |
|||
@ -0,0 +1 @@ |
|||
.star-recycle .search-box,.star-recycle .search-form{-webkit-box-align:center;-ms-flex-align:center;align-items:center}.star-recycle .search-box .margin,.star-recycle .search-form .margin{margin:0 20px}.star-recycle .search-box .btn-action,.star-recycle .search-form .btn-action{background-color:#f1f2f6;border-color:#f1f2f6}.star-recycle .search-box .btn-action:hover,.star-recycle .search-form .btn-action:hover{background-color:#3296fa;color:#fff;border-color:#3296fa}.star-recycle .search-box .el-checkbox,.star-recycle .search-form .el-checkbox{margin-bottom:0}.star-recycle .recycle-list{margin:-12.5px}.star-recycle .recycle-list--empty{color:#999;text-align:center}.star-recycle .recycle-list--empty i{color:#3296fa}.star-recycle .recycle-list .recycle-item{width:360px;display:inline-block;-webkit-box-sizing:border-box;box-sizing:border-box;font-size:0;padding:12.5px;vertical-align:middle}.star-recycle .recycle-list .recycle-item__box{border:1px solid #e8e9eb;padding:20px;cursor:pointer;position:relative;z-index:1}.star-recycle .recycle-list .recycle-item__box:hover{border-color:#3296fa}.star-recycle .recycle-list .recycle-item__box:hover .recycle-item__name{color:#3296fa}.star-recycle .recycle-list .recycle-item__info{display:-webkit-box;display:-ms-flexbox;display:flex;font-size:14px;margin-bottom:20px}.star-recycle .recycle-list .recycle-item__logo{width:50px;height:50px;border-radius:50%;margin-right:10px}.star-recycle .recycle-list .recycle-item__content{-webkit-box-flex:1;-ms-flex:1;flex:1;width:0}.star-recycle .recycle-list .recycle-item__name{font-size:16px;color:#333;margin-bottom:15px}.star-recycle .recycle-list .recycle-item__desc{font-size:14px;color:grey}.star-recycle .recycle-list .recycle-item__action{height:20px;font-size:20px;color:#999;text-align:right;line-height:30px}.star-recycle .recycle-list .recycle-item__action i{margin-left:20px}.star-recycle .recycle-list .recycle-item__right{width:20px;-ms-flex-item-align:baseline;align-self:baseline;margin-top:-5px;text-align:center;position:absolute;right:15px;top:15px;z-index:-1}.star-recycle .recycle-list .recycle-item__right .el-checkbox__label{display:none}.star-popover.el-popover{padding:3px;min-width:auto;text-align:center;font-size:12px} |
|||
@ -0,0 +1,52 @@ |
|||
.dialog--domain .el-alert{margin-bottom:10px} |
|||
.star-item{display:inline-block;width:320px;font-size:0;padding:10px;vertical-align:middle} |
|||
.star-item--module .star-item__box{background-color:#fffaf5} |
|||
.star-item--module .star-item__logo{border-radius:5px} |
|||
.star-item--module .star-item__footer{color:grey;cursor:pointer;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;position:relative} |
|||
.star-item--module .star-item__footer>span{-webkit-box-flex:1;-ms-flex:1;flex:1;width:0} |
|||
.star-item--welcome .star-item__box{background-color:#fffaf6} |
|||
.star-item--welcome .star-item__footer{margin:0 20px;border-top:1px solid #e8e9eb;text-align:center;display:block} |
|||
.star-item__box{border:1px solid #e8e9eb;position:relative;cursor:pointer;background-color:#f5f5ff} |
|||
.star-item__box:hover{border-color:#3296fa} |
|||
.star-item__box:hover .star-item__star{display:inline-block} |
|||
.star-item__box:hover .star-item__action{display:block} |
|||
.star-item__box:hover .star-item__right .item{display:inline-block} |
|||
.star-item__info{padding:25px;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center} |
|||
.star-item__info:hover .star-item__name{color:#3296fa} |
|||
.star-item__logo{width:50px!important;height:50px!important;border-radius:50%;margin-right:20px} |
|||
.star-item__content{-webkit-box-flex:1;-ms-flex:1;flex:1;width:0} |
|||
.star-item__right{width:20px;-ms-flex-item-align:baseline;align-self:baseline;margin-top:-5px;text-align:center;position:absolute;right:15px} |
|||
.star-item__right .item{color:#ccc;display:none;line-height:1;margin-bottom:8px;font-size:20px} |
|||
.star-item__right .item:hover{color:#b3b3b3} |
|||
.star-item__move{font-size:16px!important;display:none;cursor:move;line-height:1} |
|||
.star-item__star{color:#e8e9eb;display:none;cursor:pointer;line-height:1} |
|||
.star-item__star .item{font-size:20px} |
|||
.star-item__star.active{display:inline-block} |
|||
.star-item__star.active .item{display:inline-block;color:#eeb336} |
|||
.star-item__star.active .item:hover{color:#d99b16} |
|||
.star-item__name{font-size:16px;color:#333;margin-bottom:8px} |
|||
.star-item__desc{font-size:14px;color:grey} |
|||
.star-item__footer{height:50px;font-size:14px;padding:0 15px 0 20px;line-height:50px;color:#3296fa;display:-webkit-box;display:-ms-flexbox;display:flex} |
|||
.star-item__footer .icon{margin-right:10px} |
|||
.star-item__go{-webkit-box-flex:1;-ms-flex:1;flex:1;width:0} |
|||
.star-item__go .icon{font-size:20px;vertical-align:middle} |
|||
.star-item__go:hover:after{content:">"} |
|||
.star-item__action{display:none;color:#999} |
|||
.star-item__action i{margin-left:15px} |
|||
.star-item__account{display:inline-block;border-top:1px solid #e8e9eb;padding-right:30px;margin-right:30px} |
|||
.star-item__accountblock{-webkit-box-flex:1;-ms-flex:1 1 auto;flex:1 1 auto;width:0} |
|||
.star-item__accountlogo{width:30px!important;height:30px!important;border-radius:50%;-webkit-box-flex:0;-ms-flex:0 0 auto;flex:0 0 auto} |
|||
.star-popover.el-popover{padding:3px;min-width:auto;text-align:center;font-size:12px} |
|||
.el-dropdown-menu__item.star-active{background-color:#ebf5ff;color:#3296fa} |
|||
.dialog-type.el-dialog{width:990px} |
|||
.sortable-opacity{opacity:1!important} |
|||
.star-sort-item{display:block;color:#333;font-size:14px} |
|||
.star-sort-item+.star-sort-item{margin-top:10px} |
|||
.star-sort-item.active{color:#3296fa} |
|||
.account-num{font-size:12px;color:grey} |
|||
.account-num .label-text{padding:0 10px;border-left:1px solid #e8e9eb} |
|||
.account-num .label-text:first-child{border:0} |
|||
.account-num .num{font-size:16px;vertical-align:-1px;padding-right:10px;font-weight:600} |
|||
.account-num .icon{width:24px;height:24px;text-align:center;line-height:24px;display:inline-block;vertical-align:middle;margin-left:10px;font-size:18px;color:grey;cursor:pointer} |
|||
.account-num .icon:hover{background-color:#f0f2f5} |
|||
.account-num .icon.el-icon-setting,.account-num .star-add{margin-left:20px} |
|||
@ -0,0 +1 @@ |
|||
.account-header-info{padding:30px;background-color:#f7f8fa;display:-webkit-box;display:-ms-flexbox;display:flex;color:#999;-webkit-box-align:center;-ms-flex-align:center;align-items:center;margin-bottom:30px}.account-header-info .account-logo{width:60px;height:60px;border-radius:50%;margin-right:30px}.account-header-info .info{-webkit-box-flex:1;-ms-flex:1;flex:1;width:0}.account-header-info .title{color:#252424;margin-bottom:10px}.account-header-info .type i{margin-right:5px}.dialog--domain .el-alert{margin-bottom:10px}.star-item{display:inline-block;width:300px;font-size:0;padding:10px;vertical-align:middle}.star-item--module .star-item__box{background-color:#fffaf5}.star-item--module .star-item__logo{border-radius:5px}.star-item--module .star-item__footer{color:grey;cursor:pointer;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center;position:relative}.star-item--module .star-item__footer>span{-webkit-box-flex:1;-ms-flex:1;flex:1;width:0}.star-item--welcome .star-item__box{background-color:#fffaf6}.star-item--welcome .star-item__footer{margin:0 20px;border-top:1px solid #e8e9eb;text-align:center;display:block}.star-item__box{border:1px solid #e8e9eb;position:relative;cursor:pointer;background-color:#f5f5ff}.star-item__box:hover{border-color:#3296fa}.star-item__box:hover .star-item__star{display:inline-block}.star-item__box:hover .star-item__action{display:block}.star-item__box:hover .star-item__right .item{display:inline-block}.star-item__info{padding:20px 60px 20px 20px;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-align:center;-ms-flex-align:center;align-items:center}.star-item__info:hover .star-item__name{color:#3296fa}.star-item__logo{width:50px!important;height:50px!important;border-radius:50%;margin-right:20px}.star-item__content{-webkit-box-flex:1;-ms-flex:1;flex:1;width:0}.star-item__right{width:20px;-ms-flex-item-align:baseline;align-self:baseline;margin-top:-5px;text-align:center;position:absolute;right:15px}.star-item__right .item{color:#ccc;display:none;line-height:1;margin-bottom:8px;font-size:20px}.star-item__right .item:hover{color:#b3b3b3}.star-item__move{font-size:16px!important;display:none;cursor:move;line-height:1}.star-item__star{color:#e8e9eb;display:none;cursor:pointer;line-height:1}.star-item__star .item{font-size:20px}.star-item__star.active{display:inline-block}.star-item__star.active .item{display:inline-block;color:#eeb336}.star-item__star.active .item:hover{color:#d99b16}.star-item__name{font-size:16px;color:#333;margin-bottom:8px}.star-item__desc{font-size:14px;color:grey}.star-item__footer{height:50px;font-size:14px;padding:0 15px 0 20px;line-height:50px;color:#3296fa;display:-webkit-box;display:-ms-flexbox;display:flex}.star-item__footer .icon{margin-right:10px}.star-item__go{-webkit-box-flex:1;-ms-flex:1;flex:1;width:0}.star-item__go .icon{font-size:20px;vertical-align:middle}.star-item__go:hover:after{content:">"}.star-item__action{display:none;color:#999}.star-item__action i{margin-left:15px}.star-item__account{display:inline-block;border-top:1px solid #e8e9eb;padding-right:30px;margin-right:30px}.star-item__accountblock{-webkit-box-flex:1;-ms-flex:1 1 auto;flex:1 1 auto;width:0}.star-item__accountlogo{width:30px!important;height:30px!important;border-radius:50%;-webkit-box-flex:0;-ms-flex:0 0 auto;flex:0 0 auto}.star-popover.el-popover{padding:3px;min-width:auto;text-align:center;font-size:12px}.star-list{margin:-12.5px;font-size:0}.star-list--empty{font-size:14px;color:#4c4c4c;text-align:center;margin:40px auto}.star-list--empty i{color:#3296fa;margin-right:30px;font-size:20px;vertical-align:middle}.star-list .bottom{padding:20px 0;color:#989898;text-align:center;font-size:14px}.star-list .bottom .el-icon-loading{color:#3296fa} |
|||
@ -0,0 +1,20 @@ |
|||
.star-flex{display:-webkit-box;display:-ms-flexbox;display:flex} |
|||
.star-flex .star-menu{width:250px} |
|||
.star-flex .star-menu .item{width:100%;-webkit-box-sizing:border-box;box-sizing:border-box;cursor:pointer;padding:0 20px;display:inline-block;height:40px;line-height:40px;color:#333;font-size:14px} |
|||
.star-flex .star-menu .item.router-link-active{background-color:#e5f2ff;color:#3296fa} |
|||
.star-flex .star-menu .item.router-link-active .icon{color:#3296fa} |
|||
.star-flex .star-menu .item:hover{background-color:#f0f2f5} |
|||
.star-flex .star-menu .item .num{float:right;color:#999} |
|||
.star-flex .star-menu .item .icon{font-size:22px;vertical-align:middle;color:#b3b3b3;margin-right:8px} |
|||
.star-flex .star-menu .parent-item{color:grey;padding:0 20px;margin-top:30px;line-height:40px} |
|||
.star-flex .star-menu .child-ul{height:120px;overflow:hidden;-webkit-transition:all .5s;transition:all .5s} |
|||
.star-flex .star-menu .child-ul.more{height:auto} |
|||
.star-flex .star-menu .show-more{padding:0 20px;line-height:40px;color:grey;font-size:14px;cursor:pointer} |
|||
.star-flex .star-menu .show-more:hover{color:#3296fa} |
|||
.star-flex .star-menu .show-more i{font-size:20px;vertical-align:middle} |
|||
.star-flex .star-content{width:0;-webkit-box-flex:1;-ms-flex:1;flex:1;padding:0 55px 0 60px} |
|||
.star-flex .star-list{margin:-10px;font-size:0} |
|||
.star-flex .star-list--empty{font-size:14px;color:#4c4c4c;text-align:center;margin:40px auto} |
|||
.star-flex .star-list--empty i{color:#3296fa;margin-right:10px;font-size:20px;vertical-align:middle} |
|||
.star-flex .star-list .bottom{padding:20px 0;color:#989898;text-align:center;font-size:14px} |
|||
.star-flex .star-list .bottom .el-icon-loading{color:#3296fa} |
|||
@ -0,0 +1,390 @@ |
|||
(window["webpackJsonp"] = window["webpackJsonp"] || []).push([["chunk-43bc671b"], { |
|||
"287d": function (t, e, a) { |
|||
}, "2ef9": function (t, e, a) { |
|||
"use strict"; |
|||
var i = a("287d"), s = a.n(i); |
|||
s.a |
|||
}, "4a06": function (t, e, a) { |
|||
}, "7f7f": function (t, e, a) { |
|||
var i = a("86cc").f, s = Function.prototype, n = /^\s*function ([^ (]*)/, o = "name"; |
|||
o in s || a("9e1e") && i(s, o, { |
|||
configurable: !0, get: function () { |
|||
try { |
|||
return ("" + this).match(n)[1] |
|||
} catch (t) { |
|||
return "" |
|||
} |
|||
} |
|||
}) |
|||
}, "86b2": function (t, e, a) { |
|||
"use strict"; |
|||
var i = function () { |
|||
var t = this, e = t.$createElement, a = t._self._c || e; |
|||
return "account" == t.item.list_type ? a("div", {staticClass: "star-item star-item--account"}, [a("div", {staticClass: "star-item__box"}, [a("div", {staticClass: "star-item__info"}, [a("img", { |
|||
directives: [{ |
|||
name: "lazy", |
|||
rawName: "v-lazy", |
|||
value: t.item.logo, |
|||
expression: "item.logo" |
|||
}], staticClass: "star-item__logo account-logo", attrs: {alt: ""}, on: { |
|||
click: function (e) { |
|||
return t.goUrl(t.item.switchurl) |
|||
} |
|||
} |
|||
}), a("div", { |
|||
staticClass: "star-item__content", on: { |
|||
click: function (e) { |
|||
return t.goUrl(t.item.switchurl) |
|||
} |
|||
} |
|||
}, [a("div", {staticClass: "star-item__name text-over"}, [t._v(t._s(t.item.name))]), a("div", {staticClass: "star-item__desc text-over"}, [t._v(t._s(t.item.type_name) + " " + t._s(1 == t.item.support_version && t.item.current_version ? "/ 版本" + t.item.current_version.version : ""))])]), a("div", {staticClass: "star-item__right"}, [a("div", { |
|||
staticClass: "star-item__star", |
|||
class: {active: 1 == t.item.is_star}, |
|||
on: { |
|||
click: function (e) { |
|||
return e.stopPropagation(), t.changeStar(t.item) |
|||
} |
|||
} |
|||
}, [a("el-popover", { |
|||
attrs: { |
|||
placement: "right", |
|||
"popper-class": "star-popover", |
|||
"open-delay": 500, |
|||
"close-delay": "100", |
|||
trigger: "hover", |
|||
content: 1 == t.item.is_star ? "取消星标" : "设为星标" |
|||
} |
|||
}, [a("i", { |
|||
staticClass: "wi wi-star item", |
|||
attrs: {slot: "reference"}, |
|||
slot: "reference" |
|||
})])], 1), t.item.manageurl ? a("el-popover", { |
|||
attrs: { |
|||
placement: "right-start", |
|||
"open-delay": 500, |
|||
"close-delay": 100, |
|||
"popper-class": "star-popover", |
|||
trigger: "hover", |
|||
content: "进入管理" |
|||
} |
|||
}, [a("i", { |
|||
staticClass: "wi wi-setting-o item", attrs: {slot: "reference"}, on: { |
|||
click: function (e) { |
|||
return t.goUrl(t.item.manageurl) |
|||
} |
|||
}, slot: "reference" |
|||
})]) : t._e(), t.showMove ? a("el-popover", { |
|||
attrs: { |
|||
placement: "right-start", |
|||
"open-delay": 500, |
|||
"close-delay": 100, |
|||
"popper-class": "star-popover", |
|||
trigger: "hover", |
|||
content: "拖动排序" |
|||
} |
|||
}, [a("i", { |
|||
staticClass: "wi wi-sortable star-item__move item", |
|||
attrs: {slot: "reference"}, |
|||
on: { |
|||
mouseenter: function (e) { |
|||
return t.changeMove(!1) |
|||
}, mouseup: function (e) { |
|||
return t.changeMove(!0) |
|||
}, mouseleave: function (e) { |
|||
e.stopPropagation(), !t.isMove && t.changeMove(!0) |
|||
} |
|||
}, |
|||
slot: "reference" |
|||
})]) : t._e()], 1)]), a("div", {staticClass: "star-item__footer"}, [a("div", { |
|||
staticClass: "star-item__go", |
|||
on: { |
|||
click: function (e) { |
|||
return t.goChild(t.item.uniacid) |
|||
} |
|||
} |
|||
}, [a("i", {staticClass: "wi wi-apply-o icon"}), t._v("平台应用模块\n ")])])])]) : "module" == t.item.list_type ? a("div", {staticClass: "star-item star-item--module"}, [a("div", {staticClass: "star-item__box"}, [a("div", {staticClass: "star-item__info"}, [a("img", { |
|||
directives: [{ |
|||
name: "lazy", |
|||
rawName: "v-lazy", |
|||
value: t.item.logo, |
|||
expression: "item.logo" |
|||
}], staticClass: "star-item__logo module-logo", attrs: {alt: ""}, on: { |
|||
click: function (e) { |
|||
return t.goUrl(t.item.switchurl) |
|||
} |
|||
} |
|||
}), a("div", { |
|||
staticClass: "star-item__content", on: { |
|||
click: function (e) { |
|||
return t.goUrl(t.item.switchurl) |
|||
} |
|||
} |
|||
}, [a("div", {staticClass: "star-item__name text-over"}, [t._v(t._s(t.item.title))])]), a("div", {staticClass: "star-item__right"}, [a("div", { |
|||
staticClass: "star-item__star", |
|||
class: {active: 1 == t.item.is_star}, |
|||
on: { |
|||
click: function (e) { |
|||
return e.stopPropagation(), t.changeStar(t.item) |
|||
} |
|||
} |
|||
}, [a("el-popover", { |
|||
attrs: { |
|||
placement: "right", |
|||
"open-delay": 500, |
|||
"close-delay": 100, |
|||
"popper-class": "star-popover", |
|||
width: "60", |
|||
trigger: "hover", |
|||
content: 1 == t.item.is_star ? "取消星标" : "设为星标" |
|||
} |
|||
}, [a("i", { |
|||
staticClass: "wi wi-star item", |
|||
attrs: {slot: "reference"}, |
|||
slot: "reference" |
|||
})])], 1), t.showMove ? a("el-popover", { |
|||
attrs: { |
|||
placement: "right", |
|||
"open-delay": 500, |
|||
"close-delay": 100, |
|||
"popper-class": "star-popover", |
|||
trigger: "hover", |
|||
content: "拖动排序" |
|||
} |
|||
}, [a("i", { |
|||
staticClass: "wi wi-sortable star-item__move item", |
|||
attrs: {slot: "reference"}, |
|||
on: { |
|||
mouseenter: function (e) { |
|||
return t.changeMove(!1) |
|||
}, mouseup: function (e) { |
|||
return t.changeMove(!0) |
|||
}, mouseleave: function (e) { |
|||
e.stopPropagation(), !t.isMove && t.changeMove(!0) |
|||
} |
|||
}, |
|||
slot: "reference" |
|||
})]) : t._e()], 1)]), a("div", {staticClass: "star-item__footer"}, [t.item.default_account ? [a("div", {staticClass: "star-item__account text-over"}, [t._v("\n 所属平台: " + t._s(t.item.default_account.name) + "\n ")]), a("div", {staticClass: "star-item__accountblock"}), a("img", { |
|||
directives: [{ |
|||
name: "lazy", |
|||
rawName: "v-lazy", |
|||
value: t.item.default_account.logo, |
|||
expression: "item.default_account.logo" |
|||
}], staticClass: "star-item__accountlogo account-logo", attrs: {alt: ""} |
|||
})] : t._e()], 2)])]) : "system_welcome_module" == t.item.list_type ? a("div", {staticClass: "star-item star-item--welcome"}, [a("div", {staticClass: "star-item__box"}, [a("div", {staticClass: "star-item__info"}, [a("img", { |
|||
directives: [{ |
|||
name: "lazy", |
|||
rawName: "v-lazy", |
|||
value: t.item.logo, |
|||
expression: "item.logo" |
|||
}], staticClass: "star-item__logo module-logo", attrs: {alt: ""}, on: { |
|||
click: function (e) { |
|||
return t.goUrl(t.item.manageurl, "_blank") |
|||
} |
|||
} |
|||
}), a("div", { |
|||
staticClass: "star-item__content", on: { |
|||
click: function (e) { |
|||
return t.goUrl(t.item.manageurl, "_blank") |
|||
} |
|||
} |
|||
}, [a("div", {staticClass: "star-item__name text-over"}, [t._v(t._s(t.item.title))]), a("div", {staticClass: "star-item__desc text-over"}, [t._v(t._s(t.item.bind_domain || "未设置绑定域名"))])]), a("div", {staticClass: "star-item__right"})]), a("div", {staticClass: "star-item__footer text-align"}, [a("el-button", { |
|||
attrs: {type: "text"}, |
|||
on: { |
|||
click: function (e) { |
|||
return t.showBindDomain(t.item) |
|||
} |
|||
} |
|||
}, [t._v("设置域名")])], 1)]), a("el-dialog", { |
|||
staticClass: "we7-dialog dialog--domain", |
|||
attrs: {title: "设置域名", visible: t.showBindDomainStatus}, |
|||
on: { |
|||
"update:visible": function (e) { |
|||
t.showBindDomainStatus = e |
|||
} |
|||
} |
|||
}, [a("el-alert", { |
|||
attrs: { |
|||
closable: !1, |
|||
type: "warning" |
|||
} |
|||
}, [a("i", {staticClass: "wi wi-info"}), t._v("绑定域名后,直接访问域名即可访问该应用;\n ")]), a("el-alert", { |
|||
attrs: { |
|||
closable: !1, |
|||
type: "warning" |
|||
} |
|||
}, [a("i", {staticClass: "wi wi-info"}), t._v("绑定域名,只支持一级域名和二级域名;\n ")]), a("el-alert", { |
|||
attrs: { |
|||
closable: !1, |
|||
type: "warning" |
|||
} |
|||
}, [a("i", {staticClass: "wi wi-info"}), t._v("请注意一定要将绑定的域名解析到本服务器IP并绑定到系统网站目录。\n ")]), a("el-alert", { |
|||
attrs: { |
|||
closable: !1, |
|||
type: "warning" |
|||
} |
|||
}, [a("i", {staticClass: "wi wi-info"}), t._v("多个域名以逗号隔开。\n ")]), a("el-input", { |
|||
attrs: {placeholder: "请输入访问域名,以http://或者htpps://开头"}, |
|||
model: { |
|||
value: t.editItem.bind_domain_edit, callback: function (e) { |
|||
t.$set(t.editItem, "bind_domain_edit", e) |
|||
}, expression: "editItem.bind_domain_edit" |
|||
} |
|||
}), a("div", { |
|||
staticClass: "dialog-footer", |
|||
attrs: {slot: "footer"}, |
|||
slot: "footer" |
|||
}, [a("el-button", { |
|||
staticClass: "el-button--base", |
|||
attrs: {type: "primary"}, |
|||
on: {click: t.bindDomain} |
|||
}, [t._v("确 定")]), a("el-button", { |
|||
staticClass: "el-button--base", on: { |
|||
click: function (e) { |
|||
e.stopPropagation(), t.showBindDomainStatus = !1 |
|||
} |
|||
} |
|||
}, [t._v("取 消")])], 1)], 1)], 1) : t._e() |
|||
}, s = [], n = (a("7f7f"), { |
|||
name: "we7StarItem", |
|||
props: {item: Object, showMove: {type: Boolean, default: !1}, isMove: {type: Boolean, default: !1}}, |
|||
data: function () { |
|||
return {editItem: {}, showBindDomainStatus: !1} |
|||
}, |
|||
methods: { |
|||
goChild: function (t) { |
|||
this.$router.push("/appList/" + t) |
|||
}, goUrl: function (t, e) { |
|||
window.open(t, e || "_self") |
|||
}, changeMove: function (t) { |
|||
this.$emit("changeMove", t) |
|||
}, changeStar: function (t) { |
|||
var e = this, a = { |
|||
type: "account" == t.list_type ? 1 : 2, |
|||
uniacid: "account" == t.list_type ? t.uniacid : t.default_account && t.default_account.uniacid |
|||
}; |
|||
"module" == t.list_type && (a.module_name = t.name), this.$http.post("/index.php?c=account&a=display&do=setting_star", a).then(function (a) { |
|||
e.$message({ |
|||
message: a || "修改成功", |
|||
type: "success" |
|||
}), t.is_star = 1 == t.is_star ? 2 : 1, e.$emit("changeStar", t) |
|||
}) |
|||
}, showBindDomain: function (t) { |
|||
this.editItem = t, this.$set(this.editItem, "bind_domain_edit", this.editItem.bind_domain), this.showBindDomainStatus = !0 |
|||
}, bindDomain: function () { |
|||
var t = this; |
|||
this.$http.post("/index.php?c=module&a=display&do=set_system_welcome_domain", { |
|||
domain: this.editItem.bind_domain_edit, |
|||
module_name: this.editItem.name |
|||
}).then(function () { |
|||
t.$message({ |
|||
message: "设置成功", |
|||
type: "success" |
|||
}), t.editItem.bind_domain = t.editItem.bind_domain_edit, t.showBindDomainStatus = !1 |
|||
}) |
|||
} |
|||
} |
|||
}), o = n, c = (a("b7a7"), a("2877")), r = Object(c["a"])(o, i, s, !1, null, null, null); |
|||
e["a"] = r.exports |
|||
}, a787: function (t, e, a) { |
|||
}, b7a7: function (t, e, a) { |
|||
"use strict"; |
|||
var i = a("4a06"), s = a.n(i); |
|||
s.a |
|||
}, bf60: function (t, e, a) { |
|||
"use strict"; |
|||
var i = a("a787"), s = a.n(i); |
|||
s.a |
|||
}, ef9b: function (t, e, a) { |
|||
"use strict"; |
|||
a.r(e); |
|||
var i = function () { |
|||
var t = this, e = t.$createElement, a = t._self._c || e; |
|||
return a("div", {staticClass: "we7-page"}, [a("we7-account-header-info", { |
|||
attrs: { |
|||
account: t.accountInfo, |
|||
showDelete: !1 |
|||
} |
|||
}), a("div", {staticClass: "star-list"}, [t._l(t.list, function (t, e) { |
|||
return [a("we7-star-item", {key: e, attrs: {item: t}})] |
|||
}), 0 == t.list.length ? a("div", {staticClass: "bottom"}, [t._v("\n 暂无应用\n ")]) : t._e()], 2), a("el-pagination", { |
|||
attrs: { |
|||
background: "", |
|||
"hide-on-single-page": "", |
|||
"page-size": t.page_size, |
|||
total: t.total, |
|||
"current-page": t.page, |
|||
layout: "prev, pager, next" |
|||
}, on: { |
|||
"update:pageSize": function (e) { |
|||
t.page_size = e |
|||
}, "update:page-size": function (e) { |
|||
t.page_size = e |
|||
}, "update:currentPage": function (e) { |
|||
t.page = e |
|||
}, "update:current-page": function (e) { |
|||
t.page = e |
|||
}, "current-change": t.getList |
|||
} |
|||
})], 1) |
|||
}, s = [], n = (a("7f7f"), function () { |
|||
var t = this, e = t.$createElement, a = t._self._c || e; |
|||
return a("div", {staticClass: "account-header-info"}, [a("img", { |
|||
directives: [{ |
|||
name: "lazy", |
|||
rawName: "v-lazy", |
|||
value: t.account.logo, |
|||
expression: "account.logo" |
|||
}], key: t.account.logo, staticClass: "account-logo", attrs: {alt: ""} |
|||
}), a("div", {staticClass: "info"}, [a("div", {staticClass: "title"}, [t._v(t._s(t.account.name))]), a("div", {staticClass: "type"}, [a("i", {class: t.account.type_class}), t._v(t._s(t.account.type_name))])]), t.account.current_user_role != t.CONSTANT.ACCOUNT_MANAGE_NAME_FOUNDER && t.account.current_user_role != t.CONSTANT.ACCOUNT_MANAGE_NAME_OWNER && t.showDelete ? t._e() : a("div", {staticClass: "action"}, [a("a", { |
|||
staticClass: "el-button el-button--primary", |
|||
attrs: {href: t.account.switchurl_full, type: "primary"} |
|||
}, [t._v("进入" + t._s(t.account.type_name))]), t.showDelete ? a("el-button", { |
|||
attrs: {type: "primary"}, |
|||
on: { |
|||
click: function (e) { |
|||
return t.deleteAccount(t.account.uniacid) |
|||
} |
|||
} |
|||
}, [t._v("停用")]) : t._e()], 1)]) |
|||
}), o = [], c = { |
|||
name: "we7AccountHeaderInfo", |
|||
props: {account: Object, showDelete: {type: Boolean, default: !0}}, |
|||
computed: { |
|||
typeList: function () { |
|||
return this.$store.state.uni_account_type_sign |
|||
}, CONSTANT: function () { |
|||
return this.$store.state.CONSTANT |
|||
} |
|||
} |
|||
}, r = c, l = (a("2ef9"), a("2877")), u = Object(l["a"])(r, n, o, !1, null, null, null), m = u.exports, |
|||
d = a("86b2"), _ = { |
|||
name: "starChild", components: {we7AccountHeaderInfo: m, we7StarItem: d["a"]}, data: function () { |
|||
return {list: [], accountInfo: {}, page_size: 1, total: 1, page: 1} |
|||
}, methods: { |
|||
getInfo: function () { |
|||
var t = this; |
|||
this.$http.get("/index.php?c=account&a=post", {params: {uniacid: this.$route.params.uniacid}}).then(function (e) { |
|||
t.accountInfo = e, t.addDom(e.name) |
|||
}) |
|||
}, getList: function () { |
|||
var t = this; |
|||
this.$http.get("/index.php?c=account&a=display&do=account_modules", {params: {uniacid: this.$route.params.uniacid}}).then(function (e) { |
|||
t.list = e.list, t.page_size = e.page_size, t.total = e.total |
|||
}) |
|||
}, addDom: function (t) { |
|||
var e = document.querySelector(".header-info-common"), a = document.createElement("div"); |
|||
a.className = "header-info-common__breadcrumb"; |
|||
var i = '<a href="./home.php" class="home"><i class="wi wi-home"></i></a><span class="separator"> <i class="wi wi-angle-right"></i> </span><div class="item">' + t + "</div>"; |
|||
a.innerHTML = i, e && e.appendChild(a) |
|||
} |
|||
}, created: function () { |
|||
this.getInfo(), this.getList() |
|||
}, beforeDestroy: function () { |
|||
var t = document.querySelector(".header-info-common"), |
|||
e = document.querySelector(".header-info-common .header-info-common__breadcrumb"); |
|||
t && e && t.removeChild(e) |
|||
} |
|||
}, p = _, v = (a("bf60"), Object(l["a"])(p, i, s, !1, null, null, null)); |
|||
e["default"] = v.exports |
|||
} |
|||
}]); |
|||
@ -0,0 +1 @@ |
|||
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-a7ffc2ce"],{"02c9":function(t,e,n){"use strict";var s=n("4032"),o=n.n(s);o.a},4032:function(t,e,n){},"452d":function(t,e,n){"use strict";n.r(e);var s=function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{staticClass:"we7-page"},[n("div",{staticClass:"star-flex"},[n("div",{staticClass:"star-menu"},[n("ul",[t._l(t.menu,function(e,s){return[e.menu?[n("li",{key:s,staticClass:"parent-item"},[t._v(t._s(e.title))]),n("ul",{key:s+1,staticClass:"child-ul",class:{more:t.showMore[s]}},[t._l(e.menu,function(e,o){return[void 0===e.num||0!=e.num?n("router-link",{key:s+o,staticClass:"item",attrs:{to:"/"+s+"/"+o,tag:"li"}},[e.icon?n("i",{staticClass:"icon",class:e.icon}):t._e(),t._v("\n "+t._s(e.title)+"\n "),e.num?n("span",{staticClass:"num"},[t._v(t._s(e.num))]):t._e()]):t._e()]})],2),t.getLength(e.menu)>3?n("li",{key:s+2,staticClass:"show-more",on:{click:function(e){return t.showMoreAction(s)}}},[n("i",{class:t.showMore[s]?"el-icon-arrow-up":"el-icon-arrow-down"}),t._v("\n "+t._s(t.showMore[s]?"收起":"更多")+"\n ")]):t._e()]:[void 0===e.num||0!=e.num?n("router-link",{key:s,staticClass:"item",attrs:{to:"/"+s,tag:"li"}},[e.icon?n("i",{staticClass:"icon",class:e.icon}):t._e(),t._v("\n "+t._s(e.title)+"\n "),e.num?n("span",{staticClass:"num"},[t._v(t._s(e.num))]):t._e()]):t._e()]]})],2)]),n("div",{staticClass:"star-content"},[n("router-view",{attrs:{"active-menu":t.activeMenu}})],1)])])},o=[],i=n("4360"),u={name:"star",components:{},data:function(){return{showMore:{}}},methods:{showMoreAction:function(t){this.$set(this.showMore,t,!this.showMore[t])},getLength:function(t){var e=0;for(var n in t)t[n]&&("number"===typeof t[n].num&&t[n].num>0||void 0===t[n]["num"])&&e++;return e}},computed:{routeType:function(){return this.$route.params.type},routeKey:function(){return this.$route.params.key||this.$route.path.substr(1)},menu:function(){return this.$store.state.starMenu},activeMenu:function(){this.routeType||window.localStorage.setItem("we7StarRoute",this.$route.path);var t=this.routeType&&this.menu[this.routeKey]["menu"]?this.menu[this.routeKey]["menu"][this.routeType]:this.menu[this.routeKey];return t.route=this.routeKey,t}},beforeRouteEnter:function(t,e,n){i["a"].dispatch("getStarMenu",t).then(function(e){var s=t.params.key||t.path.substr(1);e[s]&&0!==e[s].num?n():(window.localStorage.removeItem("we7StarRoute"),n("platform"===s?"/modules":{path:"/"}))})}},r=u,a=(n("02c9"),n("2877")),c=Object(a["a"])(r,s,o,!1,null,null,null);e["default"]=c.exports}}]); |
|||
|
After Width: | Height: | Size: 680 B |
|
After Width: | Height: | Size: 796 B |
|
After Width: | Height: | Size: 7.0 KiB |
|
After Width: | Height: | Size: 1.1 KiB |
@ -0,0 +1 @@ |
|||
var requireConfig={baseUrl:"resource/js/app",paths:{datetimepicker:"../../components/datetimepicker/jquery.datetimepicker",daterangepicker:"../../components/daterangepicker/daterangepicker",colorpicker:"../../components/colorpicker/spectrum",map:"https://api.map.baidu.com/getscript?v=2.0&ak=F51571495f717ff1194de02366bb8da9&services=&t=20140530104353",qqmap:"https://map.qq.com/api/js?v=2.exp",webuploader:"../../components/webuploader/webuploader.min",fileUploader:"../../components/fileuploader/fileuploader.min",clockpicker:"../../components/clockpicker/clockpicker.min",district:"../lib/district",moment:"../lib/moment",emoji:"../../components/emoji/emoji",fontawesome:"../../components/fontawesome/fontawesome",material:"../../components/fileuploader/fileuploader.min",trade:"../../components/trade/trade",hammer:"../lib/hammer.min","bootstrap.switch":"../../components/switch/bootstrap-switch.min",filestyle:"../lib/bootstrap-filestyle.min",validator:"../lib/bootstrapValidator.min","jquery.ui":"../lib/jquery-ui-1.10.3.min","jquery.caret":"../lib/jquery.caret","jquery.jplayer":"../../components/jplayer/jquery.jplayer.min","jquery.zclip":"../../components/zclip/jquery.zclip.min","jquery.wookmark":"../lib/jquery.wookmark.min","jquery.qrcode":"../lib/jquery.qrcode.min","jquery.jplayer":"../../components/jplayer/jquery.jplayer.min",underscore:"../lib/underscore-min",biz:"../lib/biz",swiper:"../../components/swiper/swiper.min",echarts:"../lib/echarts.min",util:"../app/util",ueditor:"../../components/ueditor/ueditor.all.min",angular:"../lib/angular.min","angular.sanitize":"../lib/angular-sanitize.min","angular.hotkeys":"../lib/angular.hotkeys",loadcss:"../lib/loadcss.min",css:"../lib/css.min",clipboard:"../lib/clipboard.min","we7.check":"../lib/we7.check",loadjs:"../lib/loadjs"},shim:{ueditor:{deps:["./resource/components/ueditor/third-party/zeroclipboard/ZeroClipboard.min.js","./resource/components/ueditor/ueditor.config.js"],exports:"UE",init:function(e){window.ZeroClipboard=e}},util:{exports:"util"},daterangepicker:{deps:["moment","loadcss!../../components/daterangepicker/daterangepicker.css"]},datetimepicker:{deps:["loadcss!../../components/datetimepicker/jquery.datetimepicker.css"]},colorpicker:{deps:["loadcss!../../components/colorpicker/spectrum.css"]},map:{exports:"BMap"},"jquery.wookmark":{exports:"$"},"jquery.ui":{exports:"$"},"jquery.caret":{exports:"$"},bootstrap:{exports:"$"},"bootstrap.switch":{deps:["loadcss!../../components/switch/bootstrap-switch.min.css"],exports:"$"},clockpicker:{exports:"$",deps:["loadcss!../../components/clockpicker/clockpicker.min.css"]},district:{exports:"$"},"jquery.toast":{deps:["loadcss!../../components/toast/toastr.min.css"]},emoji:{deps:["loadcss!../../components/emoji/emotions.css"]},fontawesome:{deps:["loadcss!../../components/fontawesome/style.css"]},angular:{exports:"angular",deps:["jquery"]},"angular.sanitize":{exports:"angular",deps:["angular"]},"angular.hotkeys":{exports:"angular",deps:["angular"]},chart:{exports:"Chart"},swiper:{deps:["loadcss!../../components/swiper/swiper.min.css"]}}};jQuery.fn.modal?define("bootstrap",[],function(){if(void 0===jQuery.fn.modal){require(["../lib/bootstrap.min"]);return jQuery}return jQuery}):requireConfig.paths.bootstrap="../lib/bootstrap.min",require.config(requireConfig),define("jquery",[],function(){return jQuery}); |
|||
@ -0,0 +1,157 @@ |
|||
define(['jquery', 'underscore', 'bootstrap'], function($, _){ |
|||
var coupon = { |
|||
'defaultoptions' : { |
|||
callback : null, |
|||
type : 'all', |
|||
multiple : true, |
|||
ignore : { |
|||
'local' : false, |
|||
'wechat' : false |
|||
} |
|||
}, |
|||
'init' : function(callback, options) { |
|||
var $this = this; |
|||
$this.options = $.extend({}, $this.defaultoptions, options); |
|||
$this.options.callback = callback; |
|||
|
|||
$('#counpon-Modal').remove(); |
|||
$(document.body).append($this.buildHtml().mainDialog); |
|||
|
|||
$this.modalobj = $('#counpon-Modal'); |
|||
$this.modalobj.find('.modal-header .nav li a').click(function(){ |
|||
var type = $(this).data('type'); |
|||
$this.localPage(type, 1); |
|||
$(this).tab('show') |
|||
return false; |
|||
}); |
|||
if (!$(this).data('init')) { |
|||
if($this.options.type && $this.options.type != 'all') { |
|||
$this.modalobj.find('.modal-header .nav li.' + $this.options.type + ' a').trigger('click'); |
|||
} else { |
|||
$this.modalobj.find('.modal-header .nav li.show:first a').trigger('click'); |
|||
} |
|||
} |
|||
$this.modalobj.modal('show'); |
|||
return $this.modalobj; |
|||
}, |
|||
|
|||
'localPage' : function(type, page) { |
|||
var $this = this; |
|||
var $history = $this.modalobj.find('.coupon-content #' + type); |
|||
$history.html('<div class="info"><i class="fa fa-spinner fa-pulse fa-lg"></i> 数据加载中</div>'); |
|||
$.getJSON('./index.php?c=utility&a=coupon&do=' + type, {'page': page}, function(data){ |
|||
data = data.message; |
|||
$this.modalobj.find('#coupon-list-pager').html(''); |
|||
if(!_.isEmpty(data.items)) { |
|||
$this.modalobj.find('#btn-select').show(); |
|||
$history.data('attachment', data.items); |
|||
$history.empty(); |
|||
var Dialog = type + 'Dialog'; |
|||
$history.html(_.template($this.buildHtml()[Dialog])(data)); |
|||
$this.modalobj.find('#coupon-list-pager').html(data.page); |
|||
$this.modalobj.find('.pagination a').click(function(){ |
|||
$this.localPage(type, $(this).attr('page')); |
|||
}); |
|||
$history.find('.conpon-list').click(function(){ |
|||
$this.selectCoupon(this); |
|||
}); |
|||
} else { |
|||
$history.html('<div class="info"><i class="fa fa-info-circle fa-lg"></i> 暂无数据</div>'); |
|||
} |
|||
}); |
|||
|
|||
$this.modalobj.find('.modal-footer .btn-primary').unbind('click').click(function(){ |
|||
var attachment = []; |
|||
$history.find('.btn-primary').each(function(){ |
|||
attachment.push($history.data('attachment')[$(this).data('attachid')]); |
|||
$(this).removeClass('btn-primary'); |
|||
}); |
|||
$this.finish(attachment); |
|||
}); |
|||
return false; |
|||
}, |
|||
|
|||
'selectCoupon' : function(obj) { |
|||
var $this = this; |
|||
$(obj).toggleClass('btn-primary'); |
|||
if (!$this.options.multiple) { |
|||
$this.modalobj.find('.modal-footer .btn-primary').trigger('click'); |
|||
} |
|||
}, |
|||
|
|||
'finish' : function(attachment) { |
|||
var $this = this; |
|||
if($.isFunction($this.options.callback)) { |
|||
if ($this.options.multiple == false) { |
|||
$this.options.callback(attachment[0]); |
|||
} else { |
|||
$this.options.callback(attachment); |
|||
} |
|||
$this.modalobj.modal('hide'); |
|||
} |
|||
}, |
|||
|
|||
'buildHtml' : function() { |
|||
var dialog = {}; |
|||
dialog['mainDialog'] = '<div id="counpon-Modal" class="modal fade" tabindex="-1" role="dialog" aria-hidden="true">\n' + |
|||
' <div class="modal-dialog">\n' + |
|||
' <div class="modal-content modal-lg">\n' + |
|||
' <div class="modal-header">\n' + |
|||
' <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>\n' + |
|||
' <h3>'+ |
|||
' <ul role="tablist" class="nav nav-pills" style="font-size:14px; margin-top:-20px;">'+ |
|||
' <li role="presentation" class="wechat ' + (this.options.ignore.wechat ? 'hide' : 'show') + '">'+ |
|||
' <a data-toggle="tab" data-type="wechat" role="tab" aria-controls="wechat" href="#wechat">卡券列表</a>'+ |
|||
' </li>'+ |
|||
' </ul>'+ |
|||
' </h3>'+ |
|||
' </div>\n' + |
|||
' <div class="modal-body coupon-content">\n' + |
|||
' <div class="tab-content">'+ |
|||
' <div id="local" class="tab-pane" class="active" role="tabpanel"></div>'+ |
|||
' <div id="wechat" class="tab-pane" role="tabpanel"></div>'+ |
|||
' </div>' + |
|||
' </div>\n' + |
|||
' <div class="modal-footer">\n' + |
|||
' <div style="float: left;">\n' + |
|||
' <nav id="coupon-list-pager">\n' + |
|||
' <ul class="pager" style="margin: 0;"></ul>\n' + |
|||
' </nav>\n' + |
|||
' </div>\n' + |
|||
' <div id="btn-select" style="float: right; display: none">\n' + |
|||
' <button '+(this.options.multiple ? '' : 'style="display:none;"')+' type="button" class="btn btn-primary">确认</button>\n' + |
|||
(this.options.multiple ? '<button type="button" class="btn btn-default" data-dismiss="modal">取消</button>\n' : '') + |
|||
' </div>\n' + |
|||
' </div>\n'+ |
|||
' </div>\n' + |
|||
' </div>\n' + |
|||
'</div>'; |
|||
|
|||
dialog['wechatDialog'] ='<table class="table table-hover table-bordered">\n'+ |
|||
' <thead>\n'+ |
|||
' <tr>\n'+ |
|||
' <th width="130" class="text-center">标题</th>\n'+ |
|||
' <th class="text-center">类型</th>\n'+ |
|||
' <th width="250" class="text-center">卡券有效期</th>\n'+ |
|||
' <th class="text-center">库存/每人限领</th>\n'+ |
|||
' <th class="text-center">操作</th>\n'+ |
|||
' </tr>'+ |
|||
' </thead>'+ |
|||
' <tbody>'+ |
|||
' <%var items = _.sortBy(items, function(item) {return -item.id;});%>' + |
|||
' <%_.each(items, function(item) {%> \n' + |
|||
' <tr title="<%=item.title%>">' + |
|||
' <td><%=item.title%></td>' + |
|||
' <td><%if(item.type == "1") {%><span class="label label-info"><%=item.extra.discount%>折</span> <span class="label label-success">折扣券</span><%} else if(item.type == "2") {%><span class="label label-info"><%=item.extra.reduce_cost%>元</span> <span class="label label-danger">代金券</span><%} else if(item.type == "4") {%><span class="label label-danger">礼品券</span><%} else if(item.type == "3") {%><span class="label label-danger">团购券</span><%} else if(item.type == "5") {%><span class="label label-danger">优惠券</span><%}%></td>' + |
|||
' <td><%if(item.date_info.time_type == 1) {%><%=item.date_info.time_limit_start%> ~ <%=item.date_info.time_limit_end%><%} else {%>领取后<%=item.date_info.date_info%>天后生效,<%=item.date_info.limit%>天有效期<%}%></td>' + |
|||
' <td><%=item.quantity%>/<strong class="text-danger"><%=item.get_limit%></strong></td>' + |
|||
' <td><a href="javascript:;" class="btn btn-default conpon-list" data-title="<%=item.title%>" data-attachid="<%=item.id%>">选取</a></td>' + |
|||
' </tr>' + |
|||
' <%});%>' + |
|||
' </tbody>'+ |
|||
' </table>'; |
|||
return dialog; |
|||
} |
|||
}; |
|||
return coupon; |
|||
}); |
|||
@ -0,0 +1 @@ |
|||
define(function(){if(typeof window=="undefined")return{load:function(n,r,load){load()}};var head=document.getElementsByTagName("head")[0];var engine=window.navigator.userAgent.match(/Trident\/([^ ;]*)|AppleWebKit\/([^ ;]*)|Opera\/([^ ;]*)|rv\:([^ ;]*)(.*?)Gecko\/([^ ;]*)|MSIE\s([^ ;]*)/)||0;var useImportLoad=false;var useOnload=true;if(engine[1]||engine[7])useImportLoad=parseInt(engine[1])<6||parseInt(engine[7])<=9;else if(engine[2])useOnload=false;else if(engine[4])useImportLoad=parseInt(engine[4])<18;var cssAPI={};cssAPI.pluginBuilder="./css-builder";var curStyle;var createStyle=function(){curStyle=document.createElement("style");head.appendChild(curStyle)};var importLoad=function(url,callback){createStyle();var curSheet=curStyle.styleSheet||curStyle.sheet;if(curSheet&&curSheet.addImport){curSheet.addImport(url);curStyle.onload=callback}else{curStyle.textContent='@import "'+url+'";';var loadInterval=setInterval(function(){try{curStyle.sheet.cssRules;clearInterval(loadInterval);callback()}catch(e){}},10)}};var linkLoad=function(url,callback){var link=document.createElement("link");link.type="text/css";link.rel="stylesheet";if(useOnload)link.onload=function(){link.onload=function(){};setTimeout(callback,7)};else var loadInterval=setInterval(function(){for(var i=0;i<document.styleSheets.length;i++){var sheet=document.styleSheets[i];if(sheet.href==link.href){clearInterval(loadInterval);return callback()}}},10);link.href=url;head.appendChild(link)};cssAPI.normalize=function(name,normalize){if(name.substr(name.length-4,4)==".css")name=name.substr(0,name.length-4);return normalize(name)};cssAPI.load=function(cssId,req,load,config){(useImportLoad?importLoad:linkLoad)(req.toUrl(cssId+".css"),load)};return cssAPI}); |
|||
@ -0,0 +1,166 @@ |
|||
<?php |
|||
|
|||
defined('IN_IA') or exit('Access Denied'); |
|||
load()->model('user'); |
|||
|
|||
$dos = array('display', 'save_account', 'get_user_info'); |
|||
$do = in_array($do, $dos) ? $do : 'display'; |
|||
$sign = safe_gpc_string($_GPC['sign']); |
|||
if (empty($account_all_type_sign[$sign])) { |
|||
$error_msg = '所需创建的账号类型不存在, 请重试.'; |
|||
empty($_W['isajax']) ? message($error_msg, '', 'error') : iajax(-1, $error_msg); |
|||
} |
|||
|
|||
if ('get_user_info' == $do) { |
|||
if (!$_W['isfounder']) { |
|||
iajax(-1, '非法请求数据!'); |
|||
} |
|||
|
|||
$uid = intval($_GPC['uid'][0]); |
|||
$user = user_single(array('uid' => $uid)); |
|||
if (empty($user)) { |
|||
iajax(-1, '用户不存在或是已经被删除', ''); |
|||
} |
|||
$info = array( |
|||
'uid' => $user['uid'], |
|||
'username' => $user['username'], |
|||
'group' => [], |
|||
'endtime' => user_end_time($user['uid']), |
|||
'modules' => array(), |
|||
); |
|||
$info['package'] = empty($info['group']['package']) ? array() : iunserializer($info['group']['package']); |
|||
iajax(0, $info); |
|||
} |
|||
$sign_title = $account_all_type_sign[$sign]['title']; |
|||
$create_account_type = $account_all_type_sign[$sign]['contain_type'][0]; |
|||
$_W['breadcrumb'] = '新建平台账号'; |
|||
|
|||
if ('save_account' == $do) { |
|||
$post = array(); |
|||
$post['step'] = safe_gpc_string(trim($_GPC['step'])); |
|||
$post['name'] = safe_gpc_string(trim($_GPC['name'])); |
|||
$post['description'] = safe_gpc_string($_GPC['description']); |
|||
$post['owner_uid'] = intval($_GPC['owner_uid']); |
|||
$post['version'] = safe_gpc_string(trim($_GPC['version'])); |
|||
//判断商户名称 |
|||
if (empty($post['step']) || 'base_info' == $post['step']) { |
|||
if (empty($post['name'])) iajax(-1, $sign_title . '名称不能为空'); |
|||
//判断平台名称是否重复 |
|||
$isHave = pdo_get('uni_account', ['name'=>$post['name']]); |
|||
//if ($isHave) iajax(-1, "该名称'{$post['name']}'已经存在"); |
|||
} |
|||
//保存平台信息 并且进行相关操作 |
|||
if (in_array($sign, array(ACCOUNT_TYPE_SIGN, WEBAPP_TYPE_SIGN, PHONEAPP_TYPE_SIGN))) { |
|||
//添加信息 |
|||
$account_insert = [ |
|||
'groupid' => 0 , |
|||
'default_acid' => 0 , |
|||
'name' => $post['name'] , |
|||
'description' => $post['description'] , |
|||
'title_initial' => get_first_pinyin($post['name']) , |
|||
'createtime' => TIMESTAMP , |
|||
'create_uid' => intval($_W['uid']) , |
|||
]; |
|||
if (!empty($_GPC['headimg'])) { |
|||
$headimg = safe_gpc_path($_GPC['headimg']); |
|||
if (file_is_image($headimg)) { |
|||
$account_insert['logo'] = $headimg; |
|||
} |
|||
} |
|||
pdo_insert('uni_account' , $account_insert); |
|||
$uniacid = pdo_insertid(); |
|||
if (empty($uniacid)) iajax(-1 , "添加{$sign_title}失败, 请重试"); |
|||
$account_data = ['name' => $post['name'] , 'type' => $create_account_type]; |
|||
if (ACCOUNT_TYPE_SIGN == $sign) { |
|||
$account_data['account'] = safe_gpc_string(trim($_GPC['account'])); |
|||
$account_data['original'] = safe_gpc_string(trim($_GPC['original'])); |
|||
$account_data['level'] = 4; |
|||
$account_data['key'] = safe_gpc_string(trim($_GPC['key'])); |
|||
$account_data['secret'] = safe_gpc_string(trim($_GPC['secret'])); |
|||
} |
|||
$acid = account_create($uniacid , $account_data); |
|||
if (empty($acid)) iajax(-1 , "添加{$sign_title}信息失败"); |
|||
pdo_update('uni_account' , ['default_acid' => $acid] , ['uniacid' => $uniacid]); |
|||
if (empty($_W['isfounder'])) uni_account_user_role_insert($uniacid , $_W['uid'] , ACCOUNT_MANAGE_NAME_OWNER); |
|||
if (!pdo_get(PDO_NAME."uni_modules",['uniacid'=>$uniacid])){ |
|||
pdo_insert(PDO_NAME."uni_modules",['uniacid'=>$uniacid,'module_name'=>MODULE_NAME]); |
|||
} |
|||
//cache_build_account_modules($uniacid); |
|||
if (in_array($sign , [ACCOUNT_TYPE_SIGN])) { |
|||
pdo_insert('mc_groups' , ['uniacid' => $uniacid , 'title' => '默认会员组' , 'isdefault' => 1]); |
|||
// $fields = pdo_getall('profile_fields'); |
|||
// if (is_array($fields)) { |
|||
// foreach ($fields as $field) { |
|||
// pdo_insert('mc_member_fields' , [ |
|||
// 'uniacid' => $uniacid , |
|||
// 'fieldid' => $field['id'] , |
|||
// 'title' => $field['title'] , |
|||
// 'available' => $field['available'] , |
|||
// 'displayorder' => $field['displayorder'] , |
|||
// ]); |
|||
// } |
|||
// } |
|||
} |
|||
if (ACCOUNT_TYPE_SIGN == $sign) { |
|||
$oauth = uni_setting($uniacid , ['oauth']); |
|||
if ($acid && empty($oauth['oauth']['account']) && !empty($account_data['key']) && !empty($account_data['secret']) && ACCOUNT_SERVICE_VERIFY == $account_data['level']) { |
|||
pdo_update('uni_settings' , [ |
|||
'oauth' => iserializer([ |
|||
'account' => $acid , |
|||
'host' => $oauth['oauth']['host'] |
|||
]) |
|||
] , ['uniacid' => $uniacid]); |
|||
} |
|||
} |
|||
pdo_insert('uni_settings' , [ |
|||
'creditnames' => iserializer([ |
|||
'credit1' => ['title' => '积分' , 'enabled' => 1] , |
|||
'credit2' => ['title' => '余额' , 'enabled' => 1] |
|||
]) , |
|||
'creditbehaviors' => iserializer(['activity' => 'credit1' , 'currency' => 'credit2']) , |
|||
'uniacid' => $uniacid , |
|||
'default_site' => 0 , |
|||
'sync' => iserializer(['switch' => 0 , 'acid' => '']) , |
|||
]); |
|||
} |
|||
if ($_W['isfounder']) { |
|||
if (!empty($post['owner_uid'])) { |
|||
$owner = pdo_get('uni_account_users', array('uniacid' => $uniacid, 'role' => 'owner')); |
|||
if (!empty($owner)) { |
|||
pdo_update('uni_account_users', array('uid' => $post['owner_uid']), array('uniacid' => $uniacid, 'role' => 'owner')); |
|||
} else { |
|||
uni_account_user_role_insert($uniacid, $post['owner_uid'], ACCOUNT_MANAGE_NAME_OWNER); |
|||
} |
|||
} |
|||
|
|||
if (!empty($_GPC['endtime'])) { |
|||
$account_end_time = strtotime($_GPC['endtime']); |
|||
if (!empty($post['owner_uid'])) { |
|||
$user_end_time = strtotime(user_end_time($post['owner_uid'])); |
|||
if ($user_end_time > 0 && $account_end_time > $user_end_time) { |
|||
$account_end_time = $user_end_time; |
|||
} |
|||
} |
|||
pdo_update('account', array('endtime' => $account_end_time), array('uniacid' => $uniacid)); |
|||
} |
|||
cache_delete(cache_system_key('uniaccount', array('uniacid' => $uniacid))); |
|||
cache_delete(cache_system_key('unimodules', array('uniacid' => $uniacid))); |
|||
cache_delete(cache_system_key('proxy_wechatpay_account')); |
|||
$cash_index = 'account' == $sign ? 'app' : $sign; |
|||
cache_delete(cache_system_key('user_accounts', array('type' => $cash_index, 'uid' => $_W['uid']))); |
|||
if (!empty($post['owner_uid'])) { |
|||
cache_delete(cache_system_key('user_accounts', array('type' => $cash_index, 'uid' => $post['owner_uid']))); |
|||
//cache_build_account_modules($uniacid, $post['owner_uid']); |
|||
if (!pdo_get(PDO_NAME."uni_modules",['uniacid'=>$uniacid])){ |
|||
pdo_insert(PDO_NAME."uni_modules",['uniacid'=>$uniacid,'module_name'=>MODULE_NAME]); |
|||
} |
|||
} |
|||
} |
|||
$next_url = url('account/manage'); |
|||
if (!empty($next_url)) { |
|||
$result = array('next_url' => $next_url, 'uniacid' => $uniacid); |
|||
iajax(0, $result, $next_url); |
|||
} |
|||
} |
|||
|
|||
template('account/create'); |
|||
@ -0,0 +1,413 @@ |
|||
<?php |
|||
|
|||
defined('IN_IA') or exit('Access Denied'); |
|||
|
|||
load()->model('miniapp'); |
|||
load()->model('phoneapp'); |
|||
|
|||
$dos = array('rank', 'display', 'list', 'switch', 'platform', 'history', 'setting_star', 'setting_star_rank', 'list_star', |
|||
'account_num', 'welcome_link', 'account_modules', 'account_create_info'); |
|||
$do = in_array($_GPC['do'], $dos) ? $do : 'platform'; |
|||
|
|||
if ('platform' == $do) { |
|||
$url = $_W['siteroot'] . 'web/home.php'; |
|||
$last_uniacid = switch_get_account_display(); |
|||
if (empty($last_uniacid)) { |
|||
itoast('', $url, 'info'); |
|||
} |
|||
if (!empty($last_uniacid) && $last_uniacid != $_W['uniacid']) { |
|||
switch_save_account_display($last_uniacid); |
|||
} |
|||
$permission = permission_account_user_role($_W['uid'], $last_uniacid); |
|||
if (empty($permission)) { |
|||
itoast('', $url, 'info'); |
|||
} |
|||
$account_info = uni_fetch($last_uniacid); |
|||
|
|||
if (ACCOUNT_TYPE_SIGN == $account_info['type_sign']) { |
|||
$url = url('home/welcome'); |
|||
} elseif (WEBAPP_TYPE_SIGN == $account_info['type_sign']) { |
|||
$url = url('webapp/home/display'); |
|||
} else { |
|||
$last_version = miniapp_fetch($last_uniacid); |
|||
if (!empty($last_version)) { |
|||
$url = url('miniapp/version/home', array('version_id' => $last_version['version']['id'])); |
|||
} |
|||
} |
|||
itoast('', $url); |
|||
} |
|||
if ('list' == $do) { |
|||
if ($_W['isadmin']) { |
|||
$founders = pdo_getall('users', array('founder_groupid' => 2), array('uid', 'username'), 'uid'); |
|||
$founder_id = intval($_GPC['founder_id']); |
|||
} |
|||
$pindex = max(1, intval($_GPC['page'])); |
|||
$psize = 'list' == $do ? 24 : 20; |
|||
$limit_num = intval($_GPC['limit_num']); |
|||
$psize = $limit_num > 0 ? $limit_num : $psize; |
|||
$type = ACCOUNT_TYPE_SIGN; |
|||
|
|||
if ('all' == $type) { |
|||
$condition = array_keys($account_all_type); |
|||
} else { |
|||
$condition = $account_all_type_sign[$type]['contain_type']; |
|||
} |
|||
|
|||
$table = table('account'); |
|||
$table->searchWithType($condition); |
|||
$keyword = safe_gpc_string($_GPC['keyword']); |
|||
if (!empty($keyword)) { |
|||
$table->searchWithKeyword($keyword); |
|||
} |
|||
$letter = safe_gpc_string($_GPC['letter']); |
|||
if (!empty($letter) && '全部' != $letter) { |
|||
$table->searchWithLetter($letter); |
|||
} |
|||
$search_role = in_array($_GPC['role'], array('owner', 'manager', 'operator')) ? $_GPC['role'] : ''; |
|||
if ($search_role) { |
|||
$table->searchWithRole($search_role); |
|||
} |
|||
|
|||
if ('all' == $type) { |
|||
$total_list = array(); |
|||
foreach ($account_all_type as $account_type) { |
|||
$total_list[$account_type['type_sign']] = 0; |
|||
} |
|||
|
|||
if (!empty($founder_id)) { |
|||
$table->searchWithViceFounder($founder_id); |
|||
} |
|||
$account_total = $table->searchAccounTotal(false); |
|||
$table->searchWithType($condition); |
|||
if (!empty($keyword)) { |
|||
$table->searchWithKeyword($keyword); |
|||
} |
|||
if (!empty($letter) && '全部' != $letter) { |
|||
$table->searchWithLetter($letter); |
|||
} |
|||
if ($search_role) { |
|||
$table->searchWithRole($_GPC['role']); |
|||
} |
|||
foreach ($account_total as $row) { |
|||
if (in_array($row['type'], array(ACCOUNT_TYPE_OFFCIAL_NORMAL, ACCOUNT_TYPE_OFFCIAL_AUTH))) { |
|||
$total_list['account'] += $row['total']; |
|||
} elseif (in_array($row['type'], array(ACCOUNT_TYPE_APP_NORMAL, ACCOUNT_TYPE_APP_AUTH))) { |
|||
$total_list['wxapp'] += $row['total']; |
|||
} else { |
|||
foreach ($account_all_type as $type_key => $type_info) { |
|||
if ($type_key == $row['type']) { |
|||
$total_list[$type_info['type_sign']] += $row['total']; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||
if ('display' == $do) { |
|||
$table->accountRankOrder(); |
|||
$table->accountUniacidOrder(); |
|||
} elseif ('list' == $do) { |
|||
$orderby = $_GPC['orderby'] == 'initials' ? 'initials' : 'createtime'; |
|||
switch($orderby) { |
|||
case 'createtime': |
|||
$table->accountUniacidOrder(); |
|||
break; |
|||
case 'initials': |
|||
$table->accountInitialsOrder(); |
|||
break; |
|||
} |
|||
} |
|||
$table->searchWithPage($pindex, $psize); |
|||
$list = $table->searchAccountList(false); |
|||
$total = $table->getLastQueryTotal(); |
|||
if (!empty($list)) { |
|||
if (!$_W['isfounder']) { |
|||
$account_user_roles = table('uni_account_users')->where('uid', $_W['uid'])->getall('uniacid'); |
|||
} |
|||
foreach ($list as $k => &$account) { |
|||
$account = uni_fetch($account['uniacid']); |
|||
$account['manageurl'] .= '&iscontroller=0'; |
|||
if (!in_array($account_user_roles[$account['uniacid']]['role'], array(ACCOUNT_MANAGE_NAME_OWNER, ACCOUNT_MANAGE_NAME_MANAGER)) && !$_W['isfounder']) { |
|||
unset($account['manageurl']); |
|||
} |
|||
$account['list_type'] = 'account'; |
|||
$account['type_name'] = $account->typeName; |
|||
$account['level'] = $account_all_type_sign[$account['type_sign']]['level'][$account['level']]; |
|||
$account['user_role'] = $account_user_roles[$account['uniacid']]['role']; |
|||
if (ACCOUNT_MANAGE_NAME_CLERK == $account['user_role']) { |
|||
unset($list[$k]); |
|||
continue; |
|||
} |
|||
$account['is_star'] = 0; |
|||
$account['end'] = USER_ENDTIME_GROUP_EMPTY_TYPE == $account['endtime'] || USER_ENDTIME_GROUP_UNLIMIT_TYPE == $account['endtime'] ? '永久' : date('Y-m-d', $account['endtime']) . '到期'; |
|||
} |
|||
if (!empty($list)) { |
|||
$list = array_values($list); |
|||
} |
|||
} |
|||
iajax(0, $list); |
|||
} |
|||
if ('switch' == $do) { |
|||
$uniacid = intval($_GPC['uniacid']); |
|||
$module_name = safe_gpc_string($_GPC['module_name']); |
|||
if (!empty($uniacid)) { |
|||
$role = permission_account_user_role($_W['uid'], $uniacid); |
|||
if (empty($role) || ACCOUNT_MANAGE_NAME_CLERK == $role && empty($module_name)) { |
|||
if ($_W['isajax']) { |
|||
iajax(-1, '操作失败, 非法访问.'); |
|||
} |
|||
itoast('操作失败, 非法访问.', '', 'error'); |
|||
} |
|||
$account_info = uni_fetch($uniacid); |
|||
if (USER_ENDTIME_GROUP_EMPTY_TYPE != $account_info['endtime'] && USER_ENDTIME_GROUP_UNLIMIT_TYPE != $account_info['endtime'] && TIMESTAMP > $account_info['endtime'] && !$_W['isadmin']) { |
|||
$type_sign = $account_info->typeSign; |
|||
$expired_message_settings = setting_load('account_expired_message'); |
|||
$expired_message_settings = $expired_message_settings['account_expired_message'][$type_sign]; |
|||
if (!empty($expired_message_settings) && !empty($expired_message_settings['status']) && !empty($expired_message_settings['message'])) { |
|||
if ($_W['isajax']) { |
|||
iajax(-1, $expired_message_settings['message']); |
|||
} |
|||
itoast($expired_message_settings['message']); |
|||
} else { |
|||
if ($_W['isajax']) { |
|||
iajax(-1, '抱歉,您的平台账号服务已过期,请及时联系管理员'); |
|||
} |
|||
itoast('抱歉,您的平台账号服务已过期,请及时联系管理员'); |
|||
} |
|||
} |
|||
|
|||
$url = url('site/entry/index', array('m' => 'weliam_smartcity')); |
|||
switch_save_uniacid($uniacid); |
|||
if ($_W['isajax']) { |
|||
iajax(0, '切换成功'); |
|||
} |
|||
itoast('', $url); |
|||
} |
|||
} |
|||
if ('history' == $do) { |
|||
$limit_num = intval($_GPC['limit_num']); |
|||
$limit_num = $limit_num > 0 ? $limit_num : 40; |
|||
$history = user_load_operate_history($limit_num); |
|||
if (empty($history)) { |
|||
iajax(0, array()); |
|||
} |
|||
$result = array(); |
|||
$keyword = safe_gpc_string($_GPC['keyword']); |
|||
foreach ($history as $key => $item) { |
|||
$operate = array(); |
|||
$account_info = uni_fetch($item['uniacid']); |
|||
if (USERS_OPERATE_TYPE_ACCOUNT == $item['type'] && empty($account_info['isdeleted'])) { |
|||
$operate = array( |
|||
'list_type' => 'account', |
|||
'name' => $account_info['name'], |
|||
'uniacid' => $account_info['uniacid'], |
|||
'type' => $account_info['type'], |
|||
'type_name' => $account_info['type_name'], |
|||
'level' => $account_all_type_sign[$account_info['type_sign']]['level'][$account_info['level']], |
|||
'logo' => $account_info['logo'], |
|||
'switchurl' => $account_info['switchurl'], |
|||
'is_star' => $account_info['is_star'] ? 1 : 0, |
|||
); |
|||
if (!empty($keyword) && strpos($operate['name'], $keyword) === false) { |
|||
continue; |
|||
} |
|||
} elseif (USERS_OPERATE_TYPE_MODULE == $item['type']) { |
|||
$module_info = module_fetch($item['module_name']); |
|||
if (empty($module_info)) { |
|||
continue; |
|||
} |
|||
if (!empty($keyword) && strpos($module_info['title'], $keyword) === false) { |
|||
continue; |
|||
} |
|||
$module_info['list_type'] = 'module'; |
|||
$module_info['is_star'] = table('users_operate_star')->getByUidUniacidModulename($_W['uid'], $item['uniacid'], $item['module_name']) ? 1 : 0; |
|||
$module_info['switchurl'] = url('module/display/switch', array('module_name' => $item['module_name'], 'uniacid' => $item['uniacid'])); |
|||
$module_info['default_account'] = array( |
|||
'name' => $account_info['name'], |
|||
'uniacid' => $account_info['uniacid'], |
|||
'type' => $account_info['type'], |
|||
'logo' => $account_info['logo'], |
|||
); |
|||
$operate = $module_info; |
|||
} |
|||
if ($operate) { |
|||
$result[] = $operate; |
|||
} |
|||
} |
|||
iajax(0, $result); |
|||
} |
|||
if ('setting_star' == $do) { |
|||
$type = intval($_GPC['type']); |
|||
$uniacid = intval($_GPC['uniacid']); |
|||
$module_name = safe_gpc_string($_GPC['module_name']); |
|||
|
|||
$result = user_save_operate_star($type, $uniacid, $module_name); |
|||
if (is_error($result)) { |
|||
iajax(-1, $result['message']); |
|||
} else { |
|||
iajax(0, '设置成功!'); |
|||
} |
|||
} |
|||
if ('setting_star_rank' == $do) { |
|||
$change_ids = safe_gpc_array($_GPC['change_ids']); |
|||
$users_operate_star_table = table('users_operate_star'); |
|||
$all_star = $users_operate_star_table->getALlByUid($_W['uid']); |
|||
$all_star_num = count($all_star); |
|||
if ($all_star_num != count($change_ids)) { |
|||
iajax(-1, '参数不合法,非法请求!'); |
|||
} |
|||
foreach ($change_ids as $id) { |
|||
$if_exists = $users_operate_star_table->where('uid', $_W['uid'])->getById($id); |
|||
if (!$if_exists) { |
|||
iajax(-1, '当前用户没有设置该星标!'); |
|||
break; |
|||
} |
|||
} |
|||
unset($id); |
|||
$change_data = array(); |
|||
foreach ($change_ids as $id) { |
|||
$change_data[] = array('id' => $id, 'rank' => $all_star_num); |
|||
$all_star_num--; |
|||
} |
|||
foreach ($change_data as $data) { |
|||
$result = $users_operate_star_table->where('id', $data['id'])->fill(array('rank' => $data['rank']))->save(); |
|||
} |
|||
iajax(0, $result); |
|||
} |
|||
if ('list_star' == $do) { |
|||
$limit_num = intval($_GPC['limit_num']); |
|||
$limit_num = $limit_num > 0 ? $limit_num : 100; |
|||
$list = user_load_operate_star($limit_num); |
|||
if (empty($list)) { |
|||
iajax(0, array()); |
|||
} |
|||
$keyword = safe_gpc_string($_GPC['keyword']); |
|||
foreach ($list as $key => $item) { |
|||
$account_info = uni_fetch($item['uniacid']); |
|||
if (USERS_OPERATE_TYPE_ACCOUNT == $item['type'] && empty($account_info['isdeleted'])) { |
|||
if (!empty($keyword) && strpos($account_info['name'], $keyword) === false) { |
|||
continue; |
|||
} |
|||
$result[] = array( |
|||
'id' => $item['id'], |
|||
'list_type' => 'account', |
|||
'name' => $account_info['name'], |
|||
'uniacid' => $account_info['uniacid'], |
|||
'type' => $account_info['type'], |
|||
'type_name' => $account_info['type_name'], |
|||
'level' => $account_all_type_sign[$account_info['type_sign']]['level'][$account_info['level']], |
|||
'logo' => $account_info['logo'], |
|||
'switchurl' => $account_info['switchurl'], |
|||
'manageurl' => $account_info['manageurl'], |
|||
'is_star' => 1, |
|||
); |
|||
} elseif (USERS_OPERATE_TYPE_MODULE == $item['type']) { |
|||
$module_info = module_fetch($item['module_name']); |
|||
if (empty($module_info)) { |
|||
continue; |
|||
} |
|||
if (!empty($keyword) && strpos($module_info['title'], $keyword) === false) { |
|||
continue; |
|||
} |
|||
$module_info['id'] = $item['id']; |
|||
$module_info['is_star'] = 1; |
|||
$module_info['switchurl'] = url('module/display/switch', array('module_name' => $item['module_name'], 'uniacid' => $item['uniacid'])); |
|||
$module_info['default_account'] = array( |
|||
'name' => $account_info['name'], |
|||
'uniacid' => $account_info['uniacid'], |
|||
'type' => $account_info['type'], |
|||
'logo' => $account_info['logo'], |
|||
); |
|||
$module_info['list_type'] = 'module'; |
|||
$result[] = $module_info; |
|||
} |
|||
} |
|||
iajax(0, $result); |
|||
} |
|||
if ('account_num' == $do) { |
|||
$result = array('max_total' => 0, 'created_total' => 0, 'limit_total' => 0); |
|||
if ($_W['isadmin']) { |
|||
iajax(0, array('max_total' => '不限', 'created_total' => '不限', 'limit_total' => '不限')); |
|||
} |
|||
$user_founder_info = table('users_founder_own_users')->getFounderByUid($_W['uid']); |
|||
$account_num = permission_user_account_num(); |
|||
if ($user_founder_info) { |
|||
$result['max_total'] = $account_num['max_total'] - $account_num['founder_limit_total'] > 0 ? ($account_num['founder_limit_total'] + $account_num['created_total']) : $account_num['max_total']; |
|||
$result['created_total'] = $account_num['current_vice_founder_user_created_total'] < 0 ? 0 : $account_num['created_total']; |
|||
$result['limit_total'] = $account_num['limit_total'] - $account_num['founder_limit_total'] > 0 ? $account_num['founder_limit_total'] : $account_num['limit_total']; |
|||
} else { |
|||
$result['max_total'] = max(0, $account_num['max_total']); |
|||
$result['created_total'] = max(0, $account_num['created_total']); |
|||
$result['limit_total'] = max(0, $account_num['limit_total']); |
|||
} |
|||
iajax(0, $result); |
|||
} |
|||
if ('welcome_link' == $do) { |
|||
if ($_W['isadmin']) { |
|||
iajax(0, array()); |
|||
} |
|||
$welcome_link_info = array( |
|||
array('id' => WELCOME_DISPLAY_TYPE, 'name' => '用户欢迎页'), |
|||
array('id' => PLATFORM_DISPLAY_TYPE, 'name' => '最后进入的平台或应用'), |
|||
); |
|||
$result = array( |
|||
'user_welcome_link' => in_array($_W['user']['welcome_link'], array_column($welcome_link_info, 'id')) ? $_W['user']['welcome_link'] : WELCOME_DISPLAY_TYPE, |
|||
'welcome_link' => $welcome_link_info, |
|||
); |
|||
iajax(0, $result); |
|||
} |
|||
if ('account_modules' == $do) { |
|||
$uniacid = intval($_GPC['uniacid']); |
|||
$result = array(); |
|||
$account_type_sign = table('account')->getByUniacid($uniacid); |
|||
$account_type_sign = $account_all_type[$account_type_sign['type']]['type_sign']; |
|||
$uni_user_accounts = uni_user_accounts($_W['uid'], $account_type_sign); |
|||
if (!in_array($uniacid, array_keys($uni_user_accounts)) && !$_W['isadmin']) { |
|||
iajax(-1, '您没有该账号的权限!'); |
|||
} |
|||
$account_modules = uni_modules_by_uniacid($uniacid); |
|||
if (empty($account_modules)) { |
|||
iajax(0, $result); |
|||
} |
|||
$user_account_modules = permission_account_user_menu($_W['uid'], $uniacid, 'modules'); |
|||
$account_info = uni_fetch($uniacid); |
|||
if ($account_info->supportVersion) { |
|||
$version_info = miniapp_fetch($uniacid); |
|||
$version_modules = !empty($version_info['version']) && !empty($version_info['version']['modules']) ? array_keys($version_info['version']['modules']) : array(); |
|||
} |
|||
$star_info = table('users_operate_star')->where('type', USERS_OPERATE_TYPE_MODULE)->where('uid', $_W['uid'])->where('uniacid', $uniacid)->where('module_name IN', array_keys($account_modules))->getall('module_name'); |
|||
foreach ($account_modules as $module) { |
|||
if ($module['issystem'] || |
|||
!empty($user_account_modules) && empty($user_account_modules[$module['name']]) || |
|||
$module[$account_all_type[$account_info['type']]['module_support_name']] != $account_all_type[$account_info['type']]['module_support_value']) { |
|||
continue; |
|||
} |
|||
if (!empty($version_modules) && !in_array($module['name'], $version_modules)) { |
|||
continue; |
|||
} |
|||
$module['switchurl'] = url('module/display/switch', array('module_name' => $module['name'], 'uniacid' => $uniacid)); |
|||
$module['is_star'] = $star_info[$module['name']] ? 1 : 0; |
|||
$module['list_type'] = 'module'; |
|||
$module['default_account'] = array( |
|||
'name' => $account_info['name'], |
|||
'uniacid' => $account_info['uniacid'], |
|||
'type' => $account_info['type'], |
|||
'logo' => $account_info['logo'], |
|||
); |
|||
$result[] = $module; |
|||
} |
|||
|
|||
$pindex = max(1, intval($_GPC['page'])); |
|||
$psize = 40; |
|||
$page_result = array_slice($result, ($pindex - 1) * $psize, $psize); |
|||
$message = array( |
|||
'total' => count($result), |
|||
'page' => $pindex, |
|||
'page_size' => $psize, |
|||
'list' => $page_result |
|||
); |
|||
iajax(0, $message); |
|||
} |
|||
if ('account_create_info' == $do) { |
|||
//$result = uni_account_create_info(); |
|||
iajax(0, []); |
|||
} |
|||
@ -0,0 +1,44 @@ |
|||
<?php |
|||
|
|||
defined('IN_IA') or exit('Access Denied'); |
|||
load()->model('system'); |
|||
|
|||
if ('check_fpm' == $do) { |
|||
$result = fastcgi_finish_request(); |
|||
if (is_error($result)) { |
|||
$message = array( |
|||
'status' => $result['errno'], |
|||
'message' => $result['message'] |
|||
); |
|||
iajax(0, $message); |
|||
} |
|||
exit(); |
|||
} |
|||
|
|||
$system_check_items = system_check_items(); |
|||
if (version_compare(PHP_VERSION, '7.0.0', '>=')) { |
|||
unset($system_check_items['mcrypt']); |
|||
} |
|||
|
|||
foreach ($system_check_items as $check_item_name => &$check_item) { |
|||
$check_item['check_result'] = $check_item['operate']($check_item_name); |
|||
} |
|||
|
|||
$check_num = count($system_check_items); |
|||
$check_wrong_num = 0; |
|||
foreach ($system_check_items as $check_key => $check_val) { |
|||
if (false === $check_val['check_result']) { |
|||
$check_wrong_num += 1; |
|||
} |
|||
} |
|||
|
|||
cache_write(cache_system_key('system_check'), array('check_items' => $system_check_items, 'check_num' => $check_num, 'check_wrong_num' => $check_wrong_num)); |
|||
if ($_W['isw7_request']) { |
|||
$message = array( |
|||
'check_num' => $check_num, |
|||
'check_wrong_num' => $check_wrong_num, |
|||
'system_check_items' => $system_check_items |
|||
); |
|||
iajax(0, $message); |
|||
} |
|||
template('system/check'); |
|||