Changeset 316 for trunk/grails-app/controllers/SearchableController.groovy
- Timestamp:
- Mar 26, 2010, 1:02:39 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/grails-app/controllers/SearchableController.groovy
r247 r316 1 2 1 /* 3 2 * Copyright 2007 the original author or authors. … … 21 20 * Basic web interface for Grails Searchable Plugin 22 21 * 23 * @author Adem and Jahn22 * @author Maurice Nicholson 24 23 */ 25 24 class SearchableController { 26 25 def searchableService 27 28 def selectsample = {29 30 31 // produce error message here if studies don't contain samples!32 // redirect back or use error33 34 35 println "in selectsample: "36 params.each{println it}37 38 // prepare showing all studies selected in the previous view39 def selectedStudies = []40 def selectedStudyIds = params['selectedStudyIds']41 42 if(selectedStudyIds!=null)43 {44 def list = selectedStudyIds.findAll(/(\d)+/)45 selectedStudies = list.collect{ dbnp.studycapturing.Study.get(it) }46 }47 else48 {49 def tmpList = []50 def studyList = dbnp.studycapturing.Study.list()51 selectedStudyIds = []52 params.each{ key,values->53 if (values=="on") tmpList.add(key)54 }55 56 for (i in studyList)57 if (tmpList.contains(i.getId().toString()))58 {59 selectedStudyIds.add(i.id)60 selectedStudies.add(i)61 }62 }63 64 65 // subgroups66 // provide list of subgroups depending on the type of subgrouping67 // selected by the user68 def subgroups = []69 def submitButton = params["submit"] // this button's value determines the kind of subgrouping70 71 switch(submitButton)72 {73 case "Subject Groups":74 render(params)75 render("Subject Groups")76 def studyGroups = []77 if(selectedStudies!=null)78 {79 selectedStudies.each{ study ->80 study.groups.each{ group -> studyGroups.add[group] }81 }82 println "study groups: "83 studyGroups.each{x-> println x}84 }85 86 // testing:87 // there is a lack of data in the mockup (subject groups are still missing)88 // as long as there are no groups in the boot script,89 // we use this90 subgroups = studyGroups.size()<=0 ?91 ["subject group 1","subject group 2"] : studyGroups92 93 render(view:"selectsample",model:[selectedStudies:selectedStudies,selectedStudyIds:selectedStudyIds,subgroups:subgroups])94 break95 96 case "Event Groups":97 def eventGroups = []98 if(selectedStudies!=null)99 {100 selectedStudies.each{ study ->101 println study.id102 println study.samplingEvents.each{ eventGroups.add(it) }103 }104 }105 subgroups=eventGroups106 render(view:"selectsample",model:[selectedStudies:selectedStudies,selectedStudyIds:selectedStudyIds,subgroups:subgroups])107 break108 109 case "Starting Time Groups":110 111 def timeGroups = []112 if(selectedStudies!=null)113 {114 selectedStudies.each{ study ->115 println study.samplingEvents.each{116 def timeDiff = it.getPrettyDuration( study.startDate, it.startTime )117 if( !timeGroups.contains(timeDiff) ) timeGroups.add(timeDiff)118 }119 }120 }121 subgroups=timeGroups122 render("Starting Time Groups")123 render(view:"selectsample",model:[selectedStudies:selectedStudies,selectedStudyIds:selectedStudyIds,subgroups:subgroups])124 break125 126 case ">> Execute and continue with biomarker selection":127 render("Starting Time Groups")128 break129 case "<< Back to study selection":130 break131 }132 render(view:"selectsample",model:[selectedStudies:selectedStudies,selectedStudyIds:selectedStudyIds,subgroups:subgroups])133 }134 135 136 26 137 27 /** … … 166 56 render("unindexAll done") 167 57 } 168 169 170 def subjectGroups = { render ("hello") }171 172 173 58 }
Note: See TracChangeset
for help on using the changeset viewer.