From 7c5ba2eb17bcc421ac981ff7bd78b573e60bd7a6 Mon Sep 17 00:00:00 2001 From: Olivier PEREZ Date: Wed, 17 Dec 2014 23:12:05 +0100 Subject: [PATCH] Split parts of studs.tpl into severals sub-templates. --- app/inc/i18n.php | 2 +- tpl/part/comments.tpl | 36 ++++++ tpl/part/poll_info.tpl | 32 +++++ tpl/part/vote_table.tpl | 192 ++++++++++++++++++++++++++++ tpl/studs.tpl | 270 ++-------------------------------------- 5 files changed, 268 insertions(+), 264 deletions(-) create mode 100644 tpl/part/comments.tpl create mode 100644 tpl/part/poll_info.tpl create mode 100644 tpl/part/vote_table.tpl diff --git a/app/inc/i18n.php b/app/inc/i18n.php index 31c6f2d..5040073 100644 --- a/app/inc/i18n.php +++ b/app/inc/i18n.php @@ -50,7 +50,7 @@ if (strtoupper(substr(PHP_OS,0,3))=='WIN'){ putenv('LANGUAGE=');//sert à quoi? setlocale(LC_ALL, $locale); setlocale(LC_TIME, $locale); -setlocale(LC_MESSAGES, $locale); +//setlocale(LC_MESSAGES, $locale); $domain = 'Studs'; bindtextdomain($domain, 'locale'); diff --git a/tpl/part/comments.tpl b/tpl/part/comments.tpl new file mode 100644 index 0000000..4e9f09c --- /dev/null +++ b/tpl/part/comments.tpl @@ -0,0 +1,36 @@ + + +{* Comment list *} + +{if $comments|count > 0} + {foreach $comments as $comment} +
+ {$comment->usercomment}  + {nl2br($comment->comment)} +
+ {/foreach} +{/if} + +{* Add comment form *} +{if $active} +
+
+
+
{_("Add a comment to the poll")} +
+ + +
+
+ + +
+
+ +
+
+
+
+
+
+{/if} \ No newline at end of file diff --git a/tpl/part/poll_info.tpl b/tpl/part/poll_info.tpl new file mode 100644 index 0000000..d0108e1 --- /dev/null +++ b/tpl/part/poll_info.tpl @@ -0,0 +1,32 @@ +
+
+
+

{$poll->title}

+
+
+
+ + {_('Export to CSV')} +
+
+
+
+
+
+

{_("Initiator of the poll")}

+

{$poll->admin_name}

+
+ +
+ + {if !empty($poll->comment)} +
+

{_("Description")}


+

{$poll->comment}

+
+ {/if} +
+
\ No newline at end of file diff --git a/tpl/part/vote_table.tpl b/tpl/part/vote_table.tpl new file mode 100644 index 0000000..b9f9186 --- /dev/null +++ b/tpl/part/vote_table.tpl @@ -0,0 +1,192 @@ +

{_('Votes of the poll')}

+ +
+
+ + + + + + {foreach $slots as $id=>$slot} + + {for $foo=0 to ($slot->moments|count)-1} + {append var='headersM' value=$id} + {/for} + {/foreach} + + + + + {foreach $slots as $id=>$slot} + + {/foreach} + + + + + {$headersDCount=0} + {foreach $slots as $slot} + {foreach $slot->moments as $id=>$moment} + + {append var='headersD' value=$headersDCount} + {$headersDCount = $headersDCount+1} + {/foreach} + {/foreach} + + + + + {foreach $votes as $vote} + + {* Edited line *} + + + + {if $editingVoteId == $vote->id} + {foreach $vote->choices as $k=>$choice} + + + {/foreach} + + {else} + + {* Voted line *} + + {foreach $vote->choices as $k=>$choice} + + {if $choice==2} + + {elseif $choice==1} + + {else} + + {/if} + + {/foreach} + + {if $active && $poll->editable} + + {else} + + {/if} + {/if} + + {/foreach} + + {* Line to add a new vote *} + + {if $active && $editingVoteId == 0} + + + {$i = 0} + {foreach $slots as $slot} + {foreach $slot->moments as $moment} + + {$i = $i+1} + {/foreach} + {/foreach} + + + {/if} + + {* Line displaying best moments *} + {$count_bests = 0} + + + {$max = max($best_moments)} + {foreach $best_moments as $best_moment} + {if $max == $best_moment} + {$count_bests = $count_bests +1} + + {else} + + {/if} + {/foreach} + + +
{_('Votes of the poll')} {$poll->title}
{$slot->day|date_format:'%B %Y'}
{$slot->day|date_format:$date_format.txt_day}
{$moment}
{$vote->name} +
    +
  • + + +
  • +
  • + + +
  • +
  • + + +
  • +
+
{_('Yes')}(){_('Ifneedbe')}{_('No')} + +
+
+ + +
+
+
    +
  • + + +
  • +
  • + + +
  • +
  • + + +
  • +
+
{_("Addition")}{$max}
+
+
+ +{* Best votes listing *} + +{$max = max($best_moments)} +{if $max > 0} +
+ {if $count_bests == 1} +

{_("Best choice")}

+
+

{_("The best choice at this time is:")}

+ {elseif $count_bests > 1} +

{_("Best choices")}

+
+

{_("The bests choices at this time are:")}

+ {/if} + + + {$i = 0} +
    + {foreach $slots as $slot} + {foreach $slot->moments as $moment} + {if $best_moments[$i] == $max} +
  • {$slot->day|date_format:$date_format.txt_full} - {$moment}
  • + {/if} + {$i = $i+1} + {/foreach} + {/foreach} +
+

{_("with")} {$max} {if $max==1}{_('vote')}{else}{_('votes')}{/if}.

+
+
+{/if} \ No newline at end of file diff --git a/tpl/studs.tpl b/tpl/studs.tpl index dc7f0dc..4cba8d6 100644 --- a/tpl/studs.tpl +++ b/tpl/studs.tpl @@ -2,44 +2,13 @@ {block name=main} + {if !empty($message)} + + {/if} + {* Global informations about the current poll *} -{if !empty($message)} - -{/if} - -
-
-
-

{$poll->title}

-
-
-
- - {_('Export to CSV')} -
-
-
-
-
-
-

{_("Initiator of the poll")}

-

{$poll->admin_name}

-
- -
- - {if !empty($poll->comment)} -
-

{_("Description")}


-

{$poll->comment}

-
- {/if} -
-
+{include 'part/poll_info.tpl'} {* Information about voting *} @@ -70,235 +39,10 @@ {* Vote table *} -

{_('Votes of the poll')}

-
-
- - - - - - {foreach $slots as $id=>$slot} - - {for $foo=0 to ($slot->moments|count)-1} - {append var='headersM' value=$id} - {/for} - {/foreach} - - - - - {foreach $slots as $id=>$slot} - - {/foreach} - - - - - {$headersDCount=0} - {foreach $slots as $slot} - {foreach $slot->moments as $id=>$moment} - - {append var='headersD' value=$headersDCount} - {$headersDCount = $headersDCount+1} - {/foreach} - {/foreach} - - - - - {foreach $votes as $vote} - - {* Edited line *} - - - - {if $editingVoteId == $vote->id} - {foreach $vote->choices as $k=>$choice} - - - {/foreach} - - {else} - - {* Voted line *} - - {foreach $vote->choices as $k=>$choice} - - {if $choice==2} - - {else if $choice==1} - - {else} - - {/if} - - {/foreach} - - {if $poll->active && $poll->editable} - - {else} - - {/if} - {/if} - - {/foreach} - - {* Line to add a new vote *} - - {if $poll->active && $editingVoteId == 0} - - - {$i = 0} - {foreach $slots as $slot} - {foreach $slot->moments as $moment} - - {$i = $i+1} - {/foreach} - {/foreach} - - - {/if} - - {* Line displaying best moments *} - {$count_bests = 0} - - - {$max = max($best_moments)} - {foreach $best_moments as $best_moment} - {if $max == $best_moment} - {$count_bests = $count_bests +1} - - {else} - - {/if} - {/foreach} - - -
{_('Votes of the poll')} {$poll->title}
{$slot->day|date_format:'%B %Y'}
{$slot->day|date_format:$date_format.txt_day}
{$moment}
{$vote->name} -
    -
  • - - -
  • -
  • - - -
  • -
  • - - -
  • -
-
{_('Yes')}(){_('Ifneedbe')}{_('No')} - -
-
- - -
-
-
    -
  • - - -
  • -
  • - - -
  • -
  • - - -
  • -
-
{_("Addition")}{$max}
-
-
- -{* Best votes listing *} - -{$max = max($best_moments)} -{if $max > 0} -
- {if $count_bests == 1} -

{_("Best choice")}

-
-

{_("The best choice at this time is:")}

- {elseif $count_bests > 1} -

{_("Best choices")}

-
-

{_("The bests choices at this time are:")}

- {/if} - - - {$i = 0} -
    - {foreach $slots as $slot} - {foreach $slot->moments as $moment} - {if $best_moments[$i] == $max} -
  • {$slot->day|date_format:$date_format.txt_full} - {$moment}
  • - {/if} - {$i = $i+1} - {/foreach} - {/foreach} -
-

{_("with")} {$max} {if $max==1}{_('vote')}{else}{_('votes')}{/if}.

-
-
-{/if} +{include 'part/vote_table.tpl' active=$poll->active} {* Comments *} -{if $poll->active} - +{include 'part/comments.tpl' active=$poll->active comments=$comments} - {* Comment list *} - - {if $comments|count > 0} - {foreach $comments as $comment} -
- {$comment->usercomment}  - {nl2br($comment->comment)} -
- {/foreach} - {/if} - - {* Add comment form *} - -
-
-
-
{_("Add a comment to the poll")} -
- - -
-
- - -
-
- -
-
-
-
-
-
-{/if} {/block} \ No newline at end of file