Example #1
0
 /**
  * Save \KinsAndNominees conditionally.
  * @param \KinsAndNominees $model models.
  */
 public function modelSave($model)
 {
     if ($model->isNewRecord && ($model->active != self::ACTIVE || $model->kinOrNominee == self::NOMINEE && empty($model->percent))) {
     } else {
         $model->save();
     }
 }
 /**
  * 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 KinsAndNominees the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = KinsAndNominees::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
Example #3
0
 /**
  * 
  * @param string $id relationship id
  * @return string relation
  */
 public function relationshipOrKinOrNominee($id)
 {
     $rltn = $id == 1 || 6 ? 'Parents' : ($id = 2 || 7 ? 'Parents-in-Law' : ($id = 3 || 8 ? 'Siblings' : ($id = 4 || 9 ? 'Spouse' : ($id = 5 || 10 ? ' Children' : null))));
     if (empty($rltn)) {
         $rltn = KinsAndNominees::model()->kinOrNominee($id);
     }
     return $rltn;
 }
Example #4
0
    ?>
                <?php 
    if ($person_model->havechildren == 'y') {
        $this->renderPartial('_view_children', array('child' => $child, 'buttons' => DependentMembers::model(), 'model' => $person_model, 'can_update' => $can_update));
    }
    ?>

                <?php 
    if (!empty($child) || !empty($spouse) || !empty($prnts) || !empty($siblings)) {
        ?>
                    <?php 
        $this->renderPartial('_view_nextOfKin', array('nextOfKins' => $nextOfKins, 'buttons' => KinsAndNominees::model(), 'model' => $person_model, 'can_update' => $can_update));
        ?>
                   
                    <?php 
        $this->renderPartial('_view_nominees', array('nominees' => $nominees, 'buttons' => KinsAndNominees::model(), 'model' => $person_model, 'can_update' => $can_update));
        ?>
                <?php 
    }
    ?>
                <?php 
    $this->renderPartial('_view_parents', array('prnts' => $prnts, 'buttons' => DependentMembers::model(), 'model' => $person_model, 'can_update' => $can_update));
    ?>
                <?php 
    if ($person_model->married == 'y') {
        $this->renderPartial('_view_parents', array('inlaws' => $inlaws, 'buttons' => DependentMembers::model(), 'model' => $person_model, 'can_update' => $can_update));
    }
    ?>
                <?php 
    $this->renderPartial('_view_siblings', array('siblings' => $siblings, 'buttons' => DependentMembers::model(), 'model' => $person_model, 'can_update' => $can_update));
    ?>
Example #5
0
            echo $dob;
        }
        ?>
</font>
                </td>
            </tr>

        <?php 
    }
    ?>
    <?php 
}
?>

    <?php 
$nominees = KinsAndNominees::model()->kinsOrNominees(KinsAndNominees::model()->nomineesOfAMember($person->primaryKey));
?>
    <?php 
if (!empty($nominees)) {
    ?>

        <tr><td style="display:table-cell; text-align:center; width:500px; height: 10px">&nbsp;</td></tr>

        <tr>
            <td style="display:table-cell; text-align:justify; width:500px; height: 12px">
                <font style="font-family: sans-serif; font-weight: bold" size="12">NOMINEES' DETAILS</font>
            </td>
        </tr>

        <tr>
            <td style="display:table-cell; text-align:center; width:180px; height: 12px; border: 1px solid #000000">
Example #6
0
 /**
  * Displays a particular model.
  * @param integer $id the ID of the model to be displayed
  */
 public function actionView($id = NULL, $action = NULL)
 {
     if (NULL === $id) {
         $id = Yii::app()->user->id;
     }
     $user_model = Users::model()->loadModel($id);
     if ($user_model->status != Users::STATUS_ACTIVE) {
         $this->redirect('../../auth/default/logout');
     }
     $person_model = Person::model()->loadModel($id);
     $this->resource = Users::USER_RESOURCE_PREFIX . $user_model->user_level;
     if (!Users::isMyAccount($id)) {
         $this->hasPrivilege();
     }
     $this->pageTitle = $person_model->name;
     $this->showPageTitle = TRUE;
     $address_model = PersonAddress::model()->find('`person_id`=:t1', array(':t1' => $id));
     if (NULL === $address_model) {
         $address_model = new PersonAddress();
         $address_model->person_id = $id;
     }
     if (Yii::app()->request->isPostRequest) {
         if (!empty($action)) {
             if (!Users::isMyAccount($id)) {
                 $this->checkPrivilege($user_model, Acl::ACTION_UPDATE);
             }
             switch ($action) {
                 case Users::ACTION_UPDATE_PERSONAL:
                     if ($this->update($person_model)) {
                         $this->redirect(array('view', 'id' => $id, 'action' => Users::ACTION_UPDATE_ADDRESS));
                     }
                     break;
                 case Users::ACTION_UPDATE_ACCOUNT:
                     $this->update($user_model);
                     break;
                 case Users::ACTION_UPDATE_ADDRESS:
                     if ($this->update($address_model)) {
                         $this->redirect($this->createUrl('/members/dependentMembers/create', array('id' => $id, 'rltn1' => $m = $person_model->married == 'y' ? 4 : ($person_model->havechildren == 'y' ? 5 : 1), 'rltn2' => $m + 5, 'action' => Users::ACTION_ADD_DEPENDENTS)));
                     }
                     break;
                 case Users::ACTION_RESET_PASSWORD:
                     $this->resetPassword($user_model);
                     break;
                 case Users::ACTION_CHANGE_PASSWORD:
                     $this->changePassword($user_model);
                     break;
                 case Users::ACTION_CHANGE_PASSWORD:
                     $this->changePassword($user_model);
                     break;
                 case Users::ACTION_ADD_DEPENDENTS:
                     $this->changePassword($user_model);
                     break;
                 default:
                     $action = NULL;
             }
         }
     }
     $this->render('view', array('user_model' => $user_model, 'person_model' => $person_model, 'address_model' => $address_model, 'child' => DependentMembers::model()->dependents($id, 5) || DependentMembers::model()->dependents($id, 10), 'spouse' => DependentMembers::model()->dependents($id, 4) || DependentMembers::model()->dependents($id, 9), 'prnts' => DependentMembers::model()->dependents($id, 1) || DependentMembers::model()->dependents($id, 6), 'inlaws' => DependentMembers::model()->dependents($id, 2) || DependentMembers::model()->dependents($id, 7), 'siblings' => DependentMembers::model()->dependents($id, 3) || DependentMembers::model()->dependents($id, 8), 'nextOfKins' => KinsAndNominees::model()->nextOfKinsOfAMember($id), 'nominees' => KinsAndNominees::model()->nomineesOfAMember($id), 'action' => $action));
 }