Source for file catalog-defs.php

Documentation is available at catalog-defs.php

  1. <?php
  2. /* ******************************************************************** */
  3. /* CATALYST PHP Source Code */
  4. /* -------------------------------------------------------------------- */
  5. /* This program is free software; you can redistribute it and/or modify */
  6. /* it under the terms of the GNU General Public License as published by */
  7. /* the Free Software Foundation; either version 2 of the License, or */
  8. /* (at your option) any later version. */
  9. /* */
  10. /* This program is distributed in the hope that it will be useful, */
  11. /* but WITHOUT ANY WARRANTY; without even the implied warranty of */
  12. /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
  13. /* GNU General Public License for more details. */
  14. /* */
  15. /* You should have received a copy of the GNU General Public License */
  16. /* along with this program; if not, write to: */
  17. /* The Free Software Foundation, Inc., 59 Temple Place, Suite 330, */
  18. /* Boston, MA 02111-1307 USA */
  19. /* -------------------------------------------------------------------- */
  20. /* */
  21. /* Filename: catalog-defs.php */
  22. /* Author: Paul Waite */
  23. /* Description: Handle media catalog items and lists. */
  24. /* */
  25. /* ******************************************************************** */
  26. /** @package catalog */
  27. include_once("lucene-defs.php");
  28. /** Filesystem access */
  29. ("file-defs.php");
  30.  
  31. // -----------------------------------------------------------------------
  32. /**
  33. * A class which encpasulates an item which can be in the catalog.
  34. * @package catalog
  35. */
  36. class catalogitem extends RenderableObject {
  37. var $cat_id; // Unique catalog record key for the catalog item
  38. var $cat_name = ""; // Name of this catalog item
  39. var $cat_desc = ""; // Full description of catalog item
  40. var $mime_type = ""; // Mime-type of catalog item
  41. var $mime_category = ""; // Mime category eg: document, movie, audio etc.
  42. var $keywords = ""; // Any keywords associated with it
  43. var $category = ""; // Optional user-defined category for item
  44. var $filesize = ""; // Size of catalog item in bytes
  45. var $filepath = ""; // Full local path to the item
  46. var $fileexists = false; // True if file exists at filepath
  47. var $width = 0; // Pixel width of this item
  48. var $height = 0; // Pixel height of this item
  49. var $uploaded_ts = 0; // Unix timestamp of datetime item was added to catalog
  50. var $uploaded = ""; // Datetime uploaded, NICE_FULLDATETIME format
  51. var $errmsg = ""; // Contains error message if invalid
  52. var $valid = false; // True if item was retreived successfully
  53. var $newcat = false; // True if we just created this story
  54.  
  55. // .....................................................................
  56. /** Constructor
  57. * @param integer $id Optional unique catalog item ID
  58. */
  59. function catalogitem($id=false) {
  60. // The all-important catalog ID..
  61. $this->cat_id = $id;
  62. if (!$id) {
  63. $this->newcat = true;
  64. $this->valid = true;
  65. }
  66. // Further processing for existing items..
  67. if (!$this->newcat) {
  68. // Attempt to get the catlog item
  69. $this->get();
  70. }
  71.  
  72. } // catalogitem
  73.  
  74. // .....................................................................
  75. /** Get current or nominated catalog item definition from the database.
  76. * @param integer $id Optional unique catalog item ID to get
  77. */
  78. function get($id=false) {
  79. $res = false;
  80. if ($id) $this->cat_id = $id;
  81. if ($this->cat_id) {
  82. $catQ = dbrecordset("SELECT * FROM ax_catalog WHERE cat_id=$this->cat_id");
  83. if ($catQ->hasdata) {
  84. $this->cat_name = $catQ->field("cat_name");
  85. $this->cat_desc = $catQ->field("cat_desc");
  86. $this->mime_type = $catQ->field("mime_type");
  87. $this->mime_category = $catQ->field("mime_category");
  88. $this->keywords = $catQ->field("keywords");
  89. $this->category = $catQ->field("category");
  90. $this->filesize = $catQ->field("filesize");
  91. $this->filepath = $catQ->field("filepath");
  92. $this->width = $catQ->field("width");
  93. $this->height = $catQ->field("height");
  94. $this->uploaded_ts = datetime_to_timestamp($catQ->field("upload_timestamp"));
  95. $this->uploaded = timestamp_to_displaydate(NICE_FULLDATETIME, $this->uploaded_ts);
  96. // Update status of physical file..
  97. $this->fileexists = file_exists($this->filepath);
  98. $res = true;
  99. $this->newcat = false;
  100. }
  101. else $this->errmsg = "No record of catalog item: $this->cat_id";
  102. }
  103. else $this->errmsg = "No catalog ID was given";
  104. // Did we succeed..?
  105. $this->valid = $res;
  106. return $res;
  107. } // get
  108.  
  109. // .....................................................................
  110. /** Save current catalog item definition to the database. Inserts
  111. * if brand new, else performs an update.
  112. */
  113. function save() {
  114. $res = false;
  115. if ($this->newcat || ($this->cat_id && $this->valid)) {
  116. if ($this->newcat) {
  117. $this->cat_id = get_next_sequencevalue("seq_cat_id", "ax_catalog", "cat_id");
  118. $this->uploaded_ts = time();
  119. $this->uploaded = timestamp_to_displaydate(NICE_FULLDATETIME, $this->uploaded_ts);
  120. $cup = new dbinsert("ax_catalog");
  121. $cup->set("cat_id", $this->cat_id);
  122. $this->newcat = false;
  123. }
  124. else {
  125. $cup = new dbupdate("ax_catalog");
  126. $cup->where("cat_id=$this->cat_id");
  127. }
  128. $cup->set("cat_name", $this->cat_name);
  129. $cup->set("cat_desc", $this->cat_desc);
  130. $cup->set("mime_type", $this->mime_type);
  131. $cup->set("mime_category", $this->mime_category);
  132. $cup->set("keywords", $this->keywords);
  133. $cup->set("category", $this->category);
  134. $cup->set("filesize", $this->filesize);
  135. $cup->set("filepath", $this->filepath);
  136. $cup->set("width", $this->width);
  137. $cup->set("height", $this->height);
  138. $cup->set("upload_timestamp", timestamp_to_datetime($this->uploaded_ts));
  139. $res = $cup->execute();
  140. if ($res) {
  141. // Index to Lucene..
  142. $this->index();
  143. // Update status of physical file..
  144. $this->fileexists = file_exists($this->filepath);
  145. }
  146. }
  147. return $res;
  148. } // save
  149.  
  150. // .....................................................................
  151. /**
  152. * Remove the catalog item from the database and disk. This method
  153. * normally tries to remove the physical file first, and if that succeeds
  154. * it removes the database record. If $deletefile is false then the file
  155. * will be left and only the DB record deleted.
  156. * @param boolean $deletefile If true the physical file will be deleted
  157. * @return boolean True if the operation succeeded, else false.
  158. */
  159. function delete($deletefile=true) {
  160. $deleted = false;
  161. $err = false;
  162. if ($this->cat_id && $this->valid) {
  163. // First, deal to the physical file..
  164. if ($deletefile) {
  165. if (file_exists($this->filepath)) {
  166. if (!is_writeable($this->filepath) || !unlink($this->filepath)) {
  167. $err = true;
  168. }
  169. }
  170. }
  171. // Delete the database record now..
  172. if (!$err) {
  173. $dcat = new dbdelete("ax_catalog");
  174. $dcat->where("cat_id=$this->cat_id");
  175. $res = $dcat->execute();
  176. if ($res) {
  177. // Remove from Lucene index..
  178. $this->unindex();
  179. $this->valid = false;
  180. $deleted = true;
  181. }
  182. }
  183. }
  184. return $deleted;
  185. } // delete
  186.  
  187. // .....................................................................
  188. /**
  189. * Index this catalog item to Lucene.
  190. * If it exists already, index entry for this item is replaced.
  191. */
  192. function index() {
  193. global $CONTEXT;
  194. if ($this->valid && isset($CONTEXT) && $CONTEXT->configvalue("Lucene Site Indexing") ) {
  195. $I = new lucene_indexmsg();
  196. // Make sure these fields are stored..
  197. $I->define_field("catname", "Text", STORED);
  198. $I->define_field("category", "Text", STORED);
  199. $I->define_field("mimecat", "Text", STORED);
  200. $I->define_field("uploaded", "Date", STORED);
  201. $I->define_field("path", "text", STORED);
  202. // Index the fields..
  203. $I->index_field("Id", "CAT_" . $this->cat_id);
  204. $I->index_field("keywords", $this->keywords);
  205. $I->index_field("catname", $this->cat_name);
  206. $I->index_field("category", $this->category);
  207. $I->index_field("mimecat", $this->mime_category);
  208. $I->index_field("uploaded", $this->uploaded_ts);
  209. $I->index_field("path", $this->filepath);
  210. // Index the content..
  211. $allcontent[] = $this->cat_name;
  212. $allcontent[] = $this->cat_desc;
  213. $allcontent[] = $this->keywords;
  214. $I->index_content("CAT_" . $this->cat_id, implode(" ", $allcontent));
  215. $I->send();
  216. }
  217. } // index
  218.  
  219. // .....................................................................
  220. /** Remove this catalog item from the Lucene index. */
  221.  
  222. function unindex() {
  223. global $CONTEXT;
  224. if ($this->valid && isset($CONTEXT) && $CONTEXT->configvalue("Lucene Site Indexing") ) {
  225. $UI = new lucene_unindexmsg();
  226. $UI->unindex("CAT_" . $this->cat_id);
  227. $UI->send();
  228. }
  229. } // unindex
  230.  
  231. // .....................................................................
  232. /** Return the catalog item as a clickable icon.
  233. * @param boolean $autostart Movies etc. if true start automatically
  234. */
  235. function AsIcon($showcontrols=false, $autostart=false, $loop=false) {
  236. global $LIBDIR, $CATALOGDIR;
  237. $icon = "";
  238. $tooltip = basename($this->filepath);
  239. // Set commonsense values for movies..
  240. if (!$showcontrols) {
  241. $autostart = true;
  242. $loop = true;
  243. }
  244. switch ($this->mime_category) {
  245. case "movie":
  246. $media = new MediaObject($CATALOGDIR.'/'.basename($this->filepath), $this->width, $this->height, $autostart, $loop, $showcontrols);
  247. $media->AsIcon($tooltip);
  248. $icon = $media->render();
  249. break;
  250. case "audio":
  251. $media = new MediaObject($CATALOGDIR.'/'.basename($this->filepath), $this->width, $this->height, $autostart, $loop, $showcontrols);
  252. $media->AsIcon($tooltip);
  253. $icon = $media->render();
  254. break;
  255. case "flash":
  256. $media = new FlashObject($CATALOGDIR.'/'.basename($this->filepath), $this->width, $this->height, $autostart, $loop);
  257. $media->AsIcon($tooltip);
  258. $icon = $media->render();
  259. break;
  260. case "document":
  261. $media = new DocumentObject($CATALOGDIR.'/'.basename($this->filepath), $this->width, $this->height);
  262. $media->AsIcon($tooltip);
  263. $icon = $media->render();
  264. break;
  265. case "image":
  266. $media = new Img($CATALOGDIR.'/'.basename($this->filepath), $this->cat_name);
  267. $media->AsIcon($tooltip);
  268. $icon = $media->render();
  269. break;
  270. default:
  271. $icon = $this->AsLink();
  272. } // switch
  273. return $icon;
  274. } // AsIcon
  275.  
  276. // .....................................................................
  277. /** Return the catalog item as image, a clickable icon, or otherwise a link.
  278. * @param boolean $autostart Movies etc. if true start automatically
  279. */
  280. function Insitu($showcontrols=false, $autostart=false, $loop=false) {
  281. global $LIBDIR, $CATALOGDIR;
  282. $catmedia = "";
  283. $tooltip = basename($this->filepath);
  284. // Set commonsense values for movies..
  285. if (!$showcontrols) {
  286. $autostart = true;
  287. $loop = true;
  288. }
  289. switch ($this->mime_category) {
  290. case "movie":
  291. $media = new MediaObject($CATALOGDIR.'/'.basename($this->filepath), $this->width, $this->height, $autostart, $loop, $showcontrols);
  292. $catmedia = $media->render();
  293. break;
  294. case "flash":
  295. $media = new FlashObject($CATALOGDIR.'/'.basename($this->filepath), $this->width, $this->height, $autostart, $loop);
  296. $catmedia = $media->render();
  297. break;
  298. case "image":
  299. $media = new img($CATALOGDIR.'/'.basename($this->filepath), $this->cat_name);
  300. $catmedia = $media->render();
  301. break;
  302. default:
  303. $catmedia = $this->AsIcon();
  304. } // switch
  305. return $catmedia;
  306. } // In-situ
  307.  
  308. // .....................................................................
  309. /** Return the catalog item as a clickable hyperlink. */
  310.  
  311. function AsLink() {
  312. global $LIBDIR, $CATALOGDIR;
  313. include_once("button-defs.php");
  314. $catlink = new Link( $CATALOGDIR.'/'.basename($this->filepath), $this->cat_name);
  315. $catlink->set_linkover_text( basename($this->filepath) );
  316. return $catlink->render();
  317. } // AsLink
  318.  
  319. // .....................................................................
  320. /**
  321. * Process an uploaded media file, and define this catalog item to be
  322. * the newly uploaded file. Assuming a valid upload is performed, this
  323. * catalog item will be added to the database, and the file stahsed
  324. * in the media directory. This method is provided to allow for easy
  325. * handling of upload form submission particularly for the Axyl media
  326. * catalog. Ie. use this if you have a form which is just for uploading
  327. * new images, movies etc. to the Axyl catalog.
  328. * @param string $name Media file associated name
  329. * @param string $category Media file associated category
  330. * @param string $desc Media file full description
  331. * @param string $keywords Media file associated keywords
  332. * @return array Error messages, if any occurred
  333. */
  334. function upload($name="", $category="", $desc="", $keywords="") {
  335. global $CATALOGDIR, $RESPONSE;
  336. global $_overwrite;
  337.  
  338. $this->valid = false;
  339. $errmsgs = array();
  340. $up = new fileupload();
  341. if ($up->uploaded_count >= 1) {
  342. // Process uploaded file..
  343. $file_mime = $up->mimetype;
  344. $path = "$CATALOGDIR/$up->filename";
  345. debugbr($path);
  346. // Check existence/overwrite
  347. if (!file_exists($path) || isset($_overwrite)) {
  348. // Determine mime_category..
  349. if ($mime_category == "" ) {
  350. $mime_category = mimetype_category($file_mime);
  351. if ($mime_category == "") {
  352. $file_mime = mimetype_from_filename($up->filename);
  353. $mime_category = mimetype_category($file_mime);
  354. if ($mime_category == "") {
  355. $errmsgs[] = "That file is of a type unknown to the system [$file_mime].";
  356. }
  357. }
  358. }
  359. // Carry on if legal mime_category..
  360. if ($mime_category != "") {
  361. // Store file in catalog..
  362. if ($up->store($RESPONSE->site_docroot.$CATALOGDIR)) {
  363. // Image metrics..
  364. $width = 0; $height = 0;
  365. if ($mime_category == "image") {
  366. if (extension_loaded("gd") && file_exists($path)) {
  367. $szinfo = getimagesize($path);
  368. $width = $szinfo[0];
  369. $height = $szinfo[1];
  370. }
  371. }
  372. // Store file in database..
  373. if ($name == "") {
  374. $name = basename($path);
  375. }
  376. $this->cat_name = $name;
  377. $this->cat_desc = $desc;
  378. $this->keywords = $keywords;
  379. $this->category = $category;
  380. $this->mime_category = $mime_category;
  381. $this->mime_type = $file_mime;
  382. $this->filesize = $up->filesize;
  383. $this->filepath = $path;
  384. $this->width = $width;
  385. $this->height = $height;
  386. $this->valid = $this->save();
  387. }
  388. else {
  389. $errmsgs[] = $up->error_message();
  390. }
  391. }
  392. else {
  393. $errmsgs[] = "No content type was specified.";
  394. }
  395. }
  396. else {
  397. $errmsgs[] = "File exists. Check the box to overwrite.";
  398. $overwrite_chk = true;
  399. }
  400. }
  401. else {
  402. $errmsgs[] = "Nothing was uploaded.";
  403. }
  404. return $errmsgs;
  405. } // upload
  406.  
  407. // .....................................................................
  408. /**
  409. * Render the catalog item. We render it as either and icon or a link,
  410. * both being clickable to view the content.
  411. * @param string $mode Mode of rendering: 'icon' or 'link'.
  412. * @return string HTML rendering of this catalog item in given mode
  413. */
  414. function html($mode="link") {
  415. $s = "";
  416. switch ($mode) {
  417. case "icon":
  418. $s = $this->AsIcon();
  419. break;
  420. case "insitu":
  421. $s = $this->Insitu(false);
  422. break;
  423. default: // case "link"
  424. $s = $this->AsLink();
  425. } // switch
  426. return $s;
  427. } // html
  428.  
  429.  
  430.  
  431. } // catalogitem class
  432. // -----------------------------------------------------------------------
  433.  
  434. /**
  435. * This class encapsulates a media catalog, which is a collection of
  436. * catalogitem objects.
  437. * @package catalog
  438. */
  439. class catalog extends RenderableObject {
  440. /** The array of catalogitem objects in this catalog */
  441.  
  442. var $catalogitems = array();
  443. /** The array of categories (optional) */
  444.  
  445. var $categories = array();
  446.  
  447. // .....................................................................
  448. /** Constructor */
  449.  
  450. function catalog($catalogitems=false) {
  451. if (is_array($catalogitems)) {
  452. $this->catalogitems = $catalogitems;
  453. }
  454. } // catalog
  455.  
  456. // .....................................................................
  457. /** Return the count of items in the catalog currently.
  458. * @return integer Count of items in the catalog.
  459. */
  460. function itemcount() {
  461. return count($this->catalogitems);
  462. }
  463. // .....................................................................
  464. /**
  465. * Define the list of user categories which is used to categorise
  466. * the catalog items in this catalog. This is submitted as an
  467. * associative array with a single word string as key, and a multi-word
  468. * string as the value (category description).
  469. * @param array $cats Array of catalog categories: ID => description
  470. */
  471. function set_categories($categories) {
  472. if (is_array($categories)) {
  473. $this->categories = $categories;
  474. }
  475. } // define_categories
  476.  
  477. // .....................................................................
  478. /**
  479. * Add catalog item to the catalog. The catalog will add the new item
  480. * by cat_id. If that ID already exists it is overwritten.
  481. * @param object $catitem The catalog item to add
  482. */
  483. function additem($catitem) {
  484. if (is_object($catitem) && is_a($catitem, "catalogitem")) {
  485. $this->catalogitems[$catitem->cat_id] = $catitem;
  486. }
  487. } // additem
  488.  
  489. // .....................................................................
  490. /**
  491. * Perform a search for catalog items. This method will use Lucene
  492. * if it is available and keywords are provided, otherwise it will
  493. * just go to the database. The end result is that this catalog is
  494. * populated with the results of the search, having been cleared out
  495. * beforehand.
  496. * @param string $keywords Keywords to search for
  497. * @param array $mimecats Array of content types (mime categories)
  498. * @param array $categories Array of media user-categories
  499. * @param strong $sortby Sort order for results
  500. */
  501. function search($keywords="", $mimecats="", $categories="", $sortby="") {
  502. global $CONTEXT;
  503.  
  504. // Initialise catalog..
  505. $this->catalogitems = array();
  506.  
  507. // LUCENE KEYWORD SEARCH..
  508. if ($keywords != "" && isset($CONTEXT) && $CONTEXT->configvalue("Lucene Site Indexing")) {
  509. $thesearch = new lucene_search();
  510.  
  511. // CONTENT TYPES
  512. if (is_array($mimecats) && count($mimecats) > 0) {
  513. $terms = array();
  514. foreach ($mimecats as $mimecat) {
  515. // The nullstring represents 'Any' or 'All'..
  516. if ($mimecat != "") $terms[] = $mimecat;
  517. }
  518. if (count($terms) > 0) {
  519. $thesearch->must_match( "mimecat:(" . implode(" ", $terms) . ")" );
  520. }
  521. }
  522.  
  523. // CATEGORIES
  524. $thesearch->does_not_match( "category:sitecontent" );
  525. if (is_array($categories) && count($categories) > 0) {
  526. $terms = array();
  527. foreach ($categories as $cat) {
  528. // The nullstring represents 'Any' or 'All'..
  529. if ($cat != "") $terms[] = $cat;
  530. }
  531. if (count($terms) > 0) {
  532. $thesearch->must_match( "category:(" . implode(" ", $terms) . ")" );
  533. }
  534. }
  535.  
  536. // KEYWORDS
  537. // Keywords matching. We search the keywords fields, and
  538. // also the default text field..
  539. if ($keywords != "") {
  540. $words = explode(" ", $keywords);
  541. $terms = array();
  542. foreach ($words as $word) {
  543. if ($word != "") $terms[] = "$word^2";
  544. }
  545. $keyword_terms = implode(" ", $terms);
  546.  
  547. $terms = array();
  548. foreach ($words as $word) {
  549. if ($word != "") $terms[] = $word;
  550. }
  551. $text_terms = implode(" ", $terms);
  552. // Construct the search terms..
  553. $thesearch->must_match( "(keywords:($keyword_terms) ($text_terms))" );
  554. }
  555.  
  556. // SORT ORDER
  557. switch ($sortby) {
  558. case "rank":
  559. $thesearch->set_sortorder("RANK");
  560. break;
  561. case "uploaded":
  562. $thesearch->set_sortorder("uploaded:Date:Desc");
  563. break;
  564. case "catname":
  565. $thesearch->set_sortorder("catname");
  566. break;
  567. case "mimecat":
  568. $thesearch->set_sortorder("mimecat,uploaded:Date:Desc");
  569. break;
  570. case "category":
  571. $thesearch->set_sortorder("category,uploaded:Date:Desc");
  572. break;
  573. default:
  574. $thesearch->set_sortorder("uploaded:Date:Desc");
  575. break;
  576. } // switch
  577.  
  578. // RETURN FIELDS
  579. $thesearch->set_returnfields("catname,category,mimecat,uploaded:Date,path");
  580. $thesearch->execute();
  581.  
  582. // Populate the catalog..
  583. if ($thesearch->hitcount > 0) {
  584. foreach ($thesearch->hit as $hit) {
  585. $ci = new catalogitem();
  586. $bits = explode("_", $hit["Id"]);
  587. $ci->cat_id = $bits[1];
  588. $ci->cat_name = $hit["catname"];
  589. $ci->category = $hit["category"];
  590. $ci->mime_category = $hit["mimecat"];
  591. $ci->uploaded_ts = $hit["uploaded"];
  592. $ci->uploaded = timestamp_to_displaydate(NICE_FULLDATETIME, $ci->uploaded_ts);
  593. $ci->filepath = $hit["path"];
  594. $ci->valid = true;
  595. $ci->newcat = false;
  596. $this->catalogitems[$ci->cat_id] = $ci;
  597. }
  598. }
  599.  
  600. } // got keywords & lucene
  601. else {
  602. $cQ = new dbselect("ax_catalog");
  603. $wheres = array();
  604.  
  605. // CONTENT TYPES
  606. if (is_array($mimecats) && count($mimecats) > 0) {
  607. // The nullstring represents 'Any' or 'All'..
  608. if (!in_array("", $mimecats)) {
  609. $wheres[] = "mime_category IN ('" . implode("','", $mimecats) . "')";
  610. }
  611. }
  612.  
  613. // CATEGORIES
  614. if (is_array($categories) && count($categories) > 0) {
  615. // The nullstring represents 'Any' or 'All'..
  616. if (!in_array("", $categories)) {
  617. if ($where != "") $where .= " AND ";
  618. $wheres[] = "category IN ('" . implode("','", $categories) . "')";
  619. }
  620. }
  621. if (count($wheres) > 0) {
  622. $cQ->where( implode(" AND ", $wheres) );
  623. }
  624.  
  625. // SORT ORDER
  626. switch ($sortby) {
  627. case "uploaded":
  628. $cQ->orderby("upload_timestamp DESC");
  629. break;
  630. case "catname":
  631. $cQ->orderby("cat_name");
  632. break;
  633. case "mimecat":
  634. $cQ->orderby("mime_category");
  635. break;
  636. case "category":
  637. $cQ->orderby("category");
  638. break;
  639. default:
  640. $cQ->orderby("upload_timestamp DESC");
  641. break;
  642. } // switch
  643.  
  644. $cQ->execute();
  645. if ($cQ->hasdata) {
  646. do {
  647. $ci = new catalogitem();
  648. $ci->cat_id = $cQ->field("cat_id");
  649. $ci->cat_name = $cQ->field("cat_name");
  650. $ci->category = $cQ->field("category");
  651. $ci->mime_category = $cQ->field("mime_category");
  652. $ci->uploaded_ts = datetime_to_timestamp($cQ->field("upload_timestamp"));
  653. $ci->uploaded = timestamp_to_displaydate(NICE_FULLDATETIME, $ci->uploaded_ts);
  654. $ci->filepath = $cQ->field("filepath");
  655. $ci->valid = true;
  656. $ci->newcat = false;
  657. $this->catalogitems[$ci->cat_id] = $ci;
  658. } while ($cQ->get_next());
  659. }
  660. }
  661.  
  662. } // search
  663.  
  664. // .....................................................................
  665. /** Return the HTML for this catalog. Returns the list of catalog items
  666. * as an HTML table.
  667. * @return string HTML table containing the whole catalog
  668. */
  669. function html() {
  670. global $RESPONSE, $LIBDIR;
  671. return $s;
  672. } // html
  673.  
  674.  
  675.  
  676. } // catalog class
  677. // -----------------------------------------------------------------------
  678.  
  679. ?>

Documentation generated by phpDocumentor 1.3.0RC3