Source for file sortcolclass.php

Documentation is available at sortcolclass.php


1 <?php
2 /**
3 * @author Jan H. Andersen <jha@ipwsystems.dk>
4 * @author Martin R. Larsen <mrl@ipwsystems.dk>
5 * @copyright {@link http://www.ipwsystems.dk/ IPW Systems a.s}
6 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
7 * @package METAjour
8 * @subpackage core
9 * $Id: sortcolclass.php,v 1.1 2005/02/10 08:23:42 SYSTEM Exp $
10 */
11
12 require_once(dirname(__FILE__) . '/basicclass.php');
13
14 class sortcol extends basic {
15
16 function sortcol() {
17 $this->basic();
18 $this->addcolumn('name', 0, UI_CLASS);
19 $this->addcolumn('makedefault', 0, UI_CHECKBOX);
20
21 $this->removeview('createvariant');
22 $this->removeview('createfuture');
23 $this->removeview('approvepublish');
24 $this->removeview('requestapproval');
25 $this->removeview('category');
26 }
27
28 function prv_updateobject($objectid, $arr) {
29 basic::prv_updateobject($objectid, $arr);
30 $db =& $this->_adodb;
31 $db->execute("delete from sortcol_data where objectid = $objectid");
32 $i = 0;
33 if (is_array($arr['fieldname'])) {
34 foreach($arr['fieldname'] as $name) {
35 if ($name != '') {
36 $res = $db->execute(sprintf("insert into sortcol_data (objectid, name, way, sortorder) values (%d,%s,%s,%s)",
37 $objectid,
38 $db->qstr($arr['fieldname'][$i]),
39 $db->qstr($arr['fieldway'][$i]),
40 $db->qstr($arr['fieldsortorder'][$i])));
41 if ($res === false) {
42 $this->errorhandler->seterror('sortcol::prv_updateobject: ' . $db->errormsg());
43 }
44 }
45
46 $i++;
47 }
48 }
49 }
50
51 function prv_readobject($objectid) {
52 $res =& $this->_adodb->execute("select name, way, sortorder from sortcol_data where objectid = $objectid order by sortorder");
53 if ($res === false) {
54 $this->errorhandler->seterror($this->_adodb->errormsg());
55 return array();
56 }
57 $arr['fieldname'] = array();
58 $arr['fieldsortorder'] = array();
59 $arr['fieldway'] = array();
60 while ($row = $res->fetchrow()) {
61 $arr['fieldname'][] = $row['name'];
62 $arr['fieldsortorder'][] = $row['sortorder'];
63 $arr['fieldway'][] = $row['way'];
64 }
65 return $arr;
66 }
67
68 }
69
70 ?>

Documentation generated on Thu, 9 Jun 2005 06:53:17 +0200 by phpDocumentor 1.2.3