private function getModifications($ts, $userid) { $offsetDate = JDate::getInstance(date("Y-m-d H:i:s", $ts), JFactory::getConfig()->get('offset')); $offset = $offsetDate->format('Y-m-d H:i:s'); //1. get issues $issuesModel = JModelLegacy::getInstance('Issues', 'ImcModel', array('ignore_request' => true)); $issuesModel->setState('filter.imcapi.ts', $offset); $issuesModel->setState('filter.imcapi.raw', true); //Do not unset anything in getItems() $data = $issuesModel->getItems(); $issues = ImcFrontendHelper::sanitizeIssues($data, $userid, true); //2. get categories $categories = ImcFrontendHelper::getModifiedCategories($offset); $categories = ImcFrontendHelper::sanitizeCategories($categories); //3. get steps $stepsModel = JModelLegacy::getInstance('Steps', 'ImcModel', array('ignore_request' => true)); $stepsModel->setState('filter.imcapi.ts', $offset); $stepsModel->setState('filter.imcapi.raw', true); $data = $stepsModel->getItems(); $steps = ImcFrontendHelper::sanitizeSteps($data, true); //4. get votes $data = ImcFrontendHelper::getModifiedVotes($offset); $votes = ImcFrontendHelper::sanitizeModifiedVotes($data); //5. full categories structure if modified categories are found $allCategories = array(); if (!empty($categories)) { $allCategories = ImcFrontendHelper::getCategories(false); } $info = array('count_issues' => sizeof($issues), 'count_categories' => sizeof($categories), 'count_steps' => sizeof($steps), 'count_votes' => sizeof($votes), 'count_allcategories' => sizeof($allCategories), 'given_ts' => $ts, 'given_date' => gmdate('Y-m-d H:i:s', $ts), 'offset' => $offsetDate); $updated = array('issues' => $issues, 'categories' => $categories, 'steps' => $steps, 'votes' => $votes, 'allcategories' => $allCategories); return array('info' => $info, 'updated' => $updated); }