/** * Do the conversion for a source document * * @param object DOMDocument $sourceDoc * @param string $sourceFilePath * @return DOMDocument The output document * @access public * @since 2/4/08 */ public function convert(DOMDocument $sourceDoc, $sourceFilePath) { $this->sourceDoc = $sourceDoc; $this->sourceXPath = new DOMXPath($this->sourceDoc); if (!is_dir($sourceFilePath)) { throw new Exception("'{$sourceFilePath}' does not exist for conversion."); } if (!is_readable($sourceFilePath)) { throw new Exception("'{$sourceFilePath}' is not readable for conversion."); } $this->sourceFilePath = $sourceFilePath; // Set up the output document $this->doc = new Harmoni_DOMDocument(); $this->doc->appendChild($this->doc->createElement('Segue2')); $this->doc->documentElement->setAttribute('export_date', DateAndTime::now()->asString()); $this->doc->documentElement->setAttribute('segue_version', displayAction::getSegueVersion()); $this->doc->documentElement->setAttribute('segue_export_version', '2.0'); $this->agents = $this->doc->documentElement->appendChild($this->doc->createElement('agents')); $this->xpath = new DOMXPath($this->doc); $this->rootAdded = false; // print "<pre>"; // foreach ($this->sourceXPath->query('/site/media/media_file/filename') as $filename) // print $filename->nodeValue."\n"; // print "</pre>"; $this->addSite(); return $this->doc; }
/** * 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(); }
/** * Answer the ui module * * @return string * @access public * @since 3/18/08 */ public function getUiModule() { $displayAction = new displayAction(); return $displayAction->getUiModule(); }
/** * Add the footer controls to the main screen gui component * * @param object Component $mainScreen * @return void * @access public * @since 4/7/08 */ public function addFooterControls(Component $mainScreen) { // :: Footer :: $harmoni = Harmoni::instance(); $rootSiteComponent = SiteDispatcher::getCurrentRootNode(); $footer = $mainScreen->add(new Container(new XLayout(), BLANK, 1), $rootSiteComponent->getWidth(), null, CENTER, BOTTOM); ob_start(); print "<div class='seguefooter_left'>"; // Home print "<a href='" . $harmoni->request->quickURL('portal', 'list') . "' title='" . _("List of Segue sites") . "'>"; print _("home") . "</a> | "; // Help LInk print Help::link(); // Site Map $siteMapUrl = $harmoni->request->quickURL("view", "map", array('node' => SiteDispatcher::getCurrentNodeId())); print " | <a target='_blank' href='" . $siteMapUrl . "'"; print ' onclick="'; print "var url = '" . $siteMapUrl . "'; "; print "window.open(url, 'site_map', 'width=500,height=600,resizable=yes,scrollbars=yes'); "; print "return false;"; print '"'; print ">" . _("map") . "</a>"; // Tracking $trackingUrl = $harmoni->request->quickURL("participation", "actions", array('node' => SiteDispatcher::getCurrentNodeId())); print " | <a target='_blank' href='" . $trackingUrl . "'"; print ' onclick="'; print "var url = '" . $trackingUrl . "'; "; print "window.open(url, 'site_map', 'width=500,height=600,resizable=yes,scrollbars=yes'); "; print "return false;"; print '"'; print ">" . _("track") . "</a>"; print "</div>"; $footer->add(new UnstyledBlock(ob_get_clean()), "50%", null, LEFT, BOTTOM); $footer->add(new UnstyledBlock(displayAction::getVersionText()), "50%", null, RIGHT, BOTTOM); }