{"id":15162,"date":"2014-03-12T01:43:04","date_gmt":"2014-03-12T05:43:04","guid":{"rendered":"http:\/\/napmamembers.com\/go\/?page_id=15162"},"modified":"2015-04-21T14:18:32","modified_gmt":"2015-04-21T18:18:32","slug":"crm-liststudents","status":"publish","type":"page","link":"http:\/\/napmamembers.com\/go\/crm-liststudents\/","title":{"rendered":"CRM-ListStudents"},"content":{"rendered":"[insert_php]\nrequire_once(&#8220;.\/api\/src\/isdk.php&#8221;);<\/p>\n<p>$app = new iSDK;<br \/>\necho &#8220;created object!<br \/>&#8220;;<\/p>\n<p>if ($app->cfgCon(&#8220;connectionName&#8221;)) {<\/p>\n<p>    echo &#8220;App Connected!<br \/>Please Stand By While I Pull Up that Information for You!<\/br>&#8220;;<\/p>\n<p>   \t# $email = &#8216;tobymilroy@napma.com&#8217;;<br \/>\n\t$_DFYSchoolOwnerID = i4w_get_contact_field(&#8216;id&#8217;);<br \/>\n    $totalRecords = $app->dsCount(&#8220;Contact&#8221;, array(&#8216;_DFYSchoolOwnerID&#8217; => $_DFYSchoolOwnerID));<\/p>\n<p>    echo &#8220;<\/p>\n<h3>You currently have &#8221; . $totalRecords . &#8221; students loaded into the system.<\/h3>\n<p>&#8220;;<\/p>\n<p>    if ($totalRecords > 0) {<br \/>\n        $totalPages = ceil($totalRecords \/ 1000);<br \/>\n        $contacts = array();<br \/>\n        $page = 0;<br \/>\n        do {<br \/>\n            $contact = $app->dsQuery(&#8220;Contact&#8221;, 1000, $page++, array(&#8216;_DFYSchoolOwnerID&#8217; => $_DFYSchoolOwnerID), array(&#8216;Id&#8217;, &#8216;Groups&#8217;, &#8216;_DFYSchoolOwnerID&#8217;, &#8216;_DFYSchoolOwnerName&#8217;, &#8216;FirstName&#8217;, &#8216;LastName&#8217;, &#8216;Email&#8217;, &#8216;Phone1&#8217;));<\/p>\n<p>            foreach ($contact as $c) {<br \/>\n                $contacts[] = $c;<br \/>\n            }<br \/>\n        } while ($page < $totalPages);\n\n        #echo \"\n\n<pre>&#8220;;\r\n        #print_r($contacts);\r\n        #echo &#8220;<\/pre>\n<p>&#8220;;<\/p>\n<p>        function aasort (&#038;$array, $key) {<br \/>\n            $sorter=array();<br \/>\n            $ret=array();<br \/>\n            reset($array);<br \/>\n            foreach ($array as $ii => $va) {<br \/>\n                $sorter[$ii]=$va[$key];<br \/>\n            }<br \/>\n            asort($sorter);<br \/>\n            foreach ($sorter as $ii => $va) {<br \/>\n                $ret[$ii]=$array[$ii];<br \/>\n            }<br \/>\n            return $array=$ret;<br \/>\n        }<\/p>\n<p>        $contacts = aasort($contacts,&#8221;LastName&#8221;);<\/p>\n<p>        #echo &#8220;<\/p>\n<pre>\";\r\n        #$rev_array = rsort($sort_arra);\r\n        #print_r($contacts);\r\n        #echo \"<\/pre>\n<p>&#8220;;<\/p>\n<p>        echo &#8220;<\/p>\n<table>&#8220;;<br \/>\n        echo &#8216;<\/p>\n<tr>\n<th align=\"center\">#<\/td>\n<th align=\"center\">ID#<\/th>\n<th align=\"center\">First Name<\/td>\n<th align=\"center\">Last Name<\/td>\n<th align=\"center\">Email<\/td>\n<th align=\"center\">Phone<\/th>\n<th align=\"center\">Kickin<\/th>\n<th align=\"center\">NBBC<\/th>\n<th align=\"center\">Leadership<\/th>\n<th align=\"center\">GOLD<\/th>\n<\/tr>\n<p>&#8216;;<br \/>\n\t\t$i=0;<br \/>\n        foreach($contacts as $cont)<br \/>\n\t\t{<br \/>\n        echo &#8216;<\/p>\n<tr>\n<td>&#8216;. ($i +1) .&#8217;<\/td>\n<p>&#8216;;<br \/>\n        echo &#8216;<\/p>\n<td>&#8216;.$cont[Id].&#8217;<\/td>\n<p>&#8216;;<br \/>\n        #echo &#8216;<\/p>\n<td>&#8216;.$cont[Groups].&#8217;<\/td>\n<p>&#8216;;<br \/>\n    \t#echo &#8216;<\/p>\n<td>&#8216;.$cont[_DFYSchoolOwnerID].&#8217;<\/td>\n<p>&#8216;;<br \/>\n        #echo &#8216;<\/p>\n<td>&#8216;.$cont[_DFYSchoolOwnerName].&#8217;<\/td>\n<p>&#8216;;<br \/>\n        echo &#8216;<\/p>\n<td>&#8216;.$cont[FirstName].&#8217;<\/td>\n<p>&#8216;;<br \/>\n        echo &#8216;<\/p>\n<td>&#8216;.$cont[LastName].&#8217;<\/td>\n<p>&#8216;;<br \/>\n        echo &#8216;<\/p>\n<td>&#8216;.$cont[Email].&#8217;<\/td>\n<p>&#8216;;<br \/>\n    \techo &#8216;<\/p>\n<td>&#8216;.$cont[Phone1].&#8217;<\/td>\n<p>&#8216;;<br \/>\n        #Kickin\tNBBC\tLeadership gold<br \/>\n        $kickin = explode(&#8220;,&#8221;,$cont[Groups]);<br \/>\n        echo &#8216;<\/p>\n<td>&#8216;.(in_array(&#8220;2704&#8243;, $kickin)?&#8217;X&#8217;:&#8221;).&#8217;<\/td>\n<p>&#8216;;<br \/>\n        echo &#8216;<\/p>\n<td>&#8216;.(in_array(&#8220;2706&#8243;, $kickin)?&#8217;X&#8217;:&#8221;).&#8217;<\/td>\n<p>&#8216;;<br \/>\n        echo &#8216;<\/p>\n<td>&#8216;.(in_array(&#8220;2708&#8243;, $kickin)?&#8217;X&#8217;:&#8221;).&#8217;<\/td>\n<p>&#8216;;<br \/>\n        echo &#8216;<\/p>\n<td>&#8216;.(in_array(&#8220;2710&#8243;, $kickin)?&#8217;X&#8217;:&#8221;).&#8217;<\/td>\n<\/tr>\n<p>&#8216;;<br \/>\n        $i++;<br \/>\n\t\t}<br \/>\n\t\techo &#8220;<\/table>\n<p>&#8220;;<\/p>\n<p>    } else {<br \/>\n        echo &#8220;There were no contacts found with the specified Owner ID &#8221; . $_DFYSchoolOwnerID;<br \/>\n    }<\/p>\n<p>} else {<br \/>\n    echo &#8220;connection failed!<br \/>&#8220;;<br \/>\n}<\/p>\n[\/insert_php]\n","protected":false},"excerpt":{"rendered":"<p>CRM &#8211; List Students<\/p>\n","protected":false},"author":3,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"open","ping_status":"closed","template":"page-crm.php","meta":{"footnotes":""},"class_list":["post-15162","page","type-page","status-publish","hentry"],"publishpress_future_action":{"enabled":false,"date":"2026-05-07 19:42:54","action":"change-status","newStatus":"draft","terms":[],"taxonomy":"","extraData":[]},"publishpress_future_workflow_manual_trigger":{"enabledWorkflows":[]},"_links":{"self":[{"href":"http:\/\/napmamembers.com\/go\/wp-json\/wp\/v2\/pages\/15162","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/napmamembers.com\/go\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"http:\/\/napmamembers.com\/go\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"http:\/\/napmamembers.com\/go\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"http:\/\/napmamembers.com\/go\/wp-json\/wp\/v2\/comments?post=15162"}],"version-history":[{"count":0,"href":"http:\/\/napmamembers.com\/go\/wp-json\/wp\/v2\/pages\/15162\/revisions"}],"wp:attachment":[{"href":"http:\/\/napmamembers.com\/go\/wp-json\/wp\/v2\/media?parent=15162"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}