本文整理汇总了PHP中RequestContext::value方法的典型用法代码示例。如果您正苦于以下问题:PHP RequestContext::value方法的具体用法?PHP RequestContext::value怎么用?PHP RequestContext::value使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RequestContext
的用法示例。
在下文中一共展示了RequestContext::value方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildContent
/**
* Build the content for this action
*
* @return boolean
* @access public
* @since 4/26/05
*/
function buildContent()
{
$actionRows = $this->getActionRows();
$harmoni = Harmoni::instance();
ob_start();
CollectionsPrinter::printFunctionLinks();
$layout = new Block(ob_get_contents(), STANDARD_BLOCK);
ob_end_clean();
$actionRows->add($layout, null, null, CENTER, CENTER);
$type = HarmoniType::fromString(urldecode(RequestContext::value('type')));
$repositoryManager = Services::getService("Repository");
// Get the Repositories
$allRepositories = $repositoryManager->getRepositoriesByType($type);
// put the repositories into an array and order them.
// @todo, do authorization checking
$repositoryArray = array();
while ($allRepositories->hasNext()) {
$repository = $allRepositories->next();
$repositoryArray[$repository->getDisplayName()] = $repository;
}
ksort($repositoryArray);
// print the Results
$resultPrinter = new ArrayResultPrinter($repositoryArray, 2, 20, "printrepositoryShort", $harmoni);
$resultPrinter->addLinksStyleProperty(new MarginTopSP("10px"));
$resultLayout = $resultPrinter->getLayout();
$actionRows->add($resultLayout, null, null, CENTER, CENTER);
}
示例2: getComment
/**
* Answer the comment object
*
* @return object
* @access public
* @since 7/11/07
*/
function getComment()
{
$idManager = Services::getService("Id");
$commentId = $idManager->getId(RequestContext::value('comment_id'));
$commentManager = CommentManager::instance();
return $commentManager->getComment($commentId);
}
示例3: getTag
/**
* Answer the Tag for this action
*
* @return object Tag
* @access public
* @since 12/8/06
*/
function getTag()
{
if (!isset($this->_tag)) {
$this->_tag = new Tag(RequestContext::value('tag'));
}
return $this->_tag;
}
示例4: buildContent
/**
* Build the content for this action
*
* @return boolean
* @access public
* @since 4/26/05
*/
function buildContent()
{
$actionRows = $this->getActionRows();
$harmoni = Harmoni::instance();
$repository = $this->getRepository();
// get the search type.
$searchType = HarmoniType::fromString(urldecode(RequestContext::value('search_type')));
// Get the Search criteria
$searchModules = Services::getService("RepositorySearchModules");
$searchCriteria = $searchModules->getSearchCriteria($repository, $searchType);
// function links
ob_start();
print _("Collection") . ": ";
RepositoryPrinter::printRepositoryFunctionLinks($harmoni, $repository);
$layout = new Block(ob_get_contents(), 2);
ob_end_clean();
$actionRows->add($layout, null, null, CENTER, CENTER);
ob_start();
print "<p>";
print _("Some <em>Collections</em>, <em>Exhibitions</em>, <em>Assets</em>, and <em>Slide-Shows</em> may be restricted to certain users or groups of users. Log in above to ensure your greatest access to all parts of the system.");
print "</p>";
$introText = new Block(ob_get_contents(), 2);
ob_end_clean();
$actionRows->add($introText, null, null, CENTER, CENTER);
//***********************************
// Get the assets to display
//***********************************
$assets = $repository->getAssetsBySearch($searchCriteria, $searchType, new HarmoniProperties(new Type('Repository', 'edu.middlebury', 'null')));
//***********************************
// print the results
//***********************************
$resultPrinter = new IteratorResultPrinter($assets, 2, 6, "printAssetShort", $harmoni);
$resultLayout = $resultPrinter->getLayout();
$actionRows->add($resultLayout, "100%", null, LEFT, CENTER);
}
示例5: update
/**
* Tells the wizard component to update itself - this may include getting
* form post data or validation - whatever this particular component wants to
* do every pageload.
* @param string $fieldName The field name to use when outputting form data or
* similar parameters/information.
* @access public
* @return boolean - TRUE if everything is OK
*/
function update($fieldName)
{
$val = RequestContext::value($fieldName);
if ($val !== null && (!$this->_startingDisplay || $val != $this->_startingDisplay)) {
$string = HtmlString::fromString($val);
$string->cleanXSS();
$this->_value = $string->asString();
if (trim($this->_value) != trim($val)) {
$this->_origErrorText = $this->getErrorText();
$this->setErrorText(dgettext('polyphony', "The value you entered has been reformatted to meet XHTML validity standards."));
// Add both error text if validation failed as well.
if (!$this->validate()) {
$this->setErrorText($this->getErrorText() . " " . $this->_origErrorText);
}
$this->_showError = true;
// Add a dummy rule if needed.
if (!$this->getErrorRule()) {
$this->setErrorRule(new WECRegex('.*'));
}
} else {
// Reset the original error text.
if (isset($this->_origErrorText)) {
$this->setErrorText($this->_origErrorText);
}
}
}
return $this->validate();
}
示例6: buildContent
/**
* Execute
*
* @return void
* @access public
* @since 3/21/08
*/
public function buildContent()
{
$rows = $this->getActionRows();
$message = _("The file that you requested, '%1', does not exist in this site.");
$message = str_replace('%1', RequestContext::value('filename'), $message);
$rows->add(new Block($message, HIGHLIT_BLOCK));
}
示例7: execute
/**
* Execute the action
*
* @return void
* @access public
* @since 10/9/08
*/
public function execute()
{
header('Content-Type: text/plain;');
try {
if (!$this->isAuthorizedToExecute()) {
throw new PermissionDeniedException("You must be logged in.");
}
$mgr = SlotManager::instance();
$slot = $mgr->getSlotByShortname(RequestContext::value('slot'));
$slot->makeAlias($mgr->getSlotByShortname(RequestContext::value('target_slot')));
print _("Success");
/*********************************************************
* Log the success
*********************************************************/
if (Services::serviceRunning("Logging")) {
$loggingManager = Services::getService("Logging");
$log = $loggingManager->getLogForWriting("Segue");
$formatType = new Type("logging", "edu.middlebury", "AgentsAndNodes", "A format in which the acting Agent[s] and the target nodes affected are specified.");
$priorityType = new Type("logging", "edu.middlebury", "Event_Notice", "Normal events.");
$item = new AgentNodeEntryItem("Alias Made", "'" . $slot->getShortname() . "' has been made an alias of '" . RequestContext::value('target_slot') . "'.");
$item->addNodeId($slot->getSiteId());
$log->appendLogWithTypes($item, $formatType, $priorityType);
}
} catch (OperationFailedException $e) {
print $e->getMessage();
} catch (UnknownIdException $e) {
print $e->getMessage();
}
exit;
}
示例8: execute
/**
* Execute this action.
*
* @param object Harmoni $harmoni
* @return mixed
* @access public
* @since 4/25/05
*/
function execute()
{
if (!$this->isAuthorizedToExecute()) {
throw new PermissionDeniedException();
}
$harmoni = Harmoni::instance();
$harmoni->request->startNamespace("harmoni-authentication");
$query = RequestContext::value("user");
$harmoni->request->endNamespace();
header('Content-type: text/plain');
if (!strlen($query)) {
exit;
}
$authNMethodManager = Services::getService("AuthNMethods");
$types = $authNMethodManager->getAuthNTypes();
while ($types->hasNext()) {
$type = $types->next();
$method = $authNMethodManager->getAuthNMethodForType($type);
$foundTokens = $method->getTokensBySearch($query);
while ($foundTokens->hasNext()) {
$tokens = $foundTokens->next();
print $method->getDisplayNameForTokens($tokens) . " (" . $type->getKeyword() . ")|type=\"" . $type->asString() . "\" id=\"" . $tokens->getIdentifier() . "\"\n";
}
}
exit;
}
示例9: execute
/**
* Execute this action.
*
* @return void
* @access public
* @since 08/11/08
*/
public function execute()
{
$this->start();
try {
if (!$this->isAuthorizedToExecute()) {
$this->error(_("You are not authorized to search."), "PermissionDenied");
}
if (!isset($_SESSION['portal_searches'])) {
$_SESSION['portal_searches'] = array();
}
$folder = new SearchPortalFolder(RequestContext::value('query'));
$usingOld = false;
foreach ($_SESSION['portal_searches'] as $searchFolder) {
if ($searchFolder->getIdString() == $folder->getIdString() && $folder->getAgentId()->isEqual($searchFolder->getAgentId())) {
$folder = $searchFolder;
$usingOld = true;
break;
}
}
// run the search if needed.
if (!$usingOld) {
$folder->search();
}
$_SESSION['portal_searches'][] = $folder;
print "\n\t<search id=\"" . $folder->getIdString() . "\"/>";
} catch (Exception $e) {
$this->error($e->getMessage(), get_class($e));
}
$this->end();
}
示例10: update
/**
* Tells the wizard component to update itself - this may include getting
* form post data or validation - whatever this particular component wants to
* do every pageload.
*
* @param string $fieldName The field name to use when outputting form data or
* similar parameters/information.
* @access public
* @return boolean - TRUE if everything is OK
* @since 12/12/07
*/
public function update($fieldName)
{
// Update the list with any subtractions
$removeId = RequestContext::value($fieldName . "_remove");
if ($removeId) {
foreach ($this->list as $key => $result) {
if ($removeId == $result->getIdString()) {
$this->removeFromList($key);
break;
}
}
}
// Update the list with any additions
$addId = RequestContext::value($fieldName . "_add");
if ($addId) {
foreach ($this->searchResults as $result) {
if ($addId == $result->getIdString()) {
$this->addToList($result);
break;
}
}
}
// update the search field
parent::update($fieldName);
}
示例11: execute
/**
* Execute
*
* @return void
* @access public
* @since 3/26/08
*/
public function execute()
{
if (!$this->isAuthorizedToExecute()) {
throw new PermissionDeniedException('This command can only be run by admins or from the command-line.');
}
header("Content-Type: text/plain");
if (RequestContext::value('help') || RequestContext::value('h') || RequestContext::value('?')) {
throw new HelpRequestedException("Usage:\n\t" . $_SERVER['argv'][0] . " [-h|--help] [-t|--test]\n\t\n\t-h,--help Print out this help text.\n\t-t,--test Run in test mode. Equivalent to adding `define('MIGRATION_REMINDER_EMAIL_TEST_ONLY', true);` to the config.\n");
}
if (RequestContext::value('t') || RequestContext::value('test')) {
if (defined('MIGRATION_REMINDER_EMAIL_TEST_ONLY') && !MIGRATION_REMINDER_EMAIL_TEST_ONLY) {
throw new ConfigurationErrorException("-t or --test was specified, but the configuration has set MIGRATION_REMINDER_EMAIL_TEST_ONLY to false.\nDo not specify a value for MIGRATION_REMINDER_EMAIL_TEST_ONLY in the configuration if you wish to\nbe able to switch between test mode and real mode with -t/--test.");
}
define('MIGRATION_REMINDER_EMAIL_TEST_ONLY', true);
}
while (ob_get_level()) {
ob_end_flush();
}
flush();
if (!defined('MIGRATION_REMINDER_EMAIL_TEST_ONLY')) {
define('MIGRATION_REMINDER_EMAIL_TEST_ONLY', false);
}
if (MIGRATION_REMINDER_EMAIL_TEST_ONLY) {
print "In test mode. Email will be sent to " . MIGRATION_REMINDER_EMAIL_TEST_RECIPIENT . " rather than real recipients.\n";
} else {
print "Site reminders will be sent to real recipients.\n";
}
$this->buildUserSiteList();
$this->emailUsers();
exit;
}
示例12: execute
/**
* Execute
*
* @return void
* @access public
* @since 7/31/08
*/
public function execute()
{
try {
if (!RequestContext::value('id')) {
throw new InvalidArgumentException("Id is expected.");
}
$selection = Segue_Selection::instance();
$director = SiteDispatcher::getSiteDirector();
$component = $director->getSiteComponentById(RequestContext::value('id'));
if ($selection->isSiteComponentInSet($component)) {
$selection->removeSiteComponent($component);
}
$this->start();
$selection->reset();
while ($selection->hasNext()) {
$siteComponent = $selection->nextSiteComponent();
print "\n\t<siteComponent type='" . $siteComponent->getComponentClass() . "' ";
if (method_exists($siteComponent, 'isSection')) {
if ($siteComponent->isSection()) {
print "navType='Section' ";
} else {
print "navType='Page' ";
}
}
print "id='" . $siteComponent->getId() . "' ";
print "displayName=\"" . str_replace('"', '"', preg_replace('/\\s+/', ' ', strip_tags($siteComponent->getDisplayName()))) . "\" ";
print "/>";
}
$this->end();
} catch (Exception $e) {
HarmoniErrorHandler::logException($e);
$this->error($e->getMessage(), get_class($e));
}
}
示例13: execute
/**
* Execute this action.
*
* @return mixed
* @access public
* @since 12/13/06
*/
function execute()
{
switch (RequestContext::value('package')) {
case 'harmoni':
$currentPackage = 'harmoni';
$file = HARMONI_BASE . "docs/changelog.html";
$source = file_get_contents($file);
break;
case 'polyphony':
$currentPackage = 'polyphony';
$file = POLYPHONY . "/docs/changelog.html";
$source = file_get_contents($file);
break;
case 'viewer':
$currentPackage = 'viewer';
$file = VIEWER_URL . "/README.txt";
$source = "<html>\n\t<head>\n\t\t<title>Viewer Changelog</title>\n\t</head>\n\t<body>\n\t\t<pre>" . htmlentities(file_get_contents($file)) . "</pre>\n\t</body>\n</html>\n";
break;
default:
$currentPackage = 'concerto';
$file = MYDIR . "/doc/changelog.html";
$source = file_get_contents($file);
break;
}
$menu = $this->generateMenu($currentPackage);
// insert the menu into the file
print str_replace('<body>', '<body>' . $menu, $source);
exit;
}
示例14: update
/**
* Tells the wizard component to update itself - this may include getting
* form post data or validation - whatever this particular component wants to
* do every pageload.
* @param string $fieldName The field name to use when outputting form data or
* similar parameters/information.
* @access public
* @return boolean - TRUE if everything is OK
*/
function update($fieldName)
{
$val = RequestContext::value($fieldName);
if ($val !== false && $val !== null) {
$this->_value = $val;
}
}
示例15: execute
function execute()
{
$harmoni = Harmoni::instance();
// Get services
$idManager = Services::getService("Id");
$authZ = Services::getService("AuthZ");
$harmoni->request->startNamespace("polyphony-authorizations");
// Get info passed to this action via the URL
$operation = RequestContext::value("operation");
$functionIdString = RequestContext::value("functionId");
$qualifierIdString = RequestContext::value("qualifierId");
$agentList = array();
if (RequestContext::value("mult")) {
$agentList = unserialize(urldecode(RequestContext::value("agents")));
} else {
$agentList = array(RequestContext::value("agentId"));
}
// Process authorizations
if ($operation == 'create') {
// Get Ids from these strings
$functionId = $idManager->getId($functionIdString);
$qualifierId = $idManager->getId($qualifierIdString);
foreach ($agentList as $agentIdString) {
$authZ->createAuthorization($idManager->getId($agentIdString), $functionId, $qualifierId);
}
} else {
if ($operation == 'delete') {
// Get Ids from these strings
$functionId = $idManager->getId($functionIdString);
$qualifierId = $idManager->getId($qualifierIdString);
foreach ($agentList as $agentIdString) {
$authorizations = $authZ->getExplicitAZs($idManager->getId($agentIdString), $functionId, $qualifierId, false);
while ($authorizations->hasNext()) {
$authorization = $authorizations->next();
/* $qualifier =$authorization->getQualifier();
$function =$authorization->getFunction();
$qualifierId =$qualifier->getId();
$functionId =$function->getId();
print "auth -> function: ".$functionId->getIdString().", qualifier: ".$qualifierId->getIdString()."<br/>";
*/
$authZ->deleteAuthorization($authorization);
}
}
} else {
if ($operation == 'delete_all') {
// clear all authorizations for the users selected
foreach ($agentsList as $agentIdString) {
$authorizations = $authZ->getAllExplicitAZsForAgent($idManager->getId($agentIdString), false);
while ($authorizations->hasNext()) {
$authorization = $authorizations->next();
$authZ->deleteAuthorization($authorization);
}
}
}
}
}
$harmoni->request->endNamespace();
$harmoni->history->goBack("polyphony/agents/process_authorizations");
}