public static function hookEventCreate($event)
 {
     sfContext::getInstance()->getConfiguration()->loadHelpers(array('Asset', 'opUtil'));
     $uri = sfContext::getInstance()->getConfiguration()->generateAppUrl('pc_frontend', array('sf_route' => 'communityEvent_show', 'id' => $event->id), true);
     $title = op_truncate($event->name, 140 - 23 - 4 - 2);
     self::api()->post('statuses/update', array('status' => sprintf('[イベント] %s %s', $title, $uri)));
 }
示例#2
0
function op_api_diary($diary)
{
    if ($diary) {
        $body = preg_replace(array('/<op:.*?>/', '/<\\/op:.*?>/'), '', $diary->getBody());
        $body = preg_replace('/http.:\\/\\/maps\\.google\\.co[[:graph:]]*/', '', $body);
        $bodyShort = op_truncate($body, 60);
        $body = op_auto_link_text($body);
        return array('id' => $diary->getId(), 'member' => op_api_member($diary->getMember()), 'title' => $diary->getTitle(), 'body' => nl2br(op_api_diary_convert_emoji($body)), 'body_short' => nl2br(op_api_diary_convert_emoji($bodyShort)), 'public_flag' => $diary->getPublicFlag(), 'ago' => op_format_activity_time(strtotime($diary->getCreatedAt())), 'created_at' => $diary->getCreatedAt());
    }
}
 protected function countTestData($namespace, $name, $isEscaped, $truncateOption = array())
 {
     if ($isEscaped) {
         $string = $this->getEscapedTestData($namespace, $name);
     } else {
         $string = $this->getRawTestData($namespace, $name);
     }
     if ($truncateOption) {
         if (!is_array($truncateOption)) {
             $truncateOption = array();
         }
         $width = isset($truncateOption['width']) ? $truncateOption['width'] : 80;
         $etc = isset($truncateOption['etc']) ? $truncateOption['etc'] : '';
         $rows = isset($truncateOption['rows']) ? $truncateOption['rows'] : 1;
         $string = op_truncate($string, $width, $etc, $rows);
     }
     return substr_count($this->response->getContent(), $string);
 }
示例#4
0
 function output($section_name, $config, $op, $return = false)
 {
     global $post;
     $defaults = array('before' => '', 'after' => '', 'ulclass' => '', 'post_id' => 0);
     $config = wp_parse_args($config, $defaults);
     extract($config);
     $ulclass = $ulclass == '' ? '' : ' class="' . $ulclass . '"';
     $post_id = $post_id > 0 ? $post_id : $post->ID;
     if ($post_tags = get_the_tags($post_id)) {
         $tmp_post = $post;
         $tags = array();
         foreach ($post_tags as $tag) {
             $tags[] = $tag->term_id;
         }
         $related_posts = get_posts(array('tag__in' => $tags, 'numberposts' => 4, 'exclude' => $post_id));
         $html = '';
         foreach ($related_posts as $related) {
             if ($related->ID == $post_id) {
                 continue;
             }
             $url = get_permalink($related->ID);
             $cn = get_comments_number($related->ID);
             $title = get_the_title($related->ID);
             $comments = sprintf(_n('1 Comment', '%1$s Comments', $cn, OP_SN), number_format_i18n($cn));
             $atag = ' href="' . $url . '" rel="bookmark" title="' . sprintf(esc_attr__('Permalink to %s', OP_SN), esc_attr($title)) . '"';
             $img = '';
             $class = '';
             if (has_post_thumbnail($related->ID)) {
                 $img = '<a' . $atag . ' class="thumbnail">' . get_the_post_thumbnail($related->ID, 'small-image') . '</a>';
             } else {
                 $class = ' class="no-thumbnail"';
             }
             $html .= '<li' . $class . '>' . $img . '<h4><a' . $atag . '>' . op_truncate($title) . '</a></h4><a href="' . get_comments_link($related->ID) . '">' . $comments . '</a></li>';
         }
         if (!empty($html)) {
             $html = $before . '<ul' . $ulclass . '>' . $html . '</ul>' . $after;
         }
         $post = $tmp_post;
         if ($return) {
             return $html;
         }
         echo $html;
     }
 }
