public function actionViewHistory()
 {
     $model = new ApplicationClosed();
     $isAdmin = User::isCurrentUserAdmin();
     if (!$isAdmin) {
         $model->user_id = User::getCurrentUserId();
     }
     $this->render('viewhistory', array('model' => $model));
 }
 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new DomainSuggestion();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['DomainSuggestion'])) {
         $model->attributes = $_POST['DomainSuggestion'];
         $model->creator_user_id = User::getCurrentUserId();
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->suggestion_id));
         }
     }
     $this->render('create', array('model' => $model));
 }
Пример #3
0
    <br/>
    <?php 
    if (User::isCurrentUserDomMentor()) {
        ?>
        <h3>Assigned Questions</h3> <br/>
        <?php 
        $model3 = Ticket::model();
        $AssignedTabs = array('tab4' => array('title' => "Open", 'content' => $this->widget('zii.widgets.grid.CGridView', array('id' => 'Assigned_tickets', 'dataProvider' => $model3->searchAssigned(User::getCurrentUserId()), 'columns' => array(array('name' => 'created_date', 'value' => '$data->getCreatedDateToString()'), 'subject', array('name' => 'Last Activity', 'value' => '$data->getLatestActivityDate()'), array('name' => 'Priority', 'value' => '$data->getPriorityString()'), array('class' => 'CButtonColumn', 'template' => '{view}', 'buttons' => array('view' => array('url' => 'Yii::app()->createUrl("ticket/view", array("id"=>$data->id))'))))), true)), 'tab3' => array('title' => "Closed", 'content' => $this->widget('zii.widgets.grid.CGridView', array('id' => 'Assigned_Closed_tickets', 'dataProvider' => $model3->searchAssignedClosed(User::getCurrentUserId()), 'columns' => array(array('name' => 'created_date', 'value' => '$data->getCreatedDateToString()'), 'subject', array('name' => 'Last Activity', 'value' => '$data->getLatestActivityDate()'), array('name' => 'Priority', 'value' => '$data->getPriorityString()'), array('class' => 'CButtonColumn', 'template' => '{view}', 'buttons' => array('view' => array('url' => 'Yii::app()->createUrl("ticket/view", array("id"=>$data->id))'))))), true)));
        $this->widget('CTabView', array('tabs' => $AssignedTabs));
    }
    ?>
     <br/>
    <h3>Upcoming Meetings</h3>
    <?php 
    $model2 = VideoConference::model();
    $this->widget('zii.widgets.grid.CGridView', array('id' => 'upcomingVc', 'dataProvider' => $model2->searchUpcoming(User::getCurrentUserId()), 'columns' => array('subject', array('name' => 'scheduled_for', 'value' => '$data->getDateToString()'), array('class' => 'CButtonColumn', 'template' => '{view}', 'buttons' => array('view' => array('url' => 'Yii::app()->createAbsoluteUrl("videoConference/join/".$data->id, array(), "https")'))))));
    ?>

        <div class="span2" style="margin-left: 30px">
            <!-- Cancel Button -->
            <table>
                <tr>

                </tr>
                <tr>
                    <td>
                        <br>
                    </td>
                </tr>
            </table>
<?php

/**
 * Created by PhpStorm.
 * User: Mandy
 * Date: 7/13/15
 * Time: 7:24 PM
 */
?>

<?php 
/* @var $this VideoConferenceController */
/* @var $model VideoConference */
$this->breadcrumbs = array('Video Conferences' => array('index'));
$this->menu = array(array('label' => 'List VideoConference', 'url' => array('index')), array('label' => 'Create VideoConference', 'url' => array('create')));
Yii::app()->clientScript->registerScript('search', "\n\$('.search-button').click(function(){\n\t\$('.search-form').toggle();\n\treturn false;\n});\n\$('.search-form form').submit(function(){\n\t\$('#video-conference-grid').yiiGridView('update', {\n\t\tdata: \$(this).serialize()\n\t});\n\treturn false;\n});\n");
?>

<h2>Deleted Video Conferences</h2>

