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


PHP Type::isEqual方法代码示例

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


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

示例1: getVisitorLoginLink

function getVisitorLoginLink()
{
    $harmoni = Harmoni::instance();
    $authN = Services::getService("AuthN");
    // Visitor Registration Link
    $authTypes = $authN->getAuthenticationTypes();
    $hasVisitorType = false;
    $visitorType = new Type("Authentication", "edu.middlebury.harmoni", "Visitors");
    while ($authTypes->hasNext()) {
        $authType = $authTypes->next();
        if ($visitorType->isEqual($authType)) {
            $hasVisitorType = true;
            break;
        }
    }
    if ($hasVisitorType && !$authN->isUserAuthenticatedWithAnyType()) {
        $harmoni->request->startNamespace('polyphony');
        $url = $harmoni->request->mkURL("auth", "login_type");
        $url->setValue("type", urlencode($visitorType->asString()));
        // Add return info to the visitor registration url
        $visitorReturnModules = array('view', 'ui1', 'ui2', 'versioning');
        if (in_array($harmoni->request->getRequestedModule(), $visitorReturnModules)) {
            $url->setValue('returnModule', $harmoni->request->getRequestedModule());
            $url->setValue('returnAction', $harmoni->request->getRequestedAction());
            $url->setValue('returnKey', 'node');
            $url->setValue('returnValue', SiteDispatcher::getCurrentNodeId());
        }
        $harmoni->request->endNamespace();
        return "\n\t<a href='" . $url->write() . "'>" . _("Visitor Login") . "</a>";
    }
    return null;
}
开发者ID:adamfranco,项目名称:segue,代码行数:32,代码来源:authentication-cas_default.conf.php

示例2: 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();
     print "<p>";
     print _("Below are listed the available <em>Collections</em>, organized by type, then name.");
     print "</p>\n<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>";
     $actionRows->add(new Block(ob_get_contents(), STANDARD_BLOCK), "100%", null, CENTER, CENTER);
     ob_end_clean();
     $exhibitionRepositoryType = new Type('System Repositories', 'edu.middlebury.concerto', 'Exhibitions');
     $repositoryManager = Services::getService("Repository");
     // Get all the types
     $types = $repositoryManager->getRepositoryTypes();
     // put the drs into an array and order them.
     $typeArray = array();
     while ($types->hasNext()) {
         $type = $types->next();
         // include all but Exhibitions repository.
         if (!$exhibitionRepositoryType->isEqual($type)) {
             $typeArray[HarmoniType::typeToString($type)] = $type;
         }
     }
     ksort($typeArray);
     // print the Results
     $resultPrinter = new ArrayResultPrinter($typeArray, 2, 20, "printTypeShort");
     $resultPrinter->addLinksStyleProperty(new MarginTopSP("10px"));
     $resultLayout = $resultPrinter->getLayout();
     $actionRows->add($resultLayout, null, null, CENTER, CENTER);
 }
开发者ID:adamfranco,项目名称:concerto,代码行数:40,代码来源:typebrowse.act.php

示例3: isAuthorizedToExecute

 /**
  * Check Authorizations
  * 
  * @return boolean
  * @access public
  * @since 6/4/08
  */
 function isAuthorizedToExecute()
 {
     $authNManager = Services::getService("AuthN");
     $authTypes = $authNManager->getAuthenticationTypes();
     $visitorType = new Type("Authentication", "edu.middlebury.harmoni", "Visitors");
     while ($authTypes->hasNext()) {
         $authType = $authTypes->next();
         if ($visitorType->isEqual($authType)) {
             return true;
         }
     }
     return false;
 }
开发者ID:adamfranco,项目名称:polyphony,代码行数:20,代码来源:visitor_reg.act.php

