Example #1
0
function op_api_diary_comment($comment)
{
    if ($comment) {
        $images = array();
        if ($comment->getHasImages()) {
            foreach ($comment->getDiaryCommentImages() as $image) {
                $images[] = op_api_diary_image($image);
            }
        }
        return array('id' => $comment->getId(), 'diary_id' => $comment->getDiaryId(), 'number' => $comment->getNumber(), 'member' => op_api_member($comment->getMember()), 'body' => nl2br($comment->getBody()), 'ago' => op_format_activity_time(strtotime($comment->getCreatedAt())), 'created_at' => $comment->getCreatedAt(), 'images' => $images);
    }
}
Example #2
0
<br />
<?php 
}
?>
<strong class="name"><?php 
echo op_link_to_member($activity->getMember());
?>
</strong>
<span class="bodyText"><?php 
echo op_activity_body_filter($activity);
?>
</span>
</span>
<span class="info">
<span class="time"><?php 
echo $time = op_format_activity_time(strtotime($activity->getCreatedAt()));
if ($activity->getSource()) {
    ?>
 from <?php 
    echo link_to_if($activity->getSourceUri(), $activity->getSource(), $activity->getSourceUri());
}
?>
</span>
<?php 
if ($activity->getPublicFlag() != ActivityDataTable::PUBLIC_FLAG_SNS) {
    ?>
<span class="public_flag"><?php 
    echo __('Public flag');
    ?>
 : <?php 
    echo $activity->getPublicFlagCaption();
if ($community->isPrivilegeBelong($memberId)) {
    use_helper('opUtil', 'opTimeline');
    ?>
<div class="row">
<div class="gadget_header span12">最新の<?php 
    echo $op_term['activity'];
    ?>
</div>
</div>
<div class="row">
  <div class="span12">
  <?php 
    if (isset($createdAt) && isset($body)) {
        ?>
  <?php 
        echo op_format_activity_time(strtotime($createdAt));
        ?>
 - <?php 
        echo $body;
        ?>
  <?php 
    } else {
        ?>
  (<?php 
        echo $op_term['activity'];
        ?>
はまだありません。)
  <?php 
    }
    ?>
  </div>
Example #4
0
    foreach ($pager->getResults() as $comment) {
        ?>
<div class="comment" style="padding: 1px 0px 4px 0px; border-bottom: 1px solid #b3ceef;">

<div class="body">
<?php 
        echo op_link_to_member($comment->getMemberId());
        ?>
&nbsp;
<?php 
        echo op_auto_link_text($comment->body);
        ?>

<div class="info">
<small style="color: rgb(85, 85, 85);"><?php 
        echo op_format_activity_time(strtotime($comment->getCreatedAt()));
        ?>
</small>
</div>

<?php 
        if ($authorId === $sf_user->getMemberId() || $comment->member_id === $sf_user->getMemberId()) {
            ?>
<div class="operation">
<small>
<?php 
            echo link_to(__('Delete'), $deleteConfirmUrl, $comment);
            ?>
</small>
</div>
<?php 
Example #5
0
op_include_pager_total($pager);
?>
</center>
<hr color="<?php 
echo $op_color["core_color_11"];
?>
" size="3">
<?php 
foreach ($pager->getResults() as $album) {
    echo link_to($album->Member->name, '@member_profile?id=' . $album->Member->id);
    ?>
 <?php 
    echo link_to($album->title, 'album_show', $album);
    ?>
<br>
<center><?php 
    echo link_to(image_tag_sf_image($album->getCoverImage(), array('width' => '80', 'size' => '120x120')), 'album_show', $album);
    ?>
</center>
<?php 
    echo $album->body;
    ?>
 <?php 
    echo op_format_activity_time(strtotime($album->getCreatedAt()));
    ?>
<hr color="<?php 
    echo $op_color["core_color_11"];
    ?>
" size="3">
<?php 
}
 public function executeListMention(sfWebRequest $request)
 {
     sfContext::getInstance()->getConfiguration()->loadHelpers(array('Helper', 'Date', 'sfImage', 'opUtil', 'Escaping'));
     $baseUrl = sfConfig::get('op_base_url');
     $memberId = $this->getUser()->getMember()->getId();
     $mines = Doctrine::getTable('ActivityData')->findByMemberId($memberId);
     $replyId = array();
     foreach ($mines as $mine) {
         $replyId[] = $mine->getId();
     }
     $activityData = Doctrine_Query::create()->from('ActivityData ad')->where('ad.template = ?', 'mention_member_id')->andWhere('ad.template_param LIKE ?', '%|' . $memberId . '|%')->execute();
     foreach ($activityData as $activity) {
         $id = $activity->getId();
         $memberId = $activity->getMemberId();
         $member = Doctrine::getTable('Member')->find($memberId);
         if (!$member->getImageFileName()) {
             $memberImage = $baseUrl . '/images/no_image.gif';
         } else {
             $memberImageFile = $member->getImageFileName();
             $memberImage = sf_image_path($memberImageFile, array('size' => '48x48'));
         }
         $memberName = $member->getName();
         $memberScreenName = $this->getScreenName($memberId) ? $this->getScreenName($memberId) : $memberName;
         $body = sfOutputEscaper::escape(sfConfig::get('sf_escaping_method'), opTimelinePluginUtil::screenNameReplace($activity->getBody(), $baseUrl));
         $uri = $activity->getUri();
         $source = $activity->getSource();
         $sourceUri = $activity->getSourceUri();
         $createdAt = $activity->getCreatedAt();
         if ($memberId == $this->getUser()->getMember()->getId()) {
             $deleteLink = 'show';
         } else {
             $deleteLink = 'none';
         }
         $ac[] = array('id' => $id, 'memberId' => $memberId, 'memberImage' => $memberImage, 'memberScreenName' => $memberScreenName, 'memberName' => $memberName, 'body' => $body, 'deleteLink' => $deleteLink, 'uri' => $uri, 'source' => $source, 'sourceUri' => $sourceUri, 'createdAt' => op_format_activity_time(strtotime($createdAt)), 'baseUrl' => sfConfig::get('op_base_url'));
     }
     $json = array('status' => 'success', 'data' => $ac);
     return $this->renderText(json_encode($json));
 }
<p>
<span class="content">
<?php if ($activity->getImages()->count()): ?>
<?php $images = $activity->getImages() ?>
<?php for ($i = 0; $i < $images->count() && $i < 3;$i++): ?>
<?php if ($images[$i]->getFileId()): ?>
<?php echo op_image_tag_sf_image($images[$i]->getFile(), array('size' => '48x48')) ?>
<?php else: ?>
<?php echo op_image_tag($images[$i]->getUri(), array('width' => 48, 'height' => 48)) ?>
<?php endif; ?>
<?php endfor; ?>
<br />
<?php endif; ?>
<strong class="name"><?php echo op_link_to_member($activity->getMember()) ?></strong>
<span class="bodyText"><?php echo op_activity_body_filter($activity) ?></span>
</span>
<span class="info">
<span class="time"><?php echo $time = op_format_activity_time(strtotime($activity->getCreatedAt())) ?>
<?php if ($activity->getSource()): ?>
 from <?php echo link_to_if($activity->getSourceUri(), $activity->getSource(), $activity->getSourceUri()) ?>
<?php endif; ?>
</span>
<?php if ($activity->getPublicFlag() != ActivityDataTable::PUBLIC_FLAG_SNS): ?>
<span class="public_flag"><?php echo __('Public flag') ?> : <?php echo $activity->getPublicFlagCaption() ?></span>
<?php endif; ?>
</span>
</p>
</div>
<input type='checkbox' name='activities[]' value='<?php echo $activity->id; ?>'>
</li>
 public function executeGet(sfWebRequest $request)
 {
     $this->getResponse()->setContentType('application/json');
     sfContext::getInstance()->getConfiguration()->loadHelpers(array('Helper', 'Date', 'I18N', 'sfImage', 'Url', 'Tag', 'opUtil', 'Escaping', 'opTimeline'));
     $ac = array();
     $activityIds = array();
     $mode = $request->getParameter('mode');
     $list = $request->getParameter('list');
     $memberId = (int) $request->getParameter('memberId');
     $lastId = (int) $request->getParameter('lastId');
     $moreId = (int) $request->getParameter('moreId');
     $limit = (int) $request->getParameter('limit', 20);
     $communityId = (int) $request->getParameter('communityId');
     $activityData = Doctrine_Query::create()->from('ActivityData ad');
     switch ($list) {
         case 'all':
             $activityData = $activityData->where('ad.in_reply_to_activity_id IS NULL');
             break;
         case 'more':
             if (!is_numeric($moreId)) {
                 $this->status = 'error';
                 $this->message = 'Request parameter "moreId" must be numeric.';
                 return sfView::ERROR;
             }
             $activityData = $activityData->where('ad.id < ?', $moreId)->andWhere('ad.in_reply_to_activity_id IS NULL');
             break;
         case 'check':
             if (!is_numeric($lastId)) {
                 $this->status = 'error';
                 $this->message = 'Request parameter "lastId" must be numeric.';
                 return sfView::ERROR;
             }
             $activityData = $activityData->where('ad.in_reply_to_activity_id IS NULL')->andWhere('ad.id > ?', $lastId);
             break;
         default:
             $activityData = $activityData->where('ad.in_reply_to_activity_id IS NULL');
     }
     switch ($mode) {
         case 'member':
             if (!is_numeric($memberId)) {
                 $this->status = 'error';
                 $this->message = 'Request parameter "memberId" must be numeric.';
                 return sfView::ERROR;
             }
             $activityData = $activityData->andWhere('ad.member_id = ?', $memberId)->andWhere('ad.foreign_table IS NULL')->andWhere('ad.foreign_id IS NULL')->andWhere('ad.public_flag = ?', 1)->orderBy('ad.id DESC');
             break;
         case 'community':
             if (!is_numeric($communityId)) {
                 $this->status = 'error';
                 $this->message = 'Request parameter "communityId" must be numeric.';
                 return sfView::ERROR;
             }
             $activityData = $activityData->andWhere('ad.foreign_table = ?', 'community')->andWhere('ad.foreign_id = ?', $communityId)->orderBy('ad.id DESC');
             break;
         default:
             $activityData = $activityData->andWhere('ad.foreign_table IS NULL')->andWhere('ad.foreign_id IS NULL')->andWhere('ad.public_flag = ?', 1);
             $activityData = $activityData->orderBy('ad.id DESC');
     }
     $activityData = $activityData->limit($limit);
     $activityData = $activityData->execute();
     foreach ($activityData as $activity) {
         $id = $activity->getId();
         $memberId = $activity->getMemberId();
         $member = Doctrine::getTable('Member')->find($memberId);
         if (!$member->getImageFileName()) {
             $memberImage = url_for('@homepage') . '/images/no_image.gif';
         } else {
             $memberImageFile = $member->getImageFileName();
             $memberImage = sf_image_path($memberImageFile, array('size' => '48x48'));
         }
         $memberName = $member->getName();
         $memberScreenName = $this->getScreenName($memberId) ? $this->getScreenName($memberId) : $memberName;
         $body = sfOutputEscaper::escape(sfConfig::get('sf_escaping_method'), opTimelinePluginUtil::screenNameReplace($activity->getBody(), url_for('@homepage')));
         $body = op_timeline_plugin_body_filter($activity, $body);
         $uri = $activity->getUri();
         $source = $activity->getSource();
         $sourceUri = $activity->getSourceUri();
         $createdAt = $activity->getCreatedAt();
         if ($memberId == $this->getMember()->getId()) {
             $deleteLink = 'inline';
         } else {
             $deleteLink = 'none';
         }
         $ac[] = array('id' => $id, 'memberId' => $memberId, 'memberImage' => $memberImage, 'memberScreenName' => $memberScreenName, 'memberName' => $memberName, 'body' => $body, 'deleteLink' => $deleteLink, 'uri' => $uri, 'source' => $source, 'sourceUri' => $sourceUri, 'createdAt' => op_format_activity_time(strtotime($createdAt)), 'baseUrl' => sfConfig::get('op_base_url'));
         $activityIds[] = $id;
     }
     $count = count($ac);
     $i = 0;
     $commentData = Doctrine_Query::create()->from('ActivityData ad')->whereIn('ad.in_reply_to_activity_id', $activityIds)->andWhere('ad.foreign_table IS NULL')->andWhere('ad.foreign_id IS NULL')->andWhere('ad.public_flag = ?', 1)->execute();
     foreach ($commentData as $activity) {
         $inReplyToActivityId = $activity->getInReplyToActivityId();
         for ($j = 0; $j < $count; $j++) {
             if ($ac[$j]['id'] == $inReplyToActivityId) {
                 $member = Doctrine::getTable('Member')->find($activity->getMemberId());
                 $cm = array();
                 $cm['id'] = $activity->getId();
                 $cm['memberId'] = $member->getId();
                 $cm['memberName'] = $member->getName();
                 if (!$member->getImageFileName()) {
                     $cm['memberImage'] = $baseUrl . '/images/no_image.gif';
                 } else {
                     $memberImageFile = $member->getImageFileName();
                     $cm['memberImage'] = sf_image_path($memberImageFile, array('size' => '48x48'));
                 }
                 $cm['memberScreenName'] = $this->getScreenName($cm['memberId']) ? $this->getScreenName($cm['memberId']) : $cm['memberName'];
                 $cm['body'] = opTimelinePluginUtil::screenNameReplace(sfOutputEscaper::escape(sfConfig::get('sf_escaping_method'), $activity->getBody()), $baseUrl);
                 if ($cm['memberId'] == $this->getMember()->getId()) {
                     $cm['deleteLink'] = 'inline';
                 } else {
                     $cm['deleteLink'] = 'none';
                 }
                 $cm['uri'] = $activity->getUri();
                 $cm['source'] = $activity->getSource();
                 $cm['sourceUri'] = $activity->getSourceUri();
                 $cm['createdAt'] = op_format_activity_time(strtotime($activity->getCreatedAt()));
                 $cm['baseUrl'] = sfConfig::get('op_base_url');
                 $ac[$j]['reply'][] = $cm;
             }
         }
         $i++;
     }
     $this->status = 'success';
     $this->data = $ac;
     return sfView::SUCCESS;
 }
<?php

use_helper('Helper', 'Date', 'sfImage', 'opUtil');
$ac = array();
foreach ($activityData as $activity) {
    $member = $activity->getMember();
    $memberImageFileName = $member->getImageFileName();
    if (!$memberImageFileName) {
        $memberImage = $baseUrl . '/images/no_image.gif';
    } else {
        $memberImage = sf_image_path($memberImageFileName, array('size' => '48x48'));
    }
    $ac[] = array('id' => $activity->getId(), 'memberId' => $member->getId(), 'memberImage' => $memberImage, 'memberScreenName' => $member->getConfig('op_screen_name', $member->getName()), 'memberName' => $member->getName(), 'body' => $activity->getBody(), 'deleteLink' => $member->getId() == $viewMemberId ? 'inline' : 'none', 'uri' => $activity->getUri(), 'source' => $activity->getSource(), 'sourceUri' => $activity->getSourceUri(), 'createdAt' => op_format_activity_time(strtotime($activity->getCreatedAt())), 'baseUrl' => $baseUrl);
}
return array('status' => 'success', 'data' => $ac);