1

I'm trying to query on statements stored in Learning Locker using TinCanPHP but I want to retrieve only the statements generated in a specific interval of time. For example, I want all the statements generated today.

How can I do it?

Peter Rubi
  • 119
  • 1
  • 12

1 Answers1

1

Try this:

$LRSResponse = $LRS->queryStatements(['since' => '2016-11-15', 'ascending' => false]); // change to 'true', or omit, for ascending dates
$StatementsResult = $LRSResponse->content;
$array_of_Statement_objects = $StatementsResult->getStatements();
foreach ($array_of_Statement_objects as $extracted_Statement_object){
// deal with statements as necessary
}
unset($extracted_Statement_object);
Grant_Bailey
  • 308
  • 1
  • 2
  • 13
  • 1
    To limit to a single day (not today) you would have to also include the `until` parameter, and there shouldn't be a reason to include the `ascending` flag unless you want them in that order. Note that this is the `stored` order of the statements *not* the `timestamp` order. – Brian J. Miller Nov 15 '16 at 13:54
  • Thanks, It works, but the time has to be indicated in the same format as the timestamp. It would be `$LRSResponse = $lrs->queryStatements(['since' => '2016-11-14T20:19:08+01:00', 'ascending' => false]);` – Peter Rubi Nov 16 '16 at 17:19