コード例 #1
0
ファイル: ExtGridView.php プロジェクト: rash012/cms
 /**
  * Register client script
  */
 public function registerClientScript()
 {
     parent::registerClientScript();
     if ($this->enablePageSizing) {
         Yii::app()->getClientScript()->registerScript(__CLASS__ . '#' . $this->id . '-page-size', "\n\t\t\t\t\$(document).on('change', '#{$this->id}-page-size', function(){\n\t\t\t\t\t\$.fn.yiiGridView.update('{$this->id}',{data: { '{$this->id}-page-size': \$(this).val()}});\n\t\t\t\t\treturn false;\n\t\t\t\t});\n\t\t\t");
     }
 }
コード例 #2
0
ファイル: TorrentGridWidget.php プロジェクト: maduhu/openbay
 public function registerClientScript()
 {
     if ($this->initScripts) {
         return parent::registerClientScript();
     }
     return;
 }
コード例 #3
0
 /**
  * Registers necessary client scripts. 
  * Automaticlly prepend user's beforeajaxUpdate with needed code that will modify GET params when navigating and sorting
  */
 public function registerClientScript()
 {
     parent::registerClientScript();
     if ($this->selectableRows > 0) {
         $id = $this->getId();
         $options = array('selVar' => $this->selVar);
         $options = CJavaScript::encode($options);
         $cs = Yii::app()->getClientScript();
         $cs->registerScriptFile($this->selBaseScriptUrl . '/jquery.selgridview.js', CClientScript::POS_END);
         $cs->registerScript(__CLASS__ . '#' . $id . '-sel', "jQuery('#{$id}').selGridView({$options});");
     }
 }
