function addmessage() { $clang = Yii::app()->lang; // if (!Permission::model()->hasGlobalPermission('Regions', 'create')) { // Yii::app()->setFlashMessage($clang->gT("You do not have sufficient rights to access this page."), 'error'); // $this->getController()->redirect(array("admin/country/index")); // } $email_to = (int) Yii::app()->request->getPost("email_to"); $subject = flattenText(Yii::app()->request->getPost('subject')); $message = flattenText(Yii::app()->request->getPost('message')); $parent = flattenText(Yii::app()->request->getPost('parent')); $chat = flattenText(Yii::app()->request->getPost('chat')); $aData = array(); $aViewUrls = array(); if (empty($email_to)) { $aViewUrls['message'] = array('title' => $clang->gT("Failed to send message"), 'message' => $clang->gT("Message was not supplied or the Message is invalid."), 'class' => 'warningheader'); } elseif (empty($subject)) { $aViewUrls['message'] = array('title' => $clang->gT("Failed to send message"), 'message' => $clang->gT("Subject was not supplied or the Subject is invalid."), 'class' => 'warningheader'); } elseif (empty($message)) { $aViewUrls['message'] = array('title' => $clang->gT("Failed to send message"), 'message' => $clang->gT("Message was not supplied or the Message is invalid."), 'class' => 'warningheader'); } else { $NewMessage = Supoort_center::model()->instAdminMessage($email_to, $subject, $message, $parent, $chat); if ($NewMessage) { Yii::app()->setFlashMessage($clang->gT("message send successfully")); $this->getController()->redirect(array("admin/message/index")); } else { $aViewUrls['mboxwithredirect'][] = $this->_messageBoxWithRedirect($clang->gT("Failed to send message"), $clang->gT("Error in sending message."), 'warningheader'); } } $this->_renderWrappedTemplate('message', $aViewUrls, $aData); }
<?php } ?> <li> <a href="<?php echo $this->createUrl("admin/message/index"); ?> " > <?php if (Permission::model()->hasGlobalPermission('superadmin', 'read')) { //$msglist = Supoort_center::model()->findAll(array('condition' => 'status = "Unread" and parent = 0'));//Remove $msglist = Supoort_center::model()->findAll(array('condition' => 'status = "Unread"')); //Add } else { //$msglist = Supoort_center::model()->findAll(array('condition' => 'email_to = ' . Yii::app()->session['loginID'] . ' AND status = "Unread and parent = 0"'));//Remove $msglist = Supoort_center::model()->findAll(array('condition' => 'email_to = ' . Yii::app()->session['loginID'] . ' AND status = "Unread"')); //Add } $style = ''; if (count($msglist) > 0) { //$style = 'style="background-color:#ecfbd6;"';//Remove } ?> <img src='<?php echo $sImageURL; ?> my-msg-b.png' <?php echo $style; ?> alt='<?php $clang->eT("Manage Message");
public function support_center() { $clang = $this->getController()->lang; App()->getClientScript()->registerPackage('jqgrid'); $aData['imageurl'] = Yii::app()->getConfig("adminimageurl"); $action = isset($_POST['action']) ? $_POST['action'] : ''; if ($action == 'add') { $email_to = (int) Yii::app()->request->getPost("email_to"); $subject = flattenText(Yii::app()->request->getPost('subject')); $message = flattenText(Yii::app()->request->getPost('message')); $parent = (int) Yii::app()->request->getPost("parent"); if (empty($email_to)) { $message = $clang->gT('Please Select Email To'); App()->user->setFlash('Error', $message); $this->getController()->redirect(array('pl/home/sa/support_center')); } elseif (empty($subject)) { $message = $clang->gT('Email Subject not be Empty'); App()->user->setFlash('Error', $message); $this->getController()->redirect(array('pl/home/sa/support_center')); } elseif (empty($message)) { $message = $clang->gT('Please Provide your Problem'); App()->user->setFlash('Error', $message); $this->getController()->redirect(array('pl/home/sa/support_center')); } else { $NewMessage = Supoort_center::model()->insertTicket($subject, $message, $email_to, $parent); if ($NewMessage) { $message = $clang->gT('Message sent successfully'); App()->user->setFlash('Success', $message); $this->getController()->redirect(array('pl/home/sa/support_center')); } else { $message = $clang->gT('There were Error in message sending'); App()->user->setFlash('Success', $message); $this->getController()->redirect(array('pl/home/sa/support_center')); } } } $this->_renderWrappedTemplate('', 'view_support_center', $aData); }