G6K is a tool that enables the creation and online publishing of calculation simulators without coding. It has a simulation engine and an administration module.
A calculation simulator is an online service made available to a user to enable them to calculate the results (taxes, social benefits, etc.) corresponding to their particular situation. The results are calculated on the basis of data supplied by the user, reference data (eg amount of a tax) and business rules reflecting the current legislation in the field of simulation.
php -d memory_limit=-1 composer.phar create-project eureka2/g6k simulator/ 4.*
for sqlite database only:
for mysql or pgsql database:
G6K comes with a .htaccess
file in the calcul/
directory that contains the rewrite rules.
/admin/...
is rewritten in /admin.php/...
and all other queries in /index.php/...
.
Thus, the admin.php
andindex.php
front-end controllers can be omitted from the request urls.
You must add the AllowOverride All
directive in the VirtualHost
block of the server configuration.
Assuming G6K is installed in the directory /var/www/html/simulator
:
<VirtualHost *:80>
ServerName domain.tld
ServerAlias www.domain.tld
DocumentRoot /var/www/html/simulator
<Directory /var/www/html/simulator>
AllowOverride All
Order Allow,Deny
Allow from All
</Directory>
# other directives
</VirtualHost>
For best performance, rewrite rules can be moved from the .htaccess
file to the VirtualHost
block of the server configuration.
In this case, change AllowOverride All
to AllowOverride None
and delete the .htaccess
file.
<VirtualHost *:80>
ServerName domain.tld
ServerAlias www.domain.tld
DocumentRoot /var/www/html/simulator
<Directory /var/www/html/simulator>
AllowOverride None
Order Allow,Deny
Allow from All
</Directory>
<Directory /var/www/html/simulator/calcul>
# rewrite rules from .htaccess
</Directory>
# other directives
</VirtualHost>
For security reasons, the calcul/
directory : DocumentRoot /var/www/html/simulator/calcul
In this case, calcul/
should be omitted from the path of the request URL.
<VirtualHost *:80>
ServerName domain.tld
ServerAlias simulators.domain.tld
DocumentRoot /var/www/html/simulator/calcul
<Directory /var/www/html/simulator/calcul>
# rewrite rules from .htaccess
AllowOverride None
Order Allow,Deny
Allow from All
</Directory>
# other directives
</VirtualHost>
Because NGinx does not have .htaccess
files, all of the setup has to be managed within the server config file.
The following is fully working. There are probably a number of improvements which can be made, but this should be a good starting-point.
The most important point is that the /admin
path has to be routed separately to the other app.
server {
rewrite ^/index\.php/?(.*)$ /$1 permanent;
## Admin ##
## Required for the admin area (this is in .htaccess inside /calcul) ##
location /admin {
rewrite ^(.*)$ /admin.php/$1 last;
}
## Main ##
location @rewriteapp {
rewrite ^(.*)$ /index.php/$1 last;
}
## Symfony ##
## PRODUCTION ENV ##
location ~ ^/(index|admin)\.php(/|$) {
fastcgi_pass unix:/var/run/php/php7.2-fpm.sock; #-> this needs to be your php-fpm location
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;
internal;
}
# other directives
}
If you want to transfer simulators, their data sources and style sheets from a previous installation, do not copy them manually, use the following console command:
php bin/console g6k:simulator:copy -w abDatepicker -w abListbox -w AutoMoneyFormat all /var/www/html/simulator-old
assuming /var/www/html/simulator-old
is the installation directory of the previous version.
This command performs all the necessary conversions to enable their use with this new version.
Note that in this command, the -w option sets widgets.
abDatepicker
, abListbox
and AutoMoneyFormat
are widgets that will automatically apply to 'date', choice (select), and money fields, respectively.
You can omit those you do not want to use.
At the end of the copy, go to the administration interface to clear the development and production caches.
|
G6K By eureka2 |
![]() April 2018 Number 6 |
There are many sites that are useful because they provide means to let the users perform calculations of some kind from simple values entered in Web forms.
This package provides a Web interface to implement a generic system for designing and providing access to pages that provide several types of calculator tools. Manuel Lemos |
© 2015-2019 Eureka2 - Jacques Archimède. Code released under the MIT license.