/**
  * 
  * @return \KinsAndNominees Models to be created or updated.
  */
 public static function kinsOrNominees()
 {
     for ($rltnshp = 1; $rltnshp <= 5; $rltnshp++) {
         $dependents[$rltnshp] = DependentMembers::model()->returnDependentsOfMember($_REQUEST['id'], $rltnshp, $rltnshp + 5);
     }
     foreach (empty($dependents) ? array() : $dependents as $rltnshps) {
         foreach ($rltnshps as $dependent) {
             $kinOrNominee[$dependent->primaryKey] = KinsAndNominees::model()->find('dependent_member=:mbr && kinOrNominee=:kin', array(':mbr' => $dependent->primaryKey, ':kin' => $_REQUEST['kiNom'] == 'kin' ? KinsAndNominees::NEXT_OF_KIN : KinsAndNominees::NOMINEE));
             if (empty($kinOrNominee[$dependent->primaryKey])) {
                 $kinOrNominee[$dependent->primaryKey] = new KinsAndNominees();
                 $kinOrNominee[$dependent->primaryKey]->dependent_member = $dependent->primaryKey;
                 $kinOrNominee[$dependent->primaryKey]->kinOrNominee = $_REQUEST['kiNom'] == 'kin' ? KinsAndNominees::NEXT_OF_KIN : KinsAndNominees::NOMINEE;
                 $kinOrNominee[$dependent->primaryKey]->active = KinsAndNominees::INACTIVE;
             }
             if ($dependent->alive != 1) {
                 if (!$kinOrNominee[$dependent->primaryKey]->isNewRecord && $kinOrNominee[$dependent->primaryKey]->active != KinsAndNominees::INACTIVE) {
                     $kinOrNominee[$dependent->primaryKey]->active = KinsAndNominees::INACTIVE;
                     $kinOrNominee[$dependent->primaryKey]->update(array('active'));
                 }
                 unset($kinOrNominee[$dependent->primaryKey]);
             }
         }
     }
     return empty($kinOrNominee) ? array() : $kinOrNominee;
 }
Beispiel #2
0
                        <tr style="font-weight: bold">
                            <td style="text-align: center">No.</td>
                            <td style="text-align: center">Name</td>
                            <td style="text-align: center">ID. No.</td>
                            <td style="text-align: center">Alive</td>
                            <td style="text-align: center">Relationship</td>
                            <td style="text-align: center">Mobile No.</td>
                            <td style="text-align: justify">Postal Address</td>
                        </tr>


                        <?php 
    $i = 0;
    $gdrs = isset($prnts) ? array(1, 6) : array(2, 7);
    foreach ($gdrs as $gdr) {
        $parents = DependentMembers::model()->returnDependentsOfMember($model->primaryKey, $gdr, $gdr);
        ?>
                            <?php 
        foreach ($parents as $parent) {
            ?>
                                <tr>
                                    <td style="text-align: center"><?php 
            echo ++$i;
            ?>
. </td>
                                    <td style="text-align: justify"><?php 
            echo $parent->name;
            ?>
</td>
                                    <td style="text-align: center"><?php 
            echo $parent->idno;
Beispiel #3
0
 /**
  * 
  * @param int $member Member
  * @return \KinsAndNominees Nominees.
  */
 public function nomineesOfAMember($member)
 {
     $kins = array();
     for ($rltnshp = 1; $rltnshp <= 5; $rltnshp++) {
         $kins[$rltnshp] = $this->dependentMembersAreKinsOrNominees(DependentMembers::model()->returnDependentsOfMember($member, $rltnshp, $rltnshp + 5), self::NOMINEE);
     }
     return $kins;
 }
Beispiel #4
0
 public function uniqueAttribute($attribute)
 {
     if (!empty($this->{$attribute})) {
         $get1 = DependentMembers::model()->find($this->isNewRecord ? "{$attribute}=:attr" : "{$attribute}=:attr && id!=:id", $params = $this->isNewRecord ? array(':attr' => $this->{$attribute}) : array(':attr' => $this->{$attribute}, ':id' => $this->primaryKey));
         $get1 = DependentMembers::model()->find($this->isNewRecord ? "{$attribute}=:attr" : "{$attribute}=:attr && id!=:id", $params = $this->isNewRecord ? array(':attr' => $this->{$attribute}) : array(':attr' => $this->{$attribute}, ':id' => $this->primaryKey));
         if (!empty($get1)) {
             $this->addError($attribute, $this->getAttributeLabel($attribute) . ' already exists');
         }
     }
 }
Beispiel #5
0
                    <?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));
    ?>
           
                 <?php 
    //$this->renderPartial('_view_account', array('model' => $user_model, 'can_update' => $can_update))
    ?>
            </div>
        <?php 
} elseif ($action === Users::ACTION_UPDATE_PERSONAL) {
    ?>
            <?php 
    $this->renderPartial('_update_personal', array('model' => $person_model));
    ?>
        <?php 
} elseif ($action === Users::ACTION_UPDATE_ACCOUNT) {
    ?>
Beispiel #6
0
    }
    ?>
    <?php 
}
?>

    <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">SIBLINGS' DETAILS</font>
        </td>
    </tr>

    <?php 
