当前位置: 首页>>代码示例>>PHP>>正文


PHP Basket::instance方法代码示例

本文整理汇总了PHP中Basket::instance方法的典型用法代码示例。如果您正苦于以下问题:PHP Basket::instance方法的具体用法?PHP Basket::instance怎么用?PHP Basket::instance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Basket的用法示例。


在下文中一共展示了Basket::instance方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: buildContent

 function buildContent()
 {
     $harmoni = Harmoni::Instance();
     $basket = Basket::instance();
     $basket->removeAllItems();
     RequestContext::locationHeader($harmoni->request->quickURL("basket", "view"));
 }
开发者ID:adamfranco,项目名称:polyphony,代码行数:7,代码来源:empty.act.php

示例2: execute

 /**
  * Build the content for this action
  * 
  * @return boolean
  * @access public
  * @since 5/5/06
  */
 function execute()
 {
     $harmoni = Harmoni::Instance();
     $basket = Basket::instance();
     $basket->removeAllItems();
     print $basket->getSmallBasketHtml();
     exit;
 }
开发者ID:adamfranco,项目名称:polyphony,代码行数:15,代码来源:emptyAjax.act.php

示例3: buildContent

 /**
  * Build the content for this action
  * 
  * @return boolean
  * @access public
  * @since 4/26/05
  */
 function buildContent()
 {
     $actionRows = $this->getActionRows();
     $harmoni = Harmoni::instance();
     $harmoni->request->startNamespace("basket");
     $idManager = Services::getService("Id");
     $authZ = Services::getService("AuthZ");
     $basket = Basket::instance();
     $assetId = $idManager->getId(RequestContext::value("asset_id"));
     $basket->moveUp($assetId);
     $harmoni->request->endNamespace();
     RequestContext::locationHeader($harmoni->request->quickURL("basket", "view"));
 }
开发者ID:adamfranco,项目名称:polyphony,代码行数:20,代码来源:up.act.php

示例4: getAssets

 /**
  * Answer the assets to display in the slideshow
  * 
  * @return object AssetIterator
  * @access public
  * @since 5/4/06
  */
 function getAssets()
 {
     $assets = array();
     $repositoryManager = Services::getService("Repository");
     $basket = Basket::instance();
     $basket->clean();
     $basket->reset();
     while ($basket->hasNext()) {
         $assets[] = $repositoryManager->getAsset($basket->next());
     }
     $iterator = new HarmoniIterator($assets);
     return $iterator;
 }
开发者ID:adamfranco,项目名称:polyphony,代码行数:20,代码来源:browse_xml.act.php

示例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)
 {
     $idManager = Services::getService("Id");
     $ok = parent::update($fieldName);
     // then, check if any "buttons" or anything were pressed to add/remove elements
     $this->_addFromBasketButton->update($fieldName . "_addfrombasket");
     if ($this->_addFromBasketButton->getAllValues()) {
         $basket = Basket::instance();
         $basket->reset();
         while ($basket->hasNext()) {
             $assetId = $basket->next();
             $element =& $this->_addElement();
             $element['_assetId'] = new AssetComponent();
             $element['_assetId']->setParent($this);
             $element['_assetId']->setValue($assetId);
         }
         $basket->removeAllItems();
         $this->rebuildPositionSelects();
     }
     return $ok;
 }
开发者ID:adamfranco,项目名称:concerto,代码行数:30,代码来源:SlideOrderedRepeatableComponentCollection.class.php

示例6: isAuthorizedToExecute

 /**
  * Check Authorizations
  * 
  * @return boolean
  * @access public
  * @since 9/27/05
  */
 function isAuthorizedToExecute()
 {
     $harmoni = Harmoni::instance();
     $authZ = Services::getService("AuthZ");
     $idManager = Services::getService("Id");
     $basket = Basket::instance();
     $basket->reset();
     $view = $idManager->getId("edu.middlebury.authorization.view");
     $this->_exportList = array();
     while ($basket->hasNext()) {
         $id = $basket->next();
         if ($authZ->isUserAuthorized($view, $id)) {
             $this->_exportList[] = $id;
         }
     }
     if (count($this->_exportList) > 0) {
         return true;
     } else {
         return false;
     }
 }
