本文整理匯總了PHP中LogActions::query方法的典型用法代碼示例。如果您正苦於以下問題:PHP LogActions::query方法的具體用法?PHP LogActions::query怎麽用?PHP LogActions::query使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類LogActions
的用法示例。
在下文中一共展示了LogActions::query方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: GetLog
static function GetLog($object = null, $limitbyclass = true)
{
$log = new LogActions();
if (!is_null($object)) {
$log->Class = get_class($object);
// Attempt to autofind the id of the object we've been handed
foreach ($object as $prop => $value) {
if (preg_match("/id/i", $prop)) {
$log->ObjectID = $value;
break;
}
}
}
function sql($sql, $prop, $var)
{
$sql = $sql . ($sql == '' ? " WHERE" : " AND") . " {$prop}=\"{$var}\"";
return $sql;
}
// build out the query using all available data
$sql = "SELECT * FROM fac_GenericLog";
$add = '';
$add = $limitbyclass && $log->Class != '' ? sql($add, 'Class', $log->Class) : $add;
$add = $log->ObjectID != '' ? sql($add, 'ObjectID', $log->ObjectID) : $add;
$sql .= $add . ' ORDER BY Time ASC;';
$events = array();
foreach ($log->query($sql) as $dbRow) {
$events[] = LogActions::RowToObject($dbRow);
}
return $events;
}