public static function reload($view) { GrowlAsset::register($view); AnimateAsset::register($view); }
/** * Register client assets */ protected function registerAssets() { $view = $this->getView(); GrowlAsset::register($view); if ($this->useAnimation) { AnimateAsset::register($view); } $this->registerPluginOptions('growl'); $js = '$.growl(' . Json::encode($this->_settings) . ', ' . $this->_hashVar . ');'; if (!empty($this->delay) && $this->delay > 0) { $js = 'setTimeout(function () {' . $js . '}, ' . $this->delay . ');'; } $view->registerJs($js); }
/** * Register client assets */ protected function registerAssets() { $view = $this->getView(); if (in_array($this->type, self::$_themes)) { GrowlAsset::register($view)->addTheme($this->type); } else { GrowlAsset::register($view); } if ($this->useAnimation) { AnimateAsset::register($view); } $this->registerPluginOptions('notify'); $js = '$.notify(' . Json::encode($this->_settings) . ', ' . $this->_hashVar . ');'; if (!empty($this->delay) && $this->delay > 0) { $js = 'setTimeout(function () {' . $js . '}, ' . $this->delay . ');'; } $view->registerJs($js); }
/** * Adjusted version of 'Register client assets' method */ protected function registerAssets() { $view = $this->getView(); if (in_array($this->type, self::$_themes)) { GrowlAsset::register($view)->addTheme($this->type); } else { GrowlAsset::register($view); } if ($this->useAnimation) { AnimateAsset::register($view); } $this->registerPluginOptions('notify'); // Apply AJAX if specified // if ($this->ajaxOptions) { $ajax_js = "\$.ajax({\n url: '{$this->ajaxOptions['url']}',\n method: '{$this->ajaxOptions['method']}',\n " . ($this->ajaxOptions['data'] ? "data: {$this->ajaxOptions['data']}," : null) . "\n }).success(function(data) {\n if( data.success ) {\n var notify_settings = " . Json::encode($this->_settings) . ";\n var successFunction = {$this->ajaxOptions['successCallback']}\n successFunction.call(this, data, notify_settings);\n \n // Loop through results - Could have more than one notification at a time //\n for(var i=0; i<data.notifications.length; i++) {\n // These values can now be determined by the AJAX data sent back //\n notify_settings.message = data.notifications[i].body;\n notify_settings.title = data.notifications[i].title + '<hr>';\n \n // Only show if the 'notification.show' variable is true.\n // This allows us to poll for notifications without them\n // appearing non-stop - Could implement an AJAX callback\n // to server side code to dismiss the notification...\n if( data.notifications[i].show )\n \$.notify(notify_settings, " . $this->_hashVar . ");\n }\n }\n }).fail({$this->ajaxOptions['failCallback']});"; // Apply interval if one is passed in // if ($this->ajaxOptions['interval']) { $js = "\n // Call on page load up //\n {$ajax_js}\n \n // Call on an interval //\n setInterval(function() {\n {$ajax_js}\n }, {$this->ajaxOptions['interval']});"; } else { // Call on page load up but don't repeat // $js = $ajax_js; } } else { $js = '$.notify(' . Json::encode($this->_settings) . ', ' . $this->_hashVar . ');'; if (!empty($this->delay) && $this->delay > 0) { $js = 'setTimeout(function () {' . $js . '}, ' . $this->delay . ');'; } } $view->registerJs($js); }