示例#5
0
function op_api_message($messageList, $member, $useIsReadFlag = false)
{
    $message = $messageList->getSendMessageData();
    $body = preg_replace(array('/&lt;op:.*?&gt;/', '/&lt;\\/op:.*?&gt;/'), '', $message->getBody());
    $body = preg_replace('/http.:\\/\\/maps\\.google\\.co[[:graph:]]*/', '', $body);
    $body = op_auto_link_text($body);
    $imagePath = null;
    $imageTag = null;
    $image = $message->getMessageFile();
    if (0 < count($image)) {
        $imageTag = image_tag_sf_image($image[0]->getFile(), array('size' => '76x76'));
        $imagePath = sf_image_path($image[0]->getFile());
    }
    $data = array('id' => $message->getId(), 'member' => op_api_member($member), 'subject' => $message->getSubject(), 'body' => nl2br($body), 'summary' => op_truncate(op_decoration($body, true), 25, '...'), 'image_path' => $imagePath, 'image_tag' => $imageTag, 'created_at' => $message->getCreatedAt(), 'formatted_date' => get_formatted_date($message->getCreatedAt()));
    if ($useIsReadFlag) {
        $data['is_read'] = $messageList->isSelf() ? (bool) $messageList->getIsRead() : null;
    }
    return $data;
}
示例#6
0
function op_api_diary($diary, $option = null)
{
    if ($diary) {
        //モデルクラス内でsns_termの値が取れずgetPublicFlagLabelでコケるため,緊急処置(see #3502, #3503)
        Doctrine::getTable('SnsTerm')->configure('ja_JP', 'pc_frontend');
        $data = array('id' => $diary->id, 'member' => op_api_member($diary->getMember()), 'title' => $diary->title, 'public_flag' => $diary->getPublicFlagLabel(), 'created_at' => $diary->created_at);
        if ('short' == $option) {
            $bodyShort = op_truncate(op_decoration($diary->body, true), 60);
            if (mb_strlen($diary->body) >= 60) {
                $bodyShort .= '&hellip;';
            }
            $data['body_short'] = op_api_diary_convert_emoji($bodyShort);
        } else {
            $body = op_auto_link_text(op_decoration($diary->body));
            $data['body'] = nl2br(op_api_diary_convert_emoji($body));
            $images = $diary->getDiaryImages();
            foreach ($images as $image) {
                $data['images'][] = op_api_diary_image($image);
            }
        }
        return $data;
    }
}
示例#7
0
</td>
</tr><tr>
<th><?php 
        echo __('Title');
        ?>
</th><td><?php 
        echo op_diary_get_title_and_count($diary);
        echo op_diary_image_icon($diary);
        ?>
</td>
</tr><tr>
<th><?php 
        echo __('Body');
        ?>
</th><td><?php 
        echo op_truncate(op_decoration($diary->body, true), 36, '', 3);
        ?>
</td>
</tr><tr class="operation">
<th><?php 
        echo __('Created at');
        ?>
</th><td><span class="text"><?php 
        echo op_format_date($diary->created_at, 'XDateTimeJa');
        ?>
</span> <span class="moreInfo"><?php 
        echo link_to(__('View this diary'), 'diary_show', $diary);
        ?>
</span></td>
</tr></tbody></table></div></div>
<?php 
op_mobile_page_title(__('Recently Posted %Community% Events'));
?>

<?php 
if ($pager->getNbResults()) {
    use_helper('Date');
    ?>

<center>
<?php 
    echo pager_total($pager);
    ?>
</center>

<?php 
    $list = array();
    foreach ($pager->getResults() as $event) {
        $list[] = sprintf("%s<br>%s (%s)", op_format_date($event->getUpdatedAt(), 'XDateTime'), link_to(sprintf("%s(%d)", op_truncate($event->getName(), 28), $event->getCommunityEventComment()->count()), '@communityEvent_show?id=' . $event->getId()), op_truncate($event->getCommunity()->getName(), 28));
    }
    $options = array('border' => true);
    op_include_list('communityList', $list, $options);
    ?>

<?php 
    if ($pager->haveToPaginate()) {
        op_include_pager_navigation($pager, '@communityEvent_recently_event_list?page=%d', array('is_total' => false));
    }
    ?>

<?php 
}
示例#9
0
<?php

