Exemple #1
0
<?php

$isform = isset($isform) ? $isform : false;
$url = Yii::app()->createUrl('employee/addresses/create' . '&id=' . $model->id);
?>

<?php 
$this->widget('DTGridView', array('id' => 'masters-employee-familys-grid', 'itemsCssClass' => 'table datatable', 'dataProvider' => MastersEmployeeAddresses::model()->searchByEmployee($model->id), 'columns' => array(array('name' => 'id', 'header' => '#', 'htmlOptions' => array('style' => 'width:50px;')), array('name' => 'label', 'header' => at('Label')), array('name' => 'street1', 'header' => at('Street1')), array('name' => 'street2', 'header' => at('Street2')), array('name' => 'geography', 'header' => at('Geography'), 'value' => '$data->getGeography()'), array('name' => 'poscode', 'header' => at('Poscode'), 'htmlOptions' => array('style' => 'width:100px;')), array('name' => 'phone', 'header' => at('Phone')))));
Exemple #2
0
<?php 
if ($isform) {
    ?>
<div class="row">
	<a href="#address_id#create#0" class="btn btn-primary"><?php 
    echo at('Add Address');
    ?>
</a>	
</div>
<?php 
}
?>

<?php 
$this->widget('DTGridView', array('id' => 'masters-employee-addresses-grid', 'itemsCssClass' => 'table datatable', 'dataProvider' => MastersEmployeeAddresses::model()->searchByEmployee($model->id), 'columns' => array(array('name' => 'id', 'header' => '#', 'htmlOptions' => array('style' => 'width:50px;')), array('name' => 'label', 'header' => at('Label')), array('name' => 'street1', 'header' => at('Street1')), array('name' => 'street2', 'header' => at('Street2')), array('name' => 'geography', 'header' => at('Geography'), 'value' => '$data->getGeography()'), array('name' => 'poscode', 'header' => at('Poscode')), array('name' => 'phone', 'header' => at('Phone')), array('class' => 'CButtonColumn', 'htmlOptions' => array('style' => 'width: 80px'), 'buttons' => array('view' => array('url' => '"#address_id#view#".$data->id'), 'update' => array('url' => '"#address_id#update#".$data->id'), 'delete' => array('url' => 'createUrl("employee/addresses/delete", array("id"=>$data->id))'))))));
?>

<input value="<?php 
echo $model->id;
?>
" id="inputHiddenEmployee_id" hidden>

<!-- Modal -->
<div class="modal fade" id="addressModal" tabindex="-1" role="dialog" aria-labelledby="addressModalLabel" aria-hidden="true">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title" id="addressModalLabel">Address</h4>
      </div>
 /**
  * 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 $id the ID of the model to be loaded
  * @return MastersEmployeeAddresses the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $c = new CDbCriteria();
     $c->compare('id', $id);
     $c->compare('employee_id', getUser()->id);
     $model = MastersEmployeeAddresses::model()->find($c);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }