/** * @param string $emailAddress * @return mixed if true integer otherwise null */ public static function saveEmailAddress($emailAddress) { $emailID = null; $parseEmail = explode('@', strtolower(trim($emailAddress))); if (count($parseEmail) == 2) { $domain = Domain::model()->findByAttributes(array('name' => $parseEmail[1])); if (!$domain) { $domain = new Domain(); $domain->name = $parseEmail[1]; } if ($domain->save()) { $email = new Email(); $email->username = $parseEmail[0]; $email->domainID = $domain->ID; if ($email->save()) { $emailID = $email->ID; } else { if ($domain->isNewRecord) { Domain::model()->deleteByPk($domain->ID); } } } } return $emailID; }
protected function loadDomain() { if (null !== ($model = Domain::model()->findByAttributes(array('name' => Yii::app()->request->serverName)))) { Yii::app()->getParams()->mergeWith($model->attributes); } else { $model = new Domain(); Yii::app()->getParams()->mergeWith($model->attributes); } }
/** * Получение модели домена * @return Domain * @throws CException */ public function getModel() { if ($this->_model === null) { $this->_model = Domain::model()->findByPk($this->mainDomainId); } if ($this->_model === null) { throw new CException('Домен с id = ' . $this->mainDomainId . ' не найден.'); } return $this->_model; }
/** * Load Banque model * @param integer $id * @return Banque * @throws CHttpException */ protected function loadModel($id = null) { if (null === $id) { $model = new Domain(); } else { $model = Domain::model()->findByPk($id); } if ($model instanceof CModel) { $model->titleField = 'name'; return $model; } throw new CHttpException(404, 'Item not found'); }
/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate($domain) { $model = new Record(); $model->domain_id = $domain; $domain = Domain::model()->findByPK($domain); $model->domain = $domain; // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['Record'])) { $model->attributes = $_POST['Record']; if ($model->save()) { Yii::app()->audit->log('Created record: ' . $model->id); $this->redirect(array('domain/update', 'id' => $domain->id)); } } $userId = Yii::app()->user->getId(); $user = User::model()->findByPK($userId); $this->render('create', array('model' => $model, 'user' => $user)); }
public function actionAdminView($id) { $model = DomainSuggestion::model()->findByPk($id); if (strcasecmp($model->status, "pending") == 0) { if (isset($_POST['button1'])) { $model->status = "Accepted"; $model->description = $_POST['DomainSuggestion']['description']; $domainID = $_POST['DomainSuggestion']['Domain']; $dom = Domain::model()->findByPk($domainID); if (is_null($dom)) { $dom = new Domain(); $dom->name = $model->name; $dom->description = $model->description; $dom->need = "Medium"; $dom->need_amount = 5; $dom->validator = 5; $dom->save(); } else { $subDom = new Subdomain(); $subDom->need = "Medium"; $subDom->name = $model->name; $subDom->description = $model->description; $subDom->validator = 5; $subDom->need_amount = 5; $subDom->domain_id = $dom->id; $subDom->save(); } if ($model->save()) { $this->redirect(array('view', 'id' => $model->suggestion_id)); } } if (isset($_POST['button2'])) { $model->status = "Rejected"; if ($model->save()) { $this->redirect(array('view', 'id' => $model->suggestion_id)); } } $this->render('adminView', array('model' => $model)); } else { $this->actionView($id); } }
public static function getStatus($status) { $domainStatus = Domain::model()->findAll('Type=:Type', array('Type' => 'student')); foreach ($domainStatus as $domain) { if ($domain->ID == $status) { return $domain->Name; } } }
if ($userdoms == null) { ?> <?php echo "No Assigned Domains"; } else { ?> <table cellpadding="0" cellspacing="0" border="0" class="table table-striped table-bordered" id="#mytable" width="100%"> <thead> <tr> <th width="50%">Domain Name</th> <th width="50%">Subdomain/Rating/Tier</th> </tr> </thead> <?php foreach ($userdoms as $userdom) { $domain = Domain::model()->find("id=:id", array(":id" => $userdom->domain_id)); $userdom = UserDomain::model()->findAllBySql("SELECT subdomain_id,rate,tier_team FROM user_domain WHERE domain_id={$domain->id} AND user_id={$user->id}"); ?> <tbody> <tr> <td><?php echo $domain->name; ?> </td> <td> <?php $res = ''; foreach ($userdom as $udom) { if ($udom->subdomain_id != null) { $subdm = Subdomain::model()->findBySql("select * from subdomain where id = {$udom->subdomain_id}");
?> <?php echo $form->errorSummary($domainUser); ?> <?php echo $form->hiddenField($domainUser, 'user_id', array('value' => $model->id)); ?> <div class="row"> <?php echo $form->labelEx($domainUser, 'domain_id'); ?> <?php $models = Domain::model()->findAllBySql('SELECT * FROM `domains` WHERE `domains`.`id` NOT IN (SELECT `domain_id` FROM `domain_user` WHERE `user_id` = ' . $model->id . ') ORDER BY `domains`.`name`'); echo $form->dropDownList($domainUser, 'domain_id', CHtml::listData($models, 'id', 'name')); ?> <?php echo $form->error($domainUser, 'domain_id'); ?> </div> <div class="row buttons"> <?php echo CHtml::submitButton(Yii::t('app', 'page.add')); ?> </div> <?php $this->endWidget();
<p class="note">Fields with <span class="required">*</span> are required.</p> <?php echo $form->errorSummary($model); ?> <div id = "container"; style="margin-top:10px; width: 1000px; border: 1px solid #C9E0ED; border-radius: 5px;"> <div class ="row"; style = "margin-left: 40px"> <?php echo $form->labelEx($model, 'domain_id'); ?> <?php echo $form->dropDownList($model, 'domain_id', CHtml::listData(Domain::model()->findAll(), 'id', 'name')); ?> <?php echo $form->error($model, 'domain_id'); ?> </div> <div class="row" style = "margin-left: 40px"> <?php echo $form->labelEx($model, 'subdomain_id'); ?> <?php echo $form->dropDownList($model, 'subdomain_id', CHtml::listData(Subdomain::model()->findAll(), 'id', 'name'), array('prompt' => 'Select')); ?> <?php echo $form->error($model, 'subdomain_id');
public static function escalateTicket($domain_id, $sub) { if ($sub) { $userDomain = UserDomain::model()->findAllBySql("SELECT * FROM user_domain WHERE subdomain_id =:id", array(":id" => $domain_id)); $subdomain = Subdomain::model()->findByPk($domain_id); $validator = $subdomain->validator; } else { $userDomain = UserDomain::model()->findAllBySql("SELECT * FROM user_domain WHERE domain_id =:id", array(":id" => $domain_id)); $domain = Domain::model()->findByPk($domain_id); $validator = $domain->validator; } if ($userDomain != null && is_array($userDomain)) { foreach ($userDomain as $auserDomain) { /** @var UserDomain $auserDomain */ if ($auserDomain->tier_team == 2) { if ($auserDomain->rate >= $validator) { /*Query to the domain mentor to see how many tickets is allowed to be assigned */ $domainMentor = DomainMentor::model()->findAllBySql("SELECT * FROM domain_mentor WHERE user_id =:id", array(":id" => $auserDomain->user_id)); /** @var Ticket $count */ if (is_array($domainMentor)) { foreach ($domainMentor as $adomainMentor) { /** @var DomainMentor $adomainMentor */ $count = Ticket::model()->findBySql("SELECT COUNT(id) as `id` FROM ticket WHERE assign_user_id =:id", array(":id" => $adomainMentor->user_id)); if ($count->id < $adomainMentor->max_tickets) { /*return the first available domain mentor on queue */ return $auserDomain->user_id; } } } } } } } return self::$admin; /* Assign the ticket to the admin for reassign */ }
/** * 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 the ID of the model to be loaded */ public function loadModel($id) { $model = Domain::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
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 domainExists($domain) { $d = Domain::model()->findAllBySql("SELECT name FROM domain WHERE name='{$domain}'"); return $d; /* for($i = 0; $i < count($d); $i++) { if(strcasecmp($domain, $d[$i]->name)) { return true; } else { return false; } }*/ }
function getTicketColumns($model) { //get or initialize the current column order $columnArrayOrder = getColumnArrayOrder(); //only if make a cache of the columns if needed if (isset($_GET['sourceColumn']) && isset($_GET['destinationColumn'])) { $source = $_GET['sourceColumn']; $destination = $_GET['destinationColumn']; $sourceIndex = $source[0]; $destIndex = $destination[0]; ReportUtils::moveColumnsByIndex($sourceIndex, $destIndex, $columnArrayOrder); Yii::app()->session['TicketColumnOrder'] = $columnArrayOrder; } $columns = array(); for ($i = 0; $i < count($columnArrayOrder); $i++) { switch ($columnArrayOrder[$i]) { case TicketReportColumns::ticketID: $columns[] = array('name' => 'ticketID', 'header' => 'Ticket #', 'filter' => CHtml::activeNumberField($model, 'ticketID'), 'headerHtmlOptions' => array('width' => '75')); break; case TicketReportColumns::creatorName: $columns[] = array('name' => 'creatorName', 'header' => 'Creator Name', 'filter' => CHtml::activeTextField($model, 'creatorName'), 'headerHtmlOptions' => array('width' => '200')); break; case TicketReportColumns::creatorID: $columns[] = array('name' => 'creatorID', 'header' => 'Creator ID', 'filter' => CHtml::activeNumberField($model, 'creatorID'), 'headerHtmlOptions' => array('width' => '75')); break; case TicketReportColumns::creatorDisabled: $columns[] = array('name' => 'creatorDisabled', 'header' => 'Creator Disabled', 'value' => 'ReportUtils::getZeroOneToYesNo($data->creatorDisabled)', 'filter' => array('1' => 'Yes', '0' => 'No'), 'headerHtmlOptions' => array('width' => '80')); break; case TicketReportColumns::creatorEmail: $columns[] = array('name' => 'creatorEmail', 'header' => 'Creator Email', 'filter' => CHtml::activeEmailField($model, 'creatorEmail'), 'headerHtmlOptions' => array('width' => '150')); break; case TicketReportColumns::ticketStatus: $columns[] = array('name' => 'ticketStatus', 'header' => 'Ticket Status', 'filter' => array('Close' => 'Close', 'Pending' => 'Pending'), 'headerHtmlOptions' => array('width' => '105')); break; case TicketReportColumns::ticketCreatedDate: $columns[] = array('name' => 'ticketCreatedDate', 'header' => 'Created Date', 'value' => 'ReportUtils::dateformat($data->ticketCreatedDate)', 'filter' => CHtml::activeDateField($model, 'ticketCreatedDate'), 'headerHtmlOptions' => array('width' => '160')); break; case TicketReportColumns::assignedUserName: $columns[] = array('name' => 'assignedUserName', 'header' => 'Assigned To (Name)', 'filter' => CHtml::activeTextField($model, 'assignedUserName'), 'headerHtmlOptions' => array('width' => '150')); break; case TicketReportColumns::ticketAssignUserID: $columns[] = array('name' => 'ticketAssignUserID', 'header' => 'Assigned To (Id)', 'filter' => CHtml::activeNumberField($model, 'ticketAssignUserID'), 'headerHtmlOptions' => array('width' => '100')); break; case TicketReportColumns::assignedUserDisabled: $columns[] = array('name' => 'assignedUserDisabled', 'header' => 'Assigned To (Disabled)', 'value' => 'ReportUtils::getZeroOneToYesNo($data->assignedUserDisabled)', 'filter' => array('1' => 'Yes', '0' => 'No'), 'headerHtmlOptions' => array('width' => '100')); break; case TicketReportColumns::assignedUserEmail: $columns[] = array('name' => 'assignedUserEmail', 'header' => 'Assigned To (Email)', 'filter' => CHtml::activeEmailField($model, 'assignedUserEmail'), 'headerHtmlOptions' => array('width' => '150')); break; case TicketReportColumns::ticketDomainName: $columns[] = array('name' => 'ticketDomainName', 'header' => 'Ticket Domain', 'filter' => CHtml::activeDropDownList($model, 'ticketDomainID', CHtml::listData(Domain::model()->findAll(), 'id', 'name'), array('empty' => ' ')), 'headerHtmlOptions' => array('width' => '200')); break; case TicketReportColumns::ticketSubDomainName: $columns[] = array('name' => 'ticketSubDomainName', 'header' => 'Ticket Sub Domain', 'filter' => CHtml::activeDropDownList($model, 'ticketSubDomainID', CHtml::listData(Subdomain::model()->findAll(), 'id', 'name'), array('empty' => ' ')), 'headerHtmlOptions' => array('width' => '170')); break; case TicketReportColumns::ticketPriorityDescription: $columns[] = array('name' => 'ticketPriorityDescription', 'header' => 'Ticket Priority', 'filter' => CHtml::activeDropDownList($model, 'ticketPriorityID', CHtml::listData(Priority::model()->findAll(), 'id', 'description'), array('empty' => ' ')), 'headerHtmlOptions' => array('width' => '110')); break; case TicketReportColumns::ticketAssignedDate: $columns[] = array('name' => 'ticketAssignedDate', 'header' => 'Ticket Assigned Date', 'value' => 'ReportUtils::dateformat($data->ticketAssignedDate)', 'filter' => CHtml::activeDateField($model, 'ticketAssignedDate'), 'headerHtmlOptions' => array('width' => '160')); break; case TicketReportColumns::ticketClosedDate: $columns[] = array('name' => 'ticketClosedDate', 'header' => 'Ticket Closed Date', 'value' => 'ReportUtils::dateformat($data->ticketClosedDate)', 'filter' => CHtml::activeDateField($model, 'ticketClosedDate'), 'headerHtmlOptions' => array('width' => '160')); break; case TicketReportColumns::ticketIsEscalated: $columns[] = array('name' => 'ticketIsEscalated', 'header' => 'Escalated', 'value' => 'ReportUtils::getZeroOneToYesNo($data->ticketIsEscalated)', 'filter' => array('1' => 'Yes', '0' => 'No'), 'headerHtmlOptions' => array('width' => '80')); break; case TicketReportColumns::ticketSubject: $columns[] = array('name' => 'ticketSubject', 'header' => 'Subject', 'filter' => CHtml::activeTextField($model, 'ticketSubject'), 'headerHtmlOptions' => array('width' => '300')); break; case TicketReportColumns::ticketDescription: $columns[] = array('name' => 'ticketDescription', 'header' => 'Description', 'filter' => CHtml::activeTextField($model, 'ticketDescription'), 'headerHtmlOptions' => array('width' => '400')); break; } } return $columns; }
public function actionuserProfile() { $model = User::getCurrentUser(); $promentor = ProjectMentor::getCurrentUser(); $permentor = PersonalMentor::getCurrentUser(); $dommentor = DomainMentor::getCurrentUser(); if (isset($_POST['submit'])) { $model->biography = $_POST['biography']; $uploadedFile = CUploadedFile::getInstance($model, 'pic_url'); /*Attach file */ $fileName = "{$uploadedFile}"; if ($fileName != null) { /*Save file uploaded in the Uploads folder */ $model->pic_url = '/coplat/images/profileimages/' . $fileName; $uploadedFile->saveAs(Yii::getPathOfAlias('webroot') . '/images/profileimages/' . $fileName); } $model->save(false); if ($model->isProMentor == 1) { echo $_POST['proHours']; $promentor->max_hours = $_POST['proHours']; //$promentor->max_projects = $_POST['numProjects']; $promentor->save(); if (isset($_POST['proj'])) { $projs = $_POST['proj']; if (empty($projs)) { echo " No projects selected "; } else { $pro = $_POST['proj']; $curr = Project::model()->findallbysql("SELECT * FROM project WHERE project_mentor_user_id={$model->id}"); for ($i = 0; $i < $promentor->max_projects - count($curr); $i++) { $p = Project::model()->findBySql("SELECT * FROM project WHERE title='{$pro[$i]}'"); $p->project_mentor_user_id = $model->id; $p->save(); } } } } if ($model->isPerMentor == 1) { $permentor->max_hours = $_POST['pmenHours']; // $permentor->max_mentees = $_POST['numMentees']; $permentor->save(); if (isset($_POST['mentees'])) { $men = $_POST['mentees']; $curr = Mentee::model()->findallbysql("SELECT * FROM mentee WHERE personal_mentor_user_id={$model->id}"); for ($i = 0; $i < $permentor->max_mentees - count($curr); $i++) { $m = Mentee::model()->findBySql("SELECT * FROM mentee WHERE user_id={$men[$i]}"); $m->personal_mentor_user_id = $model->id; $m->save(); } } } if ($model->isDomMentor == 1) { $dommentor->max_tickets = $_POST['numTickets']; $dommentor->save(); if (isset($_POST['domainName'])) { $d = new Domain(); $d->name = $_POST['domainName']; if (Domain::model()->domainExists($d->name)) { //do nothing } else { $d = new Domain(); $ud = new UserDomain(); $d->name = $_POST['domainName']; $d->save(); $ud->domain_id = $d->id; $ud->user_id = $model->id; $ud->rate = $_POST['ratings']; $ud->save(); } } if (isset($_POST['existDoms'])) { $doms = $_POST['existDoms']; for ($i = 0; $i < count($doms); $i++) { $d = Domain::model()->findBySql("SELECT id FROM domain WHERE name='{$doms[$i]}'"); $ud = new UserDomain(); $ud->domain_id = $d->id; $ud->user_id = $model->id; $ud->rate = $_POST['ratings']; $ud->save(); } } if (isset($_POST['unrated'])) { $ud = UserDomain::model()->findAllBySql("SELECT * FROM user_domain WHERE rate IS NULL AND user_id={$model->id} "); $ur = $_POST['unrated']; for ($i = 0; $i < count($ur); $i++) { $ud[$i]->rate = $ur[$i]; $ud[$i]->save(); } } } } /** @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={$user->id}"); $userdoms = UserDomain::model()->findAllBySql("SELECT distinct domain_id FROM user_domain WHERE user_id={$user->id}"); $Mentees = Mentee::model()->findAllBySql("SELECT user_id FROM mentee WHERE personal_mentor_user_id={$user->id}"); $Tickets = Ticket::model()->findAllBySql("SELECT * FROM ticket WHERE assign_user_id=:id", array(":id" => $user->id)); $this->render('userProfile', array('Tickets' => $Tickets, 'user' => $user, 'userdoms' => $userdoms, 'Mentees' => $Mentees, 'projects' => $projects)); }
public function actionDomain() { $application = new ApplicationDomainMentor(); $domains = new Domain(); if (Yii::app()->getRequest()->isPostRequest) { $user = User::model()->getCurrentUser(); $application->attributes = $_POST['ApplicationDomainMentor']; $application->status = 'Admin'; $application->user_id = $user->id; $application->date_created = new CDbExpression('NOW()'); $application->save(false); $picks = $_POST['domPicks']; $picks = explode(',', $picks); foreach ($picks as $pick) { $dbpick = new ApplicationDomainMentorPick(); $dbpick->app_id = $application->id; $temp = explode(':', $pick); $dbpick->domain_id = $temp[0]; $dbpick->proficiency = $temp[1]; $dbpick->approval_status = 'Proposed by Mentor'; $dbpick->save(false); } $picks = $_POST['subPicks']; if (isset($picks) && $picks != "") { $picks = explode(',', $picks); foreach ($picks as $pick) { $dbpick = new ApplicationSubdomainMentorPick(); $dbpick->app_id = $application->id; $temp = explode(':', $pick); $dbpick->subdomain_id = $temp[0]; $dbpick->proficiency = $temp[1]; $dbpick->approval_status = 'Proposed by Mentor'; $dbpick->save(false); } } $this->redirect("/coplat/index.php/application/portal"); } else { // on initial load $domains->unsetAttributes(); $domain = Domain::model()->getDomainsForApp($domains->searchNoPagination()); } $error = ''; $this->render('domain', array('application' => $application, 'domain' => $domain, 'error' => $error)); }
/* @var $this SubdomainController */ /* @var $model Subdomain */ /* @var $form CActiveForm */ ?> <div class="wide form"> <?php $form = $this->beginWidget('CActiveForm', array('action' => Yii::app()->createUrl($this->route), 'method' => 'get')); ?> <div id="regbox"> <?php echo $form->label($model, 'domain_id'); ?> <?php echo $form->dropDownList($model, 'domain_id', CHtml::listData(Domain::model()->findAll(), 'id', 'name'), array('prompt' => 'Select')); ?> <br/> <?php echo CHtml::submitButton('Search', array("class" => "btn btn-primary")); ?> </div> <?php $this->endWidget(); ?> </div><!-- search-form -->
function updateAction() { $model = new Campaign(); if (isset($_POST['country_id'])) { $_POST['country_id'] = implode(',', $_POST['country_id']); } // check if this is an attachment campaign. if so, we don't want to validate the urls or fulfillment_id if it isnot presesnt $attach = false; if (isset($_POST['attach']) && $_POST['attach']) { $attach = true; $_POST['url'] = $_POST['order_url'] = $_POST['return_url'] = 'attach'; if (!strlen($_POST['fulfillment_id'])) { $_POST['fulfillment_id'] = 0; } } else { $_POST['attach'] = 0; } // Uncomment the following line if AJAX validation is needed $this->performAjaxValidation($model); if (isset($_POST['ajax']) && $_POST['ajax'] == 'categorys-form') { $model->fillFromArray($_POST, FALSE); $model->user_id_updated = $this->user->user_id; $model->updated = 'NOW():sql'; $model->model_uset_id = $this->user->user_id; $fulfillment_change = AF::get($_POST, 'fulfillment_change'); Campaigns::fulfillmentRelationship($model->campaign_id, $model->fulfillment_id, $fulfillment_change); if ($model->restrictions()->save()) { Message::echoJsonSuccess(__('campaign_updated')); } else { Message::echoJsonError(__('campaign_no_updated')); } die; } $id = AF::get($this->params, 'id', FALSE); if (!$id) { throw new AFHttpException(0, 'no_id'); } if (!$model->restrictions()->cache()->findByPk($id)) { throw new AFHttpException(0, 'incorrect_id'); } $model->country_id = explode(',', $model->country_id); Assets::js('jquery.form'); $this->addToPageTitle('Update campaign'); //array_unshift($fulfillments, array('fulfillment_id'=>0, 'alias'=>__('none'))); // Is this used still? $ccomboModel = new CCombo(); $ccomboModel->campaign_id = $model->campaign_id; $isCombo = $ccomboModel->checkRelationship(); $countries = Country::model()->cache()->findAllInArray(); $profiles = Profile::model()->cache()->findAllInArray(); // prepend dry run gateway array_unshift($profiles, array('profile_id' => 0, 'profile_name' => 'DRY RUN GATEWAY')); $fulfillments = Fulfillment::model()->cache()->findAllInArray(); $currencies = $model->getCountOrders() > 0 ? array() : Currency::model()->cache()->findAllInArray(); $domains = Domain::model()->cache()->findAllInArray(); $this->render('update', array('model' => $model, 'countries' => $countries, 'profiles' => $profiles, 'currencies' => $currencies, 'fulfillments' => $fulfillments, 'isCombo' => $isCombo, 'domains' => $domains)); }
public static function getUserStatusOptions() { return CHtml::listData(Domain::model()->findAll('Type=:Type', array('Type' => 'users')), 'ID', 'Name'); }
} else { echo $userdom->rate; } ?> </td> </tr> </tbody> <?php } ?> </table><br> </div> <h7><center>Rating: 1: Basic experience, 5: Moderate exp, 10: Mastered</h7> <h6>Add Current Domain(s) <select name ="existDoms[]" style="width:100px;"> <?php $dm = Domain::model()->findAllBySql("SELECT * FROM domain WHERE id NOT IN (SELECT domain_id FROM user_domain WHERE user_id={$model->id})"); for ($i = 0; $i < count($dm); $i++) { ?> <option value="<?php echo $dm[$i]->name; ?> "><?php echo $dm[$i]->name; ?> </option> <?php } ?> </select> <select name="ratings" style="width:60px;"> <?php
<?php /*This part and 'change' view was assinged to me in the last few weeks so I apologize for the mess*/ //global variables $all = Domain::model()->findAll(); $def = User::model()->findBySql("select * from user where username = '******'"); //default user ?> <head> <script> function load() { /*abandoned javascript function to grayou elements*/ } <?php ?> </script> <link rel="stylesheet" type="text/css" href="/coplat/css/ui-lightness/jquery-ui-1.8.2.custom.css" /> <link rel="stylesheet" type="text/css" href="/coplat/css/Wizard.css" /> </head> <body > <div id="demoWrapper" class="my-box-container7" style="background-color: #ffffff"> <h2>User: <?php echo $model->fname . ' ' . $model->lname;
<th width="15%">Subdomain</th> <th width="15%">Status</th> </tr> </thead> <?php if ($tickets == null) { echo "No tickets"; } else { ?> <?php foreach ($tickets as $myTicket) { if ($myTicket == null) { continue; } $domain = Domain::model()->findBySql("SELECT * FROM domain WHERE id=:id", array(":id" => $myTicket->domain_id)); $creator = User::model()->find("id=:id", array(":id" => $myTicket->creator_user_id)); $sub = Subdomain::model()->findByPk($myTicket->subdomain_id); $s = 'N/A'; if ($sub == null) { $s = $sub->name; } ?> <tbody> <tr id="<?php echo $myTicket->id; ?> " class="triggerTicketClick"> <td width="5%"><?php echo $myTicket->id;
/** * Manages all models. */ public function actionAdmin() { $this->layout = ''; $model = new Ticket('search'); $cUser = User::model()->findAllBySql("select id, fname, lname from user where activated = 1 and disable = 0 order by lname"); $data1 = array(); foreach ($cUser as $u) { $data1[$u->id] = $u->fname . ' ' . $u->lname; } $aUser = User::model()->findAllBySql("select id, fname, lname from user where activated = 1 and disable = 0 order by lname"); $data2 = array(); foreach ($aUser as $u) { $data2[$u->id] = $u->fname . ' ' . $u->lname; } $dom = Domain::model()->findAllBySql("select id, name from domain order by name"); $data3 = array(); foreach ($dom as $u) { $data3[$u->id] = $u->name; } $subdom = Subdomain::model()->findAllBySql("select id, name from subdomain order by name"); $data4 = array(); foreach ($subdom as $u) { $data4[$u->id] = $u->name; } $model->unsetAttributes(); // clear any default values if (isset($_GET['Ticket'])) { $model->attributes = $_GET['Ticket']; } $this->render('admin', array('model' => $model, 'data1' => $data1, 'data2' => $data2, 'data3' => $data3, 'data4' => $data4)); }
<div> <?php $domainID = $filter->agregatedDomainID; if (isset($domainID) && $domainID > 0) { $subdomain = SubDomain::model()->findAllByAttributes(array('domain_id' => $domainID)); } else { $subdomain = array(); } echo CHtml::activeLabel($filter, 'subdomainID'); echo CHtml::activeDropDownList($filter, 'subdomainID', CHtml::listData($subdomain, 'id', 'name'), array('empty' => ' ')); ?> </div> <div> <?php echo CHtml::activeLabel($filter, 'exclusiveDomainID'); echo CHtml::activeDropDownList($filter, 'exclusiveDomainID', CHtml::listData(Domain::model()->findAll(), 'id', 'name'), array('empty' => ' ')); ?> </div> <div> <?php echo CHtml::activeLabel($filter, 'assigned_domain_mentor_id'); echo CHtml::activeDropDownList($filter, 'assigned_domain_mentor_id', CHtml::listData(User::model()->findAllDomainMentors(), 'id', 'FullName'), array('empty' => ' ')); ?> </div> <div> <?php echo CHtml::activeLabel($filter, 'assigned_project_id'); echo CHtml::activeDropDownList($filter, 'assigned_project_id', CHtml::listData(Project::model()->findAllProjects(), 'id', 'title'), array('empty' => ' ')); ?> </div> <div>
public function actionEnableDomain($domain, $_output = true) { $result = true; $error = array('code' => 0, 'message' => ''); $dd = DisabledDomain::model()->findByAttributes(array('domain' => $domain)); if (!isset($dd)) { $result = false; $error['code'] = self::ERROR_DOMAIN_NOT_FOUND; $error['message'] = 'Domain not found'; } else { $records = @unserialize($dd->records); if (!is_array($records)) { $result = false; $error['code'] = self::ERROR_RECORD_NOT_FOUND; $error['message'] = 'Cannot recover records'; } else { // Remove fallback records $domain = Domain::model()->findByAttributes(array('name' => $dd->domain)); Record::model()->deleteAllByAttributes(array('domain_id' => $domain->id)); $resp = $this->actionEditBulkRecords($dd->domain, json_encode($records), true, false); if ($resp['result'] === true) { $dd->delete(); } else { $error['code'] = $resp['error_code']; $error['message'] = $resp['error_message']; $result = $resp['result']; } } } $var = array('error_code' => $error['code'], 'error_message' => $error['message'], 'result' => $result); if ($_output) { $this->renderText(CJSON::encode($var)); } return $var; }
<div class="row"> <?php echo "Name: " . $model->name . "\n"; ?> </div> <br/> <div class="row"> <?php echo "Select a Domain*"; ?> </div> <div class="row"> <?php $list = array(); $count = 0; $domains = Domain::model()->findAll(); foreach ($domains as $dom) { $list[$dom->id] = $dom->name; $count = $dom->id; } $count++; $list[$count] = 'New Domain'; echo $form->dropDownList($model, 'Domain', $list, array('prompt' => 'Select')); ?> </div> <div class="row"> <?php echo $form->labelEx($model, 'description'); ?> <?php echo $form->textArea($model, 'description', array('id' => 'description', 'style' => 'width:500px', 'cols' => 110, 'rows' => 5, 'width' => '300px'));
/** * Displays a particular model. * @param integer $id the ID of the model to be displayed */ public function actionView($id) { $subdomain = Subdomain::model()->findByPk($id); $domainName = Domain::model()->findByPk($subdomain->domain_id); $this->render('view', array('model' => $this->loadModel($id), 'domainName' => $domainName)); }