categories php,categories.php

/**

* Copyright (c) BoonEx Pty Limited - http://www.boonex.com/

* CC-BY License - http://creativecommons.org/licenses/by/3.0/

*/

define('BX_CATEG_ACTION_ALL', 'all');

define('BX_CATEG_ACTION_COMMON', 'common');

define('BX_CATEG_ACTION_USERS', 'users');

define('BX_CATEG_ACTION_CALENDAR', 'calendar');

define('BX_CATEG_ACTION_SEARCH', 'search');

require_once( 'inc/header.inc.php' );

require_once( BX_DIRECTORY_PATH_INC . 'design.inc.php' );

bx_import('BxTemplCategories');

bx_import('BxDolPageView');

bx_import('BxTemplCalendar');

$bAjaxMode = isset($_SERVER['HTTP_X_REQUESTED_WITH']) and $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest' ? true : false;

function showCategories($aParam = array(), $iBoxId = 1, $sAction = '', $isBox = false, $bOrderPanel = false, $sTitle = '')

{

$oCateg = new BxTemplCategories();

$oCateg->getTagObjectConfig($aParam);

if (empty($oCateg->aTagObjects)) {

if ($isBox)

return DesignBoxContent($sTitle, MsgBox(_t('_Empty')), 1);

else

return MsgBox(_t('_Empty'));

}

$aParam['type'] = isset($_GET['tags_mode']) && isset($oCateg->aTagObjects[$_GET['tags_mode']]) ? $_GET['tags_mode'] : $oCateg->getFirstObject();

$sCode = $oCateg->display($aParam, $iBoxId, $sAction, $bOrderPanel, getParam('categ_show_columns'));

if ($isBox) {

$aCaptionMenu = $oCateg->getCategTopMenuHtml($aParam, $iBoxId, $sAction);

$sCode = DesignBoxContent($sTitle, $sCode, 1, $aCaptionMenu);

$sCode = '

' . $sCode . '
';

return $sCode;

} else

return array(

$sCode,

$oCateg->getCategTopMenu($aParam, $sAction),

array(),

($sDate ? _t('_categ_by_day') . $sDate : '')

);

}

class CategoriesCalendar extends BxTemplCalendar

{

function __construct($iYear, $iMonth)

{

parent::__construct($iYear, $iMonth);

}

function display()

{

$sTopControls = $GLOBALS['oSysTemplate']->parseHtmlByName('calendar_top_controls.html', array(

'month_prev_url' => $this->getBaseUri () . "&year={$this->iPrevYear}&month={$this->iPrevMonth}",

'month_next_url' => $this->getBaseUri () . "&year={$this->iNextYear}&month={$this->iNextMonth}",

'month_current' => $this->getTitle(),

));

$sHtml = $GLOBALS['oSysTemplate']->parseHtmlByName('calendar.html', array (

'top_controls' => $sTopControls,

'bx_repeat:week_names' => $this->_getWeekNames (),

'bx_repeat:calendar_row' => $this->_getCalendar (),

'bottom_controls' => $sTopControls,

));

$sHtml = preg_replace ('#.*?#s', '', $sHtml);

$GLOBALS['oSysTemplate']->addCss('calendar.css');

return $sHtml;

}

function getData()

{

$oDb = BxDolDb::getInstance();

return $oDb->getAll("SELECT *, DAYOFMONTH(`Date`) AS `Day`

FROM `sys_categories`

WHERE `Date` >= TIMESTAMP(?)

AND `Date` < TIMESTAMP(?)

AND `Owner` <> 0 AND `Status` = 'active'",

[

"{$this->iYear}-{$this->iMonth}-1",

"{$this->iNextYear}-{$this->iNextMonth}-1",

]

);

}

function getBaseUri()

{

return BX_DOL_URL_ROOT . 'categories.php?action=calendar';

}

function getBrowseUri()

{

return BX_DOL_URL_ROOT . 'categories.php?action=calendar';

}

function getEntriesNames ()

{

return array(_t('_categ_single'), _t('_categ_plural'));

}

function _getCalendar ()

{

$sBrowseUri = $this->getBrowseUri();

list ($sEntriesSingle, $sEntriesMul) = $this->getEntriesNames ();

$this->_getCalendarGrid($aCalendarGrid);

$aRet = array ();

for ($i = 0; $i < 6; $i++) {

$aRow = array ('bx_repeat:cell');

$isRowEmpty = true;

for ($j = $this->iWeekStart; $j < $this->iWeekEnd; $j++) {

$aCell = array ();

if ($aCalendarGrid[$i][$j]['today']) {

$aCell['class'] = 'sys_cal_cell sys_cal_today';

$aCell['day'] = $aCalendarGrid[$i][$j]['day'];

$aCell['bx_if:num'] = array ('condition' => $aCalendarGrid[$i][$j]['num'], 'content' => array(

'num' => $aCalendarGrid[$i][$j]['num'],

'href' => $sBrowseUri . '&year=' . $this->iYear . '&month=' . $this->iMonth . '&day=' . $aCell['day'],

'entries' => 1 == $aCalendarGrid[$i][$j]['num'] ? $sEntriesSingle : $sEntriesMul,

));

$isRowEmpty = false;

} elseif (isset($aCalendarGrid[$i][$j]['day'])) {

$aCell['class'] = 'sys_cal_cell';

$aCell['day'] = $aCalendarGrid[$i][$j]['day'];

$aCell['bx_if:num'] = array ('condition' => $aCalendarGrid[$i][$j]['num'], 'content' => array(

'num' => $aCalendarGrid[$i][$j]['num'],

'href' => $sBrowseUri . '&year=' . $this->iYear . '&month=' . $this->iMonth . '&day=' . $aCell['day'],

'entries' => 1 == $aCalendarGrid[$i][$j]['num'] ? $sEntriesSingle : $sEntriesMul,

));

$isRowEmpty = false;

} else {

$aCell['class'] = 'sys_cal_cell_blank';

$aCell['day'] = '';

$aCell['bx_if:num'] = array ('condition' => false, 'content' => array(

'num' => '',

'href' => '',

'entries' => '',

));

}

if ($aCell)

$aRow['bx_repeat:cell'][] = $aCell;

}

if ($aRow['bx_repeat:cell'] && !$isRowEmpty) {

$aRet[] = $aRow;

}

}

return $aRet;

}

}

