当前位置: 首页>>代码示例>>PHP>>正文


PHP CJavaScript类代码示例

本文整理汇总了PHP中CJavaScript的典型用法代码示例。如果您正苦于以下问题:PHP CJavaScript类的具体用法?PHP CJavaScript怎么用?PHP CJavaScript使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了CJavaScript类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: run

 /**
  * Runs the widget.
  */
 public function run()
 {
     $id = $this->id;
     if (is_string($this->keys)) {
         $this->keys = array($this->keys);
     }
     echo CHtml::openTag('div', $this->htmlOptions);
     foreach ($this->keys as $key) {
         if (Yii::app()->user->hasFlash($key)) {
             echo strtr($this->template, array('{class}' => ' fade in', '{key}' => $key, '{message}' => Yii::app()->user->getFlash($key)));
         }
     }
     echo '</div>';
     /** @var CClientScript $cs */
     $cs = Yii::app()->getClientScript();
     $selector = "#{$id} .alert";
     $cs->registerScript(__CLASS__ . '#' . $id, "jQuery('{$selector}').alert();");
     // Register the "close" event-handler.
     if (isset($this->events['close'])) {
         $fn = CJavaScript::encode($this->events['close']);
         $cs->registerScript(__CLASS__ . '#' . $id . '.close', "jQuery('{$selector}').bind('close', {$fn});");
     }
     // Register the "closed" event-handler.
     if (isset($this->events['closed'])) {
         $fn = CJavaScript::encode($this->events['closed']);
         $cs->registerScript(__CLASS__ . '#' . $id . '.closed', "jQuery('{$selector}').bind('closed', {$fn});");
     }
 }
开发者ID:niranjan2m,项目名称:Voyanga,代码行数:31,代码来源:BootAlert.php

示例2: run

 /**
  * Runs the widget.
  */
 public function run()
 {
     $id = $this->id;
     echo CHtml::openTag('div', $this->htmlOptions);
     echo '<div class="carousel-inner">';
     $this->renderItems($this->items);
     echo '</div>';
     echo '<a class="carousel-control left" href="#' . $id . '" data-slide="prev">' . $this->prev . '</a>';
     echo '<a class="carousel-control right" href="#' . $id . '" data-slide="next">' . $this->next . '</a>';
     echo '</div>';
     /** @var CClientScript $cs */
     $cs = Yii::app()->getClientScript();
     $options = !empty($this->options) ? CJavaScript::encode($this->options) : '';
     $cs->registerScript(__CLASS__ . '#' . $id, "jQuery('#{$id}').carousel({$options});");
     // Register the "slide" event-handler.
     if (isset($this->events['slide'])) {
         $fn = CJavaScript::encode($this->events['slide']);
         $cs->registerScript(__CLASS__ . '#' . $id . '.slide', "jQuery('#{$id}').on('slide', {$fn});");
     }
     // Register the "slid" event-handler.
     if (isset($this->events['slid'])) {
         $fn = CJavaScript::encode($this->events['slid']);
         $cs->registerScript(__CLASS__ . '#' . $id . '.slid', "jQuery('#{$id}').on('slid', {$fn});");
     }
 }
开发者ID:niranjan2m,项目名称:Voyanga,代码行数:28,代码来源:BootCarousel.php

