Index: main/waeup.kofa/trunk/src/waeup/kofa/students/browser_templates/studentreportgeneratorpage.pt
===================================================================
--- main/waeup.kofa/trunk/src/waeup/kofa/students/browser_templates/studentreportgeneratorpage.pt	(revision 9643)
+++ main/waeup.kofa/trunk/src/waeup/kofa/students/browser_templates/studentreportgeneratorpage.pt	(revision 9647)
@@ -19,7 +19,24 @@
       </select>
       <div class="help-inline" i18n:translate="">
-        Academic session to report
+        Select academic session to report
       </div>
     </div>
+    <br />
+    <label for="session">Study Mode Group:</label>
+    <div class="input">
+      <select name="mode">
+        <span tal:repeat="items view/modes" tal:omit-tag="">
+          <option
+              tal:define="name python: items[1]; title python: items[0]"
+              tal:attributes="value name">
+            <span tal:replace="title">TITLE</span>
+          </option>
+        </span>
+      </select>
+      <div class="help-inline" i18n:translate="">
+        Set study modes filter
+      </div>
+    </div>
+
   </div>
   <div class="input">
Index: main/waeup.kofa/trunk/src/waeup/kofa/students/reports.py
===================================================================
--- main/waeup.kofa/trunk/src/waeup/kofa/students/reports.py	(revision 9643)
+++ main/waeup.kofa/trunk/src/waeup/kofa/students/reports.py	(revision 9647)
@@ -25,9 +25,17 @@
 from waeup.kofa.reports import IReport
 
+MODE_GROUPS = {
+    'All':('all',),
+    'Undergraduate Full-Time':('ug_ft',),
+    'Undergraduate Part-Time':('ug_pt',),
+    'Postgraduate Full-Time':('pg_ft',),
+    'Postgraduate Part-Time':('pg_pt',),
+    }
+
 class IStudentReport(IReport):
     pass
 
-def get_students_by_session(session):
-    """Get students of a certain session.
+def get_students_by(session, mode):
+    """Get students in a certain session and study mode.
 
     Returns a table ordered by faculty code (one per row) and
@@ -52,5 +60,5 @@
     fac_codes = tuple(sorted([x for x in site['faculties'].keys()],
                              key=lambda x: x.lower()))
-    fac_codes = fac_codes + ('Total',)
+    fac_codes = fac_codes + (u'Total',)
     # XXX: Here we do _one_ query and then examine the single
     #   students. One could also do multiple queries and just look for
@@ -61,4 +69,6 @@
     table = [[0 for x in xrange(len(states))] for y in xrange(len(fac_codes))]
     for stud in result:
+        if mode != 'All' and stud.current_mode not in MODE_GROUPS[mode]:
+            continue
         row = fac_codes.index(stud.faccode)
         col = states.index(stud.state)
@@ -112,18 +122,20 @@
     data = None
     session = None
-
-    def __init__(self, session, author='System'):
+    mode = None
+
+    def __init__(self, session, mode, author='System'):
         super(StudentReport, self).__init__(
-            args=[session], kwargs={'author':author})
-        self.session = session
+            args=[session, mode], kwargs={'author':author})
+        self.session = academic_sessions_vocab.getTerm(session).title
+        self.mode = mode
         self.author = author
-        self.data = get_students_by_session(session)
+        self.data = get_students_by(session, mode)
 
     def __repr__(self):
-        return 'StudentReport(session=%s, author=%r)' % (
-            self.session, self.author)
+        return 'StudentReport(session=%s, mode=%s, author=%r)' % (
+            self.session, self.mode, self.author)
 
     def get_data(self):
-        self.data = get_students_by_session(self.session)
+        self.data = get_students_by(self.session, self.mode)
 
     def create_pdf(self):
@@ -131,14 +143,15 @@
         table_data = tbl_data_to_table(*self.data)
         col_widths = [None,] + [1.6*cm] * len(self.data[1]) + [None,]
