/** * get all actions of a participant in a node * * @return array of Participation_Action * @access public * @since 1/23/09 */ public function getActions() { $all_actions = $this->_view->getActions(); $participantActions = array(); foreach ($all_actions as $action) { $participationAction = $action->getParticipant($this->_id)->getId(); if ($participationAction == $this->_id) { $participantActions[] = $action; } } return $participantActions; }
/** * Display a list of participants with summary of their contributions * * @param string $id * @return string XHTML markup * @access private * @since 1/28/09 */ private function getActionsList() { $node = SiteDispatcher::getCurrentNode(); $view = new Participation_View($node); $participants = $view->getParticipants(); // create an array of reorder urls $sortValues = array('timestamp', 'contributor', 'contribution', 'role'); $reorderUrl = array(); foreach ($sortValues as $sortValue) { $reorderUrl[$sortValue] = SiteDispatcher::quickURL('participation', 'actions', array('node' => $node->getId(), 'sort' => $sortValue, 'direction' => $this->_reorder, 'participant' => $this->_participant, 'role' => $this->_role)); } // header row for list of actions ob_start(); print "\n\t<thead>"; print "\n\t\t<tr>"; // time print "\n\t\t\t<th style='border-bottom: 1px dotted'><a href='"; print $reorderUrl['timestamp']; print "'>" . _("Time") . " " . ($this->_sort == 'timestamp' ? $this->_reorderFlag : "") . "</a></th>"; // contributor print "\n\t\t\t<th style='border-bottom: 1px dotted'><a href='"; print $reorderUrl['contributor']; print "'>" . _("Contributor") . " " . ($this->_sort == 'contributor' ? $this->_reorderFlag : "") . "</a></th>"; // role print "\n\t\t\t<th style='border-bottom: 1px dotted'><a href='"; print $reorderUrl['role']; print "'>" . _("Role") . " " . ($this->_sort == 'role' ? $this->_reorderFlag : "") . "</a>"; print "</th>"; // contribution print "\n\t\t\t<th style='border-bottom: 1px dotted'><a href='"; print $reorderUrl['contribution']; print "'>" . _("Contribution") . " " . ($this->_sort == 'contribution' ? $this->_reorderFlag : "") . "</a></th>"; // pushdown link print "\n\t\t\t<th style='border-bottom: 1px dotted'></th>"; print "\n\t</thead>"; $headRow = ob_get_clean(); // if participant specified get their actions if (isset($this->_participant) && $this->_participant != 'all') { $idMgr = Services::getService('Id'); $participantId = $idMgr->getId($this->_participant); $participantView = new Participation_Participant($view, $participantId); $actions = $participantView->getActions(); //get list of all actions in site } else { $actions = $view->getActions(); } // sort actions by sort key $sortKeys = array(); if ($this->_sort == 'timestamp') { foreach ($actions as $action) { $sortKeys[] = $action->getTimeStamp()->asString(); } } else { if ($this->_sort == 'contributor') { foreach ($actions as $action) { $sortKeys[] = $action->getParticipant()->getDisplayName(); } } else { if ($this->_sort == 'contribution') { foreach ($actions as $action) { $sortKeys[] = $action->getTargetDisplayName(); } } else { if ($this->_sort == 'role') { foreach ($actions as $action) { $sortKeys[] = $action->getCategoryDisplayName(); } } else { throw new InvalidArguementException("Unknown sort field {$sort}"); } } } } array_multisort($sortKeys, $this->_direction, array_keys($actions), SORT_ASC, $actions); // if role action specified then filter actions $selectedActions = array(); if ($this->_role != 'all') { foreach ($actions as $action) { if ($action->getCategoryId() == $this->_role) { $selectedActions[] = $action; } } } else { $selectedActions = $actions; } $this->_node = $node; $this->_sortValue = $sortValue; $printer = new ParticipationResultPrinter($selectedActions, $headRow, $this->_display, array($this, 'printAction')); print $printer->getMarkup(); return ob_get_clean(); }