[Mapbender-commits] r3227 - trunk/mapbender/http/classes
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Wed Nov 12 03:53:01 EST 2008
Author: christoph
Date: 2008-11-12 03:53:01 -0500 (Wed, 12 Nov 2008)
New Revision: 3227
Modified:
trunk/mapbender/http/classes/class_administration.php
Log:
merged from noframes branch. I'm not sure if these functions are needed.
Modified: trunk/mapbender/http/classes/class_administration.php
===================================================================
--- trunk/mapbender/http/classes/class_administration.php 2008-11-12 08:52:12 UTC (rev 3226)
+++ trunk/mapbender/http/classes/class_administration.php 2008-11-12 08:53:01 UTC (rev 3227)
@@ -585,6 +585,83 @@
}
}
+ function getAllFilteredUsers($owner) {
+ $allUsers = array();
+ $sql = "SELECT mb_user_id,mb_user_name,mb_user_email FROM mb_user ";
+ $sql .= " WHERE mb_user_owner = $1 ORDER BY mb_user_name ";
+ $v = array($owner);
+ $t = array('i');
+ $res = db_prep_query($sql, $v, $t);
+ while ($row = db_fetch_array($res)) {
+ array_push($allUsers, array("mb_user_id" => $row["mb_user_id"], "mb_user_name" => $row["mb_user_name"], "mb_user_email" => $row["mb_user_email"]));
+ }
+ $json = new Mapbender_JSON();
+ $output = $json->encode($allUsers);
+
+ header("Content-type:text/plain; charset=utf-8");
+ return $output;
+ }
+
+ function getAllUserColumns($userId) {
+ $userArray = array();
+ $sql = "SELECT * FROM mb_user WHERE mb_user_id = $1";
+ $v = array($userId);
+ $t = array('s');
+ $res = db_prep_query($sql,$v,$t);
+ while ($row = db_fetch_array($res)) {
+ foreach ($row as $key => $value){
+ if (is_int($key)==false) {
+ array_push($userArray, array("id" => $key, "value" => $value));
+ }
+ }
+ }
+ $json = new Mapbender_JSON();
+ $output = $json->encode($userArray);
+
+ header("Content-type:text/plain; charset=utf-8");
+ return $output;
+ }
+
+ /**
+ * Returns an array of column names and fieldtype for a table.
+ *
+ */
+ function getTableColumns($table) {
+ $sql = "SELECT * FROM $table LIMIT 1";
+ $columnArray = array();
+
+ $v = array();
+ $t = array();
+ $res = db_prep_query($sql,$v,$t);
+
+ $i = 0;
+ while ($i < db_num_fields($res)) {
+ if(db_field_type($res, $i)=="varchar") {
+ $fieldType = "s";
+ }
+ else {
+ $fieldType = "i";
+ }
+ $columnArray[db_fieldname($res, $i)] = $fieldType;
+ $i++;
+ }
+
+ return $columnArray;
+ }
+
+ function deleteTableRecord($table,$keyField,$keyFieldValue) {
+ $sql = "DELETE FROM $table WHERE $keyField = $1";
+ $v = array($keyFieldValue);
+ $t = array('s');
+ $res = db_prep_query($sql,$v,$t);
+ if (!$res) {
+ return false;
+ }
+ else {
+ return true;
+ }
+ }
+
function getUserIdByUserName($username){
$sql = "SELECT mb_user_id FROM mb_user ";
$sql .= "WHERE mb_user_name = $1 GROUP BY mb_user_id";
More information about the Mapbender_commits
mailing list