本文整理汇总了PHP中Agent类的典型用法代码示例。如果您正苦于以下问题:PHP Agent类的具体用法?PHP Agent怎么用?PHP Agent使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Agent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: processEvent
private function processEvent()
{
$dom = $this->dom;
$headerNode = $dom->getElementsByTagName('SIF_Header')->item(0);
$originalMsgId = $headerNode->getElementsByTagName('SIF_MsgId')->item(0)->nodeValue;
$originalSourceId = $headerNode->getElementsByTagName('SIF_SourceId')->item(0)->nodeValue;
$originalTimestamp = $headerNode->getElementsByTagName('SIF_Timestamp')->item(0)->nodeValue;
$validSourceId = Agent::checkSourceId($originalSourceId);
if (!$validSourceId) {
RegisterError::invalidSourceId($agent->sourceId, $originalMsgId);
} else {
$agent = new Agent($originalSourceId);
if ($agent->isRegistered()) {
$eventObjectNode = $dom->getElementsByTagName('SIF_EventObject')->item(0);
$objectName = $eventObjectNode->getAttribute('ObjectName');
$objectAction = $eventObjectNode->getAttribute('Action');
$objectAction = strtolower($objectAction);
if (!DataObject::objectExists($objectName)) {
ProvisionError::invalidObject($originalSourceId, $originalMsgId, $objectName);
exit;
} else {
$allowed = $this->hasPermission($objectName, $objectAction, $agent->agentId);
if ($allowed) {
$provider = DataObject::isProvider($objectName, $agent->agentId);
if ($provider) {
$this->publishEvent($agent->agentId, $objectName, $objectAction, $_SESSION['ZONE_VERSION'], $dom->saveXml($headerNode));
$timestamp = Utility::createTimestamp();
$msgId = Utility::createMessageId();
$sifMessageNode = $dom->getElementsByTagName('SIF_Message')->item(0);
XmlHelper::buildSuccessMessage($msgId, $timestamp, $originalSourceId, $originalMsgId, 0, $originalMsg = null, $desc = null);
} else {
ProvisionError::notProviderError($originalSourceId, $originalMsgId);
}
} else {
switch ($objectAction) {
case 'add':
ProvisionError::invalidPermissionToPublishAdd($originalSourceId, $originalMsgId, $objectName);
break;
case 'change':
ProvisionError::invalidPermissionToPublishChange($originalSourceId, $originalMsgId, $objectName);
break;
case 'delete':
ProvisionError::invalidPermissionToPublishDelete($originalSourceId, $originalMsgId, $objectName);
break;
}
//switch for error message
}
//allowed
}
//object exist
} else {
RegisterError::notRegisteredError($originalSourceId, $originalMsgId);
}
//not registered
}
//valid sourceId
}
示例3: onlySmithCanReplicate
/**
* @dataProvider agents
* @test
* @param Agent $agent
* @param type $name
* @param type $isNowAgent
*/
public function onlySmithCanReplicate(Agent $agent, $name, $shouldReplicate)
{
$victim = new Program();
$replication = new AgentReplication();
$agent->setName($name);
$replication->replicate($agent, $victim);
if ($shouldReplicate) {
$this->assertEquals('Agent', get_class($victim));
} else {
$this->assertEquals('Program', get_class($victim));
}
}
示例4: Create
function Create($email, $firstname, $lastname, $phone, $password, $repassword, $sendButton = null)
{
$repassword = $repassword == "null" ? null : $repassword;
$agent = new Agent();
$agent->set($firstname, $lastname, $email, $phone, $password);
$agentModel = new AgentModel($agent);
$list = $agentModel->GetUsers();
$this->agentModelView->agent = $agent;
$this->agentModelView->agentList = $list;
if ($agent->validated()) {
if ($password != $repassword) {
Session::set("warning", " Password mis-matched, re-enter passwords again!");
return $this->View($this->agentModelView, "Agent", "Create");
} else {
$this->agentModelView->agentDbModel = $agentModel;
if ($agentModel->Exists()) {
Session::set("warning", "The user with the given email address [{$email}] already exists!");
} else {
try {
//else create the user
if ($agentModel->Create()) {
$sessionID = Validator::UniqueKey(20);
$agentModel->SaveVerificationCode($email, $sessionID);
//create a barcode
$param = new ArrayIterator();
$param->offsetSet("username", $agent->email);
$param->offsetSet("verificationCode", $sessionID);
$url = ContextManager::CreateURL("Agent", "Login", $param);
$imgPath = ContextManager::CreateQRBarcode($url, $agent->agentId);
if ($this->_sendVerificationEmail($agent, $sessionID, $imgPath)) {
//navigate to comfirmation page
return $this->View($agent, "Agent", "Confirmation");
} else {
Session::set("warning", "could not send mail ");
$agentModel->DeleteAgent($email);
}
}
} catch (Exception $err) {
Session::set("warning", $err->getMessage());
}
}
}
// create a database record here
} else {
Session::set("warning", $agent->getError());
}
return $this->View($this->agentModelView, "Agent", "Create");
}
示例5: detail
public function detail($idLook, $categoria, $name)
{
$producto = DB::table('looks')->where('looks.idlook', $idLook)->where('looks.estado', '>=', 1)->join('lookbook', 'lookbook.idlookbook', '=', 'looks.idlookbook')->select('looks.*', 'lookbook.nombre')->get();
$subcate = $producto[0]->subcategoria;
$ordensuperior = $producto[0]->orden2 + 1;
$ordeninferior = $producto[0]->orden2 - 1;
$numregistros = DB::table('looks')->where('looks.idlookbook', $categoria)->count();
if ($ordensuperior > $numregistros) {
$ordensuperior = 1;
}
if ($ordeninferior <= 1) {
$ordeninferior = $numregistros;
}
$prodsiguiente = DB::table('looks')->where('looks.orden2', $ordensuperior)->where('looks.estado', '>=', 1)->where('looks.idlookbook', $categoria)->select('looks.idlook', 'looks.nombrelook', 'looks.idlookbook')->take(1)->get();
$prodanterior = DB::table('looks')->where('looks.orden2', $ordeninferior)->where('looks.estado', '>=', 1)->where('looks.idlookbook', $categoria)->select('looks.idlook', 'looks.nombrelook', 'looks.idlookbook')->take(1)->get();
/*$similares = DB::table('looks')
->where('looks.idlookbook', '=', $categoria)
->where('looks.estado', '=', 1)
->where('looks.idlook', '!=', $idLook)
->select('looks.*')
->orderBy('looks.orden2')
->take(4)
->get();*/
$similares = DB::table('looks')->where('looks.idlookbook', '=', $categoria)->where('looks.estado', '>=', 1)->where('looks.idlook', '!=', $idLook)->where('looks.subcategoria', $subcate)->select('looks.*')->orderBy(DB::raw('RAND()'))->get();
$isMobile = Agent::isMobile();
if ($isMobile) {
return View::make('mobile/lookbook-detail')->with('producto', $producto)->with('similares', $similares)->with('sig', $prodsiguiente)->with('ant', $prodanterior);
} else {
return View::make('desktop/lookbook-detail')->with('producto', $producto)->with('similares', $similares)->with('sig', $prodsiguiente)->with('ant', $prodanterior);
}
}
示例6: store
public function store()
{
$prospect = new Prospect();
$fullAddress = Input::get('prospect-address');
$addressPieces = explode(", ", $fullAddress);
$prospect->prospect_address = $addressPieces[0];
$prospect->prospect_city = $addressPieces[1];
$prospect->prospect_state = $addressPieces[2];
$prospect->prospect_address_lat = Input::get('latitude');
$prospect->prospect_address_lng = Input::get('longitude');
$prospect->prospect_zip = Input::get('zipcode');
if (Input::has('prospect-unit-number')) {
$prospect->prospect_apt_unit = Input::get('prospect-unit-number');
}
$prospect->agent_id = Agent::findOrFail(1)->id;
//formula to determine agent
$prospect->broker_id = Broker::findOrFail(1)->id;
if ($prospect->save()) {
//true returns true or false
return Redirect::action('HomeController@edit', array('prospect' => $prospect->id));
} else {
Session::flash('errorMessage', 'Unable to locate property!');
return Redirect::back()->withInput();
}
}
示例7: getCreditLimit
public static function getCreditLimit($agent_id)
{
if (Entrust::hasRole('Agent')) {
return Agent::where('user_id', $agent_id)->first()->credit_limit;
}
return false;
}
示例8: getcomboboxesAction
public function getcomboboxesAction()
{
$auth = Zend_Auth::getInstance();
if ($auth->hasIdentity()) {
if (!$this->getRequest()->isXmlHttpRequest()) {
$this->view->msg = 'Not Ajax Request';
$this->_forward('error', 'error');
} else {
$zones = Zone::getAllZones();
$contexts = Context::getAllContexts();
$agents = Agent::getAllAgents();
$this->view->zones = $zones;
$this->view->agents = $agents;
$this->view->contexts = $contexts;
$this->render('aclcomboboxes');
}
} else {
if (!$this->getRequest()->isXmlHttpRequest()) {
$this->view->msg = 'Not Ajax Request';
$this->_forward('error', 'error');
} else {
$this->view->msg = 'Invalid User';
$this->_forward('error', 'error');
}
}
}
示例9: index
public function index()
{
Log::debug(__METHOD__);
if (Input::has('book_id')) {
$this->setCurrentBook(Input::get('book_id'));
}
if (Input::has('layout')) {
$this->setLayout(Input::get('layout'));
}
if (Agent::isMobile()) {
$user_name = Auth::user()->username;
$get_task_counts = $this->getTaskCounts();
$book_name = $this->getBookName();
$current_book_id = $this->currentBook() ? $this->currentBook()->id : 0;
$prefix = $this->getPrefix();
$recent_done_now = 10;
$books = $this->getAllBookCounts();
$tasks = $this->getTasks('', $recent_done_now);
return View::make('tasks.index', compact('user_name', 'book_name', 'current_book_id', 'prefix', 'recent_done_now', 'tasks', 'books'));
} else {
$this->tasks = $this->currentTasks();
// respond_to do |format|
// format.html
// format.csv { send_data(current_tasks.csv) }
// format.xls
// end
return View::make('tasks.index');
}
}
示例10: checkForUpdate
public function checkForUpdate($gamertag = '')
{
if ($this->request->ajax() && !\Agent::isRobot()) {
try {
$account = Account::with('destiny.characters')->where('seo', Text::seoGamertag($gamertag))->firstOrFail();
// We don't care about non-panda members
if (!$account->isPandaLove()) {
$this->inactiveCounter = 1;
}
// check for 10 inactive checks
if ($account->destiny->inactiveCounter >= $this->inactiveCounter) {
return response()->json(['updated' => false, 'frozen' => true, 'last_update' => 'This account hasn\'t had new data in awhile. - <a href="' . URL::action('Destiny\\ProfileController@manualUpdate', [$account->seo]) . '" class="ui horizontal green label no_underline">Update Manually</a>']);
}
$char = $account->destiny->firstCharacter();
if ($char->updated_at->diffInMinutes() >= $this->refreshRateInMinutes) {
// update this
$this->dispatch(new UpdateAccount($account));
return response()->json(['updated' => true, 'frozen' => false, 'last_update' => $char->getLastUpdatedRelative()]);
}
return response()->json(['updated' => false, 'frozen' => false, 'last_update' => $char->getLastUpdatedRelative()]);
} catch (ModelNotFoundException $e) {
return response()->json(['error' => 'Gamertag not found']);
}
}
}
示例11: __construct
public function __construct()
{
if (Agent::isMobile()) {
$this->_vista = 'mobile';
} else {
$this->_vista = 'index';
}
$this->_imagesInstagram = array();
$this->_imagesTwitter = array();
$instagram = new instagram(array('apiKey' => '09fd60952ea742d5abb761b6c6a137aa', 'apiSecret' => 'ee25063e91e74d6c9f257be054a44ec3', 'apiCallback' => 'http://viernesdezapatillas.pe/'));
$tagInstagram = 'viernesdezapatillas';
$numphotosInstagram = 15;
$media = $instagram->getTagMedia($tagInstagram, $auth = false, array('count' => $numphotosInstagram));
$response = json_decode(json_encode($media));
foreach ($response->data as $data) {
$this->_imagesInstagram[] = $data->images->thumbnail->url;
}
$max_id = 0;
$totalTweets = 15;
$responset = Twitter::getSearch(array('q' => '#viernesdezapatillas since:2015-07-01 filter:images', 'count' => $totalTweets, 'max_id' => $max_id, 'since_id' => 0));
foreach ($responset->statuses as $tweet) {
foreach ($tweet->entities->media as $url) {
$this->_imagesTwitter[] = $url->media_url;
// . ':thumb';
}
}
}
示例12: processAck
public function processAck($m)
{
$dom = $this->dom;
$headerNode = $m->headerNode;
$msgId = $m->msgId;
$agentSourceId = $m->sourceId;
# $msgId = $headerNode->getElementsByTagName('SIF_MsgId')->item(0)->nodeValue;
# $agentSourceId = $headerNode->getElementsByTagName('SIF_SourceId')->item(0)->nodeValue;
$originalMsgId = $dom->getElementsByTagName('SIF_OriginalMsgId')->item(0)->nodeValue;
$timestamp = $headerNode->getElementsByTagName('SIF_Timestamp')->item(0)->nodeValue;
$status = $dom->getElementsByTagName('SIF_Status');
$status = $status->item(0)->nodeValue;
$validSourceId = Agent::checkSourceId($agentSourceId);
if (!$validSourceId) {
RegisterError::invalidSourceId($agentSourceId, $msgId);
} else {
$agent = new Agent($agentSourceId);
if ($agent->isRegistered()) {
if ($status == 1) {
$agent->unFreezeAgent();
$this->updateMessageQueue($agent, $originalMsgId, $msgId);
} else {
if ($status == 3) {
//done processing
if ($originalMsgId == $agent->frozenMsgId) {
$agent->unFreezeAgent();
$this->updateMessageQueue($agent, $originalMsgId, $msgId);
} else {
GeneralError::EventACKError($this->xml);
}
} else {
if ($status == 2) {
//Intermediate wait for final
$agent->freezeAgent();
$agent->setFrozenMsgId($originalMsgId);
$timestamp = Utility::createTimestamp();
$msgId_u = Utility::createMessageId();
XmlHelper::buildSuccessMessage($msgId_u, $timestamp, $agent->sourceId, $msgId, 0, $originalMsg = null, $desc = null);
}
}
}
} else {
RegisterError::notRegisteredError($agentSourceId, $msgId);
}
}
}
示例13: removeIdentity
public function removeIdentity()
{
if (!empty($this->getPrivateKeyFile()) && Agent::identityLoaded($this->getPrivateKeyFile())) {
// echo "Removing identity {$this->unlockedPrivateKeyFile}\n";
Agent::deleteIdentity($this->getPrivateKeyFile());
}
return $this;
}
示例14: index
public function index()
{
if (!Owner::isAuthenticated() && !Agent::isAuthenticated()) {
$this->redirect('/');
} else {
$this->view('dashboard/index');
}
}
示例15: create_object
public function create_object($data)
{
$data = \Core\Dict::create($data);
$assassin = Agent::mapper()->create_object(array('id' => $data->assassin, 'alias' => $data->assassin_agent_alias));
$target = Agent::mapper()->create_object(array('id' => $data->target, 'alias' => $data->target_agent_alias));
$weapon = Weapon::mapper()->create_object(array('id' => $data->weapon_id, 'name' => $data->weapon_name));
return Kill::create(array('id' => $data->id, 'description' => $data->description, 'assassin' => $assassin, 'target' => $target, 'weapon' => $weapon, 'game' => $game, 'when_happened' => new \DateTime($data->when_happened)), True);
}