コード例 #1
0
ファイル: HistoryGroup.php プロジェクト: sgrove/cothinker
 public function getLastHistoryEvent()
 {
     $c = new Criteria();
     $c->addDescendingOrderByColumn(HistoryEventPeer::CREATED_AT);
     $c->add(HistoryEventPeer::HISTORY_GROUP_ID, $this->getId());
     $event = HistoryEventPeer::doSelectOne($c);
     return $event;
 }
コード例 #2
0
ファイル: HistoryEventPeer.php プロジェクト: sgrove/cothinker
 public static function retrieveByUuid($value)
 {
     $c = new Criteria();
     $c->add(HistoryEventPeer::UUID, $value);
     return HistoryEventPeer::doSelectOne($c);
 }
コード例 #3
0
ファイル: BasesfGuardUser.php プロジェクト: sgrove/cothinker
 public function getHistoryEventsJoinHistoryGroup($criteria = null, $con = null)
 {
     include_once 'lib/model/om/BaseHistoryEventPeer.php';
     if ($criteria === null) {
         $criteria = new Criteria();
     } elseif ($criteria instanceof Criteria) {
         $criteria = clone $criteria;
     }
     if ($this->collHistoryEvents === null) {
         if ($this->isNew()) {
             $this->collHistoryEvents = array();
         } else {
             $criteria->add(HistoryEventPeer::USER_ID, $this->getId());
             $this->collHistoryEvents = HistoryEventPeer::doSelectJoinHistoryGroup($criteria, $con);
         }
     } else {
         $criteria->add(HistoryEventPeer::USER_ID, $this->getId());
         if (!isset($this->lastHistoryEventCriteria) || !$this->lastHistoryEventCriteria->equals($criteria)) {
             $this->collHistoryEvents = HistoryEventPeer::doSelectJoinHistoryGroup($criteria, $con);
         }
     }
     $this->lastHistoryEventCriteria = $criteria;
     return $this->collHistoryEvents;
 }
コード例 #4
0
ファイル: actions.class.php プロジェクト: sgrove/cothinker
 public function executeShowItem()
 {
     $this->event = HistoryEventPeer::retrieveByUuid($this->getRequestParameter('landing'));
     $this->forward404Unless($this->event, 'news item not found');
 }
コード例 #5
0
ファイル: BaseHistoryEvent.php プロジェクト: sgrove/cothinker
 public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
 {
     $keys = HistoryEventPeer::getFieldNames($keyType);
     if (array_key_exists($keys[0], $arr)) {
         $this->setId($arr[$keys[0]]);
     }
     if (array_key_exists($keys[1], $arr)) {
         $this->setUuid($arr[$keys[1]]);
     }
     if (array_key_exists($keys[2], $arr)) {
         $this->setHistoryGroupId($arr[$keys[2]]);
     }
     if (array_key_exists($keys[3], $arr)) {
         $this->setCategory($arr[$keys[3]]);
     }
     if (array_key_exists($keys[4], $arr)) {
         $this->setTitle($arr[$keys[4]]);
     }
     if (array_key_exists($keys[5], $arr)) {
         $this->setText($arr[$keys[5]]);
     }
     if (array_key_exists($keys[6], $arr)) {
         $this->setUserId($arr[$keys[6]]);
     }
     if (array_key_exists($keys[7], $arr)) {
         $this->setSlug($arr[$keys[7]]);
     }
     if (array_key_exists($keys[8], $arr)) {
         $this->setVersion($arr[$keys[8]]);
     }
     if (array_key_exists($keys[9], $arr)) {
         $this->setDeletedAt($arr[$keys[9]]);
     }
     if (array_key_exists($keys[10], $arr)) {
         $this->setCreatedAt($arr[$keys[10]]);
     }
 }
コード例 #6
0
 public function getDefaultFeed($max = 25)
 {
     $feed = new sfRssFeed();
     $feed->initialize(array('title' => 'Cothink Feed for ' . $this->getFullName(), 'link' => 'http://www.cothink.org/', 'authorEmail' => $this->getPrimaryContactInfo()->getEmail(), 'authorName' => $this->getFullName()));
     $events = HistoryEventPeer::retrieveByUser($this->getUserId(), $max);
     // TODO: Allow user to configure max
     $eventItems = sfFeedPeer::convertObjectsToItems($events, array('routeName' => '@permalink'));
     $feed->addItems($eventItems);
     return $feed;
 }
コード例 #7
0
 public static function retrieveByPKs($pks, $con = null)
 {
     if ($con === null) {
         $con = Propel::getConnection(self::DATABASE_NAME);
     }
     $objs = null;
     if (empty($pks)) {
         $objs = array();
     } else {
         $criteria = new Criteria();
         $criteria->add(HistoryEventPeer::ID, $pks, Criteria::IN);
         $objs = HistoryEventPeer::doSelect($criteria, $con);
     }
     return $objs;
 }