public function buildCondition(PlFilter &$uf)
{
- $ufc->requireAccounts();
+ $uf->requireAccounts();
return XDB::format('a.hruid IN {?}', $this->hruids);
}
}
}
// }}}
+// {{{ class UFC_Photo
+/** Filters profiles with photo
+ */
+class UFC_Photo implements UserFilterCondition
+{
+ public function buildCondition(PlFilter &$uf)
+ {
+ $uf->addPhotoFilter();
+ return 'photo.attach IS NOT NULL';
+ }
+}
+// }}}
+
// {{{ class UFC_Mentor_Expertise
/** Filters users by mentoring expertise
* @param $expertise Domain of expertise
return User::iterOverUIDs($this->getUIDs($limit));
}
- public function getProfiles($limit = null)
+ public function getProfiles($limit = null, $fields = 0x0000, $visibility = null)
{
- return Profile::getBulkProfilesWithPIDs($this->getPIDs($limit));
+ return Profile::getBulkProfilesWithPIDs($this->getPIDs($limit), $fields, $visibility);
}
- public function getProfile($pos = 0)
+ public function getProfile($pos = 0, $fields = 0x0000, $visibility = null)
{
$pid = $this->getPID($pos);
if ($pid == null) {
return null;
} else {
- return Profile::get($pid);
+ return Profile::get($pid, $fields, $visibility);
}
}
- public function iterProfiles($limit = null)
+ public function iterProfiles($limit = null, $fields = 0x0000, $visibility = null)
{
- return Profile::iterOverPIDs($this->getPIDs($limit));
+ return Profile::iterOverPIDs($this->getPIDs($limit), true, $fields, $visibility);
}
public function get($limit = null)
static public function assertName($name)
{
- if (!Profile::getNameTypeId($name)) {
+ if (!DirEnum::getID(DirEnum::NAMETYPES, $name)) {
Platal::page()->kill('Invalid name type: ' . $name);
}
}
if (!is_null($variant) && $variant == 'other') {
$sub .= $this->option++;
}
- $this->pn[$sub] = Profile::getNameTypeId($ft);
+ $this->pn[$sub] = DirEnum::getID(DirEnum::NAMETYPES, $ft);
return $sub;
}
{
$this->requireAccounts();
if (!is_null($group)) {
- if (ctype_digit($group)) {
+ if (is_int($group) || ctype_digit($group)) {
$index = $sub = $group;
} else {
$index = $group;
if (is_null($key)) {
$joins['gpa' . $sub] = PlSqlJoin::inner('groups');
$joins['gpm' . $sub] = PlSqlJoin::left('group_members', '$ME.uid = $UID AND $ME.asso_id = gpa' . $sub . '.id');
- } else if (ctype_digit($key)) {
+ } else if (is_int($key) || ctype_digit($key)) {
$joins['gpm' . $sub] = PlSqlJoin::left('group_members', '$ME.uid = $UID AND $ME.asso_id = ' . $key);
} else {
$joins['gpa' . $sub] = PlSqlJoin::inner('groups', '$ME.diminutif = {?}', $key);
}
+ /** PHOTOS
+ */
+ private $with_photo;
+ public function addPhotoFilter()
+ {
+ $this->requireProfiles();
+ $this->with_photo = true;
+ }
+
+ protected function photoJoins()
+ {
+ if ($this->with_photo) {
+ return array('photo' => PlSqlJoin::left('profile_photos', '$ME.pid = $PID'));
+ } else {
+ return array();
+ }
+ }
+
+
/** MARKETING
*/
private $with_rm;