Fix link + fix agenda list

remotes/angel/1.11.x
jmontoyaa 8 years ago
parent 6ef3c2f4b0
commit bb1f536eba
  1. 19
      main/calendar/agenda_list.php
  2. 9
      main/template/default/agenda/event_list.tpl

@ -63,22 +63,23 @@ $actions = $agenda->displayActions('list');
$tpl = new Template(get_lang('Events'));
$tpl->assign('agenda_events', $events);
$tpl->assign('url', $url);
$tpl->assign('show_action', in_array($type, ['course', 'session']));
$tpl->assign('actions', $actions);
$tpl->assign('is_allowed_to_edit', api_is_allowed_to_edit());
if (api_is_allowed_to_edit()) {
if (isset($_GET['action']) && $_GET['action'] == 'change_visibility') {
$courseInfo = api_get_course_info();
if (empty($courseInfo)) {
// This happens when list agenda is not inside a course
if (($type == 'course' || $type == 'session') && isset($_GET['cid']) && intval($_GET['cid']) !== 0) {
// For course and session event types
// Just needs course ID
$courseInfo = array('real_id' => intval($_GET['cid']));
$agenda->changeVisibility($_GET['id'], $_GET['visibility'], $courseInfo);
}
$courseCondition = '';
// This happens when list agenda is not inside a course
if (($type == 'course' || $type == 'session' && !empty($courseInfo))) {
// For course and session event types
// Just needs course ID
$agenda->changeVisibility($_GET['id'], $_GET['visibility'], $courseInfo);
} else {
$courseCondition = '&'.api_get_cidreq();
}
header('Location: '. api_get_self());
header('Location: '. api_get_self().'?type='.$agenda->type.$courseCondition);
exit;
}
}

@ -9,7 +9,7 @@
<th>
{{ 'Title' | get_lang }}
</th>
{% if is_allowed_to_edit %}
{% if is_allowed_to_edit and show_action %}
<th>
{{ 'Actions' | get_lang }}
</th>
@ -41,22 +41,21 @@
{{ event.attachment }}
</td>
{% if is_allowed_to_edit %}
{% if is_allowed_to_edit and show_action %}
<td>
{% if event.visibility == 1 %}
<a class="btn btn-default" href="{% if url %}{{ url }}{% else %}{{ event.url }}{% endif %}&action=change_visibility&visibility=0&id={{ event.real_id }}">
<a class="btn btn-default" href="{% if url %}{{ url }}{% else %}{{ event.url }}{% endif %}&action=change_visibility&visibility=0&id={{ event.real_id }}&type={{ event.type }}">
<img title="{{ 'Invisible' }}" src="{{'visible.png'|icon(32)}} " width="32" height="32">
</a>
{% else %}
{% if event.type == 'course' or event.type == 'session' %}
<a class="btn btn-default" href="{% if url %}{{ url }}{% else %}{{ event.url }}{% endif %}&action=change_visibility&visibility=1&id={{ event.real_id }}">
<a class="btn btn-default" href="{% if url %}{{ url }}{% else %}{{ event.url }}{% endif %}&action=change_visibility&visibility=1&id={{ event.real_id }}&type={{ event.type }}">
<img title="{{ 'Visible' }}" src="{{'invisible.png'|icon(32)}} " width="32" height="32">
</a>
{% endif %}
{% endif %}
</td>
{% endif %}
</tr>
{% endfor %}
</table>

Loading…
Cancel
Save