Skip to content

Commit

Permalink
Dev: updated delete template function
Browse files Browse the repository at this point in the history
  • Loading branch information
LouisGac committed Oct 18, 2017
1 parent 0777e55 commit cb14b59
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions application/controllers/admin/templates.php
Expand Up @@ -516,7 +516,7 @@ public function delete($templatename)

Yii::app()->loadHelper("admin/template");

if (array_key_exists($templatename,Template::getTemplateList()) && !Template::isStandardTemplate($templatename)){
if ( Template::checkIfTemplateExists($templatename) && !Template::isStandardTemplate($templatename)){

if (rmdirr(Yii::app()->getConfig('usertemplaterootdir') . "/" . $templatename) == true) {
$surveys = Survey::model()->findAllByAttributes(array('template' => $templatename));
Expand All @@ -533,7 +533,7 @@ public function delete($templatename)
$s->save();
}

Template::model()->deleteAllByAttributes(array('folder' => $templatename));
TemplateConfiguration::uninstall($templatename);
Permission::model()->deleteAllByAttributes(array('permission' => $templatename,'entity' => 'template'));

Yii::app()->setFlashMessage(sprintf(gT("Template '%s' was successfully deleted."), $templatename));
Expand All @@ -544,9 +544,9 @@ public function delete($templatename)
}else{
// Throw an error 500 ?
}

// Redirect with default templatename, editfile and screenname
$this->getController()->redirect(array("admin/templates/sa/view"));
$this->getController()->redirect(array("admin/templateoptions"));
}

/**
Expand Down

0 comments on commit cb14b59

Please sign in to comment.