mercredi 25 février 2015

Gravity Forms Custom Addon Pagination Issue


Good Morning,


I am writing a custom addon for Gravity Forms 1.9 and it uses the the API get_entries method as written below



$sorting = array( );
$paging = array('offset' => 0, 'page_size' => 25 );

$search_criteria = array();

$entries = GFAPI::get_entries($form, $search_criteria, $sorting, $paging);


I see that it includes a $paging option but it's my understanding that this acts as a limit for returned values.



if ( $user_role === 'administrator' || $user_role === 'staff') {
$row = 1;
foreach ($entries as $entry) {

$status = $entry['9'];
if($status !== 'Closed') {

if ($row % 2 == 0) {

?>
<tr class="evenRow"><td class="ticketID"> <?php echo $entry['id']; ?> </td><td class="ticketDate"><?php echo$entry['5']; ?></td> <td class="ticketSubject"> <?php echo $entry['10']; ?> </td> <td class="ticketResponse"><a href="../tickets?entry=<?php echo $entry['id'] ?>">Respond</a></td> </tr>
<?php
} else {
?>
<tr class="oddRow"><td class="ticketID"> <?php echo $entry['id']; ?> </td><td class="ticketDate"><?php echo$entry['5']; ?></td> <td class="ticketSubject"> <?php echo $entry['10']; ?> </td> <td class="ticketResponse"><a href="../tickets?entry=<?php echo $entry['id'] ?>">Respond</a></td> </tr>
<?php
}
$row++;

}
}
} else {?>
<tr class="oddRow center"><td colspan="3" style="text-align:center;">No entries found for this campaign</td> </tr>
<?php
}

} else {
echo "No entries to be reviewed at this time";
}
?>


I would ideally like to include pagination in my addon as it returns a list of Support Tickets but I am not strong enough in PHP to implement examples I have come across.





Aucun commentaire:

Enregistrer un commentaire