gradebook_edit_link.php 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. // $Id: gradebook_edit_link.php 400 2007-04-10 13:58:55Z stijn $
  3. /*
  4. ==============================================================================
  5. Dokeos - elearning and course management software
  6. Copyright (c) 2006 Dokeos S.A.
  7. Copyright (c) 2007 Stijn Konings, Bert Stepp� (Hogeschool Gent)
  8. For a full list of contributors, see "credits.txt".
  9. The full license can be read in "license.txt".
  10. This program is free software; you can redistribute it and/or
  11. modify it under the terms of the GNU General Public License
  12. as published by the Free Software Foundation; either version 2
  13. of the License, or (at your option) any later version.
  14. See the GNU General Public License for more details.
  15. Contact address: Dokeos, 44 rue des palais, B-1030 Brussels, Belgium
  16. Mail: info@dokeos.com
  17. ==============================================================================
  18. */
  19. $language_file = 'gradebook';
  20. $cidReset = true;
  21. include_once ('../inc/global.inc.php');
  22. include_once ('lib/be.inc.php');
  23. include_once ('lib/gradebook_functions.inc.php');
  24. include_once ('lib/fe/linkform.class.php');
  25. include_once ('lib/fe/linkaddeditform.class.php');
  26. api_block_anonymous_users();
  27. block_students();
  28. $linkarray = LinkFactory :: load($_GET['editlink']);
  29. $link = $linkarray[0];
  30. $form = new LinkAddEditForm(LinkAddEditForm :: TYPE_EDIT,
  31. null,
  32. null,
  33. $link,
  34. 'edit_link_form',
  35. api_get_self() . '?selectcat=' . $_GET['selectcat']
  36. . '&editlink=' . $_GET['editlink']);
  37. if ($form->validate())
  38. {
  39. $values = $form->exportValues();
  40. $link->set_weight($values['weight']);
  41. $link->set_date(strtotime($values['date']));
  42. $link->set_visible(empty ($values['visible']) ? 0 : 1);
  43. $link->save();
  44. header('Location: gradebook.php?linkedited=&selectcat=' . $link->get_category_id());
  45. exit;
  46. }
  47. $interbreadcrumb[] = array (
  48. 'url' => 'gradebook.php?selectcat='.$_GET['selectcat'],
  49. 'name' => get_lang('Gradebook'
  50. ));
  51. Display :: display_header(get_lang('EditLink'));
  52. $form->display();
  53. Display :: display_footer();
  54. ?>