function resend_all_passwords() { $this->loadTicket(); $email = $this->ticket->email; $tickets = new SupportTickets(); $tickets->limitstart = 0; $tickets->limit = 500; $tickets->loadTicketsByQuery(array("t.email = '{$email}'"), "lastupdate DESC"); FSS_EMail::User_Unreg_Passwords($tickets->tickets); $link = FSSRoute::_("index.php?option=com_fss&view=admin_support&layout=ticket&ticketid=" . $this->ticket->id, false); JFactory::getApplication()->redirect($link, JText::_("PASSWORDS_FOR_ALL_THIS_USERS_TICKETS_HAVE_BEEN_SENT")); return false; }
public function actionComment() { if (!isset($_GET['id'])) { throw new CHttpException(500, "Ломаешь?"); } /** * @var $model SupportTickets */ $model = SupportTickets::model()->findByAttributes(["userId" => Yii::app()->user->id, "id" => $_GET['id']]); if (!$model) { throw new CHttpException(404, "Не найдено"); } if (Yii::app()->request->isPostRequest) { if (isset($_POST['content']) && isset($_POST['toClose'])) { if ($_POST['toClose'] == 1) { $model->status = 2; } else { $model->status = 0; } $model->save(); $m2 = new SupportTicketsComments(); $m2->ticketId = $model->id; $m2->userId = Yii::app()->user->id; $m2->datePosted = time(); $m2->isAnswer = 0; $m2->content = $_POST['content']; $m2->save(); $this->redirect($this->createUrl("list")); } else { $this->redirect($this->createUrl("view", ["id" => $model->id])); } } }
function delete() { // load in tickets to do $ticketid = FSS_Input::getInt('ticketid'); $tickets = FSS_Input::getCmd('tickets'); $def_archive = FSS_Ticket_Helper::GetStatusID('def_archive'); if ($ticketid > 0) { $ticket = new SupportTicket(); if ($ticket->load($ticketid)) { $ticket->delete(); } } else { if ($tickets != '') { $tickets = new SupportTickets(); $tickets->limitstart = 0; $tickets->limit = 100; $tickets->loadTicketsByStatus($tickets); foreach ($tickets->tickets as $ticket) { $ticket->delete(); } } } JFactory::getApplication()->redirect($_SERVER['HTTP_REFERER']); }
function init() { $user = JFactory::getUser(); $this->userid = $user->get('id'); $this->model = $this->getModel("admin_support"); if (!FSS_Permission::auth("fss.handler", "com_fss.support_admin")) { return FSS_Admin_Helper::NoPerm(); } $this->def_open = FSS_Ticket_Helper::GetStatusID('def_open'); $this->ticket_view = FSS_Input::getCmd('tickets', $this->def_open); $this->count = SupportTickets::getTicketCount(); FSS_Helper::StylesAndJS(array('calendar', 'base64')); if (Task_Helper::HandleTasks($this)) { return false; } return true; }
public function actionComment() { if (!isset($_GET['id'])) { throw new CHttpException(500, "Ломаешь?"); } /** * @var $model SupportTickets */ $model = SupportTickets::model()->findByPk($_GET['id']); if (!$model) { throw new CHttpException(404, "Не найдено"); } if (Yii::app()->request->isPostRequest) { if (isset($_POST['content']) && isset($_POST['toClose'])) { if ($_POST['toClose'] == 1) { $model->status = 2; } else { $model->status = 1; } $model->save(); $m2 = new SupportTicketsComments(); $m2->ticketId = $model->id; $m2->userId = Yii::app()->user->id; $m2->datePosted = time(); $m2->isAnswer = 1; $m2->content = $_POST['content']; $m2->save(); Yii::import('ext.yii-mail.*'); $message = new YiiMailMessage(); $message->view = 'supportNewReply'; $message->setSubject('Тикет #' . $model->id . " - Новый ответ"); $message->setBody(array('model' => $model), 'text/html'); $message->setTo($model->user->email); $message->from = array(Yii::app()->params['adminEmail'] => 'Crystal Reality Games'); Yii::app()->mail->send($message); $this->redirect($this->createUrl("index")); } else { $this->redirect($this->createUrl("view", ["id" => $model->id])); } } }
* @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html **/ defined('_JEXEC') or die; require_once JPATH_SITE . DS . 'components' . DS . 'com_fss' . DS . 'helper' . DS . 'translate.php'; require_once JPATH_SITE . DS . 'components' . DS . 'com_fss' . DS . 'helper' . DS . 'support_tickets.php'; require_once JPATH_SITE . DS . 'components' . DS . 'com_fss' . DS . 'helper' . DS . 'support_source.php'; ?> <?php echo FSS_Helper::PageSubTitle("<a href='" . FSSRoute::_('index.php?option=com_fss&view=admin_support') . "'><img src='" . JURI::root(true) . "/components/com_fss/assets/images/support/support_24.png'> " . JText::_("SUPPORT_TICKETS") . "</a>", false); ?> <ul> <?php FSS_Ticket_Helper::GetStatusList(); $counts = SupportTickets::getTicketCount(); FSS_Translate_Helper::Tr(FSS_Ticket_Helper::$status_list); foreach (FSS_Ticket_Helper::$status_list as $status) { if ($status->def_archive) { continue; } if ($status->is_closed) { continue; } if (!array_key_exists($status->id, $counts)) { continue; } if ($counts[$status->id] < 1) { continue; } echo "<li>" . $status->title . ": <b>" . $counts[$status->id] . "</b> - <a href='" . FSSRoute::_('index.php?option=com_fss&view=admin_support&tickets=' . $status->id) . "'>" . JText::_("VIEW_NOW") . "</a></li>";
?> <?php if (FSS_Permission::CanModerate() && !$params->get('hide_moderate')) { ?> <h4><?php echo JText::_("SUPPORT_TICKETS"); ?> </h4> <?php } ?> <ul> <?php FSS_Ticket_Helper::GetStatusList(); $counts = SupportTickets::getTicketCount(true, $tickets_user_only); FSS_Translate_Helper::Tr(FSS_Ticket_Helper::$status_list); foreach (FSS_Ticket_Helper::$status_list as $status) { //if (!$tickets_archived_status && $status->def_archive) continue; if (!$tickets_closed_status && $status->is_closed) { continue; } if (!array_key_exists($status->id, $counts)) { continue; } if ($counts[$status->id] < 1) { continue; } ?> <li class="fss_module_support_item"> <a href="<?php
<ul class="dropdown-menu extended inbox"> <li> <p> <?php if ($count > 0) { echo $count . " " . AlexBond::doPlural($count, "запрос требует", "запроса требуют", "запросов требуют") . " ответа"; } else { echo "Пока все хорошо."; } ?> </p> </li> <li> <ul class="dropdown-menu-list scroller" style="height: 250px;"> <?php $last = SupportTickets::model()->findAll(['order' => 'status ASC, dateCreated ASC', 'limit' => 10]); if ($last) { foreach ($last as $item) { ?> <li> <a href="<?php echo $this->createUrl("/support/support/view", ["id" => $item->id]); ?> "> <span class="photo"><?php echo Users::model()->getAvatar($item->user->username, 40); ?> </span> <span class="subject"> <span class="from"><?php
function Unreg_Passlist() { $email = FSS_Input::getEMail('email'); if ($email == "") { $email = FSS_Input::getEMail('reference'); } $tickets = new SupportTickets(); $tickets->limitstart = 0; $tickets->limit = 500; $tickets->loadTicketsByQuery(array("t.email = '{$email}'"), "lastupdate DESC"); if ($tickets->ticket_count > 0) { FSS_EMail::User_Unreg_Passwords($tickets->tickets); $link = FSSRoute::_("index.php?option=com_fss&view=ticket", false); JFactory::getApplication()->redirect($link, JText::sprintf("A_LIST_OF_YOUR_TICKETS_AND_PASSWORDS_HAS_BEEN_SENT_TO_YOU", $email)); } else { $link = FSSRoute::_("index.php?option=com_fss&view=ticket", false); JFactory::getApplication()->redirect($link, JText::sprintf("UNABLE_TO_FIND_ANY_TICKETS_FOR_EMAIL", $email)); } }
static function &getTicketCount($foradmin = true, $current_handler_only = false) { $key = 0; if ($foradmin) { $key += 1; } if ($current_handler_only) { $key += 2; } if (empty(self::$counts)) { self::$counts = array(); } if (!array_key_exists($key, self::$counts)) { $db = JFactory::getDBO(); $query = "SELECT count( * ) AS count, ticket_status_id FROM #__fss_ticket_ticket as t WHERE 1 "; $query .= " AND " . SupportUsers::getAdminWhere(); if ($foradmin) { $query .= " AND " . SupportSource::admin_list_sql(); } else { $query .= " AND " . SupportSource::user_list_sql(); } if ($current_handler_only) { $query .= " AND admin_id = " . JFactory::getUser()->id; } $query .= " GROUP BY ticket_status_id"; $db->setQuery($query); $rows = $db->loadAssocList(); $out = array(); FSS_Ticket_Helper::GetStatusList(); foreach (FSS_Ticket_Helper::$status_list as $status) { $out[$status->id] = 0; } if (count($rows) > 0) { foreach ($rows as $row) { $out[$row['ticket_status_id']] = $row['count']; } } // work out counts for allopen, closed, all, archived $archived = FSS_Ticket_Helper::GetStatusID("def_archive"); $out['archived'] = 0; if (array_key_exists($archived, $out)) { $out['archived'] = $out[$archived]; } $allopen = FSS_Ticket_Helper::GetStatusIDs("is_closed", true); $out['allopen'] = 0; foreach ($allopen as $id) { if (array_key_exists($id, $out)) { $out['allopen'] += $out[$id]; } } $allclosed = FSS_Ticket_Helper::GetClosedStatus(); $out['allclosed'] = 0; foreach ($allclosed as $id) { if (array_key_exists($id, $out)) { $out['allclosed'] += $out[$id]; } } $all = FSS_Ticket_Helper::GetStatusIDs("def_archive", true); $out['all'] = 0; foreach ($all as $id) { if (array_key_exists($id, $out)) { $out['all'] += $out[$id]; } } self::$counts[$key] = $out; } return self::$counts[$key]; }
"> Просмотреть всех <i class="m-fa fa-swapright m-fa fa-white"></i> </a> </div> </div> </div> <div class="row"> <div class="col-lg-4 col-md-4 col-sm-6 col-xs-12"> <div class="dashboard-stat blue"> <div class="visual"> <i class="fa fa-comments"></i> </div> <div class="details"> <div class="number"> <?php echo SupportTickets::model()->getCountNeedAnswer(); ?> </div> <div class="desc"> Новых запросов в СТП </div> </div> <a class="more" href="<?php echo $this->createUrl("/support/support/index"); ?> "> Просмотреть запросы <i class="m-fa fa-swapright m-fa fa-white"></i> </a> </div> </div> <div class="col-lg-4 col-md-4 col-sm-6 col-xs-12">
static function parseRedirectType($status, $type) { $ticketid = FSS_Input::getInt('ticketid'); $ticket = new SupportTicket(); if (!$ticket->load($ticketid)) { $ticketid = 0; } if ($type == "" && $ticketid > 0) { return FSSRoute::_('index.php?option=com_fss&view=admin_support&layout=ticket&ticketid=' . FSS_Input::getInt('ticketid'), false); } $bits = explode("_", $type); // 2nd parameter of type is the status, so if current, use the status that has been passed in if ($bits[1] == "current") { $bits[1] = $status; } if (count($bits) != 2) { if ($ticketid > 0) { return FSSRoute::_('index.php?option=com_fss&view=admin_support&layout=ticket&ticketid=' . FSS_Input::getInt('ticketid'), false); } else { return FSSRoute::_('index.php?option=com_fss&view=admin_support', false); } } if ($bits[0] == "list") { return FSSRoute::_('index.php?option=com_fss&view=admin_support&tickets=' . $bits[1], false); } if ($bits[0] == "new" || $bits[0] == "old") { // get current tickets for the current handler of a specific type JRequest::setVar('tickets', $bits[1]); $tickets = new SupportTickets(); $tickets->limitstart = 0; $tickets->limit = 500; $tickets->loadTicketsByStatus($bits[1]); $oldest_time = time(); $oldest_id = -1; $newest_time = 0; $newset_id = -1; foreach ($tickets->tickets as $ticket) { $updated = strtotime($ticket->lastupdate); if ($updated > $newest_time) { $newest_time = $updated; $newset_id = $ticket->id; } if ($updated < $oldest_time) { $oldest_time = $updated; $oldest_id = $ticket->id; } } if ($bits[0] == "new" && $newset_id > 0) { return FSSRoute::_('index.php?option=com_fss&view=admin_support&layout=ticket&ticketid=' . $newset_id, false); } if ($bits[0] == "old" && $oldest_id > 0) { return FSSRoute::_('index.php?option=com_fss&view=admin_support&layout=ticket&ticketid=' . $oldest_id, false); } return FSSRoute::_('index.php?option=com_fss&view=admin_support&tickets=' . $bits[1], false); } if ($ticketid > 0) { return FSSRoute::_('index.php?option=com_fss&view=admin_support&layout=ticket&ticketid=' . FSS_Input::getInt('ticketid')); } return FSSRoute::_('index.php?option=com_fss&view=admin_support', false); }