/** * This function recursively creates the children pages for the given $cpage_id. * * @param ADONewConnection $db The database connection * @param integer $cpage_id * @param integer $COMMUNITY_ID The community ID of the community to copy. * @param integer $new_parent_id * @param integer $new_community_id * @param integer the proxy id for the user who owns the community. */ function create_child_pages($db, $cpage_id, $COMMUNITY_ID, $new_parent_id, $new_community_id, $proxy_id) { $query = "\tSELECT *\n\t\t\t\tFROM " . DATABASE_NAME . ".`community_pages`\n\t\t\t\tWHERE `community_id` = " . $COMMUNITY_ID . "\n\t\t\t\tAND `parent_id` = " . $db->qstr($cpage_id) . "\n\t\t\t\tORDER BY cpage_id ASC"; $community_pages_arr = $db->GetAll($query); if ($community_pages_arr) { //insert every child page. foreach ($community_pages_arr as $page) { $page["parent_id"] = $new_parent_id; $new_cpage_id = insert_community_page($db, $page, $new_community_id, $proxy_id); create_child_pages($db, $page["cpage_id"], $COMMUNITY_ID, $new_cpage_id, $new_community_id, $proxy_id); } } }
/** * See ADOConnection::GetAll() * * @access public * @param mixed * @return mixed */ public function _getAll($sql) { return $this->db->GetAll($sql); }