本文整理汇总了PHP中FabrikWorker::getDBO方法的典型用法代码示例。如果您正苦于以下问题:PHP FabrikWorker::getDBO方法的具体用法?PHP FabrikWorker::getDBO怎么用?PHP FabrikWorker::getDBO使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FabrikWorker
的用法示例。
在下文中一共展示了FabrikWorker::getDBO方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: log
/**
* perform log
*
* @param object $params
* @param object form model
* @param string message type
* @returns bool
*/
protected function log($params, $formModel, $messageType)
{
$this->formModel = $formModel;
$app = JFactory::getApplication();
$db = FabrikWorker::getDBO();
$query = $db->getQuery(true);
$rowid = JRequest::getVar('rowid', '');
$loading = strstr($messageType, 'form.load');
$http_referrer = JRequest::getVar('HTTP_REFERER', 'no HTTP_REFERER', 'SERVER');
$user = JFactory::getUser();
$userid = $user->get('id');
$username = $user->get('username');
// Generate random filename
if ($params->get('logs_random_filename') == 1) {
function generate_filename($length)
{
$key = "";
$possible = "0123456789bcdfghjkmnpqrstvwxyzBCDFGHJKLMNPQRTVWXYZ";
$i = 0;
while ($i < $length) {
$char = substr($possible, mt_rand(0, strlen($possible) - 1), 1);
$key .= $char;
$i++;
}
return $key;
}
$random_filename = '_' . generate_filename($params->get('logs_random_filename_length'));
} else {
$random_filename = '';
}
$w = new FabrikWorker();
$logs_path = $w->parseMessageForPlaceHolder($params->get('logs_path'));
if (strpos($logs_path, DS) !== 0) {
$logs_path = JPATH_ROOT . DS . $logs_path;
}
$logs_path = rtrim($logs_path, DS);
if (!JFolder::exists($logs_path)) {
if (!JFolder::create($logs_path)) {
return;
}
}
$ext = $params->get('logs_file_format');
$sep = $params->get('logs_separator');
// Making complete path + filename + extension
$w = new FabrikWorker();
$logs_file = $logs_path . DS . $w->parseMessageForPlaceHolder($params->get('logs_file')) . $random_filename . '.' . $ext;
$logs_mode = $params->get('logs_append_or_overwrite');
$date_element = $params->get('logs_date_field');
$date_now = $params->get('logs_date_now');
// COMPARE DATA
$result_compare = '';
if ($params->get('compare_data')) {
if ($ext == 'csv') {
$sep_compare = '';
$sep_2compare = '/ ';
} else {
if ($ext == 'txt') {
$sep_compare = "\n";
$sep_2compare = "\n";
} else {
if ($ext == 'htm') {
$sep_compare = '<br/>';
$sep_2compare = '<br/>';
}
}
}
if ($loading) {
$result_compare = JText::_('COMPARE_DATA_LOADING') . $sep_2compare;
} else {
$data = $this->getEmailData();
$newData = $this->getNewData($formModel);
if (!empty($data)) {
$post = JRequest::get('post');
$elementModel = JModel::getInstance('element', 'FabrikModel');
$element = $elementModel->getElement(true);
$tableModel = $formModel->getTable();
$origDataCount = count(array_keys(JArrayHelper::fromObject($formModel->_origData[0])));
if ($origDataCount > 0) {
$c = 0;
$origData = $formModel->_origData;
$log_elements = explode(',', str_replace(' ', '', $params->get('logs_element_list', '')));
$groups = $formModel->getGroupsHiarachy();
foreach ($groups as $groupModel) {
$group = $groupModel->getGroup();
$elementModels = $groupModel->getPublishedElements();
foreach ($elementModels as $elementModel) {
$element = $elementModel->getElement();
$fullName = $elementModel->getFullName(false, true, false);
if (empty($log_elements) || in_array($fullName, $log_elements)) {
if ($newData[$c]->{$fullName} != $origData[$c]->{$fullName}) {
$result_compare .= JText::_('COMPARE_DATA_CHANGE_ON') . ' ' . $element->label . ' ' . $sep_compare . JText::_('COMPARE_DATA_FROM') . ' ' . $origData[0]->{$fullName} . ' ' . $sep_compare . JText::_('COMPARE_DATA_TO') . ' ' . $newData[$c]->{$fullName} . ' ' . $sep_2compare;
}
//.........这里部分代码省略.........