1<?php
2// (c) Copyright by authors of the Tiki Wiki CMS Groupware Project
3//
4// All Rights Reserved. See copyright.txt for details and a complete list of authors.
5// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
6// $Id$
7
8use Tiki\Recommendation as R;
9
10class Services_Recommendation_DevelopmentController
11{
12	function setUp()
13	{
14		Services_Exception_Denied::checkGlobal('admin');
15	}
16
17	function action_compare($input)
18	{
19		$user = $input->user->username() ?: $GLOBALS['user'];
20		$input = new R\Input\UserInput($user);
21
22		$comparator = new R\Comparator($this->getEngineSet('content'));
23
24		return [
25			'title' => tr('Recommendations for %0', $user),
26			'recommendations' => $comparator->generate($input),
27		];
28	}
29
30	private function getEngineSet($set)
31	{
32		$container = TikiInit::getContainer();
33		return $container->get("tiki.recommendation.$set.set");
34	}
35}
36