public function actionpMenteeViewMeetings()
 {
     /** @var  User $user */
     $username = Yii::app()->user->name;
     $user = User::model()->find("username=:username", array(':username' => $username));
     /*Return all the meetings for the current user */
     /** @var ProjectMeeting $meetings */
     $meetings = ProjectMeeting::model()->findAllBySql("SELECT * FROM project_meeting WHERE mentee_user_id =:id ORDER BY `date` ASC", array(":id" => $user->id));
     /*mentee array */
     $mentees = array();
     /** @var User $mentee */
     foreach ($meetings as $id => $meetin) {
         $mentees[$id] = User::model()->findBySql("SELECT * FROM user WHERE id =:id OR id =:iid", array(":id" => $meetin->mentee_user_id, ":iid" => $meetin->project_mentor_user_id));
     }
     /*Return all the projects for the current Project Mentor */
     $pro = Mentee::model()->find("user_id=:id", array(':id' => $user->id));
     $projects = Project::model()->findAll("id=:project_id", array(':project_id' => $pro->project_id));
     /* Return all the mentees for the project mentor */
     $pmentees = array();
     foreach ($projects as $pm) {
         /** @var ProjectMentorProject $pm */
         $allMentees = Mentee::model()->findAllBySql("SELECT * FROM mentee WHERE project_id=:id", array(":id" => $pm->id));
         foreach ($allMentees as $i => $m) {
             $pmentees[$pm->id][$m->user_id] = $m;
         }
     }
     $pmentee = array();
     foreach ($pmentees as $pment) {
         foreach ($pment as $pm) {
             $pmentee[$pm->user_id] = User::model()->findBySql("SELECT * FROM user WHERE id=:id", array(":id" => $pm->user_id));
         }
     }
     foreach ($projects as $project) {
         /** @var Project $project */
         $project->description .= sprintf("<h4>Mentees</h4><ul>");
         foreach ($pmentees[$project->id] as $projectMenteeId => $menteeObject) {
             $project->description .= sprintf("<li>%s</li>", $pmentee[$projectMenteeId]);
         }
         $project->description .= sprintf("</ul>");
     }
     /** @var User $usermentee */
     /* End Return all the mentees for the project mentor */
     $this->render('pMenteeViewMeetings', array('user' => $user, 'meetings' => $meetings, 'projects' => $projects, 'pmentee' => $pmentee, 'mentees' => $mentees));
 }
 public function actionpMentorHome()
 {
     /** @var  User $user */
     $username = Yii::app()->user->name;
     $user = User::model()->find("username=:username", array(':username' => $username));
     /*Return all the meetings for the current user */
     $meetings = ProjectMeeting::model()->findAllBySql("SELECT * FROM project_meeting WHERE project_mentor_user_id =:id", array(":id" => $user->id));
     $this->render('pMentorHome', array('user' => $user, 'meetings' => $meetings));
 }