use_helper('opMessage');
echo op_format_date($message->getCreatedAt(), 'XDateTime');
?>
<br>
<?php 
echo sprintf('%s (%s)', link_to(op_truncate($message->getSubject(), 28), '@readDustMessage?id=' . $message->getViewMessageId()), op_message_link_to_member($message->getSendFromOrTo()));
示例#10
0
<?php

use_helper('opMessage');
echo op_format_date($message->getCreatedAt(), 'XDateTime');
?>
<br> 
<?php 
echo sprintf('%s (%s)', link_to(op_truncate($message->getSubject(), 28), '@readSendMessage?id=' . $message->getId()), op_message_link_to_member($message->getSendTo()));
示例#11
0
<?php

$acl = opCommunityTopicAclBuilder::buildCollection($community, array($sf_user->getMember()));
?>

<?php 
if ($acl->isAllowed($sf_user->getMemberId(), null, 'view')) {
    use_helper('Date');
    $list = array();
    foreach ($communityEvents as $communityEvent) {
        $list[] = sprintf("[%s] %s", op_format_date($communityEvent->getUpdatedAt(), 'XShortDate'), link_to(sprintf("%s(%d)", op_truncate($communityEvent->getName(), 28), $communityEvent->getCommunityEventComment()->count()), '@communityEvent_show?id=' . $communityEvent->getId()));
    }
    $moreInfo = array();
    if (count($communityEvents)) {
        $moreInfo[] = link_to(__('More'), '@communityEvent_list_community?id=' . $community->getId());
    }
    if ($acl->isAllowed($sf_user->getMemberId(), null, 'add')) {
        $moreInfo[] = link_to(__('Create a new event'), '@communityEvent_new?id=' . $community->getId());
    }
    $option = array('title' => __('Recently Posted This %Community% Events'), 'border' => true, 'moreInfo' => $moreInfo);
    op_include_list('communityEvent', $list, $option);
}
function op_bbs_get_title_and_count($bbs, $space = true, $width = 36)
{
    return sprintf('%s%s(%d)', op_truncate($bbs->getTitle(), $width), $space ? ' ' : '', $bbs->countBbsComments());
}
示例#13
0
if ($pager->getNbResults()) {
    ?>

<center>
<?php 
    echo pager_total($pager);
    ?>
</center>
<?php 
    $list = array();
    foreach ($pager->getResults() as $topic) {
        $list_str = op_format_date($topic->getUpdatedAt(), 'XDateTime');
        if ($topic->isEditable($sf_user->getMemberId())) {
            $list_str .= sprintf('&nbsp;[%s]', link_to(__('Edit'), '@communityTopic_edit?id=' . $topic->getId()));
        }
        $list_str .= '<br>' . link_to(sprintf("%s(%d)", op_truncate($topic->getName(), 28), $topic->getCommunityTopicComment()->count()), '@communityTopic_show?id=' . $topic->getId());
        $list[] = $list_str;
    }
    $options = array('border' => true);
    op_include_list('communityTopicList', $list, $options);
    ?>

<?php 
    if ($pager->haveToPaginate()) {
        op_include_pager_navigation($pager, 'communityTopic/listCommunity?id=' . $community->getId() . '&page=%d', array('is_total' => false));
    }
    ?>

<?php 
} else {
    ?>
示例#14
0
<?php

use_helper('opMessage');
echo op_format_date($message->getCreatedAt(), 'XDateTime');
?>
<br>
<?php 
echo sprintf('%s (%s)', $message->getSendTo()->getId() ? link_to(op_truncate($message->getSubject(), 28), 'message/edit?id=' . $message->getId()) : op_truncate($message->getSubject(), 28), op_message_link_to_member($message->getSendTo()));
</th>
<td>
<?php 
    if ($count = count($communityEvents)) {
        ?>
<ul class="articleList">
<?php 
        foreach ($communityEvents as $key => $communityEvent) {
            ?>
<li>
<span class="date"><?php 
            echo op_format_date($communityEvent->getUpdatedAt(), 'XShortDateJa');
            ?>
</span>
<?php 
            echo link_to(sprintf('%s(%d)', op_truncate($communityEvent->getName(), 36), $communityEvent->getCommunityEventComment()->count()), '@communityEvent_show?id=' . $communityEvent->getId());
            ?>
</li>
<?php 
        }
        ?>
</ul>
<?php 
    }
    ?>
<div class="moreInfo">
<ul class="moreInfo">
<?php 
    if ($count) {
        ?>
<li><?php 
示例#16
0
/**
 * This file is part of the OpenPNE package.
 * (c) OpenPNE Project (http://www.openpne.jp/)
 *
 * For the full copyright and license information, please view the LICENSE
 * file and the NOTICE file that were distributed with this source code.
 */
function op_album_get_title_and_count($album, $space = true, $width = 36)
{
    return sprintf('%s%s', op_truncate($album->getTitle(), $width), $space ? ' ' : '');
}
op_mobile_page_title(__('Recently Posted %Community% Topics'));
?>

<?php 
if ($pager->getNbResults()) {
    use_helper('Date');
    ?>

<center>
<?php 
    echo pager_total($pager);
    ?>
</center>

<?php 
    $list = array();
    foreach ($pager->getResults() as $topic) {
        $list[] = sprintf("%s<br>%s (%s)", op_format_date($topic->getUpdatedAt(), 'XDateTime'), link_to(sprintf("%s(%d)", op_truncate($topic->getName(), 28), $topic->getCommunityTopicComment()->count()), 'communityTopic_show', $topic), op_truncate($topic->getCommunity()->getName(), 28));
    }
    $options = array('border' => true);
    op_include_list('communityList', $list, $options);
    ?>

<?php 
    if ($pager->haveToPaginate()) {
        op_include_pager_navigation($pager, '@communityTopic_recently_topic_list?page=%d', array('is_total' => false));
    }
    ?>

<?php 
}
示例#18
0
for ($i = 0; $i < $memberList['number']; $i++)
{
  $member = $memberList['model'][$i];
  $list[$i][__('No%0%', array('%0%' => $memberList['rank'][$i]))] =
    __('%0% :%1% access', array('%0%' => link_to($member->getName(), 'member/profile?id='.$member->getId()), '%1%' => $memberList['count'][$i]));

  if (sfConfig::get('app_ranking_display_self_introduction', false))
  {
    $selfintoroCaption = __('Self Introduction');
    $selfintoro = $member->getProfile('op_preset_self_introduction');
    if ($selfintoro)
    {
      $acl = $selfintoro->getTable()->getAcl($selfintoro->getRawValue());
      if ($acl->isAllowed('everyone', $selfintoro->getRawValue(), 'view'))
      {
        $list[$i][$selfintoroCaption] = op_truncate($selfintoro, 36, '', 3);
      }
    }
  }
}

$options = array(
  'id'             => 'rankingResultList',
  'title'          => __('The No1 of the number of access member is %0%', array('%0%' => $memberList['model'][0]->getName())),
  'link_to_detail' => 'member/profile?id=%d',
  'model'          => $memberList['model'],
  'list'           => $list,
  'rank'           => $memberList['rank'],
);

include_partial('global/partsRankingResultList', array('options' => $options));
示例#19
0
<?php

if ($ranking['number']) {
    $list = array();
    for ($i = 0; $i < $ranking['number']; $i++) {
        $community = $ranking['model'][$i];
        $list[$i][__('No%0%', array('%0%' => $ranking['rank'][$i]))] = link_to($community->getName(), 'community/home?id=' . $community->getId()) . ' ' . __(':%0% member', array('%0%' => $ranking['count'][$i]));
        $list[$i][__('Category')] = $community->getCommunityCategory();
        $list[$i][__('Manager')] = link_to($ranking['admin'][$i]->getName(), '@obj_member_profile?id=' . $ranking['admin'][$i]->getId());
        $list[$i][__('Description')] = op_truncate($community->getConfig('description'), 36, '', 3);
    }
    $options = array('id' => 'rankingResultList', 'title' => __("The No1 of the number of %community% member is '%0%'", array('%community%' => $op_term['community'], '%0%' => $ranking['model'][0]->getName())), 'link_to_detail' => 'community/home?id=%d', 'model' => $ranking['model'], 'list' => $list, 'rank' => $ranking['rank']);
    include_partial('global/partsRankingResultList', array('options' => $options));
} else {
    op_include_box('community_list', __('No %community%'), array('title' => __('Participation number No1 %community%')));
}
<?php

use_helper('Date');
$list = array();
$getCommunityComment = 'event' === $type ? 'getCommunityEventComment' : 'getCommunityTopicComment';
foreach ($pager->getResults() as $communityTopic) {
    $list[] = sprintf("%s<br>%s(%s)", op_format_date($communityTopic->getUpdatedAt(), 'XDateTime'), link_to(sprintf("%s(%d)", op_truncate($communityTopic->getName(), 28), $communityTopic->{$getCommunityComment}()->count()), sprintf($link_to_detail, $communityTopic->getId()), $communityTopic), op_truncate($communityTopic->getCommunity()->getName(), 17));
}
op_include_list('communityTopic', $list, array('border' => true));
示例#21
0
        echo $holiday;
        ?>
</p>
<?php 
    }
    foreach ($item['events'] as $event) {
        if ($event['is_join']) {
            $eventIcon = 'icon_event_R.gif';
            $eventAlt = '[参]';
        } else {
            $eventIcon = 'icon_event_B.gif';
            $eventAlt = '[イ]';
        }
        ?>
<p class="event"><?php 
        echo link_to(sprintf('<span class="icon">%s </span>%s', image_tag('/opCalendarPlugin/images/' . $eventIcon, array('alt' => $eventAlt)), op_truncate($event['name'], 20, '...', 1)), '@communityEvent_show?id=' . $event['id']);
        ?>
</p>
<?php 
    }
    foreach ($item['schedules'] as $schedule) {
        if ($schedule->isShowable($sf_user->getMemberId())) {
            ?>
<p class="schedule"><?php 
            echo op_link_to_schedule($schedule, 20);
            ?>
</p>

<?php 
        }
    }
示例#22
0
<?php

if ($memberList['number']) {
    $list = array();
    for ($i = 0; $i < $memberList['number']; $i++) {
        $member = $memberList['model'][$i];
        $list[$i][__('No%0%', array('%0%' => $memberList['rank'][$i]))] = __('%0% :%1% member', array('%0%' => link_to($member->getName(), '@obj_member_profile?id=' . $member->getId()), '%1%' => $memberList['count'][$i]));
        $selfintoroCaption = __('Self Introduction');
        if ($member->getProfile('op_preset_self_introduction')) {
            $list[$i][$selfintoroCaption] = op_truncate($member->getProfile('op_preset_self_introduction'), 36, '', 3);
        }
    }
    $options = array('id' => 'rankingResultList', 'title' => __('The No1 of the number of %friend% member is %0%', array('%friend%' => $op_term['friend']->pluralize(), '%0%' => $memberList['model'][0]->getName())), 'link_to_detail' => '@obj_member_profile?id=%d', 'model' => $memberList['model'], 'list' => $list, 'rank' => $memberList['rank']);
    include_partial('global/partsRankingResultList', array('options' => $options));
} else {
    op_include_box('friend_list', __('There is no member who has a %friend%'), array('title' => __('Member of number No1 of %friend%', array('%friend%' => $op_term['friend']->pluralize()))));
}
示例#23
0
            } else {
                $eventIcon = 'icon_event_B.gif';
                $eventAlt = '[イ]';
            }
            ?>
