From b8d663bbe75e00e21c078b22ef9176116945ad54 Mon Sep 17 00:00:00 2001 From: Michael Francis Date: Sun, 5 Jun 2011 11:59:42 -0400 Subject: Added Recently watched (history) --- models/Profile.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'models') diff --git a/models/Profile.php b/models/Profile.php index a85be6d..83f82ae 100644 --- a/models/Profile.php +++ b/models/Profile.php @@ -12,6 +12,25 @@ class Profile extends \lithium\data\Model { public $validates = array( 'birthday' => array(array('date')) ); + + public static function history($animelist) + { + + $al = $animelist->data(); + return profile::historySort($al, 'my_finish_date'); + } + + + public static function historySort($a,$subkey) { + foreach($a as $k=>$v) { + $b[$k] = strtolower($v[$subkey]); + } + arsort($b); + foreach($b as $key=>$val) { + $c[] = $a[$key]; + } + return $c; + } } ?> \ No newline at end of file -- cgit v1.2.3