$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 { if ($confirmed == 'true' && $positive == 'true') { $successfullyDeleted = $templateMgr->remove($template); if (in_array($template, $successfullyDeleted)) { if ($tmpTemplateInfo['FOLDER']) { $jsQueue->add($template, HISTORYTYPE_TEMPLATE, 'OBJECT_DELETE', sGuiUS(), 'templatefolder', NULL, NULL, $template . '-template', 'name'); } else { $jsQueue->add($template, HISTORYTYPE_TEMPLATE, 'OBJECT_DELETE', sGuiUS(), 'template', NULL, NULL, $template . '-template', 'name'); } } } } } else { // Not used, delete template $successfullyDeleted = $templateMgr->remove($template); if (in_array($template, $successfullyDeleted)) { if ($tmpTemplateInfo['FOLDER']) { $jsQueue->add($template, HISTORYTYPE_TEMPLATE, 'OBJECT_DELETE', sGuiUS(), 'templatefolder', NULL, NULL, $template . '-template', 'name');