public static function add(GatheringDataSourceConfiguration $configuration, $post) { $gathering = $configuration->getGatheringObject(); try { // we wrap this in a try because it MIGHT fail if it's a duplicate $item = parent::create($gathering, $configuration->getGatheringDataSourceObject(), $post->get_date('Y-m-d H:i:s'), $post->get_title(), $post->get_link()); } catch (Exception $e) { } if (is_object($item)) { $item->assignFeatureAssignments($post); $item->setAutomaticGatheringItemTemplate(); return $item; } }
public static function add(GatheringDataSourceConfiguration $configuration, Page $c) { $gathering = $configuration->getGatheringObject(); try { // we wrap this in a try because it MIGHT fail if it's a duplicate $item = parent::add($gathering, $configuration->getGatheringDataSourceObject(), $c->getCollectionDatePublic(), $c->getCollectionName(), $c->getCollectionID()); } catch (Exception $e) { } if (is_object($item)) { $db = Loader::db(); $db->Execute('insert into gaPage (gaiID, cID) values (?, ?)', array($item->getGatheringItemID(), $c->getCollectionID())); $item->assignFeatureAssignments($c); $item->setAutomaticGatheringItemTemplate(); return $item; } }
public static function add(GatheringDataSourceConfiguration $configuration, $tweet) { $gathering = $configuration->getGatheringObject(); try { // we wrap this in a try because it MIGHT fail if it's a duplicate $item = parent::create($gathering, $configuration->getGatheringDataSourceObject(), date('Y-m-d H:i:s', strtotime($tweet->created_at)), $tweet->text, $tweet->id); } catch (Exception $e) { } if (is_object($item)) { $item->assignFeatureAssignments($tweet); if (count($tweet->entities->media) > 0 && $tweet->entities->media[0]->type == 'photo') { $item->setAutomaticGatheringItemTemplate(); } else { $type = GatheringItemTemplateType::getByHandle('tile'); $template = GatheringItemTemplate::getByHandle('tweet'); $item->setGatheringItemTemplate($type, $template); } return $item; } }
public function getConfiguredGatheringDataSources() { $db = Loader::db(); $r = $db->Execute('select gcsID from GatheringConfiguredDataSources where gaID = ?', array($this->gaID)); $list = array(); while ($row = $r->FetchRow()) { $source = GatheringDataSourceConfiguration::getByID($row['gcsID']); if (is_object($source)) { $list[] = $source; } } return $list; }