コード例 #1
0
 public function actionGetRemarlList($id, $num, $flag = 0)
 {
     $result = array();
     $results = TicketChangeLog::model()->getRemarkList($id, $num);
     foreach ($results as $r) {
         $result[] = array("id" => $r['id'], "status_name" => TicketStatus::model()->getStatusName($r['status_id']), "remark" => $r['remark'], "user_name" => Users::model()->getUserName($r['user_id']), 'created_date' => date('d M Y @ g:i A', strtotime($r['created_date'])));
     }
     if ($flag == 0) {
         echo json_encode($result);
     } else {
         return $result;
     }
 }
コード例 #2
0
 function getRemarkList($ticket_id, $id = 0)
 {
     //$connection = Yii::app()->db;
     //$command = $connection->createCommand('SELECT * FROM  ticketChangeLog where ticket_id=' . $ticket_id . ' AND  id  > ' . $id);
     //$results = $command->queryAll();
     $results = TicketChangeLog::model()->findAllByAttributes(array("ticket_id" => $ticket_id), array('condition' => 'id > :id', 'params' => array('id' => $id), 'order' => 'id DESC'));
     return $results;
 }
コード例 #3
0
ファイル: AppController.php プロジェクト: bhaiyyalal/testcode
 function actionEmailChangeTicketStatus()
 {
     $template = Template::getTemplate('ticket_status_changed_mail_template_');
     $subject = $template->template_subject;
     $message = $template->template_content;
     $results = TicketChangeLog::model()->findAllByAttributes(array(), array('condition' => 'send_mail = :send_mail', 'params' => array('send_mail' => 0)));
     foreach ($results as $users) {
         $userdata['user_by'] = Users::model()->getUserName($users->user_id);
         $userInfo = Users::model()->findByPk($user->fwd_to);
         $ticket_id = $users->ticket_id;
         $remark = $users->remark;
         $userdata['user_by'] = Users::model()->getUserName($users->user_id);
         $userdata['remark'] = $remark;
         $userdata['ticket_status_name'] = TicketStatus::model()->getStatusName($users->status_id);
         $userdata['ticket_id'] = $ticket_id;
         $userdata['ticket_link'] = Utils::getBaseUrl() . "/ticket/view/" . base64_encode($ticket_id);
         $assignee = TicketAssign::model()->findAllByAttributes(array(), array('condition' => 'ticket_id = :ticket_id AND fwd_to !=:user_id AND status=1 ', 'params' => array('ticket_id' => $ticket_id, user_id => $users->user_id)));
         $assigneeby = TicketAssign::model()->findAllByAttributes(array(), array('condition' => 'ticket_id = :ticket_id AND fwd_by !=:user_id AND status=1 ', 'params' => array('ticket_id' => $ticket_id, user_id => $users->user_id), 'group' => "fwd_by"));
         // For Assignee mail
         foreach ($assignee as $user) {
             $userInfo = Users::model()->findByPk($user->fwd_to);
             $userdata['user_name'] = $userInfo->user_name;
             $subject = $this->replace($userdata, $subject);
             $message = $this->replace($userdata, $message);
             $this->SendMail($userInfo->user_email, $userInfo->user_name, $subject, $message);
         }
         // this is fowwarded by
         foreach ($assigneeby as $user) {
             $userInfo = Users::model()->findByPk($user->fwd_by);
             $userdata['user_name'] = $userInfo->user_name;
             $subject = $this->replace($userdata, $subject);
             $message = $this->replace($userdata, $message);
             $this->SendMail($userInfo->user_email, $userInfo->user_name, $subject, $message);
         }
         $model = TicketChangeLog::model()->findByPk($users->id);
         $model->send_mail = 1;
         $model->update();
     }
 }