示例3: run

 /**
  * Runs the widget.
  */
 public function run()
 {
     $id = $this->id;
     echo '</div>';
     /** @var CClientScript $cs */
     $cs = Yii::app()->getClientScript();
     $options = CJavaScript::encode($this->options);
     $cs->registerScript(__CLASS__ . '#' . $id, "jQuery('#{$id}').modal({$options});");
     // Register the "show" event-handler.
     if (isset($this->events['show'])) {
         $fn = CJavaScript::encode($this->events['show']);
         $cs->registerScript(__CLASS__ . '#' . $id . '.show', "jQuery('#{$id}').on('show', {$fn});");
     }
     // Register the "shown" event-handler.
     if (isset($this->events['shown'])) {
         $fn = CJavaScript::encode($this->events['shown']);
         $cs->registerScript(__CLASS__ . '#' . $id . '.shown', "jQuery('#{$id}').on('shown', {$fn});");
     }
     // Register the "hide" event-handler.
     if (isset($this->events['hide'])) {
         $fn = CJavaScript::encode($this->events['hide']);
         $cs->registerScript(__CLASS__ . '#' . $id . '.hide', "jQuery('#{$id}').on('hide', {$fn});");
     }
     // Register the "hidden" event-handler.
     if (isset($this->events['hidden'])) {
         $fn = CJavaScript::encode($this->events['hidden']);
         $cs->registerScript(__CLASS__ . '#' . $id . '.hidden', "jQuery('#{$id}').on('hidden', {$fn});");
     }
 }
开发者ID:laiello,项目名称:what-i-need,代码行数:32,代码来源:BootModal.php

示例4: run

 /**
  * Generates the required HTML and Javascript
  */
 public function run()
 {
     list($name, $id) = $this->resolveNameID();
     $model = $this->model;
     if ($this->uploadTemplate === null) {
         $this->uploadTemplate = "#template-upload";
         $this->render("upload");
     }
     if ($this->downloadTemplate === null) {
         $this->downloadTemplate = "#template-download";
         $this->render("download");
     }
     if (!isset($this->htmlOptions['enctype'])) {
         $this->htmlOptions['enctype'] = 'multipart/form-data';
     }
     if (!isset($this->htmlOptions['id'])) {
         $this->htmlOptions['id'] = get_class($model) . "-form";
     }
     $options = CJavaScript::encode($this->options);
     Yii::app()->clientScript->registerScript(__CLASS__ . '#' . $this->htmlOptions['id'], "jQuery('#{$this->htmlOptions['id']}').fileupload({$options});", CClientScript::POS_READY);
     $htmlOptions = array();
     if ($this->multiple) {
         $htmlOptions["multiple"] = true;
         /* if($this->hasModel()){
                $this -> attribute = "[]" . $this -> attribute;
            }else{
                $this -> attribute = "[]" . $this -> name;
            }*/
     }
     $this->render("form", compact('htmlOptions'));
 }
开发者ID:Zalinski,项目名称:Bootstrap-blog-demo-multi-login,代码行数:34,代码来源:XUpload.php

示例5: run

 public function run()
 {
     if (empty($this->config['action'])) {
         throw new CException('EAjaxUpload: param "action" cannot be empty.');
     }
     if (empty($this->config['allowedExtensions'])) {
         throw new CException('EAjaxUpload: param "allowedExtensions" cannot be empty.');
     }
     if (empty($this->config['sizeLimit'])) {
         throw new CException('EAjaxUpload: param "sizeLimit" cannot be empty.');
     }
     unset($this->config['element']);
     echo '<div id="' . $this->id . '"><noscript><p>Habilite Jva Script en este navegador para usar esta funcion .</p></noscript></div>';
     $assets = dirname(__FILE__) . '/assets';
     $baseUrl = Yii::app()->assetManager->publish($assets);
     Yii::app()->clientScript->registerScriptFile($baseUrl . '/fileuploader.js', CClientScript::POS_HEAD);
     $this->css = !empty($this->css) ? $this->css : $baseUrl . '/fileuploader.css';
     Yii::app()->clientScript->registerCssFile($this->css);
     $postParams = array('PHPSESSID' => session_id(), 'YII_CSRF_TOKEN' => Yii::app()->request->csrfToken);
     if (isset($this->postParams)) {
         $postParams = array_merge($postParams, $this->postParams);
     }
     $config = array('element' => 'js:document.getElementById("' . $this->id . '")', 'debug' => false, 'multiple' => false);
     $config = array_merge($config, $this->config);
     $config['params'] = $postParams;
     $config = CJavaScript::encode($config);
     Yii::app()->getClientScript()->registerScript("FileUploader_" . $this->id, "var FileUploader_" . $this->id . " = new qq.FileUploader({$config}); ", CClientScript::POS_LOAD);
 }
