Commit e101bea9 authored by Arnaud Bey's avatar Arnaud Bey

Merge branch 'master' into data-control

parents 07f69ac0 6ead07d5
......@@ -20,15 +20,17 @@ PWD=rootpassword make install
* if you let default values, MW should be available at localhost:666 and the phpmyadmin at localhost:8080
* You'd better leave default values, some stuff is hardcoded...
* Once application installed, you can generate some grid with these commands in the php container. It will generates 10 grids in french and english with at least 150 (and 250 for french) foundable forms.
* Once application installed, you can generate some grid with these commands in the php container. It will generates 10 grids in french and english with at least 150 (and 250 for french) foundable forms.
> php bin/console magicword:generate-grid english 10 150
> php bin/console magicword:generate-grid french 10 250
# Update
```
git pull origin master
sudo docker-compose up --build -d
sudo docker-compose exec php bash
make update
```
......@@ -114,6 +114,9 @@ fos_user:
db_driver: orm
firewall_name: main
user_class: MagicWordBundle\Entity\Player
from_email:
address: "%mailer_user%"
sender_name: "%mailer_user%"
registration:
form:
type: MagicWordBundle\Form\Type\RegistrationType
......
......@@ -10,8 +10,8 @@ parameters:
database_name2: lexicon
mailer_transport: smtp
mailer_host: 127.0.0.1
mailer_user: ~
mailer_password: ~
mailer_user: default_user
mailer_password: default_passwd
# A secret key that's used to generate certain security-related tokens
secret: ThisTokenIsNotSoSecretChangeIt
......@@ -20,7 +20,7 @@
"require": {
"php": ">=5.5.9",
"symfony/symfony": "3.3.*@stable",
"symfony/symfony": "3.4.*@stable",
"doctrine/orm": "^2.5",
"doctrine/doctrine-bundle": "^1.6",
"doctrine/doctrine-cache-bundle": "^1.2",
......@@ -35,7 +35,7 @@
"twig/extensions": "^1.3",
"ramsey/uuid": "^3.5",
"willdurand/js-translation-bundle": "^2.6",
"twig/twig": "v1.32",
"twig/twig": "^1.0||^2.0",
"michelf/php-markdown": "^1.7"
},
"require-dev": {
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
......@@ -2,8 +2,8 @@
namespace MagicWordBundle\Repository;
use MagicWordBundle\Entity\Player;
use LexiconBundle\Entity\Language;
use MagicWordBundle\Entity\Player;
/**
* GameRepository.
......@@ -20,7 +20,7 @@ class GameRepository extends \Doctrine\ORM\EntityRepository
LEFT JOIN game.rounds r
LEFT JOIN r.grid g
WHERE r.language = :language
AND game INSTANCE OF 'MagicWordBundle\Entity\GameType\Training'
AND game INSTANCE OF MagicWordBundle\Entity\GameType\Training
AND NOT EXISTS(
SELECT a FROM MagicWordBundle\Entity\Activity a
WHERE a.round = r
......
......@@ -41,7 +41,7 @@ class PlayerRepository extends \Doctrine\ORM\EntityRepository
$dql = "SELECT p FROM MagicWordBundle:Player p
LEFT JOIN p.startedGames started
WHERE (
started INSTANCE OF 'MagicWordBundle\Entity\GameType\Challenge'
started INSTANCE OF MagicWordBundle\Entity\GameType\Challenge
AND started.author = :currentUser
) OR p = :currentUser
";
......
{% macro percent(foundable, activities) %}
{% import _self as my_macros %}
{% set found = 0 %}
{% for a in activities %}
{% if foundable in a.foundForms %}
......@@ -9,52 +10,54 @@
{% endmacro %}
{% macro foundableComplete(foundable, activity, activities, type) %}
{% set percent = _self.percent(foundable, activities) %}
<div class="col-md-4 foundable" data-form="{{ foundable.form }}" data-points="{{ foundable.points }}" data-percent="{{ percent }}" data-length="{{ foundable.form|length }}">
<div class="panel panel-default">
<div class="panel-heading " role="tab">
<h4 class="panel-title {% if activity and foundable in activity.foundForms and type == "foundable" %}bg-success{% endif %} ">
<a role="button" data-toggle="collapse" data-parent="#accordion" href="#{{ foundable.id ~ type}}" aria-expanded="true" aria-controls="{{ foundable.id }}">
{{ foundable.form | upper }} <span class="text-muted">({{ foundable.points}})</span>
<span class="pull-right">
<span class="label label-default">{{ percent }}</span>
</span>
</a>
</h4>
</div>
<div id="{{ foundable.id ~ type }}" class="panel-collapse collapse" role="tabpanel">
<div class="list-group" >
{% for inflection in foundable.inflections %}
<li class="list-group-item">
{{ inflection.content }}
({{ inflection.lemma.content }} - <span class="text-muted">{{ inflection.lemma.category ? inflection.lemma.category.value | trans }}</span>)
<span class="pull-right">
<span class="btn btn-default btn-xs" onClick="wiktionnary.getDef('{{ inflection.lemma.content }}', '{{ foundable.grid.language.name |slice(0,2) }}')">
<i class="fa fa-wikipedia-w" aria-hidden="true"></i>
</span>
{% if isInWordbox(inflection.lemma) == false %}
<span class="btn btn-default btn-xs" onclick="addToWordbox({{ inflection.lemma.id }}, this);">
<i class="fa fa-plus" aria-hidden="true"></i>
</span>
{% endif %}
</span>
</li>
{% endfor %}
</div>
</div>
</div>
</div>
{% import _self as my_macros %}
{% set percent = my_macros.percent(foundable, activities) %}
<div class="col-md-4 foundable" data-form="{{ foundable.form }}" data-points="{{ foundable.points }}" data-percent="{{ percent }}" data-length="{{ foundable.form|length }}">
<div class="panel panel-default">
<div class="panel-heading " role="tab">
<h4 class="panel-title {% if activity and foundable in activity.foundForms and type == "foundable" %}bg-success{% endif %} ">
<a role="button" data-toggle="collapse" data-parent="#accordion" href="#{{ foundable.id ~ type}}" aria-expanded="true" aria-controls="{{ foundable.id }}">
{{ foundable.form | upper }} <span class="text-muted">({{ foundable.points}})</span>
<span class="pull-right">
<span class="label label-default">{{ percent }}</span>
</span>
</a>
</h4>
</div>
<div id="{{ foundable.id ~ type }}" class="panel-collapse collapse" role="tabpanel">
<div class="list-group" >
{% for inflection in foundable.inflections %}
<li class="list-group-item">
{{ inflection.content }}
({{ inflection.lemma.content }} - <span class="text-muted">{{ inflection.lemma.category ? inflection.lemma.category.value | trans }}</span>)
<span class="pull-right">
<span class="btn btn-default btn-xs" onClick="wiktionnary.getDef('{{ inflection.lemma.content }}', '{{ foundable.grid.language.name |slice(0,2) }}')">
<i class="fa fa-wikipedia-w" aria-hidden="true"></i>
</span>
{% if isInWordbox(inflection.lemma) == false %}
<span class="btn btn-default btn-xs" onclick="addToWordbox({{ inflection.lemma.id }}, this);">
<i class="fa fa-plus" aria-hidden="true"></i>
</span>
{% endif %}
</span>
</li>
{% endfor %}
</div>
</div>
</div>
</div>
{% endmacro %}
{% macro foundableShort(foundable, activities) %}
{% set percent = _self.percent(foundable, activities) %}
<div class="sortable" style="margin-bottom:2px" data-form="{{ foundable.form }}" data-points="{{ foundable.points }}" data-percent="{{ percent }}" data-length="{{ foundable.form|length }}">
<div style="float:left; width:80px">
<div class="label label-default">{{ percent }}</div> &nbsp;
<span class="btn btn-default btn-xs" onClick="wiktionnary.getDef('{{ foundable.inflections[0].lemma.content }}', '{{ foundable.grid.language.name |slice(0,2) }}')">
<i class="fa fa-wikipedia-w" aria-hidden="true"></i>
</span>
</div>
{{ foundable.form | upper }} <span class="text-muted">({{ foundable.points}}pts)</span>
</div>
{% import _self as my_macros %}
{% set percent = my_macros.percent(foundable, activities) %}
<div class="sortable" style="margin-bottom:2px" data-form="{{ foundable.form }}" data-points="{{ foundable.points }}" data-percent="{{ percent }}" data-length="{{ foundable.form|length }}">
<div style="float:left; width:80px">
<div class="label label-default">{{ percent }}</div> &nbsp;
<span class="btn btn-default btn-xs" onClick="wiktionnary.getDef('{{ foundable.inflections[0].lemma.content }}', '{{ foundable.grid.language.name |slice(0,2) }}')">
<i class="fa fa-wikipedia-w" aria-hidden="true"></i>
</span>
</div>
{{ foundable.form | upper }} <span class="text-muted">({{ foundable.points}}pts)</span>
</div>
{% endmacro %}
......@@ -3,6 +3,7 @@
{% block title %}{{ 'rankings_and_stats' | trans }}{% endblock %}
{% block body -%}
{% import _self as my_macros %}
<div class="panel panel-default">
<div class="panel-heading">
<h4>
......@@ -23,14 +24,14 @@
<div role="tabpanel" class="tab-pane active" id="massives">
<ul class="list-group">
{% for game in games if game.discr == "massive"%}
{{ _self.game_end_link(game) }}
{{ my_macros.game_end_link(game) }}
{% endfor %}
</ul>
</div>
<div role="tabpanel" class="tab-pane" id="challenges">
<ul class="list-group">
{% for game in games if game.discr == "challenge"%}
{{ _self.game_end_link(game) }}
{{ my_macros.game_end_link(game) }}
{% endfor %}
</ul>
</div>
......
......@@ -3,6 +3,7 @@
{% block title %}{{ 'games_started' | trans }}{% endblock %}
{% block body -%}
{% import _self as my_macros %}
<div class="panel panel-default">
<div class="panel-heading">
<h4>
......@@ -31,7 +32,7 @@
<div data-gametype="{{ game.discr }}" data-roundcount="roundCount" data-popularity="{{ popularity }}" data-author="{{ game.author }}" class="panel panel-default game">
<div class="panel-heading" role="tab" id="headingOne">
<h4 class="panel-title">
{{ _self.game_name(game) }}
{{ my_macros.game_name(game) }}
<span class="pull-right">
{% if game.discr == "massive" %}
<span class="label label-info">{{ "popularity" | trans }}: {{ getActivityCount(game) }}</span>
......@@ -39,7 +40,7 @@
<i class="fa fa-info" aria-hidden="true"></i> Infos
</a>
{% endif %}
{{ _self.game_play_link(game) }}
{{ my_macros.game_play_link(game) }}
</span>
</h4>
</div>
......
{% import _self as macros %}
<span onclick="gridPatternHandler.list();" class="btn btn-default">
<i class="fa fa-chevron-left" aria-hidden="true"></i>
{{"back_to_patterns_list" | trans}}
......@@ -23,9 +25,9 @@
<i class="fa fa-plus" aria-hidden="true"></i>
{{ 'add_string' | trans }}
</span>
<ul class="list-group row" id="strings" data-prototype="{{ _self.strings_prototype(form.strings.vars.prototype)|e }}">
<ul class="list-group row" id="strings" data-prototype="{{ macros.strings_prototype(form.strings.vars.prototype)|e }}">
{% for string in form.strings %}
{{ _self.strings_prototype(string) }}
{{ macros.strings_prototype(string) }}
{% endfor %}
</ul>
<input type="hidden" id="pattern-id" name="pattern-id" value="{{ pattern.id }}"/>
......
{% import _self as macros %}
{% macro percent(objective, activities) %}
{% set found = 0 %}
{% for a in activities %}
......@@ -9,7 +11,7 @@
{% endmacro %}
{% macro objectiveShort(objective, activities) %}
{% set percent = _self.percent(objective, activities) %}
{% set percent = macros.percent(objective, activities) %}
<div class="sortable" style="margin-bottom:2px" data-percent="{{ percent }}">
<div style="float:left; width:40px">
<div class="label label-default">{{ percent }}</div>
......
{% import _self as my_macros %}
<div class="panel panel-default">
<div class="panel-heading">
&nbsp;
......@@ -13,9 +15,9 @@
</span>
</div>
<ul class="list-group" id="combos" data-prototype="{{ _self.combos_prototype(form.combos.vars.prototype)|e }}">
<ul class="list-group" id="combos" data-prototype="{{ my_macros.combos_prototype(form.combos.vars.prototype)|e }}">
{% for combo in form.combos %}
{{ _self.combos_prototype(combo) }}
{{ my_macros.combos_prototype(combo) }}
{% endfor %}
</ul>
</div>
......
{% import _self as my_macros %}
<div class="panel panel-default">
<div class="panel-heading">
&nbsp;
......@@ -15,9 +17,9 @@
</span>
</div>
<ul class="list-group" id="constraints" data-prototype="{{ _self.constraints_prototype(form.constraints.vars.prototype)|e }}">
<ul class="list-group" id="constraints" data-prototype="{{ my_macros.constraints_prototype(form.constraints.vars.prototype)|e }}">
{% for constraint in form.constraints %}
{{ _self.constraints_prototype(constraint) }}
{{ my_macros.constraints_prototype(constraint) }}
{% endfor %}
</ul>
</div>
......
{% import _self as my_macros %}
<div class="panel panel-default">
<div class="panel-heading">
&nbsp;
......@@ -12,9 +14,9 @@
</span>
</span>
</div>
<ul class="list-group" id="words" data-prototype="{{ _self.findWord_prototype(form.findWords.vars.prototype)|e }}">
<ul class="list-group" id="words" data-prototype="{{ my_macros.findWord_prototype(form.findWords.vars.prototype)|e }}">
{% for findWord in form.findWords %}
{{ _self.findWord_prototype(findWord) }}
{{ my_macros.findWord_prototype(findWord) }}
{% endfor %}
</ul>
</div>
......
......@@ -389,7 +389,7 @@ class SymfonyRequirements extends RequirementCollection
{
/* mandatory requirements follow */
$installedPhpVersion = phpversion();
$installedPhpVersion = PHP_VERSION;
$requiredPhpVersion = $this->getPhpRequiredVersion();
$this->addRecommendation(
......@@ -448,15 +448,8 @@ class SymfonyRequirements extends RequirementCollection
}
if (false !== $requiredPhpVersion && version_compare($installedPhpVersion, $requiredPhpVersion, '>=')) {
$timezones = array();
foreach (DateTimeZone::listAbbreviations() as $abbreviations) {
foreach ($abbreviations as $abbreviation) {
$timezones[$abbreviation['timezone_id']] = true;
}
}
$this->addRequirement(
isset($timezones[@date_default_timezone_get()]),
in_array(@date_default_timezone_get(), DateTimeZone::listIdentifiers(), true),
sprintf('Configured default timezone "%s" must be supported by your installation of PHP', @date_default_timezone_get()),
'Your default timezone is not supported by PHP. Check for typos in your <strong>php.ini</strong> file and have a look at the list of deprecated timezones at <a href="http://php.net/manual/en/timezones.others.php">http://php.net/manual/en/timezones.others.php</a>.'
);
......@@ -633,12 +626,6 @@ class SymfonyRequirements extends RequirementCollection
'Install and enable the <strong>mbstring</strong> extension.'
);
$this->addRecommendation(
function_exists('iconv'),
'iconv() should be available',
'Install and enable the <strong>iconv</strong> extension.'
);
$this->addRecommendation(
function_exists('utf8_decode'),
'utf8_decode() should be available',
......@@ -737,7 +724,7 @@ class SymfonyRequirements extends RequirementCollection
'Install and/or enable a <strong>PHP accelerator</strong> (highly recommended).'
);
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
if ('WIN' === strtoupper(substr(PHP_OS, 0, 3))) {
$this->addRecommendation(
$this->getRealpathCacheSize() >= 5 * 1024 * 1024,
'realpath_cache_size should be at least 5M in php.ini',
......@@ -780,7 +767,11 @@ class SymfonyRequirements extends RequirementCollection
{
$size = ini_get('realpath_cache_size');
$size = trim($size);
$unit = strtolower(substr($size, -1, 1));
$unit = '';
if (!ctype_digit($size)) {
$unit = strtolower(substr($size, -1, 1));
$size = (int) substr($size, 0, -1);
}
switch ($unit) {
case 'g':
return $size * 1024 * 1024 * 1024;
......
......@@ -34,6 +34,7 @@ RUN "date"
# Type docker-php-ext-install to see available extensions
RUN docker-php-ext-install pdo pdo_mysql intl curl json opcache xml xsl
ADD php.ini /usr/local/etc/php/conf.d/
# install xdebug
RUN pecl install apcu
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment