$service = $data['service']; $message = strip_tags($message); if (!$id) { $apiresults = array("result" => "error", "message" => "Ticket ID Not Found"); return null; } if ($userid) { $result2 = select_query("tblclients", "", array("id" => $userid)); $data = mysql_fetch_array($result2); $name = $data['firstname'] . " " . $data['lastname']; if ($data['companyname']) { $name .= " (" . $data['companyname'] . ")"; } $email = $data['email']; } $apiresults = array("result" => "success", "ticketid" => $id, "tid" => $tid, "c" => $c, "deptid" => $deptid, "deptname" => getDepartmentName($deptid), "userid" => $userid, "name" => $name, "email" => $email, "cc" => $cc, "date" => $date, "subject" => $subject, "status" => $status, "priority" => $priority, "admin" => $admin, "lastreply" => $lastreply, "flag" => $flag, "service" => $service); $first_reply = array("userid" => $userid, "name" => $name, "email" => $email, "date" => $date, "message" => $message, "attachment" => $attachment, "admin" => $admin); $sortorder = $_REQUEST['repliessort'] ? $_REQUEST['repliessort'] : "ASC"; if ($sortorder == "ASC") { $apiresults['replies']['reply'][] = $first_reply; } $result = select_query("tblticketreplies", "", array("tid" => $id), "id", $sortorder); while ($data = mysql_fetch_array($result)) { $userid = $data['userid']; $name = $data['name']; $email = $data['email']; $date = $data['date']; $message = $data['message']; $attachment = $data['attachment']; $admin = $data['admin']; $rating = $data['rating'];
function AddReply($ticketid, $userid, $contactid, $message, $admin, $attachfile = "", $from = "", $status = "", $noemail = "", $api = false) { global $CONFIG; if ($admin) { $data = get_query_vals("tbltickets", "userid,contactid,name,email", array("id" => $ticketid)); if (0 < $data['userid']) { if (0 < $data['contactid']) { $data = get_query_vals("tblcontacts", "firstname,lastname,email", array("id" => $data['contactid'], "userid" => $data['userid'])); } else { $data = get_query_vals("tblclients", "firstname,lastname,email", array("id" => $data['userid'])); } $message = str_replace("[NAME]", $data['firstname'] . " " . $data['lastname'], $message); $message = str_replace("[FIRSTNAME]", $data['firstname'], $message); $message = str_replace("[EMAIL]", $data['email'], $message); } else { $message = str_replace("[NAME]", $data['name'], $message); $message = str_replace("[FIRSTNAME]", current(explode(" ", $data['name'])), $message); $message = str_replace("[EMAIL]", $data['email'], $message); } if (!function_exists("getAdminName")) { require ROOTDIR . "/includes/adminfunctions.php"; } $adminname = $api ? $admin : getAdminName(); } $table = "tblticketreplies"; $array = array("tid" => $ticketid, "userid" => $userid, "contactid" => $contactid, "name" => $from['name'], "email" => $from['email'], "date" => "now()", "message" => $message, "admin" => $adminname, "attachment" => $attachfile); $ticketreplyid = insert_query($table, $array); $result = select_query("tbltickets", "tid,did,title,urgency,flag", array("id" => $ticketid)); $data = mysql_fetch_array($result); $tid = $data['tid']; $deptid = $data['did']; $tickettitle = $data['title']; $urgency = $data['urgency']; $flagadmin = $data['flag']; if ($userid) { $result = select_query("tblclients", "firstname,lastname", array("id" => $userid)); $data = mysql_fetch_array($result); $clientname = $data['firstname'] . " " . $data['lastname']; } else { $clientname = $from['name']; } $deptname = getDepartmentName($deptid); if ($admin) { if ($status == "") { $status = "Answered"; } $updateqry = array("status" => $status, "clientunread" => "1", "lastreply" => "now()"); if ($CONFIG['TicketLastReplyUpdateClientOnly']) { unset($updateqry['lastreply']); } update_query("tbltickets", $updateqry, array("id" => $ticketid)); addTicketLog($ticketid, "New Ticket Response"); if (!$noemail) { sendMessage("Support Ticket Reply", $ticketid, $ticketreplyid); } run_hook("TicketAdminReply", array("ticketid" => $ticketid, "replyid" => $ticketreplyid, "deptid" => $deptid, "deptname" => $deptname, "subject" => $tickettitle, "message" => $message, "priority" => $urgency, "admin" => $adminname, "status" => $status)); return null; } $status = "Customer-Reply"; update_query("tbltickets", array("status" => "Customer-Reply", "clientunread" => "1", "adminunread" => "", "lastreply" => "now()"), array("id" => $ticketid)); addTicketLog($ticketid, "New Ticket Response made by User"); if ($flagadmin) { sendAdminMessage("Support Ticket Response", array("ticket_id" => $ticketid, "ticket_tid" => $tid, "client_id" => $userid, "client_name" => $clientname, "ticket_department" => $deptname, "ticket_subject" => $tickettitle, "ticket_priority" => $urgency, "ticket_message" => ticketMessageFormat($message)), "support", "", $flagadmin); } else { if (!$noemail) { sendAdminMessage("Support Ticket Response", array("ticket_id" => $ticketid, "ticket_tid" => $tid, "client_id" => $userid, "client_name" => $clientname, "ticket_department" => $deptname, "ticket_subject" => $tickettitle, "ticket_priority" => $urgency, "ticket_message" => ticketMessageFormat($message)), "support", $deptid, "", true); } } run_hook("TicketUserReply", array("ticketid" => $ticketid, "replyid" => $ticketreplyid, "userid" => $userid, "deptid" => $deptid, "deptname" => $deptname, "subject" => $tickettitle, "message" => $message, "priority" => $urgency, "status" => $status)); }
if ($access) { exit; } $message = strip_tags($message); $message = nl2br($message); $message = ticketAutoHyperlinks($message); if ($pauserid != "0000000000") { $result = select_query("tblclients", "", array("id" => $pauserid)); $data = mysql_fetch_array($result); $firstname = $data['firstname']; $lastname = $data['lastname']; $clientinfo = "<a href=\"clientsprofile.php?userid=" . $puserid . "\">" . $firstname . " " . $lastname . "</a>"; } else { $clientinfo = $aInt->lang("support", "notregclient"); } $department = getDepartmentName($deptid); if ($lastreply == "") { $lastreply = $date; } $date = fromMySQLDate($date, "time"); $lastreply = fromMySQLDate($lastreply, "time"); $outstatus = getStatusColour($tstatus); ob_start(); echo "\n<p><b>"; echo $title; echo "</b></p>\n\n<p><b><i>"; echo $aInt->lang("support", "ticketid"); echo ":</i></b> "; echo $tid; echo "<br>\n<b><i>"; echo $aInt->lang("support", "department");
$var_emailfooter = $row["vLookUpValue"]; break; case "Emailheader": $var_emailheader = $row["vLookUpValue"]; break; case "AutoLock": $var_autoclock = $row["vLookUpValue"]; break; } } } mysql_free_result($result); $var_mail_body = $var_emailheader . "<br>" . TEXT_MAIL_START . ", <br>" . ($var_mail_body .= TEXT_A_NEW_KB_ENTRY_POSTED . "<br>"); $var_mail_body .= TEXT_DETAILS_FOLLOW . "<br>"; $var_mail_body .= "<br>"; $var_mail_body .= TEXT_DEPARTMENT . ": " . htmlentities(getDepartmentName($var_departmentid)) . "<br>"; $var_mail_body .= TEXT_ENTRY_TITLE . ": " . htmlentities($var_kbtitle) . "<br>"; $var_mail_body .= "<br>"; $var_mail_body .= "<br>" . TEXT_THANKS . "<br>" . htmlentities($var_helpdesktitle) . "<br>" . $var_emailfooter; $var_subject = TEXT_A_NEW_KB_ENTRY_POSTED; $var_body = $var_mail_body; $headers = "From: {$var_fromName} <{$var_fromMail}>\n"; $headers .= "Reply-To: {$var_replyName} <{$var_replyMail}>\n"; $headers .= "MIME-Version: 1.0\n"; $headers .= "Content-type: text/html; charset=iso-8859-1\r\n"; // it is for smtp mail sending if ($_SESSION["sess_smtpsettings"] == 1) { $var_smtpserver = $_SESSION["sess_smtpserver"]; $var_port = $_SESSION["sess_smtpport"]; SMTPMail($var_fromMail, $emailstonotify, $var_smtpserver, $var_port, $var_subject, $var_body); } else {
echo $row["vRefNo"] . "<br>" . $lastanswerd; ?> </td> <td width="20%"> <?php echo htmlentities(getStaffName($row["nStaffId"])); ?> </td> <td width="10%"> <?php echo htmlentities(getDepartmentName($row["nCurDeptId"])); ?> </td> <td width="10%"> <?php echo htmlentities(getDepartmentName($row["nPrevDeptId"])); ?> </td> <td width="15%"> <?php echo htmlentities($row["vStatus"]); ?> </td> <td width="20%"> <?php echo date("m-d-Y h:i:s A", strtotime($row["dDate"])); ?> </td> </tr> <?php $count++;
$var_emailheader = $row["vLookUpValue"]; break; case "AutoLock": $var_autoclock = $row["vLookUpValue"]; break; case "HelpdeskTitle": $var_helpdesktitle = $row["vLookUpValue"]; break; } } } mysql_free_result($result); $var_mail_body = $var_emailheader . "<br>" . TEXT_MAIL_START . ", <br>" . ($var_mail_body .= TEXT_A_NEW_KB_ENTRY_POSTED . "<br>"); $var_mail_body .= TEXT_DETAILS_FOLLOW . "<br>"; $var_mail_body .= "<br>"; $var_mail_body .= TEXT_DEPARTMENT . ": " . stripslashes(getDepartmentName($var_departmentid)) . "<br>"; $var_mail_body .= TEXT_ENTRY_TITLE . ": " . stripslashes($var_kbtitle) . "<br>"; $var_mail_body .= "<br>"; $var_mail_body .= "<br>" . TEXT_THANKS . "<br>" . stripslashes($var_helpdesktitle) . "<br>" . $var_emailfooter; $var_subject = TEXT_A_NEW_KB_ENTRY_POSTED; $var_body = $var_mail_body; $headers = "From: {$var_fromName} <{$var_fromMail}>\n"; $headers .= "Reply-To: {$var_replyName} <{$var_replyMail}>\n"; $headers .= "MIME-Version: 1.0\n"; $headers .= "Content-type: text/html; charset=iso-8859-1\r\n"; // it is for smtp mail sending if ($_SESSION["sess_smtpsettings"] == 1) { $var_smtpserver = $_SESSION["sess_smtpserver"]; $var_port = $_SESSION["sess_smtpport"]; SMTPMail($var_fromMail, $emailstonotify, $var_smtpserver, $var_port, $var_subject, $var_body); } else {
} if ($flagto) { $updateqry['flag'] = $flagto; sendAdminMessage("Support Ticket Flagged", array("ticket_id" => $ticketid, "ticket_tid" => $tickettid, "client_id" => $ticketuserid, "client_name" => get_query_val("tblclients", "CONCAT(firstname,' ',lastname)", array("id" => $ticketuserid)), "ticket_department" => getDepartmentName($newdepartment ? $newdepartment : $ticketdeptid), "ticket_subject" => $ticketsubject, "ticket_priority" => $newpriority ? $newpriority : $ticketpriority, "ticket_message" => ticketMessageFormat($ticketmsg)), "support", $newdepartment ? $newdepartment : $ticketdeptid, $flagto); } if (count($updateqry)) { update_query("tbltickets", $updateqry, array("id" => $ticketid)); } if ($notify) { $notify = explode(",", $notify); if (in_array("all", $notify)) { sendAdminMessage("Escalation Rule Notification", array("rule_name" => $name, "ticket_id" => $ticketid, "ticket_tid" => $tickettid, "client_id" => $ticketuserid, "client_name" => get_query_val("tblclients", "CONCAT(firstname,' ',lastname)", array("id" => $ticketuserid)), "ticket_department" => getDepartmentName($newdepartment ? $newdepartment : $ticketdeptid), "ticket_subject" => $ticketsubject, "ticket_priority" => $newpriority ? $newpriority : $ticketpriority, "ticket_message" => ticketMessageFormat($ticketmsg)), "support", $newdepartment ? $newdepartment : $ticketdeptid); } foreach ($notify as $notifyid) { if (is_numeric($notifyid)) { sendAdminMessage("Escalation Rule Notification", array("rule_name" => $name, "ticket_id" => $ticketid, "ticket_tid" => $tickettid, "client_id" => $ticketuserid, "client_name" => get_query_val("tblclients", "CONCAT(firstname,' ',lastname)", array("id" => $ticketuserid)), "ticket_department" => getDepartmentName($newdepartment ? $newdepartment : $ticketdeptid), "ticket_subject" => $ticketsubject, "ticket_priority" => $newpriority ? $newpriority : $ticketpriority, "ticket_message" => ticketMessageFormat($ticketmsg), "ticket_status" => $ticketstatus), "support", "", $notifyid); continue; } } } if ($addreply) { if (!$newstatus) { $newstatus = $ticketstatus; } AddReply($ticketid, "", "", $addreply, "System", "", "", $newstatus, "", true); } } } update_query("tblconfiguration", array("value" => date("Y-m-d H:i:s")), array("setting" => "TicketEscalationLastRun")); exit; }
<?php require_once '/home/limtu/www/scripts/includes/path_list.inc.php'; include LIST_MODEL; // модель для извлечения списка записей БД include GRID_FUNC; // передача списка кафедр в выпадающий список на форме if (isset($_GET['departmentName']) && $_SERVER['HTTP_X_REQUESTED_WITH'] && !empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') { $response = getDepartmentName(); echo $response; } if (isset($_GET['student'])) { // если выбирается пункт "список студентов" из меню // если Ajax-запрос, то передаём данные в контроллер if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && !empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') { $gridParam = getGridParam(); // передаём данные от модели в $response $response = getStudentList($gridParam['page'], $gridParam['limit'], $gridParam['sidx'], $gridParam['sord']); echo $response; } else { // иначе первичное обращение к контроллеру => загружаем шаблон include STUDENT_LIST_TPL; } } if (isset($_GET['teacher'])) { if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && !empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') { $gridParam = getGridParam(); $response = getTeacherList($gridParam['page'], $gridParam['limit'], $gridParam['sidx'], $gridParam['sord']); echo $response; } else { include TEACHER_LIST_TPL;
function queryFaculty($d, $p, $s) { $d = getDepartmentName($d); //$d = text($d); $p = getFPositionName($p); //$p = text($p); attempt_connection('nits_recruitment'); if ($d == "" && $p == "") { $query = "SELECT * FROM `user_info` JOIN user_other_details ON user_info.id=user_other_details.id WHERE user_other_details.submitted='" . $s . "'"; $result = mysql_query($query) or die(mysql_error()); } elseif ($d == "" && $p != "") { $query = "SELECT * FROM `user_info` JOIN user_other_details ON user_info.id=user_other_details.id WHERE user_info.faculty_pos='" . $p . "' AND user_other_details.submitted='" . $s . "' ORDER BY user_info.id"; $result = mysql_query($query) or die(mysql_error()); } elseif ($d != "" && $p == "") { $query = "SELECT * FROM `user_info` JOIN user_other_details ON user_info.id=user_other_details.id WHERE user_info.department='" . $d . "' AND user_other_details.submitted='" . $s . "' ORDER BY user_info.id"; $result = mysql_query($query) or die(mysql_error()); } elseif ($d != "" && $p != "") { $query = "SELECT * FROM `user_info` JOIN user_other_details ON user_info.id=user_other_details.id WHERE user_info.department='" . $d . "' AND user_info.faculty_pos='" . $p . "' AND user_other_details.submitted='" . $s . "' ORDER BY user_info.id"; $result = mysql_query($query) or die(mysql_error()); } ?> <b>Total No. of Applications : <u><?php echo mysql_num_rows($result); ?> </u></b><br/> <table border=1> <tr> <th>ID</th><th>Reg ID</th><th>Applicant Name</th><th>Department</th><th>Position</th><th>View Form</th><th>Certificates (Only Uploaded files)</th> </tr> <?php while ($val = mysql_fetch_array($result)) { ?> <tr> <td><?php echo $val['id']; ?> </td><td><?php echo $val['reg_id']; ?> </td><td><?php echo $val['name_applicant']; ?> </td><td><?php echo $val['department']; ?> </td><td><?php echo $val['faculty_pos']; ?> </td><td><a href="view_faculty.php?id=<?php echo $val['id']; ?> ">Click Here</a></td><td><a href="cert_faculty.php?rid=<?php echo $val['reg_id']; ?> ">CLICK HERE</a></td> </tr> <?php } }