国内流行的内容管理系统(CMS)多端全媒体解决方案 https://www.dedebiz.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

77 lines
3.6KB

  1. <?php
  2. if (!defined('DEDEINC')) exit('dedebiz');
  3. /**
  4. * 分类信息地区与小分类搜索
  5. *
  6. * @version $id:infoguide.lib.php 9:29 2010年7月6日 tianya $
  7. * @package DedeBIZ.Taglib
  8. * @copyright Copyright (c) 2022 DedeBIZ.COM
  9. * @license https://www.dedebiz.com/license
  10. * @link https://www.dedebiz.com
  11. */
  12. function lib_infoguide(&$ctag, &$refObj)
  13. {
  14. global $dsql, $nativeplace, $infotype, $hasSetEnumJs, $cfg_cmspath, $cfg_mainsite;
  15. //属性处理
  16. //$attlist="row|12,titlelen|24";
  17. //FillAttsDefault($ctag->CAttribute->Items,$attlist);
  18. //extract($ctag->CAttribute->Items, EXTR_SKIP);
  19. $cmspath = ((empty($cfg_cmspath) || preg_match('#[/$]#', $cfg_cmspath)) ? $cfg_cmspath.'/' : $cfg_cmspath);
  20. if (empty($refObj->Fields['typeid'])) {
  21. $row = $dsql->GetOne("SELECT id FROM `#@__arctype` WHERE channeltype='-8' And reid = '0' ");
  22. $typeid = (is_array($row) ? $row['id'] : 0);
  23. if (empty($typeid)) {
  24. return '请指定一个栏目类型为“分类信息”,否则无法使用这个搜索表单';
  25. }
  26. } else {
  27. $typeid = $refObj->Fields['typeid'];
  28. }
  29. $innerText = trim($ctag->GetInnerText());
  30. if (empty($innerText)) $innerText = GetSysTemplets("info_guide.htm");
  31. $ctp = new DedeTagParse();
  32. $ctp->SetNameSpace('field', '[', ']');
  33. $ctp->LoadSource($innerText);
  34. $revalue = $seli = '';
  35. $fields = array('nativeplace' => '', 'infotype' => '', 'typeid' => $typeid);
  36. if ($hasSetEnumJs != 'has') {
  37. $revalue .= '<script src="'.$cfg_mainsite.$cmspath.'static/web/js/enums.js"></script>'."\r\n";
  38. $GLOBALS['hasSetEnumJs'] = 'hasset';
  39. }
  40. $fields['nativeplace'] = $fields['infotype'] = '';
  41. if (empty($nativeplace)) $nativeplace = 0;
  42. if (empty($infotype)) $infotype = 0;
  43. $fields['nativeplace'] .= "<input type='hidden' id='hidden_nativeplace' name='nativeplace' value='{$nativeplace}' />\r\n";
  44. $fields['nativeplace'] .= "<span class='infosearchtxt'>地区:</span><span id='span_nativeplace'></span>\r\n";
  45. $fields['nativeplace'] .= "<span id='span_nativeplace_son'></span>\r\n<span id='span_nativeplace_sec'></span><br>\r\n";
  46. $fields['nativeplace'] .= "<script>
  47. var em_nativeplaces = [];
  48. fetch('{$cmspath}static/enums/nativeplace.json').then((resp)=>resp.json()).then((d)=>{
  49. Object.entries(d).forEach(v=>{
  50. em_nativeplaces[parseFloat(v[0])]= v[1];
  51. });
  52. MakeTopSelect('nativeplace', $nativeplace);
  53. })
  54. </script>\r\n";
  55. $fields['infotype'] .= "<input type='hidden' id='hidden_infotype' name='infotype' value='{$infotype}' />\r\n";
  56. $fields['infotype'] .= "<span class='infosearchtxt'>类型:</span><span id='span_infotype'></span>\r\n";
  57. $fields['infotype'] .= "<span id='span_infotype_son'></span><span id='span_infotype_sec'></span><br>\r\n";
  58. $fields['infotype'] .= "<script>
  59. var em_infotypes = [];
  60. fetch('{$cmspath}static/enums/infotype.json').then((resp)=>resp.json()).then((d)=>{
  61. Object.entries(d).forEach(v=>{
  62. em_infotypes[parseFloat(v[0])]= v[1];
  63. });
  64. MakeTopSelect('infotype', $infotype);
  65. })
  66. </script>\r\n";
  67. if (is_array($ctp->CTags)) {
  68. foreach ($ctp->CTags as $tagid => $ctag) {
  69. if (isset($fields[$ctag->GetName()])) {
  70. $ctp->Assign($tagid, $fields[$ctag->GetName()]);
  71. }
  72. }
  73. $revalue .= $ctp->GetResult();
  74. }
  75. return $revalue;
  76. }
  77. ?>