开发者ID:hipogea,项目名称:zega,代码行数:28,代码来源:EAjaxUpload.php

示例6: registerClientScript

 /**
  * Registers necessary client scripts.
  */
 public function registerClientScript()
 {
     $id = $this->getId();
     if ($this->ajaxUpdate === false) {
         $ajaxUpdate = array();
     } else {
         $ajaxUpdate = array_unique(preg_split('/\\s*,\\s*/', $this->ajaxUpdate . ',' . $id, -1, PREG_SPLIT_NO_EMPTY));
     }
     $options = array('ajaxUpdate' => $ajaxUpdate, 'ajaxVar' => $this->ajaxVar, 'pagerClass' => $this->pagerCssClass, 'loadingClass' => $this->loadingCssClass, 'sorterClass' => $this->sorterCssClass, 'enableHistory' => $this->enableHistory);
     if ($this->ajaxUrl !== null) {
         $options['url'] = CHtml::normalizeUrl($this->ajaxUrl);
     }
     if ($this->updateSelector !== null) {
         $options['updateSelector'] = $this->updateSelector;
     }
     foreach (array('beforeAjaxUpdate', 'afterAjaxUpdate', 'ajaxUpdateError') as $event) {
         if ($this->{$event} !== null) {
             if ($this->{$event} instanceof CJavaScriptExpression) {
                 $options[$event] = $this->{$event};
             } else {
                 $options[$event] = new CJavaScriptExpression($this->{$event});
             }
         }
     }
     $options = CJavaScript::encode($options);
     $cs = Yii::app()->getClientScript();
     $cs->registerCoreScript('bbq', CClientScript::POS_HEAD);
     $cs->registerScriptFile($this->baseScriptUrl . '/jquery.yiilistview.js', CClientScript::POS_END);
     $cs->registerScript(__CLASS__ . '#' . $id, "\$(document).ready(function() { \$('#{$id}').yiiListView({$options}); });");
 }
开发者ID:fandikurnia,项目名称:CiiMS,代码行数:33,代码来源:ContentListView.php

示例7: init

 public function init()
 {
     if (isset($this->htmlOptions['id'])) {
         $id = $this->htmlOptions['id'];
     } else {
         $id = $this->htmlOptions['id'] = $this->getId();
     }
     if ($this->url !== null) {
         $this->url = CHtml::normalizeUrl($this->url);
     }
     $cs = Yii::app()->getClientScript();
     //$cs->registerCoreScript('treeview');
     $baseUrl = Yii::app()->getAssetManager()->publish(Yii::getPathOfAlias('ext.yii-jqTree.source'));
     $cs->registerScriptFile($baseUrl . '/tree.jquery.js');
     $options = $this->getClientOptions();
     $options = $options === array() ? '{}' : CJavaScript::encode($options);
     $cs->registerScript('Yii.JQTree#0' . $id, "if (jQuery.jqTree == undefined) {jQuery.jqTree = new Array;}");
     $cs->registerScript('Yii.JQTree#' . $id, "jQuery.jqTree[\"{$id}\"] = jQuery(\"#{$id}\").tree({$options});");
     if ($this->cssFile === null) {
         $cs->registerCssFile($baseUrl . '/jqtree.css');
     } else {
         if ($this->cssFile !== false) {
             $cs->registerCssFile($this->cssFile);
         }
     }
     echo CHtml::tag('ul', $this->htmlOptions, false, false) . "\n";
 }
开发者ID:asdmundt,项目名称:templateYiiApp,代码行数:27,代码来源:JQTree.php

