예제 #1
0
func (controller *Controller) loadInstitution() {
	ID := controller.Ctx.Input.Param(":institution")
	institution, err := repository.NewInstitution(ID)
	if err == nil {
		controller.Data["institution"] = institution
		controller.institution = institution
		controller.SetCustomTitle("Admin - " + institution.Name)
	}
}
예제 #2
0
func (controller *Controller) loadInstitution() {
	ID := controller.Ctx.Input.Param(":institution")
	institution, err := repository.NewInstitution(ID)
	if err != nil {
		controller.Abort("show-database-error")
	}
	controller.Data["institution"] = institution
	controller.institution = institution
	controller.SetCustomTitle(institution.Name)
}
예제 #3
0
// Perform gets the results
func (search ProgramSearch) Perform() {
	programs := search.getFromDB()
	for _, program := range programs {
		institutionID := program.GetInstitution()
		institution, _ := repository.NewInstitution(strconv.Itoa(institutionID))
		result := &Result{
			Title:       program.GetTitle(),
			URL:         search.getURL(program),
			Description: institution.Name,
			Icon:        institution.LogoURL,
			Category:    "Program of study",
			IsVisible:   true,
		}
		search.response.AppendItem(result)
	}
}
예제 #4
0
// Perform gets the results
func (search ModuleSearch) Perform() {
	modules := search.getFromDB()
	for _, module := range modules {
		institutionID := module.GetInstitution()
		institution, _ := repository.NewInstitution(strconv.Itoa(institutionID))
		result := &Result{
			Title:       module.GetTitle(),
			URL:         search.getURL(module),
			Description: institution.Name,
			Icon:        institution.LogoURL,
			Category:    "Module",
			IsVisible:   true,
		}
		search.response.AppendItem(result)
	}
}