public function createEntryByInstance(Doctrine_Record $comment, SimpleXMLElement $entry = null)
 {
     $entry = parent::createEntryByInstance($comment, $entry);
     sfContext::getInstance()->getConfiguration()->loadHelpers(array('Url', 'opUtil'));
     $entry->setContent($comment->getBody());
     $entry->setAuthorByMember($comment->getMember());
     $entry->setLink(url_for('@feeds_community_topic_comment_retrieve_resource_normal?model=communityTopic&id=' . $comment->getId()), 'self', 'application/atom+xml');
     return $entry;
 }
Exemplo n.º 2
0
 public function createEntryByInstance(Doctrine_Record $diary, SimpleXMLElement $entry = null)
 {
     $entry = parent::createEntryByInstance($diary, $entry);
     sfContext::getInstance()->getConfiguration()->loadHelpers(array('Url', 'opUtil'));
     $entry->setTitle($diary->getTitle());
     $entry->setContent($diary->getBody());
     $entry->setAuthorByMember($diary->getMember());
     $entry->setLink(app_url_for('pc_frontend', '@diary_show?id=' . $diary->getId(), true), 'self', 'alternate');
     $entry->setLink(app_url_for('mobile_frontend', '@diary_show?id=' . $diary->getId(), true), 'self', 'alternate');
     return $entry;
 }
 public function createEntryByInstance(Doctrine_Record $communityMember, SimpleXMLElement $entry = null)
 {
     $member = $communityMember->getMember();
     $entry = parent::createEntryByInstance($communityMember, $entry);
     sfContext::getInstance()->getConfiguration()->loadHelpers(array('Url', 'opUtil'));
     $entry->setTitle($member->getName());
     $content = $entry->getElements()->addChild('content');
     $content->addAttribute('type', 'xhtml');
     $profiles = $content->addChild('div');
     $profiles->addAttribute('xmlns', 'http://www.w3.org/1999/xhtml');
     foreach ($member->getProfiles() as $profile) {
         $value = (string) $profile;
         $child = $profiles->addChild('div', $value);
         $child->addAttribute('id', $profile->getName());
     }
     $entry->setLink(url_for('@feeds_member_retrieve_resource_normal?model=community&id=' . $member->getId()), 'self', 'application/atom+xml');
     $entry->setLink(app_url_for('pc_frontend', 'member/profile?id=' . $member->getId(), true), 'alternate', 'text/html');
     $entry->setLink(app_url_for('mobile_frontend', 'member/profile?id=' . $member->getId(), true), 'alternate');
     return $entry;
 }
Exemplo n.º 4
0
 public function createEntryByInstance(Doctrine_Record $member, SimpleXMLElement $entry = null)
 {
     $entry = parent::createEntryByInstance($member, $entry);
     sfContext::getInstance()->getConfiguration()->loadHelpers(array('Url', 'opUtil', 'sfImage', 'Asset', 'Tag'));
     $entry->setTitle($member->getName());
     if (!$this->member || $member->id === $this->member->id) {
         $entry->setAuthor(null, null, $member->getEmailAddress());
     }
     $content = $entry->getElements()->addChild('content');
     $content->addAttribute('type', 'xhtml');
     $profiles = $content->addChild('div');
     $profiles->addAttribute('xmlns', 'http://www.w3.org/1999/xhtml');
     $ids = array();
     foreach ($member->getProfiles() as $profile) {
         if (in_array($profile->getName(), $ids)) {
             continue;
         }
         if ($this->member && !$profile->isAllowed($this->member, 'view')) {
             continue;
         }
         $ids[] = $profile->getName();
         if ($profile->getProfile()->isPreset()) {
             $i18n = sfContext::getInstance()->getI18N();
             $child = $profiles->addChild('div');
             $entry->addValidStringToNode($child, $i18n->__((string) $profile));
         } else {
             $child = $profiles->addChild('div');
             $entry->addValidStringToNode($child, $profile);
         }
         $child->addAttribute('id', $profile->getName());
     }
     $entry->setLink(url_for('@feeds_member_retrieve_resource_normal?model=member&id=' . $member->getId()), 'self', 'application/atom+xml');
     $entry->setLink(app_url_for('pc_frontend', 'member/profile?id=' . $member->getId(), true), 'alternate', 'text/html');
     $entry->setLink(app_url_for('mobile_frontend', 'member/profile?id=' . $member->getId(), true), 'alternate');
     $image = $member->getImage();
     if ($image) {
         $entry->setLink(sf_image_path($member->getImageFileName(), array(), true), 'enclosure', $member->getImage()->getFile()->getType());
     }
     return $entry;
 }
 public function createEntryByInstance(Doctrine_Record $topic, SimpleXMLElement $entry = null)
 {
     $entry = parent::createEntryByInstance($topic, $entry);
     sfContext::getInstance()->getConfiguration()->loadHelpers(array('Url', 'opUtil'));
     $entry->setTitle($topic->getName());
     $entry->setContent($topic->getBody());
     $entry->setAuthorByMember($topic->getMember());
     $entry->setLink(url_for('@feeds_community_topic_retrieve_resource_normal?model=communityTopic&id=' . $topic->getId()), 'self', 'application/atom+xml');
     $entry->setLink(app_url_for('pc_frontend', 'communityTopic/detail?id=' . $topic->getId(), true), 'alternate', 'text/html');
     $entry->setLink(app_url_for('mobile_frontend', 'communityTopic/detail?id=' . $topic->getId(), true), 'alternate');
     return $entry;
 }
 public function setOrderBy()
 {
     $this->query->select('Community.*, COUNT(Community.CommunityMember.id) AS num_member')->groupBy('Community.CommunityMember.community_id');
     return parent::setOrderBy();
 }