Archived
1
0
Fork 0

adding app/models/Data/ActivityLog.php

This commit is contained in:
Henrik Hautakoski 2018-04-01 11:04:07 +02:00
parent 05095a9c8e
commit 3f99105588

View file

@ -0,0 +1,131 @@
<?php
namespace App\Model\Data;
use \Phalcon\Paginator\Adapter\QueryBuilder;
class ActivityLog extends Base
{
protected $id;
protected $timestamp;
protected $user_id;
protected $ip;
protected $message;
/**
* @return mixed
*/
public function getId()
{
return $this->id;
}
/**
* @param mixed $id
* @return User
*/
public function setId($id)
{
$this->id = $id;
return $this;
}
/**
* @return mixed
*/
public function getTimestamp()
{
return $this->timestamp;
}
/**
* @param mixed $timestamp
* @return ActivityLog
*/
public function setTimestamp($timestamp)
{
$this->timestamp = $timestamp;
return $this;
}
/**
* @return mixed
*/
public function getUserId()
{
return $this->user_id;
}
/**
* @param mixed $user_id
* @return ActivityLog
*/
public function setUserId($user_id)
{
$this->user_id = $user_id;
return $this;
}
/**
* @return mixed
*/
public function getIp()
{
return $this->ip;
}
/**
* @param mixed $ip
* @return ActivityLog
*/
public function setIp($ip)
{
$this->ip = $ip;
return $this;
}
/**
* @return mixed
*/
public function getMessage()
{
return $this->message;
}
/**
* @param mixed $message
* @return ActivityLog
*/
public function setMessage($message)
{
$this->message = $message;
return $this;
}
/**
* @param $userid
* @param int $page
* @param int $limit
* @return \Phalcon\Paginator\AdapterInterface
*/
public static function getPaginationList($userid, $page = 1, $limit = 30)
{
$builder = (new self())->getModelsManager()->createBuilder();
$builder->from(self::class)
->where('user_id = :uid:', array('uid' => $userid))
->orderBy('timestamp DESC');
$paginator = new QueryBuilder(array(
'builder' => $builder,
'page' => $page,
'limit' => $limit
));
return $paginator;
}
}