Fix urls, change page size

pull/2487/head
jmontoyaa 8 years ago
parent 293a5fb8a5
commit 57c17bde87
  1. 2
      plugin/studentfollowup/StudentFollowUpPlugin.php
  2. 10
      plugin/studentfollowup/my_students.php
  3. 4
      plugin/studentfollowup/view/my_students.html.twig
  4. 84
      plugin/studentfollowup/view/post.html.twig

@ -241,6 +241,6 @@ class StudentFollowUpPlugin extends Plugin
*/
public static function getPageSize()
{
return 2;
return 20;
}
}

@ -62,7 +62,6 @@ if (!empty($userList) || api_is_platform_admin()) {
if (is_array($keyword)) {
foreach ($keyword as $key) {
$key = trim($key);
//$key = api_replace_dangerous_char($key);
if (empty($key)) {
continue;
}
@ -77,12 +76,11 @@ if (!empty($userList) || api_is_platform_admin()) {
->setParameter('keyword', "%$keyword%")
;
}
}
$query = $qb->getQuery();
$items = new Paginator($query, $fetchJoinCollection = true);
$totalItems = count($items);
$items = new Paginator($query);
$totalItems = $items->count();
$pagesCount = ceil($totalItems / $pageSize);
}
@ -93,9 +91,9 @@ if ($totalItems > 1) {
for ($i = 0; $i < $pagesCount; $i++) {
$newPage = $i + 1;
if ($currentPage == $newPage) {
$pagination .= '<li class="active"><a href="'.$url.'&page='.$newPage.'">'.$newPage.'</a></li>';
$pagination .= '<li class="active"><a href="'.$url.'page='.$newPage.'">'.$newPage.'</a></li>';
} else {
$pagination .= '<li><a href="'.$url.'&page='.$newPage.'">'.$newPage.'</a></li>';
$pagination .= '<li><a href="'.$url.'page='.$newPage.'">'.$newPage.'</a></li>';
}
}
$pagination .= '</ul>';

@ -10,10 +10,10 @@
<tr>
<td>{{ user.user.completeNameWithUsername }}</td>
<td>
<a href="{{ my_students_url }}&student={{ user.user.id }}">
<a href="{{ my_students_url }}student={{ user.user.id }}">
<img src="{{ '2rightarrow.png'|icon() }}">
</a>
<a href="{{ post_url }}&student_id={{ user.user.id }}">
<a href="{{ post_url }}student_id={{ user.user.id }}">
<img src="{{ 'blog.png'|icon() }}">
</a>
</td>

@ -2,51 +2,52 @@
{% if post %}
<div class="panel panel-default">
<div class="panel-body">
<div class="row">
<div class="col-md-8">
<h2>{{ post.title }}</h2>
<p>{{ post.content }}</p>
{% if type == 'simple' %}
{% set countElements = post.hasParent + post.children.count %}
{% if countElements %}
<a href="{{ post_url }}&post_id={{ post.id }}">
{% if countElements > 1 %}
{{ information_icon }} + {{ countElements }}
{% else %}
{{ information_icon }} + 1
<div class="row">
<div class="col-md-8">
<h2>{{ post.title }}</h2>
<p>{{ post.content }}</p>
{% if type == 'simple' %}
{% set countElements = post.hasParent + post.children.count %}
{% if countElements %}
<a href="{{ post_url }}&post_id={{ post.id }}">
{% if countElements > 1 %}
{{ information_icon }} + {{ countElements }}
{% else %}
{{ information_icon }} + 1
{% endif %}
</a>
{% endif %}
</a>
{% endif %}
{% endif %}
{#{% if type == 'all' %}#}
{#{% if related_posts %}#}
{#<h3>Related</h3>#}
{#{% for post in related_posts %}#}
{#<p>#}
{#<a href="{{ post_url }}&post_id={{ post.id }}">#}
{#{{ post.title }}#}
{#</a>#}
{#</p>#}
{#{% endfor %}#}
{#{% if type == 'all' %}#}
{#{% if related_posts %}#}
{#<h3>Related</h3>#}
{#{% for post in related_posts %}#}
{#<p>#}
{#<a href="{{ post_url }}&post_id={{ post.id }}">#}
{#{{ post.title }}#}
{#</a>#}
{#</p>#}
{#{% endfor %}#}
{#{% endif %}#}
{#{% endif %}#}
{#{% endif %}#}
</div>
<div class="col-md-4">
<p>{{ post.createdAt |date('d/m/Y') }}</p>
<p>{{ post.insertUser.completeName }}</p>
{% if post.tags %}
{% for tag in post.tags %}
{{ tag }}
{% if not loop.last %}
,
{% endif %}
{% endfor %}
{% endif %}
</div>
<div class="col-md-4">
<p>{{ post.createdAt |date('d/m/Y') }}</p>
<p>{{ post.insertUser.completeName }}</p>
{% if post.tags %}
{% for tag in post.tags %}
{{ tag }}
{% if not loop.last %}
,
{% endif %}
{% endfor %}
{% endif %}
{% if post.private %}
<p><span class="label label-warning">Private</span></p>
{% endif %}
</div>
{% if post.private %}
<p><span class="label label-warning">Private</span></p>
{% endif %}
</div>
</div>
</div>
</div>
@ -67,7 +68,6 @@
<div class="actions">
{{ back_link }}
</div>
<h2 class="text-center">
{{ care_title }} - {{ student_info.complete_name }} - {{ post.title }}
{% if post.parent %}

Loading…
Cancel
Save