Skip to content

Commit e7153d4

Browse files
committed
updates
1 parent 796b877 commit e7153d4

File tree

29 files changed

+2031
-34
lines changed

29 files changed

+2031
-34
lines changed

app/Resources/translations/messages.en.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ form:
88
my_picture: My picture
99

1010
menu:
11+
phone_edit: Edit my number
12+
sendSMS: Send SMS
13+
smsavailable: SMS available
1114
receivedSent: Sent / Received
1215
totalReceivedSent: Total troops sent/rec
1316
select_player: Select a player
@@ -112,6 +115,7 @@ button:
112115

113116
notFound: No results found.
114117
notPlayerFound: No players found.
118+
notDefined: Not defined
115119

116120
action:
117121
edit: Edit

app/Resources/translations/messages.fr.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ form:
77
my_base: Ma base
88
my_picture: Ma photo
99
menu:
10+
phone_edit: Modifier mon numéro
11+
sendSMS: Send SMS
12+
smsavailable: SMS disponibles
13+
1014
receivedSent: Env / Reçues
1115
totalReceivedSent: Total troupes env / reçes
1216
select_player: Selectionner un joueur
@@ -115,6 +119,7 @@ action:
115119

116120
notFound: Aucun résultat trouvé.
117121
notPlayerFound: Aucun joueur trouvé.
122+
notDefined: Non défini
118123

119124
player:
120125
last_update: Dernière MAJ

app/Resources/views/base.html.twig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css" />
2525
<link href='http://fonts.googleapis.com/css?family=Oxygen' rel='stylesheet' type='text/css'>
2626
<link href='http://fonts.googleapis.com/css?family=Open+Sans:600' rel='stylesheet' type='text/css'>
27+
<link rel="stylesheet" href="{{ asset('css/inputPhone.css') }}" />
2728

2829
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-select/1.6.4/js/bootstrap-select.js.map" type="text/javascript"></script>
2930
<script src="{{ asset('js/jquery.js') }}" type="text/javascript"></script>

app/Resources/views/base_admin.html.twig

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,8 @@
3535
<script src="{{ asset('js/metisMenu.min.js') }}" type="text/javascript"></script>
3636
<script src="{{ asset('js/intro.js') }}" type="text/javascript"></script>
3737
<script src="{{ asset('js/bootstrap-filestyle.min.js') }}" type="text/javascript"> </script>
38-
<script src="{{ asset('bundles/fosjsrouting/js/router.js') }}"></script>
39-
<script src="{{ asset('js/fos_js_routes.js')}}"></script>
4038
<script type="text/javascript" src="{{ asset('js/bootstrap-filestyle.min.js') }}"> </script>
39+
<script src="{{ asset('js/bootstrap-select.min.js') }}" type="text/javascript"></script>
4140

4241

4342
<script src="//cdnjs.cloudflare.com/ajax/libs/moment.js/2.9.0/moment-with-locales.js"></script>

app/Resources/views/base_vitrine.html.twig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
<link rel="stylesheet" href="{{ asset('css/footable.core.css') }}" />
1818
<link href='http://fonts.googleapis.com/css?family=Oswald:400,700' rel='stylesheet' type='text/css'>
1919
<link rel="stylesheet" href="{{ asset('css/bootstrap-select.min.css') }}" />
20+
<link rel="stylesheet" href="{{ asset('css/inputPhone.css') }}" />
2021

2122
<link rel="stylesheet" href="{{ asset('css/heroic-features.css') }}" />
2223
<link rel="stylesheet" href="{{ asset('css/style.css') }}" />
@@ -29,10 +30,13 @@
2930
<script src="{{ asset('js/bootstrap.min.js') }}" type="text/javascript"></script>
3031
<script src="{{ asset('js/vitrine.js') }}" type="text/javascript"></script>
3132
<script src="{{ asset('js/jquery.swipebox.min.js') }}" type="text/javascript"></script>
33+
<script src="{{ asset('js/inputPhone.js') }}" type="text/javascript"></script>
3234

3335
<script src="{{ asset('bundles/fosjsrouting/js/router.js') }}"></script>
3436

3537
<script src="{{ asset('js/bootstrap-select.min.js') }}" type="text/javascript"></script>
38+
<script src="{{ asset('js/util.js') }}" type="text/javascript"></script>
39+
3640

3741

3842
<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->

