本文整理匯總了PHP中ProfileField::getForPID方法的典型用法代碼示例。如果您正苦於以下問題:PHP ProfileField::getForPID方法的具體用法?PHP ProfileField::getForPID怎麽用?PHP ProfileField::getForPID使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ProfileField
的用法示例。
在下文中一共展示了ProfileField::getForPID方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: PlFlagSet
$pid = $row[0];
// Find the address which would be selected as "AX mail"
// But don't update anything
$best_mail = Address::updateBestMail($pid, true);
if (is_null($best_mail)) {
continue;
}
// Just continue if the returned address is already selected
$flags = new PlFlagSet($best_mail['flags']);
if ($flags->hasFlag('dn_best_mail')) {
continue;
}
// The current profile is buggy.
// Let's fetch more data to print detailed information
$profile = Profile::get($pid);
$addresses = ProfileField::getForPID('ProfileAddresses', array($pid), $admin_visibility);
$addresses = $addresses->get(Profile::ADDRESS_POSTAL);
$old_mail = null;
$new_mail = null;
foreach ($addresses as $addr) {
if ($addr->flags->hasFlag('dn_best_mail')) {
$old_mail = $addr;
} else {
if ($addr->id == $best_mail['id']) {
$new_mail = $addr;
}
}
}
echo "Profile " . $profile->hrid() . " ({$pid}) has a wrongly selected best mail.\n";
if (is_null($old_mail)) {
echo "... no currently selected best mail\n";
示例2: getProfileField
/** If not already done, fetches data for the given field
* @param $field One of the Profile::FETCH_*
* @return A ProfileField, or null
*/
private function getProfileField($field)
{
if (!array_key_exists($field, ProfileField::$fields)) {
Platal::page()->kill("Invalid field: {$field}");
}
if ($this->fetched($field)) {
return null;
} else {
$this->fetched_fields = $this->fetched_fields | $field;
}
$cls = ProfileField::$fields[$field];
return ProfileField::getForPID($cls, $this->id(), $this->visibility);
}