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

Changeset 11155


Ignore:
Timestamp:
Mar 24, 2009, 10:25:04 PM (10 years ago)
Author:
ebihara
Message:

#3672:added ability to handle community event members

Location:
OpenPNE3/plugins/opCommunityTopicPlugin/trunk
Files:
12 added
12 edited

Legend:

Unmodified
Added
Removed
  • OpenPNE3/plugins/opCommunityTopicPlugin/trunk/apps/pc_frontend/i18n/community_event_form.ja.xml

    r11143 r11155  
    2929      <trans-unit id="7">
    3030        <source>Capacity</source>
    31         <target>定員</target>
     31        <target>募集人数</target>
     32      </trans-unit>
     33      <trans-unit id="8">
     34        <source>Count of Member</source>
     35        <target>参加人数</target>
    3236      </trans-unit>
    3337    </body>
  • OpenPNE3/plugins/opCommunityTopicPlugin/trunk/apps/pc_frontend/i18n/messages.ja.xml

    r11102 r11155  
    5151        <target>コミュニティ最新書き込み</target>
    5252      </trans-unit>
     53      <trans-unit id="">
     54        <source>See Member List</source>
     55        <target>参加者一覧を見る</target>
     56      </trans-unit>
     57      <trans-unit id="">
     58        <source>Event</source>
     59        <target>イベント</target>
     60      </trans-unit>
     61      <trans-unit id="">
     62        <source>Community Events</source>
     63        <target>コミュニティイベント</target>
     64      </trans-unit>
     65      <trans-unit id="">
     66        <source>Post a new event comment</source>
     67        <target>コメントを書く</target>
     68      </trans-unit>
     69      <trans-unit id="">
     70        <source>Add a comment only</source>
     71        <target>コメントのみ書き込む</target>
     72      </trans-unit>
     73      <trans-unit id="">
     74        <source>Cancel</source>
     75        <target>参加を取り消す</target>
     76      </trans-unit>
     77      <trans-unit id="">
     78        <source>Participate in this event</source>
     79        <target>このイベントに参加する</target>
     80      </trans-unit>
     81      <trans-unit id="">
     82        <source>Create a new event</source>
     83        <target>イベントを作成する</target>
     84      </trans-unit>
     85      <trans-unit id="">
     86        <source>Delete the event and comments</source>
     87        <target>イベントと書き込みを削除する</target>
     88      </trans-unit>
     89      <trans-unit id="">
     90        <source>List of events</source>
     91        <target>イベント一覧</target>
     92      </trans-unit>
     93      <trans-unit id="">
     94        <source>The community event was deleted successfully.</source>
     95        <target>イベントの削除が完了しました。</target>
     96      </trans-unit>
     97      <trans-unit id="">
     98        <source>Edit the event</source>
     99        <target>イベントを編集する</target>
     100      </trans-unit>
     101      <trans-unit id="">
     102        <source>Do you really delete this event?</source>
     103        <target>本当にこのイベントを削除しますか?</target>
     104      </trans-unit>
    53105    </body>
    54106  </file>
  • OpenPNE3/plugins/opCommunityTopicPlugin/trunk/apps/pc_frontend/modules/communityEvent/templates/showSuccess.php

    r11143 r11155  
    55$list = array(
    66  'Name'                 => $communityEvent->getName(),
    7   'Open date'            => $communityEvent->getOpenDate(),
     7  'Open date'            => op_format_date($communityEvent->getOpenDate(), 'D'),
    88  'Area'                 => $communityEvent->getArea(),
    9   'Application deadline' => $communityEvent->getApplicationDeadline(),
     9  'Body'                 => nl2br($communityEvent->getBody()),
     10  'Application deadline' => op_format_date($communityEvent->getApplicationDeadline(), 'D'),
    1011  'Capacity'             => $communityEvent->getCapacity(),
    11   'Body'                 => nl2br($communityEvent->getBody()),
     12  'Count of Member'      => $communityEvent->countCommunityEventMembers(),
    1213);
     14
     15if ($list['Count of Member'])
     16{
     17  $list['Count of Member'] .= '('.link_to(__('See Member List'), '@communityEvent_memberList?id='.$communityEvent->getId()).')';
     18}
    1319
    1420$i18nlist = array();
     
    2834<?php if ($communityEvent->isEditable($sf_user->getMemberId())): ?>
    2935<div class="operation">
    30 <form action="<?php echo url_for('communityEvent_edit', $communityEvent) ?>" method="get">
     36<form action="<?php echo url_for('@communityEvent_edit?id='.$communityEvent->getId()) ?>" method="get">
    3137<ul class="moreInfo button">
    3238<li><input class="input_submit" type="submit" value="<?php echo __('Edit') ?>" /></li>
     
    3945
    4046<?php if ($communityEvent->isCreatableCommunityEventComment($sf_user->getMemberId())): ?>
    41 <?php
    42 $options = array();
    43 $options['title'] = __('Post a new event comment');
    44 $options['url'] = url_for('communityEvent_comment_create', $communityEvent);
    45 op_include_form('formCommunityEventComment', $form, $options);
    46 ?>
     47<form action="<?php echo url_for('@communityEvent_comment_create?id='.$communityEvent->getId()) ?>" method="post">
     48<div class="parts form">
     49<div class="partsHeading">
     50<h3><?php echo __('Post a new event comment') ?></h3>
     51</div>
     52<table>
     53<?php echo $form ?>
     54</table>
     55<div class="operation">
     56<ul class="moreInfo button">
     57<?php if ($communityEvent->isEventMember($sf_user->getMemberId())): ?>
     58<li><input name="cancel" class="input_submit" type="submit" value="<?php echo __('Cancel') ?>" /></li>
     59<?php else: ?>
     60<li><input name="participate" class="input_submit" type="submit" value="<?php echo __('Participate in this event') ?>" /></li>
     61<?php endif; ?>
     62<li><input name="comment" class="input_submit" type="submit" value="<?php echo __('Add a comment only') ?>" /></li>
     63</ul>
     64</div>
     65</div>
     66</form>
    4767<?php endif; ?>
    4868
  • OpenPNE3/plugins/opCommunityTopicPlugin/trunk/config/schema.yml

    r11143 r11155  
    2929    updated_at: ~
    3030    event_updated_at: { type: timestamp }
    31     open_date: { type: timestamp }
     31    open_date: { type: timestamp, required: true }
    3232    open_date_comment: { type: longvarchar }
    3333    area: { type: longvarchar }
     
    4242    body: { type: longvarchar, required: true }
    4343    created_at: ~
     44
     45  community_event_member:
     46    id: ~
     47    community_event_id: { type: integer, required: true, foreignTable: community_event, foreignReference: id, onDelete: cascade }
     48    member_id: { type: integer, required: true, foreignTable: member, foreignReference: id, onDelete: cascade }
  • OpenPNE3/plugins/opCommunityTopicPlugin/trunk/data/fixtures/020_navigation.yml

    r10508 r11155  
    44    uri: "communityTopic/listCommunity"
    55    sort_order: 5
     6
     7  community_navigation_event:
     8    type: "community"
     9    uri: "communityEvent/listCommunity"
     10    sort_order: 6
    611
    712NavigationI18n:
     
    1419    caption: "トピックリスト"
    1520    culture: "ja_JP"
     21  community_navigation_event_i18n_en:
     22    id: community_navigation_event
     23    caption: "Events"
     24    culture: "en"
     25  community_navigation_event_i18n_ja:
     26    id: community_navigation_event
     27    caption: "イベントリスト"
     28    culture: "ja_JP"
  • OpenPNE3/plugins/opCommunityTopicPlugin/trunk/lib/action/opCommunityTopicPluginEventActions.class.php

    r11143 r11155  
    7777
    7878  /**
     79   * Executes memberList action
     80   *
     81   * @param sfRequest $request A request object
     82   */
     83  public function executeMemberList($request)
     84  {
     85    $this->forward404Unless($this->community->isViewableCommunityTopic($this->getUser()->getMemberId()));
     86
     87    if (!$this->size)
     88    {
     89      $this->size = 20;
     90    }
     91    $this->pager = CommunityEventPeer::getEventMemberListPager($this->communityEvent->getId(), $request->getParameter('page', 1), $this->size);
     92
     93    if (!$this->pager->getNbResults()) {
     94      return sfView::ERROR;
     95    }
     96  }
     97
     98  /**
    7999   * Executes new action
    80100   *
  • OpenPNE3/plugins/opCommunityTopicPlugin/trunk/lib/action/opCommunityTopicPluginEventCommentActions.class.php

    r11143 r11155  
    5353    if ($this->form->isValid())
    5454    {
     55      if (!$request->getParameter('comment'))
     56      {
     57        $this->form->getObject()->toggleEventMember($this->getUser()->getMemberId());
     58      }
    5559      $this->form->save();
     60
    5661      $this->redirect('@communityEvent_show?id='.$this->communityEvent->getId());
    5762    }
  • OpenPNE3/plugins/opCommunityTopicPlugin/trunk/lib/form/CommunityEventForm.class.php

    r11143 r11155  
    2727    unset($this['event_updated_at']);
    2828
     29    $dateParam = array(
     30      'culture'      => sfContext::getInstance()->getUser()->getCulture(),
     31      'month_format' => 'number',
     32    );
     33
    2934    $this->setWidget('name', new sfWidgetFormInput());
     35    $this->setWidget('open_date', new opWidgetFormDate($dateParam));
     36    $this->setWidget('application_deadline', new opWidgetFormDate(array_merge($dateParam, array('can_be_empty' => true))));
     37    $this->setWidget('open_date_comment', new sfWidgetFormInput());
     38    $this->setWidget('area', new sfWidgetFormInput());
     39
    3040    $this->widgetSchema->getFormFormatter()->setTranslationCatalogue('community_event_form');
    3141  }
  • OpenPNE3/plugins/opCommunityTopicPlugin/trunk/lib/model/CommunityEvent.php

    r11143 r11155  
    2626  }
    2727
     28  public function isEventMember($memberId)
     29  {
     30    return (bool)CommunityEventMemberPeer::retrieveByEventIdAndMemberId($this->getId(), $memberId);
     31  }
     32
    2833  public function isEventModified()
    2934  {
     
    4348    parent::save($con);
    4449  }
     50
     51  public function toggleEventMember($memberId)
     52  {
     53    if ($this->isEventMember($memberId))
     54    {
     55      $eventMember = CommunityEventMemberPeer::retrieveByEventIdAndMemberId($this->getId(), $memberId);
     56      $eventMember->delete();
     57    }
     58    else
     59    {
     60      $eventMember = new CommunityEventMember();
     61      $eventMember->setCommunityEventId($this->getId());
     62      $eventMember->setMemberId($memberId);
     63
     64      $this->addCommunityEventMember($eventMember);
     65    }
     66  }
    4567}
  • OpenPNE3/plugins/opCommunityTopicPlugin/trunk/lib/model/CommunityEventComment.php

    r11143 r11155  
    1717    parent::save($con);
    1818  }
     19
     20  public function toggleEventMember($memberId)
     21  {
     22    $this->getCommunityEvent()->toggleEventMember($memberId);
     23  }
    1924}
  • OpenPNE3/plugins/opCommunityTopicPlugin/trunk/lib/model/CommunityEventPeer.php

    r11143 r11155  
    6666    return $pager;
    6767  }
     68
     69  public static function getEventMemberListPager($eventId, $page = 1, $size = 20)
     70  {
     71    $c = new Criteria();
     72    $c->add(CommunityEventMemberPeer::COMMUNITY_EVENT_ID, $eventId);
     73    $c->addJoin(MemberPeer::ID, CommunityEventMemberPeer::MEMBER_ID);
     74
     75    $pager = new sfPropelPager('Member', $size);
     76    $pager->setCriteria($c);
     77    $pager->setPage($page);
     78    $pager->init();
     79
     80    return $pager;
     81  }
    6882}
  • OpenPNE3/plugins/opCommunityTopicPlugin/trunk/lib/opCommunityTopicPluginRouting.class.php

    r11143 r11155  
    2626      'event' => new opCommunityTopicPluginRouteCollection(array('name' => 'event')),
    2727
     28      'communityEvent_memberList' => new sfPropelRoute(
     29        '/communityEvent/:id/memberList',
     30        array('module' => 'communityEvent', 'action' => 'memberList'),
     31        array('id' => '\d+'),
     32        array('model' => 'CommunityEvent', 'type' => 'object')
     33      ),
     34
    2835      'communityTopic_nodefaults' => new sfRoute(
    2936        '/communityTopic/*',
Note: See TracChangeset for help on using the changeset viewer.