-        pdf_data = [Paragraph('<b>Session:</b> %s' % self.session,
-                              STYLE["Normal"]),
-                    Spacer(1, 12),]
-        pdf_data += [
+        #pdf_data = [Paragraph('<b>Study mode:</b> %s' % self.mode,
+        #                      STYLE["Normal"]),
+        #            Spacer(1, 12),]
+        pdf_data = [
             Table(table_data, style=TABLE_STYLE, colWidths=col_widths)]
-        doc_title = 'Report: Students of Session %s\nby faculty and status' % (
+        doc_title = '%s Students in Session %s' % (
+            self.mode,
             self.session,)
         pdf = creator.create_pdf(
             pdf_data, None, doc_title, self.author,
-            'Session %s Students,' % self.session)
+            'Students in Session %s,' % self.session)
         open('/tmp/result.pdf', 'wb').write(pdf)
         return pdf
@@ -154,6 +167,6 @@
         return self.title
 
-    def generate(self, site, session=None, author=None):
-        result = StudentReport(session=session, author=author)
+    def generate(self, site, session=None, mode=None, author=None):
+        result = StudentReport(session=session, mode=mode, author=author)
         return result
 
@@ -182,12 +195,16 @@
         return None
 
-    def update(self, CREATE=None, session=None):
+    def update(self, CREATE=None, session=None, mode=None):
         self.parent_url = self.url(self.context.__parent__)
         self._set_session_values()
+        self._set_mode_values()
         if CREATE and session:
             # create a new report job for students by session
             container = self.context.__parent__
             user_id = self.request.principal.id
-            kw = dict(session=self._value_dict[session])
+            kw = dict(
+                #session=self._session_value_dict[session],
+                session=int(session),
+                mode=mode)
             self.flash(_('New report is being created in background'))
             container.start_report_job(
@@ -200,7 +217,10 @@
         vocab_terms = academic_sessions_vocab.by_value.values()
         self.sessions = [(x.title, x.token) for x in vocab_terms]
-        self._value_dict = dict([(x.token, x.value) for x in vocab_terms])
+        #self._session_value_dict = dict([(x.token, x.value) for x in vocab_terms])
         return
 
+    def _set_mode_values(self):
+        self.modes = sorted([(key, key) for key in MODE_GROUPS.keys()])
+        return
 
 class StudentReportPDFView(grok.View):
Index: main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_catalog.py
===================================================================
--- main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_catalog.py	(revision 9643)
+++ main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_catalog.py	(revision 9647)
@@ -59,4 +59,5 @@
         setSite(self.app)
         self.certificate = self.create_cert(u'fac1', u'dep1', u'CERT1')
+        self.certificate.study_mode = u'ug_ft'
 
         # Create student with subobjects
Index: main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_reports.py
===================================================================
--- main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_reports.py	(revision 9643)
+++ main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_reports.py	(revision 9647)
@@ -1,4 +1,5 @@
 # Tests for student related reports
-from waeup.kofa.students.reports import get_students_by_session, StudentReport
+from waeup.kofa.students.reports import (
+    get_students_by, StudentReport)
 from waeup.kofa.students.tests.test_catalog import CatalogTestSetup
 from waeup.kofa.testing import FunctionalLayer
@@ -14,6 +15,6 @@
     def test_get_students_by_session_simple(self):
         # we can get a table with one student
-        result1 = get_students_by_session(2010)
-        result2 = get_students_by_session(2009)
+        result1 = get_students_by(2010, 'Undergraduate Full-Time')
+        result2 = get_students_by(2009, 'Undergraduate Full-Time')
         self.assertEqual(
             result1,
@@ -33,6 +34,6 @@
         # we can get a table with several students
         self.create_cert('fac2', 'dept2', 'CERT2')
-        result1 = get_students_by_session(2010)
-        result2 = get_students_by_session(2009)
+        result1 = get_students_by(2010, 'Undergraduate Full-Time')
+        result2 = get_students_by(2009, 'Undergraduate Full-Time')
         self.assertEqual(
             result1,
@@ -53,5 +54,5 @@
     def test_create_pdf(self):
         self.create_cert('FAC2', 'dept2', 'CERT2')
-        report = StudentReport(2010)
+        report = StudentReport(2010, 'Undergraduate Full-Time')
         result = report.create_pdf()
         self.assertTrue(result.startswith('%PDF-'))
