/** * Return the markup that represents the plugin. * Plugin writers should override this method with their own functionality * as needed. * * @return string * @access public * @since 1/12/06 */ public function getMarkup() { ob_start(); $this->printMessages(); switch ($this->getFieldValue('mode')) { case 'join': if ($this->currentUser->getId()->isEqual(new HarmoniId('edu.middlebury.agents.anonymous'))) { // Prompt for login or registration print "<h4>" . _("Please log in:") . "</h4>"; $action = new displayAction(); print "\n<div style='margin-left: 30px;'>"; print $action->getLoginFormHtml(); print "\n</div>"; print "<h4>" . _("Or create a visitor account:") . "</h4>"; print "\n<div style='margin-left: 30px;'>"; print $action->getVisitorRegistrationLink(); print "\n</div>"; } else { if ($this->isAwaitingApproval($this->currentUser->getId())) { print _("Your request has already been submitted and is awaiting approval from the site administrator."); print "\n<br/>"; print _("You will receive an email when your request is approved."); } else { // Add to the queue $this->join(); print _("Your request has been submitted and is awaiting approval from the site administrator."); print "\n<br/>"; print _("You will receive an email when your request is approved."); } } break; default: if ($this->canModify()) { print "<div style='float: right'>(" . Help::link('Site-Members') . ")</div>"; } if ($this->isUserMember()) { print "<button disabled='disabled'>" . _('Join Site') . "</button>"; } else { print "\n<button onclick='window.location = \"" . $this->url(array('mode' => 'join')) . "\".urlDecodeAmpersands();'>" . _('Join Site') . "</button>"; } if ($this->canModify()) { $awaitingApproval = $this->getAgentsAwaitingApproval(); if (count($awaitingApproval)) { print "\n<h4>" . _('Awaiting Approval') . '</h4>'; print "\n<ul>"; foreach ($awaitingApproval as $agent) { print "\n\t<li>"; print $agent->getDisplayName(); print "\n\t\t<a href='"; print $this->url(array('change' => 'approve', 'agent_id' => $agent->getId()->getIdString())); print "'>" . _('Approve') . "</a>"; print "\n\t\t<a href='"; print $this->url(array('change' => 'deny', 'agent_id' => $agent->getId()->getIdString())); print "'>" . _('Deny') . "</a>"; print "\n\t</li>"; } print "\n</ul>"; } else { print "\n<h4>" . _('No users are currently awaiting approval') . '</h4>'; } } } return ob_get_clean(); }