class CategoriesCalendarPage extends BxDolPageView

{

var $sPage;

function __construct()

{

$this->sPage = 'categ_calendar';

parent::__construct($this->sPage);

}

function getBlockCode_Calendar($iBlockId)

{

$sYear = isset($_GET['year']) ? (int)$_GET['year'] : '';

$sMonth = isset($_GET['month']) ? (int)$_GET['month'] : '';

$oCalendar = new CategoriesCalendar($sYear, $sMonth);

return $oCalendar->display();

}

function getBlockCode_CategoriesDate($iBlockId)

{

if (isset($_GET['year']) && isset($_GET['month']) && isset($_GET['day'])) {

$aParam = array(

'pagination' => getParam('categ_perpage_browse'),

'date' => array(

'year' => (int)$_GET['year'],

'month' => (int)$_GET['month'],

'day' => (int)$_GET['day']

)

);

return showCategories($aParam, $iBlockId, BX_CATEG_ACTION_CALENDAR, false, false, _t('_categ_caption_calendar'));

} else

return MsgBox(_t('_Empty'));

}

}

class CategoriesSearchPage extends BxDolPageView

{

var $aSearchForm;

var $oForm;

var $sPage;

function __construct()

{

$this->sPage = 'categ_search';

parent::__construct($this->sPage);

bx_import('BxTemplFormView');

$this->aSearchForm = array(

'form_attrs' => array(

'name' => 'form_search_categories',

'action' => '',

'method' => 'post',

),

'params' => array (

'db' => array(

'submit_name' => 'submit_form',

),

),

'inputs' => array(

'Keyword' => array(

'type' => 'text',

'name' => 'Keyword',

'caption' => _t('_categ_caption_keyword'),

'required' => true,

'checker' => array (

'func' => 'length',

'params' => array(1, 100),

'error' => _t ('_categ_err_keyword'),

),

'db' => array (

'pass' => 'Xss',

),

),

'Submit' => array (

'type' => 'submit',

'name' => 'submit_form',

'value' => _t('_Submit'),

'colspan' => true,

),

),

);

$this->oForm = new BxTemplFormView($this->aSearchForm);

$this->oForm->initChecker();

}

function getBlockCode_Form()

{

return $GLOBALS['oSysTemplate']->parseHtmlByName('search_tags_box.html', array('form' => $this->oForm->getCode()));

}

function getBlockCode_Founded($iBlockId)

{

$aParam = array(

'pagination' => getParam('categ_perpage_browse')

);

$sFilter = bx_get('filter');

if ($sFilter !== false)

$aParam['filter'] = process_db_input($sFilter);

else if ($this->oForm->isSubmittedAndValid())

$aParam['filter'] = $this->oForm->getCleanValue('Keyword');

if (isset($aParam['filter']))

return showCategories($aParam, $iBlockId, BX_CATEG_ACTION_SEARCH, false, false, _t('_categ_caption_founded_categ'));

else

return MsgBox(_t('_Empty'));

}

}