<p class="event"><?php 
            echo link_to(sprintf('<span class="icon">%s </span>%s', image_tag('/opCalendarPlugin/images/' . $eventIcon, array('alt' => $eventAlt)), op_truncate($event['name'], 40, '...', 1)), '@communityEvent_show?id=' . $event['id']);
            ?>
</p>
<?php 
        }
        foreach ($item['schedules'] as $schedule) {
            if ($schedule->isShowable($sf_user->getMemberId())) {
                ?>
<p class="schedule"><?php 
                echo link_to(sprintf('<span class="icon">%s </span>%s', image_tag('/opCalendarPlugin/images/icon_pen.gif', array('alt' => '[予]')), op_truncate($schedule->title, 40, '...', 1)), '@schedule_show?id=' . $schedule->id);
                ?>
</p>
<?php 
            }
        }
        ?>
</td>
<?php 
    }
    ?>

</tr>
<?php 
}
?>
示例#24
0
function op_link_to_schedule($schedule, $width = 40)
{
    $space = '&nbsp;';
    $icon = sprintf('<span class="icon">%s%s</span>', image_tag('/opCalendarPlugin/images/icon_pen.gif', array('alt' => '[予]')) . $space, $schedule->getApiIdUnique() ? image_tag('//www.google.com/images/icons/product/calendar-16.png', array('raw_name' => true, 'alt' => 'Google Calendar')) . $space : '');
    return link_to($icon . op_truncate($schedule->title, $width, '...', 1), '@schedule_show?id=' . $schedule->id);
}
?>
<hr class="toumei" />
<div class="row">
  <div class="gadget_header span12">コミュニティイベント一覧</div>
