Subversion Repositories Integrator Subversion

Rev

Blame | Last modification | View Log | Download | RSS feed

  <?php
  /*
   * Paging
   */


  //var_dump($_POST["selected"]);
 
  $iTotalRecords = 120;
  $iDisplayLength = intval($_REQUEST['length']);
  $iDisplayLength = $iDisplayLength < 0 ? $iTotalRecords : $iDisplayLength;
  $iDisplayStart = intval($_REQUEST['start']);
  $sEcho = intval($_REQUEST['draw']);
 
  $records = array();
  $records["data"] = array();

  $end = $iDisplayStart + $iDisplayLength;
  $end = $end > $iTotalRecords ? $iTotalRecords : $end;

  $status_list = array(
    array("info" => "Pending"),
    array("success" => "Notified"),
    array("danger" => "Failed")
  );

  for($i = $iDisplayStart; $i < $end; $i++) {
    $status = $status_list[rand(0, 2)];
    $records["data"][] = array(
      '12/09/2013 09:20:45',
      'Shipment #1231231232 has been created',    
      '<span class="label label-sm label-'.(key($status)).'">'.(current($status)).' <i class="fa fa-check"></i></span>',
      '<a href="#" class="btn btn-sm btn-default btn-editable"><i class="fa fa-search"></i> View</a>'
    );
  }

  if (isset($_REQUEST["customActionType"]) && $_REQUEST["customActionType"] == "group_action") {
    $records["customActionStatus"] = "OK"; // pass custom message(useful for getting status of group actions)
    $records["customActionMessage"] = "Group action successfully has been completed. Well done!"; // pass custom message(useful for getting status of group actions)
  }

  $records["draw"] = $sEcho;
  $records["recordsTotal"] = $iTotalRecords;
  $records["recordsFiltered"] = $iTotalRecords;

  // check http://datatables.net/usage/server-side for more info about ajax datatable
 
  echo json_encode($records);
?>