示例8: actionAdditem

 /**
  * Displays a particular model.
  * @param integer $id the ID of the model to be displayed
  */
 public function actionAdditem($item_id)
 {
     $user_id = Yii::app()->user->id;
     // find the users cart
     $user = User::model()->find(array('condition' => 'id=:user_id', 'params' => array(':user_id' => $user_id)));
     // find the users cart
     $cart = Cart::model()->find(array('condition' => 'cart_owner=:cart_owner', 'params' => array(':cart_owner' => $user_id)));
     // find the item being reffered to by item_id
     $item = Item::model()->find(array('condition' => 'id=:item_id', 'params' => array(':item_id' => $item_id)));
     if (is_null($cart)) {
         // if the cart is not found. create a cart for the user.
         $cart = new Cart();
         $cart->cart_owner = $user->id;
         $cart->save();
     }
     // check if the same order was already made & increment else, create new
     $order = Order::model()->find(array('condition' => 'item_id=:item_id AND cart_id=:cart_id AND order_by=:order_by', 'params' => array(':item_id' => $item_id, ':cart_id' => $cart->id, ':order_by' => $user->id)));
     if (is_null($order)) {
         $order = new Order();
         $order->create_time = time();
         $order->quantity = 1;
         $order->item_id = $item->id;
         $order->cart_id = $cart->id;
         $order->order_by = $user->id;
     } else {
         $order->quantity = 1 + $order->quantity;
         $order->update_time = time();
     }
     $order->save();
     // find all orders by this user.
     $orders = Order::model()->findAll('cart_id=:cart_id AND order_by=:order_by', array(':cart_id' => $cart->id, ':order_by' => $user->id));
     $return = array('success' => true, 'data' => $orders);
     echo CJavaScript::jsonEncode($return);
     Yii::app()->end();
 }
开发者ID:iusedtobecat,项目名称:sweetparticles,代码行数:39,代码来源:CartController.php

示例9: editAttribute

 /**
  * @param $model - profile model
  * @param $field - profile fields model item
  * @param $params - htmlOptions
  * @return string
  */
 public function editAttribute($model, $field, $htmlOptions = array())
 {
     if (!isset($htmlOptions['size'])) {
         $htmlOptions['size'] = 60;
     }
     if (!isset($htmlOptions['maxlength'])) {
         $htmlOptions['maxlength'] = $field->field_size ? $field->field_size : 10;
     }
     if (!isset($htmlOptions['id'])) {
         $htmlOptions['id'] = get_class($model) . '_' . $field->varname;
     }
     $id = $htmlOptions['id'];
     $options['dateFormat'] = 'yy-mm-dd';
     $options = CJavaScript::encode($options);
     $basePath = Yii::getPathOfAlias('admin.views.asset');
     $baseUrl = Yii::app()->getAssetManager()->publish($basePath);
     $cs = Yii::app()->getClientScript();
     $cs->registerCssFile($baseUrl . '/css/' . $this->params['ui-theme'] . '/jquery-ui.css');
     $cs->registerScriptFile($baseUrl . '/js/jquery-ui.min.js');
     $language = $this->params['language'];
     if ($language != 'en') {
         $js = "jQuery('#{$id}').datepicker(jQuery.extend({showMonthAfterYear:false}, jQuery.datepicker.regional['{$language}'], {$options}));";
         $cs->registerScriptFile($baseUrl . '/js/jquery-ui-i18n.min.js');
     } else {
         $js = "jQuery('#{$id}').datepicker({$options});";
     }
     $cs->registerScript('ProfileFieldController' . '#' . $id, $js);
     return CHtml::activeTextField($model, $field->varname, $htmlOptions);
 }
开发者ID:hansenmakangiras,项目名称:disperindag,代码行数:35,代码来源:UWjuidate.php

