$l['paperid'], 'title' => ($OC_configAR['OC_PROGRAM_titleCaps'] ? ucwords(strtolower($l['title'])) : $l['title']), 'format' => $l['format'], 'abstract' => $l['abstract'], 'discussant_name' => $l['discussant_name'], 'discussant_affiliation' => $l['discussant_affiliation'] ); } // Session authors $q = "SELECT `" . OCC_TABLE_AUTHOR . "`.`paperid`, `" . OCC_TABLE_AUTHOR . "`.`name_last`, `" . OCC_TABLE_AUTHOR . "`.`name_first`, `" . OCC_TABLE_AUTHOR . "`.`organization`, `" . OCC_TABLE_AUTHOR . "`.`country` FROM `" . OCC_TABLE_AUTHOR . "`, `" . OCC_TABLE_MODULE_OC_PROGRAM_SESSIONPAPERS . "` WHERE `" . OCC_TABLE_AUTHOR . "`.`paperid`=`" . OCC_TABLE_MODULE_OC_PROGRAM_SESSIONPAPERS . "`.`paperid` ORDER BY `" . OCC_TABLE_AUTHOR . "`.`paperid`, `" . OCC_TABLE_AUTHOR . "`.`position`"; $r = ocsql_query($q) or die("Unable to retrieve authors"); $sessionPaperAuthorAR = array(); $countriesAR = array(); $orgAR = array(); while ($l = ocsql_fetch_assoc($r)) { $sessionPaperAuthorAR[$l['paperid']][] = array( 'name_first' => trim($l['name_first']), 'name_last' => trim($l['name_last']), 'name' => trim($l['name_first']) . ' ' . trim($l['name_last']), 'country' => (isset($OC_countryAR[$l['country']]) ? $OC_countryAR[$l['country']] : $l['country']), 'organization' => trim($l['organization']) ); if (!in_array($l['country'], $countriesAR) && !empty($l['country'])) { $countriesAR[] = $l['country']; } if (!in_array($l['organization'], $orgAR) && !empty($l['organization'])) { $orgAR[] = $l['organization']; } } if (count($countriesAR) > 1) { $incCountry = true; } else { $incCountry = false; } if (count($orgAR) > 1) { $incOrg = true; } else { $incOrg = false; } // Time Slots / Sessions $q = "SELECT *, DATE_FORMAT(`date`, '%m/%d/%Y') AS `fdate`, DATE_FORMAT(`start_time`, '" . (($OC_configAR['OC_PROGRAM_timeFormat'] == 12) ? '%l:%i%p' : '%k:%i') . "') AS `ftime`, DATE_FORMAT(`date`, '%W') AS `weekday` FROM " . OCC_TABLE_MODULE_OC_PROGRAM_SESSIONS . " ORDER BY `date`, `start_time`, `end_time`, ISNULL(`session_order`), `session_order` ASC, `title`"; $sessions = ocsql_query($q) or die("Unable to retrieve sessions"); if (ocsql_num_rows($sessions) == 0) { print 'The program is not ready yet'; exit; } print 'Ext.data.JsonP.feedCb({ "proposals": [ '; $currdate = ''; $currtimeslot = ''; $sid=1; while ($timeslot = ocsql_fetch_assoc($sessions)) { $info = ''; if (isset($timeslot['page']) && !empty($timeslot['page'])) { $info = $timeslot['page']; } elseif (isset($timeslot['info']) && !empty($timeslot['info'])) { $info = $timeslot['info']; } if (!empty($info)) { /* if (!preg_match("/\<[^\r\n\<]+\>/",$info)) { $info = nl2br(safeHTMLstr($info)); } */ $info = preg_replace("/\r?\n\r?\n/", "