示例4: 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();
     print "<p>";
     print _("Below are listed the available <em>Collections</em>, organized by name.");
     print "</p>\n<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>";
     $actionRows->add(new Block(ob_get_contents(), STANDARD_BLOCK), "100%", null, CENTER, CENTER);
     ob_end_clean();
     // Get the Repositoriess
     $repositoryManager = Services::getService("Repository");
     $allRepositories = $repositoryManager->getRepositories();
     $exhibitionRepositoryType = new Type('System Repositories', 'edu.middlebury.concerto', 'Exhibitions');
     // put the drs into an array and order them.
     // @todo, do authorization checking
     $repositoryArray = array();
     $repositoryTitles = array();
     while ($allRepositories->hasNext()) {
         $repository = $allRepositories->next();
         // include all but Exhibitions repository.
         if (!$exhibitionRepositoryType->isEqual($repository->getType())) {
             $id = $repository->getId();
             $repositoryTitles[$id->getIdString()] = $repository->getDisplayName();
             $repositoryArray[$id->getIdString()] = $repository;
         }
     }
     array_multisort($repositoryTitles, SORT_ASC, SORT_STRING, $repositoryArray);
     // print the Results
     $resultPrinter = new ArrayResultPrinter($repositoryArray, 1, 20, "printRepositoryShort", $harmoni);
     $resultPrinter->addLinksStyleProperty(new MarginTopSP("10px"));
     $resultLayout = $resultPrinter->getLayout('canView');
     $actionRows->add($resultLayout, "100%", null, LEFT, CENTER);
 }
开发者ID:adamfranco,项目名称:concerto,代码行数:44,代码来源:namebrowse.act.php

示例5: getSiteAsset

 /**
  * Answer the Site asset for a content asset
  * 
  * @param object Asset $asset
  * @return object Asset
  * @access protected
  * @since 2/26/07
  */
 protected function getSiteAsset(Asset $asset)
 {
     $siteType = new Type('segue', 'edu.middlebury', 'SiteNavBlock');
     if ($siteType->isEqual($asset->getAssetType())) {
         return $asset;
     } else {
         $parents = $asset->getParents();
         while ($parents->hasNext()) {
             $result = $this->getSiteAsset($parents->next());
             if ($result) {
                 return $result;
             }
         }
     }
     return false;
 }
开发者ID:adamfranco,项目名称:segue,代码行数:24,代码来源:MediaAction.abstract.php

示例6: getAssetsBySearch

 /**
  * Perform a search of the specified Type and get all the Assets that
  * satisfy the SearchCriteria.	Iterators return a set, one at a time.
  * 
  * @param object mixed $searchCriteria (original type: java.io.Serializable)
  * @param object Type $searchType
  * @param object Properties $searchProperties
  *	
  * @return object AssetIterator
  * 
  * @throws object RepositoryException An exception with one of
  *		   the following messages defined in
  *		   org.osid.repository.RepositoryException may be thrown: {@link
  *		   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]);
                 }
             }
         }
//.........这里部分代码省略.........
开发者ID:adamfranco,项目名称:harmoni,代码行数:101,代码来源:HarmoniRepository.class.php

示例7: getParentComment

 /**
  * Answer the Content asset that a comment is attached to
  * 
  * @param object Id $commentId
  * @return object Asset
  * @access public
  * @static
  * @since 11/9/07
  */
 public function getParentComment()
 {
     $commentManager = CommentManager::instance();
     $commentContainerType = new Type('segue', 'edu.middlebury', 'comment_container', 'A container for Segue Comments');
     $parent = $this->_asset->getParents()->next();
     if ($commentContainerType->isEqual($parent->getAssetType())) {
         return null;
     } else {
         return $commentManager->getComment($parent);
     }
 }
开发者ID:adamfranco,项目名称:segue,代码行数:20,代码来源:CommentNode.class.php

