summaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-06-21 13:16:40 +0100
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2012-06-21 13:16:58 +0100
commitdf3b154d86cfe02c0ea92f09e27eace8c30c7ab9 (patch)
tree0b4c6ba29cd123c9cb89d0d0abe0ecfc9bd5b14f /doc
parent68a984a1638c5513e2e066305c1957c449d2f645 (diff)
downloadwebadmin-df3b154d86cfe02c0ea92f09e27eace8c30c7ab9.tar.gz
Add sample to insert resource_types
Diffstat (limited to 'doc')
-rw-r--r--doc/sample-insert-resource_types.php92
1 files changed, 92 insertions, 0 deletions
diff --git a/doc/sample-insert-resource_types.php b/doc/sample-insert-resource_types.php
new file mode 100644
index 0000000..45efd23
--- /dev/null
+++ b/doc/sample-insert-resource_types.php
@@ -0,0 +1,92 @@
+#!/usr/bin/php
+<?php
+
+ if (isset($_SERVER["REQUEST_METHOD"]) && !empty($SERVER["REQUEST_METHOD"])) {
+ die("Not intended for execution through the webserver, sorry!");
+ }
+
+ require_once("lib/functions.php");
+
+ $db = SQL::get_instance();
+
+ $result = $db->query("TRUNCATE `resource_types`");
+
+ $attributes = Array(
+ "auto_form_fields" => Array(
+ "mail" => Array(
+ "data" => Array(
+ "cn",
+ ),
+ ),
+ ),
+ "fields" => Array(
+ "objectclass" => Array(
+ "top",
+ "groupofuniquenames",
+ "kolabgroupofuniquenames",
+ ),
+ ),
+ "form_fields" => Array(
+ "cn" => Array(),
+ "uniquemember" => Array(
+ "type" => "list",
+ "autocomplete" => true,
+ "optional" => true,
+ ),
+ ),
+ );
+
+ $result = $db->query("INSERT INTO `resource_types` (`key`, `name`, `description`, `attributes`) " .
+ "VALUES ('collection','Resource Collection', 'A collection or pool of resources'," .
+ "'" . json_encode($attributes) . "')");
+
+ $attributes = Array(
+ "auto_form_fields" => Array(
+ "cn" => Array(
+ "data" => Array(
+ "cn",
+ ),
+ ),
+ "kolabtargetfolder" => Array(
+ "data" => Array(
+ "cn",
+ ),
+ ),
+ "mail" => Array(
+ "data" => Array(
+ "cn",
+ ),
+ ),
+ ),
+ "fields" => Array(
+ "objectclass" => Array(
+ "top",
+ "kolabsharedfolder",
+ "mailrecipient",
+ ),
+ "kolabfoldertype" => Array(
+ "event",
+ ),
+ ),
+ "form_fields" => Array(
+ "cn" => Array(),
+ ),
+ );
+
+ $result = $db->query("INSERT INTO `resource_types` (`key`, `name`, `description`, `attributes`) " .
+ "VALUES ('car','Car', 'A car'," .
+ "'" . json_encode($attributes) . "')");
+
+ $result = $db->query("INSERT INTO `resource_types` (`key`, `name`, `description`, `attributes`) " .
+ "VALUES ('confroom','Conference Room', 'A conference room'," .
+ "'" . json_encode($attributes) . "')");
+
+ $result = $db->query("INSERT INTO `resource_types` (`key`, `name`, `description`, `attributes`) " .
+ "VALUES ('beamer','Beamer', 'A portable beamer'," .
+ "'" . json_encode($attributes) . "')");
+
+ $result = $db->query("INSERT INTO `resource_types` (`key`, `name`, `description`, `attributes`) " .
+ "VALUES ('footballtickets','Football Season Tickets', 'Season tickets to the game (pretty good seats too!)'," .
+ "'" . json_encode($attributes) . "')");
+
+?>