本文整理汇总了PHP中kohana::Log方法的典型用法代码示例。如果您正苦于以下问题:PHP kohana::Log方法的具体用法?PHP kohana::Log怎么用?PHP kohana::Log使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kohana
的用法示例。
在下文中一共展示了kohana::Log方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getDispositionForm
public function getDispositionForm()
{
$faxprof = Input::instance()->post('faxprofile');
$faxdisp = Doctrine::getTable('FaxDisposition')->find($faxprof['fxp_fxd_id']);
if ($faxdisp) {
$packageobj = Doctrine::getTable('package')->find($faxdisp['fxd_package_id']);
if ($packageobj) {
try {
if (!($package = Package_Catalog::getInstalledPackage($packageobj->name))) {
echo 'Package not ' . $packageobj->name . ' found.';
exit;
}
$formfile = $package['directory'] . '/views/' . $packageobj->name . '/' . $faxdisp['fxd_name'] . '.php';
kohana::Log('debug', 'Looking for view ' . $formfile);
if (file_exists($formfile)) {
$featureFormView = new View($packageobj->name . '/' . $faxdisp['fxd_name']);
kohana::Log('debug', 'View file found.');
if (isset($faxprof['fxp_id']) && !empty($faxprof['fxp_id']) && $faxprof['fxp_id'] != '') {
$faxprofobj = Doctrine::getTable('FaxProfile')->find($faxprof['fxp_id']);
} else {
$faxprofobj = new FaxProfile();
}
$featureFormView->set_global('faxprofile', $faxprofobj);
echo $featureFormView->render(TRUE);
} else {
kohana::Log('debug', 'View file not found.');
}
} catch (Package_Catalog_Exception $e) {
echo 'Package not ' . $packageobj->name . ' found.';
}
}
}
exit;
}
示例2: datetimediff
public static function datetimediff($d1, $d2, $returnformat = 'colon')
{
kohana::Log('debug', 'd1: ' . print_r($d1, true) . ' d2: ' . print_r($d2, true));
if ($d1 === '' || $d2 === '') {
return false;
}
try {
$date1 = new DateTime($d1);
$date2 = new DateTime($d2);
} catch (Exception $e) {
return false;
}
$interval = $date1->diff($date2);
$interval_str = '';
switch ($returnformat) {
case 'colon':
if ($interval->invert) {
$interval_str .= '-';
}
if ($v = $interval->y >= 1) {
$interval_str .= $interval->y . 'y';
}
if ($v = $interval->m >= 1) {
$interval_str .= $interval->m . 'm';
}
if ($v = $interval->d >= 1) {
$interval_str .= $interval->d . 'd';
}
$interval_str .= ' ';
if ($v = $interval->h >= 1) {
$interval_str .= str_pad($interval->h, 2, '0', STR_PAD_LEFT) . ':';
} else {
$interval_str .= '00:';
}
if ($v = $interval->i >= 1) {
$interval_str .= str_pad($interval->i, 2, '0', STR_PAD_LEFT) . ':';
} else {
$interval_str .= '00:';
}
if ($v = $interval->s >= 1) {
$interval_str .= str_pad($interval->s, 2, '0', STR_PAD_LEFT) . ':';
} else {
$interval_str .= '00:';
}
$interval_str = substr($interval_str, 0, -1);
break;
case 'text':
if ($v = $interval->y >= 1) {
$interval_str .= self::pluralize($interval->y, ' year') . ', ';
}
if ($v = $interval->m >= 1) {
$interval_str .= self::pluralize($interval->m, ' month') . ', ';
}
if ($v = $interval->d >= 1) {
$interval_str .= self::pluralize($interval->d, ' day') . ', ';
}
if ($v = $interval->h >= 1) {
$interval_str .= self::pluralize($interval->h, ' hour') . ', ';
}
if ($v = $interval->i >= 1) {
$interval_str .= self::pluralize($interval->i, ' minute') . ', ';
}
if ($v = $interval->s >= 1) {
$interval_str .= self::pluralize($interval->s, ' second') . ', ';
}
$interval_str = substr($interval_str, 0, -1);
$interval_str .= ' ';
if ($interval->invert) {
$interval_str .= _('from now');
} else {
$interval_str .= _('ago');
}
break;
default:
$interval_str = $interval->format($returnformat);
break;
}
return $interval_str;
}
示例3: syncRunningConfig
public function syncRunningConfig($step)
{
while (ob_get_level()) {
ob_end_clean();
}
$sessionobj = Session::instance();
if ($step == 'setup') {
try {
//build domain filter
$locationobjlist = Doctrine_Query::create()->select('*')->from('Location')->execute();
foreach ($locationobjlist as $location) {
$locationidlist[] = $location->location_id;
}
$sessionobj->set('locationlist', $locationidlist);
echo json_encode(array('result' => 'OK', 'message' => 'Success', 'nextstep' => 'buildrunningqueuelist'));
} catch (Exception $e) {
kohana::Log('error', $e->getMessage());
echo json_encode(array('result' => 'ERROR', 'message' => $e->getMessage, 'nextstep' => ''));
exit;
}
} elseif ($step == 'buildrunningqueuelist') {
try {
$sessionobj->set('runningqueuelist', $this->getRunningQueueList());
echo json_encode(array('result' => 'OK', 'message' => 'Success', 'nextstep' => 'builddbqueuelist'));
} catch (Exception $e) {
kohana::Log('error', $e->getMessage());
echo json_encode(array('result' => 'ERROR', 'message' => $e->getMessage, 'nextstep' => 'buildrunningagentlist'));
exit;
}
} elseif ($step == 'builddbqueuelist') {
try {
$queuenamelist = array();
$dbqueueobjlist = Doctrine_Query::create()->select('*')->from('callcenter_queue')->execute();
foreach ($dbqueueobjlist as $dbqueueobj) {
$queuenamelist[$dbqueueobj->name . '@' . $dbqueueobj->queueLocation->domain] = $dbqueueobj;
}
$sessionobj->set('queuenamelist', $queuenamelist);
echo json_encode(array('result' => 'OK', 'message' => 'Success', 'nextstep' => 'reconcilequeues'));
} catch (Exception $e) {
$sessionobj->delete('runningqueuelist');
kohana::Log('error', $e->getMessage());
echo json_encode(array('result' => 'ERROR', 'message' => $e->getMessage, 'nextstep' => 'buildrunningagentlist'));
exit;
}
} elseif ($step == 'reconcilequeues') {
$queuestatus = '';
$queuenamelist = $sessionobj->get('queuenamelist', array());
$runningqueuelist = $sessionobj->get('runningqueuelist', array());
foreach ($runningqueuelist as $runningqueue) {
if (!isset($queuenamelist[$runningqueue['name']])) {
try {
$this->removeRunningQueue($runningqueue['name']);
} catch (callcenterException $e) {
$queuestatus .= $e->getMessage() . "\n";
kohana::Log('error', $e->getMessage());
}
}
}
foreach ($queuenamelist as $queuename => $queueobj) {
$this->updateRunningQueue($queuename);
}
if ($queuestatus != '') {
$sessionobj->delete('runningqueuelist');
$sessionobj->delete('queuenamelist');
echo json_encode(array('result' => 'ERROR', 'message' => "Error Syncronizing Queues:\n" . $queuestatus, 'nextstep' => 'buildrunningagentlist'));
exit;
}
$sessionobj->delete('runningqueuelist');
$sessionobj->delete('queuenamelist');
echo json_encode(array('result' => 'OK', 'message' => 'Success', 'nextstep' => 'buildrunningagentlist'));
} elseif ($step == 'buildrunningagentlist') {
try {
$sessionobj->set('runningagentlist', $this->getRunningAgentList());
echo json_encode(array('result' => 'OK', 'message' => 'Success', 'nextstep' => 'builddbagentlist'));
} catch (Exception $e) {
kohana::Log('error', $e->getMessage());
echo json_encode(array('result' => 'ERROR', 'message' => $e->getMessage, 'nextstep' => ''));
exit;
}
} elseif ($step == 'builddbagentlist') {
try {
$agentnamelist = array();
$dbagentobjlist = Doctrine_Query::create()->select('*')->from('callcenter_agent')->execute();
foreach ($dbagentobjlist as $dbagentobj) {
$agentnamelist[$dbagentobj->cca_loginid . '@' . $dbagentobj->agentLocation->domain] = $dbagentobj;
}
$sessionobj->set('agentnamelist', $agentnamelist);
echo json_encode(array('result' => 'OK', 'message' => 'Success', 'nextstep' => 'reconcileagents'));
} catch (Exception $e) {
$sessionobj->delete('runningagentlist');
kohana::Log('error', $e->getMessage());
echo json_encode(array('result' => 'ERROR', 'message' => $e->getMessage, 'nextstep' => ''));
exit;
}
} elseif ($step == 'reconcileagents') {
try {
$agentstatus = '';
$agentnamelist = $sessionobj->get('agentnamelist', array());
$runningagentlist = $sessionobj->get('runningagentlist', array());
foreach ($runningagentlist as $runningagent) {
//.........这里部分代码省略.........