本文整理汇总了PHP中Profile::getID方法的典型用法代码示例。如果您正苦于以下问题:PHP Profile::getID方法的具体用法?PHP Profile::getID怎么用?PHP Profile::getID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Profile
的用法示例。
在下文中一共展示了Profile::getID方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
function __construct(Profile $target, Profile $scoped = null, array $rsvp = array())
{
$stream = new RawEventsNoticeStream();
if ($target->sameAs($scoped)) {
$key = 'happening:ids_for_user_own:' . $target->getID();
} else {
$key = 'happening:ids_for_user:' . $target->getID();
}
// Match RSVP against our possible values, given in the class variable
// and if no RSVPs are given is empty, assume we want all events, even
// without RSVPs from this profile.
$this->rsvp = array_intersect($this->rsvp, $rsvp);
$this->target = $target;
parent::__construct(new CachingNoticeStream($stream, $key), $scoped);
}
示例2: saveNew
public static function saveNew(Notice $notice, Profile $target, $reason = null)
{
try {
$att = Attention::getByKeys(['notice_id' => $notice->getID(), 'profile_id' => $target->getID()]);
throw new AlreadyFulfilledException('Attention already exists with reason: ' . var_export($att->reason, true));
} catch (NoResultException $e) {
$att = new Attention();
$att->notice_id = $notice->getID();
$att->profile_id = $target->getID();
$att->reason = $reason;
$att->created = common_sql_now();
$result = $att->insert();
if ($result === false) {
throw new Exception('Failed Attention::saveNew for notice id==' . $notice->getID() . ' target id==' . $target->getID() . ', reason=="' . $reason . '"');
}
}
return $att;
}
示例3: cloneProfile
static function cloneProfile(Profile $prof)
{
$plugprof = new self();
if ($plugprof->getFromDB($prof->input['_old_id'])) {
$input = ToolBox::addslashes_deep($plugprof->fields);
$input['id'] = $prof->getID();
$plugprof->add($input);
}
}
示例4: removeEntry
public function removeEntry(Profile $actor, Notice $target)
{
$fave = new Fave();
$fave->user_id = $actor->getID();
$fave->notice_id = $target->getID();
if (!$fave->find(true)) {
// TRANS: Client error displayed when trying to remove a 'favor' when there is none in the first place.
throw new AlreadyFulfilledException(_('This is already not favorited.'));
}
$result = $fave->delete();
if ($result === false) {
common_log_db_error($fave, 'DELETE', __FILE__);
// TRANS: Server error displayed when removing a favorite from the database fails.
throw new ServerException(_('Could not delete favorite.'));
}
Fave::blowCacheForProfileId($actor->getID());
Fave::blowCacheForNoticeId($target->getID());
}
示例5: showProfileOptions
/**
* Build common remote-profile options structure.
* Currently only adds output for remote profiles, nothing for local users.
*
* @param HTMLOutputter $out
* @param Profile $profile
*/
protected function showProfileOptions(HTMLOutputter $out, Profile $profile)
{
if (!$profile->isGroup() && !$profile->isLocal()) {
$target = common_local_url('userbyid', array('id' => $profile->getID()));
// TRANS: Label for access to remote profile options.
$label = _m('Remote profile options...');
$out->elementStart('div', 'remote-profile-options');
$out->element('a', array('href' => $target), $label);
$out->elementEnd('div');
}
}
示例6: cloneProfile
/**
* if profile cloned
*
* @param $prof Profile object
**/
static function cloneProfile(Profile $prof)
{
global $DB;
$plugprof = new self();
$crit = array('profiles_id' => $prof->input['_old_id']);
foreach ($DB->request($plugprof->getTable(), $crit) as $data) {
$input = ToolBox::addslashes_deep($data);
unset($input['id']);
$input['profiles_id'] = $prof->getID();
$plugprof->add($input);
}
}
示例7: cloneProfile
/**
* if profile cloned
*
* @param $prof Profile object
**/
static function cloneProfile(Profile $prof)
{
global $DB;
///TODO check if needed, as core should already do this.
$profile_right = new ProfileRight();
$crit = array('profiles_id' => $prof->input['_old_id'], "`name` LIKE 'plugin_reports_%'");
$rights = array();
foreach ($DB->request($profile_right->getTable(), $crit) as $data) {
$rights[$data['name']] = $data['rights'];
}
unset($input['id']);
$profile_right->updateProfileRights($prof->getID(), $rights);
}
示例8: saveNew
public static function saveNew(Notice $notice, Profile $profile, $reason = null)
{
$att = new Attention();
$att->notice_id = $notice->getID();
$att->profile_id = $profile->getID();
$att->reason = $reason;
$att->created = common_sql_now();
$result = $att->insert();
if ($result === false) {
throw new Exception('Could not saveNew in Attention');
}
return $att;
}
示例9: getTagsArray
static function getTagsArray($tagger, $tagged, Profile $scoped = null)
{
$ptag = new Profile_tag();
$qry = sprintf('select profile_tag.tag ' . 'from profile_tag join profile_list ' . ' on (profile_tag.tagger = profile_list.tagger ' . ' and profile_tag.tag = profile_list.tag) ' . 'where profile_tag.tagger = %d ' . 'and profile_tag.tagged = %d ', $tagger, $tagged);
if (!$scoped instanceof Profile || $scoped->getID() !== $tagger) {
$qry .= 'and profile_list.private = 0';
}
$tags = array();
$ptag->query($qry);
while ($ptag->fetch()) {
$tags[] = $ptag->tag;
}
return $tags;
}
示例10: commonTemplateTags
/**
* Set common template tags for all profile aspects
* @param int $user the user id
* @return void
*/
private function commonTemplateTags($user)
{
// get a random sample of 6 friends.
require_once FRAMEWORK_PATH . 'models/relationships.php';
$relationships = new Relationships($this->registry);
$cache = $relationships->getByUser($user, true, 6);
$this->registry->getObject('template')->getPage()->addTag('profile_friends_sample', array('SQL', $cache));
// get the name and photo of the user
require_once FRAMEWORK_PATH . 'models/profile.php';
$profile = new Profile($this->registry, $user);
$name = $profile->getName();
$photo = $profile->getPhoto();
$uid = $profile->getID();
$this->registry->getObject('template')->getPage()->addTag('profile_name', $name);
$this->registry->getObject('template')->getPage()->addTag('profile_photo', $photo);
$this->registry->getObject('template')->getPage()->addTag('profile_user_id', $uid);
// clear the profile
$profile = "";
}
示例11: install
static function install(Migration $migration)
{
global $DB;
$profileRight = new ProfileRight();
$profile = new Profile();
//Update needed
if (TableExists('glpi_plugin_genericobject_profiles')) {
foreach (getAllDatasFromTable('glpi_plugin_genericobject_profiles') as $right) {
if (preg_match("/PluginGenericobject(.*)/", $right['itemtype'], $results)) {
$newrightname = 'plugin_genericobject_' . strtolower($results[1]) . 's';
if (!countElementsInTable('glpi_profilerights', "`profiles_id`='" . $right['profiles_id'] . "' \n AND `name`='{$newrightname}'")) {
switch ($right['right']) {
case NULL:
case '':
$rightvalue = 0;
break;
case 'r':
$rightvalue = READ;
break;
case 'w':
$rightvalue = ALLSTANDARDRIGHT;
break;
}
$profileRight->add(array('profiles_id' => $right['profiles_id'], 'name' => $newrightname, 'rights' => $rightvalue));
if (!countElementsInTable('glpi_profilerights', "`profiles_id`='" . $right['profiles_id'] . "' \n AND `name`='plugin_genericobject_types'")) {
$profileRight->add(array('profiles_id' => $right['profiles_id'], 'name' => 'plugin_genericobject_types', 'rights' => 23));
}
}
if ($right['open_ticket']) {
$profile->getFromDB($right['profiles_id']);
$helpdesk_item_types = json_decode($profile->fields['helpdesk_item_type'], true);
if (is_array($helpdesk_item_types)) {
if (!in_array($right['itemtype'], $helpdesk_item_types)) {
$helpdesk_item_types[] = $right['itemtype'];
}
} else {
$helpdesk_item_types = array($right['itemtype']);
}
$tmp['id'] = $profile->getID();
$tmp['helpdesk_item_type'] = json_encode($helpdesk_item_types);
$profile->update($tmp);
}
}
}
//$migration->dropTable('glpi_plugin_genericobject_profiles');
}
if (!countElementsInTable('glpi_profilerights', "`name` LIKE '%genericobject%'")) {
self::createFirstAccess();
}
}
示例12: realpath
*/
define('INSTALLDIR', realpath(dirname(__FILE__) . '/..'));
$shortoptions = 'y';
$longoptions = array('yes');
$helptext = <<<END_OF_HELP
clean_profiles.php [options]
Deletes all profile table entries where the profile does not occur in the
notice table, is not a group and is not a local user. Very MySQL specific I think.
WARNING: This has not been tested thoroughly. Maybe we've missed a table to compare somewhere.
-y --yes do not wait for confirmation
END_OF_HELP;
require_once INSTALLDIR . '/scripts/commandline.inc';
if (!have_option('y', 'yes')) {
print "About to delete profiles that we think are useless to save. Are you sure? [y/N] ";
$response = fgets(STDIN);
if (strtolower(trim($response)) != 'y') {
print "Aborting.\n";
exit(0);
}
}
print "Deleting";
$profile = new Profile();
$profile->query('SELECT * FROM profile WHERE ' . 'NOT (SELECT COUNT(*) FROM notice WHERE profile_id=profile.id) ' . 'AND NOT (SELECT COUNT(*) FROM user WHERE user.id=profile.id) ' . 'AND NOT (SELECT COUNT(*) FROM user_group WHERE user_group.profile_id=profile.id) ' . 'AND NOT (SELECT COUNT(*) FROM subscription WHERE subscriber=profile.id OR subscribed=profile.id) ');
while ($profile->fetch()) {
echo ' ' . $profile->getID() . ':' . $profile->getNickname();
$profile->delete();
}
print "\nDONE.\n";
示例13: newUri
static function newUri(Profile $actor, Managed_DataObject $object, $created = null)
{
if (is_null($created)) {
$created = common_sql_now();
}
return TagURI::mint(strtolower(get_called_class()) . ':%d:%s:%d:%s', $actor->getID(), ActivityUtils::resolveUri($object->getObjectType(), true), $object->getID(), common_date_iso8601($created));
}
示例14: saveAttention
/**
* Saves an attention for a profile (user or group) which means
* it shows up in their home feed and such.
*/
function saveAttention(Profile $target, $reason = null)
{
if ($target->isGroup()) {
// FIXME: Make sure we check (for both local and remote) users are in the groups they send to!
// legacy notification method, will still be in use for quite a while I think
$this->addToGroupInbox($target->getGroup());
} else {
if ($target->hasBlocked($this->getProfile())) {
common_log(LOG_INFO, "Not saving reply to profile {$target->id} ({$uri}) from sender {$sender->id} because of a block.");
return false;
}
}
if ($target->isLocal()) {
// legacy notification method, will still be in use for quite a while I think
$this->saveReply($target->getID());
}
$att = Attention::saveNew($this, $target, $reason);
self::blow('reply:stream:%d', $target->getID());
return true;
}
示例15: exists
static function exists(Profile $subscriber, Profile $other)
{
$sub = Subscription_queue::pkeyGet(array('subscriber' => $subscriber->getID(), 'subscribed' => $other->getID()));
return $sub instanceof Subscription_queue;
}