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


PHP FabrikString::isMySQLDate方法代码示例

本文整理汇总了PHP中FabrikString::isMySQLDate方法的典型用法代码示例。如果您正苦于以下问题:PHP FabrikString::isMySQLDate方法的具体用法?PHP FabrikString::isMySQLDate怎么用?PHP FabrikString::isMySQLDate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FabrikString的用法示例。


在下文中一共展示了FabrikString::isMySQLDate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: onDoContentSearch


//.........这里部分代码省略.........
         // $$$ geros - http://fabrikar.com/forums/showthread.php?t=21134&page=2
         $key = 'com_' . $package . '.list' . $id . '.filter.searchall';
         $app->setUserState($key, null);
         $used = memory_get_usage();
         $usage[] = memory_get_usage();
         if (count($usage) > 2) {
             $diff = $usage[count($usage) - 1] - $usage[count($usage) - 2];
             if ($diff + $usage[count($usage) - 1] > $memory - $memSafety) {
                 $app->enqueueMessage('Some records were not searched due to memory limitations');
                 break;
             }
         }
         // $$$rob set this to current table
         // Otherwise the fabrik_list_filter_all var is not used
         $input->set('listid', $id);
         $listModel->setId($id);
         $searchFields = $listModel->getSearchAllFields();
         if (empty($searchFields)) {
             continue;
         }
         $filterModel = $listModel->getFilterModel();
         $requestKey = $filterModel->getSearchAllRequestKey();
         // Set the request variable that fabrik uses to search all records
         $input->set($requestKey, $text, 'post');
         $table = $listModel->getTable();
         $fabrikDb = $listModel->getDb();
         $params = $listModel->getParams();
         // Test for swap too boolean mode
         $mode = $input->get('searchphrase', '') === 'all' ? 0 : 1;
         // $params->set('search-mode-advanced', true);
         $params->set('search-mode-advanced', $mode);
         // The table shouldn't be included in the search results or we have reached the max number of records to show.
         if (!$params->get('search_use') || $limit <= 0) {
             continue;
         }
         // Set the table search mode to OR - this will search ALL fields with the search term
         $params->set('search-mode', 'OR');
         $allrows = $listModel->getData();
         $elementModel = $listModel->getFormModel()->getElement($params->get('search_description', $table->label), true);
         $descname = is_object($elementModel) ? $elementModel->getFullName() : '';
         $elementModel = $listModel->getFormModel()->getElement($params->get('search_title', 0), true);
         $title = is_object($elementModel) ? $elementModel->getFullName() : '';
         /**
          * $$$ hugh - added date element ... always use raw, as anything that isn't in
          * standard MySQL format will cause a fatal error in J!'s search code when it does the JDate create
          */
         $elementModel = $listModel->getFormModel()->getElement($params->get('search_date', 0), true);
         $date_element = is_object($elementModel) ? $elementModel->getFullName() : '';
         if (!empty($date_element)) {
             $date_element .= '_raw';
         }
         $aAllowedList = array();
         $pk = $table->db_primary_key;
         foreach ($allrows as $group) {
             foreach ($group as $oData) {
                 $pkval = $oData->__pk_val;
                 if ($app->isAdmin() || $params->get('search_link_type') === 'form') {
                     $href = $oData->fabrik_edit_url;
                 } else {
                     $href = $oData->fabrik_view_url;
                 }
                 if (!in_array($href, $urls)) {
                     $limit--;
                     $urls[] = $href;
                     $o = new stdClass();
                     if (isset($oData->{$title})) {
                         $o->title = $headingPrefix ? $table->label . ' : ' . $oData->{$title} : $oData->{$title};
                     } else {
                         $o->title = $table->label;
                     }
                     $o->_pkey = $table->db_primary_key;
                     $o->section = $section;
                     $o->href = $href;
                     // Need to make sure it's a valid date in MySQL format, otherwise J!'s code will pitch a fatal error
                     if (isset($oData->{$date_element}) && FabrikString::isMySQLDate($oData->{$date_element})) {
                         $o->created = $oData->{$date_element};
                     } else {
                         $o->created = '';
                     }
                     $o->browsernav = 2;
                     if (isset($oData->{$descname})) {
                         $o->text = $oData->{$descname};
                     } else {
                         $o->text = '';
                     }
                     $o->title = strip_tags($o->title);
                     $aAllowedList[] = $o;
                 }
             }
             $list[] = $aAllowedList;
         }
     }
     $allList = array();
     foreach ($list as $li) {
         if (is_array($li) && !empty($li)) {
             $allList = array_merge($allList, $li);
         }
     }
     return $allList;
 }
开发者ID:ppantilla,项目名称:bbninja,代码行数:101,代码来源:fabrik.php


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