Esempio n. 1
0
<?php

require_once "zogi.php";
if (isset($_POST["username"])) {
    $ogo = new OpenGroupwareServer("tor", $_POST["username"], $_POST["password"]);
    $accountId = @$ogo->getLoginAccountId();
    if ($accountId == null) {
        print 'Cannot connect to groupware using provided credentials';
        die(0);
    }
    print 'Retrieving enterprise...<br/>';
    $enterprise = $ogo->getObject(3049570, 32767);
    printf('Name: %s<br/>', $enterprise['name']);
    /* Change the division, this demonstrates using getSubkeyReference 
       A reference to the dictionary (keyed array) in _COMPANYVALUES
       with an "attribute" equal to "division" is returned.  Then its
       other components can be modified. */
    $cv =& $ogo->getSubkeyReference($enterprise, '_COMPANYVALUES', 'attribute', 'division');
    printf('Division: %s<br/>', $cv['value']);
    $cv['value'] = 'Test';
    $enterprise = $ogo->putObject($enterprise);
    $cv =& $ogo->getSubkeyReference($enterprise, '_COMPANYVALUES', 'attribute', 'division');
    printf('Division: %s<br/>', $cv['value']);
    $cv['value'] = 'MVP';
    $enterprise = $ogo->putObject($enterprise);
    $cv =& $ogo->getSubkeyReference($enterprise, '_COMPANYVALUES', 'attribute', 'division');
    printf('Division: %s<br/>', $cv['value']);
    /* Display the city from the ship address */
    $ship =& $ogo->getSubkeyReference($enterprise, '_ADDRESSES', 'type', 'ship');
    printf('City: %s<br/>', $ship['city']);
} else {
Esempio n. 2
0
$property2['propertyName'] = '{http://www.example.com/properties/ext-attr}myStringAttribute';
$property2['value'] = 'Hi there';
/* We are adding two properties */
$app['_PROPERTIES'] = array($property1, $property2);
$app['_FLAGS'] = 'ignoreConflicts';
$app = $ogo->putObject($app);
print_r($app['_PROPERTIES']);
print "<BR/>--Update, changing properties--<BR/>";
$property1 = array();
$property1['propertyName'] = '{http://www.example.com/properties/ext-attr}myIntAttribute';
$property1['value'] = 4;
$property2 = array();
$property2['namespace'] = 'http://www.example.com/properties/ext-attr';
$property2['attribute'] = 'myStringAttribute';
$property2['value'] = 'Ho there';
$app['_PROPERTIES'] = array($property1, $property2);
$app['_FLAGS'] = 'ignoreConflicts';
$app = $ogo->putObject($app);
print_r($app['_PROPERTIES']);
print "<BR/>--Update, deleting property--<BR/>";
/* We are dropping the first property */
$app['_PROPERTIES'] = array($app['_PROPERTIES'][1]);
$app['_FLAGS'] = 'ignoreConflicts';
$app = $ogo->putObject($app);
print_r($app['_PROPERTIES']);
print "<BR/>--Get--<BR/>";
$app = $ogo->getObject($app['objectId'], 65535);
print_r($app);
print "<BR/>--Delete--<BR/>";
#app = server.zogi.deleteObject(app, ['deleteCycle'])
print_r($ogo->deleteObject($app['objectId']));