summaryrefslogtreecommitdiffstats
path: root/models/Profile.php
blob: 83f82aec9c00dbf370f71b5502df2c63f2de774d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php

namespace app\models;

class Profile extends \lithium\data\Model {
	public static function __init() 
	{
		Validator::add('ageism', function($birthday) {
			return true;
		} );
	}
	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;
	}
}

?>