* distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
session_start();
require_once __DIR__ . '/common.php';
require_once __DIR__ . '/aabUtil.php';
require_once __DIR__ . '/../lib/AAB/AABService.php';
use Att\Api\AAB\AABService;
$arr = null;
try {
    envinit();
    $aabService = new AABService(getFqdn(), getSessionToken());
    $searchVal = $_POST['contactsSearchValue'];
    $resultSet = $aabService->getContacts(null, null, $searchVal);
    $tables = array();
    $contacts = $resultSet->getContacts();
    $qcontacts = $resultSet->getQuickContacts();
    foreach ($contacts as $contact) {
        $tables[] = generateContactTable($contact);
        $contactId = $contact->getContactId();
        $table = generatePhonesTable($contactId, $contact->getPhones());
        if ($table !== null) {
            $tables[] = $table;
        }
        $table = generateEmailsTable($contactId, $contact->getEmails());
        if ($table !== null) {
            $tables[] = $table;
        }
        $table = generateImsTable($contactId, $contact->getIms());
 private function _handleGetContacts()
 {
     $vnames = array('searchVal', 'getContacts');
     $this->copyToSession($vnames);
     if (!isset($_SESSION['getContacts'])) {
         return;
     }
     $searchVal = $_SESSION['searchVal'];
     try {
         $aabSrvc = new AABService($this->apiFQDN, $this->getSessionToken());
         $resultSet = $aabSrvc->getContacts(null, null, $searchVal);
         $this->results[C_GET_CONTACTS] = $resultSet;
         $this->clearSession($vnames);
     } catch (Exception $e) {
         $this->errors[C_CONTACT_ERROR] = $e->getMessage();
         $this->clearSession($vnames);
     }
 }