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


PHP Type::asString方法代码示例

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


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

示例1: 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);
 }
开发者ID:adamfranco,项目名称:harmoni,代码行数:34,代码来源:HarmoniAgentManager.class.php

示例2: getLoginForm

 /**
  * Answer the login HTML
  * 
  * @return string
  * @access public
  * @since 6/5/08
  */
 public function getLoginForm()
 {
     ob_start();
     $harmoni = Harmoni::instance();
     $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 class='' style='margin-top: 10px;'>";
         print "<strong>" . dgettext("polyphony", "Logged in as:") . "</strong> &nbsp;";
         if (count(explode("+", $users)) == 1) {
             print $users . "\t";
         } else {
             print dgettext("polyphony", "Users: ") . $users . "\t";
         }
         print " | <a href='" . $harmoni->request->quickURL("auth", "logout") . "'>" . dgettext("polyphony", "Log Out") . "</a></div>";
     } else {
         if (PolyphonyLogin::instance()->hasLoginFailed()) {
             $message = "<span class='error'>" . _("Login Failed") . "</span> &nbsp; &nbsp;";
         } else {
             $message = "";
         }
         // set bookmarks for success and failure
         $harmoni->history->markReturnURL("polyphony/display_login", $harmoni->request->quickURL($harmoni->config->get('defaultModule'), $harmoni->config->get('defaultAction')));
         $harmoni->history->markReturnURL("polyphony/login_fail", $harmoni->request->quickURL("user", "main", array('login_failed' => 'true')));
         $harmoni->request->startNamespace("harmoni-authentication");
         $usernameField = $harmoni->request->getName("username");
         $passwordField = $harmoni->request->getName("password");
         $harmoni->request->endNamespace();
         $harmoni->request->startNamespace("polyphony");
         $visitorAuthType = new Type("Authentication", "edu.middlebury.harmoni", "Visitors");
         print "\n<div style='margin-top: 10px;'>" . "\n\t<strong>Visitor Login:</strong>" . "\n<form action='" . $harmoni->request->quickURL("auth", "login_type", array('type' => $visitorAuthType->asString())) . "' style='' method='post'>" . $message . "\n\t" . dgettext("polyphony", "Username (email address):") . " <input class='' type='text' size='8' \n\t\t\t\t\tname='{$usernameField}'/>" . "\n\t" . dgettext("polyphony", "Password:") . " <input class='' type='password' size ='8' \n\t\t\t\t\tname='{$passwordField}'/>" . "\n\t <input class='button' type='submit' value='Log in' />" . "\n</form></div>\n";
         $harmoni->request->endNamespace();
     }
     return ob_get_clean();
 }
开发者ID:adamfranco,项目名称:polyphony,代码行数:65,代码来源:confirm_email.act.php

示例3: getPluginDir

 /**
  * Answer a plugin directory
  * 
  * @param object Type
  * @return string
  * @access public
  * @since 10/8/08
  */
 public function getPluginDir(Type $type)
 {
     $typeString = $type->asString();
     if (!isset($this->pluginDirs[$typeString])) {
         $localPluginDir = $this->_getPluginDir($type, 'plugins-local');
         if (file_exists($localPluginDir)) {
             $this->pluginDirs[$typeString] = $localPluginDir;
         } else {
             $this->pluginDirs[$typeString] = $this->_getPluginDir($type, 'plugins-dist');
         }
     }
     return $this->pluginDirs[$typeString];
 }
开发者ID:adamfranco,项目名称:segue,代码行数:21,代码来源:PluginManager.class.php

示例4: 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 AuthZ2_Node($id, $type, $nodeRow['display_name'], $nodeRow['description'], $this);
         $result[] = $node;
     }
     return $result;
 }
开发者ID:adamfranco,项目名称:harmoni,代码行数:30,代码来源:HierarchyCache.class.php

