Merge remote-tracking branch 'origin/Sada_Faveo'

This commit is contained in:
sujitprasad
2016-02-05 13:34:25 +05:30
188 changed files with 21087 additions and 297 deletions

View File

@@ -27,6 +27,7 @@ use App\Model\helpdesk\Utility\Time_format;
use Illuminate\Http\Request;
use Input;
use Exception;
use DB;
/**
* SettingsController
@@ -54,7 +55,25 @@ class SettingsController extends Controller {
public function settings() {
return view('themes.default1.admin.helpdesk.setting');
}
public function RatingSettings() {
$ratings = DB::table('settings_ratings')->get();
return view('themes.default1.admin.helpdesk.settings.ratings',compact('ratings'));
}
public function PostRatingSettings($slug) {
$name = Input::get('rating_name');
$publish = Input::get('publish');
$modify = Input::get('modify');
DB::table('settings_ratings')->whereSlug($slug)->update(array('rating_name' => $name,'publish' => $publish, 'modify' => $modify));
return redirect()->back()->with('success', 'Successfully updated');
}
public function RatingDelete($slug) {
DB::table('settings_ratings')->whereSlug($slug)->delete();
return redirect()->back()->with('success', 'Successfully Deleted');
}
/**
* @param int $id
* @return Response

View File

@@ -13,6 +13,7 @@ use App\Model\helpdesk\Utility\Languages;
use Illuminate\Http\Request;
use Mail;
use Exception;
use Input;
/**
* TemplateController
@@ -101,6 +102,65 @@ class TemplateController extends Controller {
* @param type Languages $language
* @return type Response
*/
public function listtemplates() {
$path = '../resources/views/emails/';
$templates = scandir($path);
$directory = str_replace('/', '-', $path);
return view('themes.default1.admin.helpdesk.emails.template.listtemplates', compact('templates','directory'));
}
public function readtemplate($template,$path) {
$directory = str_replace('-', '/', $path);
$directory2 = $directory.$template;
if (is_dir($directory2)) {
$templates = scandir($directory2);
$directory = str_replace('/', '-', $directory2.'/');
return view('themes.default1.admin.helpdesk.emails.template.listtemplates', compact('templates','directory'));
}
else {
$handle = fopen($directory.$template, "r");
$contents = fread($handle, filesize($directory.$template));
fclose($handle);
}
return view('themes.default1.admin.helpdesk.emails.template.readtemplates', compact('contents','template','path'));
}
public function createtemplate() {
$directory = '../resources/views/emails/';
$fname = Input::get('folder_name');
$filename = $directory.$fname;
// images folder creation using php
// $mydir = dirname( __FILE__ )."/html/images";
// if(!is_dir($mydir)){
// mkdir("html/images");
// }
// Move all images files
if(!file_exists($filename)) {
mkdir($filename,0777);
}
$files = array_filter(scandir($directory.'default'));
foreach($files as $file){
if ($file === '.' or $file === '..') continue;
if(!is_dir($file)) {
// $file_to_go = str_replace("code/resources/views/emails/",'code/resources/views/emails/'.$fname,$file);
$destination = $directory.$fname.'/';
copy($directory.'default/'.$file, $destination.$file);
}
}
return \Redirect::back()->with('success', 'Successfully copied');
}
public function writetemplate($template,$path) {
$directory = str_replace('-', '/', $path);
$b = Input::get('templatedata');
file_put_contents($directory.$template, print_r($b, true));
return \Redirect::back()->with('success', 'Successfully updated');
}
public function edit($id, Template $template, Languages $language) {
try {
$templates = $template->whereId($id)->first();

View File

@@ -59,51 +59,47 @@ class DashboardController extends Controller {
* Fetching dashboard graph data to implement graph
* @return type Json
*/
public function ChartData()
public function ChartData($date111 = "",$date122 = "")
{
// $date11 = strtotime(\Input::get('start_date'));
// $date12 = strtotime(\Input::get('end_date'));
// if($date11 && $date12){
// $date2 = $date12;
// $date1 = $date11;
// } else {
$date11 = strtotime($date122);
$date12 = strtotime($date111);
if($date11 && $date12){
$date2 = $date12;
$date1 = $date11;
} else {
// generating current date
$date2 = strtotime(Date('Y-m-d'));
$date3 = Date('Y-m-d');
$format = 'Y-m-d';
// generating a date range of 1 month
$date1 = strtotime(Date($format,strtotime('-1 month'. $date3)));
// }
}
$return = "";
$last = "";
for ( $i = $date1; $i <= $date2; $i = $i + 86400 ) {
$thisDate = date( 'Y-m-d', $i );
$created = \DB::table('tickets')->select('created_at')->where('created_at','LIKE','%'.$thisDate.'%')->count();
$closed = \DB::table('tickets')->select('closed_at')->where('closed_at','LIKE','%'.$thisDate.'%')->count();
$reopened = \DB::table('tickets')->select('reopened_at')->where('reopened_at','LIKE','%'.$thisDate.'%')->count();
$value = ['date' => $thisDate, 'open' => $created, 'closed' => $closed, 'reopened' => $reopened];
$array = array_map('htmlentities',$value);
$json = html_entity_decode(json_encode($array));
$return .= $json.',';
}
$last = rtrim($return,',');
$return = "";
$last = "";
// fetching dashboard data for each day on a 1 month fixed range
// this range can also be fetched on a requested rannge of date
for ( $i = $date1; $i <= $date2; $i = $i + 86400 ) {
$thisDate = date( 'Y-m-d', $i );
// created tickets
$created = \DB::table('tickets')->select('created_at')->where('created_at','LIKE','%'.$thisDate.'%')->count();
// closed tickets
$closed = \DB::table('tickets')->select('closed_at')->where('closed_at','LIKE','%'.$thisDate.'%')->count();
// reopened tickets
$reopened = \DB::table('tickets')->select('reopened_at')->where('reopened_at','LIKE','%'.$thisDate.'%')->count();
// storing in array format
$value = ['date' => $thisDate, 'open' => $created, 'closed' => $closed, 'reopened' => $reopened];
$array = array_map('htmlentities',$value);
// encoding the values in jsom format
$json = html_entity_decode(json_encode($array));
$return .= $json.',';
}
// combining all the values in a single variable and returning that variable in Json.
$last = rtrim($return,',');
return '['.$last.']';
return '['.$last.']';
// $ticketlist = DB::table('tickets')
// ->select(DB::raw('MONTH(updated_at) as month'),DB::raw('SUM(CASE WHEN status = 3 THEN 1 ELSE 0 END) as closed'),DB::raw('SUM(CASE WHEN status = 2 THEN 1 ELSE 0 END) as reopened'),DB::raw('SUM(CASE WHEN status = 1 THEN 1 ELSE 0 END) as open'),DB::raw('SUM(CASE WHEN status = 5 THEN 1 ELSE 0 END) as deleted'),
// DB::raw('count(*) as totaltickets'))
// ->groupBy('month')
// ->orderBy('month', 'asc')
// ->get();
// return $ticketlist;
}

View File

@@ -20,7 +20,7 @@ use App\Model\helpdesk\Ticket\Tickets;
use PhpImap\Mailbox as ImapMailbox;
use PhpImap\IncomingMail;
use PhpImap\IncomingMailAttachment;
use \ForceUTF8\Encoding;
use ForceUTF8\Encoding;
use App;
use DB;
use Crypt;
@@ -28,7 +28,9 @@ use Schedule;
use File;
use Artisan;
use Exception;
use Phpmailer\PHPMailerautoload;
//$root = realpath($_SERVER["DOCUMENT_ROOT"]);
//include_once($root.'\vendor\phpmailer\phpmailer\PHPMailerautoload.php');
/**
* MailController
*
@@ -51,6 +53,8 @@ class MailController extends Controller {
* Reademails
* @return type
*/
public function readmails(Emails $emails, Email $settings_email, System $system)
{
// $path_url = $system->first()->url;

View File

@@ -2182,5 +2182,15 @@ class TicketController extends Controller {
return view('themes.default1.agent.helpdesk.dept-ticket.inprogress',compact('id'));
}
}
public function rating($id,$rating) {
Tickets::where('id', $id)->update(array('rating' => $rating));
return redirect()->back()->with('Success','Thank you for your rating!');
}
public function ratingReply($id,$rating) {
Tickets::where('id', $id)->update(array('ratingreply' => $rating));
return redirect()->back()->with('Success','Thank you for your rating!');
}
}

View File

@@ -18,6 +18,7 @@ use Mail;
use Auth;
use Exception;
/**
* ---------------------------------------------------
* AuthController
@@ -103,7 +104,8 @@ class AuthController extends Controller {
});
return redirect('home')->with('success', 'Activate Your Account ! Click on Link that send to your mail');
}
/**
* Get mail function
* @param type $token

View File

@@ -0,0 +1,119 @@
<?php
namespace App\Http\Controllers;
use App\Http\Requests;
use App\Http\Controllers\Controller;
use Phpmailer\PHPMailerautoload;
use Illuminate\Http\Request;
class PhpMailController extends Controller {
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index() {
//
}
/**
* Sending emails from the system.
*
* @return Mail
*/
public function sendmail($host = '', $username = '', $password = '', $smtpsecure = '', $port = '', $from = '', $recipants = '', $subject = '', $body = '', $cc = '', $bc = '') {
$mail = new \PHPMailer;
//$mail->SMTPDebug = 3; // Enable verbose debug output
$mail->isSMTP(); // Set mailer to use SMTP
$mail->Host = 'smtp.gmail.com'; // Specify main and backup SMTP servers
$mail->SMTPAuth = true; // Enable SMTP authentication
$mail->Username = 'sujitprasad4567@gmail.com'; // SMTP username
$mail->Password = 'pankajprasad22.'; // SMTP password
$mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted
$mail->Port = 587; // TCP port to connect to
$mail->setFrom('sujitprasad4567@gmail.com', 'Mailer');
$mail->addAddress('sada059@gmail.com', 'Joe User'); // Add a recipient
// Name is optional
$mail->addReplyTo('sada059@gmail.com', 'Information');
// Optional name
$mail->isHTML(true); // Set email format to HTML
$mail->Subject = 'Here is the subject';
$mail->Body = 'This is the HTML message body <b>in bold!</b>';
$mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
if (!$mail->send()) {
echo 'Message could not be sent.';
echo 'Mailer Error: ' . $mail->ErrorInfo;
} else {
echo 'Message has been sent';
}
}
/**
* Show the form for creating a new resource.
*
* @return Response
*/
public function create() {
//
}
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store() {
//
}
/**
* Display the specified resource.
*
* @param int $id
* @return Response
*/
public function show($id) {
//
}
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return Response
*/
public function edit($id) {
//
}
/**
* Update the specified resource in storage.
*
* @param int $id
* @return Response
*/
public function update($id) {
//
}
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return Response
*/
public function destroy($id) {
//
}
}