public function searchAction() { $archiveid = $this->_getParam("archive"); $search = $this->_getParam("search"); $limit = $this->_getParam("limit"); if (is_numeric($limit) === false || $limit < 1) { $limit = 100; } header('Content-type: text/xml'); echo "<records>"; $res = harvest::search($archiveid, $search, $limit); foreach ($res as $r) { echo $r; } echo "</records>"; }
function add(fs_record $record) { switch (get_class($record)) { case 'fs_client': $data = harvest::get_client_xml($record); $path = 'clients'; $result = $this->post($path, $data); if ($result['status']['code'] != 201) { return false; } $ret = new fs_client($this); $ret->fields = $record->fields; $ret->id = preg_replace('`^[^\\d]+`', '', $result['headers']['Location']); return $ret; case 'fs_contact': list(, $parent) = func_get_args(); $path = 'contacts'; $data = harvest::get_contact_xml($record); $data->addChild('client-id', $parent); $data->{'client-id'}->addAttribute('type', 'integer'); $result = $this->post($path, $data); if (!$result) { return false; } if ($result['status']['code'] != 201) { return false; } $ret = new fs_contact($this); $ret->fields = $record->fields; $ret->id = preg_replace('`^[^\\d]+`', '', $result['headers']['Location']); return $ret; } }
} unset($archive); } } else { if ($this->firstParam == '' || $this->firstParam === 'help' || $this->firstParam === 'usage') { $this->usage(); return true; } // No archive was specified or the specified ID was invalid. // Display a list of archives. $archiveDao =& DAORegistry::getDAO('ArchiveDAO'); $recordDao =& DAORegistry::getDAO('RecordDAO'); $archives =& $archiveDao->getArchives(); echo "Archive List\n"; echo "------------\n"; while ($archive =& $archives->next()) { $recordCount = $recordDao->getRecordCount($archive->getArchiveId()); echo $archive->getArchiveId() . ': ' . $archive->getTitle() . " ({$recordCount} records)\n"; unset($archive); } return false; } return !$hadErrors; } function statusCallback($message) { echo "{$message}\n"; } } $tool = new harvest(isset($argv) ? $argv : array()); $tool->execute();
<?php // +-------------------------------------------------+ // © 2002-2004 PMB Services / www.sigb.net pmb@sigb.net et contributeurs (voir www.sigb.net) // +-------------------------------------------------+ // $Id: ajax_main.inc.php,v 1.1 2012-01-25 15:20:35 ngantier Exp $ if (stristr($_SERVER['REQUEST_URI'], ".inc.php")) { die("no access"); } require_once $class_path . "/harvest.class.php"; switch ($sub) { case 'add_field': $harvest = new harvest($id); ajax_http_send_response($harvest->add_field($id_field, $nb)); break; default: break; }
public static function filterRelations($relations, $entityguid, $reverse = false) { $res = array(); foreach ($relations as $rel) { if (isset($rel["parentid"]) === false) { $rel["parentid"] = null; } if ($reverse === false && isset($rel["targetguid"]) && trim($rel["targetguid"]) !== "" && trim($rel["targetguid"]) !== trim($entityguid)) { if (is_numeric($rel["targetguid"])) { $rel["entitytype"] = harvest::getRecordType($rel["targetguid"]); } else { $rel["entitytype"] = EntityTypes::getTypeByGuid($rel["targetguid"]); } $res[] = $rel; } else { if ($reverse === true && isset($rel["subjectguid"]) && trim($rel["subjectguid"]) !== "" && trim($rel["subjectguid"]) !== trim($entityguid)) { if (is_numeric($rel["subjectguid"])) { $rel["entitytype"] = harvest::getRecordType($rel["subjectguid"]); } else { $rel["entitytype"] = EntityTypes::getTypeByGuid($rel["subjectguid"]); } $res[] = $rel; } } } return $res; }
if (stristr($_SERVER['REQUEST_URI'], ".inc.php")) { die("no access"); } require_once $class_path . "/harvest.class.php"; switch ($action) { case 'form': $harvest = new harvest($id_harvest); print $harvest->get_form(); break; case 'save': $harvest = new harvest($id_harvest); $data['name'] = $name; print $harvest->save($data); $harvests = new harvests(); print $harvests->get_list(); break; case 'delete': $harvest = new harvest($id_harvest); print $harvest->delete(); $harvests = new harvests(); print $harvests->get_list(); break; case 'test': $harvest = new harvest($id_harvest); print $harvest->havest_notice(); break; default: $harvests = new harvests(); print $harvests->get_list(); break; }