本文整理汇总了PHP中Type::getAuthority方法的典型用法代码示例。如果您正苦于以下问题:PHP Type::getAuthority方法的具体用法?PHP Type::getAuthority怎么用?PHP Type::getAuthority使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Type
的用法示例。
在下文中一共展示了Type::getAuthority方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: isEqual
/**
*
* @param object Type $type2
*
* @return boolean
*
* @access public
*/
public final function isEqual(Type $type2)
{
if (null != $type2 && null != $type2->getDomain() && null != $type2->getAuthority() && null != $type2->getKeyword() && null != $this->getDomain() && null != $this->getAuthority() && null != $this->getKeyword()) {
return $this->getDomain() == $type2->getDomain() && $this->getAuthority() == $type2->getAuthority() && $this->getKeyword() == $type2->getKeyword() ? TRUE : FALSE;
}
return false;
}
示例2: getGroupsBySearch
/**
* Get all the groups with the specified search criteria and search Type.
*
* @param object mixed $searchCriteria (original type: java.io.Serializable)
* @param object Type $groupSearchType
*
* @return object AgentIterator
*
* @throws object AgentException An exception with one of the
* following messages defined in org.osid.agent.AgentException may
* be thrown: {@link
* org.osid.agent.AgentException#OPERATION_FAILED
* OPERATION_FAILED}, {@link
* org.osid.agent.AgentException#PERMISSION_DENIED
* PERMISSION_DENIED}, {@link
* org.osid.agent.AgentException#CONFIGURATION_ERROR
* CONFIGURATION_ERROR}, {@link
* org.osid.agent.AgentException#UNIMPLEMENTED UNIMPLEMENTED},
* {@link org.osid.agent.AgentException#NULL_ARGUMENT
* NULL_ARGUMENT}, {@link
* org.osid.agent.AgentException#UNKNOWN_TYPE UNKNOWN_TYPE}
*
* @access public
*/
function getGroupsBySearch($searchCriteria, Type $groupSearchType)
{
$typeString = $groupSearchType->getDomain() . "::" . $groupSearchType->getAuthority() . "::" . $groupSearchType->getKeyword();
// get the Group Search object
$groupSearch = $this->_groupSearches[$typeString];
if (!is_object($groupSearch)) {
throwError(new Error(AgentException::UNKNOWN_TYPE() . ", " . $groupSearchType->asString(), "GroupManager", true));
}
return $groupSearch->getGroupsBySearch($searchCriteria);
}
示例3: SelectQuery
/**
* Get the key of the type.
*
* @param object Type $type
* @return integer
* @access private
* @since 3/9/05
*/
function _getTypeKey(Type $type)
{
$dbc = Services::getService("DatabaseManager");
// Check if the type exists and return its key if found.
$query = new SelectQuery();
$query->addTable($this->_typeTable);
$query->addColumn('id');
$query->addWhere("domain='" . addslashes($type->getDomain()) . "'");
$query->addWhere("authority='" . addslashes($type->getAuthority()) . "'", _AND);
$query->addWhere("keyword='" . addslashes($type->getKeyword()) . "'", _AND);
$result = $dbc->query($query, $this->_dbId);
if ($result->getNumberOfRows() == 1) {
return $result->field('id');
} else {
$result->free();
$query = new InsertQuery();
$query->setTable($this->_typeTable);
$query->setAutoIncrementColumn("id", $this->_typeTable . "_id_seq");
$query->setColumns(array('domain', 'authority', 'keyword', 'description'));
$query->setValues(array("'" . addslashes($type->getDomain()) . "'", "'" . addslashes($type->getAuthority()) . "'", "'" . addslashes($type->getKeyword()) . "'", "'" . addslashes($type->getDescription()) . "'"));
$result = $dbc->query($query, $this->_dbId);
return $result->getLastAutoIncrementValue();
}
}
示例4: SelectQuery
function _loadPlugins()
{
// cache the installed plugins
$db = Services::getService("DBHandler");
$pm = Services::getService("Plugs");
$query = new SelectQuery();
$query->addTable("plugin_type");
$query->addColumn("*");
$query->addOrderBy('type_id');
$results = $db->query($query, IMPORTER_CONNECTION);
$dis = array();
$en = array();
while ($results->hasNext()) {
$result = $results->next();
$pluginType = new Type($result['type_domain'], $result['type_authority'], $result['type_keyword']);
$class = $this->getPluginClass($pluginType);
if (class_exists($class)) {
$pluginType = new Type($pluginType->getDomain(), $pluginType->getAuthority(), $pluginType->getKeyword(), call_user_func(array($class, 'getPluginDescription')));
}
if ($result['type_enabled'] == 1) {
$this->_enabledPlugins[HarmoniType::typeToString($pluginType)] = $pluginType;
} else {
$this->_disabledPlugins[HarmoniType::typeToString($pluginType)] = $pluginType;
}
}
$this->_cachePluginArrays();
}
示例5: createRootNode
/**
* Attempts to create the specified node as root node in the database.
* @access public
* @param object nodeId The id of the node.
* @param object type The type of the node.
* @param string displayName The display name of the node.
* @param string description The description of the node.
* @return void
**/
function createRootNode(Id $nodeId, Type $type, $displayName, $description)
{
// ** parameter validation
$stringRule = StringValidatorRule::getRule();
ArgumentValidator::validate($displayName, $stringRule, true);
ArgumentValidator::validate($description, $stringRule, true);
// ** end of parameter validation
// check that the node does not exist in the cache
$idValue = $nodeId->getIdString();
if ($this->_isCached($idValue)) {
// The node has already been cached!
throw new OperationFailedException("Node, '{$idValue}' is already cached.");
}
// attempt to insert the node now
$dbHandler = Services::getService("DatabaseManager");
// 1. Insert the type
$domain = $type->getDomain();
$authority = $type->getAuthority();
$keyword = $type->getKeyword();
$typeDescription = $type->getDescription();
// check whether the type is already in the DB, if not insert it
if (isset($this->harmoni_db)) {
if (!isset($this->createRootNode_selectType_stmt)) {
$query = $this->harmoni_db->select();
$query->addTable("az2_node_type");
$query->addColumn("id");
$query->addWhereRawEqual("domain", '?');
$query->addWhereRawEqual("authority", '?');
$query->addWhereRawEqual("keyword", '?');
$this->createRootNode_selectType_stmt = $query->prepare();
}
$this->createRootNode_selectType_stmt->bindValue(1, $domain);
$this->createRootNode_selectType_stmt->bindValue(2, $authority);
$this->createRootNode_selectType_stmt->bindValue(3, $keyword);
$this->createRootNode_selectType_stmt->execute();
$queryResult = $this->createRootNode_selectType_stmt->getResult();
} else {
$query = new SelectQuery();
$query->addTable("az2_node_type");
$query->addColumn("id");
$query->addWhereEqual("domain", $domain);
$query->addWhereEqual("authority", $authority);
$query->addWhereEqual("keyword", $keyword);
$queryResult = $dbHandler->query($query, $this->_dbIndex);
}
if ($queryResult->hasNext()) {
// if the type is already in the database
$typeIdValue = $queryResult->field("id");
// get the id
$queryResult->free();
} else {
// if not, insert it
$queryResult->free();
if (isset($this->harmoni_db)) {
if (!isset($this->createRootNode_insertType_stmt)) {
$query = $this->harmoni_db->insert();
$query->setTable("az2_node_type");
// $query->setAutoIncrementColumn("id", "az2_node_type_id_seq");
$query->addRawValue("domain", '?');
$query->addRawValue("authority", '?');
$query->addRawValue("keyword", '?');
$query->addRawValue("description", '?');
$this->createRootNode_insertType_stmt = $query->prepare();
}
$this->createRootNode_insertType_stmt->bindValue(1, $domain);
$this->createRootNode_insertType_stmt->bindValue(2, $authority);
$this->createRootNode_insertType_stmt->bindValue(3, $keyword);
$this->createRootNode_insertType_stmt->bindValue(4, $typeDescription);
$this->createRootNode_insertType_stmt->execute();
$queryResult = $this->createRootNode_insertType_stmt->getResult();
} else {
$query = new InsertQuery();
$query->setTable("az2_node_type");
$query->setAutoIncrementColumn("id", "az2_node_type_id_seq");
$query->addValue("domain", $domain);
$query->addValue("authority", $authority);
$query->addValue("keyword", $keyword);
$query->addValue("description", $typeDescription);
$queryResult = $dbHandler->query($query, $this->_dbIndex);
}
$typeIdValue = $queryResult->getLastAutoIncrementValue();
}
// 2. Now that we know the id of the type, insert the node itself
if (isset($this->harmoni_db)) {
if (!isset($this->createRootNode_insertNode_stmt)) {
$query = $this->harmoni_db->insert();
$query->setTable("az2_node");
$query->addRawValue("id", '?');
$query->addRawValue("display_name", '?');
$query->addRawValue("description", '?');
$query->addRawValue("fk_hierarchy", '?');
//.........这里部分代码省略.........
示例6: getAssetsBySearch
//.........这里部分代码省略.........
* org.osid.repository.RepositoryException#OPERATION_FAILED
* OPERATION_FAILED}, {@link
* org.osid.repository.RepositoryException#PERMISSION_DENIED
* PERMISSION_DENIED}, {@link
* org.osid.repository.RepositoryException#CONFIGURATION_ERROR
* CONFIGURATION_ERROR}, {@link
* org.osid.repository.RepositoryException#UNIMPLEMENTED
* UNIMPLEMENTED}, {@link
* org.osid.repository.RepositoryException#NULL_ARGUMENT
* NULL_ARGUMENT}, {@link
* org.osid.repository.RepositoryException#UNKNOWN_TYPE
* UNKNOWN_TYPE}
*
* @access public
*/
function getAssetsBySearch($searchCriteria, Type $searchType, Properties $searchProperties)
{
if ($searchProperties->getType()->isEqual(new Type('Repository', 'edu.middlebury', 'null'))) {
$searchProperties = null;
}
// Check that we support the searchType
$supported = FALSE;
foreach (array_keys($this->_searchTypes) as $key) {
if ($searchType->isEqual($this->_searchTypes[$key])) {
$supported = TRUE;
$searchName = $key;
break;
}
}
if ($supported) {
$search = new $searchName($this);
$assetIds = $search->searchAssets($searchCriteria, $searchProperties);
// get the assets for the resuting ids
$assets = array();
// Order
if (is_object($searchProperties) && $searchProperties->getProperty("order") == "DisplayName") {
foreach ($assetIds as $key => $id) {
$asset = $this->getAsset($assetIds[$key], FALSE);
$assets[$asset->getDisplayName() . $id->getIdString()] = $asset;
}
} else {
if (is_object($searchProperties) && $searchProperties->getProperty("order") == "Id") {
foreach ($assetIds as $key => $id) {
$assets[$assetIds[$key]->getIdString()] = $this->getAsset($assetIds[$key], FALSE);
}
} else {
if (is_object($searchProperties) && $searchProperties->getProperty("order") == "ModificationDate") {
foreach ($assetIds as $key => $id) {
$asset = $this->getAsset($assetIds[$key], FALSE);
$date = $asset->getModificationDate();
$assets[$date->asString() . $id->getIdString()] = $asset;
}
} else {
if (is_object($searchProperties) && $searchProperties->getProperty("order") == "CreationDate") {
foreach ($assetIds as $key => $id) {
$asset = $this->getAsset($assetIds[$key], FALSE);
$date = $asset->getCreationDate();
$assets[$date->asString() . $id->getIdString()] = $asset;
}
} else {
foreach ($assetIds as $key => $id) {
$assets[] = $this->getAsset($assetIds[$key], FALSE);
}
}
}
}
}
// Filter based on type
// This can probably be moved to the search modules to improve
// performance by eliminating these assets before they are otherwise
// operated on.
if (is_object($searchProperties) && is_array($searchProperties->getProperty("allowed_types")) && count($searchProperties->getProperty("allowed_types"))) {
$allowedTypes = $searchProperties->getProperty("allowed_types");
foreach (array_keys($assets) as $key) {
$type = $assets[$key]->getAssetType();
$allowed = FALSE;
foreach (array_keys($allowedTypes) as $typeKey) {
if ($type->isEqual($allowedTypes[$typeKey])) {
$allowed = TRUE;
break;
}
}
if (!$allowed) {
unset($assets[$key]);
}
}
}
// Order Direction
if (is_object($searchProperties) && $searchProperties->getProperty("direction") == "DESC") {
krsort($assets);
} else {
ksort($assets);
}
// create an AssetIterator and return it
$assetIterator = new HarmoniAssetIterator($assets);
return $assetIterator;
} else {
throwError(new Error(RepositoryException::UNKNOWN_TYPE() . " " . $searchType->getDomain() . "::" . $searchType->getAuthority() . "::" . $searchType->getKeyword(), "Repository", 1));
}
}
示例7: array
/**
* Answer the database id for the type passed.
*
* @param object Type $type
* @return string
* @access public
* @since 3/1/06
*/
function _getTypeId(Type $type)
{
if (!isset($this->_typeIds)) {
$this->_typeIds = array();
}
if (!isset($this->_typeIds[$type->asString()])) {
$dbc = Services::getService("DatabaseManager");
$query = new SelectQuery();
$query->addColumn("id");
$query->addTable("log_type");
$query->addWhere("domain = '" . addslashes($type->getDomain()) . "'");
$query->addWhere("authority = '" . addslashes($type->getAuthority()) . "'");
$query->addWhere("keyword = '" . addslashes($type->getKeyword()) . "'");
$results = $dbc->query($query, $this->_dbIndex);
if ($results->getNumberOfRows()) {
$this->_typeIds[$type->asString()] = $results->field("id");
$results->free();
} else {
$results->free();
$query = new InsertQuery();
$query->setTable("log_type");
$query->setAutoIncrementColumn("id", "log_type_id_seq");
$query->setColumns(array("domain", "authority", "keyword", "description"));
$query->addRowOfValues(array("'" . addslashes($type->getDomain()) . "'", "'" . addslashes($type->getAuthority()) . "'", "'" . addslashes($type->getKeyword()) . "'", "'" . addslashes($type->getDescription()) . "'"));
$results = $dbc->query($query, $this->_dbIndex);
$this->_typeIds[$type->asString()] = $results->getLastAutoIncrementValue();
}
}
return $this->_typeIds[$type->asString()];
}
示例8: typeToString
/**
* Convert an OKI Type to a delimited string
*
* @param object Type $aType
* @param string $glue
* @return string
* @access public
* @since 6/1/05
* @static
*/
public static function typeToString(Type $type, $delimiter = "::")
{
return $type->getDomain() . $delimiter . $type->getAuthority() . $delimiter . $type->getKeyword();
}
示例9: getNodesFromDbByType_Harmoni_Db
/**
* Answer the nodes matching a type
*
* @param object Type $type
* @return array
* @access private
* @since 4/3/08
*/
private function getNodesFromDbByType_Harmoni_Db(Type $type)
{
$this->getNodesByType_stmt->bindValue($this->getNodesByType_domain_key, $type->getDomain());
$this->getNodesByType_stmt->bindValue($this->getNodesByType_authority_key, $type->getAuthority());
$this->getNodesByType_stmt->bindValue($this->getNodesByType_keyword_key, $type->getKeyword());
$this->getNodesByType_stmt->execute();
$nodeQueryResult = $this->getNodesByType_stmt->fetchAll();
$this->getNodesByType_stmt->closeCursor();
$result = array();
$idManager = Services::getService("Id");
if (!count($nodeQueryResult)) {
throw new UnknownIdException("No nodes found for type " . $type->asString());
}
foreach ($nodeQueryResult as $nodeRow) {
$idValue = $nodeRow['id'];
$id = $idManager->getId($idValue);
$type = new HarmoniType($nodeRow['domain'], $nodeRow['authority'], $nodeRow['keyword'], $nodeRow['type_description']);
$node = new HarmoniNode($id, $type, $nodeRow['display_name'], $nodeRow['description'], $this);
$result[] = $node;
}
return $result;
}
示例10:
/**
* Return a string version of a type.
*
* @param object Type $type
* @return string
* @access private
* @since 3/15/05
*/
function _getTypeString(Type $type)
{
return $type->getDomain() . "::" . $type->getAuthority() . "::" . $type->getKeyword();
}