<?php
/*
 * Copyright (c) 2013, webvariants GbR, http://www.webvariants.de
 *
 * This file is released under the terms of the MIT license. You can find the
 * complete text in the attached LICENSE file or online at:
 *
 * http://www.opensource.org/licenses/mit-license.php
 */

class sly_Controller_Devutilsrepeat extends sly_Controller_Ajax implements sly_Controller_Interface {
	public function indexAction() {
		$response = sly_Core::getResponse();

		$type  = sly_get('type', 'int');
		$name  = sly_get('name', 'string');
		$group = sly_get('group', 'string');

		$response->setContentType('text/javascript');
		$response->setContent(json_encode(array('markup' => _WV_Datatype_Repeat::addRowMarkup($type, $name, $group))));

		return $response;
	}

	public function checkPermission($action) {
		sly_Util_Session::start();
		return sly_Util_User::getCurrentUser() !== null;
	}
}
