public function NewTicket($subject, $message, $depid, $creatorid, $userid)
 {
     if (strlen($subject) < 3 || strlen($subject) > 255) {
         throw new Exception("ticket's subject too long or too short");
     }
     if (!is_numeric($depid) || !is_numeric($creatorid) || !is_numeric($userid)) {
         throw new Exception("department, creator or user id in wrong format");
     }
     $user = User::getInstance();
     $dep = Department::getInstance();
     $depdata = $dep->FetchData($depid);
     $crdata = $user->FetchData($creatorid);
     $userdata = $user->FetchData($userid);
     if ($userdata['status'] == 'Admin') {
         throw new Exception("Ticket cannot be created for admin");
     } elseif ($depdata['type'] == 'Private') {
         throw new Exception("Users cannot submit tickets to private deprtments");
     }
     $ticket = Ticket::getInstance();
     $tid = $ticket->Create(array('depid' => $depid, 'subject' => $subject, 'userid' => $userid));
     $this->Create($tid, $creatorid, $message);
     return $tid;
 }
Пример #2
0
require_once '../classes/class.smartyclass.php';
$TML = new SmartyClass();
$operator = Operator::getInstance()->GetLoggedOperator();
$threadid = verify_param("thread", "/^\\d{1,8}\$/");
$token = verify_param("token", "/^\\d{1,8}\$/");
$thread = Thread::getInstance()->GetThreadById($threadid);
$visitSession = VisitSession::GetInstance()->GetVisitSessionById($thread['visitsessionid']);
$TML->assign('visit_session', $visitSession);
if (!$thread || !isset($thread['token']) || $token != $thread['token']) {
    die("wrong thread");
}
$nextid = verify_param("nextoperatorid", "/^\\d{1,8}\$/");
$nextdepartmentid = verify_param("nextdepartmentid", "/^\\d{1,8}\$/");
$page = array();
if (!empty($nextid)) {
    $nextOperator = Operator::getInstance()->GetOperatorById($nextid);
    $TML->assign('nextoperator', $nextOperator);
}
if (!empty($nextdepartmentid)) {
    $nextdepartment = Department::getInstance()->getById($nextdepartmentid, Resources::getCurrentLocale());
    $TML->assign('nextdepartment', $nextdepartment);
}
$errors = array();
ThreadProcessor::getInstance()->ProcessThread($threadid, 'redirect', array('nextoperatorid' => $nextid, 'nextdepartmentid' => $nextdepartmentid, 'operator' => Operator::getInstance()->GetLoggedOperator()));
$TML->assign('page_settings', $page);
if (count($errors) > 0) {
    $TML->assign('errors', $errors);
    $TML->display('chat_error.tpl');
} else {
    $TML->display('redirected.tpl');
}
Пример #3
0
 public static function UserAddTicket()
 {
     $xtpl = self::$xtpl;
     $dep = Department::getInstance();
     $xtpl->assign('SUPPCURR', 'current');
     $xtpl->assign('NEWTCURR', 'current');
     $deps = $dep->GetButch("", '`type` = "Public"');
     if (count($deps) < 1) {
         $xtpl->parse('main.addticket.depinfo');
     } else {
         for ($i = 0; $i < count($deps); $i++) {
             $xtpl->assign('DEP', $deps[$i]);
             $xtpl->parse('main.addticket.ticket.deprow');
         }
         $xtpl->parse('main.addticket.ticket');
     }
     $xtpl->parse('main.addticket');
     $xtpl->parse('main');
     $xtpl->out('main');
 }
Пример #4
0
function deleteDepartment()
{
    Department::getInstance()->deleteDepartment($_REQUEST['id']);
    header("Location: " . AdminURL::getInstance()->getURL('departments'));
    exit;
}
Пример #5
0
 case 'delcurr':
     $curr = Currency::getInstance();
     $curr->Delete($_REQUEST['id']);
     Page::ManageCurrencies();
     break;
 case 'delorder':
     if (!is_numeric($_REQUEST['orderid'])) {
         Page::$messages[] = array('type' => 'attention', 'message' => 'Order ID is not set');
     } else {
         $order = Order::getInstance();
         $order->Delete($_REQUEST['orderid']);
         Page::ManageOrders();
     }
     break;
 case 'updatedep':
     $dep = Department::getInstance();
     $dep->id = $_POST['depid'];
     $dep->Update('name', $_POST['depname']);
     $dep->Update('type', $_POST['type']);
     Page::ManageDepartments();
     break;
 case 'updatelangs':
     $lang = Lang::getInstance();
     $lang->UpdateLangs();
     Page::GeneralSettings();
     break;
 case 'updatelang':
     $setting = Settings::getInstance();
     $setting->Update('system.lang.default', $_POST['langcode']);
     Page::GeneralSettings();
     break;