CRM-ListStudents
$app = new iSDK;
echo “created object!
“;
if ($app->cfgCon(“connectionName”)) {
echo “App Connected!
Please Stand By While I Pull Up that Information for You!“;
# $email = ‘tobymilroy@napma.com’;
$_DFYSchoolOwnerID = i4w_get_contact_field(‘id’);
$totalRecords = $app->dsCount(“Contact”, array(‘_DFYSchoolOwnerID’ => $_DFYSchoolOwnerID));
echo “
You currently have ” . $totalRecords . ” students loaded into the system.
“;
if ($totalRecords > 0) {
$totalPages = ceil($totalRecords / 1000);
$contacts = array();
$page = 0;
do {
$contact = $app->dsQuery(“Contact”, 1000, $page++, array(‘_DFYSchoolOwnerID’ => $_DFYSchoolOwnerID), array(‘Id’, ‘Groups’, ‘_DFYSchoolOwnerID’, ‘_DFYSchoolOwnerName’, ‘FirstName’, ‘LastName’, ‘Email’, ‘Phone1’));
foreach ($contact as $c) {
$contacts[] = $c;
}
} while ($page < $totalPages);
#echo "
“;
#print_r($contacts);
#echo “
“;
function aasort (&$array, $key) {
$sorter=array();
$ret=array();
reset($array);
foreach ($array as $ii => $va) {
$sorter[$ii]=$va[$key];
}
asort($sorter);
foreach ($sorter as $ii => $va) {
$ret[$ii]=$array[$ii];
}
return $array=$ret;
}
$contacts = aasort($contacts,”LastName”);
#echo “
";
#$rev_array = rsort($sort_arra);
#print_r($contacts);
#echo "
“;
echo “
| # | ID# | First Name | Last Name | Phone | Kickin | NBBC | Leadership | GOLD | ||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ‘. ($i +1) .’ | ‘.$cont[Id].’ | ‘.$cont[Groups].’ | ‘.$cont[_DFYSchoolOwnerID].’ | ‘.$cont[_DFYSchoolOwnerName].’ | ‘.$cont[FirstName].’ | ‘.$cont[LastName].’ | ‘.$cont[Email].’ | ‘.$cont[Phone1].’ | ‘.(in_array(“2704″, $kickin)?’X’:”).’ | ‘.(in_array(“2706″, $kickin)?’X’:”).’ | ‘.(in_array(“2708″, $kickin)?’X’:”).’ | ‘.(in_array(“2710″, $kickin)?’X’:”).’ |
“;
} else {
echo “There were no contacts found with the specified Owner ID ” . $_DFYSchoolOwnerID;
}
} else {
echo “connection failed!
“;
}