src/Application/Sonata/UserBundle/Controller/RegistrationController.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ public function registerAction(Request $request)
8888
{
8989
$user = $form->getData();
9090

91+
9192
// CREATE CLAN
9293
if ( $form->get('pass')->getData() != null && $form->get('clanName')->getData() != null )
9394
{
@@ -99,6 +100,7 @@ public function registerAction(Request $request)
99100
$clan->setStatus(0);
100101
$clan->setLevel(1);
101102
$clan->setPrivacy(0);
103+
$clan->setSmsavailable(2);
102104
$clan->setTotalAttackWon(0);
103105
$clan->setTotalTroopReceived(0);
104106
$clan->setTotalTroopSent(0);
@@ -127,6 +129,7 @@ public function registerAction(Request $request)
127129
$user->setRoles(array('ROLE_ADMIN'));
128130
$user->setVisited(0);
129131
$user->setLearned(0);
132+
$user->setPhone($form->get('country')->getData());
130133
$em->persist($user);
131134
$em->flush($user);
132135

@@ -401,6 +404,7 @@ public function registerAction(Request $request)
401404
{
402405
$user->setClan($clan);
403406
$user->setVisited(0);
407+
$user->setPhone($form->get('country')->getData());
404408
$em->persist($user);
405409
$em->flush($user);
406410
}

src/Application/Sonata/UserBundle/Entity/User.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class User extends BaseUser
3434
/**
3535
* @var integer
3636
*
37-
* @ORM\Column(name="phone", type="integer", nullable=true)
37+
* @ORM\Column(name="phone", type="string", nullable=true)
3838
*/
3939
private $phone;
4040

src/Application/Sonata/UserBundle/Form/Type/RegistrationClanFormType.php

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,17 @@ class RegistrationClanFormType extends AbstractType
1111
public function buildForm(FormBuilderInterface $builder, array $options)
1212
{
1313
parent::buildForm($builder, $options);
14-
$builder->add('phone', 'integer', array('label' => 'label.phone', 'required' => false,))
14+
$builder->
1515

16-
->add('clan', 'entity', array('label' => 'label.clan',
17-
'class' => 'COCBundle:Clan',
18-
'query_builder' => function(EntityRepository $er) {
19-
return $er->createQueryBuilder('u')
20-
->where('u.status = 0');
21-
},)
22-
)
16+
add('phone', 'text', array('required' => false,))
17+
18+
->add('clan', 'entity', array('label' => 'label.clan',
19+
'class' => 'COCBundle:Clan',
20+
'query_builder' => function(EntityRepository $er) {
21+
return $er->createQueryBuilder('u')
22+
->where('u.status = 0');
23+
},)
24+
)
2325

2426
/*
2527
->add('clan', 'text', [
@@ -28,6 +30,7 @@ public function buildForm(FormBuilderInterface $builder, array $options)
2830
->add('clanName', 'text', array('label' => 'label.clanName', 'required' => false,))
2931
->add('pass', null, array('label' => 'label.password', 'required' => false,))
3032
->add('password', null, array('label' => 'label.clanPassword', 'required' => false,'mapped' => false))
33+
->add('country', 'hidden', ['mapped' => false,])
3134
->add('save', 'submit', array('label' => 'label.register'));
3235
}
3336

src/Application/Sonata/UserBundle/Repository/UserRepository.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,18 @@ public function getNonAssignedUsers()
3939
return $qb;
4040
}
4141

42+
public function getUsers($clan)
43+
{
44+
$qb = $this->createQueryBuilder('u')
45+
->select('u')
46+
->where('u.clan = :clan')
47+
->andWhere('u.phone is NOT NULL')
48+
->orderBy('u.username', 'DESC')
49+
->setParameter('clan', $clan);
50+
51+
return $qb;
52+
}
53+
4254

4355
public function findUserInfoBySeason($season)
4456
{

src/Application/Sonata/UserBundle/Resources/views/Registration/register_content.html.twig

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@
2222

2323
<div style="padding-top:50px" class="panel-body" >
2424

25+
26+
27+
2528
<div style="display:none" id="login-alert" class="alert alert-danger col-sm-12"></div>
2629
<form action="{{ path('fos_user_registration_register') }}" {{ form_enctype(form) }} method="POST" class="form-horizontal" role="form">
2730

@@ -127,10 +130,11 @@
127130
<div class="form-group">
128131
{{ form_label(form.phone, null, {'label_attr': {'class': 'col-sm-5 control-label'}}) }}
129132
<div class="col-sm-6">
130-
{{ form_widget(form.phone, {'attr': {'class': 'form-control', 'placeholder' : 'Phone number'}}) }}
131-
{% if form.phone.vars.errors[0].message is defined %}
132-
<span class="help-block">{{ form.phone.vars.errors[0].message }}</span>
133-
{% endif %}
133+
{{ form_widget(form.phone, {'id' : 'phone', 'attr': {'class': 'form-control', 'placeholder' : 'Phone number'}}) }}
134+
135+
<span id="valid-msg" class="hide"><i class="fa fa-check-square-o"> Valid</i></span>
136+
<span id="error-msg" class="hide"><i class="fa fa-times"></i>Invalid</span>
137+
134138
</div>
135139
</div>
136140

0 commit comments

Comments
 (0)