示例8: getEntriesBySearch

 /**
  * Return the ReadableLog Entries in a last-in, first-out (LIFO) order.
  * Limit by the search criteria.
  *
  * Warning: NOT IN OSID
  * 
  * @param mixed $searchCriteria
  * @param object Type $searchType
  * @param object Type $formatType
  * @param object Type $priorityType
  *	
  * @return object EntryIterator
  * 
  * @throws object LoggingException An exception with one of the
  *		   following messages defined in org.osid.logging.LoggingException
  *		   may be thrown:	{@link
  *		   org.osid.logging.LoggingException#UNIMPLEMENTED UNIMPLEMENTED},
  *		   {@link org.osid.logging.LoggingException#OPERATION_FAILED
  *		   OPERATION_FAILED}, {@link
  *		   org.osid.logging.LoggingException#CONFIGURATION_ERROR
  *		   CONFIGURATION_ERROR}, {@link
  *		   org.osid.logging.LoggingException#PERMISSION_DENIED
  *		   PERMISSION_DENIED}, {@link
  *		   org.osid.logging.LoggingException#NULL_ARGUMENT NULL_ARGUMENT},
  *		   {@link org.osid.logging.LoggingException#UNKNOWN_TYPE
  *		   UNKNOWN_TYPE}
  * 
  * @access public
  */
 function getEntriesBySearch($searchCriteria, Type $searchType, Type $formatType, Type $priorityType)
 {
     $validType = new Type("logging_search", "edu.middlebury", "Date-Range/Agent/Node");
     if (!$validType->isEqual($searchType)) {
         throwError(new Error("Invalid search type, " . $searchType->asString() . ".", "Logging"));
     }
     $iterator = new SearchEntryIterator($this->_name, $searchCriteria, $formatType, $priorityType, $this->_dbIndex);
     return $iterator;
 }
开发者ID:adamfranco,项目名称:harmoni,代码行数:38,代码来源:HarmoniReadableLog.class.php

示例9: getCanonicalCoursesByType

 /**
  * Get all CanonicalCourses of the specified Type.
  * 
  * @param object Type $courseType
  *	
  * @return object CanonicalCourseIterator
  * 
  * @throws object CourseManagementException An exception
  *		   with one of the following messages defined in
  *		   org.osid.coursemanagement.CourseManagementException may be
  *		   thrown:	{@link
  *		   org.osid.coursemanagement.CourseManagementException#OPERATION_FAILED
  *		   OPERATION_FAILED}, {@link
  *		   org.osid.coursemanagement.CourseManagementException#PERMISSION_DENIED
  *		   PERMISSION_DENIED}, {@link
  *		   org.osid.coursemanagement.CourseManagementException#CONFIGURATION_ERROR
  *		   CONFIGURATION_ERROR}, {@link
  *		   org.osid.coursemanagement.CourseManagementException#UNIMPLEMENTED
  *		   UNIMPLEMENTED}, {@link
  *		   org.osid.coursemanagement.CourseManagementException#NULL_ARGUMENT
  *		   NULL_ARGUMENT}, {@link
  *		   org.osid.coursemanagement.CourseManagementException#UNKNOWN_TYPE
  *		   UNKNOWN_TYPE}
  * 
  * @access public
  */
 function getCanonicalCoursesByType(Type $courseType)
 {
     $cm = Services::getService("CourseManagement");
     //get the children
     $node = $this->_node;
     $nodeType = $node->getType();
     $children = $node->getChildren();
     //iterate throught the children
     $array = array();
     while ($children->hasNextNode()) {
         $child = $children->nextNode();
         $currNodeType = $child->getType();
         //If this node is also a CanonicalCourse
         if ($currNodeType->isEqual($nodeType)) {
             $id = $child->getId();
             $course = $cm->getCanonicalCourse($id);
             if ($courseType->isEqual($course->getCourseType())) {
                 $array[] = $cm->getCanonicalCourse($id);
             }
         }
     }
     //convert to an iterator and return
     $ret = new HarmoniCanonicalCourseIterator($array);
     return $ret;
 }
开发者ID:adamfranco,项目名称:harmoni,代码行数:51,代码来源:CanonicalCourse.class.php

