本文整理汇总了PHP中BizSystem::log方法的典型用法代码示例。如果您正苦于以下问题:PHP BizSystem::log方法的具体用法?PHP BizSystem::log怎么用?PHP BizSystem::log使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BizSystem
的用法示例。
在下文中一共展示了BizSystem::log方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: siremisFillDB
function siremisFillDB()
{
siremisReplaceDbConfig();
BizSystem::log(LOG_DEBUG, "SIREMIS", "install module siremis sql - " . $_REQUEST['db1type']);
if ($_REQUEST['db1type'] == "Pdo_Pgsql" || $_REQUEST['db1type'] == "pdo_pgsql") {
$sqlfile = MODULE_PATH . "/ser/mod.install.siremis.pgsql.sql";
} else {
$sqlfile = MODULE_PATH . "/ser/mod.install.siremis.sql";
}
if (!file_exists($sqlfile)) {
return true;
}
// Getting the SQL file content
$query = trim(file_get_contents($sqlfile));
if (empty($query)) {
return true;
}
// $db = BizSystem::dbConnection("Serdb");
$db = siremisConnectDB();
include_once MODULE_PATH . "/system/lib/MySQLDumpParser.php";
$queryArr = MySQLDumpParser::parse($query);
foreach ($queryArr as $query) {
try {
$db->exec($query);
} catch (Exception $e) {
BizSystem::log(LOG_DEBUG, "SIREMIS", $e->getMessage());
echo 'ERROR: ' . $e->getMessage();
exit;
}
}
return true;
}
示例2: giveActionAccess
function giveActionAccess($where, $role_id)
{
$db = BizSystem::dbConnection();
try {
if (empty($where)) {
$sql = "SELECT * FROM acl_action";
} else {
$sql = "SELECT * FROM acl_action WHERE {$where}";
}
BizSystem::log(LOG_DEBUG, "DATAOBJ", $sql);
$rs = $db->fetchAll($sql);
$sql = "";
foreach ($rs as $r) {
$sql = "DELETE FROM acl_role_action WHERE role_id={$role_id} AND action_id={$r['0']}; ";
BizSystem::log(LOG_DEBUG, "DATAOBJ", $sql);
$db->query($sql);
$sql = "INSERT INTO acl_role_action (role_id, action_id, access_level) VALUES ({$role_id},{$r['0']},1)";
BizSystem::log(LOG_DEBUG, "DATAOBJ", $sql);
$db->query($sql);
}
} catch (Exception $e) {
echo "ERROR: " . $e->getMessage() . "" . PHP_EOL;
return false;
}
}
示例3: Log
public function Log($eventName, $eventMessage, $eventComment = array())
{
global $g_BizSystem;
$logDataObj = BizSystem::getObject($this->m_logDataObj);
if (!$logDataObj) {
return false;
}
$profile = $g_BizSystem->getUserProfile();
$recArr['user_id'] = $profile["Id"];
$recArr['ipaddr'] = $_SERVER['REMOTE_ADDR'];
$recArr['event'] = $eventName;
$recArr['message'] = $eventMessage;
$recArr['comment'] = serialize($eventComment);
$recArr['timestamp'] = date("Y-m-d H:i:s");
$ok = $logDataObj->insertRecord($recArr);
if ($ok == false) {
BizSystem::log(LOG_ERR, "EVENTLOG", $logDataObj->getErrorMessage());
return false;
}
}
示例4: runSearch
public function runSearch()
{
//include_once(OPENBIZ_BIN . "/easy/SearchHelper.php");
$searchRule = "";
foreach ($this->m_SearchPanel as $element) {
$searchStr = '';
if (method_exists($element, "getSearchRule")) {
$searchStr = $element->getSearchRule();
} else {
if (!$element->m_FieldName) {
continue;
}
$value = BizSystem::clientProxy()->getFormInputs($element->m_Name);
if ($element->m_FuzzySearch == "Y") {
$value = "*{$value}*";
}
if ($value != '') {
$searchStr = inputValToRule($element->m_FieldName, $value, $this);
$values[] = $value;
}
}
if ($searchStr) {
if ($searchRule == "") {
$searchRule .= $searchStr;
} else {
$searchRule .= " AND " . $searchStr;
}
}
}
$this->m_SearchRule = $searchRule;
$this->m_SearchRuleBindValues = $values;
$this->m_RefreshData = true;
$this->m_CurrentPage = 1;
BizSystem::log(LOG_DEBUG, "FORMOBJ", $this->m_Name . "::runSearch(), SearchRule=" . $this->m_SearchRule);
$recArr = $this->readInputRecord();
$this->m_SearchPanelValues = $recArr;
$this->runEventLog();
$this->rerender();
}
示例5: render
public function render()
{
if (!$this->allowAccess()) {
return "";
}
if ($this->m_CacheLifeTime > 0) {
$cache_id = md5($this->m_Name);
//try to process cache service.
$cacheSvc = BizSystem::getService(CACHE_SERVICE, 1);
$cacheSvc->init($this->m_Name, $this->m_CacheLifeTime);
if ($cacheSvc->test($cache_id)) {
BizSystem::log(LOG_DEBUG, "MENU", "Cache Hit. menu widget name = " . $this->m_Name);
$output = $cacheSvc->load($cache_id);
} else {
BizSystem::log(LOG_DEBUG, "MENU", "Set cache. menu widget = " . $this->m_Name);
$output = $this->renderHTML();
$cacheSvc->save($output, $cache_id);
}
return $output;
}
$renderedHTML = $this->renderHTML();
return $renderedHTML;
}
示例6: render
/**
* Render this form (return html content),
* called by EasyView's render method (called when form is loaded).
* Query is issued before returning the html content.
*
* @return string - HTML text of this form's read mode
* @example ../../../example/FormObject.php
*/
public function render()
{
if (!$this->allowAccess()) {
return "";
}
if ($this->m_CacheLifeTime > 0 && $this->m_SubForms == null) {
$cache_id = md5($this->m_Name);
//try to process cache service.
$cacheSvc = BizSystem::getService(CACHE_SERVICE, 1);
$cacheSvc->init($this->m_Name, $this->m_CacheLifeTime);
if ($cacheSvc->test($cache_id)) {
BizSystem::log(LOG_DEBUG, "FORM", "Cache Hit. form name = " . $this->m_Name);
$output = $cacheSvc->load($cache_id);
} else {
BizSystem::log(LOG_DEBUG, "FORM", "Set cache. form name = " . $this->m_Name);
$output = $this->renderHTML();
$cacheSvc->save($output, $cache_id);
}
return $output;
}
//Moved the renderHTML function infront of declaring subforms
$renderedHTML = $this->renderHTML();
// prepare the subforms' dataobjs, since the subform relates to parent form by dataobj association
/*
if ($this->m_SubForms && $this->getDataObj())
{
foreach ($this->m_SubForms as $subForm)
{
$formObj = BizSystem::objectFactory()->getObject($subForm);
$dataObj = $this->getDataObj()->getRefObject($formObj->m_DataObjName);
if ($dataObj)
$formObj->setDataObj($dataObj);
}
}
*/
if (!$this->allowAccess()) {
return "";
}
return $renderedHTML;
}
示例7: UpdateloginTime
/**
* Update login time
*
* @return void
*/
protected function UpdateloginTime()
{
$userObj = BizSystem::getObject('system.do.UserDO');
try {
$curRecs = $userObj->directFetch("[username]='" . $this->username . "'", 1);
$dataRec = new DataRecord($curRecs[0], $userObj);
$dataRec['lastlogin'] = date("Y-m-d H:i:s");
$ok = $dataRec->save();
if (!$ok) {
$errorMsg = $userObj->getErrorMessage();
BizSystem::log(LOG_ERR, "DATAOBJ", "DataObj error = " . $errorMsg);
BizSystem::ClientProxy()->showErrorMessage($errorMsg);
return false;
}
} catch (BDOException $e) {
$errorMsg = $e->getMessage();
BizSystem::log(LOG_ERR, "DATAOBJ", "DataObj error = " . $errorMsg);
BizSystem::ClientProxy()->showErrorMessage($errorMsg);
return false;
}
return true;
}
示例8: getSQLFromList
public function getSQLFromList()
{
$sql = $this->getSelectFromSQL();
if (!$sql) {
return;
}
$formObj = $this->getFormObj();
$do = $formObj->getDataObj();
$db = $do->getDBConnection();
try {
$resultSet = $db->query($sql);
$recList = $resultSet->fetchAll();
foreach ($recList as $rec) {
$list[$i]['val'] = $rec[0];
$list[$i]['txt'] = isset($rec[1]) ? $rec[1] : $rec[0];
$i++;
}
} catch (Exception $e) {
BizSystem::log(LOG_ERR, "DATAOBJ", "Query Error: " . $e->getMessage());
$this->m_ErrorMessage = "Error in SQL query: " . $sql . ". " . $e->getMessage();
throw new BDOException($this->m_ErrorMessage);
return null;
}
return $list;
}
示例9: _getNumberRecords
/**
* Get the number of records according the Select SQL
*
* @param object $db database connection
* @param string $sql SQL string
* @return int number of records
*/
private function _getNumberRecords($db, $sql)
{
$has_subquery = false;
if (preg_match("/\\(\\s*?SELECT\\s*?.+\\)/si", $sql)) {
$has_subquery = true;
}
if (preg_match("/^\\s*SELECT\\s+DISTINCT/is", $sql) || preg_match('/\\s+GROUP\\s+BY\\s+/is', $sql)) {
// ok, has SELECT DISTINCT or GROUP BY so see if we can use a table alias
$rewritesql = preg_replace('/(\\sORDER\\s+BY\\s.*)/is', '', $sql);
$rewritesql = "SELECT COUNT(*) FROM ({$rewritesql}) _TABLE_ALIAS_";
} elseif ($has_subquery == false) {
// now replace SELECT ... FROM with SELECT COUNT(*) FROM
$rewritesql = preg_replace('/\\s*?SELECT\\s.*?\\s+FROM\\s/is', 'SELECT COUNT(*) FROM ', $sql);
// Because count(*) and 'order by' fails with mssql, access and postgresql.
// Also a good speedup optimization - skips sorting!
$rewritesql = preg_replace('/(\\sORDER\\s+BY\\s.*)/is', '', $rewritesql);
} else {
$rewritesql = $sql;
}
try {
if ($this->m_CacheLifeTime > 0) {
$cache_id = md5($this->m_Name . $rewritesql . serialize($bindValues));
//try to process cache service.
$cacheSvc = BizSystem::getService(CACHE_SERVICE);
$cacheSvc->init($this->m_Name, $this->m_CacheLifeTime);
if ($cacheSvc->test($cache_id)) {
//BizSystem::log(LOG_DEBUG, "DATAOBJ", ". Query Sql = ".$rewritesql);
$resultArray = $cacheSvc->load($cache_id);
} else {
BizSystem::log(LOG_DEBUG, "DATAOBJ", "Query Sql = " . $rewritesql);
$result = $db->query($rewritesql);
$resultArray = $result->fetch();
$cacheSvc->save($resultArray, $cache_id);
}
} else {
BizSystem::log(LOG_DEBUG, "DATAOBJ", "Query Sql = " . $rewritesql);
$resultSet = $db->query($rewritesql);
$resultArray = $resultSet->fetch();
}
} catch (Exception $e) {
BizSystem::log(LOG_ERR, "DATAOBJ", "Query Error: " . $e->getMessage());
$this->m_ErrorMessage = $this->getMessage("DATA_ERROR_QUERY") . ": Rewrite:" . $rewritesql . ". Raw:" . $sql . ". " . $e->getMessage();
throw new BDOException($this->m_ErrorMessage);
return 0;
}
if ($has_subquery) {
$record_count = (int) $resultSet->rowCount();
} else {
$record_count = (int) $resultArray[0];
}
return (string) $record_count;
}
示例10: _getIdWithSql
/**
* Get ID with SQL
*
* @param Zend_Db_Adapter_Abstract $conn
* @param string $sql
* @return mixed
*/
private function _getIdWithSql($conn, $sql)
{
try {
$rs = $conn->query($sql);
BizSystem::log(LOG_DEBUG, "DATAOBJ", "Get New Id: {$sql}");
} catch (Exception $e) {
$this->m_ErrorMessage = "Error in query: " . $sql . ". " . $e->getMessage();
return false;
}
if (($row = $rs->fetch()) != null) {
//print_r($row);
return $row[0];
}
return false;
}
示例11: processBDOException
/**
* Handle the exception from DataObj method,
* report the error as an alert window
*
* @param int $errCode
* @return string
*/
public function processBDOException($e)
{
$errorMsg = $e->getMessage();
BizSystem::log(LOG_ERR, "DATAOBJ", "DataObj error = " . $errorMsg);
//BizSystem::clientProxy()->showClientAlert($errorMsg); //showErrorMessage($errorMsg);
//BizSystem::clientProxy()->showErrorMessage($errorMsg);
$e->no_exit = true;
OB_ErrorHandler::ExceptionHandler($e);
}
示例12: saveSessionObjects
/**
* Save session variables of all stateful objects into sessionid_obj file
*
* @return void
**/
public function saveSessionObjects()
{
// loop all objects (bizview, bizform, bizdataobj) collect their session vars
$allobjs = BizSystem::objectFactory()->getAllObjects();
foreach ($allobjs as $obj) {
if (method_exists($obj, "SetSessionVars")) {
//after calling $obj->setSessionVars SessObjArr and StatefulSessObjArr are filled
$obj->setSessionVars($this);
}
// if previous view's object is used in current view, don't discard its session data
if (isset($obj->m_Name) && key_exists($obj->m_Name, $this->_prevViewObjNames)) {
unset($this->_prevViewObjNames[$obj->m_Name]);
BizSystem::log(LOG_ERR, "SESSION", "unset " . $obj->m_Name);
}
}
// discard useless previous view's session objects
//foreach($this->_prevViewObjNames as $objName=>$tmp)
// unset($this->_sessObjArr[$objName]);
$this->_sessObjArr["ViewHist"] = $this->_viewHistory;
$this->setVar(OB_TRANSIENT_DATA_SESSION_INDEX, $this->_sessObjArr);
$this->setVar(OB_STATEFUL_DATA_SESSION_INDEX, $this->_statefulSessObjArr);
}
示例13: _removeRecordSelftoSelf
private static function _removeRecordSelftoSelf($dataObj, $recArr)
{
// delete a record on XTable
$db = $dataObj->getDBConnection();
//TODO: delete using XDataObj if XDataObj is defined
$where = $dataObj->m_Association["XColumn1"] . "='" . $dataObj->m_Association["FieldRefVal"] . "'";
$where .= " AND " . $dataObj->m_Association["XColumn2"] . "='" . $recArr["Id"] . "'";
$sql = "DELETE FROM " . $dataObj->m_Association["XTable"] . " WHERE " . $where;
$where_2 = $dataObj->m_Association["XColumn2"] . "='" . $dataObj->m_Association["FieldRefVal"] . "'";
$where_2 .= " AND " . $dataObj->m_Association["XColumn1"] . "='" . $recArr["Id"] . "'";
$sql_2 = "DELETE FROM " . $dataObj->m_Association["XTable"] . " WHERE " . $where_2;
try {
BizSystem::log(LOG_DEBUG, "DATAOBJ", "Associate Delete Sql = {$sql}");
$db->query($sql);
$db->query($sql_2);
} catch (Exception $e) {
BizSystem::log(LOG_ERR, "DATAOBJ", "Query Error: " . $e->getMessage());
throw new BDOException("Query Error: " . $e->getMessage());
return false;
}
return true;
}
示例14: logEmail
/**
* Log that an email attemp was made.
* We assume it was successfull, since Zend_Mail throws an exception otherwise
*
* @param string $subject
* @param array $To
* @param array $CCs
* @param array $BCCs
* @return mixed boolean|string|void
*/
public function logEmail($result, $subject, $body = NULL, $TOs = NULL, $CCs = NULL, $BCCs = NULL)
{
//Log the email attempt
$recipients = '';
// add TO addresses
if ($TOs) {
foreach ($TOs as $to) {
if (is_array($to)) {
$recipients .= $to['name'] . "<" . $to['email'] . ">;";
} else {
$recipients .= $to . ";";
}
}
}
// add CC addresses
if ($CCs) {
foreach ($CCs as $cc) {
if (is_array($cc)) {
$recipients .= $cc['name'] . "<" . $cc['email'] . ">;";
} else {
$recipients .= $cc . ";";
}
}
}
// add BCC addresses
if ($BCCs) {
foreach ($BCCs as $bcc) {
if (is_array($bcc)) {
$recipients .= $bcc['name'] . "<" . $bcc['email'] . ">;";
} else {
$recipients .= $bcc . ";";
}
}
}
if ($this->_logType == 'DB') {
$account = $this->m_Accounts->get($this->m_UseAccount);
$sender_name = $account->m_FromName;
$sender = $account->m_FromEmail;
// Store the message log
$boMessageLog = BizSystem::getObject($this->_logObject);
$mlArr = $boMessageLog->newRecord();
$mlArr["sender"] = $sender;
$mlArr["sender_name"] = $sender_name;
$mlArr["recipients"] = $recipients;
$mlArr["subject"] = $subject;
$mlArr["content"] = $body;
$mlArr["result"] = $result;
//Escape Data since this may contain quotes or other goodies
foreach ($mlArr as $key => $value) {
$mlArr[$key] = addslashes($value);
}
$ok = $boMessageLog->insertRecord($mlArr);
if (!$ok) {
return $boMessageLog->getErrorMessage();
} else {
return TRUE;
}
} else {
$back_trace = debug_backtrace();
if ($result == 'Success') {
$logNum = LOG_INFO;
} else {
$logNum = LOG_ERR;
}
BizSystem::log($logNum, "EmailService", "Sent email with subject - \"{$subject}\" and body - {$body} to - {$recipients} with result {$result}.", NULL, $back_trace);
}
}
示例15: _render
/**
* Render this view. This function is called by Render() or ReRender()
*
* @return mixed either print html content or return html content if called by Render(), or void if called by ReRender()
*/
protected function _render()
{
$this->setClientScripts();
if ($this->m_CacheLifeTime > 0) {
$pageUrl = $this->curPageURL();
$cache_id = md5($pageUrl);
//try to process cache service.
$cacheSvc = BizSystem::getService(CACHE_SERVICE, 1);
$cacheSvc->init($this->m_Name, $this->m_CacheLifeTime);
if ($cacheSvc->test($cache_id)) {
BizSystem::log(LOG_DEBUG, "VIEW", "Cache Hit. url = " . $pageUrl);
$output = $cacheSvc->load($cache_id);
} else {
include_once OPENBIZ_BIN . "/easy/ViewRenderer.php";
$this->m_ConsoleOutput = false;
$output = ViewRenderer::render($this);
BizSystem::log(LOG_DEBUG, "VIEW", "Set cache. url = " . $pageUrl);
$cacheSvc->save($output, $cache_id);
}
print $output;
} else {
include_once OPENBIZ_BIN . "/easy/ViewRenderer.php";
ViewRenderer::render($this);
}
return;
/*
$this->setClientScripts();
include_once(OPENBIZ_BIN."/easy/ViewRenderer.php");
return ViewRenderer::render($this);*/
}