2013-11-26 13:45:07 +01:00
< ? php
2014-03-05 21:19:12 +01:00
use ninja\mailers\Mailer ;
2013-11-26 13:45:07 +01:00
class HomeController extends BaseController {
protected $layout = 'master' ;
2014-03-05 21:19:12 +01:00
protected $mailer ;
public function __construct ( Mailer $mailer )
{
parent :: __construct ();
$this -> mailer = $mailer ;
}
2013-11-26 13:45:07 +01:00
2014-07-15 22:36:40 +02:00
public function showIndex ()
2013-11-26 13:45:07 +01:00
{
2014-07-15 22:36:40 +02:00
if ( Utils :: isNinja ())
{
return View :: make ( 'public.splash' );
}
else
{
if ( Account :: count () == 0 )
{
return Redirect :: to ( '/invoice_now' );
}
else
{
return Redirect :: to ( '/login' );
}
}
2013-11-26 13:45:07 +01:00
}
2014-01-02 14:21:15 +01:00
2014-02-26 17:08:40 +01:00
public function showAboutUs ()
{
2014-06-02 18:21:47 +02:00
$data = [
'title' => 'About Us' ,
'description' => 'Invoice Ninja is an an open-source solution where you can create, customize, and generate invoices online for free using our templates!'
];
return View :: make ( 'public.about_us' , $data );
2014-02-26 17:08:40 +01:00
}
2014-02-26 17:50:27 +01:00
public function showContactUs ()
{
2014-06-02 18:21:47 +02:00
$data = [
'title' => 'Contact Us' ,
'description' => 'Contact us today and try out our free or premium hassle-free plans. Start your online invoicing today with Invoice Ninja!'
];
return View :: make ( 'public.contact_us' , $data );
2014-02-26 17:50:27 +01:00
}
2014-03-11 18:37:54 +01:00
public function showTerms ()
{
2014-03-20 23:12:07 +01:00
return View :: make ( 'public.terms' );
2014-03-11 18:37:54 +01:00
}
2014-04-24 10:46:44 +02:00
public function showFaq ()
2014-03-31 17:06:44 +02:00
{
return View :: make ( 'public.faq' );
}
2014-04-24 10:46:44 +02:00
2014-03-31 17:06:44 +02:00
public function showFeatures ()
{
return View :: make ( 'public.features' );
}
2014-04-24 10:46:44 +02:00
public function showPlans ()
{
2014-06-02 18:21:47 +02:00
$data = [
'title' => 'Professional Invoicing Software & Templates' ,
'description' => 'Invoice Ninja allows you to create and generate your own custom invoices. Choose from our professional invoice templates or customize your own with our pro plan.'
];
return View :: make ( 'public.plans' , $data );
2014-04-24 10:46:44 +02:00
}
2014-06-13 17:11:46 +02:00
public function showTestimonials ()
{
return View :: make ( 'public.testimonials' );
}
2014-04-24 10:46:44 +02:00
2014-03-11 18:37:54 +01:00
2014-03-05 21:19:12 +01:00
public function doContactUs ()
{
$email = Input :: get ( 'email' );
$name = Input :: get ( 'name' );
$message = Input :: get ( 'message' );
$data = [
'text' => $message
];
2014-06-30 13:42:25 +02:00
$this -> mailer -> sendTo ( CONTACT_EMAIL , $email , $name , 'Invoice Ninja Feedback' , 'contact' , $data );
2014-03-05 21:19:12 +01:00
2014-04-02 14:28:23 +02:00
$message = trans ( 'texts.sent_message' );
Session :: flash ( 'message' , $message );
2014-06-02 18:21:47 +02:00
return View :: make ( 'public.contact_us' );
2014-03-05 21:19:12 +01:00
}
2014-01-08 21:09:47 +01:00
public function showComingSoon ()
{
return View :: make ( 'coming_soon' );
}
2014-05-12 13:10:42 +02:00
public function showSecurePayment ()
{
return View :: make ( 'secure_payment' );
}
2014-07-30 09:08:01 +02:00
public function showCompare ()
{
return View :: make ( 'public.compare' );
}
2014-05-04 17:49:57 +02:00
public function invoiceNow ()
{
if ( Auth :: check ())
{
return Redirect :: to ( 'invoices/create' );
}
else
{
return View :: make ( 'public.header' , [ 'invoiceNow' => true ]);
}
}
2014-10-05 23:00:42 +02:00
public function newsFeed ( $userType , $version )
{
$response = Utils :: getNewsFeedResponse ( $userType );
return Response :: json ( $response );
}
public function hideMessage ()
{
if ( Auth :: check () && Session :: has ( 'news_feed_id' )) {
$newsFeedId = Session :: get ( 'news_feed_id' );
if ( $newsFeedId != NEW_VERSION_AVAILABLE && $newsFeedId > Auth :: user () -> news_feed_id ) {
$user = Auth :: user ();
$user -> news_feed_id = $newsFeedId ;
$user -> save ();
}
Session :: forget ( 'news_feed_message' );
}
return 'success' ;
}
2014-01-02 14:21:15 +01:00
public function logError ()
{
2014-01-09 00:22:56 +01:00
return Utils :: logError ( Input :: get ( 'error' ), 'JavaScript' );
2014-01-02 14:21:15 +01:00
}
2013-11-26 13:45:07 +01:00
}