Changeset 11577
- Timestamp:
- May 4, 2009, 4:32:44 AM (13 years ago)
- 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')): ?> 2 4 <?php use_helper('Date') ?> 3 5 <?php … … 18 20 $moreInfo[] = link_to(__('More'), 'communityEvent_list_community', $community); 19 21 } 20 if ($ community->isCreatableCommunityTopic($sf_user->getMemberId()))22 if ($acl->isAllowed($sf_user->getMemberId(), null, 'add')) 21 23 { 22 24 $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')): ?> 2 4 <?php use_helper('Date') ?> 3 5 <?php … … 18 20 $moreInfo[] = link_to(__('More'), 'communityTopic_list_community', $community); 19 21 } 20 if ($ community->isCreatableCommunityTopic($sf_user->getMemberId()))22 if ($acl->isAllowed($sf_user->getMemberId(), null, 'add')) 21 23 { 22 24 $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())) ?> 1 2 <?php op_mobile_page_title($community->getName(), $communityTopic->getName()) ?> 2 3 … … 15 16 16 17 <?php echo op_within_page_link('') ?> 17 <?php if ($ communityTopic->isCreatableCommunityTopicComment($sf_user->getMemberId())): ?>18 <?php if ($acl->isAllow($sf_user->getMemberId(), null, 'addComment')): ?> 18 19 <hr> 19 20 <?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')): ?> 2 4 <?php $sf_response->addStylesheet('/opCommunityTopicPlugin/css/communityTopic') ?> 3 5 <?php use_helper('Date'); ?> … … 10 12 <li> 11 13 <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) ?> 13 15 </li> 14 16 <?php endforeach; ?> … … 20 22 <li><?php echo link_to(__('More'), 'communityEvent_list_community', $community); ?></li> 21 23 <?php endif; ?> 22 <?php if ($ community->isCreatableCommunityTopic($sf_user->getMemberId())): ?>24 <?php if ($acl->isAllowed($sf_user->getMemberId(), null, 'add')): ?> 23 25 <li><?php echo link_to(__('Create a new event'), 'communityEvent_new', $community); ?></li> 24 26 <?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())) ?> 2 2 3 <?php if ($ community->isCreatableCommunityTopic($sf_user->getMemberId())): ?>3 <?php if ($acl->isAllowed($sf_user->getMemberId(), null, 'view')): ?> 4 4 <?php 5 5 op_include_parts('buttonBox', 'communityEventList', array( -
OpenPNE3/plugins/opCommunityTopicPlugin/branches/goto_doctrine/apps/pc_frontend/modules/communityEvent/templates/showSuccess.php
r11155 r11577 10 10 'Application deadline' => op_format_date($communityEvent->getApplicationDeadline(), 'D'), 11 11 'Capacity' => $communityEvent->getCapacity(), 12 'Count of Member' => $communityEvent-> countCommunityEventMembers(),12 'Count of Member' => $communityEvent->getCommunityEventMember()->count(), 13 13 ); 14 14 -
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')): ?> 2 4 <?php $sf_response->addStylesheet('/opCommunityTopicPlugin/css/communityTopic') ?> 3 5 <?php use_helper('Date'); ?> … … 10 12 <li> 11 13 <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) ?> 13 15 </li> 14 16 <?php endforeach; ?> … … 20 22 <li><?php echo link_to(__('More'), 'communityTopic_list_community', $community); ?></li> 21 23 <?php endif; ?> 22 <?php if ($ community->isCreatableCommunityTopic($sf_user->getMemberId())): ?>24 <?php if ($acl->isAllowed($sf_user->getMemberId(), null, 'add')): ?> 23 25 <li><?php echo link_to(__('Create a new topic'), 'communityTopic_new', $community); ?></li> 24 26 <?php endif; ?> -
OpenPNE3/plugins/opCommunityTopicPlugin/branches/goto_doctrine/apps/pc_frontend/modules/communityTopic/templates/listCommunitySuccess.php
r11102 r11577 1 1 <?php use_helper('Date'); ?> 2 <?php $acl = opCommunityTopicAclBuilder::buildCollection($community, array($sf_user->getMember())) ?> 2 3 3 <?php if ($ community->isCreatableCommunityTopic($sf_user->getMemberId())): ?>4 <?php if ($acl->isAllowed($sf_user->getMemberId(), null, 'add')): ?> 4 5 <?php 5 6 op_include_parts('buttonBox', 'communityTopicList', array( -
OpenPNE3/plugins/opCommunityTopicPlugin/branches/goto_doctrine/apps/pc_frontend/modules/communityTopic/templates/showSuccess.php
r11023 r11577 1 1 <?php use_helper('Date'); ?> 2 <?php $acl = opCommunityTopicAclBuilder::buildCollection($community, array($sf_user->getMember())) ?> 2 3 3 4 <div class="dparts topicDetailBox"><div class="parts"> … … 35 36 <?php include_component('communityTopicComment', 'list', array('communityTopic' => $communityTopic)) ?> 36 37 37 <?php if ($ communityTopic->isCreatableCommunityTopicComment($sf_user->getMemberId())): ?>38 <?php if ($acl->isAllowed($sf_user->getMemberId(), null, 'add')): ?> 38 39 <?php 39 40 $options = array(); -
OpenPNE3/plugins/opCommunityTopicPlugin/branches/goto_doctrine/lib/action/opCommunityTopicPluginEventActions.class.php
r11155 r11577 23 23 public function preExecute() 24 24 { 25 if ($this->getRoute() instanceof sf PropelRoute)25 if ($this->getRoute() instanceof sfDoctrineRoute) 26 26 { 27 27 $object = $this->getRoute()->getObject(); … … 30 30 { 31 31 $this->community = $object; 32 $this->acl = opCommunityTopicAclBuilder::buildCollection($this->community, array($this->getUser()->getMember())); 32 33 } 33 34 elseif ($object instanceof CommunityEvent) … … 35 36 $this->communityEvent = $object; 36 37 $this->community = $this->communityEvent->getCommunity(); 38 $this->acl = opCommunityTopicAclBuilder::buildResource($this->communityEvent, array($this->getUser()->getMember())); 37 39 } 38 40 } … … 46 48 public function executeListCommunity($request) 47 49 { 48 $this->forward404Unless($this-> community->isViewableCommunityTopic($this->getUser()->getMemberId()));50 $this->forward404Unless($this->acl->isAllowed($this->getUser()->getMemberId(), null, 'view')); 49 51 50 52 if (!$this->size) … … 53 55 } 54 56 55 $this->pager = CommunityEventPeer::getCommunityEventListPager(57 $this->pager = Doctrine::getTable('CommunityEvent')->getCommunityEventListPager( 56 58 $this->community->getId(), 57 59 $request->getParameter('page'), … … 69 71 public function executeShow($request) 70 72 { 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 { 71 87 $this->forward404Unless($this->community->isViewableCommunityTopic($this->getUser()->getMemberId())); 72 88 73 $this->form = new CommunityEventCommentForm();74 75 return sfView::SUCCESS;76 }77 78 /**79 * Executes memberList action80 *81 * @param sfRequest $request A request object82 */83 public function executeMemberList($request)84 {85 $this->forward404Unless($this->community->isViewableCommunityTopic($this->getUser()->getMemberId()));86 87 89 if (!$this->size) 88 90 { 89 91 $this->size = 20; 90 92 } 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); 92 94 93 95 if (!$this->pager->getNbResults()) { … … 103 105 public function executeNew($request) 104 106 { 105 $this->forward404Unless($this-> community->isCreatableCommunityTopic($this->getUser()->getMemberId()));107 $this->forward404Unless($this->acl->isAllowed($this->getUser()->getMemberId(), null, 'add')); 106 108 107 109 $this->form = new CommunityEventForm(); … … 117 119 public function executeCreate($request) 118 120 { 119 $this->forward404Unless($this-> community->isCreatableCommunityTopic($this->getUser()->getMemberId()));121 $this->forward404Unless($this->acl->isAllowed($this->getUser()->getMemberId(), null, 'add')); 120 122 121 123 $this->form = new CommunityEventForm(); … … 205 207 } 206 208 207 $this->pager = CommunityEventPeer::getRecentlyEventListPager(209 $this->pager = Doctrine::getTable('CommunityEvent')->getRecentlyEventListPager( 208 210 $this->getUser()->getMemberId(), 209 211 $request->getParameter('page', 1), -
OpenPNE3/plugins/opCommunityTopicPlugin/branches/goto_doctrine/lib/action/opCommunityTopicPluginEventCommentComponents.class.php
r11143 r11577 26 26 27 27 $this->commentPager = 28 CommunityEventCommentPeer::getCommunityEventCommentListPager(28 Doctrine::getTable('CommunityEventComment')->getCommunityEventCommentListPager( 29 29 $this->communityEvent->getId(), 30 30 $request->getParameter('page', 1), 31 31 $this->size, 32 $request->getParameter('order', Criteria::DESC)32 $request->getParameter('order', 'DESC') 33 33 ); 34 34 } -
OpenPNE3/plugins/opCommunityTopicPlugin/branches/goto_doctrine/lib/action/opCommunityTopicPluginEventComponents.class.php
r11143 r11577 20 20 public function executeCommunityEventList() 21 21 { 22 $publicFlag = CommunityConfigPeer::retrieveByNameAndCommunityId('public_flag', $this->community->getId());22 $publicFlag = Doctrine::getTable('CommunityConfig')->retrieveByNameAndCommunityId('public_flag', $this->community->getId()); 23 23 $isBelong = $this->community->isPrivilegeBelong($this->getUser()->getMemberId()); 24 24 $this->hasPermission = true; … … 30 30 } 31 31 32 $this->communityEvents = CommunityEventPeer::getEvents($this->community->getId());32 $this->communityEvents = Doctrine::getTable('CommunityEvent')->getEvents($this->community->getId()); 33 33 } 34 34 35 35 public function executeEventCommentListBox() 36 36 { 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')); 38 38 } 39 39 } -
OpenPNE3/plugins/opCommunityTopicPlugin/branches/goto_doctrine/lib/action/opCommunityTopicPluginTopicActions.class.php
r11102 r11577 27 27 public function preExecute() 28 28 { 29 if ($this->getRoute() instanceof sf PropelRoute)29 if ($this->getRoute() instanceof sfDoctrineRoute) 30 30 { 31 31 $object = $this->getRoute()->getObject(); … … 34 34 { 35 35 $this->community = $object; 36 $this->acl = opCommunityTopicAclBuilder::buildCollection($this->community, array($this->getUser()->getMember())); 36 37 } 37 38 elseif ($object instanceof CommunityTopic) … … 39 40 $this->communityTopic = $object; 40 41 $this->community = $this->communityTopic->getCommunity(); 42 $this->acl = opCommunityTopicAclBuilder::buildResource($this->communityTopic, array($this->getUser()->getMember())); 41 43 } 42 44 } … … 50 52 public function executeListCommunity($request) 51 53 { 52 $this->forward404Unless($this-> community->isViewableCommunityTopic($this->getUser()->getMemberId()));54 $this->forward404Unless($this->acl->isAllowed($this->getUser()->getMemberId(), null, 'view')); 53 55 54 56 if (!$this->size) … … 57 59 } 58 60 59 $this->pager = CommunityTopicPeer::getCommunityTopicListPager(61 $this->pager = Doctrine::getTable('CommunityTopic')->getCommunityTopicListPager( 60 62 $this->community->getId(), 61 63 $request->getParameter('page'), … … 73 75 public function executeShow($request) 74 76 { 75 $this->forward404Unless($this-> community->isViewableCommunityTopic($this->getUser()->getMemberId()));77 $this->forward404Unless($this->acl->isAllowed($this->getUser()->getMemberId(), null, 'view')); 76 78 77 79 $this->form = new CommunityTopicCommentForm(); … … 87 89 public function executeNew($request) 88 90 { 89 $this->forward404Unless($this-> community->isCreatableCommunityTopic($this->getUser()->getMemberId()));91 $this->forward404Unless($this->acl->isAllowed($this->getUser()->getMemberId(), null, 'add')); 90 92 91 93 $this->form = new CommunityTopicForm(); … … 101 103 public function executeCreate($request) 102 104 { 103 $this->forward404Unless($this-> community->isCreatableCommunityTopic($this->getUser()->getMemberId()));105 $this->forward404Unless($this->acl->isAllowed($this->getUser()->getMemberId(), null, 'add')); 104 106 105 107 $this->form = new CommunityTopicForm(); … … 189 191 } 190 192 191 $this->pager = CommunityTopicPeer::getRecentlyTopicListPager(193 $this->pager = Doctrine::getTable('CommunityTopic')->getRecentlyTopicListPager( 192 194 $this->getUser()->getMemberId(), 193 195 $request->getParameter('page', 1), -
OpenPNE3/plugins/opCommunityTopicPlugin/branches/goto_doctrine/lib/action/opCommunityTopicPluginTopicCommentComponents.class.php
r11102 r11577 28 28 29 29 $this->commentPager = 30 CommunityTopicCommentPeer::getCommunityTopicCommentListPager(30 Doctrine::getTable('CommunityTopicComment')->getCommunityTopicCommentListPager( 31 31 $this->communityTopic->getId(), 32 32 $request->getParameter('page', 1), 33 33 $this->size, 34 $request->getParameter('order', Criteria::DESC)34 $request->getParameter('order', 'DESC') 35 35 ); 36 36 } -
OpenPNE3/plugins/opCommunityTopicPlugin/branches/goto_doctrine/lib/action/opCommunityTopicPluginTopicComponents.class.php
r11102 r11577 23 23 public function executeCommunityTopicList() 24 24 { 25 $publicFlag = CommunityConfigPeer::retrieveByNameAndCommunityId('public_flag', $this->community->getId());25 $publicFlag = Doctrine::getTable('CommunityConfig')->retrieveByNameAndCommunityId('public_flag', $this->community->getId()); 26 26 $isBelong = $this->community->isPrivilegeBelong($this->getUser()->getMemberId()); 27 27 $this->hasPermission = true; … … 33 33 } 34 34 35 $this->communityTopics = CommunityTopicPeer::getTopics($this->community->getId());35 $this->communityTopics = Doctrine::getTable('CommunityTopic')->getTopics($this->community->getId()); 36 36 } 37 37 38 38 public function executeTopicCommentListBox() 39 39 { 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')); 41 41 } 42 42 } -
OpenPNE3/plugins/opCommunityTopicPlugin/branches/goto_doctrine/lib/model/doctrine/PluginCommunityEvent.class.php
r11535 r11577 40 40 public function isEventModified() 41 41 { 42 return ( 43 $this->isColumnModified(CommunityEventPeer::NAME) || 44 $this->isColumnModified(CommunityEventPeer::BODY) 45 ); 42 $modified = $this->getModified(); 43 return ($modified['name'] || $modified['body']); 46 44 } 47 45 48 46 public function preSave() 49 47 { 50 if ($this->isEventModified() && !$this->isColumnModified(CommunityEventPeer::EVENT_UPDATED_AT)) 48 $modified = $this->getModified(); 49 if ($this->isEventModified() && !$modified['event_updated_at']) 51 50 { 52 51 $this->setEventUpdatedAt(time()); -
OpenPNE3/plugins/opCommunityTopicPlugin/branches/goto_doctrine/lib/model/doctrine/PluginCommunityEventCommentTable.class.php
r11535 r11577 31 31 32 32 $pager = new sfReversibleDoctrinePager('CommunityEventComment', $size); 33 $pager->set Criteria($q);33 $pager->setQuery($q); 34 34 $pager->setPage($page); 35 35 $pager->setSqlOrderColumn('id'); -
OpenPNE3/plugins/opCommunityTopicPlugin/branches/goto_doctrine/lib/model/doctrine/PluginCommunityEventTable.class.php
r11535 r11577 50 50 public function retrivesByMemberId($memberId, $limit = 5) 51 51 { 52 $communityIds = CommunityPeer::getIdsByMemberId($memberId);52 $communityIds = Doctrine::getTable('Community')->getIdsByMemberId($memberId); 53 53 return $this->createQuery() 54 ->whereIn('community_id IN (?)', $communityIds)54 ->whereIn('community_id', $communityIds) 55 55 ->limit($limit) 56 56 ->orderBy('updated_at') … … 60 60 public function getRecentlyEventListPager($memberId, $page = 1, $size = 50) 61 61 { 62 $communityIds = CommunityPeer::getIdsByMemberId($memberId);62 $communityIds = Doctrine::getTable('Community')->getIdsByMemberId($memberId); 63 63 $q = $this->createQuery() 64 ->where ('community_id IN (?)', $communityIds)64 ->whereIn('community_id', $communityIds) 65 65 ->orderBy('updated_at'); 66 66 -
OpenPNE3/plugins/opCommunityTopicPlugin/branches/goto_doctrine/lib/model/doctrine/PluginCommunityTopic.class.php
r11535 r11577 35 35 public function isTopicModified() 36 36 { 37 return ( 38 $this->isColumnModified(CommunityTopicPeer::NAME) || 39 $this->isColumnModified(CommunityTopicPeer::BODY) 40 ); 37 $modified = $this->getModified(); 38 return ($modified['name'] || $modified['body']); 41 39 } 42 40 43 41 public function preSave() 44 42 { 45 if ($this->isTopicModified() && !$this->isColumnModified(CommunityTopicPeer::TOPIC_UPDATED_AT)) 43 $modified = $this->getModified(); 44 if ($this->isTopicModified() && !$modified['topic_updated_at']) 46 45 { 47 46 $this->setTopicUpdatedAt(time()); -
OpenPNE3/plugins/opCommunityTopicPlugin/branches/goto_doctrine/lib/model/doctrine/PluginCommunityTopicTable.class.php
r11535 r11577 46 46 public function retrivesByMemberId($memberId, $limit = 5) 47 47 { 48 $communityIds = CommunityPeer::getIdsByMemberId($memberId);48 $communityIds = Doctrine::getTable('Community')->getIdsByMemberId($memberId); 49 49 return $this->createQuery() 50 ->whereIn('community_id IN (?)', $communityIds)50 ->whereIn('community_id', $communityIds) 51 51 ->limit($limit) 52 52 ->orderBy('updated_at') … … 56 56 public function getRecentlyTopicListPager($memberId, $page = 1, $size = 50) 57 57 { 58 $communityIds = CommunityPeer::getIdsByMemberId($memberId);58 $communityIds = Doctrine::getTable('Community')->getIdsByMemberId($memberId); 59 59 $q = $this->createQuery() 60 ->where ('community_id IN (?)', $communityIds)60 ->whereIn('community_id', $communityIds) 61 61 ->orderBy('updated_at'); 62 62 -
OpenPNE3/plugins/opCommunityTopicPlugin/branches/goto_doctrine/lib/opIsCreatableCommunityTopicBehavior.class.php
r10409 r11577 1 1 <?php 2 2 3 class opIsCreatableCommunityTopicBehavior 3 class opIsCreatableCommunityTopicBehavior extends Doctrine_Template 4 4 { 5 5 public function isCreatableCommunityTopic($community, $memberId)
Note: See TracChangeset
for help on using the changeset viewer.