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

Changeset 12543


Ignore:
Timestamp:
Aug 6, 2009, 8:40:07 AM (10 years ago)
Author:
urabe
Message:

#3878 誕生日バナー機能をtrunkにコミットします

Location:
OpenPNE3/trunk
Files:
5 edited
4 copied

Legend:

Unmodified
Added
Removed
  • OpenPNE3/trunk/apps/mobile_frontend/i18n/messages.ja.xml

    r12470 r12543  
    640640        <target>既に写真が登録されています。新しい写真を登録したい場合は、古い画像を削除してください。</target>
    641641      </trans-unit>
     642      <trans-unit id="">
     643        <source>Happy Birthday!</source>
     644        <target>今日は誕生日です</target>
     645      </trans-unit>
     646      <trans-unit id="">
     647        <source>It is member's birthday soon.</source>
     648        <target>もうすぐ誕生日です</target>
     649      </trans-unit>
    642650    </body>
    643651  </file>
  • OpenPNE3/trunk/apps/mobile_frontend/modules/member/templates/profileSuccess.php

    r12470 r12543  
    77</font>
    88<?php endif; ?>
     9<?php include_partial('member/birthdayBox', array('targetDay' => $targetDay)); ?>
    910
    1011<?php if ($mobileTopGadgets) : ?>
  • OpenPNE3/trunk/apps/pc_frontend/modules/member/templates/profileSuccess.php

    r11715 r12543  
    4545<?php slot('op_top'); ?>
    4646<?php if ($relation->isSelf()): ?>
     47<?php include_partial('member/birthdayBox', array('targetDay' => $targetDay)); ?>
    4748<?php ob_start() ?>
    4849<p><?php echo __('Other members look your page like this.') ?></p>
  • OpenPNE3/trunk/lib/action/sfOpenPNEMemberAction.class.php

    r12346 r12543  
    158158    $this->crownIds = Doctrine::getTable('CommunityMember')->getCommunityIdsOfAdminByMemberId($id);
    159159
     160    $birthday = Doctrine::getTable('MemberProfile')->retrieveByMemberIdAndProfileName($id, 'birthday');
     161    $this->targetDay = opToolkit::extractTargetDay((string)$birthday);
     162
    160163    return sfView::SUCCESS;
    161164  }
  • OpenPNE3/trunk/lib/util/opToolkit.class.php

    r12302 r12543  
    3939    $pieces = explode('@', $string, 2);
    4040    $domain = array_pop($pieces);
    41    
     41
    4242    return in_array($domain, self::getMobileMailAddressDomains());
    4343  }
     
    211211    $widget->setAttribute('mode', $mode);
    212212  }
     213
     214/**
     215 * This method calculates how many days to go until specified day.
     216 *
     217 * @param string $targetDay
     218 * @return int between from target days.
     219 */
     220  public static function extractTargetDay($targetDay)
     221  {
     222    list(, $m, $d) = explode('-', $targetDay);
     223
     224    $m = (int)$m;
     225    $d = (int)$d;
     226
     227    if ($m == 0 || $d == 0) {
     228      return -1;
     229    }
     230
     231    $y = date('Y');
     232
     233    $today = mktime(0, 0, 0);
     234
     235    $theday_thisyear = mktime(0, 0, 0, $m, $d, $y);
     236    $theday_nextyear = mktime(0, 0, 0, $m, $d, $y + 1);
     237
     238    if ($theday_thisyear < $today) {
     239      $theday_next = $theday_nextyear;
     240    } else {
     241      $theday_next = $theday_thisyear;
     242    }
     243
     244    return ($theday_next - $today) / 86400;
     245  }
    213246}
Note: See TracChangeset for help on using the changeset viewer.