public function installEmptyTheme()
{
$emptyDir = $this->templatesDir . '/' . ThemeManagementServiceLocal::FOLDER_UNASSIGNED . '/empty/';
$themeXml = <<<XML
<theme name="Empty" designer="default" version="1.0" require="3.6">
<description>This is an empty theme</description>
<presentation-img src="preview-front.jpg" name="Front page"/>
<presentation-img src="preview-section.jpg" name="Section page"/>
<presentation-img src="preview-article.jpg" name="Article page"/>
<output name="Web">
<frontPage src="front.tpl"/>
<sectionPage src="section.tpl"/>
<articlePage src="article.tpl"/>
<errorPage src="404.tpl"/>
</output>
</theme>
XML;
$this->filesystem->mkdir($emptyDir);
$sxml = new \SimpleXMLElement($themeXml);
$sxml->asXML($emptyDir . 'theme.xml');
// creating preview images
$preview = @imagecreatetruecolor(210, 130);
$logoPoints = array(159, 9, 113, 34, 86, 99, 150, 121, 203, 99, 138, 78);
$textColor = imagecolorallocate($preview, 191, 191, 191);
imagefill($preview, 0, 0, imagecolorallocate($preview, 255, 255, 255));
imagefilledpolygon($preview, $logoPoints, 6, imagecolorallocate($preview, 239, 239, 239));
imagestring($preview, 5, 10, 100, 'Empty Theme', $textColor);
imagejpeg($preview, $emptyDir . "preview-front.jpg", 100);
imagejpeg($preview, $emptyDir . "preview-article.jpg", 100);
imagejpeg($preview, $emptyDir . "preview-section.jpg", 100);
imagedestroy($preview);
// put empty templates in theme
file_put_contents($emptyDir . "front.tpl", "<!-- Front page template -->");
file_put_contents($emptyDir . "section.tpl", "<!-- Section page template -->");
file_put_contents($emptyDir . "article.tpl", "<!-- Article page template -->");
file_put_contents($emptyDir . "404.tpl", "<!-- Error page template -->");
}