ここの情報は古いです。ご理解頂いた上でお取り扱いください。

Changeset 11740


Ignore:
Timestamp:
May 25, 2009, 11:45:38 AM (11 years ago)
Author:
urabe
Message:

#3878 The function to display the birthday banner on the birthday was created.

Location:
OpenPNE3/branches/urabe/3878
Files:
4 added
6 edited

Legend:

Unmodified
Added
Removed
  • OpenPNE3/branches/urabe/3878/apps/mobile_frontend/i18n/messages.ja.xml

    r11584 r11740  
    391391        <target>管理者</target>
    392392      </trans-unit>
     393      <trans-unit id="">
     394        <source>Happy Birthday!</source>
     395        <target>今日は誕生日です</target>
     396      </trans-unit>
     397      <trans-unit id="">
     398        <source>It is member's birthday soon.</source>
     399        <target>もうすぐ誕生日です</target>
     400      </trans-unit>
    393401    </body>
    394402  </file>
  • OpenPNE3/branches/urabe/3878/apps/mobile_frontend/modules/member/actions/actions.class.php

    r11479 r11740  
    8383    $this->communitiesSize = 5;
    8484
     85    $id = $request->getParameter('id', $this->getUser()->getMemberId());
     86    $birthday = Doctrine::getTable('MemberProfile')->retrieveByMemberIdAndProfileName($id, 'birthday');
     87    $this->targetDay = opToolkit::extractTargetDay((string)$birthday);
     88
    8589    return parent::executeProfile($request);
    8690  }
  • OpenPNE3/branches/urabe/3878/apps/mobile_frontend/modules/member/templates/profileSuccess.php

    r11056 r11740  
    77</font>
    88<?php endif; ?>
     9<?php include_partial('member/birthdayBox', array('targetDay' => $targetDay)); ?>
    910
    1011<table width="100%" bgcolor="#EEEEFF">
  • OpenPNE3/branches/urabe/3878/apps/pc_frontend/modules/member/actions/actions.class.php

    r11479 r11740  
    113113    }
    114114
     115    $birthday = Doctrine::getTable('MemberProfile')->retrieveByMemberIdAndProfileName($id, 'birthday');
     116    $this->targetDay = opToolkit::extractTargetDay((string)$birthday);
     117
    115118    $result = parent::executeProfile($request);
    116119    return $result;
  • OpenPNE3/branches/urabe/3878/apps/pc_frontend/modules/member/templates/profileSuccess.php

    r11479 r11740  
    4747<?php slot('op_top'); ?>
    4848<?php if ($relation->isSelf()): ?>
     49<?php include_partial('member/birthdayBox', array('targetDay' => $targetDay)); ?>
    4950<?php ob_start() ?>
    5051<p><?php echo __('Other members look your page like this.') ?></p>
  • OpenPNE3/branches/urabe/3878/lib/util/opToolkit.class.php

    r10198 r11740  
    3939    $pieces = explode('@', $string, 2);
    4040    $domain = array_pop($pieces);
    41    
     41
    4242    return in_array($domain, self::getMobileMailAddressDomains());
    4343  }
     
    166166    return $result;
    167167  }
     168
     169/**
     170 * This method calculates how many days to go until specified day.
     171 *
     172 * @param string $targetDay
     173 * @return int between from target days.
     174 */
     175  public static function extractTargetDay($targetDay)
     176  {
     177    list(, $m, $d) = explode('-', $targetDay);
     178
     179    $m = (int)$m;
     180    $d = (int)$d;
     181
     182    if ($m == 0 || $d == 0) {
     183      return -1;
     184    }
     185
     186    $y = date('Y');
     187
     188    $today = mktime(0, 0, 0);
     189
     190    $theday_thisyear = mktime(0, 0, 0, $m, $d, $y);
     191    $theday_nextyear = mktime(0, 0, 0, $m, $d, $y + 1);
     192
     193    if ($theday_thisyear < $today) {
     194      $theday_next = $theday_nextyear;
     195    } else {
     196      $theday_next = $theday_thisyear;
     197    }
     198
     199    return ($theday_next - $today) / 86400;
     200  }
    168201}
Note: See TracChangeset for help on using the changeset viewer.