示例10: run

 /**
  * Runs the widget.
  */
 public function run()
 {
     list($name, $id) = $this->resolveNameID();
     $id = $this->resolveId($id);
     if ($this->hasModel()) {
         echo TbHtml::activeTextField($this->model, $this->attribute, $this->htmlOptions);
     } else {
         echo TbHtml::textField($name, $this->value, $this->htmlOptions);
     }
     if ($this->assetPath !== false) {
         $this->publishAssets($this->assetPath);
         $this->registerCssFile('/css/bootstrap-datetimepicker.css');
         if ($this->registerJs) {
             $this->registerScriptFile('/js/' . $this->resolveScriptVersion('bootstrap-datetimepicker.js'), CClientScript::POS_END);
             if (isset($this->locale)) {
                 $this->locale = str_replace('_', '-', $this->locale);
                 $this->registerScriptFile("/js/locales/bootstrap-datetimepicker.{$this->locale}.js", CClientScript::POS_END);
             }
         }
     }
     if ($this->bindPlugin) {
         $options = !empty($this->pluginOptions) ? CJavaScript::encode($this->pluginOptions) : '';
         $this->getClientScript()->registerScript(__CLASS__ . '#' . $id, "jQuery('#{$id}').datetimepicker({$options});");
     }
 }
开发者ID:juanprua,项目名称:yiistrap-widgets,代码行数:28,代码来源:TbDateTimePicker.php

示例11: run

 /**
  */
 public function run()
 {
     /**
      * @var CClientScript $cs
      */
     $cs = Yii::app()->getClientScript();
     // Javascript var
     if (empty($this->jsVarName)) {
         $this->jsVarName = $this->getId() . 'Layout';
     }
     // Container ID
     if (!isset($this->htmlOptions['id'])) {
         $this->htmlOptions['id'] = $this->getId();
     }
     $id = $this->htmlOptions['id'];
     echo CHtml::openTag('div', $this->htmlOptions);
     $layoutsOptions = $this->renderLayouts();
     echo '</div>';
     // Prepare options
     $options = CMap::mergeArray($this->options, $layoutsOptions);
     $options = empty($options) ? '' : CJavaScript::encode($options);
     // Register global JS var
     $cs->registerScript(__CLASS__ . '#jsVar#' . $this->getId(), 'var ' . $this->jsVarName . ';', CClientScript::POS_HEAD);
     // Register Layouts init script
     $cs->registerScript(__CLASS__ . '#init#' . $this->getId(), $this->jsVarName . ' = $("#' . $id . '").layout(' . $options . ');', CClientScript::POS_READY);
 }
开发者ID:josefd8,项目名称:dashboardWeb,代码行数:28,代码来源:TbUiLayout.php

示例12: run

 public function run()
 {
     list($this->name, $this->id) = $this->resolveNameId();
     if (isset($this->htmlOptions['placeholder'])) {
         $this->options['placeholder'] = $this->htmlOptions['placeholder'];
     }
     $data = array();
     if (isset($this->options['placeholder'])) {
         $data[''] = '';
     }
     $this->data = $data + $this->data;
     if ($this->hasModel()) {
         echo CHtml::activeDropDownList($this->model, $this->attribute, $this->data, $this->htmlOptions);
     } else {
         $this->htmlOptions['id'] = $this->id;
         echo CHtml::dropDownList($this->name, $this->value, $this->data, $this->htmlOptions);
     }
     $bu = Yii::app()->assetManager->publish(dirname(__FILE__) . '/assets/');
     $cs = Yii::app()->clientScript;
     $cs->registerCssFile($bu . '/select2.css');
     if ($this->scriptPosition === null) {
         $this->scriptPosition = $cs->coreScriptPosition;
     }
     $cs->registerScriptFile($bu . '/select2.js', $this->scriptPosition);
     $options = $this->options ? CJavaScript::encode($this->options) : '';
     $cs->registerScript(__CLASS__ . '#' . $this->id, "\$('#{$this->id}').select2({$options});");
 }
开发者ID:rusli-nasir,项目名称:ERP_Accounting_Indonesia,代码行数:27,代码来源:ESelect2.php

