list.php 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. if ($currentUserId == $user->getId()) {
  4. if ($allowEdit) {
  5. $actions[] = Display::url(
  6. Display::return_icon('add.png', get_lang('Add'), [], ICON_SIZE_MEDIUM),
  7. $baseUrl.'action=add_item'
  8. );
  9. $actions[] = Display::url(
  10. Display::return_icon('folder.png', get_lang('AddCategory'), [], ICON_SIZE_MEDIUM),
  11. $baseUrl.'action=add_category'
  12. );
  13. $actions[] = Display::url(
  14. Display::return_icon('shared_setting.png', get_lang('Preview'), [], ICON_SIZE_MEDIUM),
  15. $baseUrl.'preview=&user='.$user->getId()
  16. );
  17. } else {
  18. $actions[] = Display::url(
  19. Display::return_icon('shared_setting_na.png', get_lang('Preview'), [], ICON_SIZE_MEDIUM),
  20. $baseUrl
  21. );
  22. }
  23. }
  24. $form = new FormValidator('a');
  25. $form->addUserAvatar('user', get_lang('User'), 'medium');
  26. $form->setDefaults(['user' => $user]);
  27. $criteria = ['user' => $user];
  28. if (!$allowEdit) {
  29. $criteria['isVisible'] = true;
  30. }
  31. $categories = $em
  32. ->getRepository('ChamiloCoreBundle:PortfolioCategory')
  33. ->findBy($criteria);
  34. if ($course) {
  35. $criteria['course'] = $course;
  36. $criteria['session'] = $session;
  37. }
  38. $criteria['category'] = null;
  39. $items = $em
  40. ->getRepository('ChamiloCoreBundle:Portfolio')
  41. ->findBy($criteria);
  42. $template = new Template(null, false, false, false, false, false, false);
  43. $template->assign('user', $user);
  44. $template->assign('course', $course);
  45. $template->assign('session', $session);
  46. $template->assign('allow_edit', $allowEdit);
  47. $template->assign('portfolio', $categories);
  48. $template->assign('uncategorized_items', $items);
  49. $layout = $template->get_template('portfolio/list.html.twig');
  50. $content = $template->fetch($layout);