Содержание

XML

  <function name="rpcf_blocks_report" id="0x3004">
      <input>
       <integer name="user_id" default="0" />
       <integer name="account_id" default="0" />
       <integer name="group_id" default="0" />
       <integer name="apid" default="0" />
       <integer name="time_start" />
       <integer name="time_end" default="now()" />
       <integer name="show_all" default="1" />
      </input>
      <output>
       <integer name="accounts_count" />
       <for name="i" from="0" count="accounts_count">
        <integer name="atr_size"/>
           <set dst="atr_size_array" src="atr_size" dst_index="i" />
        <for name="j" from="0" count="atr_size">
          <integer name="account_id" array_index="i,j" />
          <string name="login" array_index="i,j" />
          <integer name="start_date" array_index="i,j" />
          <integer name="expire_date" array_index="i,j" />
          <integer name="what_blocked" array_index="i,j" />
          <integer name="block_type" array_index="i,j" />
          <string name="comment" array_index="i,j" />
        </for>
       </for>
      </output>
  </function>

PHP

  function rpcf_blocks_report($user_id,$account_id,$group_id,$apid,$time_start,$time_end,$show_all=1){ //"0x3004
    if (!$this->connection->urfa_call(0x3004)) {
	print "Error calling function ". __FUNCTION__ ."\n";
	return FALSE;
    }
    $packet = $this->connection->getPacket();
    $packet->DataSetInt($user_id);
    $packet->DataSetInt($account_id);
    $packet->DataSetInt($group_id);
    $packet->DataSetInt($apid);
    $packet->DataSetInt($time_start);
    $packet->DataSetInt($time_end);
    $packet->DataSetInt($show_all);
    $this->connection->urfa_send_param($packet);
 
    $ret=array();
    if ($x = $this->connection->urfa_get_data()) {
      $accounts_count=$x->DataGetInt();
      $ret['accounts_count']=$accounts_count;
      $account=array();
      for ($i=0; $i<$accounts_count; $i++) {
	//$x = $this->connection->urfa_get_data();
	$atr_size=$x->DataGetInt();
	$account['atr_size']=$atr_size;
	$blocks_report=array();
	for( $j=0; $j<$atr_size; $j++ ) {
	  //$x = $this->connection->urfa_get_data();
	  $blocks_report['account_id']	=$x->DataGetInt();
	  $blocks_report['login']	=$x->DataGetString();
	  $blocks_report['start_date']	=$x->DataGetInt();
	  $blocks_report['expire_date']	=$x->DataGetInt();
	  $blocks_report['what_blocked']=$x->DataGetInt();
	  $blocks_report['block_type']	=$x->DataGetInt();
	  $blocks_report['comment']	=$x->DataGetString();
	  $account['blocks_report'][$j]=$blocks_report;
	}
	$ret['account'][$i]=$account;
      }
      //$x = $this->connection->urfa_get_data();
    }
    return $ret;
  }

EXAMPLE

$s='';
try {
  $urfa_admin = new URFAClient_Admin(UTM5_login,UTM5_passwd);
  $report=$urfa_admin->rpcf_blocks_report($_SESSION['URFA']['user_id'],0,0,0,strtotime("-2 month"),strtotime("+1 day"),1);
} catch (Exception $exception) {
  echo "Error in line ", $exception->getLine();
  echo $exception->getMessage();
}
$cnt=$report['accounts_count'];
for ($i=0; $i<$cnt; $i++) {
  $account=$report['account'][$i];
  $atr_size=$account['atr_size'];
  if (0==$atr_size) {
    $s.='<h4>Отчёт о блокировках</h4>';
    $s.='<table class=nfo_wide>';
    $s.='<tr><th align=center>Дата</th><th align=center>Причина блокировки</th></tr>';
    $s.='<tr class=even>';
    $s.='<td class=date>'.date("d.m.Y H:i",time()).'</td>';
    $s.='<td class=money align=right>Блокировок не было</td>';
    $s.='</tr>';
  } else {
    $s.='<h4>Блокировки лицевого счёта '.($account['blocks_report']['0']['account_id']).'</h4>';
    $s.='<table class=nfo_wide>';
    $s.='<tr><th align=center>Заблокирован</th><th align=center>Разблокирован</th><th align=center>Причина блокировки</th></tr>';
    for ($j=$atr_size-1;$j>=0;$j--) {
      $r=$account['blocks_report'][$j];
      $start_date	=$r['start_date'];
      $expire_date	=$r['expire_date'];
      $block_type	=(1==$r['block_type'])?'Отрицательный баланс':'Заблокирован администратором';
      $s.='<tr class='.((($i % 10)>=5)?'even':'odd').'>';
      $s.='<td class=date_block>'.date("d.m.Y H:i",$start_date).'</td>';
      $s.='<td class=date_block>'.((2000000000==$expire_date)?'':date("d.m.Y H:i",$expire_date)).'</td>';
      $s.="<td class=block_reason>$block_type</td>";
      $s.='</tr>';
    }
  }
  $s.='</table>';
}
 
/home/u18456/wiki.flintnet.ru/www/data/pages/function_admin/function_name_rpcf_blocks_report_id_0x3004.txt · Последние изменения: 2011/08/16 13:14 От 46.151.85.50
 
За исключением случаев, когда указано иное, содержимое этой вики предоставляется на условиях следующей лицензии:CC Attribution-Noncommercial-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki