コード例 #1
0
/**
 * @param Sabre_DAV_Server $server
 * @param Sabre_CalDAV_Calendar $calendar
 * @param string $calendarobject_uri
 * @param string $with_privilege
 * @return null|Sabre\VObject\Component\VCalendar
 */
function dav_get_current_user_calendarobject(&$server, &$calendar, $calendarobject_uri, $with_privilege = "")
{
    $obj = $calendar->getChild($calendarobject_uri);
    if ($with_privilege == "") {
        $with_privilege = DAV_ACL_READ;
    }
    $a = get_app();
    $uri = "/calendars/" . strtolower($a->user["nickname"]) . "/" . $calendar->getName() . "/" . $calendarobject_uri;
    /** @var Sabre_DAVACL_Plugin $aclplugin  */
    $aclplugin = $server->getPlugin("acl");
    if (!$aclplugin->checkPrivileges($uri, $with_privilege, Sabre_DAVACL_Plugin::R_PARENT, false)) {
        return null;
    }
    $data = $obj->get();
    $vObject = Sabre\VObject\Reader::read($data);
    return $vObject;
}
コード例 #2
0
 function testCreateFileNoSupportedComponents()
 {
     $file = fopen('php://memory', 'r+');
     fwrite($file, Sabre_CalDAV_TestUtil::getTestCalendarData());
     rewind($file);
     $calendar = new Sabre_CalDAV_Calendar($this->principalBackend, $this->backend, $this->calendars[1]);
     $calendar->createFile('hello', $file);
     $file = $calendar->getChild('hello');
     $this->assertTrue($file instanceof Sabre_CalDAV_CalendarObject);
 }