<?php 
$this->widget('zii.widgets.grid.CGridView', array('id' => 'video-conference-grid', 'dataProvider' => $model->searchDeleted(User::getCurrentUserId()), 'filter' => $model, 'columns' => array('subject', array('name' => 'moderatorName', 'value' => '($data->getVCModerator())', 'header' => 'Moderator', 'filter' => CHtml::activeTextField($model, 'moderatorName')), 'scheduled_on', 'scheduled_for', 'notes', array('class' => 'CButtonColumn'))));
?>

 public static function recordEvent($event_type_id, $ticket_id, $old_value, $new_value, $comment)
 {
     $resEvent = NULL;
     $newEvent = new TicketEvents();
     //Some validation first
     if (!isset($event_type_id)) {
         throw new CException("Event Type required when loggin ticket events.");
     }
     if (!isset($ticket_id)) {
         throw new CException("Ticket ID required when loggin ticket events.");
     }
     //Collect and prepare the data
     $newEvent->event_type_id = $event_type_id;
     $newEvent->ticket_id = $ticket_id;
     $newEvent->event_recorded_date = new CDbExpression('NOW()');
     $newEvent->old_value = $old_value;
     $newEvent->new_value = $new_value;
     $newEvent->comment = $comment;
     $newEvent->event_performed_by_user_id = User::getCurrentUserId();
     //if save susscessfully, just return the new event
     if ($newEvent->save()) {
         $resEvent = $newEvent;
     }
     return $resEvent;
 }
 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));
 }
 /**
  * Updates a particular model.
  * If update is successful, the browser will be redirected to the 'view' page.
  * @param integer $id the ID of the model to be updated
  */
 public function actionUpdate($id)
 {
     $model = $this->loadModel($id);
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Invitation'])) {
         $model->attributes = $_POST['Invitation'];
         $model->administrator_user_id = (int) User::getCurrentUserId();
         $model->date = date('Y-m-d H:i:s');
         if ($model->save()) {
             User::sendInvitationEmail($model);
         }
         $this->redirect(array('admin', 'id' => $model->id));
     }
     $this->render('update', array('model' => $model));
 }
 public function actionEscalate($id)
 {
     $model = $this->loadModel($id);
     $modelNew = new Ticket();
     $modelNew->creator_user_id = User::getCurrentUserId();
     $modelNew->status = 'Pending';
     $modelNew->created_date = new CDbExpression('NOW()');
     $modelNew->subject = $model->subject;
     $modelNew->description = $model->description;
     $modelNew->domain_id = $model->domain_id;
     $modelNew->subdomain_id = $model->subdomain_id;
     $modelNew->file = $model->file;
     $modelNew->priority_id = $model->priority_id;
     $modelNew->isEscalated = 1;
     $modelNew->assigned_date = new CDbExpression('NOW()');
     /* Get the current date and time */
     /*Assign the ticket to the most appropiate Domain mentor in tier2*/
     $sub = true;
     if ($model->subdomain_id == null) {
         $sub = false;
     }
     if (!$sub) {
         $modelNew->assign_user_id = User::escalateTicket($model->domain_id, $sub);
     } else {
         $modelNew->assign_user_id = User::escalateTicket($model->subdomain_id, $sub);
     }
     $saved = true;
     $trans = Yii::app()->db->beginTransaction();
     try {
         $saved = $modelNew->save();
         $sql = 'INSERT INTO comment(description, added_date, ticket_id, user_added) SELECT description, added_date,' . $modelNew->id . ', user_added FROM comment WHERE ticket_id =' . $model->id;
         $command = Yii::app()->db->createCommand($sql);
         $command->execute();
         //generate the escalated events
         TicketEvents::recordEvent(EventType::Event_Escalated_To, $model->id, NULL, $modelNew->id, NULL);
         //generate the new event
         TicketEvents::recordEvent(EventType::Event_New, $modelNew->id, NULL, NULL, NULL);
         //generate the escalated events
         TicketEvents::recordEvent(EventType::Event_Escalated_From, $modelNew->id, $model->id, NULL, 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;
     }
     //$send = $modelNew->isNewRecord;
     if ($saved) {
         /*If save if true send Notification the the Domain Mentor who was assigned the ticket */
         // if($send)
         User::sendTicketAssignedEmailNotification($modelNew->creator_user_id, $modelNew->assign_user_id, $modelNew->domain_id, $modelNew->id);
         // $this->redirect(array('view', 'id' => $modelNew->id));
         //copy all the comments from the old ticket to the new ticket
         //this has been substituted here for a change of status
         /*  $sql2 = 'INSERT INTO comment(description, added_date, ticket_id, user_added) VALUES ("Ticket ' . $model->id . ' was escalated to ticket '. $modelNew->id . '" , ' . $modelNew->created_date. ',' . $model->id . ', "System")';
                     $command2 = Yii::app()->db->createCommand($sql2);
                     $command2->execute();
         
                     $sql3 = 'INSERT INTO comment(description, added_date, ticket_id, user_added) VALUES ("Ticket ' . $model->id . ' was escalated to ticket '. $modelNew->id . '" , ' . $modelNew->created_date. ',' . $modelNew->id . ', "System")';
                     $command3 = Yii::app()->db->createCommand($sql3);
                     $command3->execute();*/
         $response = array();
         $response['url'] = "/coplat/index.php/home/userHome";
         echo json_encode($response);
         exit;
     }
 }
Пример #9
0
                <input style ="display:none" type = "text" id = "domain_id" value='<?php 
/*echo $model->domain_id;*/
?>
'</input>
                <input style ="display:none" type = "text" id = "subdomain_id" value='<?php 
/*echo $model->subdomain_id; */
?>
'</input>
                <input style ="display:none" type = "text" id = "file" value='<?php 
/*echo $model->file;*/
?>
'</input> -->
        <?php 
//Logic to identified is a subdomain is being specified
if (User::isCurrentUserAdmin()) {
    $userDomain = User::model()->findAllBySql("SELECT * FROM user WHERE activated =:activated and (isAdmin =:isAdmin or isDomMentor=:isDomMentor and id!=:userid)", array(':activated' => 1, ':isAdmin' => 1, ':isDomMentor' => 1, ':userid' => User::getCurrentUserId()));
} else {
    $userDomain = User::model()->findAllBySql("Select * from user where id = 22");
}
$data = array();
//tito
foreach ($userDomain as $mod) {
    $data[$mod->id] = $mod->fname . ' ' . $mod->lname;
}
?>
        <?php 
echo $form->labelEx($mod, 'Domain Mentor');
?>
        <?php 
echo $form->dropDownList($model, 'assign_user_id', $data, array('prompt' => 'Select'));
?>
Пример #10
0
    ?>
            <?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) {