本文整理汇总了PHP中Agent::parseLeadingNameInList方法的典型用法代码示例。如果您正苦于以下问题:PHP Agent::parseLeadingNameInList方法的具体用法?PHP Agent::parseLeadingNameInList怎么用?PHP Agent::parseLeadingNameInList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Agent
的用法示例。
在下文中一共展示了Agent::parseLeadingNameInList方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getDuplicateCollectorNumber
public function getDuplicateCollectorNumber($start)
{
$retArr = array();
$sql = '';
if ($this->obsUid) {
$sql = 'SELECT o.occid, o.eventdate, recordedby, o.recordnumber ' . 'FROM omoccurrences o INNER JOIN ' . '(SELECT eventdate, recordnumber FROM omoccurrences GROUP BY eventdate, recordnumber, collid, observeruid ' . 'HAVING Count(*)>1 AND collid = ' . $this->collid . ' AND observeruid = ' . $this->obsUid . ' AND eventdate IS NOT NULL AND recordnumber IS NOT NULL ' . 'AND recordnumber NOT IN("sn","s.n.","Not Provided","unknown")) intab ' . 'ON o.eventdate = intab.eventdate AND o.recordnumber = intab.recordnumber ' . 'WHERE collid = ' . $this->collid . ' AND observeruid = ' . $this->obsUid . ' ';
} else {
$sql = 'SELECT o.occid, o.eventdate, recordedby, o.recordnumber ' . 'FROM omoccurrences o INNER JOIN ' . '(SELECT eventdate, recordnumber FROM omoccurrences GROUP BY eventdate, recordnumber, collid ' . 'HAVING Count(*)>1 AND collid = ' . $this->collid . ' AND eventdate IS NOT NULL AND recordnumber IS NOT NULL ' . 'AND recordnumber NOT IN("sn","s.n.","Not Provided","unknown")) intab ' . 'ON o.eventdate = intab.eventdate AND o.recordnumber = intab.recordnumber ' . 'WHERE collid = ' . $this->collid . ' ';
}
//echo $sql;
$rs = $this->conn->query($sql);
$collArr = array();
while ($r = $rs->fetch_object()) {
$nameArr = Agent::parseLeadingNameInList($r->recordedby);
if (isset($nameArr['last']) && $nameArr['last'] && strlen($nameArr['last']) > 2) {
$lastName = $nameArr['last'];
$collArr[$r->eventdate][$r->recordnumber][$lastName][] = $r->occid;
}
}
$rs->free();
//Collection duplicate clusters
$occidArr = array();
$cnt = 0;
foreach ($collArr as $ed => $arr1) {
foreach ($arr1 as $rn => $arr2) {
foreach ($arr2 as $ln => $dupArr) {
if (count($dupArr) > 1) {
//Skip records until start is reached
if ($cnt >= $start) {
$sql = 'SELECT ' . $cnt . ' AS dupid, o.occid, o.catalognumber, o.othercatalognumbers, o.othercatalognumbers, o.family, o.sciname, o.recordedby, o.recordnumber, ' . 'o.associatedcollectors, o.eventdate, o.verbatimeventdate, o.country, o.stateprovince, o.county, o.municipality, o.locality, datelastmodified ' . 'FROM omoccurrences o ' . 'WHERE occid IN(' . implode(',', $dupArr) . ') ';
//echo $sql;
$retArr = array_merge($retArr, $this->getDuplicates($sql));
}
if ($cnt > $start + 200) {
break 3;
}
$cnt++;
}
}
}
}
return $retArr;
}
示例2: constructAgentDetType
/** Given a name, construct an agent object of the appropriate type.
*
* @param name the name of the agent to construct.
* @return an agent object or null;
*/
public function constructAgentDetType($name)
{
$result = null;
if (preg_match("/([|;&]| and )/", $name)) {
// agent is a composite of more than one agent
$result = constructNewAgent('Team', '', '', '', $name);
} else {
if (preg_match("/([Ee]xpedition|Exped.|[Cc]onsortium|Bureau of|[Ss]ociety|[Cc]ommission)/", $name)) {
$result = constructNewAgent('Organization', '', '', '', $name);
} else {
$namebits = Agent::parseLeadingNameInList($name);
$result = constructNewAgent('Individual', $namebits['first'], $namebits['middle'], $namebits['last'], '');
$result->setnotes($name);
}
}
return $result;
}