5 include_once
'./Modules/DataCollection/classes/class.ilDataCollectionStandardField.php';
6 include_once
'./Modules/DataCollection/classes/class.ilDataCollectionRecord.php';
135 $query =
"SELECT * FROM il_dcl_table WHERE id = " . $ilDB->quote($this->
getId(),
"integer");
136 $set = $ilDB->query(
$query);
137 $rec = $ilDB->fetchAssoc($set);
165 public function doDelete($delete_main_table =
false) {
180 $exec_delete =
false;
181 if ($delete_main_table) {
188 $query =
"DELETE FROM il_dcl_table WHERE id = " . $ilDB->quote($this->
getId(),
"integer");
189 $ilDB->manipulate(
$query);
192 $set = $ilDB->query(
'SELECT * FROM il_dcl_view WHERE table_id = ' . $ilDB->quote($this->getId(),
'integer'));
194 while (
$row = $ilDB->fetchObject($set)) {
195 $view_ids[] =
$row->id;
197 if (count($view_ids)) {
198 $ilDB->manipulate(
"DELETE FROM il_dcl_viewdefinition WHERE view_id IN (" . implode(
',', $view_ids) .
")");
200 $ilDB->manipulate(
"DELETE FROM il_dcl_view WHERE table_id = " . $ilDB->quote($this->getId(),
'integer'));
211 $id = $ilDB->nextId(
"il_dcl_table");
213 $query =
"INSERT INTO il_dcl_table (" .
"id" .
", obj_id" .
", title" .
", add_perm" .
", edit_perm" .
", delete_perm" .
", edit_by_owner"
214 .
", limited" .
", limit_start" .
", limit_end" .
", is_visible" .
", export_enabled" .
", default_sort_field_id"
215 .
", default_sort_field_order" .
", description" .
", public_comments" .
", view_own_records_perm" .
" ) VALUES ("
216 . $ilDB->quote($this->
getId(),
"integer") .
"," . $ilDB->quote($this->
getObjId(),
"integer") .
","
217 . $ilDB->quote($this->
getTitle(),
"text") .
"," . $ilDB->quote($this->
getAddPerm() ? 1 : 0,
"integer") .
","
218 . $ilDB->quote($this->
getEditPerm() ? 1 : 0,
"integer") .
"," . $ilDB->quote($this->
getDeletePerm() ? 1 : 0,
"integer") .
","
219 . $ilDB->quote($this->
getEditByOwner() ? 1 : 0,
"integer") .
"," . $ilDB->quote($this->
getLimited() ? 1 : 0,
"integer") .
","
226 $ilDB->manipulate(
$query);
230 $view_id = $ilDB->nextId(
"il_dcl_view");
231 $query =
"INSERT INTO il_dcl_view (id, table_id, type, formtype) VALUES (" . $ilDB->quote($view_id,
"integer") .
", "
233 . $ilDB->quote(1,
"integer") .
")";
234 $ilDB->manipulate(
$query);
237 $view_id = $ilDB->nextId(
"il_dcl_view");
238 $query =
"INSERT INTO il_dcl_view (id, table_id, type, formtype) VALUES (" . $ilDB->quote($view_id,
"integer") .
", "
240 . $ilDB->quote(1,
"integer") .
")";
241 $ilDB->manipulate(
$query);
244 $view_id = $ilDB->nextId(
"il_dcl_view");
245 $query =
"INSERT INTO il_dcl_view (id, table_id, type, formtype) VALUES (" . $ilDB->quote($view_id,
"integer") .
", "
247 . $ilDB->quote(1,
"integer") .
")";
248 $ilDB->manipulate(
$query);
251 $view_id = $ilDB->nextId(
"il_dcl_view");
252 $query =
"INSERT INTO il_dcl_view (id, table_id, type, formtype) VALUES (" . $ilDB->quote($view_id,
"integer") .
", "
254 . $ilDB->quote(1,
"integer") .
")";
255 $ilDB->manipulate(
$query);
268 $ilDB->update(
"il_dcl_table", array(
269 "obj_id" => array(
"integer", $this->
getObjId() ),
270 "title" => array(
"text", $this->
getTitle() ),
271 "add_perm" => array(
"integer", $this->
getAddPerm() ),
272 "edit_perm" => array(
"integer", $this->
getEditPerm() ),
275 "limited" => array(
"integer", $this->
getLimited() ),
276 "limit_start" => array(
"timestamp", $this->
getLimitStart() ),
277 "limit_end" => array(
"timestamp", $this->
getLimitEnd() ),
278 "is_visible" => array(
"integer", $this->
getIsVisible() ? 1 : 0 ),
286 "id" => array(
"integer", $this->
getId() )
315 $this->objId = $a_id;
331 $this->title = $a_title;
354 if ($this->obj == NULL) {
384 if (! count($filter)) {
389 if ($record->passThroughFilter($filter)) {
390 $filtered[] = $record;
399 if ($this->records == NULL) {
403 $query =
"SELECT id FROM il_dcl_record WHERE table_id = " . $ilDB->quote($this->
id,
"integer");
404 $set = $ilDB->query(
$query);
406 while ($rec = $ilDB->fetchAssoc($set)) {
424 $query =
"SELECT * FROM il_dcl_table WHERE obj_id = " . $ilDB->quote($a_id,
"integer");
425 $set = $ilDB->query(
$query);
428 while ($rec = $ilDB->fetchAssoc($set)) {
429 $all[$rec[
'id']] = $rec;
444 $record->deleteField($field_id);
459 foreach (
$fields as $field_1) {
460 if ($field_1->getId() == $field_id) {
478 if ($this->
fields == NULL) {
481 $query =
"SELECT DISTINCT field.* FROM il_dcl_field AS field
482 INNER JOIN il_dcl_view AS view ON view.table_id = field.table_id
483 INNER JOIN il_dcl_viewdefinition AS def ON def.view_id = view.id
484 WHERE field.table_id =" . $ilDB->quote($this->
getId(),
"integer") .
"
485 ORDER BY def.field_order DESC";
487 $set = $ilDB->query(
$query);
489 while ($rec = $ilDB->fetchAssoc($set)) {
491 $fields[$field->getId()] = $field;
508 if (! $field->isStandardField()) {
509 $place = $field->getOrder() + 1;
524 $this->stdFields = $this->getStandardFields();
537 public function getFieldsForFormula() {
538 $unsupported = array(
550 $return = $this->getStandardFields();
554 foreach ($this->
fields as $field) {
555 if (! in_array($field->getDatatypeId(), $unsupported)) {
569 public function getStandardFields() {
570 if ($this->stdFields == NULL) {
575 foreach ($this->stdFields as $k => $field) {
576 if ($field->getId() ==
'comments') {
577 unset($this->stdFields[$k]);
608 $visibleFields = array();
611 if ($field->isVisible()) {
612 $visibleFields[] = $field;
616 return $visibleFields;
625 $editableFields = array();
628 if (! $field->getLocked()) {
629 $editableFields[] = $field;
633 return $editableFields;
645 $filterableFields = array();
648 if ($field->isFilterable()) {
649 $filterableFields[] = $field;
653 return $filterableFields;
664 $exportableFields = array();
666 if ($field->getExportable()) {
667 $exportableFields[] = $field;
671 return $exportableFields;
785 public function hasPermissionToViewRecord(
$ref_id, $record) {
812 return ($ilUser->getId() == $record->
getOwner());
824 return ($from <= $now && $now <= $to);
851 $named[$field->getId()] = $field;
863 usort($array, array( $this,
"compareOrder" ));
877 if (! is_null($field->getOrder())) {
878 $field->setOrder($count);
879 $count = $count + $offset;
896 if ($field->getTitle() ==
$title) {
1109 $this->view_own_records_perm = (int)$view_own_perm;
1129 return (count($this->
fields) > 0) ?
true :
false;
1134 if (is_null($a->getOrder() == NULL) && is_null($b->getOrder() == NULL)) {
1137 if (is_null($a->getOrder())) {
1140 if (is_null($b->getOrder())) {
1144 return $a->getOrder() < $b->getOrder() ? - 1 : 1;
1172 $org_std_fields = $original->getStandardFields();
1173 foreach ($this->getStandardFields() as $element_key => $std_field) {
1181 $new_fields = array();
1182 foreach ($original->
getFields() as $orig_field) {
1183 if (! $orig_field->isStandardField()) {
1185 $new_field->setTableId($this->
getId());
1186 $new_field->cloneStructure($orig_field->getId());
1187 $new_fields[$orig_field->getId()] = $new_field;
1208 $old_view->setTableId($original->
getId());
1210 $viewdef->setTableId($this->
id);
1211 $viewdef->setXMLContent($old_view->getXMLContent(
false));
1223 return (count($this->
getRecords()) > 0) ?
true :
false;
1231 $this->
fields[$field->getId()] = $field;
1242 $query =
"SELECT * FROM il_dcl_table WHERE id = " . $table_id;
1245 return $result->numRows() != 0;
1257 $result = $ilDB->query(
'SELECT id FROM il_dcl_table WHERE title = ' . $ilDB->quote(
$title,
'text') .
' AND obj_id = '
1258 . $ilDB->quote($obj_id,
'integer'));
1260 while ($rec = $ilDB->fetchAssoc(
$result)) {
1294 $result = $ilDB->query(
'SELECT * FROM il_dcl_field WHERE table_id = ' . $ilDB->quote($obj_id,
'integer') .
' AND title = '
1295 . $ilDB->quote(
$title,
'text'));
1297 return ($ilDB->numRows(
$result)) ?
true :
false;
1316 $direction = strtolower($direction);
1317 $direction = (in_array($direction, array(
'desc',
'asc' ))) ? $direction :
'asc';
1320 $sort_by_status =
false;
1321 if (substr($sort, 0, 8) ==
'_status_') {
1322 $sort_by_status =
true;
1326 if (is_null($sort_field)) {
1327 $sort_field = $this->
getField(
'id');
1330 $id = $sort_field->getId();
1331 $stl = $sort_field->getStorageLocation();
1334 $where_additions =
'';
1337 if ($sort_field->isStandardField()) {
1338 if (
$id ==
'owner' ||
$id ==
'last_edit_by') {
1339 $join_str .=
"LEFT JOIN usr_data AS sort_usr_data_{$id} ON (sort_usr_data_{$id}.usr_id = record.{$id})";
1340 $select_str .=
" sort_usr_data_{$id}.login AS field_{$id},";
1341 } elseif (
$id !=
'comments') {
1342 $select_str .=
" record.{$id} AS field_{$id},";
1345 switch ($sort_field->getDatatypeId()) {
1347 $rating_joined =
true;
1349 $join_str .=
"LEFT JOIN (SELECT (ROUND(AVG(rating), 1) * 10000 + COUNT(rating)) as rating, obj_id FROM il_rating GROUP BY obj_id) AS average ON average.obj_id = record.id";
1350 $select_str .=
" average.rating AS field_{$id},";
1354 "LEFT JOIN il_dcl_record_field AS sort_record_field_{$id} ON (sort_record_field_{$id}.record_id = record.id AND sort_record_field_{$id}.field_id = "
1355 . $ilDB->quote($sort_field->getId(),
'integer') .
") ";
1356 $join_str .=
"LEFT JOIN il_dcl_stloc{$stl}_value AS sort_stloc_{$id} ON (sort_stloc_{$id}.record_field_id = sort_record_field_{$id}.id) ";
1357 $join_str .=
"LEFT JOIN object_reference AS sort_object_reference_{$id} ON (sort_object_reference_{$id}.ref_id = sort_stloc_{$id}.value AND sort_object_reference_{$id}.deleted IS NULL)";
1358 $join_str .=
"LEFT JOIN object_data AS sort_object_data_{$id} ON (sort_object_data_{$id}.obj_id = sort_object_reference_{$id}.obj_id)";
1359 if ($sort_by_status) {
1361 $join_str .=
"LEFT JOIN ut_lp_marks AS ut ON (ut.obj_id = sort_object_data_{$id}.obj_id AND ut.usr_id = "
1362 . $ilDB->quote($ilUser->getId(),
'integer') .
") ";
1364 $select_str .= (! $sort_by_status) ?
" sort_object_data_{$id}.title AS field_{$id}," :
" ut.status AS field_{$id}";
1369 "LEFT JOIN il_dcl_record_field AS sort_record_field_{$id} ON (sort_record_field_{$id}.record_id = record.id AND sort_record_field_{$id}.field_id = "
1370 . $ilDB->quote($sort_field->getId(),
'integer') .
") ";
1371 $join_str .=
"LEFT JOIN il_dcl_stloc{$stl}_value AS sort_stloc_{$id} ON (sort_stloc_{$id}.record_field_id = sort_record_field_{$id}.id) ";
1372 $join_str .=
"LEFT JOIN object_data AS sort_object_data_{$id} ON (sort_object_data_{$id}.obj_id = sort_stloc_{$id}.value) ";
1373 $select_str .=
" sort_object_data_{$id}.title AS field_{$id},";
1376 $prop = $sort_field->getPropertyvalues();
1382 $select_str .= ($n_ref) ?
" GROUP_CONCAT(stloc_{$id}_joined.value) AS field_{$id}" :
"stloc_{$id}_joined.value AS field_{$id},";
1384 "LEFT JOIN il_dcl_record_field AS record_field_{$id} ON (record_field_{$id}.record_id = record.id AND record_field_{$id}.field_id = "
1385 . $ilDB->quote($sort_field->getId(),
'integer') .
") ";
1386 $join_str .=
"LEFT JOIN il_dcl_stloc{$stl}_value AS stloc_{$id} ON (stloc_{$id}.record_field_id = record_field_{$id}.id) ";
1388 "LEFT JOIN il_dcl_record_field AS record_field_{$id}_joined ON (record_field_{$id}_joined.record_id = stloc_{$id}.value AND record_field_{$id}_joined.field_id = "
1389 . $ilDB->quote($ref_field->getId(),
'integer') .
") ";
1390 $join_str .=
"LEFT JOIN il_dcl_stloc{$ref_field->getStorageLocation()}_value AS stloc_{$id}_joined ON (stloc_{$id}_joined.record_field_id = record_field_{$id}_joined.id) ";
1396 $select_str .=
" sort_stloc_{$id}.value AS field_{$id},";
1398 "LEFT JOIN il_dcl_record_field AS sort_record_field_{$id} ON (sort_record_field_{$id}.record_id = record.id AND sort_record_field_{$id}.field_id = "
1399 . $ilDB->quote($sort_field->getId(),
'integer') .
") ";
1400 $join_str .=
"LEFT JOIN il_dcl_stloc{$stl}_value AS sort_stloc_{$id} ON (sort_stloc_{$id}.record_field_id = sort_record_field_{$id}.id) ";
1405 if (count($filter)) {
1406 foreach ($filter as $key => $filter_value) {
1407 $filter_field_id = substr($key, 7);
1408 $filter_field = $this->
getField($filter_field_id);
1409 switch ($filter_field->getDatatypeId()) {
1411 if(!$rating_joined) {
1412 $join_str .=
"LEFT JOIN (SELECT (ROUND(AVG(rating), 1) * 10000 + COUNT(rating)) as rating, obj_id FROM il_rating GROUP BY obj_id) AS average ON average.obj_id = record.id";
1415 $where_additions .=
" AND average.rating >= " . $ilDB->quote($filter_value * 10000,
'integer');
1419 "INNER JOIN il_dcl_record_field AS filter_record_field_{$filter_field_id} ON (filter_record_field_{$filter_field_id}.record_id = record.id AND filter_record_field_{$filter_field_id}.field_id = "
1420 . $ilDB->quote($filter_field_id,
'integer') .
") ";
1421 $join_str .=
"INNER JOIN il_dcl_stloc{$filter_field->getStorageLocation()}_value AS filter_stloc_{$filter_field_id} ON (filter_stloc_{$filter_field_id}.record_field_id = filter_record_field_{$filter_field_id}.id) ";
1422 $join_str .=
"INNER JOIN object_reference AS filter_object_reference_{$filter_field_id} ON (filter_object_reference_{$filter_field_id}.ref_id = filter_stloc_{$filter_field_id}.value ) ";
1424 "INNER JOIN object_data AS filter_object_data_{$filter_field_id} ON (filter_object_data_{$filter_field_id}.obj_id = filter_object_reference_{$filter_field_id}.obj_id AND filter_object_data_{$filter_field_id}.title LIKE "
1425 . $ilDB->quote(
"%$filter_value%",
'text') .
") ";
1430 "INNER JOIN il_dcl_record_field AS filter_record_field_{$filter_field_id} ON (filter_record_field_{$filter_field_id}.record_id = record.id AND filter_record_field_{$filter_field_id}.field_id = "
1431 . $ilDB->quote($filter_field_id,
'integer') .
") ";
1432 $join_str .=
"INNER JOIN il_dcl_stloc{$filter_field->getStorageLocation()}_value AS filter_stloc_{$filter_field_id} ON (filter_stloc_{$filter_field_id}.record_field_id = filter_record_field_{$filter_field_id}.id) ";
1434 "INNER JOIN object_data AS filter_object_data_{$filter_field_id} ON (filter_object_data_{$filter_field_id}.obj_id = filter_stloc_{$filter_field_id}.value AND filter_object_data_{$filter_field_id}.title LIKE "
1435 . $ilDB->quote(
"%$filter_value%",
'text') .
") ";
1438 $date_from = (isset($filter_value[
'from']) && is_object($filter_value[
'from'])) ? $filter_value[
'from'] : NULL;
1439 $date_to = (isset($filter_value[
'to']) && is_object($filter_value[
'to'])) ? $filter_value[
'to'] : NULL;
1440 if ($filter_field->isStandardField()) {
1442 $where_additions .=
" AND (record.{$filter_field_id} >= " . $ilDB->quote($date_from,
'date') .
")";
1445 $where_additions .=
" AND (record.{$filter_field_id} <= " . $ilDB->quote($date_to,
'date') .
")";
1449 "INNER JOIN il_dcl_record_field AS filter_record_field_{$filter_field_id} ON (filter_record_field_{$filter_field_id}.record_id = record.id AND filter_record_field_{$filter_field_id}.field_id = "
1450 . $ilDB->quote($filter_field_id,
'integer') .
") ";
1451 $join_str .=
"INNER JOIN il_dcl_stloc{$filter_field->getStorageLocation()}_value AS filter_stloc_{$filter_field_id} ON (filter_stloc_{$filter_field_id}.record_field_id = filter_record_field_{$filter_field_id}.id ";
1453 $join_str .=
"AND filter_stloc_{$filter_field_id}.value >= " . $ilDB->quote($date_from,
'date') .
" ";
1456 $join_str .=
"AND filter_stloc_{$filter_field_id}.value <= " . $ilDB->quote($date_to,
'date') .
" ";
1462 $from = (isset($filter_value[
'from'])) ? (
int)$filter_value[
'from'] : NULL;
1463 $to = (isset($filter_value[
'to'])) ? (
int)$filter_value[
'to'] : NULL;
1464 if ($filter_field->isStandardField()) {
1465 if (! is_null($from)) {
1466 $where_additions .=
" AND record.{$filter_field_id} >= " . $ilDB->quote($from,
'integer');
1468 if (! is_null($to)) {
1469 $where_additions .=
" AND record.{$filter_field_id} <= " . $ilDB->quote($to,
'integer');
1473 "INNER JOIN il_dcl_record_field AS filter_record_field_{$filter_field_id} ON (filter_record_field_{$filter_field_id}.record_id = record.id AND filter_record_field_{$filter_field_id}.field_id = "
1474 . $ilDB->quote($filter_field_id,
'integer') .
") ";
1475 $join_str .=
"INNER JOIN il_dcl_stloc{$filter_field->getStorageLocation()}_value AS filter_stloc_{$filter_field_id} ON (filter_stloc_{$filter_field_id}.record_field_id = filter_record_field_{$filter_field_id}.id";
1476 if (! is_null($from)) {
1477 $join_str .=
" AND filter_stloc_{$filter_field_id}.value >= " . $ilDB->quote($from,
'integer');
1479 if (! is_null($to)) {
1480 $join_str .=
" AND filter_stloc_{$filter_field_id}.value <= " . $ilDB->quote($to,
'integer');
1486 if ($filter_value ==
"checked") {
1488 "INNER JOIN il_dcl_record_field AS filter_record_field_{$filter_field_id} ON (filter_record_field_{$filter_field_id}.record_id = record.id AND filter_record_field_{$filter_field_id}.field_id = "
1489 . $ilDB->quote($filter_field_id,
'integer') .
") ";
1490 $join_str .=
"INNER JOIN il_dcl_stloc{$filter_field->getStorageLocation()}_value AS filter_stloc_{$filter_field_id} ON (filter_stloc_{$filter_field_id}.record_field_id = filter_record_field_{$filter_field_id}.id";
1491 $join_str .=
" AND filter_stloc_{$filter_field_id}.value = " . $ilDB->quote(1,
'integer');
1494 "INNER JOIN il_dcl_record_field AS filter_record_field_{$filter_field_id} ON (filter_record_field_{$filter_field_id}.record_id = record.id AND filter_record_field_{$filter_field_id}.field_id = "
1495 . $ilDB->quote($filter_field_id,
'integer') .
") ";
1496 $join_str .=
"LEFT JOIN il_dcl_stloc{$filter_field->getStorageLocation()}_value AS filter_stloc_{$filter_field_id} ON (filter_stloc_{$filter_field_id}.record_field_id = filter_record_field_{$filter_field_id}.id";
1497 $where_additions .=
" AND (filter_stloc_{$filter_field_id}.value <> " . $ilDB->quote(1,
'integer')
1498 .
" OR filter_stloc_{$filter_field_id}.value is NULL)";
1503 if ($filter_field->isStandardField()) {
1505 "INNER JOIN usr_data AS filter_usr_data_{$filter_field_id} ON (filter_usr_data_{$filter_field_id}.usr_id = record.{$filter_field_id} AND filter_usr_data_{$filter_field_id}.login LIKE "
1506 . $ilDB->quote(
"%$filter_value%",
'text') .
") ";
1509 " INNER JOIN il_dcl_record_field AS filter_record_field_{$filter_field_id} ON (filter_record_field_{$filter_field_id}.record_id = record.id AND filter_record_field_{$filter_field_id}.field_id = "
1510 . $ilDB->quote($filter_field_id,
'integer') .
") ";
1512 " INNER JOIN il_dcl_stloc{$filter_field->getStorageLocation()}_value AS filter_stloc_{$filter_field_id} ON (filter_stloc_{$filter_field_id}.record_field_id = filter_record_field_{$filter_field_id}.id AND filter_stloc_{$filter_field_id}.value LIKE "
1513 . $ilDB->quote(
"%$filter_value%",
'text') .
") ";
1518 " INNER JOIN il_dcl_record_field AS filter_record_field_{$filter_field_id} ON (filter_record_field_{$filter_field_id}.record_id = record.id AND filter_record_field_{$filter_field_id}.field_id = "
1519 . $ilDB->quote($filter_field_id,
'integer') .
") ";
1520 $prop = $filter_field->getPropertyvalues();
1524 " INNER JOIN il_dcl_stloc{$filter_field->getStorageLocation()}_value AS filter_stloc_{$filter_field_id} ON (filter_stloc_{$filter_field_id}.record_field_id = filter_record_field_{$filter_field_id}.id AND filter_stloc_{$filter_field_id}.value LIKE "
1525 . $ilDB->quote(
"%$filter_value%",
'text') .
") ";
1528 " INNER JOIN il_dcl_stloc{$filter_field->getStorageLocation()}_value AS filter_stloc_{$filter_field_id} ON (filter_stloc_{$filter_field_id}.record_field_id = filter_record_field_{$filter_field_id}.id AND filter_stloc_{$filter_field_id}.value = "
1529 . $ilDB->quote($filter_value,
'integer') .
") ";
1537 $sql =
"SELECT DISTINCT record.id, record.owner";
1541 $sql .= rtrim($select_str,
',') .
" FROM il_dcl_record AS record ";
1543 $sql .=
" WHERE record.table_id = " . $ilDB->quote($this->
getId(),
'integer') . $where_additions;
1545 $sql .=
" GROUP BY record.id, record.owner";
1548 $sql .=
" ORDER BY field_{$id} {$direction}";
1550 $set = $ilDB->query($sql);
1551 $total_record_ids = array();
1556 while ($rec = $ilDB->fetchAssoc($set)) {
1558 if (!$is_allowed_to_view && ($this->
getViewOwnRecordsPerm() && $ilUser->getId() != $rec[
'owner'])) {
1561 $total_record_ids[] = $rec[
'id'];
1562 $_SESSION[
'dcl_record_ids'][] = $rec[
'id'];
1566 $sort_array = array();
1567 foreach ($total_record_ids as
$id) {
1569 $sort_array[
$id] = $formula_field->getValue();
1571 switch ($direction) {
1578 arsort($sort_array);
1581 $total_record_ids = array_keys($sort_array);
1584 $record_ids = array_slice($total_record_ids, $offset, $limit);
1586 foreach ($record_ids as
$id) {
1590 return array(
'records' =>
$records,
'total' => count($total_record_ids) );