public function actionViewHistory() { $model = new ApplicationClosed(); $isAdmin = User::isCurrentUserAdmin(); if (!$isAdmin) { $model->user_id = User::getCurrentUserId(); } $this->render('viewhistory', array('model' => $model)); }
public function actionCheckAPIStatus() { if (!User::isCurrentUserAdmin()) { Yii::app()->end(); } $status = ApiStatus::getFirst(); $data = array('status' => $status['status']); echo CJSON::encode($data); }
public function actionCheckNotificationState() { if (User::isCurrentUserAdmin()) { $matchnotification = MatchNotification::model()->findBySql("SELECT * FROM match_notification ORDER BY date_modified DESC limit 1"); $status = array('status' => $matchnotification['status'], 'date_modified' => $matchnotification['date_modified'], 'userid' => $matchnotification['userid']); $user = User::model()->find("id=:id", array(':id' => $matchnotification['userid'])); $status['username'] = $user['username']; echo CJSON::encode($status); } }
<?php /* @var $this DomainSuggestionController */ /* @var $model DomainSuggestion */ /* @var $form CActiveForm */ if (User::isCurrentUserAdmin()) { $this->menu = array(array('label' => 'Manage DomainSuggestion', 'url' => array('admin'))); } ?> <div class="form"> <?php $form = $this->beginWidget('CActiveForm', array('id' => 'domain-suggestion-adminView-form', 'enableAjaxValidation' => false)); ?> <p class="note">Fields with <span class="required">*</span> are required.</p> <?php echo $form->errorSummary($model); ?> <div class="row"> <?php echo "Name: " . $model->name . "\n"; ?> </div> <br/> <div class="row"> <?php echo "Select a Domain*";
$this->endWidget(); ?> </div> <?php } ?> <div id="fullcontent"> <div id="leftside"> <?php if (User::getCurrentUser()->id == $job->FK_poster || User::isCurrentUserAdmin()) { ?> <div id="applicants" style="text-align: left;"> <div class="titlebox">APPLICANTS</div> <div style=clear:both></div> <br> <?php foreach ($job->applications as $application) { ?> <?php $applicant = User::getUser($application->userid); ?> <a style="margin:0px 10px 0px 10px;; display:block" href="/JobFair/index.php/profile/student/user/<?php echo $applicant->username; ?> "> <img src='/JobFair/images/imgs/user-default.png' height="20" width="20"/> <?php
<?php $userinfo = ""; if (!Yii::app()->user->isGuest) { $userinfo = User::model()->findBySql("SELECT fname FROM user WHERE username=:user", array(':user' => Yii::app()->user->name)) . " " . User::model()->findBySql("SELECT lname FROM user WHERE username=:user", array(':user' => Yii::app()->user->name)); } else { $userinfo = "(Guest)"; } $cp = true; if (Yii::app()->user->isGuest) { $cp = false; } // if (User::isCurrentUserMentee()) { // $cp = false; // } $currentUserIsAdmin = User::isCurrentUserAdmin(); $currentUserIsGuest = Yii::app()->user->isGuest; $this->widget('bootstrap.widgets.TbNavbar', array('htmlOptions' => array('class' => 'myNavbar', 'style' => ''), 'type' => 'null', 'items' => array(array('class' => 'bootstrap.widgets.TbMenu', 'htmlOptions' => array('class' => 'pull-right'), 'items' => array('-', array('label' => 'Home', 'url' => array('/'), 'visible' => !$currentUserIsGuest), array('label' => 'Reports', 'visible' => $currentUserIsAdmin, 'class' => 'bootstrap.widgets.TbMenu', 'items' => array('-', array('label' => 'Utilization Dashboard', 'visible' => $currentUserIsAdmin, 'class' => 'bootstrap.widgets.TbMenu', 'url' => array('/utilizationDashboard')), array('label' => 'Mentor', 'visible' => $currentUserIsAdmin, 'class' => 'bootstrap.widgets.TbMenu', 'url' => array('/reportMentor')), array('label' => 'Mentee', 'visible' => $currentUserIsAdmin, 'class' => 'bootstrap.widgets.TbMenu', 'url' => array('/reportMentee')), array('label' => 'Ticket', 'visible' => $currentUserIsAdmin, 'class' => 'bootstrap.widgets.TbMenu', 'url' => array('/reportTicket')), array('label' => 'Frequent Mentee Sub-Domains', 'visible' => $currentUserIsAdmin, 'class' => 'bootstrap.widgets.TbMenu', 'url' => array('/Analytics/PullFrecuentMenteeSubdomains')))), array('label' => 'Video Conf.', 'url' => array('/videoConference'), 'visible' => !$currentUserIsGuest), array('label' => 'Manage', 'visible' => !$currentUserIsGuest && $currentUserIsAdmin, 'class' => 'bootstrap.widgets.TbMenu', 'items' => array('-', array('label' => 'Users', 'visible' => !$currentUserIsGuest, 'class' => 'bootstrap.widgets.TbMenu', 'url' => array('user/admin')), array('label' => 'Projects', 'visible' => !$currentUserIsGuest, 'class' => 'bootstrap.widgets.TbMenu', 'url' => array('project/admin')), array('label' => 'Domains', 'visible' => !$currentUserIsGuest, 'class' => 'bootstrap.widgets.TbMenu', 'url' => array('domain/admin')), array('label' => 'Tickets', 'visible' => !$currentUserIsGuest, 'class' => 'bootstrap.widgets.TbMenu', 'url' => array('ticket/admin')), array('label' => 'Invites', 'visible' => !$currentUserIsGuest, 'class' => 'bootstrap.widgets.TbMenu', 'url' => array('invitation/admin')), array('label' => 'Applications', 'visible' => !$currentUserIsGuest, 'class' => 'bootstrap.widgets.TbMenu', 'url' => array('application/admin')))), array('label' => 'Mentor Apply', 'url' => array('application/portal'), 'visible' => !$currentUserIsGuest), array('label' => 'Search Questions', 'url' => array('/ticket/viewOld'), 'visible' => !$currentUserIsGuest), array('label' => 'Ask Question', 'url' => array('/ticket/create'), 'visible' => !$currentUserIsGuest), array('label' => $userinfo, 'url' => '#', 'items' => array(array('label' => 'My Profile', 'url' => array('profile/userProfile'), 'visible' => !$currentUserIsGuest), array('label' => 'Change Password', 'visible' => $cp, 'url' => '/coplat/index.php/user/ChangePassword'), '----', array('label' => 'Logout (' . Yii::app()->user->name . ')', 'url' => array('/site/logout'), 'visible' => !$currentUserIsGuest), array('label' => 'Login', 'url' => array('/site/login'), 'visible' => $currentUserIsGuest))), array('label' => 'About', 'url' => array('/site/page', 'view' => 'about'))))))); ?> <div class="container" id="page" style="margin-top: 60px"> <?php if (isset($this->breadcrumbs)) { ?> <?php $this->widget('bootstrap.widgets.TbBreadcrumbs', array('links' => $this->breadcrumbs)); ?> <!-- breadcrumbs --> <?php
<?php /** * Created by PhpStorm. * User: lorenzo_mac * Date: 4/9/14 * Time: 2:08 PM */ /* @var $this HomeController */ if (User::isCurrentUserAdmin() == false) { echo "<script> window.location ='userHome' </script>"; } ?> <div xmlns="http://www.w3.org/1999/html"> <div> <h2> <?php echo ucfirst($user->fname); ?> <?php echo ucfirst($user->lname); ?> Dashboard </h2> </div> <br/> <table style="width:auto;"> <tr>
public function actionChange($id) { $model = $this->loadModel($id); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); //$old_mentor = $model->assign_user_id; if (isset($_POST['Ticket']['status'])) { $newStatus = $_POST['Ticket']['status']; $oldStatus = $model->status; //prepare the model according to the status if ($newStatus == 0) { $model->status = Ticket::Status_Close; $model->closed_date = new CDbExpression('NOW()'); } elseif ($newStatus == 1) { $model->status = Ticket::Status_Reject; } //save the canges $saved = true; $trans = Yii::app()->db->beginTransaction(); try { //save the ticket $model->save(); //save the NEW event TicketEvents::recordEvent(EventType::Event_Status_Changed, $model->id, $oldStatus, $model->status, NULL); $trans->commit(); } catch (Exception $e) { $trans->rollback(); Yii::log("Error occurred while saving the ticket or its events. Rolling back... . Failure reason as reported in exception: " . $e->getMessage(), CLogger::LEVEL_ERROR, __METHOD__); $saved = false; } //preparae the routing etc if ($saved) { if (User::isCurrentUserAdmin()) { $response['url'] = "/coplat/index.php/home/adminHome"; } else { $response['url'] = "/coplat/index.php/home/userHome"; } if ($model->status == Ticket::Status_Close) { //mentor notification $mentor_id = $model->assign_user_id; $mentor = User::model()->findByPk($mentor_id); $mentorfullName = $mentor->fname . ' ' . $mentor->lname; User::sendNotification($mentor->email, "Ticket #" . $model->id . " has been closed.", "Ticket #" . $model->id . " has been closed.", $mentorfullName); } elseif ($model->status == Ticket::Status_Reject && !User::isCurrentUserAdmin()) { $this->actionTicketRejectedAdminAlert(User::model()->getCurrentUserId(), $model->id); } } else { $response['url'] = "/coplat/index.php/home/userHome"; } echo json_encode($response); exit; } /* if ($newStatus == 0) { $model->status = 'Close'; $model->closed_date = new CDbExpression('NOW()'); if ($model->save()) { if (User::isCurrentUserAdmin()) { $response['url'] = "/coplat/index.php/home/adminHome"; } else { $response['url'] = "/coplat/index.php/home/userHome"; } //mentor notification $mentor_id = $model->assign_user_id; $mentor = User::model()->findByPk($mentor_id); $mentorfullName = $mentor->fname.' '.$mentor->lname; User::sendNotification( $mentor->email,"Ticket #" . $model->id . " has been closed.", "Ticket #" . $model->id . " has been closed." , $mentorfullName); } else { $response['url'] = "/coplat/index.php/home/userHome"; } echo json_encode($response); exit(); } elseif ($newStatus == 1) { $model->status = 'Reject'; if ($model->save()) { if (User::isCurrentUserAdmin()) { $response['url'] = "/coplat/index.php/home/adminHome"; } else { $this->actionTicketRejectedAdminAlert(User::model()->getCurrentUserId(), $model->id); $response['url'] = "/coplat/index.php/home/userHome"; } } else { $response['url'] = "/coplat/index.php/home/userHome"; } echo json_encode($response); exit(); } }*/ }
</form>'; } else { $home = '/site/index'; } } } ?> <?php $this->widget('bootstrap.widgets.TbNavbar', array('htmlOptions' => array('role' => 'navigation'), 'items' => array(array('class' => 'bootstrap.widgets.TbMenu', 'items' => array(array('label' => 'Home', 'url' => array($home), 'visible' => !Yii::app()->user->isGuest), array('label' => 'Jobs', 'url' => array("/job/home"), 'visible' => User::isCUrrentUserStudent()), array('label' => 'Message', 'url' => array('/message'), 'visible' => !Yii::app()->user->isGuest), array('label' => 'Post Job', 'url' => "#", 'visible' => User::isCurrentUserEmployer()), array('label' => 'SMS', 'url' => array('/SMS/Sendsms'), 'visible' => !Yii::app()->user->isGuest & !User::isCurrentUserAdmin(Yii::app()->user->name)))), $search, array('class' => 'bootstrap.widgets.TbMenu', 'htmlOptions' => array('class' => 'pull-left'), 'items' => array('-', array('label' => '(' . Yii::app()->user->name . ')', 'url' => '#', 'items' => array(array('label' => 'My Profile', 'url' => array($profile), 'visible' => !Yii::app()->user->isGuest & !User::isCurrentUserAdmin(Yii::app()->user->name)), array('label' => 'Merge Accounts', 'visible' => User::isCurrentUserStudent(Yii::app()->user->name), 'url' => '/JobFair/index.php/user/MergeAccounts'), array('label' => 'Change Password', 'visible' => !Yii::app()->user->isGuest, 'url' => '/JobFair/index.php/user/ChangePassword'), '----', array('label' => 'Logout (' . Yii::app()->user->name . ')', 'url' => array('/site/logout'), 'visible' => !Yii::app()->user->isGuest), array('label' => 'Login', 'url' => array('/site/login'), 'visible' => Yii::app()->user->isGuest), array('label' => 'Register', 'url' => array('/user/register'), 'visible' => Yii::app()->user->isGuest)))))))); ?> <div class="container-fluid" id="page"> <?php if (User::isCurrentUserAdmin(Yii::app()->user->name)) { echo "<div class=\"row-fluid\"><div class=\"span3\">"; echo "<div class=\"well sidebar-nav affix\">"; $actionid = $this->getUniqueId() . '/' . $this->getAction()->getId(); $this->widget('bootstrap.widgets.TbMenu', array('type' => 'list', 'items' => array(array('label' => 'ADMINISTRATION'), array('label' => 'Users', 'icon' => 'user', 'url' => $this->createUrl('UserCrud/admin'), 'active' => in_array($actionid, array('userCrud/admin', 'userCrud/update', 'userCrud/index'))), array('label' => 'Skills', 'icon' => 'pencil', 'url' => $this->createUrl('Skillset/admin'), 'active' => in_array($actionid, array('skillset/admin', 'skillset/consolidate', 'skillset/create', 'skillset/update', 'skillset/index'))), array('label' => 'Postings', 'icon' => 'list', 'url' => $this->createUrl('PostingsAdmin/admin'), 'active' => in_array($actionid, array('postingsAdmin/admin', 'postingsAdmin/index'))), array('label' => 'CAREEPATH API'), array('label' => 'Authentication', 'icon' => 'lock', 'url' => $this->createUrl('ApiAuth/index'), 'active' => in_array($actionid, array('apiAuth/index', 'apiAuth/home', 'apiAuth/create', 'apiAuth/update'))), array('label' => 'Import Jobs', 'icon' => 'briefcase', 'url' => $this->createUrl('ApiConfig/home'), 'active' => in_array($actionid, array('apiConfig/home', 'apiConfig/index'))), array('label' => 'NOTIFICATIONS'), array('label' => 'Settings', 'icon' => 'cog', 'url' => $this->createUrl('home/notificationAdmin'), 'active' => in_array($actionid, array('home/notificationAdmin')))))); echo "</div></div>"; echo "<div class=\"span9\">"; // echo $this->getUniqueId() . '<br>'; // echo $this->getAction()->getId(); echo $content; echo "</div>"; echo "</div>"; } else { echo $content; } ?>
?> <?php $projectsByCurrentUser = Project::getMenteeProjects(User::getCurrentUserId()); if (count($projectsByCurrentUser) > 0) { $model->assigned_project_id = $projectsByCurrentUser[0]->id; } echo $form->dropDownList($model, 'assigned_project_id', CHtml::listData($projectsByCurrentUser, 'id', 'title'), array('empty' => ' ')); ?> <?php echo $form->error($model, 'assigned_project_id'); ?> <?php /* If the user if project mentor. He has the option of assign the ticket to another project mentor */ if (User::isCurrentUserProMentor() || User::isCurrentUserAdmin()) { $pmentor = User::model()->findAll("isProMentor=:isProMentor and id!=:id", array(':isProMentor' => 1, ':id' => User::model()->getCurrentUserId())); //select * from user where isProMentor = '1' AND username != 'lsanc104' $data = array(); foreach ($pmentor as $mod) { $data[$mod->id] = $mod->fname . ' ' . $mod->lname; } ?> <?php echo $form->labelEx($model, 'Assign to a Project Mentor (optional)'); ?> <?php echo $form->dropDownList($model, 'assign_user_id', $data, array('prompt' => 'Select')); ?> <?php echo $form->error($model, 'assign_user_id');