示例13: registerFiles

 protected function registerFiles()
 {
     $assetsDir = (defined(__DIR__) ? __DIR__ : dirname(__FILE__)) . '/assets';
     $assets = Yii::app()->assetManager->publish($assetsDir);
     $ext = defined('YII_DEBUG') ? 'js' : 'min.js';
     $cs = Yii::app()->clientScript;
     $cs->registerCoreScript('jquery');
     $cs->registerScriptFile($assets . '/fullcalendar/jalali.js');
     $cs->registerScriptFile($assets . '/fullcalendar/fullcalendar.' . $ext);
     $cs->registerScriptFile($assets . '/fullcalendar/jquery-ui-1.8.23.custom.min.js');
     /* $cs->registerCssFile($assets.'/fullcalendar/fullcalendar.css'); */
     $cs->registerCssFile($assets . '/fullcalendar/fullcalendar_theme.css');
     if ($this->loadPrintCss) {
         $cs->registerCssFile($assets . '/fullcalendar/fullcalendar.print.css');
     }
     if ($this->googleCalendarUrl) {
         $cs->registerScriptFile($assets . '/fullcalendar/gcal.js');
         $this->options['events'] = $this->googleCalendarUrl;
     }
     if ($this->themeCssFile) {
         $this->options['theme'] = true;
         $cs->registerCssFile($assets . '/themes/' . $this->themeCssFile);
     }
     $BootBoxBaseUrl = Yii::app()->getAssetManager()->publish(Yii::getPathOfAlias('ext.bootbox'));
     $cs->registerScriptFile($BootBoxBaseUrl . '/bootstrap.bootbox.min.js');
     $js = 'var ' . $this->id . ' = $("#' . $this->id . '").fullCalendar(' . CJavaScript::encode($this->options) . ');';
     $cs->registerScript(__CLASS__ . '#' . $this->id, $js, CClientScript::POS_READY);
 }
开发者ID:RezaMansouri70,项目名称:jalali-fullcalendar,代码行数:28,代码来源:JFullCalendar.php

示例14: renderButton

 public function renderButton($button, $name, $config, $id, &$js)
 {
     $output = '';
     $buttonCssClass = 'cms-icon-' . $config['iconSize'] . '-' . $button['icon'];
     if ($button['click']) {
         $js .= "\$('#{$id}_{$name}').click(" . CJavaScript::encode($button['click']) . ");\n";
     }
     $output .= '<li id="' . $id . '_' . $name . '_li" class="' . $button['cssClass'] . '">';
     $output .= '<a id="' . $id . '_' . $name . '"
             title="' . $button['title'] . '" href="#">';
     if (isset($button['checked'])) {
         $output .= '<input ';
         if ($button['checked']) {
             $output .= ' checked="checked" ';
         }
         $output .= 'type="checkbox" id="' . $id . '_' . $name . '_checkbox" /><label for="' . $id . '_' . $name . '_checkbox">';
     }
     if ($config['showIcons']) {
         $output .= '<span class="' . $buttonCssClass . '"></span>';
     }
     if ($config['showTitles']) {
         $output .= $button['title'];
     }
     if (isset($button['checked'])) {
         $output .= '</label>';
     }
     $output .= '</a>';
     $output .= '</li>';
     return $output;
 }
开发者ID:rosko,项目名称:Tempo-CMS,代码行数:30,代码来源:Toolbar.php

示例15: run

 /**
  * Runs the widget.
  */
 public function run()
 {
     $id = $this->id;
     echo CHtml::tag('input', $this->htmlOptions);
     $options = !empty($this->options) ? CJavaScript::encode($this->options) : '';
     Yii::app()->clientScript->registerScript(__CLASS__ . '#' . $id, "jQuery('#{$id}').typeahead({$options});");
 }
开发者ID:nisarg709,项目名称:yii-bootstrap,代码行数:10,代码来源:BootTypeahead.php


注:本文中的CJavaScript类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。