Example #1
0
function returnresult($object, $getmoresubinfo, $getallinvestor)
{
    $objlength = sizeof($object);
    $idsub = 'id_sub';
    for ($i = 0; $i < $objlength; $i++) {
        //push more sub info
        $tmp = array();
        for ($j = 0; $j < sizeof($object[$i][1]); $j++) {
            /*
             *	Lấy thông tin investor
             */
            $ids = $object[$i][1][$j]->{$idsub};
            $keys = 'idsub_' . $ids;
            $inskey = 'insinfo';
            if (isset($getmoresubinfo[$keys])) {
                $id_investor = $getmoresubinfo[$keys];
                $id_investor = 'idins_' . $id_investor;
                if (isset($getallinvestor[$id_investor])) {
                    $object[$i][1][$j]->{$inskey} = $getallinvestor[$id_investor];
                } else {
                    $object[$i][1][$j]->{$inskey} = '';
                }
            } else {
                $object[$i][1][$j]->{$inskey} = '';
            }
            /*
             *	Lấy thông tin hs
             */
            $hskey = 'hoso';
            $object[$i][1][$j]->{$hskey} = getdocs_in_a_sub($ids);
        }
    }
    return $object;
}
function returnresult($object, $getmoresubinfo, $getallinvestor)
{
    $objlength = sizeof($object);
    $idsub = 'id_sub';
    foreach ($object as $key => $value) {
        //echo '<pre>'; print_r($value); exit();
        $tmp = array();
        //for ($j=0; $j<sizeof($value['data']); $j++){
        foreach ($value['data'] as $keysub => $valuesub) {
            /*
             *	Lấy thông tin investor
             */
            //echo '<pre>'; print_r($valuesub); exit();
            $ids = $valuesub->{'id_sub'};
            $keys = 'idsub_' . $ids;
            $inskey = 'insinfo';
            if (isset($getmoresubinfo[$keys])) {
                $id_investor = $getmoresubinfo[$keys];
                $id_investor = 'idins_' . $id_investor;
                if (isset($getallinvestor[$id_investor])) {
                    $valuesub->{$inskey} = $getallinvestor[$id_investor];
                } else {
                    $valuesub->{$inskey} = '';
                }
            } else {
                $valuesub->{$inskey} = '';
            }
            /*
             *	Lấy thông tin hs
             */
            $hskey = 'hoso';
            $valuesub->{$hskey} = getdocs_in_a_sub($ids);
        }
    }
    // for ($i=0; $i< $objlength; $i++){
    // 	//push more sub info
    // 	$tmp = array();
    // 	for ($j=0; $j<sizeof($object[$i][1]); $j++){
    // 		/*
    // 		*	Lấy thông tin investor
    // 		*/
    // 		$ids = $object[$i][1][$j] ->$idsub;
    // 		$keys = 'idsub_'.$ids; $inskey = 'insinfo';
    // 		if (isset($getmoresubinfo[$keys])){
    // 			$id_investor = $getmoresubinfo[$keys];
    // 			$id_investor = 'idins_'.$id_investor;
    // 			if (isset($getallinvestor[$id_investor])){
    // 				$object[$i][1][$j] ->$inskey = $getallinvestor[$id_investor];
    // 			} else {$object[$i][1][$j] ->$inskey ='';}
    // 		} else {$object[$i][1][$j] ->$inskey ='';}
    // 		/*
    // 		*	Lấy thông tin hs
    // 		*/
    // 		$hskey = 'hoso';
    // 		$object[$i][1][$j] ->$hskey = getdocs_in_a_sub($ids);
    // 	}
    // }
    return $object;
}