Error(); if (!$Group || !is_object($Group)) { $this->setNotValidGroupObjectError(); return false; } if ($Group->isError()) { $this->setError('DocumentManager:: '. $Group->getErrorMessage()); return false; } $this->Group =& $Group; return true; } /** * getGroup - get the Group object this Document is associated with. * * @return Object The Group object. */ function &getGroup() { return $this->Group; } /** * getTrashID - the trash doc_group id for this DocumentManager. * * @return integer The trash doc_group id. */ function getTrashID() { if (isset($this->data_array['trashid'])) return $this->data_array['trashid']; $res = db_query_params('SELECT doc_group from doc_groups WHERE groupname = $1 AND group_id = $2 AND stateid = $3', array('.trash', $this->Group->getID(), '2')); if (db_numrows($res) == 1) { $arr = db_fetch_array($res); $this->data_array['trashid'] = $arr['doc_group']; return $this->data_array['trashid']; } else { $dg = new DocumentGroup($this->Group); $dg->create('.trash'); $dg->setStateID('2'); return $dg->getID(); } return false; } /** * cleanTrash - delete all items in trash for this DocumentManager * * @return boolean true on success */ function cleanTrash() { $trashId = $this->getTrashID(); if ($trashId !== -1) { db_begin(); $emptyFile = db_query_params('DELETE FROM doc_data WHERE stateid=$1 and group_id=$2', array('2', $this->Group->getID())); if (!$emptyFile) { db_rollback(); return false; } $emptyDir = db_query_params('DELETE FROM doc_groups WHERE stateid=$1 and group_id=$2 and groupname !=$3', array('2', $this->Group->getID(), '.trash')); if (!$emptyDir) { db_rollback(); return false; } db_commit(); return true; } return false; } /** * getTree - display recursively the content of the doc_group. Only doc_groups within doc_groups. * * @param integer the selected directory * @param string the type of link in the menu * @param integer the doc_group to start: default 0 */ function getTree($selecteddir, $linkmenu, $docGroupId = 0) { global $g; // the master group of all the groups .... anyway. $dg = new DocumentGroup($this->Group); switch ($linkmenu) { case "listtrashfile": { $stateId = 2; break; } default: { $stateId = 1; break; } } $subGroupIdArr = $dg->getSubgroup($docGroupId, $stateId); if (sizeof($subGroupIdArr)) { echo ''; } } } ?>