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