$siblings = DependentMembers::model()->returnDependentsOfMember($person->primaryKey, 3, 8);
?>

    <?php 
if (empty($siblings)) {
    ?>
        <tr>
            <td style="display:table-cell; text-align:justify; width:100px; height: 12px">
                <font style="font-family: sans-serif; font-weight: bold" size="12">N / A</font>
            </td>
        </tr>
    <?php 
} else {
    ?>

        <tr>
Beispiel #7
0
            <td style="text-align: center">No.</td>
            <td style="text-align: center">Name</td>
            <td style="text-align: center">ID. No.</td>
            <td style="text-align: center">Mobile No.</td>
            <td style="text-align: center">Relationship</td>
            <td style="text-align: center">Percent</td>
            <td style="text-align: justify">Postal Address</td>
        </tr>

        <?php 
$i = 0;
foreach ($nominees as $rltnshps) {
    ?>
            <?php 
    foreach ($rltnshps as $nominee) {
        $dependent = DependentMembers::model()->findByPk($nominee->dependent_member);
        ?>
                <tr>
                    <td style="text-align: center"><?php 
        echo ++$i;
        ?>
. </td>
                    <td style="text-align: justify"><?php 
        echo $dependent->name;
        ?>
</td>
                    <td style="text-align: center"><?php 
        echo $dependent->idno;
        ?>
</td>
                    <td style="text-align: center"><?php 
Beispiel #8
0
                        <td style="text-align: center">No.</td>
                        <td style="text-align: center">Name</td>
                        <td style="text-align: center">ID. No.</td>
                        <td style="text-align: center">Relationship</td>
                        <td style="text-align: center">Mobile No.</td>
                        <td style="text-align: justify">Postal Address</td>
                    </tr>


                    <?php 
$i = 0;
foreach ($nextOfKins as $rltnshps) {
    ?>
                        <?php 
    foreach ($rltnshps as $nextOfKin) {
        $dependent = DependentMembers::model()->findByPk($nextOfKin->dependent_member);
        ?>
                            <tr>
                                <td style="text-align: center"><?php 
        echo ++$i;
        ?>
. </td>
                                <td style="text-align: justify"><?php 
        echo $dependent->name;
        ?>
</td>
                                <td style="text-align: center"><?php 
        echo $dependent->idno;
        ?>
</td>
                                <td style="text-align: center"><?php 
 /**
  * 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 DependentMembers the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = DependentMembers::model()->findByPk($id);
     //        if ($model === null)
     //            throw new CHttpException(404, 'The requested page does not exist.');
     return $model;
 }
Beispiel #10
0
                            <td>Relationship</td>
                            <td>Mobile No.</td>
                            <td>Status</td>

                            <?php 
if ($_REQUEST['kiNom'] == 'nom') {
    ?>
                                <td>Percent</td>
                            <?php 
}
?>
                        </tr>

                        <?php 
foreach ($models as $m => $model) {
    $dependent = DependentMembers::model()->findByPk($model->dependent_member);
    $rltnship = Relationships::model()->returnRelationship($dependent->relationship);
    ?>
                            <tr>
                                <td style="text-align: center"><?php 
    echo ++$i;
    ?>
. </td>
                                <td style="text-align: left"><?php 
    echo $dependent->name;
    ?>
</td>
                                <td><?php 
    echo $dependent->idno;
    ?>
</td>
Beispiel #11
0
?>
                            </td>
                            <td>
                                &nbsp;
                            </td>
                            <td>
                                <?php 
echo DependentMembers::model()->getAttributeLabel('mobileno');
?>
                            </td>
                            <td>
                                &nbsp;
                            </td>
                            <td>
                                <?php 
echo DependentMembers::model()->getAttributeLabel('postaladdress');
?>
                            </td>
                        </tr>

                        <?php 
$c = 0;
foreach ($models as $i => $model) {
    ?>
                            <tr>
                                <td style="text-align: right">
                                    <?php 
    echo ++$c;
    ?>
.&nbsp;
Beispiel #12
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));
 }