view.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. $language_file = array('exercice', 'work', 'document', 'admin');
  3. require_once '../inc/global.inc.php';
  4. $current_course_tool = TOOL_STUDENTPUBLICATION;
  5. require_once 'work.lib.php';
  6. $id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : null;
  7. $work = get_work_data_by_id($id);
  8. if (empty($id) || empty($work)) {
  9. api_not_allowed();
  10. }
  11. $interbreadcrumb[] = array ('url' => 'work.php', 'name' => get_lang('StudentPublications'));
  12. $my_folder_data = get_work_data_by_id($work['parent_id']);
  13. $course_info = api_get_course_info();
  14. if (user_is_author($id) || $course_info['show_score'] == 0 && $work['active'] == 1 && $work['accepted'] == 1) {
  15. $url_dir = 'work.php?&id=' . $my_folder_data['id'];
  16. $interbreadcrumb[] = array ('url' => $url_dir,'name' => $my_folder_data['title']);
  17. $interbreadcrumb[] = array ('url' => '#','name' => $work['title']);
  18. if (($course_info['show_score'] == 0 && $work['active'] == 1 && $work['accepted'] == 1) || api_is_allowed_to_edit() || ($work['user_id'] == api_get_user_id() && $work['active'] == 1 && $work['accepted'] == 1)) {
  19. $tpl = new Template();
  20. $tpl->assign('work', $work);
  21. $template = $tpl->get_template('work/view.tpl');
  22. $content = $tpl->fetch($template);
  23. $tpl->assign('content', $content);
  24. $tpl->display_one_col_template();
  25. } else {
  26. api_not_allowed();
  27. }
  28. }