本文整理汇总了PHP中Member::getName方法的典型用法代码示例。如果您正苦于以下问题:PHP Member::getName方法的具体用法?PHP Member::getName怎么用?PHP Member::getName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Member
的用法示例。
在下文中一共展示了Member::getName方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
/**
* opDumpMemberTask::execute()
*
* @param array $arguments
* @param array $options
* @return
*/
protected function execute($arguments = array(), $options = array())
{
// initialize the database connection
$databaseManager = new sfDatabaseManager($this->configuration);
$connection = $databaseManager->getDatabase($options['connection'])->getConnection();
$doctrineConnection = $databaseManager->getDatabase($options['connection'])->getDoctrineConnection();
$fp = fopen(sfConfig::get('sf_data_dir') . '/memberlist.csv', 'w');
// gets member list(using pure SQL)
$sql = 'select * from member';
$members = $doctrineConnection->fetchAll($sql, array());
foreach ($members as $member) {
$line = array();
$memberObj = new Member();
$memberObj->fromArray($member);
// nickname is required
$name = $memberObj->getName();
if (empty($name)) {
continue;
}
$line[] = $memberObj->getId();
$line[] = $name;
$email = trim($memberObj->getConfig('pc_address'));
if (empty($email)) {
$email = $memberObj->getConfig('mobile_address');
}
if (empty($email)) {
continue;
}
$line[] = trim($email);
fputcsv($fp, $line, ',', '"');
}
fclose($fp);
}
示例2: execute
protected function execute($arguments = array(), $options = array())
{
$databaseManager = new sfDatabaseManager($this->configuration);
$n = (int)$options['number'];
$link = $options['link'];
if (!is_null($link))
{
$linkMember = Doctrine::getTable('Member')->find($link);
if (!$linkMember)
{
throw new Exception("not found member: ".$link);
}
}
for ($i = 0; $i < $n; $i++)
{
$member = new Member();
$member->setName('dummy');
$member->setIsActive(self::fetchRandomNotActive($options['notactivemember-rate'], $n));
$member->save();
$member->setName(sprintf($options['name-format'], $member->getId()));
$member->save();
$address = sprintf($options['mail-address-format'], $member->getId());
$member->setConfig('pc_address', $address);
$member->setConfig('mobile_address', $address);
$password = preg_replace("/%d/", $member->getId(), $options['password-format'], 1);
$member->setConfig('password', md5($password));
$this->logSection('member+', $member->getName());
if (isset($linkMember))
{
$memberRelationship1 = new MemberRelationship();
$memberRelationship1->setMember($member);
$memberRelationship1->setMemberRelatedByMemberIdFrom($linkMember);
$memberRelationship1->setIsFriend(true);
$memberRelationship1->save();
$memberRelationship2 = new MemberRelationship();
$memberRelationship2->setMember($linkMember);
$memberRelationship2->setMemberRelatedByMemberIdFrom($member);
$memberRelationship2->setIsFriend(true);
$memberRelationship2->save();
$this->logSection('friend link', sprintf("%s - %s", $linkMember->getId(), $member->getId()));
}
}
}
示例3: run
public function run($request)
{
// get all users from LDAP, but only get the attributes we need.
// this is useful to avoid holding onto too much data in memory
// especially in the case where getUser() would return a lot of users
$users = $this->ldapService->getUsers(array_merge(array('objectguid', 'samaccountname', 'useraccountcontrol', 'memberof'), array_keys(Config::inst()->get('Member', 'ldap_field_mappings'))));
$start = time();
$count = 0;
foreach ($users as $data) {
$member = Member::get()->filter('GUID', $data['objectguid'])->limit(1)->first();
if (!($member && $member->exists())) {
// create the initial Member with some internal fields
$member = new Member();
$member->GUID = $data['objectguid'];
$member->write();
$this->log(sprintf('Creating new Member (ID: %s, GUID: %s, sAMAccountName: %s)', $member->ID, $data['objectguid'], $data['samaccountname']));
} else {
$this->log(sprintf('Updating existing Member "%s" (ID: %s, GUID: %s, sAMAccountName: %s)', $member->getName(), $member->ID, $data['objectguid'], $data['samaccountname']));
}
// sync attributes from LDAP to the Member record
// this is also responsible for putting the user into mapped groups
try {
$this->ldapService->updateMemberFromLDAP($member, $data);
} catch (Exception $e) {
$this->log($e->getMessage());
}
// cleanup object from memory
$member->destroy();
$count++;
}
// remove Member records that were previously imported, but no longer exist in the directory
// NOTE: DB::query() here is used for performance and so we don't run out of memory
if ($this->config()->destructive) {
foreach (DB::query('SELECT "ID", "GUID" FROM "Member" WHERE "IsImportedFromLDAP" = 1') as $record) {
if (!isset($users[$record['GUID']])) {
$member = Member::get()->byId($record['ID']);
$member->delete();
$this->log(sprintf('Removing Member "%s" (GUID: %s) that no longer exists in LDAP.', $member->getName(), $member->GUID));
// cleanup object from memory
$member->destroy();
}
}
}
$end = time() - $start;
$this->log(sprintf('Done. Processed %s records. Duration: %s seconds', $count, round($end, 0)));
}
示例4: executeTransaction
protected function executeTransaction($conn, $arguments = array(), $options = array())
{
$n = (int) $options['number'];
$link = $options['link'];
if (null !== $link) {
$linkMember = Doctrine::getTable('Member')->find($link);
if (!$linkMember) {
throw new Exception("not found member: " . $link);
}
}
for ($i = 0; $i < $n; $i++) {
$member = new Member();
$member->setName('dummy');
$member->setIsActive(true);
$member->save();
$member->setName(sprintf($options['name-format'], $member->getId()));
$member->save();
$address = sprintf($options['mail-address-format'], $member->getId());
self::setMemberConfig($member->id, 'pc_address', $address);
self::setMemberConfig($member->id, 'mobile_address', $address);
$password = preg_replace("/%d/", $member->getId(), $options['password-format'], 1);
self::setMemberConfig($member->id, 'password', md5($password));
$this->logSection('member+', $member->getName());
if (isset($linkMember)) {
$memberRelationship1 = new MemberRelationship();
$memberRelationship1->setMemberIdTo($member->id);
$memberRelationship1->setMemberIdFrom($linkMember->id);
$memberRelationship1->setIsFriend(true);
$memberRelationship1->save();
$memberRelationship1->free(true);
$memberRelationship2 = new MemberRelationship();
$memberRelationship2->setMemberIdTo($linkMember->id);
$memberRelationship2->setMemberIdFrom($member->id);
$memberRelationship2->setIsFriend(true);
$memberRelationship2->save();
$memberRelationship2->free(true);
$this->logSection('friend link', sprintf("%s - %s", $linkMember->getId(), $member->getId()));
}
$member->free(true);
}
}
示例5: Parser
<?php
require_once e_PLUGIN . "e107dkp/includes/parsers/" . $_POST['parser'] . "/Parser.php";
require_once e_PLUGIN . "e107dkp/includes/models/Member.php";
global $ns;
$parser = new Parser($_POST['raidlog']);
// Report new members created.
$text .= "<h2>Raid Log Parse Report</h2>";
$text .= "<h3>Attendee Parsing Messages</h3><ul style=\"list-style: none;\">";
$attendees = array();
foreach ($parser->getAttendees() as $attendee) {
$member = Member::loadByName($attendee->name);
if (!$member) {
$member = new Member($attendee->name);
$member->save();
$text .= "<li>The attendee, " . $member->getName() . ", has not been seen before. A new record has been created.</li>";
$attendees[] = $member;
} else {
$attendees[] = $member;
}
}
$text .= "</ul>";
$text .= "<h3>Zone Parsing Messages</h3><ul style=\"list-style: none;\">";
$zone = Zone::loadByName($parser->getZone());
if ($zone == false) {
$zone = new Zone($parser->getZone());
$zone->save();
$text .= "<p>The zone, " . $zone->getName() . ", has not been seen before. A new record has been created.</p>";
}
$text .= "</ul>";
$text = "<div style=\"text-align: center;\">" . $text . "</div>";
示例6: setAuthorByMember
public function setAuthorByMember(Member $member)
{
sfContext::getInstance()->getConfiguration()->loadHelpers(array('Url', 'opUtil'));
$uri = url_for('@feeds_member_retrieve_resource_normal?model=member&id=' . $member->getId(), true);
$this->setAuthor($member->getName(), $uri);
}
示例7: setAuthorByMember
public function setAuthorByMember(Member $member)
{
$this->setAuthor($member->getName(), $member->getId());
}
示例8: memberToUser
public static function memberToUser(Member $member)
{
return array('id' => $member->getId(), 'name' => $member->getName(), 'screen_name' => $member->getName());
}