parent
ad649f4eb1
commit
4b5f86c413
@ -0,0 +1,61 @@ |
|||||||
|
<?php |
||||||
|
/* For licensing terms, see /license.txt */ |
||||||
|
|
||||||
|
use Chamilo\CourseBundle\Entity\CSurvey; |
||||||
|
use Chamilo\CourseBundle\Entity\CSurveyInvitation; |
||||||
|
use Chamilo\CoreBundle\Entity\Course; |
||||||
|
use Chamilo\CoreBundle\Entity\Session; |
||||||
|
|
||||||
|
$cidReset = true; |
||||||
|
|
||||||
|
require_once __DIR__.'/../inc/global.inc.php'; |
||||||
|
|
||||||
|
api_block_anonymous_users(true); |
||||||
|
|
||||||
|
$em = Database::getManager(); |
||||||
|
|
||||||
|
$currentUser = api_get_user_entity(api_get_user_id()); |
||||||
|
$avatarPath = UserManager::getUserPicture($currentUser->getId()); |
||||||
|
$pending = SurveyUtil::getUserPendingInvitations($currentUser->getId()); |
||||||
|
|
||||||
|
$surveysData = []; |
||||||
|
|
||||||
|
foreach ($pending as $i => $item) { |
||||||
|
if (is_a($item, 'Chamilo\CourseBundle\Entity\CSurveyInvitation')) { |
||||||
|
continue; |
||||||
|
} |
||||||
|
|
||||||
|
/** @var CSurvey $survey */ |
||||||
|
$survey = $item; |
||||||
|
/** @var CSurveyInvitation invitation */ |
||||||
|
$invitation = $pending[$i + 1]; |
||||||
|
/** @var Course $course */ |
||||||
|
$course = $em->find('ChamiloCoreBundle:Course', $survey->getCId()); |
||||||
|
/** @var Session $session */ |
||||||
|
$session = $em->find('ChamiloCoreBundle:Session', $survey->getSessionId()); |
||||||
|
|
||||||
|
$surveysData[$survey->getSurveyId()] = [ |
||||||
|
'title' => $survey->getTitle(), |
||||||
|
'invitation_code' => $invitation->getInvitationCode(), |
||||||
|
'avail_from' => $survey->getAvailFrom(), |
||||||
|
'avail_till' => $survey->getAvailTill(), |
||||||
|
'course' => $course |
||||||
|
? ['id' => $course->getId(), 'title' => $course->getTitle(), 'code' => $course->getCode()] |
||||||
|
: null, |
||||||
|
'session' => $session |
||||||
|
? ['id' => $session->getId(), 'name' => $session->getName()] |
||||||
|
: null |
||||||
|
]; |
||||||
|
} |
||||||
|
|
||||||
|
$toolName = get_lang('PendingSurveys'); |
||||||
|
|
||||||
|
$template = new Template($toolName); |
||||||
|
$template->assign('user', $currentUser); |
||||||
|
$template->assign('user_avatar', $avatarPath); |
||||||
|
$template->assign('surveys', $surveysData); |
||||||
|
$layout = $template->get_template('survey/pending.tpl'); |
||||||
|
$content = $template->fetch($layout); |
||||||
|
$template->assign('header', $toolName); |
||||||
|
$template->assign('content', $content); |
||||||
|
$template->display_one_col_template(); |
@ -0,0 +1,38 @@ |
|||||||
|
<div class="media"> |
||||||
|
<div class="media-left"> |
||||||
|
<a href="#"> |
||||||
|
<img class="media-object" src="{{ user_avatar }}" alt="{{ user.completeName }}"> |
||||||
|
</a> |
||||||
|
</div> |
||||||
|
<div class="media-body"> |
||||||
|
<h3 class="media-heading">{{ user.completeName }}</h3> |
||||||
|
<p>{{ user.username }}</p> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
<br> |
||||||
|
{% for survey in surveys %} |
||||||
|
{% set course_code = survey.course ? survey.course.code : '' %} |
||||||
|
{% set session_id = survey.session ? survey.session.id : 0 %} |
||||||
|
|
||||||
|
<div class="panel panel-default"> |
||||||
|
{% if survey.course %} |
||||||
|
<div class="panel-heading"> |
||||||
|
<h3 class="panel-title"> |
||||||
|
{{ survey.course.title }} |
||||||
|
|
||||||
|
{% if survey.session %} |
||||||
|
({{ survey.session.name }}) |
||||||
|
{% endif %} |
||||||
|
</h3> |
||||||
|
</div> |
||||||
|
{% endif %} |
||||||
|
<div class="panel-body"> |
||||||
|
<div> |
||||||
|
<a href="{{ _p.web_main ~ 'survey/fillsurvey.php?' ~ {'course': course_code, 'invitationcode': survey.invitation_code, 'cidReq': course_code, 'id_session': session_id}|url_encode }}"> |
||||||
|
{{ survey.title }} |
||||||
|
</a> |
||||||
|
<p>{{ 'FromDateXToDateY'|get_lang|format(survey.avail_from|api_convert_and_format_date(2), survey.avail_till|api_convert_and_format_date(2)) }}</p> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
{% endfor %} |
Loading…
Reference in new issue