Profile.php 629 B

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. namespace app\models;
  3. use \lithium\util\Validator;
  4. class Profile extends \lithium\data\Model {
  5. public static function __init()
  6. {
  7. Validator::add('ageism', function($birthday) {
  8. return true;
  9. } );
  10. }
  11. public $validates = array(
  12. 'birthday' => array(array('date'))
  13. );
  14. public static function history($animelist)
  15. {
  16. $al = $animelist->data();
  17. return profile::historySort($al, 'my_finish_date');
  18. }
  19. public static function historySort($a,$subkey) {
  20. foreach($a as $k=>$v) {
  21. $b[$k] = strtolower($v[$subkey]);
  22. }
  23. arsort($b);
  24. foreach($b as $key=>$val) {
  25. $c[] = $a[$key];
  26. }
  27. return $c;
  28. }
  29. }
  30. ?>