示例5: printTypeOption

 /**
  * print an option tag
  * 
  * @param object Type $type
  * @return void
  * @access private
  * @since 12/14/07
  */
 private function printTypeOption(Type $type)
 {
     print "\n\t\t\t<option value='" . $type->asString() . "'>";
     if (isset($this->_classNames[$type->getKeyword()])) {
         print $this->_classNames[$type->getKeyword()];
     } else {
         try {
             $pluginManager = Services::getService("PluginManager");
             $class = $pluginManager->getPluginClass($type);
             print call_user_func(array($class, 'getPluginDisplayName'));
         } catch (UnknownIdException $e) {
             print $type->getKeyword();
         }
     }
     print "</option>";
 }
开发者ID:adamfranco,项目名称:segue,代码行数:24,代码来源:EditModeSiteVisitor.class.php

示例6: generateDisplayForPartStructures

 /**
  * Generate HTML for displaying particular fields of the Record 
  * 
  * @param object $record The record to print.
  * @param array $partStructures An array of partStructures to print. 
  * @return string
  * @access public
  * @since 10/19/04
  */
 function generateDisplayForPartStructures(Id $repositoryId, Id $assetId, Record $record, array $partStructures)
 {
     ArgumentValidator::validate($partStructures, new ArrayValidatorRuleWithRule(new ExtendsValidatorRule("PartStructure")));
     $recordStructure = $record->getRecordStructure();
     try {
         $type = $recordStructure->getType();
     } catch (UnimplementedException $e) {
         $type = new Type("RecordStructures", "edu.middlebury.harmoni", "text/plain");
     }
     if (!is_object($this->_modules[$type->asString()])) {
         throwError(new Error("Unsupported Format, '" . $type->asString() . "'", "RepositoryInputOutputModuleManager", true));
     }
     return $this->_modules[$type->asString()]->generateDisplayForPartStructures($repositoryId, $assetId, $record, $partStructures);
 }
开发者ID:adamfranco,项目名称:polyphony,代码行数:23,代码来源:RepositoryInputOutputModuleManager.class.php

示例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()];
 }
开发者ID:adamfranco,项目名称:harmoni,代码行数:38,代码来源:HarmoniWritableLog.class.php

示例8: 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

示例9: saveWizard

 function saveWizard($cacheName)
 {
     $wizard = $this->getWizard($cacheName);
     $values = $wizard->getAllValues();
     $props = $values["properties"];
     $list = $this->_getAgentList();
     print_r($props);
     $agentManager = Services::getService("Agent");
     $idManager = Services::getService("Id");
     $valuesHandled = array();
     // go through each agent and update all its properties at once
     foreach ($list as $idString) {
         // first clear all their properties, then reset them
         $id = $idManager->getId($idString);
         $agent = $agentManager->getAgentOrGroup($id);
         if (count($list) == 1) {
             $agent->deleteAllProperties();
         }
         foreach ($props as $values) {
             if ($values['type']) {
                 $type = HarmoniType::fromString($values['type']);
             } else {
                 $type = new Type("agent_properties", "harmoni", "custom", "Properties defined outside of an authentication system.");
             }
             $valuesHandled[$type->asString()][$values['key']] = true;
             if (count($list) == 1 || $values['value_update']) {
                 $key = $values['key'];
                 $value = $values['value'];
                 if (count($list) == 1 || !$agent->updateProperty($type, $key, $value)) {
                     $agent->addProperty($type, $key, $value);
                 }
             }
         }
     }
     if (count($list) > 1) {
         // now go through each agent and check if there are any properties that were not handled, delete them
         foreach ($list as $idString) {
             $id = $idManager->getId($idString);
             $agent = $agentManager->getAgentOrGroup($id);
             $properties = $agent->getProperties();
             while ($properties->hasNext()) {
                 $property = $properties->next();
                 $keys = $property->getKeys();
                 $type = $property->getType();
                 $typeString = $type->asString();
                 while ($keys->hasNext()) {
                     $key = $keys->next();
                     if (!isset($valuesHandled[$typeString][$key]) || !$valuesHandled[$typeString][$key]) {
                         $agent->deleteProperty($type, $key);
                     }
                 }
             }
         }
     }
     //		exit(0);
     return true;
 }
开发者ID:adamfranco,项目名称:polyphony,代码行数:57,代码来源:edit_properties.act.php


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