public function assignProjectforUser($username, $project_id) { if ($project_id != null) { $id = User::model()->find(array('select' => 'id', 'condition' => 'username=:un', 'params' => array(':un' => $username))); $record = Mentee::model()->findByPk($id->id); $record->project_id = $project_id; $record->save(false); } }
public static function getMentee($id) { $mentee = Mentee::model()->findBySql("SELECT * FROM mentee WHERE user_id=" . $id); return $mentee; }
public function actionpersonalMentorViewMeetings() { /** @var User $user */ $username = Yii::app()->user->name; $user = User::model()->find("username=:username", array(':username' => $username)); $pmentees = array(); // tito $allMentees = Mentee::model()->findAllBySql("SELECT * FROM mentee WHERE personal_mentor_user_id=:id", array(":id" => $user->id)); foreach ($allMentees as $i => $m) { //tito $pmentees[$pm->id][$m->user_id] = $m; $pmentees[4352][$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)); } } /*Get all tickets for his mentees */ $tickets = array(); foreach ($pmentee as $id => $menteeTickets) { $myTickets = Ticket::model()->findAllBySql("SELECT * FROM ticket WHERE creator_user_id=:id and assign_user_id!=:id2", array(':id' => $menteeTickets->id, ':id2' => User::getCurrentUserId())); if (is_array($myTickets)) { $tickets = array_merge($tickets, $myTickets); } } function cmp($a, $b) { return $b["id"] - $a["id"]; } usort($tickets, "cmp"); /** @var User $usermentee */ /* End Return all the mentees for the project mentor */ $this->render('personalMentorViewMeetings', array('user' => $user, 'pmentee' => $pmentee, 'tickets' => $tickets)); }
<div class="container" > <div class="column-center"> <?php if (User::isCurrentUserMentee()) { $pmentors = Mentee::model()->findBySql("SELECT * FROM mentee WHERE user_id={$user->id}"); $pmentor = null; $proj = null; if ($pmentors->personal_mentor_user_id != null) { $pmentor = PersonalMentor::model()->findBySql("SELECT * FROM personal_mentor WHERE user_id={$pmentors->personal_mentor_user_id}"); } $myproject = Mentee::model()->findBySql("SELECT project_id FROM mentee WHERE user_id={$user->id}"); if ($myproject->project_id != null) { $proj = Project::model()->findBySql("SELECT * FROM project WHERE id={$myproject->project_id}"); } ?> <div class="titlebox" style="width: auto" align="center"><h3>Mentee</h3></div> <br> <br> <div id="contain" class ="my-box-container6"> <h4> My Personal Mentor </h4> <div id="container" class="my-box-container6" style="<?php if (User::isCurrentUserMentee()) { echo 'display:block;'; } else { echo 'display:none;'; } ?> height: auto; overflow-y: scroll;width: 400px"> <?php
<h4><?php echo ucfirst($model->fname) . "'s "; ?> Current Assigned Mentees</h4> <h5>***Max Mentees Already Assigned***</h5> <div id="container" class="my-box-container6" style="height: 200px; overflow-y: scroll "> <?php ?> <table cellpadding="0" cellspacing="0" border="0" class="table table-striped table-bordered" id="#mytable" width="100%"> <thread> <tr> <th width="40%">Student Name</th> </tr> </thread> <?php $men = Mentee::model()->findAllBySql("SELECT * FROM mentee WHERE personal_mentor_user_id={$model->id}"); foreach ($men as $mentee) { $usr = User::model()->findBySql("SELECT * FROM user WHERE id={$mentee->user_id}"); ?> <tbody> <tr> <td><?php echo ucfirst($usr->fname) . " " . ucfirst($usr->lname); ?> </td> </tr> </tbody> <?php } ?>
if ($mentee->project_id != null) { $menteeProj = Project::model()->findBySql("select * from project where id = {$mentee->project_id}"); $projMentor = User::model()->findByPk($menteeProj->project_mentor_user_id); $title = $menteeProj->title; $projectdesc = $menteeProj->description; $mycustomer = null; if ($projMentor != null) { if ($projMentor->username == 'DEFAULT') { $mycustomer = Project::model()->findBySql("select * from project where id = {$menteeProj->id}"); $pmName = ucfirst($projMentor->fname) . ' ' . ucfirst($projMentor->fname); } } if ($mycustomer != null) { $CUSName = $mycustomer->customer_fname . ' ' . $mycustomer->customer_lname; } $mymenids = Mentee::model()->findAllBySql("select * from mentee where project_id ={$menteeProj->id} "); if ($mymenids != null) { $res = ''; foreach ($mymenids as $m) { $pid = $m->user_id; $t = User::model()->findBySql("select * from user where id = {$pid}"); $projmid = Project::model()->findBySql("select * from project where id = {$m->project_id}"); $pjm = null; if ($projmid != null) { if ($projmid->project_mentor_user_id != null) { $pjm = User::model()->findBySql("select * from user where id = {$projmid->project_mentor_user_id}"); } } $perm = User::model()->findBySql("select * from user where id = {$m->personal_mentor_user_id}"); if (isset($pjm)) { $PJMname = $pjm->fname . ' ' . $pjm->lname;
public function returnUsersForApp($dataProvider) { $users = array(); foreach ($dataProvider->getData() as $user) { $temp = array(); $temp["id"] = $user->id; $temp["name"] = $user->getFullName(); if (isset($user->university_id) && $user->university_id > 0) { $temp["university"] = University::model()->universityById($user->university_id); } $temp["avatar"] = $user->pic_url; $temp["email"] = $user->email; $mentee = Mentee::model()->findByPk($user->id); $mentorTrim = array(); $mentorTrim["name"] = "None"; $mentorTrim["avatar"] = ""; if (count($mentee) == 0) { $temp["project"] = "None"; $temp["description"] = ""; $temp["mentor"] = $mentorTrim; } else { $project = Project::model()->findByPk($mentee->project_id); if (count($project) > 0) { $temp["project"] = $project->title; $temp["description"] = $project->getDescriptionOfSize(200); } else { $temp["project"] = "None"; $temp["description"] = ""; } $personalMentor = User::model()->findByPk($mentee->personal_mentor_user_id); if (count($personalMentor) > 0 && $mentee->personal_mentor_user_id != 999) { $mentorTrim = array(); $mentorTrim["name"] = $personalMentor->getFullName(); $mentorTrim["avatar"] = $personalMentor->pic_url; } $temp["mentor"] = $mentorTrim; } $users[] = $temp; } return $users; }
/** * 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 Mentee the loaded model * @throws CHttpException */ public function loadModel($id) { $model = Mentee::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
public function actionApprove() { //$this->layout = ''; $user = User::model()->getCurrentUser(); $perModel = new ApplicationPersonalMentorPick(); $proModel = new ApplicationProjectMentorPick(); $domModel = new ApplicationDomainMentorPick(); $subModel = new ApplicationSubdomainMentorPick(); if (Yii::app()->getRequest()->isPostRequest) { $projectFlag = false; $personalFlag = false; $domainFlag = false; $domApp = $this->loadDomainMentorForApproval($user->id); $persApp = $this->loadPersonalMentorForApproval($user->id); $projApp = $this->loadProjectMentorForApproval($user->id); // PERSONAL PICKS ACCEPT $mypicks = $_POST['personal_picks_accept']; // add entry to personal_mentor $personalEntry = $this->isNewEntry($user->id, 'personal_mentor'); // if it already exists do NOTHING . change here with else statement to perform update if ($personalEntry < 1) { // add entry to personal_mentor $pementor = new PersonalMentor('add_new'); $pementor->user_id = $user->id; $pementor->max_hours = $persApp->max_hours; $pementor->max_mentees = $persApp->max_amount; $pementor->save(); } // else UPDATE $personalFlag = true; //$loaduser->isPerMentor = 1; } if ($mypicks != '') { $mypicks = explode(',', $mypicks); // cycle through each and add permanetly to appropriate table foreach ($mypicks as $pick) { $actualPick = $this->loadPersonalPick($pick); $this->updatePickStatus($actualPick, 'Approved'); // create new entry $mentee = new PersonalMentorMentees('add_new'); $mentee->user_id = $actualPick->user_id; // mentee id $mentee->personal_mentor_id = $user->id; // mentor id $mentee->save(); $trans = Yii::app()->db->beginTransaction(); $menter = Mentee::model()->findByPk($actualPick->user_id); if (is_null($menter)) { $menter = new Mentee('add_new'); $menter->user_id = $actualPick->user_id; } $menter->personal_mentor_user_id = $user->id; $menter->save(); $trans->commit(); } // PERSONAL PICKS REJECT $mypicks = $_POST['personal_picks_reject']; if ($mypicks != '') { $mypicks = explode(',', $mypicks); // cycle through each and add permanetly to appropriate table foreach ($mypicks as $pick) { $actualPick = $this->loadPersonalPick($pick); $this->updatePickStatus($actualPick, 'Rejected'); } $personalFlag = true; } // PROJECT PICKS ACCEPT $mypicks = $_POST['project_picks_accept']; if ($mypicks != '') { $mypicks = explode(',', $mypicks); // cycle through each and add permanetly to appropriate table foreach ($mypicks as $pick) { $actualPick = $this->loadProjectPick($pick); $this->updatePickStatus($actualPick, 'Approved'); // update entry $project = $this->loadProject($actualPick->project_id); $project->project_mentor_user_id = $user->id; $project->save(); } // add entry to project_mentor $projectEntry = $this->isNewEntry($user->id, 'project_mentor'); // if it already exists do NOTHING . change here with else statement to perform update if ($projectEntry < 1) { // add entry to project_mentor $promentor = new ProjectMentor('add_new'); $promentor->user_id = $user->id; $promentor->max_hours = $projApp->max_hours; $promentor->max_projects = $projApp->max_amount; $promentor->save(); } // else UPDATE $projectFlag = true; //$loaduser->isProMentor = 1; } // PROJECT PICKS REJECT $mypicks = $_POST['project_picks_reject']; if ($mypicks != '') { $mypicks = explode(',', $mypicks); foreach ($mypicks as $pick) { $actualPick = $this->loadProjectPick($pick); $this->updatePickStatus($actualPick, 'Rejected'); } $projectFlag = true; } // DOMAIN PICKS ACCEPT $mypicks = $_POST['domain_picks_accept']; if ($mypicks != '') { $mypicks = explode(',', $mypicks); // cycle through each and add permanetly to appropriate table foreach ($mypicks as $pick) { $actualPick = $this->loadDomainPick($pick); $this->updatePickStatus($actualPick, 'Approved'); // create new entry $domain = new UserDomain('add_new'); $domain->user_id = $user > id; $domain->domain_id = $actualPick->domain_id; $domain->rate = $actualPick->proficiency; $domain->active = 1; $domain->tier_team = 1; $domain->save(); } $domainFlag = true; //$loaduser->isDomMentor = 1; } // DOMAIN PICKS REJECT $mypicks = $_POST['domain_picks_reject']; if ($mypicks != '') { $mypicks = explode(',', $mypicks); // cycle through each and add permanetly to appropriate table foreach ($mypicks as $pick) { $actualPick = $this->loadDomainPick($pick); $this->updatePickStatus($actualPick, 'Rejected'); } $domainFlag = true; } // SUBDOMAIN PICKS ACCEPT $mypicks = $_POST['subdomain_picks_accept']; if ($mypicks != '') { $mypicks = explode(',', $mypicks); // cycle through each and add permanetly to appropriate table foreach ($mypicks as $pick) { $actualPick = $this->loadSubDomainPick($pick); $this->updatePickStatus($actualPick, 'Approved'); //create new entry $subdomain = new UserDomain('add_new'); $subdomain->user_id = $user->id; $subdomain->domain_id = $actualPick->subdomain->domain->id; $subdomain->subdomain_id = $actualPick->subdomain_id; $subdomain->rate = $actualPick->proficiency; $subdomain->active = 1; $subdomain->tier_team = 1; $subdomain->save(); } $domainFlag = true; //$loaduser->isDomMentor = 1; } // SUBDOMAIN PICKS REJECT $mypicks = $_POST['subdomain_picks_reject']; if ($mypicks != '') { $mypicks = explode(',', $mypicks); // cycle through each and add permanetly to appropriate table foreach ($mypicks as $pick) { $actualPick = $this->loadSubDomainPick($pick); $this->updatePickStatus($actualPick, 'Rejected'); } $domainFlag = true; } $closed = new ApplicationClosed(); $closedOne = false; if ($domainFlag) { // add entry to domain_mentor $domEntry = $this->isNewEntry($user->id, 'domain_mentor'); $user->isDomMentor = 1; // add entry to domain_mentor // if it already exists do NOTHING . change here with else statement to perform update if ($domEntry < 1) { $dmentor = new DomainMentor('add_new'); $dmentor->user_id = $user->id; $dmentor->max_tickets = $domApp->max_amount; $dmentor->save(); } // else UPDATE $this->updateAppStatus($domApp, 'Closed'); $closed->app_domain_mentor_id = $domApp->id; $closedOne = true; } if ($personalFlag) { $user->isPerMentor = 1; $this->updateAppStatus($persApp, 'Closed'); $closed->app_personal_mentor_id = $persApp->id; $closedOne = true; } if ($projectFlag) { $user->isProMentor = 1; $this->updateAppStatus($projApp, 'Closed'); $closed->app_project_mentor_id = $projApp->id; $closedOne = true; } $user->save(); if ($closedOne) { $closed->user_id = $user->id; $closed->date = new CDbExpression('NOW()'); $closed->save(); } $this->redirect("/coplat/index.php/application/portal"); } // on initial load // application personal mentor // load application sent by admin $personalMentor = $this->loadPersonalMentorForApproval($user->id); $personalMentorHistory = null; $personalMentorChanges = null; $personalCount = 0; if ($personalMentor != null) { $personalMentorHistory = new CSqlDataProvider('SELECT t.id, t.app_id, t.user_id, t.approval_status, u.fname, u.lname FROM application_personal_mentor_pick t, user u WHERE t.user_id = u.id AND (t.approval_status = "Approved" OR t.approval_status = "Rejected") AND t.app_id = ' . $personalMentor->id . ''); $personalMentorChanges = new CSqlDataProvider('SELECT t.id, t.app_id, t.user_id, t.approval_status, u.fname, u.lname FROM application_personal_mentor_pick t, user u WHERE t.user_id = u.id AND (t.approval_status = "Proposed by Admin") AND t.app_id = ' . $personalMentor->id . ''); $personalCount = Yii::app()->db->createCommand()->select('count(*)')->from('application_personal_mentor_pick')->where('app_id =:id', array(':id' => $personalMentor->id))->andWhere('approval_status = "Proposed by Admin"')->queryScalar(); } // application project mentor $projectMentor = $this->loadProjectMentorForApproval($user->id); $projectMentorHistory = null; $projectMentorChanges = null; $projectCount = 0; if ($projectMentor != null) { $projectMentorHistory = new CSqlDataProvider('SELECT t.id, t.app_id, t.project_id, t.approval_status, p.title FROM application_project_mentor_pick t, project p WHERE t.project_id = p.id AND (t.approval_status = "Approved" OR t.approval_status = "Rejected") AND t.app_id = ' . $projectMentor->id . ''); $projectMentorChanges = new CSqlDataProvider('SELECT t.id, t.app_id, t.project_id, t.approval_status, p.title FROM application_project_mentor_pick t, project p WHERE t.project_id = p.id AND (t.approval_status = "Proposed by Admin") AND t.app_id = ' . $projectMentor->id . ''); $projectCount = Yii::app()->db->createCommand()->select('count(*)')->from('application_project_mentor_pick')->where('app_id =:id', array(':id' => $projectMentor->id))->andWhere('approval_status = "Proposed by Admin"')->queryScalar(); } // application domain mentor $domainMentor = $this->loadDomainMentorForApproval($user->id); $domainHistory = null; $domainChanges = null; $domainCount = 0; $subdomainHistory = null; $subdomainChanges = null; $subdomainCount = 0; if ($domainMentor != null) { $domainHistory = new CSqlDataProvider('SELECT t.id, t.app_id, t.domain_id, t.proficiency, t.approval_status, d.name FROM application_domain_mentor_pick t, domain d WHERE (t.approval_status = "Approved" OR t.approval_status = "Rejected") AND t.domain_id = d.id AND t.app_id = ' . $domainMentor->id . ''); $domainChanges = new CSqlDataProvider('SELECT t.id, t.app_id, t.domain_id, t.proficiency, t.approval_status, d.name FROM application_domain_mentor_pick t, domain d WHERE (t.approval_status = "Proposed by Admin") AND t.domain_id = d.id AND t.app_id= ' . $domainMentor->id . ''); $domainCount = Yii::app()->db->createCommand()->select('count(*)')->from('application_domain_mentor_pick')->where('app_id =:id', array(':id' => $domainMentor->id))->andWhere('approval_status = "Proposed by Admin"')->queryScalar(); $subdomainHistory = new CSqlDataProvider('SELECT t.id, t.app_id, t.subdomain_id, t.proficiency, t.approval_status, d.name as "dname", s.name as "sname" FROM application_subdomain_mentor_pick t, subdomain s, domain d WHERE (t.approval_status = "Approved" OR t.approval_status = "Rejected") AND s.domain_id = d.id AND s.id = t.subdomain_id AND t.app_id = ' . $domainMentor->id . ''); $subdomainChanges = new CSqlDataProvider('SELECT t.id, t.app_id, t.subdomain_id, t.proficiency, t.approval_status, d.name as "dname", s.name as "sname" FROM application_subdomain_mentor_pick t, subdomain s, domain d WHERE (t.approval_status = "Proposed by Admin") AND s.domain_id = d.id AND s.id = t.subdomain_id AND t.app_id = ' . $domainMentor->id . ''); $subdomainCount = Yii::app()->db->createCommand()->select('count(*)')->from('application_subdomain_mentor_pick')->where('app_id =:id', array(':id' => $domainMentor->id))->andWhere('approval_status = "Proposed by Admin"')->queryScalar(); } $userInfo = $this->loadUserInfoByUser($user->id); $newCount = $personalCount + $projectCount + $domainCount + $subdomainCount; // render view $this->render('approve', array('user_id' => $user->id, 'personalMentor' => $personalMentor, 'personalMentorHistory' => $personalMentorHistory, 'personalMentorChanges' => $personalMentorChanges, 'projectMentor' => $projectMentor, 'projectMentorHistory' => $projectMentorHistory, 'projectMentorChanges' => $projectMentorChanges, 'domainMentor' => $domainMentor, 'domainHistory' => $domainHistory, 'domainChanges' => $domainChanges, 'subdomainHistory' => $subdomainHistory, 'subdomainChanges' => $subdomainChanges, 'newCount' => $newCount, 'perModel' => $perModel, 'proModel' => $proModel, 'domModel' => $domModel, 'subModel' => $subModel, 'userInfo' => $userInfo)); }
public function actionAdmin_Create_User() { $model = new User(); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); $error = ''; if (isset($_POST['User'])) { /*if ($this->actionVerifyRegistrationOld() != "") { $this->render('create', array('model'=>$model)); }*/ $model->attributes = $_POST['User']; $model->pic_url = '/coplat/images/profileimages/default_pic.jpg'; $model->biography = "Tell us something about yourself..."; $model->activation_chain = $this->genRandomString(10); $model->activated = 1; $error = $this->verifyRegistrationOld(); if (!$model->isProMentor && !$model->isDomMentor && !$model->isPerMentor && !$model->isMentee) { $error = "Please select at least one user role."; } if ($error == null) { $model->save(false); if ($model->isProMentor) { $proMentor = new ProjectMentor(); $proMentor->user_id = $model->id; $proMentor->max_hours = 0; $proMentor->max_projects = 0; $proMentor->save(false); } if ($model->isDomMentor) { $domMentor = new DomainMentor(); $domMentor->user_id = $model->id; $domMentor->max_tickets = 0; $domMentor->save(); } if ($model->isPerMentor) { $perMentor = new PersonalMentor(); $perMentor->user_id = $model->id; $perMentor->max_hours = 0; $perMentor->max_mentees = 0; $perMentor->save(); } if ($model->isMentee()) { $mentee = new Mentee(); $mentee->user_id = $model->id; $mentee->personal_mentor_user_id = null; $mentee->project_id = null; $mentee->save(); } } } if (isset($_POST['Roles'])) { $proMentor = ProjectMentor::model()->getProMentor($_COOKIE['UserID']); $perMentor = PersonalMentor::model()->getPerMentor($_COOKIE['UserID']); $domMentor = DomainMentor::model()->getDomMentor($_COOKIE['UserID']); $mentee = Mentee::model()->getMentee($_COOKIE['UserID']); //$model->save(false); $user = User::model()->findByPk($_COOKIE['UserID']); if ($user->isProMentor == 1) { //$proMentor = new ProjectMentor; $proMentor->user_id = $user->id; $proMentor->max_hours = $_POST['pjmhours']; $all = Project::model()->findAll(); $proMentor->save(); $count = 0; foreach ($all as $each) { if (isset($_POST[$each->id . 'pjm'])) { $p = Project::model()->findByPk($each->id); $p->project_mentor_user_id = $_COOKIE['UserID']; $p->save(false); $count++; } } $proMentor->max_projects = $count; $proMentor->save(); } if ($user->isDomMentor == 1) { //UserDomain::model()->deleteAll("user_id = ".$user->id); $domMentor->max_tickets = $_POST['dmmaxtickets']; $domMentor->save(); $all = Domain::model()->findAll(); foreach ($all as $each) { if (isset($_POST[$each->id])) { $user_domain = new UserDomain(); $user_domain->user_id = $domMentor->user_id; $user_domain->domain_id = $each->id; $user_domain->active = 1; $user_domain->save(false); $allsubs = Subdomain::model()->findAllBySql("select * from subdomain where domain_id = {$each->id}"); if ($allsubs != null) { foreach ($allsubs as $onesub) { $temp = $onesub->id . 'ddmsub'; if (isset($_POST[$temp])) { $user_domain = new UserDomain(); $user_domain->user_id = $domMentor->user_id; $user_domain->domain_id = $each->id; $user_domain->active = 1; $rate = $each->id . '-' . $onesub->id . 'dmrate'; $tier = $each->id . '-' . $onesub->id . 'dmtier'; $user_domain->rate = $_POST[$rate]; $user_domain->tier_team = $_POST[$tier]; $user_domain->subdomain_id = $onesub->id; $user_domain->save(false); } } } else { $user_domain = new UserDomain(); $user_domain->user_id = $domMentor->user_id; $user_domain->domain_id = $each->id; $user_domain->active = 1; $user_domain->save(false); } } } } if ($user->isPerMentor) { //$perMentor = new PersonalMentor(); $perMentor->user_id = $user->id; $perMentor->max_hours = $_POST['pmhours']; $all = Mentee::model()->findAll(); $perMentor->save(); $count = 0; foreach ($all as $each) { if (isset($_POST[$each->user_id . 'pm'])) { $p = Mentee::model()->findByPk($each->user_id); $p->personal_mentor_user_id = $_COOKIE['UserID']; $p->save(false); $count++; } } $perMentor->max_mentees = $count; $perMentor->save(); } if ($user->isMentee) { $changed = false; $menteePersonalMentor = $_POST['mentePersonalMentor']; if (isset($menteePersonalMentor) && $menteePersonalMentor > 0) { $mentee->personal_mentor_user_id = $menteePersonalMentor; $changed = true; } $menteeProject = $_POST['menteeProject']; if (isset($menteeProject) && $menteeProject > 0) { $mentee->project_id = $menteeProject; $changed = true; } if ($changed) { $mentee->save(); } } $hasher = new PasswordHash(8, false); $pw = $this->genRandomString(8); $user->password = $hasher->HashPassword($pw); $user->save(false); $userfullName = $user->fname . ' ' . $user->lname; $adminName = User::getCurrentUser(); User::sendConfirmationEmail($userfullName, $user->email, $user->username, $pw, $adminName->fname . ' ' . $adminName->lname); } //$error = ''; $this->render('admin_create_user', array('model' => $model, 'error' => $error)); return; //$this->render('add',array('model'=>$model, 'error' => $error)); }
public function actioneditProfile() { /** @var User $username */ $username = Yii::app()->user->name; $user = User::model()->find("username=:username", array(':username' => $username)); $projects = Project::model()->findAllBySql("SELECT title FROM project WHERE project_mentor_user_id IS NULL"); $userdoms = UserDomain::model()->findAllBySql("SELECT domain_id FROM user_domain WHERE user_id={$user->id}"); $Mentees = Mentee::model()->findAllBySql("SELECT user_id FROM mentee WHERE personal_mentor_user_id IS NULL"); $Tickets = Ticket::model()->findAllBySql("SELECT * FROM ticket WHERE assign_user_id=:id", array(":id" => $user->id)); $this->render('editProfile', array('Tickets' => $Tickets, 'user' => $user, 'userdoms' => $userdoms, 'Mentees' => $Mentees, 'projects' => $projects)); }
?> <?php echo $form->dropDownList($model, 'assign_user_id', $data, array('prompt' => 'Select')); ?> <?php echo $form->error($model, 'assign_user_id'); ?> <?php } ?> <?php /* If the user if project mentor. He has the option of assign the ticket to another project mentor */ if (User::isCurrentUserMentee()) { // find project mentor $mentee = Mentee::model()->findByPk(User::getCurrentUserId()); $mentor = null; $projectmentor = Project::model()->findByPk($mentee->project_id); if ($projectmentor != null) { $mentor = User::model()->find("id=:id", array(':id' => $projectmentor->project_mentor_user_id)); } else { } //Tito: Find perssonnal mentor $personalMentor = null; if ($mentee->personal_mentor_user_id != null) { $personalMentorID = $mentee->personal_mentor_user_id; $personalMentor = User::model()->find("id=:id", array(':id' => $personalMentorID)); } $data = array(); // foreach ($mentor as $mod) { if ($mentor != null) {