コード例 #4
0
    /**
     * Registers necessary client scripts.
     */
    public function registerClientScript()
    {
        parent::registerClientScript();

        $cs=Yii::app()->getClientScript();
        $cs->registerScriptFile($this->baseJuiUrl.'/jquery.ui.core.min.js',CClientScript::POS_END);
        $cs->registerScriptFile($this->baseJuiUrl.'/jquery.ui.widget.min.js',CClientScript::POS_END);
        $cs->registerScriptFile($this->baseJuiUrl.'/jquery.ui.mouse.min.js',CClientScript::POS_END);
        $cs->registerScriptFile($this->baseJuiUrl.'/jquery.ui.droppable.min.js',CClientScript::POS_END);
        $cs->registerScriptFile($this->baseJuiUrl.'/jquery.ui.draggable.min.js',CClientScript::POS_END);
        
        $baseUrl = Y::curBaseUrl();
        
        $cs->registerScript('draganddrop', '
            $(document).ready(function()  {
               $("#'.$this->getId().' tbody tr").live("mouseenter", function() {
	              var $this = $(this);
	              if($this.is(":data(draggable)")) return;
				  $this.draggable({
	                  helper: "clone",
	                  opacity: .75,
	                  refreshPositions: true, // Performance?
	                  revert: "invalid",
	                  revertDuration: 300,
	                  scroll: true
	              });
	           });
               $("#'.$this->getId().' tbody tr").live("mouseenter", function() {
               		var $this = $(this);
               		if ($this.is(":data(droppable)")) return;
				    $(this).droppable({
	                    drop: function(e, ui) {
							$("#'.$this->getId().'").addClass("grid-views-loading");
	                    	$.get(
		                    	"'.$baseUrl.'/movePosition",
								{
		                    		pk : $(ui.draggable).attr("id"),
		                    		to : $(this).attr("id")
		                    	},
		                    	function() {
		                    		$.fn.yiiGridView.update("'.$this->getId().'");
		    					}
		                    );
	                    },
	  					hoverClass: "accept",
	               });
               });
            });
		');
    }
コード例 #5
0
 private function getWidgetScript($callback1, $callback2, $callback3, $callback4)
 {
     Yii::import('zii.widgets.grid.CGridView');
     Yii::app()->clientScript->scripts = array();
     ob_start();
     $widget = new CGridView(null);
     $widget->beforeAjaxUpdate = $callback1;
     $widget->afterAjaxUpdate = $callback2;
     $widget->ajaxUpdateError = $callback3;
     $widget->selectionChanged = $callback4;
     $widget->dataProvider = new CArrayDataProvider(array(1, 2, 3));
     $widget->init();
     $widget->registerClientScript();
     Yii::app()->clientScript->render($out);
     ob_end_clean();
     return $out;
 }
コード例 #6
0
ファイル: NGridView.php プロジェクト: kinghinds/kingtest2
 public function registerClientScript()
 {
     if (!Yii::app()->request->isAjaxRequest) {
         parent::registerClientScript();
         $cs = Yii::app()->clientScript;
         $basePath = Yii::getPathOfAlias('ext.NPager.assets');
         $baseUrl = Yii::app()->getAssetManager()->publish($basePath);
         $id = parent::getId();
         $cs = Yii::app()->clientScript;
         $cs->registerCoreScript('jquery');
         $js = "function {$id}" . "_changePageSize(id,url)\n";
         $js .= "{\n";
         $js .= "    url = {url:url+\$('#'+id+'>.{$this->pagerlistCssClass}>select').val()};\n";
         $js .= "    \$.fn.yiiGridView.update(id,url);\n";
         $js .= "}\n";
         $js .= "\n";
         $cs->registerScript($this->getId(), $js, CClientScript::POS_END);
         $cs->registerCssFile($baseUrl . '/style.css');
     }
 }
コード例 #7
0
 public function registerClientScript()
 {
     // attach ajax events
     $updateParameters = array();
     if (isset($this->ajaxUpdateError)) {
         $updateParameters['ajaxUpdateError'] = (strpos($this->ajaxUpdateError, 'js:') !== 0 ? 'js:' : '') . $this->ajaxUpdateError;
     }
     if (isset($this->afterAjaxUpdate)) {
         $updateParameters['afterAjaxUpdate'] = (strpos($this->afterAjaxUpdate, 'js:') !== 0 ? 'js:' : '') . $this->afterAjaxUpdate;
     }
     if (isset($this->beforeAjaxUpdate)) {
         $updateParameters['beforeAjaxUpdate'] = (strpos($this->beforeAjaxUpdate, 'js:') !== 0 ? 'js:' : '') . $this->beforeAjaxUpdate;
     }
     parent::registerClientScript();
     $id = $this->getId();
     $cs = Yii::app()->getClientScript();
     $cs->registerScriptFile(Yii::app()->getAssetManager()->publish(__DIR__ . '/assets') . '/js/jquery.yiilivegridview.js');
     $cs->registerScript(__CLASS__ . '# ' . $id, "jQuery('#{$id}').yiiLiveGridView();");
     $cs->registerScript(__CLASS__ . '# ' . $id . '-live', "setInterval(function(){;\$.fn.yiiLiveGridView.update( '{$id}', " . CJavaScript::encode($updateParameters) . ");}, {$this->updatingTime});");
 }
コード例 #8
0
 public function registerClientScript()
 {
     parent::registerClientScript();
     if ($this->enableGvSettings) {
         Yii::app()->clientScript->registerScriptFile(Yii::app()->getBaseUrl() . '/js/colResizable-1.2.x2.js');
         Yii::app()->clientScript->registerScriptFile(Yii::app()->getBaseUrl() . '/js/jquery.dragtable.x2.js');
         Yii::app()->clientScript->registerScriptFile(Yii::app()->getBaseUrl() . '/js/x2gridview.js');
         Yii::app()->clientScript->registerScript(__CLASS__ . '#' . $this->getId() . '_gvSettings', "\$('#" . $this->getId() . " table').gvSettings({\n\t\t\t\tviewName:'" . $this->viewName . "',\n\t\t\t\tcolumnSelectorId:'" . $this->columnSelectorId . "',\n\t\t\t\tcolumnSelectorHtml:'" . addcslashes($this->columnSelectorHtml, "'") . "'\n\t\t\t});", CClientScript::POS_READY);
     }
 }
コード例 #9
0
    /**
     * Registers necessary client scripts.
     */
    public function registerClientScript()
    {
        parent::registerClientScript();

        $cs=Yii::app()->getClientScript();
        $cs->registerScriptFile($this->baseTreeTableUrl.'/javascripts/jquery.treeTable.js',CClientScript::POS_END);
        $cs->registerScriptFile($this->baseJuiUrl.'/jquery.ui.core.min.js',CClientScript::POS_END);
        $cs->registerScriptFile($this->baseJuiUrl.'/jquery.ui.widget.min.js',CClientScript::POS_END);
        $cs->registerScriptFile($this->baseJuiUrl.'/jquery.ui.mouse.min.js',CClientScript::POS_END);
        $cs->registerScriptFile($this->baseJuiUrl.'/jquery.ui.droppable.min.js',CClientScript::POS_END);
        $cs->registerScriptFile($this->baseJuiUrl.'/jquery.ui.draggable.min.js',CClientScript::POS_END);
        $cs->registerCssFile($this->baseTreeTableUrl.'/stylesheets/jquery.treeTable.css');

        $cs->registerScript('treeTable', '
            $(document).ready(function()  {
              $("#'.$this->getId().' .items").treeTable();
            });
        ');
        
        $baseUrl = '/';
        if(Y::module())
        	$baseUrl.=Y::module()->id.'/';
        $baseUrl .= Y::controller()->id.'/';
        
        $cs->registerScript('draganddrop', '
            $(document).ready(function()  {
               $("#'.$this->getId().' .items tr.initialized").draggable({
                  helper: "clone",
                  opacity: .75,
                  refreshPositions: true, // Performance?
                  revert: "invalid",
                  revertDuration: 300,
                  scroll: true
                });

                $("#'.$this->getId().' .items tr.initialized, #'.$this->getId().' .items tr.before, #'.$this->getId().' .items tr.after").droppable({
                    accept: ".initialized",
                    drop: function(e, ui) {
                      // Call jQuery treeTable plugin to move the branch
                      //$(ui.draggable).appendBranchTo(this);
                      if($(this).hasClass("initialized")) {
                        window.location.href = "'.$baseUrl.'moveNode/action/child/to/"+$(this).attr("id")+"/id/"+$(ui.draggable).attr("id");
                      }
                      if($(this).hasClass("before")) {
                        window.location.href = "'.$baseUrl.'moveNode/action/before/to/"+$(this).attr("id").replace("before-", "")+"/id/"+$(ui.draggable).attr("id");
                      }
                      if($(this).hasClass("after")) {
                        window.location.href = "'.$baseUrl.'moveNode/action/before/to/"+$(this).attr("id").replace("after-", "")+"/id/"+$(ui.draggable).attr("id");
                      }
                    },
                    hoverClass: "accept",
                    over: function(e, ui) {
                      // Make the droppable branch expand when a draggable node is moved over it.
                      if(this.id != $(ui.draggable.parents("tr")[0]).id && !$(this).is(".expanded")) {
                        $(this).expand();
                      }
                    },
                    activate: function(e, ui) {
                      $(".after").css("display", "table-row");
                      $(".before").css("display", "table-row");
                    },
                    deactivate: function(e, ui) {
                      $(".after").css("display", "none");
                      $(".before").css("display", "none");
                    },
                  });
            });

            ');
    }
コード例 #10
0
 /**
  * Registers necessary client scripts.
  */
 public function registerClientScript()
 {
     $controller = Yii::app()->getController();
     $id = $this->id;
     $cs = Yii::app()->clientScript;
     $this->options['summaryID'] = $id . '_es_';
     $this->options['hideErrorMessage'] = true;
     $activeFormOptions = CJavaScript::encode($this->options);
     $gridOptions = CJavaScript::encode(array('updateUrl' => $controller->createUrl($controller->getId() . '/' . $this->quickUpdateAction)));
     $cs->registerCoreScript('yiiactiveform');
     $cs->registerScriptFile($this->extUrl . '/js/editable-grid-view.js', CClientScript::POS_END);
     $cs->registerScript('editabe-grid-view-' . $id, "jQuery('#{$id}').yiiEditableGridView({$gridOptions});\n\$('#{$id}').yiiactiveform({$activeFormOptions});\t\n", CClientScript::POS_END);
     //$this->afterAjaxUpdate="setActiveForm";
     $cs->registerCssFile($this->extUrl . '/css/editable-grid-view.css');
     parent::registerClientScript();
 }
コード例 #11
0
ファイル: GridView.php プロジェクト: nizsheanez/documentation
 public function registerClientScript()
 {
     parent::registerClientScript();
     Yii::app()->clientScript->registerScriptFile($this->baseScriptUrl . '/gridview.js', CClientScript::POS_END, true);
 }
コード例 #12
0
ファイル: GridView.php プロジェクト: nizsheanez/alp.ru
 /**
  * Изначально регистрируются 2 плагина gridBase и grid
  * Если установить значение свойства jsPlugin, то подключится так же плагин /css/admin/gridview/{$this->jsPlugin}.js
  * И на сам grid будет инициализироват плагин с названием из jsPlugin
  */
 public function registerClientScript()
 {
     parent::registerClientScript();
     $cs = Yii::app()->clientScript;
     $cs->registerCoreScript('jquery.ui');
     $cs->registerScriptFile("/js/plugins/gridview/gridBase.js");
     $cs->registerScriptFile("/js/plugins/gridview/grid.js");
     if ($this->jsPlugin != 'grid') {
         $cs->registerScriptFile("/js/plugins/gridview/{$this->jsPlugin}.js");
     }
     $options = CJavaScript::encode(array('mass_removal' => $this->mass_removal));
     $cs->registerScript($this->getId() . 'CmsUI', "\n            \$('#{$this->getId()}').{$this->jsPlugin}({$options});\n        ");
     $this->onRegisterScript(new CEvent());
 }
コード例 #13
0
 /**
  * Registers necessary client scripts.
  */
 public function registerClientScript()
 {
     if (Yii::app()->request->isAjaxRequest) {
         Yii::app()->clientScript->coreScriptPosition = CClientScript::POS_BEGIN;
     }
     return parent::registerClientScript();
 }
コード例 #14
0
ファイル: CQTreeGridView.php プロジェクト: kostya1017/our
    /**
     * Registers necessary client scripts.
     */
    public function registerClientScript()
    {
        parent::registerClientScript();
        $cs = Yii::app()->getClientScript();
        $cs->registerScriptFile($this->baseTreeTableUrl . '/javascripts/jquery.treeTable.js', CClientScript::POS_END);
        /*
        $cs->registerScriptFile($this->baseJuiUrl.'/jquery.ui.core.min.js',CClientScript::POS_END);
        $cs->registerScriptFile($this->baseJuiUrl.'/jquery.ui.widget.min.js',CClientScript::POS_END);
        $cs->registerScriptFile($this->baseJuiUrl.'/jquery.ui.mouse.min.js',CClientScript::POS_END);
        $cs->registerScriptFile($this->baseJuiUrl.'/jquery.ui.droppable.min.js',CClientScript::POS_END);
        $cs->registerScriptFile($this->baseJuiUrl.'/jquery.ui.draggable.min.js',CClientScript::POS_END);
        */
        $cs->registerCssFile($this->baseTreeTableUrl . '/stylesheets/jquery.treeTable.css');
        $cs->registerScript('treeTable', '
            $(document).ready(function()  {
              $("#' . $this->getId() . ' .items").treeTable();
            });
            ');
        if ($this->dragdrop) {
            $cs->registerScript('draganddrop', '
	            $(document).ready(function()  {
	               $("#' . $this->getId() . ' .items tr.initialized").not(".nodrag").draggable({
	                  helper: "clone",
	                  opacity: .75,
	                  refreshPositions: true, // Performance?
	                  revert: "invalid",
	                  revertDuration: 300,
	                  scroll: true
	                });
	
	                $("#' . $this->getId() . ' .items tr.initialized, #' . $this->getId() . ' .items tr.before, #' . $this->getId() . ' .items tr.after").not(".nodrop").droppable({
	                    accept: ".initialized",
	                    drop: ' . ($this->dropFunction !== null ? $this->dropFunction : '
	        					function(e, ui) {
	                    		  if (window.location.href.lastIndexOf("/") == window.location.href.length-1)
	                    		    var href = window.location.href.substr(0, window.location.href.length-1);
	                    		  else
	                    			var href = window.location.href;

			                      if($(this).hasClass("initialized")) {
			                        window.location.href = href+"/moveNode/child/to/"+$(this).attr("id")+"/id/"+$(ui.draggable).attr("id");
			                      }
			                      if($(this).hasClass("before")) {
			                        window.location.href = href+"/moveNode/before/to/"+$(this).attr("id").replace("before-", "")+"/id/"+$(ui.draggable).attr("id");
			                      }
			                      if($(this).hasClass("after")) {
			                        window.location.href = href+"/moveNode/after/to/"+$(this).attr("id").replace("after-", "")+"/id/"+$(ui.draggable).attr("id");
			                      }
	        					}
	                    	') . ',
	                    hoverClass: "accept",
	                    over: function(e, ui) {
	                      // Make the droppable branch expand when a draggable node is moved over it.
	                      if(this.id != $(ui.draggable.parents("tr")[0]).id && !$(this).is(".expanded")) {
	                        $(this).treeTable_expand();
	                      }
	                    },
	                    activate: function(e, ui) {
	                      $(".after").css("display", "table-row");
	                      $(".before").css("display", "table-row");
	                    },
	                    deactivate: function(e, ui) {
	                      $(".after").css("display", "none");
	                      $(".before").css("display", "none");
	                    },
	                  });
	            });
	        ');
        }
    }
コード例 #15
0
ファイル: GridView.php プロジェクト: Baiqiang/fewestmov.es
 public function registerClientScript()
 {
     if ($this->front === false) {
         parent::registerClientScript();
     }
 }