/** * Saves all the items a user follows in the session */ public function saveFollowInformation(User $user) { $follows = array(); // Initialize the array foreach (Item::$items as $item) { $follows[$item] = array(); } foreach ($user->getFollows() as $follow) { $follows[$follow->getItem()][$follow->getItemId()] = 1; } $this->session->set(self::USER_FOLLOWS, $follows); }
public function getHTML(UserEntity $user, $courses, $campaignId) { $templating = $this->getContainer()->get('templating'); $html = $templating->renderResponse('ClassCentralMOOCTrackerBundle:NewCourses:newcourses.inlined.html', array('user' => $user, 'courses' => $courses, 'recommendationsPageUnlocked' => count($user->getFollows()) >= 10, 'loginToken' => $this->getContainer()->get('user_service')->getLoginToken($user), 'baseUrl' => $this->getContainer()->getParameter('baseurl'), 'jobType' => $this->getJob()->getJobType(), 'utm' => array('medium' => Mailgun::UTM_MEDIUM, 'campaign' => $campaignId, 'source' => Mailgun::UTM_SOURCE_PRODUCT), 'unsubscribeToken' => CryptUtility::getUnsubscribeToken($user, UserPreference::USER_PREFERENCE_PERSONALIZED_COURSE_RECOMMENDATIONS, $this->getContainer()->getParameter('secret'))))->getContent(); return $html; }