</div>
<hr class="toumei" />
<div id="eventList" style="margin-left: 0px;">
<?php 
foreach ($communityEvents as $key => $communityEvent) {
    ?>
  <div class="row">
    <div class="span3">
      <?php 
    echo op_format_date($communityEvent->getUpdatedAt(), 'XShortDateJa');
    ?>
    </div>
    <div class="span9">
    <?php 
    echo link_to(sprintf('%s', op_truncate($communityEvent->getName(), 36)), '@communityEvent_show?id=' . $communityEvent->getId());
    ?>
    (<?php 
    echo $communityEvent->getCommunity()->getName();
    ?>
)
    </div>
  </div>
<?php 
}
?>
</div>
示例#26
0
<?php

if (count($communityTopic)) {
    $list = array();
    foreach ($communityTopic as $topic) {
        $list[] = sprintf("[%s] %s<br>%s", op_format_date($topic->getUpdatedAt(), 'XShortDate'), $topic->getCommunity()->getName(), link_to(sprintf("%s(%d)", op_truncate($topic->getName(), 28), $topic->getCommunityTopicComment()->count()), '@communityTopic_show?id=' . $topic->getId()));
    }
    $options = array('title' => __('Recently Posted %Community% Topics'), 'border' => true, 'moreInfo' => array(link_to(__('More'), 'communityTopic_recently_topic_list')));
    op_include_list('communityList', $list, $options);
    ?>

<?php 
}
function _op_mtviewer_entry_str($entry, $width = 36)
{
    $title = op_truncate($entry->title, $width);
    $title = sprintf('%s (%d)', $title, $entry->getCommentsCount());
    return $title;
}
示例#28
0
<ul class="articleList">
<?php 
foreach ($options['blogRssCacheList'] as $blogRssCache) {
    ?>
<li>
<span class="date"><?php 
    echo op_format_date($blogRssCache->getDate(), 'XShortDateJa');
    ?>
</span>
<?php 
    echo image_tag('articleList_maker.gif', array('alt' => ''));
    ?>
 
<?php 
    echo link_to(op_truncate($blogRssCache->getTitle(), 30), $blogRssCache->getLink());
    if ($options['showName']) {
        ?>
(<?php 
        echo $blogRssCache->getMember()->getName();
        ?>
)
<?php 
    }
    ?>
</li>
<?php 
}
?>
</ul>
    echo key($list);
    ?>
</th><td>
<?php 
    echo array_shift($list);
    ?>
</td>
</tr>
<?php 
    foreach ($list as $caption => $item) {
        ?>
<tr>
<th><?php 
        echo $caption;
        ?>
</th><td><?php 
        echo op_truncate($item, 36, '', 3);
        ?>
</td>
</tr>
<?php 
    }
    ?>
</tbody></table></div></div>
<?php 
}
?>
</div>

<?php 
include_slot('pager');
示例#30
0
        ?>
</td>
</tr><tr>
<th><?php 
        echo __('Title');
        ?>
</th><td><?php 
        echo op_album_get_title_and_count($album);
        ?>
</td>
</tr><tr>
<th><?php 
        echo __('Description');
        ?>
</th><td><?php 
        echo op_truncate($album->getBody(), 36, '', 3);
        ?>
</td>
</tr><tr class="operation">
<th><?php 
        echo __('Created at');
        ?>
</th><td><span class="text"><?php 
        echo op_format_date($album->getCreatedAt(), 'XDateTimeJa');
        ?>
</span> <span class="moreInfo"><?php 
        echo link_to(__('View this album'), 'album_show', $album);
        ?>
</span></td>
</tr></tbody></table></div></div>
<?php