public static function extractMultiDimensional($rawMulti) { $resultArr = array(); foreach ($rawMulti as $currentMulti) { if (isset($currentMulti['claimData'])) { $currentMulti = json_decode($currentMulti['claimData'], true); $tempContainer = array_values($currentMulti); $mobileNumContainer = MobileNumberExtractor::extractMobileNumbers($tempContainer); /*check if present in table blacklist*/ $criteria = new CDbCriteria(); $criteria->compare("mobile_number", $mobileNumContainer); if (!BlackListedMobile::model()->exists($criteria)) { $resultArr[] = $mobileNumContainer; } } } return $resultArr; }
public function actionMobile() { if (isset($_REQUEST['accountID'])) { $accountMdl = Accounts::model()->findByPk($_REQUEST['accountID']); $fileName = $accountMdl->claimAccountName . ' - ' . date("Y-m-d") . '-all-mobilenumbers'; header("Pragma: public"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Cache-Control: private", false); header("Content-Type: application/octet-stream"); header("Content-Disposition: attachment; filename=\"{$fileName}.csv\";"); header("Content-Transfer-Encoding: binary"); $criteria = new CDbCriteria(); $criteria->compare("account_id", $_REQUEST['accountID']); $criteria->order = "date_created DESC"; $records = Records::model()->findAll($criteria); $isFirst = true; foreach ($records as $curRecord) { $data = json_decode($curRecord->claimData, true); if ($isFirst) { //print heads echo "Mobile Number\n"; $isFirst = false; } //retrieve mobile number $arrayVals = array_values($data); $extractedMobile = MobileNumberExtractor::extractMobileNumbers($arrayVals); if ($extractedMobile != false) { /* check if present at blacklist*/ $crt = new CDbCriteria(); $crt->compare('mobile_number', $extractedMobile); if (!BlackListedMobile::model()->exists($crt)) { echo $extractedMobile . PHP_EOL; } } } } else { throw new CHttpException(404, "Yikes , You forgot to pass in the Account ID"); } }