コード例 #1
0
ファイル: XML.php プロジェクト: ddolbik/sabre-vobject
 /**
  * Create a property.
  *
  * @param Component $parentComponent
  * @param string $name
  * @param array $parameters
  * @param string $type
  * @param mixed $value
  *
  * @return void
  */
 protected function createProperty(Component $parentComponent, $name, $parameters, $type, $value)
 {
     $property = $this->root->createProperty($name, null, $parameters, $type);
     $parentComponent->add($property);
     $property->setXmlValue($value);
 }
コード例 #2
0
ファイル: cp_calendar.php プロジェクト: shiyake/php-ihome
    if ($_POST['leadout-type-person']) {
        $sqlperson = $sql . " and bgcolor='#75D906'";
        $query = $_SGLOBAL['db']->query($sqlperson);
        while ($res = $_SGLOBAL['db']->fetch_array($query)) {
            $item = array("id" => $res['id'], "content" => $res['content'], "place" => $res['place'], "start_t" => $res['start_t'], "end_t" => $res['end_t'], "bgcolor" => $res['bgcolor'], "dateline" => $res['dateline']);
            $event[] = $item;
        }
    }
    include S_ROOT . './source/vendor/autoload.php';
    $vcal = Sabre\VObject\Document::create('VCALENDAR');
    $vcal->VERSION = '2.0';
    $vcal->PRODID = '-//SabreDAV//SabreDAV//EN';
    $vcal->CALSCALE = 'GREGORIAN';
    var_dump($vcal);
    for ($i = 0; $i < count($event); $i++) {
        $todo = Sabre\VObject\Document::create('VTODO');
        $todo->summary = $event[$i]['content'];
        $todo->dtstart = $event[$i]['start_t'];
        $todo->ddtend = $event[$i]['end_t'];
        $vcal->add($todo);
        var_dump($todo);
    }
    file_put_contents('output.ics', $vcal->serialize());
    echo json_encode($event);
    exit;
} elseif ($op == 'delete') {
    //删除
    if (submitcheck('deletesubmit')) {
        $sql = "delete from " . tname('calendar') . " where uid={$_SGLOBAL['supe_uid']} and id={$calendar_id}";
        $_SGLOBAL['db']->query($sql);
        //删除日历