-
Notifications
You must be signed in to change notification settings - Fork 1
/
ClockPicker.php
43 lines (36 loc) · 1.32 KB
/
ClockPicker.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
/**
* ClockPicker Class File
*
* @author Phelipe B. Folgierini <[email protected]>
* @version 1
* @license http://www.opensource.org/licenses/mit-license.php MIT license
*
* @desc ClockPicker is a wrapper for http://weareoutman.github.io/clockpicker/
*/
class ClockPicker extends CWidget {
/**
* @var string Path of the asset files after publishing.
*/
private $assetsPath;
/**
* @var string the selected HTML elements
*/
public $element;
/**
* @var array options for maskMoney
*/
public $config = array();
public function init() {
$assets = dirname(__FILE__) . '/' . 'assets';
$this->assetsPath = Yii::app()->getAssetManager()->publish($assets);
Yii::app()->getClientScript()->registerScriptFile($this->assetsPath . '/' . 'jquery-clockpicker.min.js');
Yii::app()->clientScript->registerCoreScript('jquery-clockpicker-js');
Yii::app()->getClientScript()->registerCssFile($this->assetsPath . '/' . 'jquery-clockpicker.min.css');
Yii::app()->clientScript->registerCoreScript('jquery-clockpicker-css');
}
public function run() {
Yii::app()->clientScript->registerScript('processClockPicker', '$("'.$this->element.'").clockpicker('.json_encode($this->config).')');
}
}
?>