protected function initDefaultButtons()
 {
     parent::initDefaultButtons();
     if ($this->customButtonLabel === null) {
         $this->customButtonLabel = Yii::t('zii', 'Custom');
     }
     // if($this->proyectosButtonLabel===null)
     // 	$this->proyectosButtonLabel=Yii::t('zii','proyectos');
     if ($this->viewButtonIcon !== false && !isset($this->buttons['view']['icon'])) {
         $this->buttons['view']['icon'] = $this->viewButtonIcon;
     }
     if ($this->updateButtonIcon !== false && !isset($this->buttons['update']['icon'])) {
         $this->buttons['update']['icon'] = $this->updateButtonIcon;
     }
     if ($this->deleteButtonIcon !== false && !isset($this->buttons['delete']['icon'])) {
         $this->buttons['delete']['icon'] = $this->deleteButtonIcon;
     }
     if ($this->customButtonIcon !== false && !isset($this->buttons['custom']['icon'])) {
         $this->buttons['custom']['icon'] = $this->customButtonIcon;
     }
     if ($this->materialsButtonIcon !== false && !isset($this->buttons['materials']['icon'])) {
         $this->buttons['materials']['icon'] = $this->materialsButtonIcon;
     }
     if ($this->publicacionesButtonIcon !== false && !isset($this->buttons['folder']['icon'])) {
         $this->buttons['publicaciones']['icon'] = $this->publicacionesButtonIcon;
     }
 }
 protected function initDefaultButtons()
 {
     if ($this->modelClassName != "") {
         $modelClass = $this->modelClassName;
     } else {
         $modelClass = $this->grid->dataProvider->modelClass;
     }
     $controller = $modelClass;
     // do not lowercase the names, it breaks
     if (is_array($modelClass::model()->primaryKey)) {
         if ($this->returnTo != "") {
             $paramExpression = '",array_merge($data->primaryKey, array("returnTo" => "' . urlencode($this->returnTo) . '"))';
         } else {
             $paramExpression = '",$data->primaryKey';
         }
     } else {
         if ($this->returnTo != "") {
             $paramExpression = '",array("id"=>$data->primaryKey, "returnTo" => "' . urlencode($this->returnTo) . '")';
         } else {
             $paramExpression = '",array("id"=>$data->primaryKey)';
         }
     }
     /*
             if(isset($this->returnTo)){
                 $paramExpression .= ",'returnTo' => ". "'$this->returnTo'";
             }
     */
     $paramExpression .= ")";
     foreach (array('view', 'update', 'delete') as $id) {
         $this->{$id . 'ButtonUrl'} = 'Yii::app()->urlManager->createUrl("' . "{$controller}/{$id}{$paramExpression}";
     }
     parent::initDefaultButtons();
 }
 /**
  *### .initDefaultButtons()
  *
  * Initializes the default buttons (view, update and delete).
  */
 protected function initDefaultButtons()
 {
     parent::initDefaultButtons();
     if ($this->viewButtonIcon !== false && !isset($this->buttons['view']['icon'])) {
         $this->buttons['view']['icon'] = $this->viewButtonIcon;
     }
     if ($this->viewInButtonIcon !== false && !isset($this->buttons['viewin']['icon'])) {
         $this->buttons['viewin']['icon'] = $this->viewInButtonIcon;
     }
     if ($this->updateButtonIcon !== false && !isset($this->buttons['update']['icon'])) {
         $this->buttons['update']['icon'] = $this->updateButtonIcon;
     }
     if ($this->deleteButtonIcon !== false && !isset($this->buttons['delete']['icon'])) {
         $this->buttons['delete']['icon'] = $this->deleteButtonIcon;
     }
     $this->buttons['view']['options']['class'] = $this->viewButtonClass;
     $this->buttons['viewin']['options']['class'] = $this->viewInButtonClass;
     $this->buttons['update']['options']['class'] = $this->updateButtonClass;
     $this->buttons['delete']['options']['class'] = $this->deleteButtonClass;
     /*if (!empty($this->buttons['view']['icon']))
     			$this->buttons['view']['icon'] .= ' white';
     		if (!empty($this->buttons['update']['icon']))
     			$this->buttons['update']['icon'] .= ' white';
     		if (!empty($this->buttons['delete']['icon']))
     			$this->buttons['delete']['icon'] .= ' white';
     		*/
 }
 /**
  * @inheritdoc
  */
 protected function initDefaultButtons()
 {
     parent::initDefaultButtons();
     foreach (['view', 'update', 'delete'] as $id) {
         if (!empty($this->{$id . 'ButtonIcon'}) && !isset($this->buttons[$id]['icon'])) {
             $this->buttons[$id]['icon'] = $this->{$id . 'ButtonIcon'};
         }
     }
 }
