Example #1
0
// Display shows the public page for a subject of study
func (controller *Subject) Display() {
	subject := controller.GetSubject()
	controller.SetCustomTitle(subject.GetName())
	controller.Data["institutions"] = repository.GetAllInstitutions()
	controller.LoadTemplate("home")
	controller.Data["subjectAnalyses"] = analyse.GetSubjectAnalysersBySubject(subject.GetID())

}
Example #2
0
// ShowInsertForm shows the form to add a new repository
func (controller *Repository) ShowInsertForm() {
	controller.Data["institutions"] = model.GetAllInstitutions()
	selectedInstitution, _ := strconv.Atoi(strings.TrimSpace(controller.GetString("institution")))
	controller.Data["selectedInstitution"] = selectedInstitution
	controller.Data["category"] = strings.TrimSpace(controller.GetString("category"))
	controller.SetCustomTitle("Add a new repository")
	controller.showForm("Add", "Add a new repository")
}
Example #3
0
func (analyser Analyser) processModules() {

	institutions := repository.GetAllInstitutions()
	subjects := education.GetAllSubjects()

	for _, institution := range institutions {
		analyser.CreateInstitutionAnalyser(institution)
	}

	for _, subject := range subjects {
		analyser.CreateSubjectAnalyser(subject)
	}

	analyser.Finish()
}
Example #4
0
// let's start the magic
func (analyser SubjectAnalyser) start() {

	subject := analyser.GetSubject()
	exists := false

	institutions := repository.GetAllInstitutions()

	ownDescription := analyser.getDescription()

	keywords := word.NewDigester("")
	formats := word.NewDigester("")
	description := word.NewDigester("")

	for _, institution := range institutions {
		exists = true
		d1, d2, d3 := analyser.getDigesters(institution)
		keywords = keywords.Combine(d1)
		formats = formats.Combine(d2)
		description = description.Combine(d3)
	}
	if exists || len(ownDescription.GetData()) != 0 {

		description = description.Combine(ownDescription)

		description.SortByCounter("DESC")
		formats.SortByCounter("DESC")
		keywords.SortByCounter("DESC")

		columns := "`subject`, `description`, `formats`, `keywords`, `analyse`"
		table := "digest_subject"

		buffer := database.NewSQLBuffer(table, columns)
		buffer.AddRow(subject.GetID(), description.GetPlainJSON(), formats.GetPlainJSON(), keywords.GetPlainJSON(), analyser.parent.id)

		err := buffer.Exec()

		if err != nil {
			fmt.Println(err)
		}
	}
}
Example #5
0
// Display shows a table with all the institutions
func (controller *Home) Display() {
	controller.SetCustomTitle("Admin - Institutions")
	controller.Data["institutions"] = repository.GetAllInstitutions()
	controller.LoadTemplate("home")
}