Profile.php 600 B

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