200 lines
4.4 KiB
PHP
200 lines
4.4 KiB
PHP
<?php
|
|
namespace Sookon\Helpers;
|
|
/**
|
|
* Theme 主题
|
|
*/
|
|
|
|
class Theme
|
|
{
|
|
private $render; //传入Zend Render对象
|
|
public $plus; //插件
|
|
public $ScriptKey = "js"; //js 文件键名
|
|
public $CSSKey = "css"; //css 文件键名
|
|
|
|
function __construct()
|
|
{
|
|
$this->_init_plus();
|
|
}
|
|
|
|
//初始化插件
|
|
function _init_plus()
|
|
{
|
|
$this->plus = array(
|
|
|
|
/**********Jquery公共库******/
|
|
|
|
//Jquery UI
|
|
'jquery_ui_datepicker' => array(
|
|
$this->ScriptKey => array(
|
|
'/static/lib/datepicker/bootstrap-datepicker.min.js'
|
|
),
|
|
$this->CSSKey => array(
|
|
'/static/lib/datepicker/datepicker.css'
|
|
)
|
|
),
|
|
|
|
/***********自定义插件**********/
|
|
|
|
//admin_plugin
|
|
'admin_plugin' => array(
|
|
$this->ScriptKey => array(
|
|
'/static/js/custom/admin_plugin.js'
|
|
)
|
|
),
|
|
|
|
'colorbox' => array(
|
|
$this->ScriptKey => array(
|
|
'/static/lib/colorbox/jquery.colorbox-min.js'
|
|
),
|
|
$this->CSSKey => array(
|
|
'/static/lib/colorbox/colorbox-clear.css'
|
|
)
|
|
),
|
|
|
|
//uploadify
|
|
'uploadify' => array(
|
|
$this->ScriptKey => array(
|
|
'/static/lib/uploadify/jquery.uploadify.min.js'
|
|
),
|
|
$this->CSSKey => array(
|
|
'/static/lib/uploadify/uploadify.css'
|
|
)
|
|
),
|
|
|
|
'kindeditor-min' => array(
|
|
$this->ScriptKey => array(
|
|
'/static/lib/kindeditor/kindeditor-min.js',
|
|
'/static/lib/kindeditor/lang/zh_CN.js'
|
|
)
|
|
),
|
|
|
|
'swfupload' => array(
|
|
$this->ScriptKey => array(
|
|
'/static/lib/swfupload/swfupload.js',
|
|
'/static/lib/swfupload/plugins/swfupload.cookies.js',
|
|
'/static/lib/swfupload/plugins/swfupload.queue.js',
|
|
'/static/lib/swfupload/plugins/swfupload.speed.js',
|
|
'/static/lib/swfupload/plugins/swfupload.swfobject.js'
|
|
)
|
|
),
|
|
|
|
'slidesjs' => array(
|
|
$this->ScriptKey => array(
|
|
'/static/lib/slidesjs/jquery.slides.min.js',
|
|
)
|
|
),
|
|
|
|
'masonry'=>array(
|
|
$this->ScriptKey => array(
|
|
'/static/js/jquery.masonry.min.js'
|
|
)
|
|
),
|
|
|
|
'jquery-ui'=>array(
|
|
$this->ScriptKey => array(
|
|
'/static/lib/jquery-ui/jquery-ui-1.10.3.custom.min.js',
|
|
'/static/lib/jquery-ui/jquery.ui.touch-punch.min.js'
|
|
),
|
|
$this->CSSKey=>array(
|
|
'/static/lib/jquery-ui/jquery-ui-1.10.3.custom.min.css'
|
|
)
|
|
),
|
|
|
|
'jplayer'=>array(
|
|
$this->ScriptKey => array(
|
|
'/static/lib/jplayer/jquery.jplayer.min.js'
|
|
)
|
|
),
|
|
|
|
'taginput'=>array(
|
|
$this->ScriptKey => array(
|
|
'/static/lib/taginput/jquery.tagsinput.min.js'
|
|
),
|
|
$this->CSSKey=>array(
|
|
'/static/lib/taginput/jquery.tagsinput.css'
|
|
)
|
|
),
|
|
|
|
'datetimepicker' => array(
|
|
$this->ScriptKey => array(
|
|
'/static/lib/bootstrap-datepicker/js/bootstrap-datetimepicker.min.js',
|
|
'/static/lib/bootstrap-datepicker/js/locales/bootstrap-datetimepicker.zh-CN.js'
|
|
),
|
|
$this->CSSKey=>array(
|
|
'/static/lib/bootstrap-datepicker/css/bootstrap-datetimepicker.min.css'
|
|
)
|
|
),
|
|
|
|
/*********谷歌地图*********/
|
|
|
|
//Google Map API v3
|
|
'google_map_v3'=>array(
|
|
$this->ScriptKey => array(
|
|
'http://maps.google.com/maps/api/js?sensor=false&language=zh-cn'
|
|
)
|
|
),
|
|
|
|
//Google Map API v3 - KeyDragZone
|
|
'google_map_keydragzone' => array(
|
|
$this->ScriptKey => array(
|
|
'/static/js/custom/google-map/keydragzoom.js'
|
|
)
|
|
),
|
|
|
|
/********Highcharts*******/
|
|
|
|
'highcharts' => array(
|
|
$this->ScriptKey => array(
|
|
'/static/lib/highcharts/highcharts.js',
|
|
'/static/lib/highcharts/modules/exporting.js'
|
|
),
|
|
),
|
|
|
|
/********Highstock********/
|
|
'highstock' => array(
|
|
$this->ScriptKey => array(
|
|
'/static/lib/highstock/highstock.js',
|
|
'/static/lib/highstock/modules/exporting.js'
|
|
),
|
|
),
|
|
|
|
);//插件列表
|
|
|
|
}// _init_plus()
|
|
|
|
//前台添加插件
|
|
public function AppendPlus($render,$plus_name){
|
|
|
|
$plus_name = strtolower($plus_name);
|
|
|
|
$plusing = $this->plus;
|
|
|
|
if(!empty($plusing[$plus_name][$this->ScriptKey]))
|
|
{
|
|
foreach($plusing[$plus_name][$this->ScriptKey] as $k=>$v)
|
|
{
|
|
$render->headScript()->appendFile($v);
|
|
}
|
|
}
|
|
|
|
if(!empty($plusing[$plus_name][$this->CSSKey]))
|
|
{
|
|
foreach($plusing[$plus_name][$this->CSSKey] as $k=>$v)
|
|
{
|
|
$render->headLink()->appendStylesheet($v);
|
|
}
|
|
}
|
|
|
|
}// AppendPlus
|
|
|
|
//加载页面中的JS
|
|
function AppendModel($render,$model)
|
|
{
|
|
|
|
$model = trim($model);
|
|
|
|
$render->headScript()->appendFile("/static/js/custom/models/".$model.".js");
|
|
|
|
}//
|
|
}
|