/**
  * 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 AccountInvitation the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = AccountInvitation::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
 /**
  * Manages all models.
  */
 public function actionAdmin()
 {
     //$model = new AccountTeamMember('search');
     //$model->unsetAttributes();  // clear any default values
     // get team members I'm in charge
     //$model->master_account_id = Yii::app()->user->id;
     $subcription = LBApplication::getCurrentlySelectedSubscription();
     // CADP for getting list my team members of team that user is the master account of.
     $memberCADataProvider = AccountTeamMember::model()->getTeamMembers($subcription);
     // CADP for getting list of members from OTHER teams of which user is NOT the master account of.
     $otherMemberCADataProvider = AccountTeamMember::model()->getMyOtherTeams(Yii::app()->user->id, $subcription);
     // CADP for invites to this user
     $invitesToUserCADataProvider = AccountInvitation::model()->getInvitesToAccount(Yii::app()->user->id);
     // get master account of people whose teams I'm part of
     $model2 = new AccountTeamMember('search');
     $model2->unsetAttributes();
     $model2->member_account_id = Yii::app()->user->id;
     if (isset($_GET['AccountTeamMember'])) {
         $model->attributes = $_GET['AccountTeamMember'];
     }
     $this->render('admin', array('memberCADataProvider' => $memberCADataProvider, 'otherMemberCADataProvider' => $otherMemberCADataProvider, 'invitesToUserCADataProvider' => $invitesToUserCADataProvider));
 }