Directory

Dialing Directions

'; // bring in datatable resources // www.datatables.net echo ""; echo ""; // bring in custom VCCCD css and initialize echo ""; echo ""; // select view to use // we stopped using URL param $vselect = "oceveryone"; // 20140629 old code used to grab URL parms (VK) // test for URL params //if ( empty( $_GET["vselect"] ) ){ // exit("No params specified."); //} // collect SharePoint view to use based on URL param 'vselect' // old switch statement when used with URL param //switch ( $_GET["vselect"]) { switch ( $vselect ) { case "mceveryone": $viewName = "{5BC05419-4620-49E7-B8DB-887174016D31}"; //mc classified break; case "mcftfaculty": $viewName = "{A4E1B2F2-AA2B-4E4E-AF55-102D014E8F89}"; //mc full-time faculty break; case "mcptfaculty": $viewName = "{8C633DCA-34F4-4FD4-8B69-4028625CE928}"; //mc part-time faculty break; case "mcmanagement": $viewName = "{EFD8044B-DE52-431E-B71E-B4A673E9EAE4}"; //mc management break; case "mcclassified": $viewName = "{A1FA04A8-FEEE-4F62-83C6-E536C2DDBF0D}"; //mc classified break; case "oceveryone": $viewName = "{5718D9C3-5842-45DF-A8AC-F4D90EF1F70F}"; //oc everyone break; } //Authentication details $authParams = array('login' => 'DSPBE01\DirectoryLookup', 'password' => 'pass12345'); /* A string that contains either the display name or the GUID for the list. * It is recommended that you use the GUID, which must be surrounded by curly * braces ({}). */ $listName = "{E13B1C49-B949-4807-A1E0-4149D764A80F}"; $rowLimit = '1000'; /* Local path to the Lists.asmx WSDL file (localhost). You must first download * it manually from your SharePoint site (which should be available at * yoursharepointsite.com/subsite/_vti_bin/Lists.asmx?WSDL) */ $myserver = $_SERVER['SERVER_NAME'] ; $wsdl = "http://" . $myserver . "/sites/default/files/webshare-directory.wsdl"; //Creating the SOAP client and initializing the GetListItems method parameters $soapClient = new SoapClient($wsdl, $authParams); //$soapClient = new SoapClient($wsdl); $params = array('listName' => $listName, 'viewName' => $viewName, 'rowLimit' => $rowLimit); //Calling the GetListItems Web Service $rawXMLresponse = null; try{ $rawXMLresponse = $soapClient->GetListItems($params)->GetListItemsResult->any; } catch(SoapFault $fault){ echo 'Fault code: '.$fault->faultcode; echo 'Fault string: '.$fault->faultstring; } //echo '
' . $rawXMLresponse . '
'; //Loading the XML result into parsable DOM elements $dom = new DOMDocument(); $dom->loadXML($rawXMLresponse); $results = $dom->getElementsByTagNameNS("#RowsetSchema", "*"); // Build alpha sort menu echo ''; echo "\r\n"; //Fetching the elements values. Specify more attributes as necessary echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; foreach($results as $result){ if ( $result->getAttribute("ows_ContentType") == "Person" ) { // do this for persons echo ''; echo ''; echo ''; echo ''; echo ''; } else { // do this for generic entries echo ''; echo ''; //last or generic name echo ''; echo ''; echo ''; } } echo ''; echo '
Name/DepartmentExtEmail
'; // if website exists, prepend with tag with website if ( $result->getAttribute("ows_Website") !== "" ) { echo ''; } // if firstname is blank, return just the dept in bold // else return lastname and firstname with comma if ( $result->getAttribute("ows_First_x0020_Name") == "" ) { echo '' . $result->getAttribute("ows_Department") . ''; } else { echo $result->getAttribute("ows_LinkTitle"); // last name if ( $result->getAttribute("ows_First_x0020_Name") !== "" ) { echo ', ' . $result->getAttribute("ows_First_x0020_Name"); } } // if website exists close off the tag if ( $result->getAttribute("ows_Website") !== "" ) { echo ''; } // if lastname is not blank and department or title is not blank return title and/or department in parenthesis if ( ( $result->getAttribute(ows_LinkTitle) !== "" ) && ( ( $result->getAttribute("ows_Title0") !== "" ) || ( $result->getAttribute("ows_Department") !== "" ) ) ) { echo ' ('; echo $result->getAttribute("ows_Title0"); // if title and department are not blank add separator if ( ($result->getAttribute("ows_Title0") !== "") && ($result->getAttribute("ows_Department") !== "") ) { echo ', '; } echo $result->getAttribute("ows_Department"); echo ')'; } echo '' ; // if phone and ext exist return 555-5555 x5555 // else return both as at least one will be blank if ( ( $result->getAttribute("ows_Phone") !== "") && ( $result->getAttribute("ows_Extension") !=="" ) ) { echo $result->getAttribute("ows_Phone") . ' x' . $result->getAttribute("ows_Extension"); } else { echo $result->getAttribute("ows_Phone"); echo $result->getAttribute("ows_Extension"); } echo ''; if ( $result->getAttribute("ows_Email") !== "" ) { echo '' . $result->getAttribute("ows_Email") . ''; } echo '
'.$result->getAttribute("ows_LinkTitle").'' ; // if phone and ext exist return 555-5555 x5555 // else return both as at least one will be blank if ( ( $result->getAttribute("ows_Phone") !== "") && ( $result->getAttribute("ows_Extension") !=="" ) ) { echo $result->getAttribute("ows_Phone") . ' x' . $result->getAttribute("ows_Extension"); } else { echo $result->getAttribute("ows_Phone"); echo $result->getAttribute("ows_Extension"); } echo ''; if ( $result->getAttribute("ows_Email") !== "" ) { echo '' . $result->getAttribute("ows_Email") . ''; } echo '
'; unset($soapClient); ?>