<?php $jsQueue = new JSQueue(NULL); $templateMgr = new Templates(); $tagMgr = new Tags(); switch ($action) { case 'deleteTemplate': $template = $this->params['template']; $confirmed = $this->params['confirmed']; $positive = $this->params['positive']; // Check if template is still used $stillInUse = false; $sites = sSites()->getList(); foreach ($sites as $curr_site) { $pageMgr = new PageMgr($curr_site['ID']); $pages = $pageMgr->getPagesByTemplate($template); if (count($pages) > 0) { $stillInUse = true; } } $mailings = sMailingMgr()->getMailingsByTemplate($template); if (count($pages) > 0) { $stillInUse = true; } $tmpTemplateInfo = $templateMgr->getTemplate($template); if ($stillInUse) { // Still used! if ($confirmed != 'true') { $parameters = array('template' => $template); $koala->callJSFunction('Koala.yg_confirm', $itext['TXT_DELETE_USED_TEMPLATE_TITLE'] != '' ? $itext['TXT_DELETE_USED_TEMPLATE_TITLE'] : '$TXT_DELETE_USED_TEMPLATE_TITLE', $itext['TXT_DELETE_USED_TEMPLATE'] != '' ? $itext['TXT_DELETE_USED_TEMPLATE'] : '$TXT_DELETE_USED_TEMPLATE', $action, json_encode($parameters)); } else {