AlexandrKerch
5/4/2018 - 3:00 PM

task.item.list.json

<?php
$i = 1;
$result = array();
function GetTask($i,$result){	
	$appParams = array(
		"ORDER" => array("RESPONSIBLE_ID" => "desc"),
		"FILTER" => array("REAL_STATUS" => 3),
		"PARAMS" => array(     	
			'NAV_PARAMS' => array(
				"nPageSize" => 50, 
				'iNumPage' => $i
			)
		),     
		"SELECT" => array(
			"RESPONSIBLE_NAME",
			"RESPONSIBLE_LAST_NAME",
			"RESPONSIBLE_SECOND_NAME",
		)         
	);
	$appRequestUrl = 'https://profmoscow.bitrix24.ru/rest/132/q4xcj2a9fmbmt96q/task.item.list.json?'.http_build_query($appParams);
	$arrContextOptions=array(
		"ssl"=>array(
			"verify_peer"=>false,
			"verify_peer_name"=>false,
		),
	);  

	$response = file_get_contents(urldecode($appRequestUrl), false, stream_context_create($arrContextOptions));
	$json_array = json_decode($response, true);	
	$result[] = $json_array;
	if(isset($json_array['next'])){
		$i++;			
		return GetTask($i,$result);
	}else{		
		return $result;	
	}	
}

$out = GetTask($i,$result);
$res = array();
$n = 0;
foreach($out as $val){
	foreach($val['result'] as $key => $v){
		$fio = $v['RESPONSIBLE_LAST_NAME'] . ' ' . $v['RESPONSIBLE_NAME'] . ' ' . $v['RESPONSIBLE_SECOND_NAME'];
		$res[$fio][$n]['RESPONSIBLE_NAME'] = $v['RESPONSIBLE_NAME']; 
		$res[$fio][$n]['RESPONSIBLE_LAST_NAME'] = $v['RESPONSIBLE_LAST_NAME']; 
		$res[$fio][$n]['RESPONSIBLE_SECOND_NAME'] = $v['RESPONSIBLE_SECOND_NAME'];
		$n++;
	}	
}
echo '<table>';
foreach($res as $k => $r){
	echo '<tr>';		
		echo '<td>';
		echo $k;
		echo '</td>';		
		echo '<td>';
		echo count($r);
		echo '</td>';
	echo '</tr>';
}
echo '</table>';
?>