update v1.0.7.9 R.C.

This is a Release Candidate. We are still testing.
This commit is contained in:
Sujit Prasad
2016-08-03 20:04:36 +05:30
parent 8b6b924d09
commit ffa56a43cb
3830 changed files with 181529 additions and 495353 deletions

View File

@@ -33,16 +33,15 @@ use Redirect;
*
* @author Ladybird <info@ladybirdweb.com>
*/
class FormController extends Controller
{
class FormController extends Controller {
/**
* Create a new controller instance.
* Constructor to check.
*
* @return void
*/
public function __construct(TicketWorkflowController $TicketWorkflowController)
{
public function __construct(TicketWorkflowController $TicketWorkflowController) {
$this->middleware('board');
// creating a TicketController instance
$this->TicketWorkflowController = $TicketWorkflowController;
@@ -55,18 +54,21 @@ class FormController extends Controller
*
* @return type
*/
public function getForm(Help_topic $topic, CountryCode $code)
{
public function getForm(Help_topic $topic, CountryCode $code) {
if (\Config::get('database.install') == '%0%') {
return \Redirect::route('license');
return \Redirect::route('licence');
}
$location = GeoIP::getLocation('');
$phonecode = $code->where('iso', '=', $location['isoCode'])->first();
if (System::first()->status == 1) {
$topics = $topic->get();
$codes = $code->get();
return view('themes.default1.client.helpdesk.form', compact('topics', 'codes'))->with('phonecode', $phonecode->phonecode);
if ($phonecode->phonecode) {
$phonecode = $phonecode->phonecode;
} else {
$phonecode = "";
}
return view('themes.default1.client.helpdesk.form', compact('topics', 'codes'))->with('phonecode', $phonecode);
} else {
return \Redirect::route('home');
}
@@ -80,46 +82,46 @@ class FormController extends Controller
*
* @return type string
*/
public function postForm($id, Help_topic $topic)
{
public function postForm($id, Help_topic $topic) {
if ($id != 0) {
$helptopic = $topic->where('id', '=', $id)->first();
$custom_form = $helptopic->custom_form;
$values = Fields::where('forms_id', '=', $custom_form)->get();
if (!$values) {
}
if ($values) {
foreach ($values as $value) {
if ($value->type == 'select') {
$data = $value->value;
$value = explode(',', $data);
echo '<select class="form-control">';
foreach ($value as $option) {
echo '<option>'.$option.'</option>';
foreach ($values as $form_data) {
if ($form_data->type == "select") {
$form_fields = explode(',', $form_data->value);
$var = "";
foreach ($form_fields as $form_field) {
$var .= '<option value="' . $form_field . '">' . $form_field . '</option>';
}
echo '</select></br>';
} elseif ($value->type == 'radio') {
$type2 = $value->value;
$val = explode(',', $type2);
echo '<label class="radio-inline">'.$value->label.'</label>&nbsp&nbsp&nbsp<input type="'.$value->type.'" name="'.$value->name.'">&nbsp;&nbsp;'.$val[0].'
&nbsp&nbsp&nbsp<input type="'.$value->type.'" name="'.$value->name.'">&nbsp;&nbsp;'.$val[1].'</br>';
} elseif ($value->type == 'textarea') {
$type3 = $value->value;
$v = explode(',', $type3);
//dd($v);
if (array_key_exists(1, $v)) {
echo '<label>'.$value->label.'</label></br><textarea class=form-control rows="'.$v[0].'" cols="'.$v[1].'"></textarea></br>';
} else {
echo '<label>'.$value->label.'</label></br><textarea class=form-control rows="10" cols="60"></textarea></br>';
echo '<br/><label>' . ucfirst($form_data->label) . '</label><select class="form-control" name="' . $form_data->name . '">' . $var . '</select>';
} elseif ($form_data->type == "radio") {
$type2 = $form_data->value;
$vals = explode(',', $type2);
echo '<br/><label>' . ucfirst($form_data->label) . '</label><br/>';
foreach ($vals as $val) {
echo '<input type="' . $form_data->type . '" name="' . $form_data->name . '"> ' . $val . '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
}
echo "<br/>";
} elseif ($form_data->type == "textarea") {
$type3 = $form_data->value;
echo '<br/><label>' . $form_data->label . '</label></br><textarea id="unique-textarea" name="' . $form_data->name . '" class="form-control" style="height:15%;"></textarea>';
} elseif ($form_data->type == "checkbox") {
$type4 = $form_data->value;
$checks = explode(',', $type4);
echo '<br/><label>' . ucfirst($form_data->label) . '</label><br/>';
foreach ($checks as $check) {
echo '<input type="' . $form_data->type . '" name="' . $form_data->name . '">&nbsp&nbsp' . $check;
}
} elseif ($value->type == 'checkbox') {
$type4 = $value->value;
$check = explode(',', $type4);
echo '<label class="radio-inline">'.$value->label.'&nbsp&nbsp&nbsp<input type="'.$value->type.'" name="'.$value->name.'">&nbsp&nbsp'.$check[0].'</label><label class="radio-inline"><input type="'.$value->type.'" name="'.$value->name.'">&nbsp&nbsp'.$check[1].'</label></br>';
} else {
echo '<label>'.$value->label.'</label><input type="'.$value->type.'" class="form-control" name="'.$value->name.'" /></br>';
echo '<br/><label>' . ucfirst($form_data->label) . '</label><input type="' . $form_data->type . '" class="form-control" name="' . $form_data->name . '" />';
}
}
echo '<br/><br/>';
}
} else {
return;
@@ -132,8 +134,7 @@ class FormController extends Controller
* @param type Request $request
* @param type User $user
*/
public function postedForm(User $user, ClientRequest $request, Ticket $ticket_settings, Ticket_source $ticket_source, Ticket_attachments $ta, CountryCode $code)
{
public function postedForm(User $user, ClientRequest $request, Ticket $ticket_settings, Ticket_source $ticket_source, Ticket_attachments $ta, CountryCode $code) {
$form_extras = $request->except('Name', 'Phone', 'Email', 'Subject', 'Details', 'helptopic', '_wysihtml5_mode', '_token');
$name = $request->input('Name');
@@ -142,12 +143,16 @@ class FormController extends Controller
$subject = $request->input('Subject');
$details = $request->input('Details');
$phonecode = $request->input('Code');
$System = System::where('id', '=', 1)->first();
$departments = Department::where('id', '=', $System->department)->first();
$department = $departments->id;
$mobile_number = $request->input('Mobile');
$status = $ticket_settings->first()->status;
$helptopic = $ticket_settings->first()->help_topic;
$helptopic = $request->input('helptopic');
$helpTopicObj = Help_topic::where('id','=', $helptopic);
if($helpTopicObj->exists() && ($helpTopicObj->value('status')==1)){
$department = $helpTopicObj->value('department');
}else{
$defaultHelpTopicID = Ticket::where('id', '=', '1')->first()->help_topic;
$department = Help_topic::where('id','=', $defaultHelpTopicID)->value('department');
}
$sla = $ticket_settings->first()->sla;
$priority = $ticket_settings->first()->priority;
$source = $ticket_source->where('name', '=', 'web')->first()->id;
@@ -161,8 +166,8 @@ class FormController extends Controller
$geoipcode = $code->where('iso', '=', $location['isoCode'])->first();
if ($phonecode == null) {
$data = [
'fails' => Lang::get('lang.country-code-required-error'),
'phonecode' => $geoipcode->phonecode,
'fails' => Lang::get('lang.country-code-required-error'),
'phonecode' => $geoipcode->phonecode,
'country_code_error' => 1,
];
@@ -171,8 +176,8 @@ class FormController extends Controller
$code = CountryCode::select('phonecode')->where('phonecode', '=', $phonecode)->get();
if (!count($code)) {
$data = [
'fails' => Lang::get('lang.incorrect-country-code-error'),
'phonecode' => $geoipcode->phonecode,
'fails' => Lang::get('lang.incorrect-country-code-error'),
'phonecode' => $geoipcode->phonecode,
'country_code_error' => 1,
];
@@ -197,9 +202,10 @@ class FormController extends Controller
}
}
}
return Redirect::back()->with('success', Lang::get('lang.Ticket-has-been-created-successfully-your-ticket-number-is').' '.$result[0].'. '.Lang::get('lang.Please-save-this-for-future-reference'));
// dd($result);
return Redirect::back()->with('success', Lang::get('lang.Ticket-has-been-created-successfully-your-ticket-number-is') . ' ' . $result[0] . '. ' . Lang::get('lang.Please-save-this-for-future-reference'));
}
// dd($result);
}
/**
@@ -209,14 +215,13 @@ class FormController extends Controller
*
* @return type view
*/
public function post_ticket_reply($id, Request $request)
{
public function post_ticket_reply($id, Request $request) {
try {
if ($comment != null) {
$tickets = Tickets::where('id', '=', $id)->first();
$thread = Ticket_Thread::where('ticket_id', '=', $tickets->id)->first();
$subject = $thread->title.'[#'.$tickets->ticket_number.']';
$subject = $thread->title . '[#' . $tickets->ticket_number . ']';
$body = $request->input('comment');
$user_cred = User::where('id', '=', $tickets->user_id)->first();
@@ -248,29 +253,24 @@ class FormController extends Controller
} catch (Exception $e) {
return \Redirect::back()->with('fails1', $e->getMessage());
}
//
// $comment = $request->input('comment');
// if ($comment != null) {
// $tickets = Tickets::where('id', '=', $id)->first();
// $threads = new Ticket_Thread();
// $tickets->closed_at = null;
// $tickets->closed = 0;
// $tickets->reopened_at = date('Y-m-d H:i:s');
// $tickets->reopened = 1;
// $threads->user_id = $tickets->user_id;
// $threads->ticket_id = $tickets->id;
// $threads->poster = 'client';
// $threads->body = $comment;
// try {
// $threads->save();
// $tickets->save();
//
// return \Redirect::back()->with('success1', Lang::get('lang.successfully_replied'));
// } catch (Exception $e) {
// return \Redirect::back()->with('fails1', $e->getMessage());
// }
// } else {
// return \Redirect::back()->with('fails1', Lang::get('lang.please_fill_some_data'));
// }
}
}
public function getCustomForm(Request $request) {
$html = "";
$helptopic_id = $request->input('helptopic');
$helptopics = new Help_topic();
$helptopic = $helptopics->find($helptopic_id);
if (!$helptopic) {
throw new Exception("We can not find your request");
}
$custom_form = $helptopic->custom_form;
if ($custom_form) {
$fields = new Fields();
$forms = new \App\Model\helpdesk\Form\Forms();
$form_controller = new \App\Http\Controllers\Admin\helpdesk\FormController($fields, $forms);
$html = $form_controller->renderForm($custom_form);
}
return $html;
}
}

View File

@@ -16,6 +16,7 @@ use App\Model\helpdesk\Settings\System;
use App\Model\helpdesk\Ticket\Ticket_Thread;
use App\Model\helpdesk\Ticket\Tickets;
use App\Model\helpdesk\Utility\CountryCode;
use App\Model\helpdesk\Settings\CommonSettings;
use App\User;
use Auth;
// classes
@@ -76,18 +77,18 @@ class GuestController extends Controller
if ($user->profile_pic == 'avatar5.png' || $user->profile_pic == 'avatar2.png') {
if ($request->input('gender') == 1) {
$name = 'avatar5.png';
$destinationPath = 'lb-faveo/media/profilepic';
$destinationPath = 'uploads/profilepic';
$user->profile_pic = $name;
} elseif ($request->input('gender') == 0) {
$name = 'avatar2.png';
$destinationPath = 'lb-faveo/media/profilepic';
$destinationPath = 'uploads/profilepic';
$user->profile_pic = $name;
}
}
if (Input::file('profile_pic')) {
//$extension = Input::file('profile_pic')->getClientOriginalExtension();
$name = Input::file('profile_pic')->getClientOriginalName();
$destinationPath = 'lb-faveo/media/profilepic';
$destinationPath = 'uploads/profilepic';
$fileName = rand(0000, 9999).'.'.$name;
//echo $fileName;
Input::file('profile_pic')->move($destinationPath, $fileName);
@@ -138,7 +139,7 @@ class GuestController extends Controller
public function getForm(Help_topic $topic)
{
if (\Config::get('database.install') == '%0%') {
return \Redirect::route('license');
return \Redirect::route('licence');
}
if (System::first()->status == 1) {
$topics = $topic->get();
@@ -316,11 +317,13 @@ class GuestController extends Controller
*
* @return type
*/
public function get_ticket_email($id)
public function get_ticket_email($id, CommonSettings $common_settings)
{
$id1 = \Crypt::decrypt($id);
return view('themes.default1.client.helpdesk.ckeckticket', compact('id'));
$common_setting = $common_settings->select('status')
->where('option_name', '=', 'user_set_ticket_status')
->first();
return view('themes.default1.client.helpdesk.ckeckticket', compact('id', 'common_setting'));
}
/**

View File

@@ -279,7 +279,7 @@ class UnAuthController extends Controller
return Lang::get('lang.your_ticket_has_been').' '.$ticket_status->state;
}
//Auto-close tickets
//Auto-close tickets
public function autoCloseTickets()
{
$workflow = \App\Model\helpdesk\Workflow\WorkflowClose::whereId(1)->first();

View File

@@ -19,7 +19,7 @@ class WelcomepageController extends Controller
{
public function __construct()
{
// $this->middleware('board');
// $this->middleware('board');
}
/**

View File

@@ -24,18 +24,10 @@ use Lang;
use Mail;
use Redirect;
class UserController extends Controller
{
public function __construct()
{
class UserController extends Controller {
public function __construct() {
$this->middleware('board');
//$this->middleware('auth');
//SettingsController::language();
// $this->port();
// $this->host();
// $this->password();
// $this->encryption();
// $this->email();
}
/**
@@ -43,23 +35,16 @@ class UserController extends Controller
*
* @return response
*/
public function getArticle(Article $article, Category $category, Settings $settings)
{
$settings = $settings->first();
$pagination = $settings->pagination;
if (Auth::check()) {
if (\Auth::user()->role == 'user') {
$article = $article->where('status', '1');
}
} else {
public function getArticle(Article $article, Category $category, Settings $settings) {
$setting = $settings->first();
$pagination = $setting->pagination;
if (\Auth::user()->role == 'user' || !Auth::check()) {
$article = $article->where('status', '1');
}
$article = $article->where('type', '1');
$article = $article->paginate($pagination);
// dd($article);
$article->setPath('article-list');
$categorys = $category->get();
// $time = $this->timezone($utc);
return view('themes.default1.client.kb.article-list.articles', compact('time', 'categorys', 'article'));
}
@@ -72,8 +57,7 @@ class UserController extends Controller
*
* @return string excerpt
*/
public static function getExcerpt($str, $startPos = 0, $maxLength = 50)
{
public static function getExcerpt($str, $startPos = 0, $maxLength = 50) {
if (strlen($str) > $maxLength) {
$excerpt = substr($str, $startPos, $maxLength - 3);
$lastSpace = strrpos($excerpt, ' ');
@@ -96,14 +80,13 @@ class UserController extends Controller
*
* @return type view
*/
public function search(SearchRequest $request, Category $category, Article $article, Settings $settings)
{
public function search(SearchRequest $request, Category $category, Article $article, Settings $settings) {
$settings = $settings->first();
$pagination = $settings->pagination;
$search = $request->input('s');
$result = $article->where('name', 'LIKE', '%'.$search.'%')
->orWhere('slug', 'LIKE', '%'.$search.'%')
->orWhere('description', 'LIKE', '%'.$search.'%')
$result = $article->where('name', 'LIKE', '%' . $search . '%')
->orWhere('slug', 'LIKE', '%' . $search . '%')
->orWhere('description', 'LIKE', '%' . $search . '%')
->paginate($pagination);
$result->setPath('search');
$categorys = $category->get();
@@ -116,34 +99,31 @@ class UserController extends Controller
*
* @return response
*/
public function show($slug, Article $article, Category $category)
{
public function show($slug, Article $article, Category $category) {
//ArticleController::timezone();
$tz = \App\Model\helpdesk\Settings\System::where('id', '1')->first()->time_zone;
$tz = \App\Model\helpdesk\Utility\Timezones::where('id', $tz)->first()->name;
date_default_timezone_set($tz);
$date = \Carbon\Carbon::now()->toDateTimeString();
$arti = $article->where('slug', $slug);
if (Auth::check()) {
if (\Auth::user()->role == 'user') {
$arti = $arti->where('status', '1');
}
} else {
if (!Auth::check()|| \Auth::user()->role == 'user') {
$arti = $arti->where('status', '1');
$arti = $arti->where('publish_time', '<', $date);
}
$arti = $arti->where('type', '1');
$arti = $arti->where('publish_time', '<', $date);
$arti = $arti->first();
if ($arti) {
return view('themes.default1.client.kb.article-list.show', compact('arti'));
} else {
return redirect()->back()->with('fails', Lang::get('lang.no_records_on_publish_time'));
return redirect('404');
}
}
public function getCategory($slug, Article $article, Category $category, Relationship $relation)
{
public function getCategory($slug, Article $article, Category $category, Relationship $relation) {
/* get the article_id where category_id == current category */
$catid = $category->where('slug', $slug)->first();
if (!$catid) {
@@ -159,8 +139,7 @@ class UserController extends Controller
return view('themes.default1.client.kb.article-list.category', compact('all', 'id', 'categorys', 'article_id'));
}
public function home(Article $article, Category $category, Relationship $relation)
{
public function home(Article $article, Category $category, Relationship $relation) {
if (Config::get('database.install') == '%0%') {
return redirect('step1');
} else {
@@ -172,8 +151,7 @@ class UserController extends Controller
}
}
public function Faq(Faq $faq, Category $category)
{
public function Faq(Faq $faq, Category $category) {
$faq = $faq->where('id', '1')->first();
$categorys = $category->get();
@@ -185,8 +163,7 @@ class UserController extends Controller
*
* @return response
*/
public function contact(Category $category, Settings $settings)
{
public function contact(Category $category, Settings $settings) {
$settings = $settings->whereId('1')->first();
$categorys = $category->get();
@@ -198,8 +175,7 @@ class UserController extends Controller
*
* @return response
*/
public function postContact(ContactRequest $request, Contact $contact)
{
public function postContact(ContactRequest $request, Contact $contact) {
$this->port();
$this->host();
$this->encryption();
@@ -217,8 +193,8 @@ class UserController extends Controller
//echo $message;
//echo $contact->email;
$mail = Mail::send('themes.default1.client.kb.article-list.contact-details', ['name' => $name, 'email' => $email, 'subject' => $subject, 'details' => $details], function ($message) use ($contact) {
$message->to($contact->email, $contact->name)->subject('Contact');
});
$message->to($contact->email, $contact->name)->subject('Contact');
});
if ($mail) {
return redirect('contact')->with('success', Lang::get('lang.your_details_send_to_system'));
} else {
@@ -226,8 +202,7 @@ class UserController extends Controller
}
}
public function contactDetails()
{
public function contactDetails() {
return view('themes.default1.client.kb.article-list.contact-details');
}
@@ -241,9 +216,11 @@ class UserController extends Controller
*
* @return type response
*/
public function postComment($slug, Article $article, CommentRequest $request, Comment $comment)
{
public function postComment($slug, Article $article, CommentRequest $request, Comment $comment) {
$article = $article->where('slug', $slug)->first();
if(!$article){
return Redirect::back()->with('fails', Lang::get('lang.sorry_not_processed'));
}
$id = $article->id;
$comment->article_id = $id;
if ($comment->fill($request->input())->save()) {
@@ -253,46 +230,42 @@ class UserController extends Controller
}
}
public function getPage($name, Page $page)
{
public function getPage($name, Page $page) {
$page = $page->where('slug', $name)->first();
//$this->timezone($page->created_at);
return view('themes.default1.client.kb.article-list.pages', compact('page'));
if($page){
return view('themes.default1.client.kb.article-list.pages', compact('page'));
}else{
return Redirect::back()->with('fails', Lang::get('lang.sorry_not_processed'));
}
}
public static function port()
{
public static function port() {
$setting = Settings::whereId('1')->first();
Config::set('mail.port', $setting->port);
}
public static function host()
{
public static function host() {
$setting = Settings::whereId('1')->first();
Config::set('mail.host', $setting->host);
}
public static function encryption()
{
public static function encryption() {
$setting = Settings::whereId('1')->first();
Config::set(['mail.encryption' => $setting->encryption, 'mail.username' => $setting->email]);
}
public static function email()
{
public static function email() {
$setting = Settings::whereId('1')->first();
Config::set(['mail.from' => ['address' => $setting->email, 'name' => 'asd']]);
//dd(Config::get('mail'));
}
public static function password()
{
public static function password() {
$setting = Settings::whereId('1')->first();
Config::set(['mail.password' => $setting->password, 'mail.sendmail' => $setting->email]);
}
public function getCategoryList(Article $article, Category $category, Relationship $relation)
{
public function getCategoryList(Article $article, Category $category, Relationship $relation) {
//$categorys = $category->get();
$categorys = $category->get();
// $categorys->setPath('home');
@@ -314,15 +287,13 @@ class UserController extends Controller
// //return substr($date, 0, -6);
// }
public function clientProfile()
{
public function clientProfile() {
$user = Auth::user();
return view('themes.default1.client.kb.article-list.profile', compact('user'));
}
public function postClientProfile($id, ProfileRequest $request)
{
public function postClientProfile($id, ProfileRequest $request) {
$user = Auth::user();
$user->gender = $request->input('gender');
$user->save();
@@ -341,7 +312,7 @@ class UserController extends Controller
//$extension = Input::file('profile_pic')->getClientOriginalExtension();
$name = Input::file('profile_pic')->getClientOriginalName();
$destinationPath = 'lb-faveo/dist/img';
$fileName = rand(0000, 9999).'.'.$name;
$fileName = rand(0000, 9999) . '.' . $name;
//echo $fileName;
Input::file('profile_pic')->move($destinationPath, $fileName);
$user->profile_pic = $fileName;
@@ -355,8 +326,7 @@ class UserController extends Controller
}
}
public function postClientProfilePassword($id, ProfilePassword $request)
{
public function postClientProfilePassword($id, ProfilePassword $request) {
$user = Auth::user();
//echo $user->password;
if (Hash::check($request->input('old_password'), $user->getAuthPassword())) {
@@ -368,4 +338,5 @@ class UserController extends Controller
return redirect()->back()->with('fails', Lang::get('lang.password_was_not_updated'));
}
}
}