task_profile.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <?php
  2. /**
  3. * [Discuz!] (C)2001-2099 Comsenz Inc.
  4. * This is NOT a freeware, use is subject to license terms
  5. *
  6. * $Id: task_profile.php 24704 2011-10-08 10:19:11Z zhangguosheng $
  7. */
  8. if(!defined('IN_DISCUZ')) {
  9. exit('Access Denied');
  10. }
  11. class task_profile {
  12. var $version = '1.0';
  13. var $name = 'profile_name';
  14. var $description = 'profile_desc';
  15. var $copyright = '<a href="http://www.comsenz.com" target="_blank">Comsenz Inc.</a>';
  16. var $icon = '';
  17. var $period = '';
  18. var $periodtype = 0;
  19. var $conditions = array();
  20. function csc($task = array()) {
  21. global $_G;
  22. $data = $this->checkfield();
  23. if(!$data[0]) {
  24. return true;
  25. }
  26. return array('csc' => $data[1], 'remaintime' => 0);
  27. }
  28. function view() {
  29. $data = $this->checkfield();
  30. return lang('task/profile', 'profile_view', array('profiles' => implode(', ', $data[0])));
  31. }
  32. function checkfield() {
  33. global $_G;
  34. $fields = array('realname', 'gender', 'birthyear', 'birthmonth', 'birthday', 'bloodtype', 'affectivestatus',
  35. 'birthprovince','birthcity', 'resideprovince', 'residecity');
  36. loadcache('profilesetting');
  37. $fieldsnew = array();
  38. foreach($fields as $v) {
  39. if(isset($_G['cache']['profilesetting'][$v])) {
  40. $fieldsnew[$v] = $_G['cache']['profilesetting'][$v]['title'];
  41. }
  42. }
  43. if($fieldsnew) {
  44. space_merge($_G['member'], 'profile');
  45. $none = array();
  46. foreach($_G['member'] as $k => $v) {
  47. if(in_array($k, $fields, true) && !trim($v)) {
  48. $none[] = $fieldsnew[$k];
  49. }
  50. }
  51. $all = count($fields);
  52. $csc = intval(($all - count($none)) / $all * 100);
  53. return array($none, $csc);
  54. } else {
  55. return true;
  56. }
  57. }
  58. }
  59. ?>