本文整理汇总了PHP中Avatar::getAvatar方法的典型用法代码示例。如果您正苦于以下问题:PHP Avatar::getAvatar方法的具体用法?PHP Avatar::getAvatar怎么用?PHP Avatar::getAvatar使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Avatar
的用法示例。
在下文中一共展示了Avatar::getAvatar方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: afterStoreCallback
public function afterStoreCallback()
{
if ($this->isDirty()) {
//add notification to writer of review
if (!$this->review['host_id'] && $this->review['user_id'] !== $this['user_id']) {
PersonalNotifications::add($this->review['user_id'], URLHelper::getURL("plugins.php/lernmarktplatz/market/discussion/" . $this['review_id'] . "#comment_" . $this->getId()), sprintf(_("%s hat einen Kommentar zu Ihrem Review geschrieben."), $this['host_id'] ? LernmarktplatzUser::find($this['user_id'])->name : get_fullname($this['user_id'])), "comment_" . $this->getId(), Icon::create("support", "clickable"));
}
//add notification to all users of this servers who discussed this review but are neither the new
//commentor nor the writer of the review
$statement = DBManager::get()->prepare("\n SELECT user_id\n FROM lernmarktplatz_comments\n WHERE review_id = :review_id\n AND host_id IS NULL\n GROUP BY user_id\n ");
$statement->execute(array('review_id' => $this->review->getId()));
foreach ($statement->fetchAll(PDO::FETCH_COLUMN, 0) as $user_id) {
if (!in_array($user_id, array($this->review['user_id'], $this['user_id']))) {
PersonalNotifications::add($user_id, URLHelper::getURL("plugins.php/lernmarktplatz/market/discussion/" . $this['review_id'] . "#comment_" . $this->getId()), sprintf(_("%s hat auch einen Kommentar geschrieben."), $this['host_id'] ? LernmarktplatzUser::find($this['user_id'])->name : get_fullname($this['user_id'])), "comment_" . $this->getId(), Icon::create("support", "clickable"));
}
}
//only push if the comment is from this server and the material-server is different
if (!$this['host_id']) {
$myHost = LernmarktplatzHost::thisOne();
$data = array();
$data['host'] = array('name' => $myHost['name'], 'url' => $myHost['url'], 'public_key' => $myHost['public_key']);
$data['data'] = $this->toArray();
$data['data']['foreign_comment_id'] = $data['data']['comment_id'];
unset($data['data']['comment_id']);
unset($data['data']['id']);
unset($data['data']['user_id']);
unset($data['data']['host_id']);
$user_description_datafield = DataField::find(get_config("LERNMARKTPLATZ_USER_DESCRIPTION_DATAFIELD")) ?: DataField::findOneBySQL("name = ?", array(get_config("LERNMARKTPLATZ_USER_DESCRIPTION_DATAFIELD")));
if ($user_description_datafield) {
$datafield_entry = DatafieldEntryModel::findOneBySQL("range_id = ? AND datafield_id = ?", array($this['user_id'], $user_description_datafield->getId()));
}
$data['user'] = array('user_id' => $this['user_id'], 'name' => get_fullname($this['user_id']), 'avatar' => Avatar::getAvatar($this['user_id'])->getURL(Avatar::NORMAL), 'description' => $datafield_entry ? $datafield_entry['content'] : null);
$statement = DBManager::get()->prepare("\n SELECT host_id\n FROM lernmarktplatz_comments\n WHERE review_id = :review_id\n AND host_id IS NOT NULL\n GROUP BY host_id\n ");
$statement->execute(array('review_id' => $this->review->getId()));
$hosts = $statement->fetchAll(PDO::FETCH_COLUMN, 0);
if ($this->review['host_id'] && !in_array($this->review['host_id'], $hosts)) {
$hosts[] = $this->review['host_id'];
}
if ($this->review->material['host_id'] && !in_array($this->review->material['host_id'], $hosts)) {
$hosts[] = $this->review->material['host_id'];
}
foreach ($hosts as $host_id) {
$remote = new LernmarktplatzHost($host_id);
if (!$remote->isMe()) {
$review_id = $this->review['foreign_review_id'] ?: $this->review->getId();
if ($this->review['foreign_review_id']) {
if ($this->review->host_id === $remote->getId()) {
$host_hash = null;
} else {
$host_hash = md5($this->review->host['public_key']);
}
} else {
$host_hash = md5($myHost['public_key']);
}
$remote->pushDataToEndpoint("add_comment/" . $review_id . "/" . $host_hash, $data);
}
}
}
}
}
示例2: afterStoreCallback
public function afterStoreCallback()
{
if (!$this->material['host_id'] && $this->material['user_id'] !== $GLOBALS['user']->id) {
PersonalNotifications::add($this->material['user_id'], URLHelper::getURL("plugins.php/lernmarktplatz/market/details/" . $this->material->getId() . "#review_" . $this->getId()), $this->isNew() ? sprintf(_("%s hat ein Review zu '%s' geschrieben."), $this['host_id'] ? LernmarktplatzUser::find($this['user_id'])->name : get_fullname($this['user_id']), $this->material['name']) : sprintf(_("%s hat ein Review zu '%s' verändert."), $this['host_id'] ? LernmarktplatzUser::find($this['user_id'])->name : get_fullname($this['user_id']), $this->material['name']), "review_" . $this->getId(), Icon::create("support", "clickable"));
}
//only push if the comment is from this server and the material-server is different
if ($this->material['host_id'] && !$this['host_id'] && $this->isDirty()) {
$remote = new LernmarktplatzHost($this->material['host_id']);
$myHost = LernmarktplatzHost::thisOne();
$data = array();
$data['host'] = array('name' => $myHost['name'], 'url' => $myHost['url'], 'public_key' => $myHost['public_key']);
$data['data'] = $this->toArray();
$data['data']['foreign_review_id'] = $data['data']['review_id'];
unset($data['data']['review_id']);
unset($data['data']['id']);
unset($data['data']['user_id']);
unset($data['data']['host_id']);
$user_description_datafield = DataField::find(get_config("LERNMARKTPLATZ_USER_DESCRIPTION_DATAFIELD")) ?: DataField::findOneBySQL("name = ?", array(get_config("LERNMARKTPLATZ_USER_DESCRIPTION_DATAFIELD")));
if ($user_description_datafield) {
$datafield_entry = DatafieldEntryModel::findOneBySQL("range_id = ? AND datafield_id = ?", array($this['user_id'], $user_description_datafield->getId()));
}
$data['user'] = array('user_id' => $this['user_id'], 'name' => get_fullname($this['user_id']), 'avatar' => Avatar::getAvatar($this['user_id'])->getURL(Avatar::NORMAL), 'description' => $datafield_entry ? $datafield_entry['content'] : null);
if (!$remote->isMe()) {
$remote->pushDataToEndpoint("add_review/" . $this->material['foreign_material_id'], $data);
}
}
}
示例3: map
/**
* Mapping function where to find what
* @param type $object the object
* @param type $function the called function
* @return string output
*/
private static function map($object, $function)
{
/**
* If you want to add an object to the helper simply add to this array
*/
$mapping = array('User' => array('link' => function ($obj) {
return URLHelper::getLink('dispatch.php/profile', array('username' => $obj->username));
}, 'name' => function ($obj) {
return htmlReady($obj->getFullname());
}, 'avatar' => function ($obj) {
return Avatar::getAvatar($obj->id, $obj->username)->getImageTag(Avatar::SMALL, array('title' => htmlReady($obj->getFullname('no_title'))));
}), 'Course' => array('link' => function ($obj) {
return URLHelper::getLink('seminar_main.php', array('auswahl' => $obj->id));
}, 'name' => function ($obj) {
return htmlReady($obj->name);
}, 'avatar' => function ($obj) {
return CourseAvatar::getAvatar($obj->id)->getImageTag($size = CourseAvatar::SMALL, array('title' => htmlReady($obj->name)));
}));
/*
* Some php magic to call the right function if it exists
*/
if ($object && $mapping[get_class($object)]) {
return $mapping[get_class($object)][$function]($object);
}
return "";
}
示例4: setUp
function setUp()
{
$stub = $this->getMock('Seminar_Perm');
// Configure the stub.
$stub->expects($this->any())->method('have_perm')->will($this->returnValue(true));
$GLOBALS['perm'] = $stub;
$GLOBALS['DYNAMIC_CONTENT_URL'] = "/dynamic";
$GLOBALS['DYNAMIC_CONTENT_PATH'] = "/dynamic";
$this->avatar_id = "123456789";
$this->avatar = Avatar::getAvatar($this->avatar_id);
}
示例5: exportUser
/**
* Export of a single user
*
* @param User $user Userobject
* @return String vCard export string
*/
private static function exportUser(User $user)
{
// If user is not visible export nothing
if (!get_visibility_by_id($user->id)) {
return "";
}
// vCard exportheader
$vCard['BEGIN'] = 'VCARD';
$vCard['VERSION'] = '3.0';
$vCard['PRODID'] = 'Stud.IP//' . $GLOBALS['UNI_NAME_CLEAN'] . '//DE';
$vCard['REV'] = date('Y-m-d H:i:s');
$vCard['TZ'] = date('O');
// User specific data
//Fullname
$vCard['FN'] = studip_utf8encode($user->getFullname());
//Name
$vCard['N'][] = studip_utf8encode($user->Nachname);
$vCard['N'][] = studip_utf8encode($user->Vorname);
$vCard['N'][] = studip_utf8encode($user->info->title_rear);
$vCard['N'][] = studip_utf8encode($user->info->title_front);
// Adress
if (Visibility::verify('privadr', $user->id)) {
$vCard['ADR;TYPE=HOME'] = studip_utf8encode($user->info->privadr);
}
// Tel
if (Visibility::verify('private_phone', $user->id)) {
$vCard['TEL;TYPE=HOME'] = studip_utf8encode($user->info->privatnr);
}
if (Visibility::verify('private_cell', $user->id)) {
$vCard['TEL;TYPE=CELL'] = studip_utf8encode($user->info->privatcell);
}
// Email
if (get_local_visibility_by_id($user->id, 'email')) {
$vCard['EMAIL'] = studip_utf8encode($user->email);
}
// Photo
if (Visibility::verify('picture', $user->id)) {
// Fetch avatar
$avatar = Avatar::getAvatar($user->id);
// Only export if
if ($avatar->is_customized()) {
$vCard['PHOTO;JPEG;ENCODING=BASE64'] = base64_encode(file_get_contents($avatar->getFilename(Avatar::NORMAL)));
}
}
// vCard end
$vCard['END'] = 'VCARD';
// Produce string
foreach ($vCard as $index => $value) {
$exportString .= $value ? $index . ':' . (is_array($value) ? join(';', $value) : $value) . "\r\n" : "";
}
return $exportString;
}
示例6: up
function up()
{
foreach (glob($GLOBALS['DYNAMIC_CONTENT_PATH'] . '/user/*.jpg') as $value) {
if (preg_match('/\\/([0-9a-f]+).jpg$/', $value, $matches)) {
try {
Avatar::getAvatar($matches[1])->createFrom($value);
} catch (Exception $e) {
$this->announce('Exception while converting avatar "%s"', $value);
$this->write($e->getMessage() . "\n");
}
@unlink($value);
}
}
}
示例7: getUser
/**
* getUser - retrieves data of a user
*
* @get /user/:user_id
* @get /user
*/
public function getUser($user_id = '')
{
$user_id = $user_id ?: $GLOBALS['user']->id;
$user = \User::find($user_id);
if (!$user) {
$this->halt(404, sprintf('User %s not found', $user_id));
}
$visibilities = get_local_visibility_by_id($user_id, 'homepage');
if (is_array(json_decode($visibilities, true))) {
$visibilities = json_decode($visibilities, true);
} else {
$visibilities = array();
}
$get_field = function ($field, $visibility) use($user_id, $user, $visibilities) {
if (!$user[$field] || !is_element_visible_for_user($GLOBALS['user']->id, $user_id, $visibilities[$visibility])) {
return '';
}
return $user[$field];
};
$avatar = \Avatar::getAvatar($user_id);
$user = array('user_id' => $user_id, 'username' => $user['username'], 'name' => self::getNamesOfUser($user), 'perms' => $user['perms'], 'email' => get_visible_email($user_id), 'avatar_small' => $avatar->getURL(\Avatar::SMALL), 'avatar_medium' => $avatar->getURL(\Avatar::MEDIUM), 'avatar_normal' => $avatar->getURL(\Avatar::NORMAL), 'avatar_original' => $avatar->getURL(\Avatar::ORIGINAL), 'phone' => $get_field('privatnr', 'private_phone'), 'homepage' => $get_field('Home', 'homepage'), 'privadr' => strip_tags($get_field('privadr', 'privadr')));
$query = "SELECT value\n FROM user_config\n WHERE field = ? AND user_id = ?";
$statement = \DBManager::get()->prepare($query);
$statement->execute(array('SKYPE_NAME', $user_id));
$user['skype'] = $statement->fetchColumn() ?: '';
$statement->closeCursor();
if ($user['skype']) {
$statement->execute(array('SKYPE_ONLINE_STATUS', $user_id));
$user['skype_show'] = (bool) $statement->fetchColumn();
} else {
$user['skype_show'] = false;
}
// Data fields
$datafields = array();
foreach (\DataFieldEntry::getDataFieldEntries($user_id, 'user') as $entry) {
if (!$entry->isVisible()) {
continue;
}
if (!\Visibility::verify($entry->getID(), $user_id)) {
continue;
}
$datafields[] = array('type' => $entry->getType(), 'id' => $entry->getId(), 'name' => $entry->getName(), 'value' => $entry->getValue());
}
$user['datafields'] = $datafields;
$this->etag(md5(serialize($user)));
return $user;
}
示例8: ajax_search_action
/**
* Ajax action used for searching persons.
*
* @param $name string name of MultiPersonSearch object
*/
public function ajax_search_action($name)
{
$searchterm = Request::get("s");
$searchterm = str_replace(",", " ", $searchterm);
$searchterm = preg_replace('/\\s+/', ' ', $searchterm);
$result = array();
// execute searchobject if searchterm is at least 3 chars long
if (strlen($searchterm) >= 3) {
$mp = MultiPersonSearch::load($name);
$searchObject = $mp->getSearchObject();
$result = array_map(function ($r) {
return $r['user_id'];
}, $searchObject->getResults($searchterm, array(), 50));
$result = User::findMany($result, 'ORDER BY nachname asc, vorname asc');
$alreadyMember = $mp->getDefaultSelectedUsersIDs();
}
$output = array();
foreach ($result as $user) {
$output[] = array('user_id' => $user->id, 'avatar' => Avatar::getAvatar($user->id)->getURL(Avatar::SMALL), 'text' => $user->nachname . ", " . $user->vorname . " -- " . $user->perms . " (" . $user->username . ")", 'member' => in_array($user->id, $alreadyMember));
}
$this->render_json($output);
}
示例9: upload_action
/**
* Upload a new avatar or removes the current avatar.
* Upon Sends an information email to the user if the action was not invoked
* by himself.
*/
public function upload_action()
{
$this->check_ticket();
if (Request::submitted('reset')) {
Avatar::getAvatar($this->user->user_id)->reset();
Visibility::removePrivacySetting('picture', $this->user->user_id);
$this->reportSuccess(_('Bild gelöscht.'));
} elseif (Request::submitted('upload')) {
try {
Avatar::getAvatar($this->user->user_id)->createFromUpload('imgfile');
NotificationCenter::postNotification('AvatarDidUpload', $this->user->user_id);
$message = _('Die Bilddatei wurde erfolgreich hochgeladen. ' . 'Eventuell sehen Sie das neue Bild erst, nachdem Sie diese Seite ' . 'neu geladen haben (in den meisten Browsern F5 drücken).');
$this->reportSuccess($message);
setTempLanguage($this->user->user_id);
$this->postPrivateMessage(_("Ein neues Bild wurde hochgeladen.\n"));
restoreLanguage();
Visibility::addPrivacySetting(_('Eigenes Bild'), 'picture', 'commondata', 1, $this->user->user_id);
} catch (Exception $e) {
$this->reportError($e->getMessage());
}
}
$this->redirect('settings/avatar');
}
示例10: foreach
?>
:
<? foreach (array_slice($related_users, 0, 3) as $key => $user_id) {
if ($key > 0) {
echo ", ";
}
echo get_fullname($user_id);
} ?>
<? if (count($related_users) > 3) : ?>
, ...
<? endif ?>
</div>
</div>
<div class="related_users">
<? foreach ($related_users as $user_id) {
echo Avatar::getAvatar($user_id)->getImageTag(Avatar::SMALL);
} ?>
</div>
<? else : ?>
<div class="contextinfo" title="<?php
echo _("Öffentlich");
?>
">
<div class="name"><?php
echo _("Öffentlich");
?>
</div>
</div>
<? endif ?>
<? if ($thread['context_type'] === "public") : ?>
<? $sharingusers = $thread->getSharingUsers() ?>
示例11: _
<?php
echo _('Aktionen');
?>
</th>
</tr>
</thead>
<tbody>
<? foreach ($invitedMembers as $p) : ?>
<tr>
<td>
<a href="<?php
echo URLHelper::getLink('dispatch.php/profile?username=' . $p['username']);
?>
">
<?php
echo Avatar::getAvatar($p['user_id'])->getImageTag(Avatar::SMALL);
?>
</a>
</td>
<td>
<a href="<?php
echo URLHelper::getLink('dispatch.php/profile?username=' . $p['username']);
?>
">
<?php
echo htmlReady($p['fullname']);
?>
</a>
</td>
<td class="actions">
<a href="<?php
示例12: pushDataToIndexServers
public function pushDataToIndexServers($delete = false)
{
$myHost = LernmarktplatzHost::thisOne();
$data = array();
$data['host'] = array('name' => $myHost['name'], 'url' => $myHost['url'], 'public_key' => $myHost['public_key']);
$data['data'] = $this->toArray();
$data['data']['foreign_material_id'] = $data['data']['material_id'];
unset($data['data']['material_id']);
unset($data['data']['id']);
unset($data['data']['user_id']);
unset($data['data']['host_id']);
$user_description_datafield = DataField::find(get_config("LERNMARKTPLATZ_USER_DESCRIPTION_DATAFIELD")) ?: DataField::findOneBySQL("name = ?", array(get_config("LERNMARKTPLATZ_USER_DESCRIPTION_DATAFIELD")));
if ($user_description_datafield) {
$datafield_entry = DatafieldEntryModel::findOneBySQL("range_id = ? AND datafield_id = ?", array($this['user_id'], $user_description_datafield->getId()));
}
$data['user'] = array('user_id' => $this['user_id'], 'name' => get_fullname($this['user_id']), 'avatar' => Avatar::getAvatar($this['user_id'])->getURL(Avatar::NORMAL), 'description' => $datafield_entry ? $datafield_entry['content'] : null);
$data['topics'] = array();
foreach ($this->getTopics() as $tag) {
if ($tag['name']) {
$data['topics'][] = $tag['name'];
}
}
if ($delete) {
$data['delete_material'] = 1;
}
foreach (LernmarktplatzHost::findBySQL("index_server = '1' AND allowed_as_index_server = '1' ") as $index_server) {
if (!$index_server->isMe()) {
echo " push ";
$index_server->pushDataToEndpoint("push_data", $data);
}
}
}
示例13: sprintf
<form action="<?php
echo $controller->url_for('oauth/authorize?oauth_token=' . $rs['token']);
?>
" method="post">
<p>
<?php
echo Studip\Button::createAccept('erlauben', 'allow');
?>
<?php
echo Studip\LinkButton::createCancel('verweigern', $rs['callback_url']);
?>
</p>
</form>
<p>
<?php
echo Avatar::getAvatar($GLOBALS['user']->id)->getImageTag(Avatar::SMALL);
?>
<?php
echo sprintf(_('Angemeldet als <strong>%s</strong> (%s)'), $name = get_fullname(), $GLOBALS['user']->username);
?>
<br>
<small>
<?php
echo sprintf(_('Sind sie nicht <strong>%s</strong>, so <a href="%s">melden Sie sich bitte ab</a> und versuchen es erneut.'), $name, URLHelper::getLink('logout.php'));
?>
</small>
</p>
</section>
示例14: _
<tr>
<td><strong><?php
echo _("Durchführende Dozenten");
?>
</strong></td>
<td>
<? $dozenten = $date->dozenten ?>
<? count($dozenten) > 0 || $dozenten = array_map(function ($m) { return $m->user; }, (Course::findCurrent()->getMembersWithStatus("dozent"))) ?>
<ul class="dozenten_list clean">
<? foreach ($dozenten as $dozent) : ?>
<li>
<a href="<?php
echo URLHelper::getLink("dispatch.php/profile", array('username' => $dozent['username']));
?>
"><?php
echo Avatar::getAvatar($dozent['user_id'])->getImageTag(Avatar::SMALL) . " " . htmlReady($dozent->getFullName());
?>
</a>
</li>
<? endforeach ?>
</ul>
</td>
</tr>
<tr>
<td><strong><?php
echo _("Beteiligte Gruppen");
?>
</strong></td>
<td>
<? $groups = $date->statusgruppen ?>
<? if (count($groups)) : ?>
示例15: htmlReady
</updated>
<content><?php
echo htmlReady(studip_utf8encode($posting['description']));
?>
</content>
<activity:verb>http://activitystrea.ms/schema/1.0/post</activity:verb>
<author>
<name><?php
echo htmlReady(studip_utf8encode($posting['user_id']));
?>
</name>
<uri><?php
echo $GLOBALS['ABSOLUTE_URI_STUDIP'] . "/about.php?username=" . get_username($posting['user_id']);
?>
</uri>
<link rel="alternate" type="text/html" href="<?php
echo $GLOBALS['ABSOLUTE_URI_STUDIP'] . "/about.php?username=" . get_username($posting['user_id']);
?>
"/>
<link rel="avatar" type="image/png" media:width="200" media:height="250" href="<?php
echo Avatar::getAvatar($posting['user_id'])->getURL(Avatar::NORMAL);
?>
"/>
</author>
<link rel="ostatus:conversation" href="<?php
echo $GLOBALS['ABSOLUTE_URI_STUDIP'] . "/plugins.php/Blubber/forum/thread/" . $posting['root_id'];
?>
"/>
</entry>
<? endforeach ?>
</feed>