本文整理汇总了PHP中Globals::getLog方法的典型用法代码示例。如果您正苦于以下问题:PHP Globals::getLog方法的具体用法?PHP Globals::getLog怎么用?PHP Globals::getLog使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Globals
的用法示例。
在下文中一共展示了Globals::getLog方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct($id)
{
$this->_db = Globals::getDBConn();
$select = $this->_db->select()->from('session')->where('id = ' . $id);
$row = $select->query()->fetch();
if (empty($row)) {
Globals::getLog()->err('NONEXISTENT SESSION - SessionModel id: ' . $id);
throw new Exception('Session object not found in database with id ' . $id);
}
foreach ($row as $key => $value) {
$this->_metadata[$key] = $value;
}
}
示例2: __construct
public function __construct($initId)
{
$this->_db = Globals::getDBConn();
$this->_initId = $initId;
$select = $this->_db->select()->from('initiative', array('id', 'title', 'fk_root_location as rootLocation', 'description'))->where('id = ' . $this->_initId);
$metadata = $select->query()->fetch();
if (!empty($metadata)) {
$this->_initMetadata = $metadata;
} else {
throw new Exception('Initiative does not exist');
Globals::getLog()->err('NONEXISTENT INITIATIVE - id: ' . $initId);
}
}
示例3: loadAction
public function loadAction()
{
$id = Zend_Filter::filterStatic($this->getRequest()->getParam('initiative'), 'StripTags');
if (is_numeric($id)) {
$init = new InitiativeModel($id);
$json = $init->getJSON();
if (empty($json)) {
$this->view->error = 'Could not find requested Initiative';
$this->render('error');
}
$this->view->json = $json;
} else {
Globals::getLog()->err('INVALID INITIATIVE ID - ClientInitController id: ' . $id);
$this->view->error = 'Initiative ID must be numeric';
$this->render('error');
}
}
示例4: processAction
//.........这里部分代码省略.........
$sTime = Zend_Filter::filterStatic($this->getRequest()->getParam('stime'), 'StripTags');
$eTime = Zend_Filter::filterStatic($this->getRequest()->getParam('etime'), 'StripTags');
$sum = Zend_Filter::filterStatic($this->getRequest()->getParam('sum'), 'StripTags');
$format = Zend_Filter::filterStatic($this->getRequest()->getParam('format'), 'StripTags');
$offset = Zend_Filter::filterStatic($this->getRequest()->getParam('offset'), 'StripTags');
$limit = Zend_Filter::filterStatic($this->getRequest()->getParam('limit'), 'StripTags');
$params = array();
if (isset($initId) && ctype_digit($initId)) {
if (empty($format) || !in_array($format, $this->_formats)) {
$format = 'cal';
}
$params['format'] = $format;
$params['offset'] = !empty($offset) && ctype_digit($offset) ? (int) $offset : 0;
$params['limit'] = !empty($limit) && ctype_digit($limit) ? (int) $limit : Globals::getQsDbLimit();
if (!empty($sDate)) {
$sDate = explode("T", strtoupper($sDate));
$yr = substr($sDate[0], 0, 4);
$month = substr($sDate[0], 4, 2);
$day = substr($sDate[0], 6, 2);
if (ctype_digit($yr) && ctype_digit($month) && ctype_digit($day)) {
$sDate = new Zend_Date(array('year' => $yr, 'month' => $month, 'day' => $day));
$params['sDate'] = $sDate->get(Zend_Date::ISO_8601);
}
}
if (!empty($eDate)) {
$eDate = explode("T", strtoupper($eDate));
$yr = substr($eDate[0], 0, 4);
$month = substr($eDate[0], 4, 2);
$day = substr($eDate[0], 6, 2);
if (ctype_digit($yr) && ctype_digit($month) && ctype_digit($day)) {
$eDate = new Zend_Date(array('year' => $yr, 'month' => $month, 'day' => $day));
if (is_object($sDate) && $eDate->isEarlier($sDate)) {
$this->view->error = 'End date must come after start date.';
$this->_forward("errorxhr", "error");
} else {
$params['eDate'] = $eDate->get(Zend_Date::ISO_8601);
}
}
}
if (!empty($sTime) && ctype_digit($sTime) && (int) $sTime > 0 && (int) $sTime < 2400) {
$sTime = str_pad($sTime, 4, '0', STR_PAD_LEFT);
$params['sTimeH'] = substr($sTime, 0, 2);
$params['sTimeM'] = substr($sTime, 2, 2);
}
if (!empty($eTime) && ctype_digit($eTime) && (int) $eTime >= 0 && (int) $eTime < 2359) {
$sTime = str_pad($eTime, 4, '0', STR_PAD_LEFT);
$params['eTimeH'] = substr($sTime, 0, 2);
$params['eTimeM'] = substr($sTime, 2, 2);
}
try {
$qModel = new QueryModel($initId);
if ($this->_getParam('service') == 'debugsessions') {
$qModel->bySessions($params);
$this->view->qModel = $qModel;
$this->view->offset = $params['offset'];
$this->view->nextOffset = $params['offset'] + $params['limit'];
$this->view->prevOffset = $params['offset'] - $params['limit'] > 0 ? $params['offset'] - $params['limit'] : 0;
$this->view->id = $initId;
$this->render('debugsessions');
} else {
if ($this->_getParam('service') == 'debugcounts') {
$qModel->byCounts($params);
$this->view->qModel = $qModel;
$this->view->offset = $params['offset'];
$this->view->nextOffset = $params['offset'] + $params['limit'];
$this->view->prevOffset = $params['offset'] - $params['limit'] > 0 ? $params['offset'] - $params['limit'] : 0;
$this->view->id = $initId;
$this->render('debugcounts');
} else {
$sum = strtolower($sum) === 'true' ? true : false;
if ($this->_getParam('service') == 'sessions') {
$qModel->bySessions($params);
$trans = TransformerFactory::factory($this->_transformers[$format], false, $sum);
} else {
$qModel->byCounts($params);
$trans = TransformerFactory::factory($this->_transformers[$format], true, $sum);
}
$trans->setInitMetadata($qModel->getInitMetadata());
$trans->setInitLocs($qModel->getInitLocs());
$trans->setInitActs($qModel->getInitActs());
$trans->setInitActGroups($qModel->getInitActGroups());
while ($row = $qModel->getNextRow()) {
$trans->addRow($row);
}
if ($qModel->hasMore()) {
$trans->setHasMore(true, $params['offset'] + $params['limit']);
}
$this->view->trans = $trans;
}
}
} catch (Exception $e) {
$this->view->error = $e->getMessage();
$this->_forward("error");
}
} else {
$this->view->error = 'Initiative ID must be numeric';
Globals::getLog()->err('INVALID INITIATIVE ID - QueryController id: ' . $initId);
$this->_forward("error");
}
}
示例5: sessionAction
public function sessionAction()
{
$id = Zend_Filter::filterStatic($this->getRequest()->getParam('id'), 'StripTags');
if (is_numeric($id)) {
try {
$session = new SessionModel($id);
$init = $session->getInitiative();
$rootLoc = $init->getRootLocation();
$treeString = LocationModel::walkTree($rootLoc->getMetadata('id'));
$treeArray = explode(",", $treeString);
$locations = array();
foreach ($treeArray as $locId) {
$locations[] = new LocationModel($locId);
}
$this->view->locations = $locations;
$this->view->session = $session;
$this->view->init = $init;
} catch (Exception $e) {
$this->view->error = $e->getMessage();
Globals::getLog()->err('ADMIN sessions error: ' . $this->view->error);
$this->render('error');
return false;
}
} else {
$this->view->error = 'Invalid session ID';
Globals::getLog()->err('ADMIN sessions error: ' . $this->view->error);
$this->render('error');
return false;
}
}
示例6: create
public static function create($data)
{
$db = Globals::getDBConn();
if (isset($data['group']) && is_numeric($data['group']) && (isset($data['title']) && strlen($data['title']) > 0)) {
$select = $db->select()->from('activity')->where('fk_activity_group = ' . $data['group'] . ' AND LOWER(title) = ' . $db->quote(strtolower($data['title'])));
$existingActivity = $select->query()->fetch();
if (empty($existingActivity)) {
$hash = array('title' => $data['title'], 'enabled' => isset($data['enabled']) ? (int) $data['enabled'] : 0, 'fk_activity_group' => $data['group'], 'description' => isset($data['desc']) ? $data['desc'] : null, 'rank' => isset($data['rank']) ? $data['rank'] : null);
$db->insert('activity', $hash);
$actId = $db->lastInsertId();
Globals::getLog()->info('ACTIVITY CREATED - id: ' . $actId . ', title: ' . $data['title'] . ', group: ' . $data['group']);
return $actId;
} else {
$errStr = 'DUPLICATE ACTIVITY CREATION DENIED - title: ' . $data['title'] . ', group: ' . $data['group'];
Globals::getLog()->warn($errStr);
throw new Exception($errStr);
}
} else {
$errStr = 'MINIMUM METADATA FOR NEW ACTIVITY (ACTIVITY GROUP AND TITLE) not provided';
Globals::getLog()->warn($errStr);
throw new Exception($errStr);
}
return FALSE;
}
示例7: setError
private function setError($error, $transId)
{
Globals::getLog()->err($error);
Globals::getLog()->debug('TRANSACTION END - id:' . $transId . ' <<<');
$this->_error = $error;
}
示例8: create
public static function create($data)
{
$db = Globals::getDBConn();
$hash = array('title' => isset($data['title']) ? $data['title'] : '', 'enabled' => isset($data['enabled']) ? (int) $data['enabled'] : 1, 'fk_parent' => isset($data['fk_parent']) ? $data['fk_parent'] : null, 'description' => isset($data['description']) ? $data['description'] : '', 'rank' => isset($data['rank']) ? $data['rank'] : 0);
$db->insert('location', $hash);
$locId = $db->lastInsertId();
Globals::getLog()->info('LOCATION CREATED - id: ' . $locId . ', title: ' . $data['title']);
return $locId;
}
示例9: create
public static function create($data)
{
$db = Globals::getDBConn();
$hash = array('title' => isset($data['title']) ? $data['title'] : 'Default', 'rank' => isset($data['rank']) ? $data['rank'] : 1, 'description' => isset($data['descr']) ? $data['descr'] : null, 'required' => isset($data['required']) ? (int) $data['required'] : 0, 'allowMulti' => isset($data['allowMulti']) ? (int) $data['allowMulti'] : 1, 'fk_initiative' => $data['init']);
$select = $db->select()->from('activity_group')->where('fk_initiative = ' . $hash['fk_initiative'] . ' AND LOWER(title) = ' . $db->quote(strtolower($hash['title'])));
$existingActivityGroup = $select->query()->fetch();
if (empty($existingActivityGroup)) {
$db->insert('activity_group', $hash);
$actGrpId = $db->lastInsertId();
Globals::getLog()->info('ACTIVITY GROUP CREATED - id: ' . $actGrpId . ', title: ' . $data['title'] . ', init: ' . $data['init']);
} else {
$errStr = 'DUPLICATE ACTIVITY GROUP CREATION DENIED - title: ' . $data['title'];
Globals::getLog()->warn($errStr);
throw new Exception($errStr);
}
return $actGrpId;
}
示例10: create
public static function create($data)
{
$db = Globals::getDBConn();
$select = $db->select()->from('initiative')->where('LOWER(title) = ' . $db->quote(strtolower($data['title'])));
$row = $select->query()->fetch();
if (empty($row)) {
$hash = array('title' => $data['title'], 'enabled' => 0, 'description' => $data['description']);
$db->insert('initiative', $hash);
$initId = $db->lastInsertId();
Globals::getLog()->info('INITIATIVE CREATED - id: ' . $initId . ', title: ' . $data['title']);
return $initId;
} else {
Globals::getLog()->warn('DUPLICATE INITIATIVE CREATION DENIED - title: ' . $data['title']);
throw new Exception('Initiative already exists with the title "' . $data['title'] . '"');
}
}