Exemplo n.º 1
0
 /**
  * Prevent delete modules from the Frontend.
  * For delete modules use safeDelete.
  *
  * @return void
  */
 public function delete()
 {
     // Delete all the project-module relations
     $project = new Project_Models_ProjectModulePermissions();
     $project->deleteModuleRelation($this->id);
     // Delete all the role-module relations
     $role = new Phprojekt_Role_RoleModulePermissions();
     $role->deleteModuleRelation($this->id);
     // Delete the items and tags
     $tag = new Phprojekt_Tags();
     $model = Phprojekt_Loader::getModel($this->name, $this->name);
     if ($model instanceof Phprojekt_ActiveRecord_Abstract) {
         $results = $model->fetchAll();
         if (is_array($results)) {
             foreach ($results as $record) {
                 $tag->deleteTagsForModuleItem($this->id, $record->id);
                 // @todo: Improve the delete routine for modules with a lot of entries.
                 $record->delete();
             }
         }
     }
     // Delete Files
     $this->_deleteFolder(PHPR_USER_CORE_PATH . $this->name);
     // Delete module entry
     parent::delete();
 }