", $info); $info = preg_replace("/[\r\n]+/", " ", $info); $info = preg_replace("/\"/", "\\\"", $info); $info = preg_replace('/[\200-\237]|\240|[\241-\377]/', '', $info); // strip out Unicode special chars #$info = '
' . $info; } print ' { "topics": [ ], "room": "' . addslashes(safeHTMLstr($timeslot['room'])) . '", "end_time": "' . safeHTMLstr($timeslot['date'] . 'T' . $timeslot['end_time']) . '", "description": "' . addslashes((($OC_configAR['OC_PROGRAM_sessionChair'] && isset($timeslot['chair_name']) && !empty($timeslot['chair_name'])) ? safeHTMLstr($timeslot['chair_name']) . ((isset($timeslot['chair_affiliation']) && !empty($timeslot['chair_affiliation'])) ? (', ' . safeHTMLstr($timeslot['chair_affiliation'])) : '') : '')) . '", "title": "' . addslashes(safeHTMLstr($timeslot['title'])) . '", "url": "", "date": "' . safeHTMLstr($timeslot['date']) . '", "info": "' . $info . '", "speakers": [ '; // papers if (isset($sessionPaperAR[$timeslot['sessionid']])) { foreach ($sessionPaperAR[$timeslot['sessionid']] as $paper) { $authors = ''; $authorsOrg = ''; if (isset($sessionPaperAuthorAR[$paper['paperid']])) { foreach ($sessionPaperAuthorAR[$paper['paperid']] as $author) { $authors .= safeHTMLstr($author['name']); $authorsOrg .= safeHTMLstr($author['name']); #if ($OC_configAR['OC_PROGRAM_listAuthorAffiliation'] && !empty($author['organization'])) { # $authorsOrg .= ', ' . safeHTMLstr($author['organization'] . ', ' . $author['country']); #} if ($incOrg) { $authorsOrg .= (!empty($author['organization']) ? (', ' . safeHTMLstr($author['organization'])) : ''); } if ($incCountry) { $authorsOrg .= (!empty($author['country']) ? (', ' . safeHTMLstr($author['country'])) : ''); } $authors .= "; "; $authorsOrg .= "
"; } } $authors = rtrim($authors, "; "); #$abstract = preg_replace("/\r?\n/", "\n", addslashes(safeHTMLstr($paper['abstract']))); $abstract = preg_replace("/\r?\n\r?\n/", "

", addslashes(safeHTMLstr($paper['abstract']))); $abstract = preg_replace("/[\r\n]+/", " ", $abstract); $abstract = preg_replace('/[\200-\237]|\240|[\241-\377]/', '', $abstract); // strip out Unicode special chars preg_match("/(\p{L})/", $paper['title'], $match); if (isset($match[1])) { $sort = strtoupper($match[1]); } else { $sort = 'Z'; } print ' { "icon": null, "title": "' . addslashes(safeHTMLstr($paper['title'])) . '", "sort": "' . safeHTMLstr($sort) . '", "authors": "' . addslashes(safeHTMLstr($authors)) . '", "authorsorg": "' . addslashes($authorsOrg) . '", "first_name": "' . $sessionPaperAuthorAR[$paper['paperid']][0]['name_first'] . ' ", "photo": null, "position": "", "name": "' . addslashes(safeHTMLstr($sessionPaperAuthorAR[$paper['paperid']][0]['name'])) . '", "affiliation": "' . (($OC_configAR['OC_PROGRAM_listAuthorAffiliation'] && !empty($sessionPaperAuthorAR[$paper['paperid']][0]['organization'])) ? addslashes(safeHTMLstr($sessionPaperAuthorAR[$paper['paperid']][0]['organization'])) : '') . '", "url": "", "bio": "' . $abstract . '", "id": ' . $paper['paperid'] . ', "twitter": null, "last_name": "' . $sessionPaperAuthorAR[$paper['paperid']][0]['name_last'] . '" }, '; } } print ' ], "proposal_type": "' . addslashes(safeHTMLstr($timeslot['type'])) . '", "id": ' . $sid++ . ', "time": "' . safeHTMLstr($timeslot['date'] . 'T' . $timeslot['start_time']) . '", "pretty_time": "' . safeHTMLstr(strtolower($timeslot['ftime'])) . '", "day": "' . safeHTMLstr($timeslot['weekday'] . ', ' . $timeslot['date']) . '" }, '; } print ' ] }) ';