# class Organisation

### Public Class Methods

orgs_with_parent_of_type(org_type) click to toggle source

retrieves info off a child org

    # File app/models/organisation.rb, line 35
    def self.orgs_with_parent_of_type(org_type)
            parents = OrganisationType.find_by_name(org_type).organisations
            children = Array.new
            parents.each do |parent|
                  children += parent.children
            end
            return children
    end

other_organisations() click to toggle source

    # File app/models/organisation.rb, line 45
    def self.other_organisations
            org_types = [I18n.t('helpers.org_type.organisation')]
            organisations_list = []
            org_types.each do |ot|
                    new_org_obejct = OrganisationType.find_by_name(ot)

                    org_with_guidance = GuidanceGroup.joins(new_org_obejct.organisations)

                    organisations_list = organisations_list + org_with_guidance
            end
            return organisations_list
    end

### Public Instance Methods

all_guidance_groups() click to toggle source

    # File app/models/organisation.rb, line 70
    def all_guidance_groups
            ggs = guidance_groups
            children.each do |c|
                    ggs = ggs + c.all_guidance_groups
            end
            return ggs
    end

all_sections(version_id) click to toggle source

    # File app/models/organisation.rb, line 58
    def all_sections(version_id)
            if parent.nil?
                    secs = sections.where("version_id = ?", version_id)
                    if secs.nil? then
                            secs = Array.new
                    end
                    return secs
            else
                    return sections.find_all_by_version_id(version_id) + parent.all_sections(version_id)
            end
    end

published_templates() click to toggle source

    # File app/models/organisation.rb, line 95
    def published_templates
            return dmptemplates.find_all_by_published(1)
    end

root() click to toggle source

    # File app/models/organisation.rb, line 78
    def root
            if parent.nil?
                    return self
            else
                    return parent.root
            end
    end

short_name() click to toggle source

    # File app/models/organisation.rb, line 26
    def short_name
            if abbreviation.nil? then
                    return name
            else
                    return abbreviation
            end
    end

to_s() click to toggle source

    # File app/models/organisation.rb, line 22
    def to_s
            name
    end

warning(option_id) click to toggle source

    # File app/models/organisation.rb, line 86
    def warning(option_id)
            warning = option_warnings.find_by_option_id(option_id)
            if warning.nil? && !parent.nil? then
                    return parent.warning(option_id)
            else
                    return warning
            end
    end