summaryrefslogtreecommitdiffstats
path: root/models
diff options
context:
space:
mode:
authorMichael Francis <edude03@gmail.com>2011-06-05 11:59:42 -0400
committerMichael Francis <edude03@gmail.com>2011-06-05 11:59:42 -0400
commitb8d663bbe75e00e21c078b22ef9176116945ad54 (patch)
treee069a02bf9accc9ca5c420092c61b4afc6fcd242 /models
parent1f30528f63a7fc1f33cfa99eaef5117b71d716a5 (diff)
downloadotakuhub-b8d663bbe75e00e21c078b22ef9176116945ad54.tar.xz
Added Recently watched (history)
Diffstat (limited to 'models')
-rw-r--r--models/Profile.php19
1 files changed, 19 insertions, 0 deletions
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