Applied fixes from StyleCI
This commit is contained in:

committed by
StyleCI Bot

parent
09bf25b5e2
commit
e2390f67d4
@@ -33,15 +33,16 @@ 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;
|
||||
@@ -54,7 +55,8 @@ 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('licence');
|
||||
}
|
||||
@@ -66,8 +68,9 @@ class FormController extends Controller {
|
||||
if ($phonecode->phonecode) {
|
||||
$phonecode = $phonecode->phonecode;
|
||||
} else {
|
||||
$phonecode = "";
|
||||
$phonecode = '';
|
||||
}
|
||||
|
||||
return view('themes.default1.client.helpdesk.form', compact('topics', 'codes'))->with('phonecode', $phonecode);
|
||||
} else {
|
||||
return \Redirect::route('home');
|
||||
@@ -82,43 +85,43 @@ 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 $form_data) {
|
||||
if ($form_data->type == "select") {
|
||||
if ($form_data->type == 'select') {
|
||||
$form_fields = explode(',', $form_data->value);
|
||||
$var = "";
|
||||
$var = '';
|
||||
foreach ($form_fields as $form_field) {
|
||||
$var .= '<option value="' . $form_field . '">' . $form_field . '</option>';
|
||||
$var .= '<option value="'.$form_field.'">'.$form_field.'</option>';
|
||||
}
|
||||
echo '<br/><label>' . ucfirst($form_data->label) . '</label><select class="form-control" name="' . $form_data->name . '">' . $var . '</select>';
|
||||
} elseif ($form_data->type == "radio") {
|
||||
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/>';
|
||||
echo '<br/><label>'.ucfirst($form_data->label).'</label><br/>';
|
||||
foreach ($vals as $val) {
|
||||
echo '<input type="' . $form_data->type . '" name="' . $form_data->name . '"> ' . $val . ' ';
|
||||
echo '<input type="'.$form_data->type.'" name="'.$form_data->name.'"> '.$val.' ';
|
||||
}
|
||||
echo "<br/>";
|
||||
} elseif ($form_data->type == "textarea") {
|
||||
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") {
|
||||
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/>';
|
||||
echo '<br/><label>'.ucfirst($form_data->label).'</label><br/>';
|
||||
foreach ($checks as $check) {
|
||||
echo '<input type="' . $form_data->type . '" name="' . $form_data->name . '">  ' . $check;
|
||||
echo '<input type="'.$form_data->type.'" name="'.$form_data->name.'">  '.$check;
|
||||
}
|
||||
} else {
|
||||
echo '<br/><label>' . ucfirst($form_data->label) . '</label><input type="' . $form_data->type . '" class="form-control" name="' . $form_data->name . '" />';
|
||||
echo '<br/><label>'.ucfirst($form_data->label).'</label><input type="'.$form_data->type.'" class="form-control" name="'.$form_data->name.'" />';
|
||||
}
|
||||
}
|
||||
echo '<br/><br/>';
|
||||
@@ -134,7 +137,8 @@ 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');
|
||||
@@ -146,12 +150,12 @@ class FormController extends Controller {
|
||||
$mobile_number = $request->input('Mobile');
|
||||
$status = $ticket_settings->first()->status;
|
||||
$helptopic = $request->input('helptopic');
|
||||
$helpTopicObj = Help_topic::where('id','=', $helptopic);
|
||||
if($helpTopicObj->exists() && ($helpTopicObj->value('status')==1)){
|
||||
$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');
|
||||
} 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;
|
||||
@@ -166,8 +170,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,
|
||||
];
|
||||
|
||||
@@ -176,8 +180,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,
|
||||
];
|
||||
|
||||
@@ -203,7 +207,7 @@ class FormController extends Controller {
|
||||
}
|
||||
}
|
||||
// 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'));
|
||||
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);
|
||||
}
|
||||
@@ -215,13 +219,14 @@ 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();
|
||||
@@ -255,13 +260,14 @@ class FormController extends Controller {
|
||||
}
|
||||
}
|
||||
|
||||
public function getCustomForm(Request $request) {
|
||||
$html = "";
|
||||
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");
|
||||
throw new Exception('We can not find your request');
|
||||
}
|
||||
$custom_form = $helptopic->custom_form;
|
||||
if ($custom_form) {
|
||||
@@ -270,7 +276,7 @@ class FormController extends Controller {
|
||||
$form_controller = new \App\Http\Controllers\Admin\helpdesk\FormController($fields, $forms);
|
||||
$html = $form_controller->renderForm($custom_form);
|
||||
}
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -11,12 +11,12 @@ use App\Http\Requests\helpdesk\ProfileRequest;
|
||||
use App\Http\Requests\helpdesk\TicketRequest;
|
||||
use App\Model\helpdesk\Manage\Help_topic;
|
||||
// models
|
||||
use App\Model\helpdesk\Settings\CommonSettings;
|
||||
use App\Model\helpdesk\Settings\Company;
|
||||
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
|
||||
@@ -323,6 +323,7 @@ class GuestController extends Controller
|
||||
$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'));
|
||||
}
|
||||
|
||||
|
@@ -24,9 +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');
|
||||
}
|
||||
|
||||
@@ -35,18 +36,20 @@ class UserController extends Controller {
|
||||
*
|
||||
* @return response
|
||||
*/
|
||||
public function getArticle(Article $article, Category $category, Settings $settings) {
|
||||
public function getArticle(Article $article, Category $category, Settings $settings)
|
||||
{
|
||||
$setting = $settings->first();
|
||||
$pagination = $setting->pagination;
|
||||
if (!Auth::check() || \Auth::user()->role == 'user') {
|
||||
$article = $article->where('status', '1');
|
||||
}
|
||||
$article = $article->where('type', '1');
|
||||
$article = $article->orderBy('publish_time','desc');
|
||||
$article = $article->orderBy('publish_time', 'desc');
|
||||
$article = $article->paginate($pagination);
|
||||
|
||||
|
||||
$article->setPath('article-list');
|
||||
$categorys = $category->get();
|
||||
|
||||
return view('themes.default1.client.kb.article-list.articles', compact('time', 'categorys', 'article'));
|
||||
}
|
||||
|
||||
@@ -59,7 +62,8 @@ 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, ' ');
|
||||
@@ -82,13 +86,14 @@ 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();
|
||||
@@ -101,15 +106,16 @@ 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()|| \Auth::user()->role == 'user') {
|
||||
|
||||
if (!Auth::check() || \Auth::user()->role == 'user') {
|
||||
$arti = $arti->where('status', '1');
|
||||
$arti = $arti->where('publish_time', '<', $date);
|
||||
}
|
||||
@@ -125,7 +131,8 @@ class UserController extends Controller {
|
||||
}
|
||||
}
|
||||
|
||||
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) {
|
||||
@@ -141,7 +148,8 @@ 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 {
|
||||
@@ -153,7 +161,8 @@ 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();
|
||||
|
||||
@@ -165,7 +174,8 @@ 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();
|
||||
|
||||
@@ -177,7 +187,8 @@ 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();
|
||||
@@ -195,8 +206,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 {
|
||||
@@ -204,7 +215,8 @@ class UserController extends Controller {
|
||||
}
|
||||
}
|
||||
|
||||
public function contactDetails() {
|
||||
public function contactDetails()
|
||||
{
|
||||
return view('themes.default1.client.kb.article-list.contact-details');
|
||||
}
|
||||
|
||||
@@ -218,10 +230,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'));
|
||||
if (!$article) {
|
||||
return Redirect::back()->with('fails', Lang::get('lang.sorry_not_processed'));
|
||||
}
|
||||
$id = $article->id;
|
||||
$comment->article_id = $id;
|
||||
@@ -232,42 +245,49 @@ class UserController extends Controller {
|
||||
}
|
||||
}
|
||||
|
||||
public function getPage($name, Page $page) {
|
||||
public function getPage($name, Page $page)
|
||||
{
|
||||
$page = $page->where('slug', $name)->first();
|
||||
if($page){
|
||||
if ($page) {
|
||||
return view('themes.default1.client.kb.article-list.pages', compact('page'));
|
||||
}else{
|
||||
} 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');
|
||||
@@ -289,13 +309,15 @@ 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();
|
||||
@@ -314,7 +336,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;
|
||||
@@ -328,7 +350,8 @@ 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())) {
|
||||
@@ -340,5 +363,4 @@ class UserController extends Controller {
|
||||
return redirect()->back()->with('fails', Lang::get('lang.password_was_not_updated'));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user