/** * AjaxDispatcher callback for getting a list of available portlets * @return BsCAResponse */ public static function getPortlets() { $oResponse = BsCAResponse::newFromPermission('read'); $aPortlets = array(); wfRunHooks('BSDashboardsGetPortlets', array(&$aPortlets)); //LogPage::validTypes(); $oResponse->setPayload($aPortlets); return $oResponse; }
/** * * @global WebRequest $wgRequest * @return type */ public static function ajaxGetOverview() { $oResponse = BsCAResponse::newFromPermission('workflowlist'); if ($oResponse->isSuccess() == false) { return $oResponse; } global $wgRequest; $iUserID = $wgRequest->getInt('userID', 0); $aFilter = FormatJson::decode($wgRequest->getVal('filter', '[]')); $oUser = User::newFromId($iUserID); if ($oUser->getId() > 0) { $aFilter[] = (object) array('type' => 'int', 'value' => $oUser->getName(), 'field' => 'user_id'); } $aReviewList = self::filterReviewList(Review::getData(), $aFilter); $aReviews = array(); foreach ($aReviewList as $arrKey => $row) { $row += $row['array']; if ($row['revs_status'] == '') { $row['revs_status'] = 'pending'; } $oReview = new stdClass(); $oReview->rev_id = $row['rev_id']; $oReview->page_title = Title::makeTitle($row['page_namespace'], $row['page_title'])->getPrefixedText(); $oReview->owner_name = $row['owner_name']; $oReview->owner_real_name = $row['owner_real_name']; $oReview->rev_status = $row['revs_status']; $oReview->rev_sequential = $row['rev_sequential']; $oReview->rev_status_text = wfMessage('bs-review-' . $row['revs_status'])->plain(); $oReview->rejected = isset($row['rejected']) ? $row['rejected'] : false; $oReview->accepted = isset($row['accepted']) ? $row['accepted'] : 0; if (!wfMessage('bs-review-' . $row['revs_status'])->exists()) { wfDebugLog('BS::Review', 'message key does not exist' . wfMessage('bs-review-' . $row['revs_status'])->plain()); } $oReview->accepted_text = wfMessage('bs-review-accepted')->plain() . ':' . $oReview->accepted . '/' . $row['total'] . '<br />' . wfMessage('bs-review-' . $row['revs_status'])->plain(); $oReview->total = $row['total']; $oReview->endtimetamp = $row['endtimestamp']; $oReview->startdate = $row['startdate']; $oReview->enddate = $row['enddate']; $oReview->assessors = array(); $bRejected = false; foreach ($row['assessors'] as $arrAssessor) { $oAssessor = new stdClass(); $oAssessor->revs_status = $arrAssessor['revs_status']; $oAssessor->name = $arrAssessor['name']; $oAssessor->real_name = $arrAssessor['real_name']; $oAssessor->timestamp = false; if ($arrAssessor['timestamp'] != '00.00' && $arrAssessor['revs_status'] >= 0) { $oAssessor->timestamp = $arrAssessor['timestamp']; } if ($oReview->accepted === 0 && $oAssessor->revs_status === '-3') { $bRejected = true; } $oReview->assessors[] = $oAssessor; } $oCurrentDate = DateTime::createFromFormat('YmdHis', wfTimestampNow()); $oEndDate = DateTime::createFromFormat('d.m.Y', $oReview->enddate); if ($oEndDate && $oEndDate && $oEndDate < $oCurrentDate) { $oReview->accepted_text = wfMessage('bs-review-accepted')->plain() . ': ' . $oReview->accepted . '/' . $row['total'] . '<br />' . wfMessage('bs-review-expired')->plain(); } elseif ($bRejected) { $oReview->accepted_text = wfMessage('bs-review-accepted')->plain() . ': ' . $oReview->accepted . '/' . $row['total'] . '<br />' . wfMessage('bs-review-denied')->plain(); } $aReviews[] = $oReview; } $oResponse->setPayload($aReviews); return $oResponse; }