示例10: getPropertiesByType

 /**
  * Get the Properties of this Type associated with this Group.
  * 
  * @param object Type $propertiesType
  *	
  * @return object Properties
  * 
  * @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 getPropertiesByType(Type $propertiesType)
 {
     if (!$propertiesType->isEqual(new Type('GroupProperties', 'edu.middlebury', 'LDAP Properties'))) {
         throw new UnknownTypeException("Unsupported Properties type.");
     }
     if (!isset($_SESSION['LDAP_GROUP_PROPERTIES'][$this->_idString])) {
         $properties = new HarmoniProperties(new Type('GroupProperties', 'edu.middlebury', 'LDAP Properties'));
         $properties->addProperty('identifier', $this->_idString);
         $propertiesFields = $this->_configuration->getProperty('group_properties_fields');
         if (is_array($propertiesFields)) {
             $fieldsToFetch = array();
             foreach ($propertiesFields as $propertyKey => $fieldName) {
                 $fieldsToFetch[] = $fieldName;
             }
             $info = $this->_authNMethod->_connector->getInfo($this->_idString, $fieldsToFetch);
             if (!$info) {
                 // store a null so that we won't keep trying to fetch data.
                 $_SESSION['LDAP_GROUP_PROPERTIES'][$this->_idString] = null;
                 throw new OperationFailedException("Could not fetch LDAP group info.");
             }
             foreach ($propertiesFields as $propertyKey => $fieldName) {
                 if (isset($info[$fieldName])) {
                     if (count($info[$fieldName]) <= 1) {
                         $properties->addProperty($propertyKey, $info[$fieldName][0]);
                     } else {
                         $properties->addProperty($propertyKey, $info[$fieldName]);
                     }
                 }
             }
         }
         $_SESSION['LDAP_GROUP_PROPERTIES'][$this->_idString] = $properties;
     }
     if (is_null($_SESSION['LDAP_GROUP_PROPERTIES'][$this->_idString])) {
         throw new OperationFailedException("Could not fetch LDAP group info.");
     }
     return $_SESSION['LDAP_GROUP_PROPERTIES'][$this->_idString];
 }
开发者ID:adamfranco,项目名称:harmoni,代码行数:60,代码来源:LDAPGroup.class.php

示例11: createWizard

 /**
  * Create a new Wizard for this action. Caching of this Wizard is handled by
  * {@link getWizard()} and does not need to be implemented here.
  * 
  * @return object Wizard
  * @access public
  * @since 4/28/05
  */
 function createWizard()
 {
     $repository = $this->getRepository();
     // Instantiate the wizard, then add our steps.
     $wizard = SimpleStepWizard::withDefaultLayout();
     // :: Step One ::
     $stepOne = $wizard->addStep("namedesc", new WizardStep());
     $stepOne->setDisplayName(_("Name & Description"));
     // Create the properties.
     $displayNameProp = $stepOne->addComponent("display_name", new WTextField());
     $displayNameProp->setErrorRule(new WECNonZeroRegex("[\\w]+"));
     $displayNameProp->setErrorText(_("A value for this field is required."));
     $descriptionProp = $stepOne->addComponent("description", WTextArea::withRowsAndColumns(5, 30));
     $formatProp = $stepOne->addComponent("format", new WTextField());
     $formatProp->setValue("Plain Text - UTF-8 encoding");
     $formatProp->setErrorRule(new WECNonZeroRegex("[\\w]+"));
     $formatProp->setErrorText(_("A value for this field is required."));
     $formatProp->setSize(25);
     // Create the step text
     ob_start();
     print "\n<h2>" . _("Name") . "</h2>";
     print "\n" . _("The Name for this Schema: ");
     print "\n<br />[[display_name]]";
     print "\n<h2>" . _("Description") . "</h2>";
     print "\n" . _("The Description for this Schema: ");
     print "\n<br />[[description]]";
     print "\n<h2>" . _("Format") . "</h2>";
     print "\n" . _("The format of data that is entered into the fields: ");
     print "\n<br /><em>" . _("'Plain Text - ASCII encoding', 'XML', etc.") . "</em>";
     print "\n<br />[[format]]";
     print "\n<div style='width: 400px'> &nbsp; </div>";
     $stepOne->setContent(ob_get_contents());
     ob_end_clean();
     // :: Add Elements ::
     $elementStep = $wizard->addStep("elementstep", new WizardStep());
     $elementStep->setDisplayName(_("Fields"));
     $multField = $elementStep->addComponent("elements", new WOrderedRepeatableComponentCollection());
     $multField->setAddLabel(_("Add New Field"));
     $multField->setRemoveLabel(_("Remove Field"));
     $property = $multField->addComponent("display_name", new WTextField());
     $property->setErrorRule(new WECNonZeroRegex("[\\w]+"));
     $property->setErrorText(_("A value for this property is required."));
     $property->setSize(20);
     $property = $multField->addComponent("description", WTextArea::withRowsAndColumns(2, 30));
     $property = $multField->addComponent("type", new WSelectList());
     $defaultType = new Type("Repository", "edu.middlebury.harmoni", "shortstring");
     $property->setValue(urlencode(HarmoniType::typeToString($defaultType, " :: ")));
     // We are going to assume that all RecordStructures have the same PartStructureTypes
     // in this Repository. This will allow us to list PartStructureTypes before
     // the RecordStructure is actually created.
     $recordStructures = $repository->getRecordStructures();
     if (!$recordStructures->hasNext()) {
         throwError(new Error("No RecordStructures available.", "Concerto"));
     }
     $dmpType = new Type("RecordStructures", "edu.middlebury.harmoni", "DataManagerPrimatives", "RecordStructures stored in the Harmoni DataManager.");
     $orderedTypes = array("Repository :: edu.middlebury.harmoni :: shortstring" => _("Short String ----- text with max-length of 256 characters"), "Repository :: edu.middlebury.harmoni :: string" => _("String  ---------- text with unlimited length"), "Repository :: edu.middlebury.harmoni :: datetime" => _("Date [and Time] -- a date or more precise point in time"), "Repository :: edu.middlebury.harmoni :: integer" => _("Integer --------- a whole number: 1, 2, 3, etc"), "Repository :: edu.middlebury.harmoni :: float" => _("Float ----------- a decimal/scientific-notation number"), "Repository :: edu.middlebury.harmoni :: boolean" => _("Boolean --------- true or false (yes/no)"), "Repository :: edu.middlebury.harmoni :: blob" => _("BLOB ----------- Binary Large OBject, for binary data"), "Repository :: edu.middlebury.harmoni :: okitype" => _("O.K.I. Type ------ 'domain :: authority :: keyword' triplet"));
     $unorderedTypes = array();
     while ($recordStructures->hasNext()) {
         // we want just the datamanager structure types, so just
         // get the first structure that has Format "DataManagerPrimatives"
         $tmpRecordStructure = $recordStructures->next();
         if ($dmpType->isEqual($tmpRecordStructure->getType())) {
             $types = $tmpRecordStructure->getPartStructureTypes();
             while ($types->hasNext()) {
                 $type = $types->next();
                 $typeString = $type->asString(" :: ");
                 if (!array_key_exists($typeString, $orderedTypes)) {
                     $unorderedTypes[$typeString] = $typeString;
                 }
             }
             break;
         }
     }
     foreach ($orderedTypes as $typeString => $desc) {
         $property->addOption(urlencode($typeString), $desc);
     }
     foreach ($unorderedTypes as $typeString => $desc) {
         $property->addOption(urlencode($typeString), $desc);
     }
     $property = $multField->addComponent("mandatory", new WCheckBox());
     $property->setChecked(false);
     $property->setLabel(_("yes"));
     $property = $multField->addComponent("repeatable", new WCheckBox());
     // 		$property->setChecked(false);
     $property->setLabel(_("yes"));
     // 		$property =$multField->addComponent(
     // 			"populatedbydr",
     // 			new WCheckBox());
     // 		$property->setChecked(false);
     // 		$property->setLabel(_("yes"));
     $property = $multField->addComponent("authoritative_values", WTextArea::withRowsAndColumns(10, 40));
     // We don't have any PartStructures yet, so we can't get them.
//.........这里部分代码省略.........
开发者ID:adamfranco,项目名称:concerto,代码行数:101,代码来源:create.act.php

示例12: createGroup

 /**
  * Create a Group with the display name, Type, description, and Properties
  * specified.  All but description are immutable.
  * 
  * @param string $displayName
  * @param object Type $groupType
  * @param string $description
  * @param object Properties $properties
  *	
  * @return object Group
  * 
  * @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 createGroup($displayName, Type $groupType, $description, Properties $properties, Id $id = null)
 {
     // ** parameter validation
     ArgumentValidator::validate($displayName, StringValidatorRule::getRule(), true);
     ArgumentValidator::validate($description, StringValidatorRule::getRule(), true);
     // ensure that we aren't using the type of one of the AuthNTypes
     // which would confict with external directories.
     // :: Add External Groups
     $authNMethodManager = Services::getService("AuthNMethodManager");
     $types = $authNMethodManager->getAuthNTypes();
     while ($types->hasNext()) {
         if ($groupType->isEqual($types->next())) {
             throwError(new Error(AgentException::PERMISSION_DENIED(), "GroupManager", true));
         }
     }
     // ** end of parameter validation
     // create a new unique id for the group
     if (is_object($id) && method_exists($id, 'getIdString')) {
         $groupId = $id;
     } else {
         $idManager = Services::getService("Id");
         $groupId = $idManager->createId();
     }
     // 1. Create the node
     $hierarchyManager = Services::getService("Hierarchy");
     $hierarchy = $hierarchyManager->getHierarchy($this->_hierarchyId);
     $groupNode = $hierarchy->createNode($groupId, $this->_allGroupsId, $groupType, $displayName, $description);
     // 2. Store the properties of the group.
     $propertyManager = Services::getService("Property");
     $propertiesId = $propertyManager->storeProperties($groupId->getIdString(), $properties);
     // create the group object to return
     $group = new HarmoniGroup($hierarchy, $groupNode);
     // update our cache for isGroup
     if (isset($this->_groupTreeIds) && is_array($this->_groupTreeIds)) {
         $this->_groupTreeIds[$groupId->getIdString()] = $groupId;
     }
     return $group;
 }
开发者ID:adamfranco,项目名称:harmoni,代码行数:65,代码来源:HarmoniAgentManager.class.php

示例13: getAssetsBySearch

 /**
  * Perform a search of the specified Type and get all the Assets that
  * satisfy the SearchCriteria.  Iterators return a set, one at a time.
  * 
  * @param object mixed $searchCriteria (original type: java.io.Serializable)
  * @param object Type $searchType
  * @param object Properties $searchProperties
  *  
  * @return object AssetIterator
  * 
  * @throws object RepositoryException An exception with one of
  *         the following messages defined in
  *         org.osid.repository.RepositoryException may be thrown: {@link
  *         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 ($searchType->isEqual(new Type("Repository", "edu.middlebury.harmoni", "Keyword", "Search with a string for keywords."))) {
         if (!is_string($searchCriteria)) {
             throw new OperationFailedException('search criteria should be a string.');
         }
         // Convert the criteria to the proper character set.
         $encoding = $this->config['encoding'];
         if (!is_null($encoding)) {
             $searchCriteria = iconv('UTF-8', $encoding, $searchCriteria);
         }
         $query = new SelectQuery();
         $query->addTable($this->config['table']);
         $query->addColumn($this->config['id_column']);
         $query->addWhereLike($this->config['id_column'], '%' . $searchCriteria . '%');
         foreach ($this->config['columns'] as $column) {
             $query->addColumn($column);
             $query->addWhereLike($column, '%' . $searchCriteria . '%', _OR);
         }
         if ($this->config['order_column']) {
             $query->addOrderBy($this->config['order_column'], $this->config['order_direction']);
         }
         return new SimpleTableAssetIterator($this, $this->config, $this->dbc->query($query, $this->dbIndex));
     } else {
         if ($searchType->isEqual(new Type("Repository", "edu.middlebury.harmoni", "RootAssets", "Search for just the 'root' or 'top level' assets which are not assets of other assets."))) {
             return $this->getAssets();
         } else {
             throw new UnknownTypeException('UNKNOWN_TYPE');
         }
     }
 }
开发者ID:adamfranco,项目名称:harmoni,代码行数:59,代码来源:SimpleTableRepository.class.php

示例14: buildContent

 /**
  * Build the content for this action
  * 
  * @return void
  * @access public
  * @since 10/24/05
  */
 function buildContent()
 {
     $actionRows = $this->getActionRows();
     $harmoni = Harmoni::instance();
     if (RequestContext::value('login_failed')) {
         $actionRows->add(new Heading("<span style='color: red;'>" . _("Error: Login Failed. Either your username or password was invalid.") . "</span>", 2));
     }
     $actionRows->add(new Heading(_("Authentication"), 2));
     // Current AuthN Table
     ob_start();
     $authNManager = Services::getService("AuthN");
     $agentManager = Services::getService("Agent");
     $authTypes = $authNManager->getAuthenticationTypes();
     print "\n<table border='2' align='left'>";
     print "\n\t<tr><th colspan='3'><center>";
     print _("Current Authentications: ");
     print "</center>\n\t</th></tr>";
     while ($authTypes->hasNext()) {
         $authType = $authTypes->next();
         $typeString = HarmoniType::typeToString($authType);
         print "\n\t<tr>";
         print "\n\t\t<td><small>";
         print "<a href='#' title='{$typeString}' onclick='alert(\"{$typeString}\")'>";
         print $authType->getKeyword();
         print "</a>";
         print "\n\t\t</small></td>";
         print "\n\t\t<td><small>";
         $userId = $authNManager->getUserId($authType);
         $userAgent = $agentManager->getAgent($userId);
         print '<a title=\'' . _("Agent Id") . ': ' . $userId->getIdString() . '\' onclick=\'Javascript:alert("' . _("Agent Id") . ':\\n\\t' . $userId->getIdString() . '");\'>';
         print $userAgent->getDisplayName();
         print "</a>";
         print "\n\t\t</small></td>";
         print "\n\t\t<td><small>";
         $harmoni->request->startNamespace("polyphony");
         // set where we are before login
         $harmoni->history->markReturnURL("polyphony/login");
         if ($authNManager->isUserAuthenticated($authType)) {
             $url = $harmoni->request->quickURL("auth", "logout_type", array("type" => urlencode($typeString)));
             print "<a href='" . $url . "'>Log Out</a>";
         } else {
             $url = $harmoni->request->quickURL("auth", "login_type", array("type" => urlencode($typeString)));
             print "<a href='" . $url . "'>Log In</a>";
         }
         $harmoni->request->endNamespace();
         print "\n\t\t</small></td>";
         print "\n\t</tr>";
     }
     print "\n</table>";
     $statusBar = new Block(ob_get_contents(), 2);
     $actionRows->add($statusBar, null, null, RIGHT, TOP);
     ob_end_clean();
     // Visitor Registration Link
     $authTypes = $authNManager->getAuthenticationTypes();
     $hasVisitorType = false;
     $visitorType = new Type("Authentication", "edu.middlebury.harmoni", "Visitors");
     while ($authTypes->hasNext()) {
         $authType = $authTypes->next();
         if ($visitorType->isEqual($authType)) {
             $hasVisitorType = true;
             break;
         }
     }
     if ($hasVisitorType && !$authNManager->isUserAuthenticatedWithAnyType()) {
         ob_start();
         print "\n<ul>" . "\n\t<li><a href='" . $harmoni->request->quickURL("user", "visitor_reg") . "'>" . _("Visitor Registration") . "</a></li>" . "\n</ul>";
         $actionRows->add(new Block(ob_get_clean(), STANDARD_BLOCK), "100%", null, CENTER, CENTER);
     }
     // Change Password
     ob_start();
     $authTypes = $authNManager->getAuthenticationTypes();
     while ($authTypes->hasNext()) {
         $authType = $authTypes->next();
         if ($authNManager->isUserAuthenticated($authType)) {
             $methodMgr = Services::getService("AuthNMethodManager");
             try {
                 $method = $methodMgr->getAuthNMethodForType($authType);
                 if ($method->supportsTokenUpdates()) {
                     print "\n\t<li><a href='" . $harmoni->request->quickURL("user", "change_password") . "'>";
                     $keyword = $authType->getKeyword();
                     print str_replace('%1', $keyword, dgettext("polyphony", "Change '%1' Password"));
                     print "</a></li>";
                 }
             } catch (Exception $e) {
             }
         }
     }
     $passLinks = ob_get_clean();
     if (strlen($passLinks)) {
         $actionRows->add(new Block("\n<ul>" . $passLinks . "\n</ul>", STANDARD_BLOCK), "100%", null, CENTER, CENTER);
     }
 }
开发者ID:adamfranco,项目名称:segue,代码行数:99,代码来源:main.act.php

示例15: buildFeed

 /**
  * Build the rss feed
  * 
  * @return void
  * @access public
  * @since 8/10/06
  */
 function buildFeed()
 {
     $harmoni = Harmoni::instance();
     $repositoryManager = Services::getService('Repository');
     $authZManager = Services::getService("AuthZ");
     $idManager = Services::getService("IdManager");
     $repositoryId = $idManager->getId("edu.middlebury.concerto.exhibition_repository");
     $repository = $repositoryManager->getRepository($repositoryId);
     if (RequestContext::value('exhibition_id')) {
         $exhibitionAssetId = $idManager->getId(RequestContext::value('exhibition_id'));
         $exhibitionAsset = $repository->getAsset($exhibitionAssetId);
     } else {
         $exhibitionAssetId = null;
         $exhibitionAsset = null;
     }
     if ($exhibitionAsset) {
         $title = $exhibitionAsset->getDisplayName();
         $this->setDescription($exhibitionAsset->getDescription());
         $this->setLink($harmoni->request->quickURL('exhibitions', 'browse_exhibition', array('exhibition_id' => $exhibitionAssetId->getIdString())));
     } else {
         $title = _("All of Concerto");
         $this->setDescription(_("Slideshows from across all of Concerto."));
         $this->setLink($harmoni->request->quickURL('exhibitions', 'browse'));
     }
     if (RequestContext::value('order') == 'modification') {
         $title .= " - " . _("Recently Changed Slideshows");
     } else {
         $title .= " - " . _("Newest Slideshows");
     }
     $this->setTitle($title);
     $slideshowAssets = $this->getAssets($repository);
     $i = 0;
     $exhibitionAssetType = new Type("Asset Types", "edu.middlebury.concerto", "Exhibition");
     while ($slideshowAssets->hasNext() && $i < 20) {
         $slideshowAsset = $slideshowAssets->next();
         $slideshowAssetId = $slideshowAsset->getId();
         // Limit to only one exhibition if necessary
         $include = true;
         if (is_object($exhibitionAssetId)) {
             $parents = $slideshowAsset->getParents();
             while ($parents->hasNext()) {
                 $parent = $parents->next();
                 if ($exhibitionAssetType->isEqual($parent->getAssetType()) && !$exhibitionAssetId->isEqual($parent->getId())) {
                     $include = false;
                 }
             }
         }
         // Check Authorization
         if ($include && $authZManager->isUserAuthorized($idManager->getId("edu.middlebury.authorization.view"), $slideshowAssetId)) {
             $this->addItem($this->getAssetItem($slideshowAsset));
             $i++;
         }
     }
 }
开发者ID:adamfranco,项目名称:concerto,代码行数:61,代码来源:rss_latest_slideshows.act.php


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