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

Changeset 11577


Ignore:
Timestamp:
May 4, 2009, 4:32:44 AM (13 years ago)
Author:
ebihara
Message:

changed for using some Doctrinized models and using the new ACLBuilder system

Location:
OpenPNE3/plugins/opCommunityTopicPlugin/branches/goto_doctrine
Files:
3 added
21 edited

Legend:

Unmodified
Added
Removed
  • OpenPNE3/plugins/opCommunityTopicPlugin/branches/goto_doctrine/apps/mobile_frontend/modules/communityEvent/templates/_communityEventList.php

    r11174 r11577  
    1 <?php if ($community->isViewableCommunityTopic($sf_user->getMemberId())): ?>
     1<?php $acl = opCommunityTopicAclBuilder::buildCollection($community, array($sf_user->getMember())) ?>
     2
     3<?php if ($acl->isAllowed($sf_user->getMemberId(), null, 'view')): ?>
    24<?php use_helper('Date') ?>
    35<?php
     
    1820  $moreInfo[] = link_to(__('More'), 'communityEvent_list_community', $community);
    1921}
    20 if ($community->isCreatableCommunityTopic($sf_user->getMemberId()))
     22if ($acl->isAllowed($sf_user->getMemberId(), null, 'add'))
    2123{
    2224  $moreInfo[] = link_to(__('Create a new event'), 'communityEvent_new', $community);
  • OpenPNE3/plugins/opCommunityTopicPlugin/branches/goto_doctrine/apps/mobile_frontend/modules/communityTopic/templates/_communityTopicList.php

    r11102 r11577  
    1 <?php if ($community->isViewableCommunityTopic($sf_user->getMemberId())): ?>
     1<?php $acl = opCommunityTopicAclBuilder::buildCollection($community, array($sf_user->getMember())) ?>
     2
     3<?php if ($acl->isAllowed($sf_user->getMemberId(), null, 'view')): ?>
    24<?php use_helper('Date') ?>
    35<?php
     
    1820  $moreInfo[] = link_to(__('More'), 'communityTopic_list_community', $community);
    1921}
    20 if ($community->isCreatableCommunityTopic($sf_user->getMemberId()))
     22if ($acl->isAllowed($sf_user->getMemberId(), null, 'add'))
    2123{
    2224  $moreInfo[] = link_to(__('Create a new topic'), 'communityTopic_new', $community);
  • OpenPNE3/plugins/opCommunityTopicPlugin/branches/goto_doctrine/apps/mobile_frontend/modules/communityTopic/templates/showSuccess.php

    r11102 r11577  
     1<?php $acl = opCommunityTopicAclBuilder::buildResource($communityTopic, array($sf_user->getMember())) ?>
    12<?php op_mobile_page_title($community->getName(), $communityTopic->getName()) ?>
    23
     
    1516
    1617<?php echo op_within_page_link('') ?>
    17 <?php if ($communityTopic->isCreatableCommunityTopicComment($sf_user->getMemberId())): ?>
     18<?php if ($acl->isAllow($sf_user->getMemberId(), null, 'addComment')): ?>
    1819<hr>
    1920<?php
  • OpenPNE3/plugins/opCommunityTopicPlugin/branches/goto_doctrine/apps/pc_frontend/modules/communityEvent/templates/_communityEventList.php

    r11143 r11577  
    1 <?php if ($community->isViewableCommunityTopic($sf_user->getMemberId())): ?>
     1<?php $acl = opCommunityTopicAclBuilder::buildCollection($community, array($sf_user->getMember())) ?>
     2
     3<?php if ($acl->isAllowed($sf_user->getMemberId(), null, 'view')): ?>
    24<?php $sf_response->addStylesheet('/opCommunityTopicPlugin/css/communityTopic') ?>
    35<?php use_helper('Date'); ?>
     
    1012<li>
    1113<span class="date"><?php echo op_format_date($communityEvent->getUpdatedAt(), 'XShortDateJa'); ?></span>
    12 <?php echo link_to(sprintf('%s(%d)', op_truncate($communityEvent->getName(), 36), $communityEvent->countCommunityEventComments()), 'communityEvent_show', $communityEvent) ?>
     14<?php echo link_to(sprintf('%s(%d)', op_truncate($communityEvent->getName(), 36), $communityEvent->getCommunityEventComment()->count()), 'communityEvent_show', $communityEvent) ?>
    1315</li>
    1416<?php endforeach; ?>
     
    2022<li><?php echo link_to(__('More'), 'communityEvent_list_community', $community); ?></li>
    2123<?php endif; ?>
    22 <?php if ($community->isCreatableCommunityTopic($sf_user->getMemberId())): ?>
     24<?php if ($acl->isAllowed($sf_user->getMemberId(), null, 'add')): ?>
    2325<li><?php echo link_to(__('Create a new event'), 'communityEvent_new', $community); ?></li>
    2426<?php endif; ?>
  • OpenPNE3/plugins/opCommunityTopicPlugin/branches/goto_doctrine/apps/pc_frontend/modules/communityEvent/templates/listCommunitySuccess.php

    r11143 r11577  
    1 <?php use_helper('Date'); ?>
     1<?php $acl = opCommunityTopicAclBuilder::buildCollection($community, array($sf_user->getMember())) ?>
    22
    3 <?php if ($community->isCreatableCommunityTopic($sf_user->getMemberId())): ?>
     3<?php if ($acl->isAllowed($sf_user->getMemberId(), null, 'view')): ?>
    44<?php
    55op_include_parts('buttonBox', 'communityEventList', array(
  • OpenPNE3/plugins/opCommunityTopicPlugin/branches/goto_doctrine/apps/pc_frontend/modules/communityEvent/templates/showSuccess.php

    r11155 r11577  
    1010  'Application deadline' => op_format_date($communityEvent->getApplicationDeadline(), 'D'),
    1111  'Capacity'             => $communityEvent->getCapacity(),
    12   'Count of Member'      => $communityEvent->countCommunityEventMembers(),
     12  'Count of Member'      => $communityEvent->getCommunityEventMember()->count(),
    1313);
    1414
  • OpenPNE3/plugins/opCommunityTopicPlugin/branches/goto_doctrine/apps/pc_frontend/modules/communityTopic/templates/_communityTopicList.php

    r11102 r11577  
    1 <?php if ($community->isViewableCommunityTopic($sf_user->getMemberId())): ?>
     1<?php $acl = opCommunityTopicAclBuilder::buildCollection($community, array($sf_user->getMember())) ?>
     2
     3<?php if ($acl->isAllowed($sf_user->getMemberId(), null, 'view')): ?>
    24<?php $sf_response->addStylesheet('/opCommunityTopicPlugin/css/communityTopic') ?>
    35<?php use_helper('Date'); ?>
     
    1012<li>
    1113<span class="date"><?php echo op_format_date($communityTopic->getUpdatedAt(), 'XShortDateJa'); ?></span>
    12 <?php echo link_to(sprintf('%s(%d)', op_truncate($communityTopic->getName(), 36), $communityTopic->countCommunityTopicComments()), 'communityTopic_show', $communityTopic) ?>
     14<?php echo link_to(sprintf('%s(%d)', op_truncate($communityTopic->getName(), 36), $communityTopic->getCommunityTopicComment()->count()), 'communityTopic_show', $communityTopic) ?>
    1315</li>
    1416<?php endforeach; ?>
     
    2022<li><?php echo link_to(__('More'), 'communityTopic_list_community', $community); ?></li>
    2123<?php endif; ?>
    22 <?php if ($community->isCreatableCommunityTopic($sf_user->getMemberId())): ?>
     24<?php if ($acl->isAllowed($sf_user->getMemberId(), null, 'add')): ?>
    2325<li><?php echo link_to(__('Create a new topic'), 'communityTopic_new', $community); ?></li>
    2426<?php endif; ?>
  • OpenPNE3/plugins/opCommunityTopicPlugin/branches/goto_doctrine/apps/pc_frontend/modules/communityTopic/templates/listCommunitySuccess.php

    r11102 r11577  
    11<?php use_helper('Date'); ?>
     2<?php $acl = opCommunityTopicAclBuilder::buildCollection($community, array($sf_user->getMember())) ?>
    23
    3 <?php if ($community->isCreatableCommunityTopic($sf_user->getMemberId())): ?>
     4<?php if ($acl->isAllowed($sf_user->getMemberId(), null, 'add')): ?>
    45<?php
    56op_include_parts('buttonBox', 'communityTopicList', array(
  • OpenPNE3/plugins/opCommunityTopicPlugin/branches/goto_doctrine/apps/pc_frontend/modules/communityTopic/templates/showSuccess.php

    r11023 r11577  
    11<?php use_helper('Date'); ?>
     2<?php $acl = opCommunityTopicAclBuilder::buildCollection($community, array($sf_user->getMember())) ?>
    23
    34<div class="dparts topicDetailBox"><div class="parts">
     
    3536<?php include_component('communityTopicComment', 'list', array('communityTopic' => $communityTopic)) ?>
    3637
    37 <?php if ($communityTopic->isCreatableCommunityTopicComment($sf_user->getMemberId())): ?>
     38<?php if ($acl->isAllowed($sf_user->getMemberId(), null, 'add')): ?>
    3839<?php
    3940$options = array();
  • OpenPNE3/plugins/opCommunityTopicPlugin/branches/goto_doctrine/lib/action/opCommunityTopicPluginEventActions.class.php

    r11155 r11577  
    2323  public function preExecute()
    2424  {
    25     if ($this->getRoute() instanceof sfPropelRoute)
     25    if ($this->getRoute() instanceof sfDoctrineRoute)
    2626    {
    2727      $object = $this->getRoute()->getObject();
     
    3030      {
    3131        $this->community = $object;
     32        $this->acl = opCommunityTopicAclBuilder::buildCollection($this->community, array($this->getUser()->getMember()));
    3233      }
    3334      elseif ($object instanceof CommunityEvent)
     
    3536        $this->communityEvent = $object;
    3637        $this->community = $this->communityEvent->getCommunity();
     38        $this->acl = opCommunityTopicAclBuilder::buildResource($this->communityEvent, array($this->getUser()->getMember()));
    3739      }
    3840    }
     
    4648  public function executeListCommunity($request)
    4749  {
    48     $this->forward404Unless($this->community->isViewableCommunityTopic($this->getUser()->getMemberId()));
     50    $this->forward404Unless($this->acl->isAllowed($this->getUser()->getMemberId(), null, 'view'));
    4951
    5052    if (!$this->size)
     
    5355    }
    5456
    55     $this->pager = CommunityEventPeer::getCommunityEventListPager(
     57    $this->pager = Doctrine::getTable('CommunityEvent')->getCommunityEventListPager(
    5658      $this->community->getId(),
    5759      $request->getParameter('page'),
     
    6971  public function executeShow($request)
    7072  {
     73    $this->forward404Unless($this->acl->isAllowed($this->getUser()->getMemberId(), null, 'view'));
     74
     75    $this->form = new CommunityEventCommentForm();
     76
     77    return sfView::SUCCESS;
     78  }
     79
     80  /**
     81   * Executes memberList action
     82   *
     83   * @param sfRequest $request A request object
     84   */
     85  public function executeMemberList($request)
     86  {
    7187    $this->forward404Unless($this->community->isViewableCommunityTopic($this->getUser()->getMemberId()));
    7288
    73     $this->form = new CommunityEventCommentForm();
    74 
    75     return sfView::SUCCESS;
    76   }
    77 
    78   /**
    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 
    8789    if (!$this->size)
    8890    {
    8991      $this->size = 20;
    9092    }
    91     $this->pager = CommunityEventPeer::getEventMemberListPager($this->communityEvent->getId(), $request->getParameter('page', 1), $this->size);
     93    $this->pager = Doctrine::getTable('CommunityEvent')->getEventMemberListPager($this->communityEvent->getId(), $request->getParameter('page', 1), $this->size);
    9294
    9395    if (!$this->pager->getNbResults()) {
     
    103105  public function executeNew($request)
    104106  {
    105     $this->forward404Unless($this->community->isCreatableCommunityTopic($this->getUser()->getMemberId()));
     107    $this->forward404Unless($this->acl->isAllowed($this->getUser()->getMemberId(), null, 'add'));
    106108
    107109    $this->form = new CommunityEventForm();
     
    117119  public function executeCreate($request)
    118120  {
    119     $this->forward404Unless($this->community->isCreatableCommunityTopic($this->getUser()->getMemberId()));
     121    $this->forward404Unless($this->acl->isAllowed($this->getUser()->getMemberId(), null, 'add'));
    120122
    121123    $this->form = new CommunityEventForm();
     
    205207    }
    206208
    207     $this->pager = CommunityEventPeer::getRecentlyEventListPager(
     209    $this->pager = Doctrine::getTable('CommunityEvent')->getRecentlyEventListPager(
    208210      $this->getUser()->getMemberId(),
    209211      $request->getParameter('page', 1),
  • OpenPNE3/plugins/opCommunityTopicPlugin/branches/goto_doctrine/lib/action/opCommunityTopicPluginEventCommentComponents.class.php

    r11143 r11577  
    2626
    2727    $this->commentPager =
    28       CommunityEventCommentPeer::getCommunityEventCommentListPager(
     28      Doctrine::getTable('CommunityEventComment')->getCommunityEventCommentListPager(
    2929      $this->communityEvent->getId(),
    3030      $request->getParameter('page', 1),
    3131      $this->size,
    32       $request->getParameter('order', Criteria::DESC)
     32      $request->getParameter('order', 'DESC')
    3333    );
    3434  }
  • OpenPNE3/plugins/opCommunityTopicPlugin/branches/goto_doctrine/lib/action/opCommunityTopicPluginEventComponents.class.php

    r11143 r11577  
    2020  public function executeCommunityEventList()
    2121  {
    22     $publicFlag = CommunityConfigPeer::retrieveByNameAndCommunityId('public_flag', $this->community->getId());
     22    $publicFlag = Doctrine::getTable('CommunityConfig')->retrieveByNameAndCommunityId('public_flag', $this->community->getId());
    2323    $isBelong = $this->community->isPrivilegeBelong($this->getUser()->getMemberId());
    2424    $this->hasPermission = true;
     
    3030    }
    3131
    32     $this->communityEvents = CommunityEventPeer::getEvents($this->community->getId());
     32    $this->communityEvents = Doctrine::getTable('CommunityEvent')->getEvents($this->community->getId());
    3333  }
    3434
    3535  public function executeEventCommentListBox()
    3636  {
    37     $this->communityEvent = CommunityEventPeer::retrivesByMemberId($this->getUser()->getMember()->getId(), $this->gadget->getConfig('col'));
     37    $this->communityEvent = Doctrine::getTable('CommunityEvent')->retrivesByMemberId($this->getUser()->getMember()->getId(), $this->gadget->getConfig('col'));
    3838  }
    3939}
  • OpenPNE3/plugins/opCommunityTopicPlugin/branches/goto_doctrine/lib/action/opCommunityTopicPluginTopicActions.class.php

    r11102 r11577  
    2727  public function preExecute()
    2828  {
    29     if ($this->getRoute() instanceof sfPropelRoute)
     29    if ($this->getRoute() instanceof sfDoctrineRoute)
    3030    {
    3131      $object = $this->getRoute()->getObject();
     
    3434      {
    3535        $this->community = $object;
     36        $this->acl = opCommunityTopicAclBuilder::buildCollection($this->community, array($this->getUser()->getMember()));
    3637      }
    3738      elseif ($object instanceof CommunityTopic)
     
    3940        $this->communityTopic = $object;
    4041        $this->community = $this->communityTopic->getCommunity();
     42        $this->acl = opCommunityTopicAclBuilder::buildResource($this->communityTopic, array($this->getUser()->getMember()));
    4143      }
    4244    }
     
    5052  public function executeListCommunity($request)
    5153  {
    52     $this->forward404Unless($this->community->isViewableCommunityTopic($this->getUser()->getMemberId()));
     54    $this->forward404Unless($this->acl->isAllowed($this->getUser()->getMemberId(), null, 'view'));
    5355
    5456    if (!$this->size)
     
    5759    }
    5860
    59     $this->pager = CommunityTopicPeer::getCommunityTopicListPager(
     61    $this->pager = Doctrine::getTable('CommunityTopic')->getCommunityTopicListPager(
    6062      $this->community->getId(),
    6163      $request->getParameter('page'),
     
    7375  public function executeShow($request)
    7476  {
    75     $this->forward404Unless($this->community->isViewableCommunityTopic($this->getUser()->getMemberId()));
     77    $this->forward404Unless($this->acl->isAllowed($this->getUser()->getMemberId(), null, 'view'));
    7678
    7779    $this->form = new CommunityTopicCommentForm();
     
    8789  public function executeNew($request)
    8890  {
    89     $this->forward404Unless($this->community->isCreatableCommunityTopic($this->getUser()->getMemberId()));
     91    $this->forward404Unless($this->acl->isAllowed($this->getUser()->getMemberId(), null, 'add'));
    9092
    9193    $this->form = new CommunityTopicForm();
     
    101103  public function executeCreate($request)
    102104  {
    103     $this->forward404Unless($this->community->isCreatableCommunityTopic($this->getUser()->getMemberId()));
     105    $this->forward404Unless($this->acl->isAllowed($this->getUser()->getMemberId(), null, 'add'));
    104106
    105107    $this->form = new CommunityTopicForm();
     
    189191    }
    190192
    191     $this->pager = CommunityTopicPeer::getRecentlyTopicListPager(
     193    $this->pager = Doctrine::getTable('CommunityTopic')->getRecentlyTopicListPager(
    192194      $this->getUser()->getMemberId(),
    193195      $request->getParameter('page', 1),
  • OpenPNE3/plugins/opCommunityTopicPlugin/branches/goto_doctrine/lib/action/opCommunityTopicPluginTopicCommentComponents.class.php

    r11102 r11577  
    2828
    2929    $this->commentPager =
    30       CommunityTopicCommentPeer::getCommunityTopicCommentListPager(
     30      Doctrine::getTable('CommunityTopicComment')->getCommunityTopicCommentListPager(
    3131      $this->communityTopic->getId(),
    3232      $request->getParameter('page', 1),
    3333      $this->size,
    34       $request->getParameter('order', Criteria::DESC)
     34      $request->getParameter('order', 'DESC')
    3535    );
    3636  }
  • OpenPNE3/plugins/opCommunityTopicPlugin/branches/goto_doctrine/lib/action/opCommunityTopicPluginTopicComponents.class.php

    r11102 r11577  
    2323  public function executeCommunityTopicList()
    2424  {
    25     $publicFlag = CommunityConfigPeer::retrieveByNameAndCommunityId('public_flag', $this->community->getId());
     25    $publicFlag = Doctrine::getTable('CommunityConfig')->retrieveByNameAndCommunityId('public_flag', $this->community->getId());
    2626    $isBelong = $this->community->isPrivilegeBelong($this->getUser()->getMemberId());
    2727    $this->hasPermission = true;
     
    3333    }
    3434
    35     $this->communityTopics = CommunityTopicPeer::getTopics($this->community->getId());
     35    $this->communityTopics = Doctrine::getTable('CommunityTopic')->getTopics($this->community->getId());
    3636  }
    3737
    3838  public function executeTopicCommentListBox()
    3939  {
    40     $this->communityTopic = CommunityTopicPeer::retrivesByMemberId($this->getUser()->getMember()->getId(), $this->gadget->getConfig('col'));
     40    $this->communityTopic = Doctrine::getTable('CommunityTopic')->retrivesByMemberId($this->getUser()->getMember()->getId(), $this->gadget->getConfig('col'));
    4141  }
    4242}
  • OpenPNE3/plugins/opCommunityTopicPlugin/branches/goto_doctrine/lib/model/doctrine/PluginCommunityEvent.class.php

    r11535 r11577  
    4040  public function isEventModified()
    4141  {
    42     return (
    43       $this->isColumnModified(CommunityEventPeer::NAME) ||
    44       $this->isColumnModified(CommunityEventPeer::BODY)
    45     );
     42    $modified = $this->getModified();
     43    return ($modified['name'] || $modified['body']);
    4644  }
    4745
    4846  public function preSave()
    4947  {
    50     if ($this->isEventModified() && !$this->isColumnModified(CommunityEventPeer::EVENT_UPDATED_AT))
     48    $modified = $this->getModified();
     49    if ($this->isEventModified() && !$modified['event_updated_at'])
    5150    {
    5251      $this->setEventUpdatedAt(time());
  • OpenPNE3/plugins/opCommunityTopicPlugin/branches/goto_doctrine/lib/model/doctrine/PluginCommunityEventCommentTable.class.php

    r11535 r11577  
    3131
    3232    $pager = new sfReversibleDoctrinePager('CommunityEventComment', $size);
    33     $pager->setCriteria($q);
     33    $pager->setQuery($q);
    3434    $pager->setPage($page);
    3535    $pager->setSqlOrderColumn('id');
  • OpenPNE3/plugins/opCommunityTopicPlugin/branches/goto_doctrine/lib/model/doctrine/PluginCommunityEventTable.class.php

    r11535 r11577  
    5050  public function retrivesByMemberId($memberId, $limit = 5)
    5151  {
    52     $communityIds = CommunityPeer::getIdsByMemberId($memberId);
     52    $communityIds = Doctrine::getTable('Community')->getIdsByMemberId($memberId);
    5353    return $this->createQuery()
    54       ->whereIn('community_id IN (?)', $communityIds)
     54      ->whereIn('community_id', $communityIds)
    5555      ->limit($limit)
    5656      ->orderBy('updated_at')
     
    6060  public function getRecentlyEventListPager($memberId, $page = 1, $size = 50)
    6161  {
    62     $communityIds = CommunityPeer::getIdsByMemberId($memberId);
     62    $communityIds = Doctrine::getTable('Community')->getIdsByMemberId($memberId);
    6363    $q = $this->createQuery()
    64       ->where('community_id IN (?)', $communityIds)
     64      ->whereIn('community_id', $communityIds)
    6565      ->orderBy('updated_at');
    6666
  • OpenPNE3/plugins/opCommunityTopicPlugin/branches/goto_doctrine/lib/model/doctrine/PluginCommunityTopic.class.php

    r11535 r11577  
    3535  public function isTopicModified()
    3636  {
    37     return (
    38       $this->isColumnModified(CommunityTopicPeer::NAME) ||
    39       $this->isColumnModified(CommunityTopicPeer::BODY)
    40     );
     37    $modified = $this->getModified();
     38    return ($modified['name'] || $modified['body']);
    4139  }
    4240
    4341  public function preSave()
    4442  {
    45     if ($this->isTopicModified() && !$this->isColumnModified(CommunityTopicPeer::TOPIC_UPDATED_AT))
     43    $modified = $this->getModified();
     44    if ($this->isTopicModified() && !$modified['topic_updated_at'])
    4645    {
    4746      $this->setTopicUpdatedAt(time());
  • OpenPNE3/plugins/opCommunityTopicPlugin/branches/goto_doctrine/lib/model/doctrine/PluginCommunityTopicTable.class.php

    r11535 r11577  
    4646  public function retrivesByMemberId($memberId, $limit = 5)
    4747  {
    48     $communityIds = CommunityPeer::getIdsByMemberId($memberId);
     48    $communityIds = Doctrine::getTable('Community')->getIdsByMemberId($memberId);
    4949    return $this->createQuery()
    50       ->whereIn('community_id IN (?)', $communityIds)
     50      ->whereIn('community_id', $communityIds)
    5151      ->limit($limit)
    5252      ->orderBy('updated_at')
     
    5656  public function getRecentlyTopicListPager($memberId, $page = 1, $size = 50)
    5757  {
    58     $communityIds = CommunityPeer::getIdsByMemberId($memberId);
     58    $communityIds = Doctrine::getTable('Community')->getIdsByMemberId($memberId);
    5959    $q = $this->createQuery()
    60       ->where('community_id IN (?)', $communityIds)
     60      ->whereIn('community_id', $communityIds)
    6161      ->orderBy('updated_at');
    6262
  • OpenPNE3/plugins/opCommunityTopicPlugin/branches/goto_doctrine/lib/opIsCreatableCommunityTopicBehavior.class.php

    r10409 r11577  
    11<?php
    22
    3 class opIsCreatableCommunityTopicBehavior
     3class opIsCreatableCommunityTopicBehavior extends Doctrine_Template
    44{
    55  public function isCreatableCommunityTopic($community, $memberId)
Note: See TracChangeset for help on using the changeset viewer.