开发者ID:adamfranco,项目名称:polyphony,代码行数:28,代码来源:export.act.php

示例7: buildContent

 /**
  * Build the content for this action
  * 
  * @return boolean
  * @access public
  * @since 4/26/05
  */
 function buildContent()
 {
     $actionRows = $this->getActionRows();
     $harmoni = Harmoni::instance();
     $harmoni->request->startNamespace("basket");
     $idManager = Services::getService("Id");
     $authZ = Services::getService("AuthZ");
     $basket = Basket::instance();
     $viewAZ = $idManager->getId("edu.middlebury.authorization.view");
     $assetIdList = RequestContext::value("assets");
     $assetIdArray = explode(",", trim($assetIdList));
     foreach ($assetIdArray as $id) {
         $assetId = $idManager->getId($id);
         try {
             if ($authZ->isUserAuthorized($viewAZ, $assetId)) {
                 $basket->addItem($assetId);
             }
         } catch (UnknownIdException $e) {
             $basket->addItem($assetId);
         }
     }
     $harmoni->request->endNamespace();
     $harmoni->history->goBack("polyphony/basket");
 }
开发者ID:adamfranco,项目名称:polyphony,代码行数:31,代码来源:add.act.php

示例8: execute

 /**
  * Build the content for this action
  * 
  * @return boolean
  * @access public
  * @since 4/26/05
  */
 function execute()
 {
     $harmoni = Harmoni::instance();
     $harmoni->request->startNamespace("basket");
     $idManager = Services::getService("Id");
     $authZ = Services::getService("AuthZ");
     $basket = Basket::instance();
     $viewAZ = $idManager->getId("edu.middlebury.authorization.view");
     $assetIdList = RequestContext::value("assets");
     $assetIdArray = explode(",", trim($assetIdList));
     foreach ($assetIdArray as $id) {
         $assetId = $idManager->getId($id);
         try {
             if ($authZ->isUserAuthorized($viewAZ, $assetId)) {
                 $basket->addItem($assetId);
             }
         } catch (UnknownIdException $e) {
             $basket->addItem($assetId);
         }
     }
     $harmoni->request->endNamespace();
     print $basket->getSmallBasketHtml();
     exit;
 }
开发者ID:adamfranco,项目名称:polyphony,代码行数:31,代码来源:addAjax.act.php

示例9: execute

 /**
  * Execute the Action
  * 
  * @param object Harmoni $harmoni
  * @return mixed
  * @access public
  * @since 4/25/05
  */
 function execute()
 {
     $xLayout = new XLayout();
     $yLayout = new YLayout();
     $harmoni = Harmoni::instance();
     $mainScreen = new Container($yLayout, BLOCK, 1);
     // :: Top Row ::
     // The top row for the logo and status bar.
     $headRow = new Container($xLayout, HEADER, 1);
     // The logo
     $logo = new Component("\n<a href='" . MYPATH . "/'> <img src='" . LOGO_URL . "' \n\t\t\t\t\t\t\tstyle='border: 0px;' alt='" . _("Concerto Logo'") . "/> </a>", BLANK, 1);
     $headRow->add($logo, null, null, LEFT, TOP);
     // Language Bar
     $harmoni->history->markReturnURL("polyphony/language/change");
     $languageText = "\n<form action='" . $harmoni->request->quickURL("language", "change") . "' method='post'>";
     $harmoni->request->startNamespace("polyphony");
     $languageText .= "\n\t<div style='text-align: center'>\n\t<select name='" . $harmoni->request->getName("language") . "'>";
     $harmoni->request->endNamespace();
     $langLoc = Services::getService('Lang');
     $currentCode = $langLoc->getLanguage();
     $languages = $langLoc->getLanguages();
     ksort($languages);
     foreach ($languages as $code => $language) {
         $languageText .= "\n\t\t<option value='" . $code . "'" . ($code == $currentCode ? " selected='selected'" : "") . ">";
         $languageText .= $language . "</option>";
     }
     $languageText .= "\n\t</select>";
     $languageText .= "\n\t<input type='submit' />";
     $languageText .= "\n\t</div>\n</form>";
     $languageBar = new Component($languageText, BLANK, 1);
     $headRow->add($languageBar, null, null, LEFT, TOP);
     // Pretty Login Box
     $loginRow = new Container($yLayout, OTHER, 1);
     $headRow->add($loginRow, null, null, RIGHT, TOP);
     ob_start();
     $authN = Services::getService("AuthN");
     $agentM = Services::getService("Agent");
     $idM = Services::getService("Id");
     $authTypes = $authN->getAuthenticationTypes();
     $users = '';
     while ($authTypes->hasNext()) {
         $authType = $authTypes->next();
         $id = $authN->getUserId($authType);
         if (!$id->isEqual($idM->getId('edu.middlebury.agents.anonymous'))) {
             $agent = $agentM->getAgent($id);
             $exists = false;
             foreach (explode("+", $users) as $user) {
                 if ($agent->getDisplayName() == $user) {
                     $exists = true;
                 }
             }
             if (!$exists) {
                 if ($users == '') {
                     $users .= $agent->getDisplayName();
                 } else {
                     $users .= " + " . $agent->getDisplayName();
                 }
             }
         }
     }
     if ($users != '') {
         print "\n<div style='text-align: right'><small>";
         if (count(explode("+", $users)) == 1) {
             print _("User: ") . $users . "\t";
         } else {
             print _("Users: ") . $users . "\t";
         }
         print "<a href='" . $harmoni->request->quickURL("auth", "logout") . "'>" . _("Log Out") . "</a></small></div>";
     } else {
         // set bookmarks for success and failure
         $harmoni->history->markReturnURL("polyphony/display_login");
         $harmoni->history->markReturnURL("polyphony/login_fail", $harmoni->request->quickURL("user", "main"));
         $harmoni->request->startNamespace("harmoni-authentication");
         $usernameField = $harmoni->request->getName("username");
         $passwordField = $harmoni->request->getName("password");
         $harmoni->request->endNamespace();
         $harmoni->request->startNamespace("polyphony");
         print "\n<div style='text-align: right'>" . "\n<form action='" . $harmoni->request->quickURL("auth", "login") . "' align='right' method='post'><small>" . "\n\t" . _("Username:") . " <input type='text' size='8' \n\t\t\t\t\tname='{$usernameField}'/>" . "\n\t" . _("Password:") . " <input type='password' size ='8' \n\t\t\t\t\tname='{$passwordField}'/>" . "\n\t <input type='submit' value='Log In' />" . "\n</small></form></div>\n";
         $harmoni->request->endNamespace();
     }
     $loginRow->add(new Component(ob_get_clean(), BLANK, 2), null, null, RIGHT, TOP);
     // User tools
     ob_start();
     print "<div style='font-size: small; margin-top: 8px;'>";
     print "<a href='" . $harmoni->request->quickURL("user", "main") . "'>";
     print _("User Tools");
     print "</a>";
     print " | ";
     print "<a href='" . $harmoni->request->quickURL("admin", "main") . "'>";
     print _("Admin Tools");
     print "</a>";
     print "</div>";
//.........这里部分代码省略.........
开发者ID:adamfranco,项目名称:concerto,代码行数:101,代码来源:display.act.php

示例10: printAssetFunctionLinks


//.........这里部分代码省略.........
                 } else {
                     $links[] = _("Browse");
                 }
             }
         } catch (UnimplementedException $e) {
             //
         }
     }
     //===== Edit Link =====//
     // 		$harmoni->history->markReturnURL("concerto/asset/edit-return",
     // 			$harmoni->request->mkURL(null, null, $params));
     //
     // 		if ($includeEditDelete) {
     // 			if ($authZ->isUserAuthorized(
     // 					$idManager->getId("edu.middlebury.authorization.modify"),
     // 					$assetId)) {
     // 				if ($actionString != "asset.edit") {
     // 					$links[] = "<a href='".$harmoni->request->quickURL(
     // 						"asset", "edit",
     // 						array("collection_id" => $repositoryId->getIdString(),
     // 						"assets" => $assetId->getIdString()))."'>";
     // 					$links[count($links) - 1] .= _("Edit")."</a>";
     // 				} else
     // 					$links[] = _("Edit");
     // 			}
     //===== Delete Link =====//
     // 			if ($authZ->isUserAuthorized(
     // 					$idManager->getId("edu.middlebury.authorization.delete"),
     // 					$assetId))
     // 			{
     // 				// If we are viewing the asset and we delete it, we can't return
     // 				// to viewing it.
     // 				if (preg_match("/^asset\..*$/", $actionString) &&
     // 						$harmoni->request->get("asset_id") ==
     // 						$assetId->getIdString())
     // 				{
     // 					$deleteParams = $params;
     // 					unset ($deleteParams['asset_id']);
     // 					$harmoni->history->markReturnURL("concerto/asset/delete-return",
     // 						$harmoni->request->mkURL('collection', 'browse', $deleteParams));
     // 				}
     // 				// otherwise, go bact to where we are.
     // 				else {
     // 					$harmoni->history->markReturnURL("concerto/asset/delete-return",
     // 						$harmoni->request->mkURL(null, null, $params));
     // 				}
     // 				ob_start();
     // 				print "<a href='Javascript:deleteAsset(\"".$assetId->getIdString().
     // 					"\", \"".$repositoryId->getIdString()."\", \"".
     // 					$harmoni->request->quickURL("asset", "delete",
     // 					array("collection_id" => $repositoryId->getIdString(),
     // 					"asset_id" => $assetId->getIdString()))."\");'>";
     // 				print _("Delete")."</a>";
     // 				$links[] = ob_get_contents();
     // 				ob_end_clean();
     //
     // 				print "\n<script type='text/javascript'>\n//<![CDATA[";
     // 				print "\n	function deleteAsset(assetId, repositoryId, url) {";
     // 				print "\n		if (confirm(\""._("Are you sure you want to delete this Asset?")."\")) {";
     // 				print "\n			window.location = url;";
     // 				print "\n		}";
     // 				print "\n	}";
     // 				print "\n//]]>\n</script>\n";
     // 			}
     //===== Add Child Asset Link =====//
     // 			if ($authZ->isUserAuthorized(
     // 					$idManager->getId("edu.middlebury.authorization.add_children"),
     // 					$assetId)) {
     // 				if (preg_match("/^asset\..*$/", $actionString) &&
     // 						$harmoni->request->get("asset_id") ==
     // 						$assetId->getIdString()) {
     // 					$links[] = "<a href='".$harmoni->request->quickURL(
     // 						"asset", "add",
     // 						array("collection_id" => $repositoryId->getIdString(),
     // 						"parent" => $assetId->getIdString()))."'>";
     // 					$links[count($links) - 1] .= _("Add Child <em>Asset</em>").
     // 						"</a>";
     // 		//===== Import Link =====//
     // 	// 				$harmoni->request->startNamespace("import");
     // 	// 				$links[] = "<a href='".$harmoni->request->quickURL(
     // 	// 					"asset", "import",
     // 	// 					array("collection_id" => $repositoryId->getIdString(),
     // 	// 					"asset_id" => $assetId->getIdString()))."'>".
     // 	// 					_("Import Child <em>Asset(s)</em>")."</a>";
     // 	// 				$harmoni->request->endNamespace();
     // 				}
     // 			}
     // 		}
     //===== Basket Link =====//
     try {
         $isAuthorized = $authZ->isUserAuthorized($idManager->getId("edu.middlebury.authorization.view"), $assetId);
     } catch (UnknownIdException $e) {
         $isAuthorized = true;
     }
     if ($isAuthorized) {
         $basket = Basket::instance();
         $links[] = $basket->getAddLink($assetId);
     }
     print implode("\n\t | ", $links);
 }
开发者ID:adamfranco,项目名称:concerto,代码行数:101,代码来源:AssetPrinter.static.php

示例11: canView

 public static function canView($assetId)
 {
     $authZ = Services::getService("AuthZ");
     $idManager = Services::getService("Id");
     try {
         if ($authZ->isUserAuthorized($idManager->getId("edu.middlebury.authorization.view"), $assetId)) {
             return TRUE;
         } else {
             $basket = Basket::instance();
             $basket->removeItem($assetId);
             return FALSE;
         }
     } catch (UnknownIdException $e) {
         return true;
     }
 }
开发者ID:adamfranco,项目名称:polyphony,代码行数:16,代码来源:view.act.php


注:本文中的Basket::instance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。