1 /* 2 File statisticsexport.h 3 */ 4 5 /*************************************************************************** 6 FET 7 ------------------- 8 copyright : (C) by Lalescu Liviu 9 email : Please see https://lalescu.ro/liviu/ for details about contacting Liviu Lalescu (in particular, you can find here the e-mail address) 10 *************************************************************************** 11 statisticsexport.h - description 12 ------------------- 13 begin : Sep 2008 14 copyright : (C) by Volker Dirr 15 : https://www.timetabling.de/ 16 *************************************************************************** 17 * * 18 * This program is free software: you can redistribute it and/or modify * 19 * it under the terms of the GNU Affero General Public License as * 20 * published by the Free Software Foundation, either version 3 of the * 21 * License, or (at your option) any later version. * 22 * * 23 ***************************************************************************/ 24 25 #ifndef STATISTICEXPORT_H 26 #define STATISTICEXPORT_H 27 28 #include <QString> 29 #include <QStringList> 30 31 #include <QHash> 32 #include <QMultiHash> 33 34 class QWidget; 35 36 #include "timetable.h" //needed? 37 #include "timetable_defs.h" //needed? 38 39 class FetStatistics{ 40 public: 41 //can be replaced by the key if I use SQL or other database 42 QHash<QString, QString> hashSubjectIDsStatistics; 43 QHash<QString, QString> hashActivityTagIDsStatistics; 44 QHash<QString, QString> hashStudentIDsStatistics; 45 QHash<QString, QString> hashTeacherIDsStatistics; 46 //QHash<QString, QString> hashRoomIDsStatistics; 47 //QHash<QString, QString> hashDayIDsStatistics; 48 49 //needed values 50 QHash<QString, int> teachersTotalNumberOfHours; 51 QHash<QString, int> teachersTotalNumberOfHours2; 52 QHash<QString, int> studentsTotalNumberOfHours; 53 QHash<QString, int> studentsTotalNumberOfHours2; 54 QHash<QString, int> subjectsTotalNumberOfHours; 55 QHash<QString, int> subjectsTotalNumberOfHours4; 56 QStringList allStudentsNames; //NOT QSet<QString>!!! Because that does an incorrect order of the lists! 57 QStringList allTeachersNames; //NOT QSet<QString>!!! Because that does an incorrect order of the lists! 58 QStringList allSubjectsNames; //NOT QSet<QString>!!! Because that does an incorrect order of the lists! 59 QMultiHash<QString, int> studentsActivities; 60 QMultiHash<QString, int> teachersActivities; 61 QMultiHash<QString, int> subjectsActivities; 62 }; 63 64 65 class StatisticsExport: public QObject{ 66 Q_OBJECT 67 68 public: 69 StatisticsExport(); 70 ~StatisticsExport(); 71 72 static void exportStatistics(QWidget* parent); 73 74 static QString exportStatisticsTeachersSubjectsHtml(QWidget* parent, QString saveTime, FetStatistics statisticValues, int htmlLevel, bool printActivityTags, int maxNames, QSet<int> *excludedNames); 75 static QString exportStatisticsSubjectsTeachersHtml(QWidget* parent, QString saveTime, FetStatistics statisticValues, int htmlLevel, bool printActivityTags, int maxNames, QSet<int> *excludedNames); 76 static QString exportStatisticsTeachersStudentsHtml(QWidget* parent, QString saveTime, FetStatistics statisticValues, int htmlLevel, bool printActivityTags, int maxNames, QSet<int> *excludedNames); 77 static QString exportStatisticsStudentsTeachersHtml(QWidget* parent, QString saveTime, FetStatistics statisticValues, int htmlLevel, bool printActivityTags, int maxNames, QSet<int> *excludedNames); 78 static QString exportStatisticsSubjectsStudentsHtml(QWidget* parent, QString saveTime, FetStatistics statisticValues, int htmlLevel, bool printActivityTags, int maxNames, QSet<int> *excludedNames); 79 static QString exportStatisticsStudentsSubjectsHtml(QWidget* parent, QString saveTime, FetStatistics statisticValues, int htmlLevel, bool printActivityTags, int maxNames, QSet<int> *excludedNames); 80 81 //this function must be called before export html files, because it compute the IDs 82 static void computeHashForIDsStatistics(FetStatistics *statisticValues); 83 static void getNamesAndHours(FetStatistics *statisticValues); 84 private: 85 //the following functions write the css and html statistics files 86 static bool exportStatisticsStylesheetCss(QWidget* parent, QString saveTime, FetStatistics statisticValues); 87 static bool exportStatisticsIndex(QWidget* parent, QString saveTime); 88 static bool exportStatisticsTeachersSubjects(QWidget* parent, QString saveTime, FetStatistics statisticValues, int htmlLevel); 89 static bool exportStatisticsSubjectsTeachers(QWidget* parent, QString saveTime, FetStatistics statisticValues, int htmlLevel); 90 static bool exportStatisticsTeachersStudents(QWidget* parent, QString saveTime, FetStatistics statisticValues, int htmlLevel); 91 static bool exportStatisticsStudentsTeachers(QWidget* parent, QString saveTime, FetStatistics statisticValues, int htmlLevel); 92 static bool exportStatisticsSubjectsStudents(QWidget* parent, QString saveTime, FetStatistics statisticValues, int htmlLevel); 93 static bool exportStatisticsStudentsSubjects(QWidget* parent, QString saveTime, FetStatistics statisticValues, int htmlLevel); 94 }; 95 96 #endif 97