示例#1
0
文件: ajax.php 项目: hkhateb/linet3
<?php

/***********************************************************************************
 * The contents of this file are subject to the Mozilla Public License Version 2.0
 * ("License"); You may not use this file except in compliance with the Mozilla Public License Version 2.0
 * The Original Code is:  Linet 3.0 Open Source
 * The Initial Developer of the Original Code is Adam Ben Hur.
 * All portions are Copyright (C) Adam Ben Hur.
 * All Rights Reserved.
 ************************************************************************************/
Yii::app()->clientScript->registerScript('search', "\n\$('.search-button').click(function(){\n\t\$('.search-form').toggle();\n\treturn false;\n});\n\$('.search-form form').submit(function(){\n\t\$.fn.yiiGridView.update('accounts-grid', {\n\t\tdata: \$(this).serialize()\n\t});\n\treturn false;\n});\n");
$this->widget('EExcelView', array('id' => 'accounts' . $model->type . '-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'template' => '{items}{pager}', 'ajaxUpdate' => true, 'ajaxType' => 'POST', 'columns' => array('id', array('name' => 'name', 'type' => 'raw', 'value' => 'CHtml::link(CHtml::encode($data->name), Yii::app()->createUrl("accounts/update", array("id"=>$data->id)))'), 'id6111', array('name' => 'cat_id', 'type' => 'raw', 'value' => 'CHtml::encode(isset($data->Category)?$data->Category->name: "")', 'filter' => CHtml::listData(AccCat::model()->findAllByAttributes(array("type_id" => $model->type)), 'id', 'name')), 'src_tax', array('class' => 'CButtonColumn', 'template' => '{create}{display}{edit}{delete}', 'buttons' => array('create' => array('label' => '<i class="glyphicon glyphicon-file"></i>', 'url' => 'Yii::app()->createUrl("docs/create", array("id"=>$data->id))'), 'edit' => array('label' => '<i class="glyphicon glyphicon-pencil"></i>', 'url' => 'Yii::app()->createUrl("accounts/update", array("id"=>$data->id))'), 'delete' => array('label' => '<i class="glyphicon glyphicon-trash"></i>', 'imageUrl' => false, 'url' => 'Yii::app()->createUrl("accounts/delete", array("id"=>$data->id))'), 'display' => array('label' => '<i class="glyphicon glyphicon-transfer"></i>', 'url' => 'Yii::app()->createUrl("accounts/transaction/".$data->id)'))))));
?>


<script type="text/javascript">




jQuery('#accounts<?php 
echo $model->type;
?>
-grid').yiiGridView({
    'ajaxUpdate':['1','accounts<?php 
echo $model->type;
?>
-grid'],
    'ajaxVar':'ajax',
    'pagerClass':'pagination',
    'loadingClass':'grid-view-loading',
示例#2
0
文件: _form.php 项目: hkhateb/linet3
    <?php 
echo $form->errorSummary($model);
?>
    <?php 
echo $form->hiddenField($model, 'type');
?>
    <div class="col-md-4 col-sm-6">
        <?php 
$this->beginWidget('TbPanel', array('header' => Yii::t('app', "Account General Details")));
?>
            <?php 
echo $form->textFieldRow($model, 'name', array('maxlength' => 200));
?>
            <?php 
echo $form->dropDownListRow($model, 'cat_id', CHtml::listData(AccCat::model()->findAllByAttributes(array("type_id" => $model->type)), 'id', 'name'));
?>
            <?php 
echo $form->textFieldRow($model, 'src_tax', array('maxlength' => 40));
?>
            <?php 
echo $form->dropDownListRow($model, 'currency_id', CHtml::listData(Currates::model()->GetRateList(), 'currency_id', 'name'));
//currency
?>
            
            <?php 
echo $form->textFieldRow($model, 'vatnum', array('maxlength' => 20));
?>
            <?php 
echo $form->textFieldRow($model, 'pay_terms', array('maxlength' => 40));
?>
示例#3
0
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer the ID of the model to be loaded
  */
 public function loadModel($id)
 {
     $model = AccCat::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }