本文整理汇总了PHP中Services类的典型用法代码示例。如果您正苦于以下问题:PHP Services类的具体用法?PHP Services怎么用?PHP Services使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Services类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_extractor
public static function get_extractor($vertical, $cart, $customFieldsModel)
{
$extra_fields = "";
switch ('retail') {
//($vertical) {
case 'retail':
require 'Retail.php';
$retail_model = new Retail();
$extra_fields = $retail_model->getFields($cart, $customFieldsModel);
break;
case 'ticketing':
require 'Ticketing.php';
$ticketing_model = new Ticketing();
$extra_fields = $ticketing_model->getFields($cart, $customFieldsModel);
break;
case 'services':
require 'Services.php';
$services_model = new Services();
$extra_fields = $services_model->getFields($cart, $customFieldsModel);
break;
case 'digital':
require 'Digitalgoods.php';
$digitalgoods_model = new Digitalgoods();
$extra_fields = $digitalgoods_model->getFields($cart, $customFieldsModel);
break;
default:
require 'Retail.php';
$retail_model = new Retail();
$extra_fields = $retail_model->getFields($cart, $customFieldsModel);
break;
}
return $extra_fields;
}
示例2: setUp
public function setUp()
{
$services = new Services();
$services->set('depA', 'a');
$services->set('depB', 'b');
$services->set('Exception', new \Exception());
$this->manager = new Manager($services);
}
示例3: getServicesObject
/**
* Get the services object
*
* @return Services
*/
public function getServicesObject()
{
/*
*
* !! IMPORTANT !!
*
* We can't use the classmap for the Services key because Services is
* reserved by PHP SOAP and will therefore always return an stdClass.
*
*/
$oServices = new Services();
$oServices->setService($this->Services->Service);
return $oServices;
}
示例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: getAZIcon
/**
* Answer the html string for an icon that displays authorization state
*
* @param object Id $qualifierId
* @return string
* @access public
* @static
* @since 11/29/06
*/
static function getAZIcon($qualifierId)
{
ob_start();
$authZ = Services::getService("AuthZ");
$idManager = Services::getService("Id");
try {
$isAuthorized = $authZ->isUserAuthorized($idManager->getId("edu.middlebury.authorization.view_authorizations"), $qualifierId);
} catch (UnknownIdException $e) {
$isAuthorized = $authZ->isUserAuthorized($idManager->getId("edu.middlebury.authorization.view_authorizations"), $idManager->getId("edu.middlebury.authorization.root"));
}
if ($isAuthorized) {
$onclick = "onclick=\"AuthZViewer.run('" . addslashes($qualifierId->getIdString()) . "', this);\" style='cursor: pointer;' ";
} else {
$onclick = '';
}
try {
$isPublicAuthorized = $authZ->isAuthorized($idManager->getId("edu.middlebury.agents.everyone"), $idManager->getId("edu.middlebury.authorization.view"), $qualifierId);
} catch (UnknownIdException $e) {
$isPublicAuthorized = true;
}
if ($isPublicAuthorized) {
print "\n<img class='az_icon' src='" . POLYPHONY_PATH . "/icons/view_public.gif' alt='" . "Public-Viewable" . "' title='" . "Public-Viewable" . "' " . $onclick . "/> ";
} else {
if ($authZ->isAuthorized($idManager->getId("edu.middlebury.agents.users"), $idManager->getId("edu.middlebury.authorization.view"), $qualifierId) || $authZ->isAuthorized($idManager->getId("edu.middlebury.institute"), $idManager->getId("edu.middlebury.authorization.view"), $qualifierId)) {
print "\n<img class='az_icon' src='" . POLYPHONY_PATH . "/icons/view_institute.gif' alt='" . "Institution-Viewable" . "' title='" . "Institution-Viewable" . "' " . $onclick . "/> ";
} else {
print "\n<img class='az_icon' src='" . POLYPHONY_PATH . "/icons/view_limited.gif' alt='" . "Viewable by some people" . "' title='" . "Viewable by some people" . "' " . $onclick . "/> ";
}
}
return ob_get_clean();
}
示例6: __construct
/**
* Constructor
*
* @param integer dbIndex The database connection as returned by the DBHandler.
* @return object
* @access public
* @since 2/8/05
*/
function __construct()
{
$idManager = Services::getService("Id");
$this->id = $idManager->getId("edu.middlebury.agents.anonymous");
$this->type = new Type("Agents", "edu.middlebury.harmoni", "Any/Anonymous", _("Special users that can represent anyone or unknown users."));
$this->propertiesArray = array();
}
示例7: visitBlock
/**
* Visit a Block
*
* @param object BlockSiteComponent $siteComponent
* @return mixed
* @access public
* @since 1/26/09
*/
public function visitBlock(BlockSiteComponent $siteComponent)
{
$view = new Participation_View($siteComponent);
$idMgr = Services::getService('Id');
$azMgr = Services::getService('AuthZ');
// get create actions
if ($azMgr->isUserAuthorized($idMgr->getId('edu.middlebury.authorization.modify'), $siteComponent->getQualifierId()) == TRUE) {
$this->_actions[] = new Participation_CreateAction($view, $siteComponent);
}
// get comment actions
$commentsManager = CommentManager::instance();
$comments = $commentsManager->getAllComments($siteComponent->getAsset(), DESC);
while ($comments->hasNext()) {
$comment = $comments->next();
if ($azMgr->isUserAuthorized($idMgr->getId('edu.middlebury.authorization.comment'), $siteComponent->getQualifierId()) == TRUE) {
$this->_actions[] = new Participation_CommentAction($view, $comment);
}
}
// get history actions
$pluginManager = Services::getService('PluginManager');
$plugin = $pluginManager->getPlugin($siteComponent->getAsset());
if ($plugin->supportsVersioning()) {
$versions = $plugin->getVersions();
$firstVersion = 0;
foreach ($versions as $version) {
if ($version->getNumber() != 1) {
if ($azMgr->isUserAuthorized($idMgr->getId('edu.middlebury.authorization.modify'), $siteComponent->getQualifierId()) == TRUE) {
$this->_actions[] = new Participation_HistoryAction($view, $siteComponent, $version);
}
}
}
}
}
示例8: indexAction
public function indexAction()
{
$this->view->bodyClass = 'pg-interna';
$vista = Services::get('vista_rest');
$this->view->listas = $vista->getListasBusca();
$form = new Site_Form_FaleConoscoForm();
$this->view->form = $form;
$params = $this->_request->getParams();
$this->view->headScript()->appendFile($this->view->serverUrl() . BASEDIR . '/res/js/quem-somos.js');
$vista = Services::get('vista_rest');
$users = $vista->getDadosUsuarios();
$grouped = array();
$groups = array();
array_walk($users, function ($user) use(&$grouped, &$groups) {
$group = String::RemoveIndex($user['Equipesite']);
$groups[] = strtolower($group);
$grouped[$group][] = $user;
});
$title = 'Equipe AG3 Imóveis';
$filterGroup = $this->getRequest()->getParam('t');
if (in_array($filterGroup, $groups)) {
$title = ucwords($filterGroup);
$grouped = array($title => $grouped[$title]);
}
$this->view->showGroups = !in_array($filterGroup, $groups);
$this->view->title = $title;
$this->view->users = $grouped;
}
示例9: getFileParts
/**
* Exporter of partstructures
*
* Adds partstructure elements to the xml, which contain the necessary
* information to create the same partstructure.
*
* @access public
* @since 12/6/06
*/
function getFileParts()
{
$idManager = Services::getService("Id");
$this->_info = array();
$FILE_URL_ID = $idManager->getId("FILE_URL");
$FILE_NAME_ID = $idManager->getId("FILE_NAME");
$FILE_SIZE_ID = $idManager->getId("FILE_SIZE");
$FILE_DIME_ID = $idManager->getId("DIMENSIONS");
$MIME_TYPE_ID = $idManager->getId("MIME_TYPE");
$THUMB_DATA_ID = $idManager->getId("THUMBNAIL_DATA");
$THUMB_MIME_ID = $idManager->getId("THUMBNAIL_MIME_TYPE");
$THUMB_DIME_ID = $idManager->getId("THUMBNAIL_DIMENSIONS");
$parts = $this->_object->getPartsByPartStructure($FILE_URL_ID);
if ($parts->count() == 1) {
$part = $parts->next();
$this->_info['f_url'] = $part->getValue();
}
$parts = $this->_object->getPartsByPartStructure($FILE_NAME_ID);
if ($parts->count() == 1) {
$part = $parts->next();
$path = $this->_fileDir . "/" . $part->getValue();
// CHECK FOR FILE NAME UNIQUENESS HERE
// $this->_dataFile = fopen($path, "wb");
$this->_info['f_name'] = basename($path);
}
$parts = $this->_object->getPartsByPartStructure($FILE_SIZE_ID);
if ($parts->count() == 1) {
$part = $parts->next();
$this->_info['f_size'] = $part->getValue();
}
$parts = $this->_object->getPartsByPartStructure($FILE_DIME_ID);
if ($parts->count() == 1) {
$part = $parts->next();
$this->_info['f_dime'] = $part->getValue();
}
$parts = $this->_object->getPartsByPartStructure($MIME_TYPE_ID);
if ($parts->count() == 1) {
$part = $parts->next();
$this->_info['f_mime'] = $part->getValue();
}
$path = $this->_fileDir . "/THUMB_" . $this->_info['f_name'];
$this->_info['t_name'] = basename($path);
$this->_thumbFile = fopen($path, "wb");
$parts = $this->_object->getPartsByPartStructure($THUMB_DATA_ID);
if ($parts->count() == 1) {
$part = $parts->next();
fwrite($this->_thumbFile, $part->getValue());
fclose($this->_thumbFile);
}
$parts = $this->_object->getPartsByPartStructure($THUMB_MIME_ID);
if ($parts->count() == 1) {
$part = $parts->next();
$this->_info['t_mime'] = $part->getValue();
}
$parts = $this->_object->getPartsByPartStructure($THUMB_DIME_ID);
if ($parts->count() == 1) {
$part = $parts->next();
$this->_info['t_dime'] = $part->getValue();
}
}
示例10: login
public function login($email = false, $passwd = false)
{
$email || ($email = $this->getPost('email'));
$passwd || ($passwd = $this->getPost('passwd'));
$orbit = new Orbit();
$client = $orbit->get('client/login', 1, 1, array('email' => $email, 'passwd' => $passwd));
if ($client['status'] == 200) {
$phones = $orbit->get('client/phones/' . $client['uid']['id']);
UID::set($client['uid']);
UID::set('phones', $phones['phones']);
$orbit = new Orbit();
$favRequest = $orbit->get('client/countfav', 1, 1, array('id' => UID::get('id')));
$favs = $favRequest['fav'];
$cartRequest = $orbit->get('client/countcart', 1, 1, array('id' => UID::get('id')));
$carts = $cartRequest['cart'];
$this->commitReplace($carts, '#cartitems');
$this->commitReplace($favs, '#favitems');
$product_id = $this->getQueryString('product_id');
if ($product_id) {
$productPage = Services::get('products');
$productPage->setId($product_id);
$productPage->viewProduct();
return;
}
$home = Services::get('home');
$home->homePage();
return;
}
$this->commitReplace('O e-mail e senha não foram encontrados', '#loginmsg');
$this->commitShow('#loginmsg');
}
示例11: execute
/**
* @see lib/modules/CommandModule::execute()
*/
public function execute($user, $target, $message)
{
// split message
$messageEx = explode(' ', $message);
if ($target[0] != '#') {
$target = $messageEx[1];
unset($messageEx[1]);
$messageEx = array_values($messageEx);
}
$access = $this->bot->getAccess($target, Services::getUserManager()->getUser($user->getUuid())->accountname);
if ($access < $this->bot->getNeededAccess($target, $this->originalName)) {
return $this->bot->sendMessage($user->getUuid(), Services::getLanguage()->get($user->languageID, 'command.permissionDenied'));
}
if (count($messageEx) == 2) {
// check target access
if ($access < $this->bot->getAccess($target, Services::getUserManager()->getUserByNick($messageEx[1])->accountname)) {
return $this->bot->sendMessage($user->getUuid(), Services::getLanguage()->get($user->languageID, 'command.permissionDenied'));
} else {
Services::getConnection()->getProtocol()->sendKick($this->bot->getUuid(), $target, $messageEx[1], $user->getNick());
}
$this->bot->sendMessage($user->getUuid(), Services::getLanguage()->get($user->languageID, 'command.' . $this->originalName . '.success'));
} else {
unset($messageEx[0]);
$username = $messageEx[1];
unset($messageEx[1]);
// check target access
// todo: abort when target has no account
if ($access < $this->bot->getAccess($target, Services::getUserManager()->getUserByNick($username)->accountname)) {
return $this->bot->sendMessage($user->getUuid(), Services::getLanguage()->get($user->languageID, 'command.permissionDenied'));
} else {
Services::getConnection()->getProtocol()->sendKick($this->bot->getUuid(), $target, $username, $user->getNick() . ': ' . implode(' ', $messageEx));
}
$this->bot->sendMessage($user->getUuid(), Services::getLanguage()->get($user->languageID, 'command.' . $this->originalName . '.success'));
}
}
示例12: buildContent
/**
* Build the content for this action
*
* @return void
* @access public
* @since 4/26/05
*/
function buildContent()
{
$actionRows = $this->getActionRows();
$harmoni = Harmoni::instance();
$idManager = Services::getService("Id");
$repositoryManager = Services::getService("Repository");
$repository = $repositoryManager->getRepository($idManager->getId(RequestContext::value('collection_id')));
$asset = $repository->getAsset($idManager->getId(RequestContext::value('asset_id')));
// Remove this asset from the tagging manager
$tagManager = Services::getService('Tagging');
$tagManager->deleteItems(TaggedItem::forId($asset->getId(), 'concerto'));
// Log the action
if (Services::serviceRunning("Logging")) {
$loggingManager = Services::getService("Logging");
$log = $loggingManager->getLogForWriting("Concerto");
$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("Delete Node", "Asset deleted:\n<br/> " . $asset->getDisplayName());
$item->addNodeId($asset->getId());
$item->addNodeId($repository->getId());
$log->appendLogWithTypes($item, $formatType, $priorityType);
}
$repository->deleteAsset($idManager->getId(RequestContext::value('asset_id')));
$harmoni->history->goBack("concerto/asset/delete-return");
}
示例13: searchAssets
/**
* Get the ids of the assets that match the search criteria
*
* @param mixed $searchCriteria
* @return array
* @access public
* @since 11/2/04
*/
function searchAssets($searchCriteria)
{
$matchingIds = array();
$recordMgr = Services::getService("RecordManager");
$schemaMgr = Services::getService("SchemaManager");
$repositoryMgr = Services::getService("Repository");
$schema = $schemaMgr->getSchemaByID($searchCriteria['RecordStructureId']->getIdString());
if ($searchCriteria['AuthoritativeValue']->asString() == '__NonMatching__') {
$authoritativeValueArray = array();
$recordStructure = $this->_repository->getRecordStructure($searchCriteria['RecordStructureId']);
$partStructure = $recordStructure->getPartStructure($searchCriteria['PartStructureId']);
$criteria = new FieldValueSearch($searchCriteria['RecordStructureId']->getIdString(), $schema->getFieldLabelFromID($searchCriteria['PartStructureId']->getIdString()), $partStructure->getAuthoritativeValues(), SEARCH_TYPE_NOT_IN_LIST);
} else {
$criteria = new FieldValueSearch($searchCriteria['RecordStructureId']->getIdString(), $schema->getFieldLabelFromID($searchCriteria['PartStructureId']->getIdString()), $searchCriteria['AuthoritativeValue'], SEARCH_TYPE_EQUALS);
}
// Get the asset Ids to limit to.
$allAssets = $this->_repository->getAssets();
$idStrings = array();
while ($allAssets->hasNext()) {
$asset = $allAssets->next();
$id = $asset->getId();
$idStrings[] = $id->getIdString();
}
// Run the search
$matchingIds = array_unique($recordMgr->getRecordSetIDsBySearch($criteria, $idStrings));
// Ensure uniqueness and convert the ids to id objects.
$matchingIds = array_unique($matchingIds);
sort($matchingIds);
$idManager = Services::getService("Id");
for ($i = 0; $i < count($matchingIds); $i++) {
$matchingIds[$i] = $idManager->getId($matchingIds[$i]);
}
// Return the array
return $matchingIds;
}
示例14: 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();
// function links
ob_start();
print _("Collection") . ": ";
RepositoryPrinter::printRepositoryFunctionLinks($harmoni, $repository);
$layout = new Block(ob_get_contents(), 3);
ob_end_clean();
$actionRows->add($layout, "100%", null, LEFT, CENTER);
$repositoryManager = Services::getService("Repository");
// Get all the types
$types = $repository->getAssetTypes();
// put the drs into an array and order them.
$typeArray = array();
while ($types->hasNext()) {
$type = $types->next();
$typeArray[$type->getDomain() . " " . $type->getAuthority() . " " . $type->getKeyword()] = $type;
}
ksort($typeArray);
// print the Results
$resultPrinter = new ArrayResultPrinter($typeArray, 2, 20, "printTypeShort", $repository->getId());
$resultPrinter->addLinksStyleProperty(new MarginTopSP("10px"));
$resultLayout = $resultPrinter->getLayout();
$actionRows->add($resultLayout, "100%", null, LEFT, CENTER);
}
示例15: createComponentForPartStructure
/**
* Create a new PrimitiveIO object that allows for selection from an authority
* list
*
* @param <##>
* @return <##>
* @access public
* @since 5/1/06
*/
static function createComponentForPartStructure($partStruct)
{
ArgumentValidator::validate($partStruct, ExtendsValidatorRule::getRule("PartStructure"));
$partStructType = $partStruct->getType();
// get the datamanager data type
$dataType = $partStructType->getKeyword();
// printpre($dataType);
$authoritativeValues = $partStruct->getAuthoritativeValues();
if ($authoritativeValues->hasNext()) {
$authZManager = Services::getService("AuthZ");
$idManager = Services::getService("Id");
if ($authZManager->isUserAuthorized($idManager->getId("edu.middlebury.authorization.modify_authority_list"), $partStruct->getRepositoryId())) {
$component = new PrimitiveIO_AuthoritativeContainer();
$component->setSelectComponent(PrimitiveIOManager::createAuthoritativeComponent($dataType));
$component->setNewComponent(PrimitiveIOManager::createComponent($dataType));
} else {
$component = PrimitiveIOManager::createAuthoritativeComponent($dataType);
}
while ($authoritativeValues->hasNext()) {
$component->addOptionFromSObject($authoritativeValues->next());
}
} else {
// get the simple component for this data type
$component = PrimitiveIOManager::createComponent($dataType);
}
return $component;
}