Esempio n. 1
0
echo $form->textField($model, 'last_name');
?>
</td>
		<td><?php 
echo $form->error($model, 'last_name');
?>
</td>
	</div></tr>
        
        <tr><div class="row">
                    <td><?php 
echo $form->labelEx($model, 'gender');
?>
</td>
                    <td><?php 
echo $form->dropdownList($model, 'gender', CHtml::listData(Gender::model()->findAll(), 'id', 'gender'), array('prompt' => 'Select Gender'));
?>
</td>
                    <td><?php 
echo $form->error($model, 'gender');
?>
</td>
       </div></tr>
        
        <tr><div class="row">
		<td><?php 
echo $form->labelEx($model, 'dob');
?>
</td>
		<td> <?php 
$this->widget('zii.widgets.jui.CJuiDatePicker', array('model' => $model, 'attribute' => 'dob', 'options' => array('showAnim' => 'fold', 'dateFormat' => 'yy-mm-dd', 'minDate' => ''), 'htmlOptions' => array()));
echo $form->textArea($element, 'address', array(), false, array('rows' => 4), array('label' => 4, 'field' => 8));
?>
        <?php 
echo $form->textField($element, 'postcode', array(), array(), array('label' => 4, 'field' => 8));
?>
        <?php 
echo $form->textField($element, 'email', array(), array(), array('label' => 4, 'field' => 8));
?>
        <?php 
echo $form->textField($element, 'telephone', array(), array(), array('label' => 4, 'field' => 8));
?>
        <?php 
echo $form->datePicker($element, 'date_of_birth', array(), array(), array('label' => 4, 'field' => 8));
?>
        <?php 
echo $form->dropDownList($element, 'gender_id', CHtml::listData(Gender::model()->findAll(), 'id', 'name'), array('empty' => '- Please Select -'), false, array('label' => 4, 'field' => 8));
?>
        <?php 
echo $form->dropDownList($element, 'ethnic_group_id', CHtml::listData(EthnicGroup::model()->findAll(), 'id', 'name'), array('empty' => '- Please Select -'), false, array('label' => 4, 'field' => 8));
?>
    </div>
    <div class="large-6 column">
        <?php 
echo $form->textField($element, 'nhs_number', array(), array(), array('label' => 4, 'field' => 8));
?>
        <?php 
echo $form->textField($element, 'gp_name', array(), array(), array('label' => 4, 'field' => 8));
?>
        <?php 
echo $form->textArea($element, 'gp_address', array(), false, array('rows' => 4), array('label' => 4, 'field' => 8));
?>
 /**
  * @param \Patient $patient
  */
 protected function mapGenderFromPatient(\Patient $patient)
 {
     $gender_string = $patient->getGenderString();
     $gender = \Gender::model()->findByAttributes(array('name' => $gender_string));
     if ($gender) {
         $this->gender_id = $gender->id;
     }
 }
 public function actionViewProfile($userId)
 {
     $this->layout = "layout_profile";
     $user = UserProfile::model()->find('user_id=:userId', array(':userId' => $userId));
     $country = Country::model()->find('id=:cId', array(':cId' => $user->country_id));
     $gender = Gender::model()->find('id=:gId', array(':gId' => $user->gender));
     $userFriend = UserFriend::model()->find('user_id=:userId AND friend_id=:friendId AND status=:status', array(':userId' => Yii::app()->user->userId, ':friendId' => $user->user_id, ':status' => 0));
     $userFriend2 = UserFriend::model()->find('user_id=:userId AND friend_id=:friendId AND status=:status', array(':userId' => $user->user_id, ':friendId' => Yii::app()->user->userId, ':status' => 0));
     $isFriend = UserFriend::model()->find('user_id=:userId AND friend_id=:friendId AND status=:status', array(':userId' => Yii::app()->user->userId, ':friendId' => $user->user_id, ':status' => 1));
     $isFriend2 = UserFriend::model()->find('user_id=:userId AND friend_id=:friendId AND status=:status', array(':userId' => $user->user_id, ':friendId' => Yii::app()->user->userId, ':status' => 1));
     //$posts = Post::model()->findAll(array('select' => '*','condition' => 'user_id=:userId','params' => array(':userId' => $userId),'order'=>'date DESC'));
     //$posts = PostTagging::model()->with('post')->findAll(array('select' => '*','distinct'=>true,'condition' => 't.user_id=:userId OR t.sender_id=:userId','params' => array(':userId' => $userId),'order'=>'post.date DESC'));
     $posts = PostTagging::model()->findAllBySql("SELECT DISTINCT( post_id ) AS post_id FROM post_tagging,posts WHERE post_tagging.user_id={$userId} OR post_tagging.sender_id={$userId} ORDER By post_tagging.id DESC");
     if (!empty($posts)) {
         foreach ($posts as $p) {
             $post[] = Post::model()->find(array('select' => '*', 'condition' => 'id=:postId', 'params' => array(':postId' => $p->post_id), 'order' => 'date DESC'));
         }
     } else {
         $post = Null;
     }
     $CheckuserFriend = UserFriend::model()->find('(user_id=:userId AND friend_id=:friendId) OR (user_id=:friendId AND friend_id=:userId) AND status=1', array(':userId' => Yii::app()->user->userId, ':friendId' => $userId));
     $this->render('viewprofile', array('posts' => $post, 'model' => $user, 'country' => $country, 'gender' => $gender, 'userFriend' => $userFriend, 'userFriend2' => $userFriend2, 'isFriend' => $isFriend, 'isFriend2' => $isFriend2, 'checkFriend' => $CheckuserFriend));
 }
Esempio n. 5
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 $id the ID of the model to be loaded
  * @return Gender the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = Gender::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }