summaryrefslogtreecommitdiff
path: root/lib/api/kolab_api_service_form_value.php
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2012-02-20 11:29:50 (GMT)
committerAleksander Machniak <alec@alec.pl>2012-02-20 11:29:50 (GMT)
commit47b4ba7f0750db379c7e07ba489aeaea8380444d (patch)
tree8ca2c969960b1477d5d8e784cff9652f2cf3c3d4 /lib/api/kolab_api_service_form_value.php
parentfe489152f2199f6a6862529cf1c9cde2b50437e6 (diff)
downloadkolab-wap-47b4ba7f0750db379c7e07ba489aeaea8380444d.tar.gz
Simplified code with user_type_attributes() method
Diffstat (limited to 'lib/api/kolab_api_service_form_value.php')
-rw-r--r--lib/api/kolab_api_service_form_value.php36
1 files changed, 4 insertions, 32 deletions
diff --git a/lib/api/kolab_api_service_form_value.php b/lib/api/kolab_api_service_form_value.php
index 0d16bdb..3b9270a 100644
--- a/lib/api/kolab_api_service_form_value.php
+++ b/lib/api/kolab_api_service_form_value.php
@@ -21,14 +21,7 @@ class kolab_api_service_form_value extends kolab_api_service
public function generate_cn($getdata, $postdata)
{
- if (!isset($postdata['user_type_id'])) {
- throw new Exception("No user type ID specified", 34);
- }
-
- $sql_result = $this->db->query("SELECT attributes FROM user_types WHERE id = ?", $postdata['user_type_id']);
- $user_type = $this->db->fetch_assoc($sql_result);
-
- $uta = json_decode(unserialize($user_type['attributes']), true);
+ $uta = $this->user_type_attributes($postdata['user_type_id']);
if (isset($uta['auto_form_fields']) && isset($uta['auto_form_fields']['cn'])) {
// Use Data Please
@@ -44,14 +37,7 @@ class kolab_api_service_form_value extends kolab_api_service
public function generate_displayname($getdata, $postdata)
{
- if (!isset($postdata['user_type_id'])) {
- throw new Exception("No user type ID specified", 34);
- }
-
- $sql_result = $this->db->query("SELECT attributes FROM user_types WHERE id = ?", $postdata['user_type_id']);
- $user_type = $this->db->fetch_assoc($sql_result);
-
- $uta = json_decode(unserialize($user_type['attributes']), true);
+ $uta = $this->user_type_attributes($postdata['user_type_id']);
if (isset($uta['auto_form_fields']) && isset($uta['auto_form_fields']['displayname'])) {
// Use Data Please
@@ -68,14 +54,7 @@ class kolab_api_service_form_value extends kolab_api_service
public function generate_mail($getdata, $postdata)
{
- if (!isset($postdata['user_type_id'])) {
- throw new Exception("No user type ID specified", 34);
- }
-
- $sql_result = $this->db->query("SELECT attributes FROM user_types WHERE id = ?", $postdata['user_type_id']);
- $user_type = $this->db->fetch_assoc($sql_result);
-
- $uta = json_decode(unserialize($user_type['attributes']), true);
+ $uta = $this->user_type_attributes($postdata['user_type_id']);
if (isset($uta['auto_form_fields']) && isset($uta['auto_form_fields']['mail'])) {
// Use Data Please
@@ -118,14 +97,7 @@ class kolab_api_service_form_value extends kolab_api_service
public function generate_uid($getdata, $postdata)
{
- if (!isset($postdata['user_type_id'])) {
- throw new Exception("No user type ID specified", 34);
- }
-
- $sql_result = $this->db->query("SELECT attributes FROM user_types WHERE id = ?", $postdata['user_type_id']);
- $user_type = $this->db->fetch_assoc($sql_result);
-
- $uta = json_decode(unserialize($user_type['attributes']), true);
+ $uta = $this->user_type_attributes($postdata['user_type_id']);
if (isset($uta['auto_form_fields']) && isset($uta['auto_form_fields']['uid'])) {
// Use Data Please