/** * Add galleries to the gallery select list according to the permissions of the logged in user * @param level in gallery tree * @param integer ID of current node in gallery tree * @param integer ID of selected gallery * @param list of permitted galleries * @return HTML to add */ function addToGalSelectList($level, $galid, $gallery_id, $galleries) { // provided by Klaas on Dec.13.2007 $database = JFactory::getDBO(); $dropdown_html = ""; $database->setQuery("SELECT * FROM #__rsgallery2_galleries WHERE parent = '{$galid}' ORDER BY ordering ASC"); $rows = $database->loadObjectList(); foreach ($rows as $row) { $dropdown_html .= "<option value=\"{$row->id}\""; // Disable when action not allowed or user not owner if (!in_array($row->id, $galleries)) { $dropdown_html .= " DISABLED"; } if ($row->id == $gallery_id) { $dropdown_html .= " SELECTED"; } $dropdown_html .= " >"; $indent = ""; for ($i = 0; $i < $level; $i++) { $indent .= " "; } if ($level) { $indent .= "|-- "; } $dropdown_html .= $indent . $row->name . "</option>\n"; $dropdown_html .= galleryUtils::addToGalSelectList($level + 1, $row->id, $gallery_id, $galleries); } return $dropdown_html; }