Training Registrations

{source}
<?php
$stringValue = JRequest::getString('offering_id', '', 'fpost');
$len = strlen($stringValue);
$pos = stripos($stringValue,'-');
$offeringID = substr($stringValue,0,$pos);
$courseCode = substr($stringValue,$pos+1,$len);

?>

<?php

// download_data to EXCEL
$filename = "assets/PDFs/NCADDTrainingReg.xls";
header("Content-type: application/vnd.ms-excel");
$fileHandle = fopen($filename, 'w+') or die("can't open file");

// write column headers

$db =& JFactory::getDBO();
$query1 = "SELECT start_date, name, instructor, location FROM ncadd_course_offerings, ncadd_courses WHERE offering_id = $offeringID AND ncadd_courses.course_code = ncadd_course_offerings.course_code LIMIT 1";
$db->setQuery($query1);
$row1 = $db->loadAssoc();

$DataString = $courseCode."\t".$row1['name']."\t"."Instructor: ".$row1['instructor']."\t"."Start date: ".$row1['start_date']."\t"."\r\n";
fwrite($fileHandle, $DataString);

echo '<br /><span class="black_StandardBold">'.$courseCode.': '.$row1['name'].'</span>';
echo '<br /><span class="black_StandardBold">Instructor: </span>'.$row1['instructor'];
echo '<br /><span class="black_StandardBold">Date: </span>'.date(' F d, Y', strtotime($row1['start_date']));

$DataString = "ID"."\t"."First"."\t"."Last"."\t"."Email"."\t"."Phone"."\t"."Organization"."\t"."Address1"."\t"."Address2"."\t"."City"."\t"."State"."\t"."Zip"."\t"."Payment"."\t"."\r\n";

fwrite($fileHandle, $DataString);

$db =& JFactory::getDBO();

$query="SELECT offering_id, ncadd_courses_students.student_id, last, first, email, phone, company, address1, address2, city, state, zip, payment FROM ncadd_courses_students, ncadd_students WHERE offering_id = $offeringID AND ncadd_courses_students.student_id = ncadd_students.student_id ORDER BY last ASC";

$db->setQuery($query);
$row = $db->loadObjectList();

?>

<br /><br />
<img src="assets/images/icons/excel.png" alt="Excel download" width="24" height="24" align="absmiddle" />
<a href="assets/PDFs/NCADDTrainingReg.xls">Download to Excel</a>
<br /><br />

<table cellpadding="10" cellspacing="10">
<tr class="black_StandardBold" >
<td width="60" align="left" valign="top" >ID</td>
<td width="175" align="left" valign="top" >Name</td>
<td width="225" align="left" valign="top" >Email / Phone</td>
<td width="175" align="left" valign="top" >Payment</td>
<td width="225" align="left" valign="top" >Address</td>
</tr>

<?php foreach ($row as $item) { ?>

<tr>
<td width="60" align="left" valign="top" ><?php echo $item->student_id; ?></td>
<td width="175" align="left" valign="top" ><?php echo $item->last.', '.$item->first; ?></td>
<td width="225" align="left" valign="top" ><?php echo $item->email.'<br />'.$item->phone; ?></td>
<td width="100" align="left" valign="top" ><?php echo $item->payment; ?></td>
<td width="225" align="left" valign="top" ><?php echo $item->address1; echo '<br />'.$item->address2; echo '<br />'.$item->city.', '.$item->state.' '.$item->zip; ?></td>

</tr>
<tr>
<td > </td>
<td >  </td>
<td >  </td>
<td >  </td>
<td >  </td>
</tr>
<?php
$DataString =
$item->student_id."\t".
$item->first."\t".
$item->last."\t".
$item->email."\t".
$item->phone."\t".
$item->company."\t".
$item->address1."\t".
$item->address2."\t".
$item->city."\t".
$item->state."\t".
$item->zip."\t".
$item->payment."\r\n";

fwrite($fileHandle, $DataString);
} ?>
</table>
<?php fclose($fileHandle); ?>
{/source}

Last modified onThursday, 07 August 2014 09:08
More in this category: « Course Details Corporate Donors »

3 comments

  • Mp3fiesta
    Mp3fiesta Monday, 05 February 2018 13:44 Comment Link

    "Hi this is a superb post. I’m going to e-mail this to my pals. I stumbled on this while searching on yahoo I’ll be sure to come back. thanks for sharing."

  • Buy Cenforce Online
    Buy Cenforce Online Sunday, 22 January 2017 13:17 Comment Link

    Hi! This is my first visit to your blog! We are
    a group of volunteers and starting a new initiative in a community
    in the same niche. Your blog provided us beneficial information to work on. You have
    done a outstanding job!

  • Bhim app
    Bhim app Saturday, 21 January 2017 03:19 Comment Link

    I do not even know how I ended up here,
    but I thought this post was good. I don't know who you
    are but certainly you are going to a famous blogger if you
    are not already ;) Cheers!

Leave a comment

Make sure you enter all the required information, indicated by an asterisk (*). HTML code is not allowed.