コード例 #1
0
ファイル: Alerts.php プロジェクト: RichieDupes/PeoplePods
 function Alert($POD, $PARAMETERS = null)
 {
     parent::Msg($POD, 'alert', array('table_name' => 'alerts', 'table_shortname' => 'x', 'fields' => array('id', 'date', 'userId', 'targetUserId', 'targetContentId', 'targetContentType', 'message', 'status'), 'ignore_fields' => array('minutes'), 'joins' => array('u' => 'inner join users u on u.id=x.userId', 'g' => 'left join groups g on g.id=x.targetContentId and targetContentType=\'group\'', 'c' => 'left join comments c on c.id=x.targetContentId and targetContentType=\'comment\'', 'd' => 'left join content d on d.id=x.targetContentId and targetContentType=\'content\'', 'tu' => 'inner join users u on u.id=x.targetUserId')));
     if (!$this->success()) {
         return $this;
     }
     // load item by id or accept params
     if (isset($PARAMETERS['gid']) && sizeof($PARAMETERS) == 1) {
         $this->load('gid', $PARAMETERS['gid']);
     } else {
         if (isset($PARAMETERS['id']) && sizeof($PARAMETERS) == 1) {
             $this->load('id', $PARAMETERS['id']);
         } else {
             if ($PARAMETERS) {
                 foreach ($PARAMETERS as $key => $val) {
                     $this->set($key, $val);
                 }
             }
         }
     }
     return $this;
 }
コード例 #2
0
ファイル: Messages.php プロジェクト: RichieDupes/PeoplePods
 function Message($POD, $PARAMETERS = null)
 {
     parent::Msg($POD, 'message', array('table_name' => 'messages', 'table_shortname' => 'm', 'fields' => array('id', 'userId', 'targetUserId', 'fromId', 'message', 'date', 'status'), 'ignore_fields' => array('permalink', 'minutes'), 'joins' => array('from' => 'inner join users from on m.fromId=from.id', 'to' => 'inner join users to on m.targetUserId=to.id and m.fromId!=m.targetUserId')));
     if (isset($PARAMETERS['id']) && sizeof($PARAMETERS) == 2) {
         // load by ID
         $this->load('id', $PARAMETERS['id']);
     } else {
         if ($PARAMETERS) {
             foreach ($PARAMETERS as $key => $value) {
                 if ($key != 'POD') {
                     $this->set($key, $value);
                 }
             }
         }
     }
     return $this;
 }