예제 #1
0
 /**
  * Finds the Families model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param string $id
  * @return Families the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Families::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
예제 #2
0
    $spouseName = Relatives::findOne($spouse);
    echo Html::beginTag('table', ['class' => 'table table-striped table-bordered detail-view']);
    echo Html::beginTag('tr', ['class' => 'info']);
    $father = $families[$i]->husband_id;
    $mother = $families[$i]->wife_id;
    $url = '/relatives/create?father_id=' . $father . '&mother_id=' . $mother;
    $options = NULL;
    $text = Html::tag('a', '<small>Добавить ребёнка</small>', ['class' => 'btn btn-success pull-right', 'href' => $url, 'target' => '_blank']);
    $a = Html::a('<h4>Семья</h4>', '/family/default/view?id=' . $families[$i]->id, ['target' => '_blank']);
    echo Html::tag('th', $a . $text, ['colspan' => COL_SPAN]);
    echo Html::endTag('tr');
    echo Html::beginTag('tr');
    echo Html::tag('th', 'Супруг(а)', ['colspan' => COL_SPAN]);
    echo Html::endTag('tr');
    Relatives::renderRow($spouse);
    $fam = Families::findOne($families[$i]->id);
    $children = $fam->getChildren();
    if ($children) {
        echo Html::beginTag('tr');
        echo Html::tag('th', 'Дети', ['colspan' => COL_SPAN]);
        echo Html::endTag('tr');
        foreach ($children as $child) {
            Relatives::renderRow($child->id);
        }
    }
    echo Html::endTag('table');
}
if ($model->gender) {
    $field = 'mother_id';
    $nullField = 'father_id';
} else {