当前位置: 首页>>代码示例>>PHP>>正文


PHP FabrikWorker::getDBO方法代码示例

本文整理汇总了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;
                                 }
//.........这里部分代码省略.........
开发者ID:rhotog,项目名称:fabrik,代码行数:101,代码来源:logs.php


注:本文中的FabrikWorker::getDBO方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。