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

Changeset 9731


Ignore:
Timestamp:
Dec 27, 2008, 5:34:50 PM (11 years ago)
Author:
ogawa
Message:

#3209:added comments to the opDiaryPlugin

Location:
OpenPNE3/plugins/opDiaryPlugin/trunk
Files:
8 added
3 edited

Legend:

Unmodified
Added
Removed
  • OpenPNE3/plugins/opDiaryPlugin/trunk/apps/pc_frontend/modules/diary/templates/showSuccess.php

    r9612 r9731  
    1111</div>
    1212<div class="body">
    13 <?php if ($images = $diary->getDiaryImages()): ?>
     13<?php $images = $diary->getDiaryImages() ?>
     14<?php if (count($images)): ?>
    1415<ul class="photo">
    1516<?php foreach ($images as $image): ?>
     
    2425</div></div>
    2526
     27<div class="parts">
    2628<?php if ($diary->getMember()->getId() === $sf_user->getMemberId()): ?>
    2729<ul>
     
    3032</ul>
    3133<?php endif; ?>
     34</div>
     35
     36<div class="dparts"><div class="parts">
     37<div class="partsHeading"><h3><?php echo __('Comments') ?></h3></div>
     38<?php foreach ($diary->getDiaryComments() as $comment): ?>
     39<dl>
     40<dt><?php echo format_datetime($comment->getCreatedAt(), 'f') ?></dt>
     41<dd><p><?php echo $comment->getMember()->getName() ?></p></dd>
     42<dd><p><?php echo nl2br($comment->getBody()) ?></p></dd>
     43</dl>
     44<?php endforeach; ?>
     45</div></div>
     46
     47<?php
     48$options = array('form' => array($form));
     49$title = __('Post a diary comment');
     50$options['url'] = 'diary/postComment?id='.$diary->getId();
     51$options['button'] = __('Save');
     52$options['isMultipart'] = true;
     53include_box('formDiaryComment', $title, '', $options);
     54?>
  • OpenPNE3/plugins/opDiaryPlugin/trunk/config/schema.yml

    r9561 r9731  
    33  diary:
    44    id: ~
    5     member_id: { type: integer, required: true, foreignTable: member, foreignReference: id, OnDelete: cascade }
     5    member_id: { type: integer, required: true, foreignTable: member, foreignReference: id, onDelete: cascade }
    66    title: { type: longvarchar, required: true }
    77    body: { type: longvarchar, required: true }
     
    1010  diary_image:
    1111    id: ~
    12     diary_id: { type: integer, required: true, foreignTable: diary, foreignReference: id, OnDelete: cascade }
    13     file_id: { type: integer, required: true, foreignTable: file, foreignReference: id, OnDelete: cascade }
     12    diary_id: { type: integer, required: true, foreignTable: diary, foreignReference: id, onDelete: cascade }
     13    file_id: { type: integer, required: true, foreignTable: file, foreignReference: id, onDelete: cascade }
     14  diary_comment:
     15    id: ~
     16    diary_id: { type: integer, required: true, foreignTable: diary, foreignReference: id, onDelete: cascade }
     17    member_id: { type: integer, required: true, foreignTable: member, foreignReference: id, onDelete: cascade }
     18    number: { type: integer, required: true }
     19    body: { type: longvarchar, required: true }
     20    created_at: ~
     21  diary_comment_image:
     22    id: ~
     23    diary_comment_id: { type: integer, required: true, foreignTable: diary_comment, foreignReference: id, onDelete: cascade }
     24    file_id: { type: integer, required: true, foreignTable: file, foreignReference: id, onDelete: cascade }
  • OpenPNE3/plugins/opDiaryPlugin/trunk/lib/action/opDiaryPluginDiaryActions.class.php

    r9645 r9731  
    7474      sfConfig::set('sf_navi_id', $this->diary->getMemberId());
    7575    }
     76    $this->form = new DiaryCommentForm();
     77  }
     78
     79 /**
     80  * Executes postComment action
     81  *
     82  * @param sfRequest $request A request object
     83  */
     84  public function executePostComment($request)
     85  {
     86    $this->forward404Unless($request->isMethod('post'));
     87
     88    $this->diary = DiaryPeer::retrieveByPk($request->getParameter('id'));
     89    $this->forward404Unless($this->diary);
     90
     91    $comment = new DiaryComment();
     92    $comment->setDiary($this->diary);
     93    $comment->setMemberId($this->getUser()->getMemberId());
     94    $this->form = new DiaryCommentForm($comment);
     95
     96    $this->form->bind($request->getParameter('diary_comment'));
     97
     98    if ($this->form->isValid())
     99    {
     100      $this->form->save();
     101      $this->redirect('diary/show?id='.$this->diary->getId());
     102    }
     103
     104    $this->setTemplate('show');
    76105  }
    77106
Note: See TracChangeset for help on using the changeset viewer.