This commit is contained in:
Peter Howell 2025-09-26 22:06:26 +00:00
parent f6bcd1957a
commit 725547faa8
4 changed files with 28 additions and 11 deletions

View File

@ -620,6 +620,11 @@ if (isset($_REQUEST['a']) && $_REQUEST['a']=='add/letter') { update_welcome_lett
// GET LIST OF ALL SESSIONS / WORKSHOPS / EVENTS // GET LIST OF ALL SESSIONS / WORKSHOPS / EVENTS
// //
function get_sessions() { global $c, $AY; function get_sessions() { global $c, $AY;
// If a specific session id is requested, return it regardless of date range
if (isset($_REQUEST['id']) && preg_match('/^\d+$/', $_REQUEST['id'])) {
$ID = ok($_REQUEST['id']);
return multi_row_select("SELECT c.id,c.title,c.desc,c.length,c.starttime,c.track,c.location,c.location_irl,c.mode,c.gets_survey,c.category,c.parent,c.recording,c.instructions,c.image_url,c.is_flex_approved,c.cal_uid,sst.type AS typeStr, sst.id AS type, GROUP_CONCAT(ctg.tag) AS tags FROM conf_sessions c LEFT JOIN conf_sessiontypes sst ON c.type=sst.id LEFT JOIN conf_tagmember ct ON c.id=ct.session LEFT JOIN conf_tags ctg ON ctg.id=ct.tag WHERE c.id='{$ID}' GROUP BY c.id ORDER BY c.track, c.starttime;",0);
}
$date_clause = api_date_clause('c.starttime'); $date_clause = api_date_clause('c.starttime');
return multi_row_select("SELECT c.id,c.title,c.desc,c.length,c.starttime,c.track,c.location,c.location_irl,c.mode,c.gets_survey,c.category,c.parent,c.recording,c.instructions,c.image_url,c.is_flex_approved,c.cal_uid,sst.type AS typeStr, sst.id AS type, GROUP_CONCAT(ctg.tag) AS tags FROM conf_sessions c LEFT JOIN conf_sessiontypes sst ON c.type=sst.id LEFT JOIN conf_tagmember ct ON c.id=ct.session LEFT JOIN conf_tags ctg ON ctg.id=ct.tag WHERE $date_clause GROUP BY c.id ORDER BY c.track, c.starttime;",0); } return multi_row_select("SELECT c.id,c.title,c.desc,c.length,c.starttime,c.track,c.location,c.location_irl,c.mode,c.gets_survey,c.category,c.parent,c.recording,c.instructions,c.image_url,c.is_flex_approved,c.cal_uid,sst.type AS typeStr, sst.id AS type, GROUP_CONCAT(ctg.tag) AS tags FROM conf_sessions c LEFT JOIN conf_sessiontypes sst ON c.type=sst.id LEFT JOIN conf_tagmember ct ON c.id=ct.session LEFT JOIN conf_tags ctg ON ctg.id=ct.tag WHERE $date_clause GROUP BY c.id ORDER BY c.track, c.starttime;",0); }
@ -640,6 +645,10 @@ function multi_row_1d($qry) { global $c;
// GET LIST OF ALL SESSIONS + HOSTS // GET LIST OF ALL SESSIONS + HOSTS
// //
function get_ses_hosts() { global $c, $AY; function get_ses_hosts() { global $c, $AY;
if (isset($_REQUEST['id']) && preg_match('/^\d+$/', $_REQUEST['id'])) {
$ID = ok($_REQUEST['id']);
return multi_row_select("select s.id, s.title, s.starttime, u.name, u.email, u.id AS hostid from conf_sessions as s LEFT OUTER JOIN conf_hosts as h ON h.session=s.id LEFT OUTER JOIN conf_users AS u ON h.host=u.id WHERE s.id='{$ID}' ORDER BY u.name;",1);
}
$date_clause = api_date_clause('s.starttime'); $date_clause = api_date_clause('s.starttime');
return multi_row_select("select s.id, s.title, s.starttime, u.name, u.email, u.id AS hostid from conf_sessions as s LEFT OUTER JOIN conf_hosts as h ON h.session=s.id LEFT OUTER JOIN conf_users AS u ON h.host=u.id WHERE $date_clause ORDER BY u.name;",1); } return multi_row_select("select s.id, s.title, s.starttime, u.name, u.email, u.id AS hostid from conf_sessions as s LEFT OUTER JOIN conf_hosts as h ON h.session=s.id LEFT OUTER JOIN conf_users AS u ON h.host=u.id WHERE $date_clause ORDER BY u.name;",1); }
@ -765,6 +774,10 @@ if (isset($_GET['a'])&& preg_match('/get\/questions\/(\d+)$/', $_GET['a'], $matc
// ALL Survey ANSWERS // ALL Survey ANSWERS
function get_answers_all() { global $c; function get_answers_all() { global $c;
if (isset($_REQUEST['id']) && preg_match('/^\d+$/', $_REQUEST['id'])) {
$ID = ok($_REQUEST['id']);
return multi_row_select( "SELECT ses.id AS ses_id, ses.title as s_title, ses.starttime, qq.id as q_id, qq.question as question, qq.type as type, ans.answer AS answer FROM conf_sessions AS ses JOIN conf_signups as sup on ses.id = sup.session JOIN conf_users as cus on cus.id = sup.user JOIN conf_q_set as qset on ses.gets_survey = qset.q_set RIGHT JOIN conf_questions as qq on qset.question = qq.id LEFT OUTER JOIN conf_answers as ans on ans.user = sup.user AND ans.question = qq.id AND ans.session = ses.id WHERE ses.id='{$ID}' AND ans.answer is not null ORDER BY ses.starttime, ses.track asc, qset.order", 0);
}
$date_clause = api_date_clause('ses.starttime'); $date_clause = api_date_clause('ses.starttime');
return multi_row_select( "SELECT ses.id AS ses_id, ses.title as s_title, ses.starttime, qq.id as q_id, qq.question as question, qq.type as type, ans.answer AS answer FROM conf_sessions AS ses JOIN conf_signups as sup on ses.id = sup.session JOIN conf_users as cus on cus.id = sup.user JOIN conf_q_set as qset on ses.gets_survey = qset.q_set RIGHT JOIN conf_questions as qq on qset.question = qq.id LEFT OUTER JOIN conf_answers as ans on ans.user = sup.user AND ans.question = qq.id AND ans.session = ses.id WHERE $date_clause AND ans.answer is not null ORDER BY ses.starttime, ses.track asc, qset.order", 0); } return multi_row_select( "SELECT ses.id AS ses_id, ses.title as s_title, ses.starttime, qq.id as q_id, qq.question as question, qq.type as type, ans.answer AS answer FROM conf_sessions AS ses JOIN conf_signups as sup on ses.id = sup.session JOIN conf_users as cus on cus.id = sup.user JOIN conf_q_set as qset on ses.gets_survey = qset.q_set RIGHT JOIN conf_questions as qq on qset.question = qq.id LEFT OUTER JOIN conf_answers as ans on ans.user = sup.user AND ans.question = qq.id AND ans.session = ses.id WHERE $date_clause AND ans.answer is not null ORDER BY ses.starttime, ses.track asc, qset.order", 0); }

View File

@ -2285,7 +2285,7 @@ const WorkshopHistory = Vue.component('workshophistory', {
<div v-if="isHost(s.id)" class="ml-3 inline-flex items-center px-2 py-0.5 text-xs font-medium rounded bg-purple-100 text-purple-700">Host</div> <div v-if="isHost(s.id)" class="ml-3 inline-flex items-center px-2 py-0.5 text-xs font-medium rounded bg-purple-100 text-purple-700">Host</div>
</div> </div>
<div class="mt-3 flex flex-wrap gap-4 text-sm text-gray-700"> <div class="mt-3 flex flex-wrap gap-4 text-sm text-gray-700">
<div>Attendees: <span class="font-medium">{{ rosterCount(s.id) }}</span></div> <div>Signups: <span class="font-medium">{{ rosterCount(s.id) }}</span></div>
<div v-if="avgRating(s.id)">Avg Rating: <span class="font-medium">{{ avgRating(s.id) }}</span></div> <div v-if="avgRating(s.id)">Avg Rating: <span class="font-medium">{{ avgRating(s.id) }}</span></div>
</div> </div>
<div class="mt-3"> <div class="mt-3">
@ -2316,10 +2316,11 @@ const ActivityReport = Vue.component('activityreport', {
props: [ 'which' ], props: [ 'which' ],
data: function () { data: function () {
return { activities:[],hosts:[], hosts_by_sesid:[], everyone:[], questions:[], answers:{}, answers2:{}, rosters:[], return { activities:[],hosts:[], hosts_by_sesid:[], everyone:[], questions:[], answers:{}, answers2:{}, rosters:[],
semesters:[], selectedSemesterKey:'', q:'' } }, semesters:[], selectedSemesterKey:'', q:'', single:false } },
mounted: function() { mounted: function() {
var self = this var self = this
self.buildSemesters() self.buildSemesters()
self.single = (self.which && String(self.which).match(/^\d+$/)) ? true : false
self.fetchRange() self.fetchRange()
basic_get('dir_api.php?a=get/names', function(r2) { basic_get('dir_api.php?a=get/names', function(r2) {
self.everyone = [] self.everyone = []
@ -2362,7 +2363,9 @@ const ActivityReport = Vue.component('activityreport', {
fetchRange: function() { fetchRange: function() {
const sem = this.selectedSemester const sem = this.selectedSemester
let q = 'all=1' let q = 'all=1'
if (sem) { if (this.single) {
q = `id=${this.which}`
} else if (sem) {
q = `begin=${sem.start.format('YYYY-MM-DD')}&end=${sem.end.format('YYYY-MM-DD')}` q = `begin=${sem.start.format('YYYY-MM-DD')}&end=${sem.end.format('YYYY-MM-DD')}`
} }
var self = this var self = this
@ -2377,13 +2380,13 @@ const ActivityReport = Vue.component('activityreport', {
x.searchable = ((x.title||'') + ' ' + (x.desc||'')).toLowerCase() } ) x.searchable = ((x.title||'') + ' ' + (x.desc||'')).toLowerCase() } )
self.$forceUpdate(); self.$forceUpdate();
}) })
basic_get(`dir_api.php?a=get/hosts&${q}`, function(r2) { basic_get(`dir_api.php?a=get/hosts&${this.single ? ('id=' + this.which) : q}`, function(r2) {
self.hosts_by_sesid = _.groupBy(r2,function(x) { return x.id } ) self.hosts_by_sesid = _.groupBy(r2,function(x) { return x.id } )
}) })
basic_get(`dir_api.php?a=get/rosters&${q}`, function(r2) { basic_get(`dir_api.php?a=get/rosters&${this.single ? ('id=' + this.which) : q}`, function(r2) {
self.rosters = _.groupBy(r2,function(x) { return x.sesid } ) self.rosters = _.groupBy(r2,function(x) { return x.sesid } )
}) })
basic_get(`dir_api.php?a=get/answers/all&${q}`, function(r2) { basic_get(`dir_api.php?a=get/answers/all&${this.single ? ('id=' + this.which) : q}`, function(r2) {
var organized = _.groupBy(r2, function(x) { return x.ses_id; } ) var organized = _.groupBy(r2, function(x) { return x.ses_id; } )
self.answers = {} self.answers = {}
self.answers2 = {} self.answers2 = {}
@ -2464,7 +2467,7 @@ const ActivityReport = Vue.component('activityreport', {
return this.activities.filter(a => { return this.activities.filter(a => {
// semester filter // semester filter
let ok = true let ok = true
if (sem) { if (!this.single && sem) {
const t = dayjs(a.starttime) const t = dayjs(a.starttime)
ok = t.isAfter(sem.start) && t.isBefore(sem.end) ok = t.isAfter(sem.start) && t.isBefore(sem.end)
} }
@ -2474,6 +2477,7 @@ const ActivityReport = Vue.component('activityreport', {
return false return false
} }
// text filter against title/desc/hosts // text filter against title/desc/hosts
if (this.single) return true
if (!q) return true if (!q) return true
const hay = (a.title + ' ' + (a.desc||'') + ' ' + (this.hoststr(a.id)||'')).toLowerCase() const hay = (a.title + ' ' + (a.desc||'') + ' ' + (this.hoststr(a.id)||'')).toLowerCase()
return hay.indexOf(q) !== -1 return hay.indexOf(q) !== -1
@ -2481,11 +2485,11 @@ const ActivityReport = Vue.component('activityreport', {
} }
}, },
watch: { watch: {
selectedSemesterKey() { this.fetchRange() } selectedSemesterKey() { if (!this.single) this.fetchRange() }
}, },
template: `<div class="activityreport space-y-4"> template: `<div class="activityreport space-y-4">
<!-- Controls --> <!-- Controls -->
<div class="bg-white rounded-md shadow p-3 sticky top-16 md:static z-40"> <div v-if="!single" class="bg-white rounded-md shadow p-3 sticky top-16 md:static z-40">
<div class="flex flex-col gap-2 md:flex-row md:items-center"> <div class="flex flex-col gap-2 md:flex-row md:items-center">
<label class="text-sm text-gray-700">Semester <label class="text-sm text-gray-700">Semester
<select v-model="selectedSemesterKey" class="ml-2 border rounded px-2 py-1 text-sm"> <select v-model="selectedSemesterKey" class="ml-2 border rounded px-2 py-1 text-sm">

View File

@ -23,7 +23,7 @@
<header class="fixed top-0 left-0 w-full bg-blue-600 text-white border-b p-3 flex justify-around text-base font-semibold shadow z-50 md:hidden"> <header class="fixed top-0 left-0 w-full bg-blue-600 text-white border-b p-3 flex justify-around text-base font-semibold shadow z-50 md:hidden">
<a href="index.php" class="<?= $link_base ?> <?= $is_index ? $link_active : $link_inactive ?>" <?= $is_index ? 'aria-current="page"' : '' ?>>My Itinerary</a> <a href="index.php" class="<?= $link_base ?> <?= $is_index ? $link_active : $link_inactive ?>" <?= $is_index ? 'aria-current="page"' : '' ?>>My Itinerary</a>
<a href="allsessions.php" class="<?= $link_base ?> <?= $is_all ? $link_active : $link_inactive ?>" <?= $is_all ? 'aria-current="page"' : '' ?>>All Sessions</a> <a href="allsessions.php" class="<?= $link_base ?> <?= $is_all ? $link_active : $link_inactive ?>" <?= $is_all ? 'aria-current="page"' : '' ?>>All Sessions</a>
<a href="history.php" class="<?= $link_base ?> <?= $is_hist ? $link_active : $link_inactive ?>" <?= $is_hist ? 'aria-current="page"' : '' ?>>History</a> <a href="history.php" class="<?= $link_base ?> <?= $is_hist ? $link_active : $link_inactive ?>" <?= $is_hist ? 'aria-current="page"' : '' ?>>My History</a>
<?php if ($has_report_access) { ?> <?php if ($has_report_access) { ?>
<a href="report.php" class="<?= $link_base ?> <?= $is_report ? $link_active : $link_inactive ?>" <?= $is_report ? 'aria-current="page"' : '' ?>>Reports</a> <a href="report.php" class="<?= $link_base ?> <?= $is_report ? $link_active : $link_inactive ?>" <?= $is_report ? 'aria-current="page"' : '' ?>>Reports</a>
<?php } ?> <?php } ?>

View File

@ -23,7 +23,7 @@
<nav class="hidden md:flex flex-col gap-2 text-sm font-medium"> <nav class="hidden md:flex flex-col gap-2 text-sm font-medium">
<a href="index.php" class="<?= $base_link ?> <?= $is_index ? $active : $inactive ?>">My Itinerary</a> <a href="index.php" class="<?= $base_link ?> <?= $is_index ? $active : $inactive ?>">My Itinerary</a>
<a href="allsessions.php" class="<?= $base_link ?> <?= $is_all ? $active : $inactive ?>">All Sessions</a> <a href="allsessions.php" class="<?= $base_link ?> <?= $is_all ? $active : $inactive ?>">All Sessions</a>
<a href="history.php" class="<?= $base_link ?> <?= $is_hist ? $active : $inactive ?>">History</a> <a href="history.php" class="<?= $base_link ?> <?= $is_hist ? $active : $inactive ?>">My History</a>
<?php if ($has_report_access) { ?> <?php if ($has_report_access) { ?>
<a href="report.php" class="<?= $base_link ?> <?= $is_report ? $active : $inactive ?>">Reports</a> <a href="report.php" class="<?= $base_link ?> <?= $is_report ? $active : $inactive ?>">Reports</a>
<?php } ?> <?php } ?>