コード例 #1
0
<?php 
$form = $this->beginWidget('CActiveForm', array('id' => 'address-form', 'enableAjaxValidation' => false, 'htmlOptions' => array('enctype' => 'multipart/form-data')));
$this->widget('ToolbarButton', array('DialogID' => 'createdialog1', 'DialogGrid' => 'addressdatagrid', 'isSave' => true, 'UrlSave' => 'customer/writeaddress', 'isCancel' => true, 'UrlCancel' => 'customer/cancelwriteaddress'));
echo $form->hiddenField($model, 'addressid');
echo $form->hiddenField($model, 'addressbookid');
?>
    <div class="row">
		<?php 
echo $form->labelEx($model, 'addresstypeid');
echo $form->hiddenField($model, 'addresstypeid');
?>
          <input type="text" name="addresstype_name" id="addresstype_name" readonly >
          <?php 
$this->beginWidget('zii.widgets.jui.CJuiDialog', array('id' => 'addresstype_dialog', 'options' => array('title' => Yii::t('app', 'Address Type'), 'width' => 'auto', 'autoOpen' => false, 'modal' => true)));
$addresstype = new Addresstype('searchwstatus');
$addresstype->unsetAttributes();
// clear any default values
if (isset($_GET['Addresstype'])) {
    $addresstype->attributes = $_GET['Addresstype'];
}
$this->widget('zii.widgets.grid.CGridView', array('id' => 'addresstype-grid', 'dataProvider' => $addresstype->Searchwstatus(), 'filter' => $addresstype, 'template' => '{summary}{pager}<br>{items}{pager}{summary}', 'columns' => array(array('header' => '', 'type' => 'raw', 'value' => 'CHtml::Button("+",
                array("name" => "send_addresstype",
                "id" => "send_addresstype",
                "onClick" => "$(\\"#addresstype_dialog\\").dialog(\\"close\\"); $(\\"#addresstype_name\\").val(\\"$data->addresstypename\\"); $(\\"#Customeraddress_addresstypeid\\").val(\\"$data->addresstypeid\\");"))'), array('name' => 'addresstypeid', 'visible' => false, 'value' => '$data->addresstypeid', 'htmlOptions' => array('width' => '1%')), 'addresstypename')));
$this->endWidget('zii.widgets.jui.CJuiDialog');
echo CHtml::Button('...', array('onclick' => '$.fn.yiiGridView.update("addresstype-grid");$("#addresstype_dialog").dialog("open"); return false;'));
?>
		<?php 
echo $form->error($model, 'addresstypeid');
?>
コード例 #2
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 = Addresstype::model()->findByPk((int) $id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }