Created
January 28, 2016 13:52
-
-
Save iqbalmalik89/2a099293cf3443bd4c3e to your computer and use it in GitHub Desktop.
Patch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function getHeading($headingCode) | |
{ | |
$data = file_get_contents('https://www.gov.uk/trade-tariff/headings/'.$headingCode.'.json'); | |
// $data = file_get_contents('http://localhost/widget/public/'.$headingCode.'.json'); | |
if(!empty($data)) | |
{ | |
$data = json_decode($data, true); | |
// echo $this->makeTree(0, $data['commodities']); | |
// $r = $this->makeRecursive($data['commodities']); | |
// echo "<pre>"; | |
// print_r($r); | |
if(isset($data['commodities'])) | |
{ | |
$navarray = $this->GenerateNavArray($data['commodities']); | |
return $this->GenerateNavHTML($navarray); | |
} | |
else | |
{ | |
$completeCmmodityCode = $data['goods_nomenclature_item_id']; | |
$commodity1 = substr($completeCmmodityCode, 0, 2); | |
$commodity2 = substr($completeCmmodityCode, 2, 2); | |
$commodity3 = substr($completeCmmodityCode, 4); | |
$planCommodityCode = $commodity1.' '.$commodity2.' '.$commodity3; | |
$copyCode = '<a style="cursor:pointer;" data-clipboard-text="'. $planCommodityCode .'">Copy</a>'; | |
$commodityCode = '<div style="float:right;"><span class="label label-info">'.$commodity1.'</span> | |
<span class="label label-primary">'.$commodity2.'</span> | |
<span class="label label-success">'.$commodity3.'</span> | |
'.$copyCode.' | |
</div>'; | |
return $inner = '<ul><li style="display:none; margin-left:10px;"><a onclick="getCommodityCode(\'' . $planCommodityCode . '\');" class="checker" href="javascript:void(0);">' . $data['description'] .$commodityCode. '</a></li></ul>'; | |
} | |
} | |
else | |
{ | |
return false; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment