当前位置: 首页>>代码示例>>PHP>>正文


PHP OC_Calendar_Calendar::setCalendarActive方法代码示例

本文整理汇总了PHP中OC_Calendar_Calendar::setCalendarActive方法的典型用法代码示例。如果您正苦于以下问题:PHP OC_Calendar_Calendar::setCalendarActive方法的具体用法?PHP OC_Calendar_Calendar::setCalendarActive怎么用?PHP OC_Calendar_Calendar::setCalendarActive使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OC_Calendar_Calendar的用法示例。


在下文中一共展示了OC_Calendar_Calendar::setCalendarActive方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: import

 function import()
 {
     switch ($this->appinfo->version) {
         default:
             // All versions of the app have had the same db structure, so all can use the same import function
             $query = $this->content->prepare('SELECT * FROM `calendar_calendars` WHERE `userid` = ?');
             $results = $query->execute(array($this->olduid));
             $idmap = array();
             while ($row = $results->fetchRow()) {
                 // Import each calendar
                 $calendarquery = OCP\DB::prepare('INSERT INTO `*PREFIX*calendar_calendars` (`userid`,`displayname`,`uri`,`ctag`,`calendarorder`,`calendarcolor`,`timezone`,`components`) VALUES(?,?,?,?,?,?,?,?)');
                 $calendarquery->execute(array($this->uid, $row['displayname'], $row['uri'], $row['ctag'], $row['calendarorder'], $row['calendarcolor'], $row['timezone'], $row['components']));
                 // Map the id
                 $idmap[$row['id']] = OCP\DB::insertid('*PREFIX*calendar_calendars');
                 // Make the calendar active
                 OC_Calendar_Calendar::setCalendarActive($idmap[$row['id']], true);
             }
             // Now tags
             foreach ($idmap as $oldid => $newid) {
                 $query = $this->content->prepare('SELECT * FROM `calendar_objects` WHERE `calendarid` = ?');
                 $results = $query->execute(array($oldid));
                 while ($row = $results->fetchRow()) {
                     // Import the objects
                     $objectquery = OCP\DB::prepare('INSERT INTO `*PREFIX*calendar_objects` (`calendarid`,`objecttype`,`startdate`,`enddate`,`repeating`,`summary`,`calendardata`,`uri`,`lastmodified`) VALUES(?,?,?,?,?,?,?,?,?)');
                     $objectquery->execute(array($newid, $row['objecttype'], $row['startdate'], $row['enddate'], $row['repeating'], $row['summary'], $row['calendardata'], $row['uri'], $row['lastmodified']));
                 }
             }
             // All done!
             break;
     }
     return true;
 }
开发者ID:amin-hedayati,项目名称:calendar-rework,代码行数:32,代码来源:migrate.php

示例2: addList

 /**
  * @NoAdminRequired
  */
 public function addList()
 {
     $listName = $this->params('name');
     $userId = $this->api->getUserId();
     if (trim($listName) == '') {
         // OCP\JSON::error(array('message'=>'empty'));
         exit;
     }
     $calendars = \OC_Calendar_Calendar::allCalendars($userId, true);
     foreach ($calendars as $cal) {
         if ($cal['displayname'] == $listName) {
             // OCP\JSON::error(array('message'=>'namenotavailable'));
             exit;
         }
     }
     $color = '#CCCCCC';
     $calendarId = \OC_Calendar_Calendar::addCalendar($userId, strip_tags($listName), 'VEVENT,VTODO,VJOURNAL', null, 0, $color);
     \OC_Calendar_Calendar::setCalendarActive($calendarId, 1);
     $list = \OC_Calendar_Calendar::find($calendarId);
     $list['tmpID'] = $this->params('tmpID');
     $result = array('data' => array('list' => $list));
     $response = new JSONResponse();
     $response->setData($result);
     return $response;
 }
开发者ID:WYSAC,项目名称:oregon-owncloud,代码行数:28,代码来源:listscontroller.php

示例3: add

 /**
  * add a list
  *
  * @param $name
  * @param $tmpID
  * @return array
  * @throws \Exception
  */
 public function add($name, $tmpID)
 {
     if (trim($name) == '') {
         // OCP\JSON::error(array('message'=>'empty'));
         exit;
     }
     $calendars = \OC_Calendar_Calendar::allCalendars($this->userId, true);
     foreach ($calendars as $cal) {
         if ($cal['displayname'] == $name) {
             // OCP\JSON::error(array('message'=>'namenotavailable'));
             exit;
         }
     }
     $color = '#CCCCCC';
     $calendarId = \OC_Calendar_Calendar::addCalendar($this->userId, strip_tags($name), 'VEVENT,VTODO,VJOURNAL', null, 0, $color);
     \OC_Calendar_Calendar::setCalendarActive($calendarId, 1);
     $list = \OC_Calendar_Calendar::find($calendarId);
     $list['tmpID'] = $tmpID;
     return $list;
 }
开发者ID:sbambach,项目名称:tasks,代码行数:28,代码来源:listsservice.php

示例4: foreach

    exit;
}
$newcal = false;
if ($_POST['method'] == 'new') {
    $calendars = OC_Calendar_Calendar::allCalendars(OCP\User::getUser());
    foreach ($calendars as $calendar) {
        if ($calendar['displayname'] == $_POST['calname']) {
            $id = $calendar['id'];
            $newcal = false;
            break;
        }
        $newcal = true;
    }
    if ($newcal) {
        $id = OC_Calendar_Calendar::addCalendar(OCP\USER::getUser(), strip_tags($_POST['calname']), 'VEVENT,VTODO,VJOURNAL', null, 0, strip_tags($_POST['calcolor']));
        OC_Calendar_Calendar::setCalendarActive($id, 1);
    }
} else {
    $calendar = OC_Calendar_App::getCalendar($_POST['id']);
    if ($calendar['userid'] != OCP\USER::getUser()) {
        OCP\JSON::error(array('error' => 'missingcalendarrights'));
        exit;
    }
    $id = $_POST['id'];
    $import->setOverwrite($_POST['overwrite']);
}
$import->setCalendarID($id);
try {
    $import->import();
} catch (Exception $e) {
    OCP\JSON::error(array('message' => OC_Calendar_App::$l10n->t('Import failed'), 'debug' => $e->getMessage()));
开发者ID:omusico,项目名称:isle-web-framework,代码行数:31,代码来源:import.php

示例5: foreach

    exit;
}
$calendars = OC_Calendar_Calendar::allCalendars(OCP\USER::getUser());
foreach ($calendars as $cal) {
    if ($cal['userid'] != OCP\User::getUser()) {
        continue;
    }
    if ($cal['displayname'] == $_POST['name'] && $cal['id'] != $_POST['id']) {
        OCP\JSON::error(array('message' => 'namenotavailable'));
        exit;
    }
}
$calendarid = $_POST['id'];
try {
    OC_Calendar_Calendar::editCalendar($calendarid, strip_tags($_POST['name']), null, null, null, $_POST['color']);
    OC_Calendar_Calendar::setCalendarActive($calendarid, $_POST['active']);
} catch (Exception $e) {
    OCP\JSON::error(array('message' => $e->getMessage()));
    exit;
}
$calendar = OC_Calendar_Calendar::find($calendarid);
$tmpl = new OCP\Template('calendar', 'part.choosecalendar.rowfields');
$tmpl->assign('calendar', $calendar);
$shared = false;
if ($calendar['userid'] != OCP\User::getUser()) {
    $sharedCalendar = OCP\Share::getItemSharedWithBySource('calendar', $calendarid);
    if ($sharedCalendar && $sharedCalendar['permissions'] & OCP\Share::PERMISSION_UPDATE) {
        $shared = true;
    }
}
$tmpl->assign('shared', $shared);
开发者ID:noci2012,项目名称:owncloud,代码行数:31,代码来源:update.php


注:本文中的OC_Calendar_Calendar::setCalendarActive方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。