/** * Get full structure from database * @param $pStructureId structure for which we want structure * @return full structure */ function getStructure(&$pParamHash) { global $gBitSystem, $gLibertySystem; // make sure we have the correct id to get the entire structure LibertyStructure::getRootStructureId($pParamHash); $ret = FALSE; if (@BitBase::verifyId($pParamHash['root_structure_id'])) { // Get all nodes for this structure $query = "SELECT ls.*, lc.`user_id`, lc.`title`, lc.`content_type_guid`, uu.`login`, uu.`real_name`\n\t\t\t\tFROM `" . BIT_DB_PREFIX . "liberty_structures` ls\n\t\t\t\tINNER JOIN `" . BIT_DB_PREFIX . "liberty_content` lc ON ( ls.`content_id` = lc.`content_id` )\n\t\t\t\tINNER JOIN `" . BIT_DB_PREFIX . "users_users` uu ON ( uu.`user_id` = lc.`user_id` )\n\t\t\t\tWHERE ls.`root_structure_id` = ? ORDER BY `pos` ASC"; $result = $this->mDb->query($query, array($pParamHash['root_structure_id'])); $subs = array(); $row_max = $result->numRows(); $contentTypes = $gLibertySystem->mContentTypes; while ($res = $result->fetchRow()) { $aux = array(); $aux = $res; if (!empty($contentTypes[$res['content_type_guid']])) { // quick alias for code readability $type =& $contentTypes[$res['content_type_guid']]; if (empty($type['content_object'])) { // create *one* object for each object *type* to call virtual methods. $handlerFile = $gBitSystem->mPackages[$type['handler_package']]['path'] . $type['handler_file']; if (file_exists($handlerFile)) { include_once $handlerFile; if (class_exists($type['handler_class'])) { $type['content_object'] = new $type['handler_class'](); } } } if (!empty($pParamHash['thumbnail_size'])) { $aux['content_object'] = new $type['handler_class'](NULL, $aux['content_id']); if ($aux['content_object']->load()) { $aux['thumbnail_url'] = $aux['content_object']->getThumbnailUrl($pParamHash['thumbnail_size']); } } if (!empty($type['content_object']) && is_object($type['content_object'])) { $aux['title'] = $type['content_object']->getTitleFromHash($aux); } $ret[$aux['structure_id']] = $aux; } } } return $ret; }