public function selectedrequestcovenantAction() { $responce = new stdClass(); $cdrequest = $_POST["idrequest"]; $requestModel = new RequestModel(); $clientCovenant = $requestModel->fetchRow($requestModel->getClientCovenantForward($cdrequest)); if ($clientCovenant['dtbirth'] != '') { $dtbirth = new Zend_Date($clientCovenant['dtbirth'], 'dd-MM-YYYY'); $year = $dtbirth->toString('YYYY'); $month = $dtbirth->toString('MM'); $day = $dtbirth->toString('dd'); $today = new Zend_Date(); $tdYear = $today->toString('YYYY'); $tdMonth = $today->toString('MM'); $tdDay = $today->toString('dd'); $nrage = 0; $nrage = GslabUtils::calcAgeDifferenceShort($clientCovenant['dtbirth']); if ($tdMonth < $month || $tdMonth == $month && $tdDay < $day) { $nrage--; } } else { $nrage = " "; } $responce->forward = $clientCovenant['nmforward']; $responce->covenant = $clientCovenant['nmcovenant']; $responce->client = $clientCovenant['nmclient']; $responce->fgsex = $clientCovenant['fgsex']; $responce->age = $nrage; $responce = json_encode($responce); print_r($responce); return $responce; }