function getPage_All()

{

$aParam = array(

'pagination' => getParam('categ_perpage_browse')

);

return showCategories($aParam, 1, BX_CATEG_ACTION_ALL, true, true, _t('_categ_caption_all'));

}

function getPage_Common()

{

$aParam = array(

'pagination' => getParam('categ_perpage_browse'),

'common' => true,

);

return showCategories($aParam, 1, BX_CATEG_ACTION_COMMON, true, false, _t('_categ_caption_common'));

}

function getPage_Users()

{

$aParam = array(

'pagination' => getParam('categ_perpage_browse'),

'common' => false

);

return showCategories($aParam, 1, BX_CATEG_ACTION_USERS, true, false, _t('_categ_caption_users'));

}

function getPage_Calendar()

{

$oCalendarPage = new CategoriesCalendarPage();

return $oCalendarPage->getCode();

}

function getPage_Search()

{

$oSearchPage = new CategoriesSearchPage();

return $oSearchPage->getCode();

}

$sAction = empty($_GET['action']) ? '' : $_GET['action'];

switch ($sAction) {

case BX_CATEG_ACTION_COMMON:

$sContent = getPage_Common();

break;

case BX_CATEG_ACTION_USERS:

$sContent = getPage_Users();

break;

case BX_CATEG_ACTION_CALENDAR:

$sContent = getPage_Calendar();

break;

case BX_CATEG_ACTION_SEARCH:

$sContent = getPage_Search();

break;

default:

$sContent = getPage_All();

}

if (!$bAjaxMode) {

global $_page;

global $_page_cont;

$iIndex = 25;

$_page['name_index'] = $iIndex;

$_page['css_name'] = 'tags.css';

$_page['header'] = _t('_Categories');

$_page['header_text'] = _t('_Categories');

$_page_cont[$iIndex]['page_main_code'] = $sContent;

check_logged();

PageCode();

} else

echo $sContent;

一键复制

编辑

Web IDE

原始数据

按行查看

历史

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
图像识别技术在病虫害检测中的应用是一个快速发展的领域,它结合了计算机视觉和机器学习算法来自动识别和分类植物上的病虫害。以下是这一技术的一些关键步骤和组成部分: 1. **数据收集**:首先需要收集大量的植物图像数据,这些数据包括健康植物的图像以及受不同病虫害影响的植物图像。 2. **图像预处理**:对收集到的图像进行处理,以提高后续分析的准确性。这可能包括调整亮度、对比度、去噪、裁剪、缩放等。 3. **特征提取**:从图像中提取有助于识别病虫害的特征。这些特征可能包括颜色、纹理、形状、边缘等。 4. **模型训练**:使用机器学习算法(如支持向量机、随机森林、卷积神经网络等)来训练模型。训练过程中,算法会学习如何根据提取的特征来识别不同的病虫害。 5. **模型验证和测试**:在独立的测试集上验证模型的性能,以确保其准确性和泛化能力。 6. **部署和应用**:将训练好的模型部署到实际的病虫害检测系统中,可以是移动应用、网页服务或集成到智能农业设备中。 7. **实时监测**:在实际应用中,系统可以实时接收植物图像,并快速给出病虫害的检测结果。 8. **持续学习**:随着时间的推移,系统可以不断学习新的病虫害样本,以提高其识别能力。 9. **用户界面**:为了方便用户使用,通常会有一个用户友好的界面,显示检测结果,并提供进一步的指导或建议。 这项技术的优势在于它可以快速、准确地识别出病虫害,甚至在早期阶段就能发现问题,从而及时采取措施。此外,它还可以减少对化学农药的依赖,支持可持续农业发展。随着技术的不断进步,图像识别在病虫害检测中的应用将越来越广泛。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值