本文整理汇总了PHP中Agent::getId方法的典型用法代码示例。如果您正苦于以下问题:PHP Agent::getId方法的具体用法?PHP Agent::getId怎么用?PHP Agent::getId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Agent
的用法示例。
在下文中一共展示了Agent::getId方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Constructor
*
* @param object HierarchicalRadioMatrix $property
* @param object Agent $agent
* @return void
* @access public
* @since 11/14/07
*/
public function __construct(HierarchicalRadioMatrix $property, Agent $agent)
{
$this->property = $property;
$this->agent = $agent;
$this->agentId = $agent->getId();
$this->siteImplicitRole = new NoAccess_SegueRole();
$this->siteImplicitRoleMessage = '';
}
示例2: contains
/**
* Return <code>true</code> if the Member or Group is in the Group,
* optionally including subgroups, <code>false</code> otherwise.
*
* @param object Agent $memberOrGroup
* @param boolean $searchSubgroups
*
* @return boolean
*
* @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}
*
* @access public
*/
function contains(Agent $memberOrGroup, $searchSubgroups)
{
// we are going to ignore the Everyone group and the Anonymous agent
// otherwise they are in the group
$ids = Services::getService("Id");
$ignore = array("edu.middlebury.agents.users", "edu.middlebury.agents.everyone", "edu.middlebury.agents.anonymous");
foreach ($igonre as $id) {
$rId = $ids->getId($id);
if ($rId->isEqual($memberOrGroup->getId())) {
return false;
}
}
return true;
}
示例3: foreach
$property_id = Property::getCurrent()->getId();
foreach ($agents as $agent_id) {
try {
$agent = new Agent($agent_id);
} catch (Exception $ex) {
}
if ($agent != null) {
?>
<div class="box general">
<div class="agent card">
<div class="photo">
<?php
echo get_the_post_thumbnail($agent->getId(), array(70, 70));
?>
</div>
<span class="call-to-action"><?php
echo __('Contact the agent', THEME_NAME);
?>
</span>
<h5 class="name"><?php
echo $agent->getName();
?>
</h5>
<div class="contact-info">
<?php
if ($agent->hasPhone()) {
示例4: addSlotForAgent
/**
* Add a slot to a users array for an agent.
*
* @param Agent $agent
* @param Slot $slot
* @return int
*/
protected function addSlotForAgent(Agent $agent, Slot $slot)
{
$agentIdString = $agent->getId()->getIdString();
if (!isset($this->users[$agentIdString])) {
$email = $this->getAgentEmail($agent);
// Don't include people without email addresses
if (empty($email)) {
return 0;
}
$this->users[$agentIdString] = array('name' => $agent->getDisplayName(), 'email' => $email, 'slots' => array());
}
$this->users[$agentIdString]['slots'][] = $slot;
return 1;
}
示例5: agentMatches
/**
* Compare an Agent to an Agent XML description and determine if the two match.
*
* The current implementation of this method is kind of goofy. It should be
* re-worked to either use a more reliable comparison method or be made configurable
* for different comparrison methods.
*
* @param object Agent $agent
* @param object DOMElement $element
* @return boolean
* @access protected
* @since 1/28/08
*/
protected function agentMatches(Agent $agent, DOMElement $element)
{
// check some system-ids first as these will not have meaningful properties
// to compare and their IDs are hard coded into the system.
$sourceId = $element->getAttribute('id');
$systemIds = array("edu.middlebury.agents.everyone", "edu.middlebury.institute", "1", "edu.middlebury.agents.anonymous");
if (in_array($sourceId, $systemIds)) {
if ($sourceId == $agent->getId()->getIdString()) {
return true;
} else {
return false;
}
}
// Compare agent properties to make sure that the agent and the DOMElement
// are representing the same user.
$xmlPropertiesToCheck = array('email', 'username');
$agentPropertiesToCheck = array('email', 'username');
// How man properties must match
$threshold = 1;
$matches = 0;
$xmlValues = array();
foreach ($xmlPropertiesToCheck as $property) {
// printpre(htmlentities($this->doc->saveXMLWithWhitespace($element)));
$valueElements = $this->xpath->evaluate('./property[key = \'' . $property . '\']/string', $element);
if ($valueElements->length) {
$xmlValues[] = $this->getStringValue($valueElements->item(0));
}
// throw new Exception('test error');
}
$agentPropertiesIterator = $agent->getProperties();
while ($agentPropertiesIterator->hasNext()) {
$properties = $agentPropertiesIterator->next();
// printpre($properties->getKeys());
foreach ($agentPropertiesToCheck as $key) {
try {
$value = $properties->getProperty($key);
// printpre($value);
if (!is_null($value) && in_array($value, $xmlValues)) {
$matches++;
}
} catch (UnknownKeyException $e) {
}
}
}
if ($matches >= $threshold) {
return true;
} else {
return false;
}
}
示例6: __construct
/**
* Constructor
*
* @param object Agent $agent
* @return void
* @access public
* @since 11/27/07
*/
public function __construct(Agent $agent)
{
$this->id = $agent->getId();
$this->name = $agent->getDisplayName();
try {
$propertiesIterator = $agent->getProperties();
while ($propertiesIterator->hasNext()) {
$properties = $propertiesIterator->next();
try {
if ($properties->getProperty('email')) {
$this->email = $properties->getProperty('email');
break;
}
} catch (Exception $e) {
}
}
} catch (Exception $e) {
}
}
示例7: contains
/**
* Return <code>true</code> if the Member or Group is in the Group,
* optionally including subgroups, <code>false</code> otherwise.
*
* @param object Agent $memberOrGroup
* @param boolean $searchSubgroups
*
* @return boolean
*
* @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}
*
* @access public
*/
function contains(Agent $memberOrGroup, $searchSubgroups)
{
ArgumentValidator::validate($searchSubgroups, BooleanValidatorRule::getRule(), true);
// ** end of parameter validation
$id = $memberOrGroup->getId();
$children = $this->getMembers($searchSubgroups);
while ($children->hasNext()) {
if ($id->isEqual($children->next()->getId())) {
return true;
}
}
$children = $this->getGroups($searchSubgroups);
while ($children->hasNext()) {
if ($id->isEqual($children->next()->getId())) {
return true;
}
}
return FALSE;
}
示例8: setAgent
/**
* Declares an association between this object and a Agent object.
*
* @param Agent $v
* @return void
* @throws PropelException
*/
public function setAgent($v)
{
if ($v === null) {
$this->setAgentId(NULL);
} else {
$this->setAgentId($v->getId());
}
$this->aAgent = $v;
}
示例9: contains
/**
* Return <code>true</code> if the Member or Group is in the Group,
* optionally including subgroups, <code>false</code> otherwise.
*
* @param object Agent $memberOrGroup
* @param boolean $searchSubgroups
*
* @return boolean
*
* @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}
*
* @access public
*/
function contains(Agent $memberOrGroup, $searchSubgroups)
{
$id = $memberOrGroup->getId();
$myMembers = $this->getMembers(false);
while ($myMembers->hasNext()) {
if ($id->isEqual($myMembers->next()->getId())) {
return true;
}
}
$myGroups = $this->getGroups(false);
while ($myGroups->hasNext()) {
if ($id->isEqual($myGroups->next()->getId())) {
return true;
}
}
if ($searchSubgroups) {
$myGroups = $this->getGroups(true);
while ($myGroups->hasNext()) {
if ($myGroups->next()->contains($memberOrGroup, true)) {
return true;
}
}
}
return false;
}
示例10: printAgent
/**
* Print out an agent or group
*
* @param object Agent $agent
* @param optional boolean $includeChildren Default is false
* @return void
* @access protected
* @since 10/21/08
*/
protected function printAgent(Agent $agent, $includeChildren = false)
{
if ($agent->isAgent()) {
print "\n\t<agent";
} else {
print "\n\t<group";
}
print " id=\"" . $agent->getId()->getIdString() . "\">";
print "\n\t\t<displayName><![CDATA[" . $agent->getDisplayName() . "]]></displayName>";
$type = $agent->getType();
print "\n\t\t<type>";
print "\n\t\t\t<domain><![CDATA[" . $type->getDomain() . "]]></domain>";
print "\n\t\t\t<authority><![CDATA[" . $type->getAuthority() . "]]></authority>";
print "\n\t\t\t<keyword><![CDATA[" . $type->getKeyword() . "]]></keyword>";
print "\n\t\t\t<description><![CDATA[" . $type->getDescription() . "]]></description>";
print "\n\t\t</type>";
try {
print "\n\t\t<email>" . $this->getAgentEmail($agent) . "</email>";
} catch (OperationFailedException $e) {
}
if ($agent->isAgent()) {
print "\n\t</agent>";
} else {
print "\n\t\t<description><![CDATA[" . $agent->getDescription() . "]]></description>";
$authZ = Services::getService("AuthZ");
$idMgr = Services::getService("Id");
if ($includeChildren) {
$canView = $authZ->isUserAuthorized($idMgr->getId("edu.middlebury.authorization.view"), $agent->getId());
if ($agent->getId()->isEqual(new HarmoniId('edu.middlebury.agents.everyone'))) {
$canView = false;
}
// $canView = true;
print "\n\t\t<groups>";
if ($canView) {
$names = array();
$strings = array();
$children = $agent->getGroups(false);
while ($children->hasNext()) {
$child = $children->next();
ob_start();
$this->printAgent($child);
$names[] = $child->getDisplayName();
$strings[] = ob_get_clean();
}
array_multisort($names, array_keys($strings), $strings);
print implode('', $strings);
} else {
print "\n\t\t\t\t<notice>" . _("Unauthorized to view group membership.") . "</notice>";
}
print "\n\t\t</groups>";
print "\n\t\t<members>";
if ($canView) {
$names = array();
$strings = array();
$children = $agent->getMembers(false);
while ($children->hasNext()) {
$child = $children->next();
ob_start();
$this->printAgent($child);
$names[] = $child->getDisplayName();
$strings[] = ob_get_clean();
}
array_multisort($names, array_keys($strings), $strings);
print implode('', $strings);
} else {
print "\n\t\t\t\t<notice>" . _("Unauthorized to view group membership.") . "</notice>";
}
print "\n\t\t</members>";
}
print "\n\t</group>";
}
}
示例11: getDenialUrl
/**
* Answer the URL to denie an agent
*
* @param Agent $agent
* @return string
* @access protected
* @since 2/19/09
*/
protected function getDenialUrl(Agent $agent)
{
return $this->getPluginActionUrl('deny', array('agent_id' => $agent->getId()->getIdString()));
}
示例12: addSlotForAgent
/**
* Add a slot to a users array for an agent.
*
* @param Agent $agent
* @param Slot $slot
* @return int
*/
protected function addSlotForAgent(Agent $agent, Slot $slot)
{
$agentIdString = $agent->getId()->getIdString();
$email = $this->getAgentEmail($agent);
// Don't include people without email addresses
if (empty($email)) {
return 0;
}
$this->slots[$slot->getShortname()]['users'][$email] = array('name' => $agent->getDisplayName(), 'email' => $email);
ksort($this->slots[$slot->getShortname()]['users']);
return 1;
}