コード例 #1
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 = Sex::model()->findByPk((int) $id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
コード例 #2
0
    <tr>
      <td>
        <div class="row">
            <?php 
echo $form->labelEx($model, 'sexid');
?>
        <?php 
echo $form->hiddenField($model, 'sexid');
?>
                  <input type="text" name="sex_name" id="sex_name" readonly value="<?php 
echo Sex::model()->findByPk($model->sexid) !== null ? Sex::model()->findByPk($model->sexid)->sexname : '';
?>
">
                  <?php 
$this->beginWidget('zii.widgets.jui.CJuiDialog', array('id' => 'famsex_dialog', 'options' => array('title' => Yii::t('app', 'Sex'), 'width' => 'auto', 'autoOpen' => false, 'modal' => true)));
$sex = new Sex('searchwstatus');
$sex->unsetAttributes();
// clear any default values
if (isset($_GET['Sex'])) {
    $sex->attributes = $_GET['Sex'];
}
$this->widget('zii.widgets.grid.CGridView', array('id' => 'famsex-grid', 'dataProvider' => $sex->Searchwstatus(), 'filter' => $sex, 'template' => '{summary}{pager}<br>{items}{pager}{summary}', 'columns' => array(array('header' => '', 'type' => 'raw', 'value' => 'CHtml::Button("V",
                        array("name" => "send_sex",
                        "id" => "send_sex",
                        "onClick" => "$(\\"#famsex_dialog\\").dialog(\\"close\\"); $(\\"#sex_name\\").val(\\"$data->sexname\\"); $(\\"#Employeefamily_sexid\\").val(\\"$data->sexid\\");"))'), array('name' => 'sexid', 'visible' => false, 'value' => '$data->sexid', 'htmlOptions' => array('width' => '1%')), 'sexname')));
$this->endWidget('zii.widgets.jui.CJuiDialog');
echo CHtml::Button('...', array('onclick' => '$("#famsex_dialog").dialog("open"); return false;'));
?>
		<?php 
echo $form->error($model, 'sexid');
?>