/**
  * @see EventListenerInterface::listen_events()
  * @param object $event_object
  * @return bool
  */
 public static function listen_events($event_object)
 {
     if ($event_object instanceof UserDeleteEvent) {
         if (ProjectPermission_Access::delete_by_user_id($event_object->get_user_id()) == false) {
             return false;
         }
     }
     if ($event_object instanceof GroupDeleteEvent) {
         if (ProjectPermission_Access::delete_by_group_id($event_object->get_group_id()) == false) {
             return false;
         }
     }
     if ($event_object instanceof OrganisationUnitDeleteEvent) {
         if (ProjectPermission_Access::delete_by_organisation_unit_id($event_object->get_organisation_unit_id()) == false) {
             return false;
         }
     }
     /**
      * @todo slow
      */
     if ($event_object instanceof OrganisationUnitLeaderCreateEvent) {
         $project_array = Project::list_organisation_unit_related_projects($event_object->get_organisation_unit_id(), true);
         if (is_array($project_array) and count($project_array) >= 1) {
             $project_permission = new ProjectPermissionUser(null);
             foreach ($project_array as $key => $value) {
                 if ($project_permission->create($event_object->get_leader_id(), $value, (int) Registry::get_value("project_leader_default_permission"), null, 2) == null) {
                     return false;
                 }
             }
         }
     }
     /**
      * @todo slow
      */
     if ($event_object instanceof OrganisationUnitLeaderDeleteEvent) {
         $project_array = Project::list_organisation_unit_related_projects($event_object->get_organisation_unit_id(), true);
         if (is_array($project_array) and count($project_array) >= 1) {
             foreach ($project_array as $key => $value) {
                 $permission_array = self::list_entries_by_project_id_and_intention_and_user_id($value, 2, $event_object->get_leader_id());
                 if (is_array($permission_array) and count($permission_array) >= 1) {
                     foreach ($permission_array as $permission_key => $permission_value) {
                         $project_permission = self::get_instance($permission_value);
                         if ($project_permission->delete() == false) {
                             return false;
                         }
                     }
                 }
             }
         }
     }
     /**
      * @todo slow
      */
     if ($event_object instanceof OrganisationUnitQualityManagerCreateEvent) {
         $project_array = Project::list_organisation_unit_related_projects($event_object->get_organisation_unit_id(), true);
         if (is_array($project_array) and count($project_array) >= 1) {
             $project_permission = new ProjectPermissionUser(null);
             foreach ($project_array as $key => $value) {
                 if ($project_permission->create($event_object->get_quality_manager_id(), $value, (int) Registry::get_value("project_quality_manager_default_permission"), null, 5) == null) {
                     return false;
                 }
             }
         }
     }
     /**
      * @todo slow
      */
     if ($event_object instanceof OrganisationUnitQualityManagerDeleteEvent) {
         $project_array = Project::list_organisation_unit_related_projects($event_object->get_organisation_unit_id(), true);
         if (is_array($project_array) and count($project_array) >= 1) {
             foreach ($project_array as $key => $value) {
                 $permission_array = self::list_entries_by_project_id_and_intention_and_user_id($value, 5, $event_object->get_quality_manager_id());
                 if (is_array($permission_array) and count($permission_array) >= 1) {
                     foreach ($permission_array as $permission_key => $permission_value) {
                         $project_permission = self::get_instance($permission_value);
                         if ($project_permission->delete() == false) {
                             return false;
                         }
                     }
                 }
             }
         }
     }
     /**
      * @todo slow
      */
     if ($event_object instanceof OrganisationUnitGroupCreateEvent) {
         $project_array = self::list_system_setted_projects_by_organisation_id($event_object->get_organisation_unit_id());
         if (is_array($project_array) and count($project_array) >= 1) {
             foreach ($project_array as $key => $value) {
                 $project_permission = new ProjectPermissionGroup(null);
                 if ($project_permission->create($event_object->get_group_id(), $value, (int) Registry::get_value("project_group_default_permission"), null, 4) == null) {
                     return false;
                 }
             }
         }
     }
     /**
      * @todo slow
      */
     if ($event_object instanceof OrganisationUnitGroupDeleteEvent) {
         $project_array = self::list_system_setted_projects_by_organisation_id($event_object->get_organisation_unit_id());
         if (is_array($project_array) and count($project_array) >= 1) {
             foreach ($project_array as $key => $value) {
                 $project_permission_array = ProjectPermission::list_entries_by_project_id_and_intention_and_group_id($value, 4, $event_object->get_group_id());
                 if (is_array($project_permission_array) and count($project_permission_array) >= 1) {
                     foreach ($project_permission_array as $sub_key => $sub_value) {
                         $project_permission = self::get_instance($sub_value);
                         if ($project_permission->delete() == false) {
                             return false;
                         }
                     }
                 }
             }
         }
     }
     return true;
 }