public static function getByID($gcsID) { $db = Loader::db(); $row = $db->GetRow('select gcsID, gasID, gaID, gcdObject from GatheringConfiguredDataSources where gcsID = ?', array($gcsID)); if (isset($row['gcsID'])) { $source = GatheringDataSource::getByID($row['gasID']); $o = @unserialize($row['gcdObject']); if (is_object($o)) { unset($row['gcdObject']); $o->setPropertiesFromArray($row); $o->dataSource = GatheringDataSource::getByID($row['gasID']); return $o; } } }
public static function getListByItem($mixed) { $ags = GatheringDataSource::getByHandle('twitter'); return GatheringItem::getListByKey($ags, $mixed->get_link()); }
public function save($args) { $db = Database::connection(); $agID = $db->GetOne('select gaID from btCoreGathering where bID = ?', array($this->bID)); if (!$agID) { $ag = Gathering::add(); $task = 'add'; } else { $ag = Gathering::getByID($agID); $task = 'edit'; } $tab = $args['tab']; if (!is_array($tab)) { $tab = array(); } if ($task == 'add' || in_array('sources', $tab)) { $ag->clearConfiguredGatheringDataSources(); $sources = $this->post('gasID'); foreach ($sources as $key => $gasID) { $key = (string) $key; // because PHP is stupid if ($key != '_gas_') { $ags = GatheringDataSource::getByID($gasID); $ags->setOptionFormKey($key); $post = $ags->getOptionFormRequestData(); $agc = $ags->configure($ag, $post); } } $ag->generateGatheringItems(); } $itemsPerPage = intval($args['itemsPerPage']); $values = array('gaID' => $ag->getGatheringID()); if (in_array('output', $tab)) { $values['itemsPerPage'] = $itemsPerPage; } else { $values['itemsPerPage'] = $this->itemsPerPage; } if (in_array('posting', $tab)) { $ptID = 0; if ($args['enablePostingFromGathering']) { $values['enablePostingFromGathering'] = 1; if ($args['ptID']) { $ptID = $args['ptID']; } } else { $values['enablePostingFromGathering'] = 0; } $values['ptID'] = $ptID; } else { $values['ptID'] = $this->ptID; $values['enablePostingFromGathering'] = $this->enablePostingFromGathering; } parent::save($values); }