PageRenderTime 29ms CodeModel.GetById 12ms RepoModel.GetById 1ms app.codeStats 0ms

/uploads/include/arc.partview.class.php

http://pj-photohost.googlecode.com/
PHP | 217 lines | 155 code | 16 blank | 46 comment | 18 complexity | 6c370a9aa420e3162a7cac2730bf2c5f MD5 | raw file
Possible License(s): LGPL-2.1
  1. <?php
  2. if(!defined('DEDEINC')) exit('Request Error!');
  3. require_once(DEDEINC.'/channelunit.class.php');
  4. require_once(DEDEINC.'/typelink.class.php');
  5. class PartView
  6. {
  7. var $dsql;
  8. var $dtp;
  9. var $TypeID;
  10. var $Fields;
  11. var $TypeLink;
  12. var $pvCopy;
  13. var $refObj;
  14. //php5????
  15. function __construct($typeid=0,$needtypelink=true)
  16. {
  17. global $_sys_globals;
  18. $this->TypeID = $typeid;
  19. $this->dsql = $GLOBALS['dsql'];
  20. $this->dtp = new DedeTagParse();
  21. $this->dtp->SetNameSpace("dede","{","}");
  22. $this->dtp->SetRefObj($this);
  23. if($needtypelink)
  24. {
  25. $this->TypeLink = new TypeLink($typeid);
  26. if(is_array($this->TypeLink->TypeInfos))
  27. {
  28. foreach($this->TypeLink->TypeInfos as $k=>$v)
  29. {
  30. if(ereg("[^0-9]",$k))
  31. {
  32. $this->Fields[$k] = $v;
  33. }
  34. }
  35. }
  36. $_sys_globals['curfile'] = 'partview';
  37. $_sys_globals['typename'] = $this->Fields['typename'];
  38. //??????
  39. SetSysEnv($this->TypeID,$this->Fields['typename'],0,'','partview');
  40. }
  41. SetSysEnv($this->TypeID,'',0,'','partview');
  42. $this->Fields['typeid'] = $this->TypeID;
  43. //??????????
  44. foreach($GLOBALS['PubFields'] as $k=>$v)
  45. {
  46. $this->Fields[$k] = $v;
  47. }
  48. }
  49. //?????????
  50. function SetRefObj(&$refObj)
  51. {
  52. $this->dtp->SetRefObj($refObj);
  53. if(isset($refObj->TypeID))
  54. {
  55. $this->__construct($refObj->TypeID);
  56. }
  57. }
  58. //??typelink????????
  59. function SetTypeLink(&$typelink)
  60. {
  61. $this->TypeLink = $typelink;
  62. if(is_array($this->TypeLink->TypeInfos))
  63. {
  64. foreach($this->TypeLink->TypeInfos as $k=>$v)
  65. {
  66. if(ereg("[^0-9]",$k))
  67. {
  68. $this->Fields[$k] = $v;
  69. }
  70. }
  71. }
  72. }
  73. //php4????
  74. function PartView($typeid=0,$needtypelink=true)
  75. {
  76. $this->__construct($typeid,$needtypelink);
  77. }
  78. //????????
  79. function SetTemplet($temp,$stype="file")
  80. {
  81. if($stype=="string")
  82. {
  83. $this->dtp->LoadSource($temp);
  84. }
  85. else
  86. {
  87. $this->dtp->LoadTemplet($temp);
  88. }
  89. if($this->TypeID > 0)
  90. {
  91. $this->Fields['position'] = $this->TypeLink->GetPositionLink(true);
  92. $this->Fields['title'] = $this->TypeLink->GetPositionLink(false);
  93. }
  94. $this->ParseTemplet();
  95. }
  96. //????
  97. function Display()
  98. {
  99. $this->dtp->Display();
  100. }
  101. //????
  102. function GetResult()
  103. {
  104. return $this->dtp->GetResult();
  105. }
  106. /**
  107. * ???????
  108. * @param string $filename
  109. */
  110. function SaveToHtml($filename)
  111. {
  112. $this->dtp->SaveTo($filename);
  113. }
  114. /**
  115. * ????????
  116. */
  117. function ParseTemplet()
  118. {
  119. $GLOBALS['envs']['typeid'] = $this->TypeID;
  120. if($this->TypeID>0)
  121. {
  122. $GLOBALS['envs']['topid'] = GetTopid($this->TypeID);
  123. }
  124. else
  125. {
  126. $GLOBALS['envs']['topid'] = 0;
  127. }
  128. if(isset($this->TypeLink->TypeInfos['reid']))
  129. {
  130. $GLOBALS['envs']['reid'] = $this->TypeLink->TypeInfos['reid'];
  131. }
  132. if(isset($this->TypeLink->TypeInfos['channeltype']))
  133. {
  134. $GLOBALS['envs']['channelid'] = $this->TypeLink->TypeInfos['channeltype'];
  135. }
  136. MakeOneTag($this->dtp,$this); //?????? channelunit.func.php ???
  137. }
  138. /**
  139. * ??????????????????
  140. * ??????????????????????????????????????????????
  141. * @param string $templets
  142. * @param int $typeid
  143. * @param int $row
  144. * @param int $col
  145. * @param int $titlelen
  146. * @param int $infolen
  147. * @param int $imgwidth
  148. * @param int $imgheight
  149. * @param string $listtype
  150. * @param string $orderby
  151. * @param string $keyword
  152. * @param string $innertext
  153. * @param int $tablewidth
  154. * @param int $arcid
  155. * @param string $idlist
  156. * @param int $channelid
  157. * @param string $limit
  158. * @param int $att
  159. * @param string $order
  160. * @param int $subday
  161. * @param int $autopartid
  162. * @param int $ismember
  163. * @param string $maintable
  164. * @param object $ctag
  165. * @return array
  166. */
  167. function GetArcList($templets='',$typeid=0,$row=10,$col=1,$titlelen=30,$infolen=160,
  168. $imgwidth=120,$imgheight=90,$listtype="all",$orderby="default",$keyword="",$innertext="",
  169. $tablewidth="100",$arcid=0,$idlist="",$channelid=0,$limit="",$att=0,$order='desc',$subday=0,
  170. $autopartid=-1,$ismember=0,$maintable='',$ctag='')
  171. {
  172. if(empty($autopartid))
  173. {
  174. $autopartid = -1;
  175. }
  176. if(empty($typeid))
  177. {
  178. $typeid=$this->TypeID;
  179. }
  180. if($autopartid!=-1)
  181. {
  182. $typeid = $this->GetAutoChannelID($autopartid,$typeid);
  183. if($typeid==0)
  184. {
  185. return "";
  186. }
  187. }
  188. if(!isset($GLOBALS['__SpGetArcList']))
  189. {
  190. require_once(dirname(__FILE__)."/inc/inc_fun_SpGetArcList.php");
  191. }
  192. return SpGetArcList($this->dsql,$templets,$typeid,$row,$col,$titlelen,$infolen,$imgwidth,$imgheight,
  193. $listtype,$orderby,$keyword,$innertext,$tablewidth,$arcid,$idlist,$channelid,$limit,$att,
  194. $order,$subday,$ismember,$maintable,$ctag);
  195. }
  196. //????????
  197. function Close()
  198. {
  199. }
  200. }//End Class
  201. ?>