Exemple #5
0
    /**
     * ### .initDefaultButtons()
     *
     * Initializes the default buttons (view, update and delete).
     */
    protected function initDefaultButtons()
    {
        if ($this->deleteConfirmation === null) {
            $this->deleteConfirmation = Yii::t('zii', 'Are you sure you want to delete this item?');
        }
        if (!isset($this->buttons['delete']['click'])) {
            if (is_string($this->deleteConfirmation)) {
                $confirmation = CJavaScript::encode($this->deleteConfirmation);
            } else {
                $confirmation = '';
            }
            if (Yii::app()->request->enableCsrfValidation) {
                $csrfTokenName = Yii::app()->request->csrfTokenName;
                $csrfToken = Yii::app()->request->csrfToken;
                $csrf = "\n\t\tdata:{ '{$csrfTokenName}':'{$csrfToken}' },";
            } else {
                $csrf = '';
            }
            if ($this->afterDelete === null) {
                $this->afterDelete = 'function(){}';
            }
            $this->buttons['delete']['click'] = <<<EOD
function(e) {
        var th = this,
                 afterDelete = {$this->afterDelete};
        e.preventDefault();
        window.confirm({$confirmation}, function(ret){
            if(ret == false) return;  
            jQuery('#{$this->grid->id}').yiiGridView('update', {
                    type: 'POST',
                    url: jQuery(th).attr('href'),{$csrf}
                    success: function(data) {
                            jQuery('#{$this->grid->id}').yiiGridView('update');
                            afterDelete(th, true, data);
                    },
                    error: function(XHR) {
                            return afterDelete(th, false, XHR);
                    }
            });
        });
}
EOD;
        }
        parent::initDefaultButtons();
        if ($this->viewButtonIcon !== false && !isset($this->buttons['view']['icon'])) {
            $this->buttons['view']['icon'] = $this->viewButtonIcon;
        }
        if ($this->updateButtonIcon !== false && !isset($this->buttons['update']['icon'])) {
            $this->buttons['update']['icon'] = $this->updateButtonIcon;
        }
        if ($this->deleteButtonIcon !== false && !isset($this->buttons['delete']['icon'])) {
            $this->buttons['delete']['icon'] = $this->deleteButtonIcon;
        }
    }
 /**
  * Initializes the default buttons (view, update and delete).
  */
 protected function initDefaultButtons()
 {
     parent::initDefaultButtons();
     if ($this->viewButtonIcon !== false && !isset($this->buttons['view']['icon'])) {
         $this->buttons['view']['icon'] = $this->viewButtonIcon;
     }
     if ($this->updateButtonIcon !== false && !isset($this->buttons['update']['icon'])) {
         $this->buttons['update']['icon'] = $this->updateButtonIcon;
     }
     if ($this->deleteButtonIcon !== false && !isset($this->buttons['delete']['icon'])) {
         $this->buttons['delete']['icon'] = $this->deleteButtonIcon;
     }
 }
 /**
  * Initializes the default buttons (view, update and delete).
  */
 protected function initDefaultButtons()
 {
     parent::initDefaultButtons();
     if ($this->viewButtonIcon !== false && !isset($this->buttons['view']['icon'])) {
         $this->buttons['view']['icon'] = $this->viewButtonIcon;
         $this->buttons['view']['options'] = array('class' => 'btn btn-mini btn-success');
     }
     if ($this->updateButtonIcon !== false && !isset($this->buttons['update']['icon'])) {
         $this->buttons['update']['icon'] = $this->updateButtonIcon;
         $this->buttons['update']['options'] = array('class' => 'btn btn-mini btn-info');
     }
     if ($this->deleteButtonIcon !== false && !isset($this->buttons['delete']['icon'])) {
         $this->buttons['delete']['icon'] = $this->deleteButtonIcon;
         $this->buttons['delete']['options'] = array('class' => 'btn btn-mini btn-danger');
     }
 }
    /**
     * Initializes the default buttons (view, update and delete).
     */
    protected function initDefaultButtons()
    {
        if ($this->deleteConfirmation === null) {
            $this->deleteConfirmation = Yii::t('zii', 'Are you sure you want to delete this item?');
        }
        if (!isset($this->buttons['delete']['click'])) {
            if (is_string($this->deleteConfirmation)) {
                $confirmation = 'if(!confirm(' . CJavaScript::encode($this->deleteConfirmation) . ')) return false;';
            } else {
                $confirmation = '';
            }
            if (Yii::app()->request->enableCsrfValidation) {
                $csrfTokenName = Yii::app()->request->csrfTokenName;
                $csrfToken = Yii::app()->request->csrfToken;
                $csrf = "\n\t\tdata:{ '{$csrfTokenName}':'{$csrfToken}' },";
            } else {
                $csrf = '';
            }
            if ($this->afterDelete === null) {
                $this->afterDelete = 'function(){}';
            }
            $this->buttons['delete']['click'] = <<<JavaScript
function() {
\t{$confirmation}
\tvar th = this,
\t\tafterDelete = {$this->afterDelete};
\t\$.getJSON(\$(this).attr('href'), function(data){
\t\tjQuery('#{$this->grid->id}').eDataTables('refresh');
\t\tafterDelete(th, true, data);
\t});
\treturn false;
}
JavaScript;
        }
        parent::initDefaultButtons();
        // history button
        if ($this->historyButtonLabel === null) {
            $this->historyButtonLabel = Yii::t('EDataTables.edt', 'History');
        }
        if ($this->historyButtonImageUrl === null) {
            $this->historyButtonImageUrl = $this->grid->baseScriptUrl . '/history.png';
        }
        $button = array('label' => $this->historyButtonLabel, 'url' => $this->historyButtonUrl, 'imageUrl' => $this->historyButtonImageUrl, 'options' => $this->historyButtonOptions);
        $this->buttons['history'] = !isset($this->buttons['history']) ? $button : array_merge($button, $this->buttons['history']);
    }
 /**
  *### .initDefaultButtons()
  *
  * Initializes the default buttons (view, update and delete).
  */
 protected function initDefaultButtons()
 {
     parent::initDefaultButtons();
     if ($this->viewButtonIcon !== false && !isset($this->buttons['view']['icon'])) {
         $this->buttons['view']['icon'] = $this->viewButtonIcon;
     }
     if ($this->updateButtonIcon !== false && !isset($this->buttons['update']['icon'])) {
         $this->buttons['update']['icon'] = $this->updateButtonIcon;
     }
     if ($this->deleteButtonIcon !== false && !isset($this->buttons['delete']['icon'])) {
         $this->buttons['delete']['icon'] = $this->deleteButtonIcon;
     }
     if (isset($this->buttons['headerAction'])) {
         // Make this to support multiple "actions" so that this mess doesnt take place?
         $options = $this->buttons['headerAction']['options'];
         $this->filterCellContent = CHtml::link('<i class="icon-' . $this->buttons['headerAction']['icon'] . '"></i>', $this->buttons['headerAction']['url'], $this->buttons['headerAction']['options']);
     }
 }
 /**
  * Initializes the default buttons (view, update and delete).
  */
 protected function initDefaultButtons()
 {
     parent::initDefaultButtons();
     if ($this->viewButtonIcon !== false && !isset($this->buttons['view']['icon'])) {
         $this->buttons['view']['icon'] = $this->viewButtonIcon;
     }
     if ($this->updateButtonIcon !== false && !isset($this->buttons['update']['icon'])) {
         $this->buttons['update']['icon'] = $this->updateButtonIcon;
     }
     if ($this->deleteButtonIcon !== false && !isset($this->buttons['delete']['icon'])) {
         $this->buttons['delete']['icon'] = $this->deleteButtonIcon;
     }
     $temp = $this->buttons['view']['url'];
     $temp = substr_replace($temp, $this->grid->filter->tableSchema->name . '/', 35, 0);
     $this->buttons['view']['url'] = $temp;
     $temp = $this->buttons['update']['url'];
     $temp = substr_replace($temp, $this->grid->filter->tableSchema->name . '/', 35, 0);
     $this->buttons['update']['url'] = $temp;
     $temp = $this->buttons['delete']['url'];
     $temp = substr_replace($temp, $this->grid->filter->tableSchema->name . '/', 35, 0);
     $this->buttons['delete']['url'] = $temp;
 }
Exemple #11
0
 /**
  * Initializes the default buttons (view, update and delete).
  */
 protected function initDefaultButtons()
 {
     $this->viewButtonLabel = "<span class='fa fa-search' title='" . CHtml::encode(Yii::t('app', 'View record')) . "'>\n             </span>";
     $this->updateButtonLabel = "<span class='fa fa-edit' title='" . CHtml::encode(Yii::t('app', 'Edit record')) . "'>\n             </span>";
     $this->deleteButtonLabel = "<span class='fa fa-times x2-delete-icon' \n              title='" . CHtml::encode(Yii::t('app', 'Delete record')) . "'></span>";
     parent::initDefaultButtons();
 }