Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
kohinos
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
9
Issues
9
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cooperatic-mlc
kohinos
Commits
be698485
Commit
be698485
authored
6 years ago
by
Julien Jorry
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add news on front
parent
e190a36b
master
…
dev
update-from-kohinos-repo
No related merge requests found
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
39 additions
and
13 deletions
+39
-13
NewsAdmin.php
src/Admin/NewsAdmin.php
+2
-2
AppExtension.php
src/Twig/AppExtension.php
+14
-8
groupes.html.twig
templates/common/groupes.html.twig
+1
-1
news.html.twig
templates/common/news.html.twig
+20
-0
rubriques.html.twig
templates/common/rubriques.html.twig
+1
-1
index.html.twig
templates/index.html.twig
+1
-1
No files found.
src/Admin/NewsAdmin.php
View file @
be698485
...
@@ -36,8 +36,8 @@ class NewsAdmin extends AbstractAdmin
...
@@ -36,8 +36,8 @@ class NewsAdmin extends AbstractAdmin
))
))
->
add
(
'media'
,
MediaType
::
class
,
array
(
->
add
(
'media'
,
MediaType
::
class
,
array
(
'provider'
=>
'sonata.media.provider.file'
,
'provider'
=>
'sonata.media.provider.file'
,
'context'
=>
'
document
'
,
'context'
=>
'
actualites
'
,
'label'
=>
'
Document
'
'label'
=>
'
Image
'
))
))
->
add
(
'name'
,
TextType
::
class
,
array
(
->
add
(
'name'
,
TextType
::
class
,
array
(
'label'
=>
'Titre :'
'label'
=>
'Titre :'
...
...
This diff is collapsed.
Click to expand it.
src/Twig/AppExtension.php
View file @
be698485
...
@@ -4,6 +4,7 @@ namespace App\Twig;
...
@@ -4,6 +4,7 @@ namespace App\Twig;
use
App\Entity\Flux
;
use
App\Entity\Flux
;
use
App\Entity\Groupe
;
use
App\Entity\Groupe
;
use
App\Entity\News
;
use
App\Entity\Rubrique
;
use
App\Entity\Rubrique
;
use
App\Entity\User
;
use
App\Entity\User
;
use
Symfony\Component\HttpFoundation\Request
;
use
Symfony\Component\HttpFoundation\Request
;
...
@@ -27,16 +28,21 @@ class AppExtension extends AbstractExtension
...
@@ -27,16 +28,21 @@ class AppExtension extends AbstractExtension
public
function
getFunctions
()
public
function
getFunctions
()
{
{
return
[
return
[
new
\Twig_SimpleFunction
(
'getLastNews'
,
array
(
$this
,
'getLastNews'
)),
new
\Twig_SimpleFunction
(
'getAllRubriques'
,
array
(
$this
,
'getAllRubriques'
)),
new
\Twig_SimpleFunction
(
'getAllRubriques'
,
array
(
$this
,
'getAllRubriques'
)),
new
\Twig_SimpleFunction
(
'getAllGroupes'
,
array
(
$this
,
'getAllGroupes'
)),
new
\Twig_SimpleFunction
(
'getAllGroupes'
,
array
(
$this
,
'getAllGroupes'
)),
new
\Twig_SimpleFunction
(
'getAllFlux'
,
array
(
$this
,
'getAllFlux'
)),
new
\Twig_SimpleFunction
(
'getAllFlux'
,
array
(
$this
,
'getAllFlux'
)),
new
\Twig_SimpleFunction
(
'parameter'
,
function
(
$name
)
new
\Twig_SimpleFunction
(
'parameter'
,
function
(
$name
)
{
{
return
$this
->
container
->
getParameter
(
$name
);
return
$this
->
container
->
getParameter
(
$name
);
})
})
];
];
}
}
public
function
getLastNews
(
$limit
=
5
)
{
return
$this
->
container
->
get
(
'doctrine'
)
->
getRepository
(
News
::
class
)
->
findBy
(
array
(
'enabled'
=>
true
),
array
(
'createdAt'
=>
'DESC'
),
$limit
);
}
public
function
getAllRubriques
()
public
function
getAllRubriques
()
{
{
return
$this
->
container
->
get
(
'doctrine'
)
->
getRepository
(
Rubrique
::
class
)
->
findBy
(
array
(
'enabled'
=>
true
));
return
$this
->
container
->
get
(
'doctrine'
)
->
getRepository
(
Rubrique
::
class
)
->
findBy
(
array
(
'enabled'
=>
true
));
...
@@ -102,14 +108,14 @@ class AppExtension extends AbstractExtension
...
@@ -102,14 +108,14 @@ class AppExtension extends AbstractExtension
public
function
safeEmailFilter
(
$str
)
public
function
safeEmailFilter
(
$str
)
{
{
$email
=
''
;
$email
=
''
;
for
(
$i
=
0
,
$len
=
strlen
(
$str
);
$i
<
$len
;
$i
++
)
{
for
(
$i
=
0
,
$len
=
strlen
(
$str
);
$i
<
$len
;
$i
++
)
{
$j
=
mt_rand
(
0
,
1
);
$j
=
mt_rand
(
0
,
1
);
if
(
$j
===
0
)
{
if
(
$j
===
0
)
{
$email
.=
'&#'
.
ord
(
$str
[
$i
]
)
.
';'
;
$email
.=
'&#'
.
ord
(
$str
[
$i
])
.
';'
;
}
else
if
(
$j
===
1
)
{
}
else
if
(
$j
===
1
)
{
$email
.=
$str
[
$i
];
$email
.=
$str
[
$i
];
}
}
}
}
return
str_replace
(
'@'
,
'@'
,
$email
);
return
str_replace
(
'@'
,
'@'
,
$email
);
}
}
}
}
This diff is collapsed.
Click to expand it.
templates/common/groupes.html.twig
View file @
be698485
<div
class=
"rubriques"
>
<div
class=
"rubriques"
>
<h4>
<i
class=
"fa fa-paperclip"
></i>
</i>
Groupes Locaux
</h4>
<h4>
<i
class=
"fa fa-paperclip"
></i>
Groupes Locaux
</h4>
<p>
<p>
{%
for
groupe
in
getAllGroupes
()
%}
{%
for
groupe
in
getAllGroupes
()
%}
<a
class=
'groupe'
href=
'
{{
path
(
'show_groupe'
,
{
'slug'
:
groupe.slug
}
)
}}
'
>
{{
groupe.name
}}
</a>
{%
if
not
loop.last
%}
•
{%
endif
%}
<a
class=
'groupe'
href=
'
{{
path
(
'show_groupe'
,
{
'slug'
:
groupe.slug
}
)
}}
'
>
{{
groupe.name
}}
</a>
{%
if
not
loop.last
%}
•
{%
endif
%}
...
...
This diff is collapsed.
Click to expand it.
templates/common/news.html.twig
0 → 100644
View file @
be698485
<div
class=
"rubriques"
>
<h4>
<i
class=
"fa fa-newspaper"
></i>
Actualités
</h4>
<p>
{%
for
news
in
getLastNews
()
%}
<div
class=
"card mb-2"
>
<div
class=
"card-header"
style=
'cursor:pointer;'
onmouseover=
"$(this).addClass('border-primary');"
onmouseout=
"$(this).removeClass('border-primary');"
>
{{
news.title
}}
</div>
<div
class=
"card-body"
>
<h6
class=
"card-subtitle text-muted mb-3"
>
Le
{{
news.createdAt
|
date
(
'd/m/Y'
)
}}
</h6>
<div
class=
"card-text"
>
{%
if
news.media
%}
<img
src=
"
{%
path
news.media
,
'reference'
%}
"
style=
"max-width: 100%;"
/>
{%
endif
%}
{{
news.content
|
raw
}}
</div>
</div>
</div>
{%
endfor
%}
</p>
</div>
\ No newline at end of file
This diff is collapsed.
Click to expand it.
templates/common/rubriques.html.twig
View file @
be698485
<div
class=
"rubriques"
>
<div
class=
"rubriques"
>
<h4>
<i
class=
"fa fa-flag"
></i>
</i>
Rubriques
</h4>
<h4>
<i
class=
"fa fa-flag"
></i>
Rubriques
</h4>
<p>
<p>
{%
for
rubrique
in
getAllRubriques
()
%}
{%
for
rubrique
in
getAllRubriques
()
%}
<a
class=
'rubrique'
href=
'
{{
path
(
'show_rubrique'
,
{
'slug'
:
rubrique.slug
}
)
}}
'
>
{{
rubrique.name
}}
</a>
{%
if
not
loop.last
%}
•
{%
endif
%}
<a
class=
'rubrique'
href=
'
{{
path
(
'show_rubrique'
,
{
'slug'
:
rubrique.slug
}
)
}}
'
>
{{
rubrique.name
}}
</a>
{%
if
not
loop.last
%}
•
{%
endif
%}
...
...
This diff is collapsed.
Click to expand it.
templates/index.html.twig
View file @
be698485
...
@@ -26,7 +26,7 @@
...
@@ -26,7 +26,7 @@
{%
endif
%}
{%
endif
%}
</div>
</div>
<div
class=
'col-3'
>
<div
class=
'col-3'
>
SIDEBAR
{%
include
'common/news.html.twig'
%}
</div>
</div>
</div>
</div>
</div>
</div>
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment