return $joins;
}
+ /** DELTATEN
+ */
+ private $dts = array();
+ const DELTATEN = 1;
+ const DELTATEN_MESSAGE = 2;
+ // TODO: terms
+
+ public function addDeltaTenFilter($type)
+ {
+ $this->requireProfiles();
+ switch ($type) {
+ case self::DELTATEN:
+ $this->dts['pdt'] = 'profile_deltaten';
+ return 'pdt';
+ case self::DELTATEN_MESSAGE:
+ $this->dts['pdtm'] = 'profile_deltaten';
+ return 'pdtm';
+ default:
+ Platal::page()->killError("Undefined DeltaTen filter.");
+ }
+ }
+
+ protected function deltatenJoins()
+ {
+ $joins = array();
+ foreach ($this->dts as $sub => $tab) {
+ $joins[$sub] = PlSqlJoin::left($tab, '$ME.pid = $PID');
+ }
+ return $joins;
+ }
+
/** MENTORING
*/
public function addMentorFilter($type)
{
- $this->requireAccounts();
+ $this->requireProfiles();
switch($type) {
case self::MENTOR:
$this->pms['pm'] = 'profile_mentor';
}
}
// }}}
+// {{{ class UFC_DeltaTen
+class UFC_DeltaTen extends UserFilterCondition
+{
+ public function buildCondition(PlFilter $uf)
+ {
+ $sub = $uf->addDeltaTenFilter(UserFilter::DELTATEN);
+ return $sub . '.message IS NOT NULL';
+ }
+}
+// }}}
+// {{{ class UFC_DeltaTen_Message
+/** Filters users by deltaten message
+ * @param $message Message for the DeltaTen program
+ */
+class UFC_DeltaTen_Message extends UserFilterCondition
+{
+ private $message;
+
+ public function __construct($message)
+ {
+ $this->message = $message;
+ }
+
+ public function buildCondition(PlFilter $uf)
+ {
+ $sub = $uf->addDeltaTenFilter(UserFilter::DELTATEN_MESSAGE);
+ return $sub . '.message ' . XDB::formatWildcards(XDB::WILDCARD_CONTAINS, $this->message);
+ }
+}
+// }}}
// {{{ class UFC_Contact
/** Filters users who belong to selected user's contacts
*/