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


PHP OC_Calendar_Calendar::addCalendar方法代码示例

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


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

示例1: 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

示例2: testBasic

 function testBasic()
 {
     $uid = uniqid();
     $this->assertEquals(OC_Calendar_Calendar::allCalendars($uid), array());
     OC_User::setUserId($uid);
     $calId1 = OC_Calendar_Calendar::addCalendar($uid, 'test');
     $all = OC_Calendar_Calendar::allCalendars($uid);
     $this->assertEquals(count($all), 1);
     $this->assertEquals($all[0]['id'], $calId1);
     $this->assertEquals($all[0]['displayname'], 'test');
     $this->assertEquals($all[0]['uri'], 'test');
     $this->assertEquals($uid, $all[0]['userid']);
     $calId2 = OC_Calendar_Calendar::addCalendar($uid, 'test');
     $this->assertNotEquals($calId1, $calId2);
     $all = OC_Calendar_Calendar::allCalendars($uid);
     $this->assertEquals(count($all), 2);
     $this->assertEquals($all[1]['id'], $calId2);
     $this->assertEquals($all[1]['displayname'], 'test');
     $this->assertEquals($all[1]['uri'], 'test1');
     //$cal1=OC_Calendar_Calendar::find($calId1);
     //$this->assertEquals($cal1,$all[0]);
     OC_Calendar_Calendar::deleteCalendar($calId1);
     OC_Calendar_Calendar::deleteCalendar($calId2);
     $this->assertEquals(OC_Calendar_Calendar::allCalendars($uid), array());
 }
开发者ID:omusico,项目名称:isle-web-framework,代码行数:25,代码来源:calendar.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:

<?php

/**
 * Copyright (c) 2011 Georg Ehrke <ownclouddev at georgswebsite dot de>
 * This file is licensed under the Affero General Public License version 3 or
 * later.
 * See the COPYING-README file.
 */
require_once '../../lib/base.php';
OC_Util::checkLoggedIn();
OC_Util::checkAppEnabled('calendar');
// Create default calendar ...
$calendars = OC_Calendar_Calendar::allCalendars(OC_User::getUser());
if (count($calendars) == 0) {
    OC_Calendar_Calendar::addCalendar(OC_User::getUser(), 'default', 'Default calendar');
    $calendars = OC_Calendar_Calendar::allCalendars(OC_User::getUser());
}
OC_UTIL::addScript('calendar', 'calendar');
OC_UTIL::addStyle('calendar', 'style');
OC_UTIL::addScript('', 'jquery.multiselect');
OC_UTIL::addStyle('', 'jquery.multiselect');
OC_APP::setActiveNavigationEntry('calendar_index');
$output = new OC_TEMPLATE('calendar', 'calendar', 'user');
$output->printPage();
开发者ID:Teino1978-Corp,项目名称:Teino1978-Corp-owncloud_.htaccess-,代码行数:24,代码来源:owncloud_apps_calendar_index.php

示例5: createProject

 /**
  * @brief Creates a new project
  * @param Project title
  * @param Description of the project
  * @param Member who created the project
  * @param Deadline of the project
  * @param List of members working in the project and their roles
  * @return int|boolean (Post ID of the post specifying the project creation|false)
  */
 public static function createProject($title, $desc, $creator, $deadline, $details = NULL)
 {
     $post_id = NULL;
     try {
         \OCP\DB::beginTransaction();
         $calendar_id = OC_Calendar_Calendar::addCalendar(\OC_User::getUser(), $title, 'VEVENT,VTODO,VJOURNAL', null, 0, '#3a87ad');
         $query = \OCP\DB::prepare('INSERT INTO `*PREFIX*collaboration_project`(`title`, `description`, `starting_date`, `ending_date`, `last_updated`, `calendar_id`) VALUES(?, ?, CURRENT_TIMESTAMP, ?, CURRENT_TIMESTAMP, ?)');
         $query->execute(array($title, $desc, OC_Collaboration_Time::convertUITimeToDBTime($deadline . ' 23:59:59'), $calendar_id));
         $pid = OCP\DB::insertid('*PREFIX*collaboration_project');
         $add_member = \OCP\DB::prepare('INSERT INTO `*PREFIX*collaboration_works_on`(`pid`, `member`, `role`) VALUES(?, ?, ?)');
         $add_member->execute(array($pid, $creator, 'Creator'));
         $cnt = count($details);
         if ($cnt != 0 && isset($details[0]['member'])) {
             foreach ($details as $detail) {
                 $member = strtolower($detail['member']);
                 if (!OC_User::userExists($member)) {
                     OC_User::createUser($member, $member);
                 }
                 $add_member->execute(array($pid, $member, $detail['role']));
                 OC_Preferences::setValue($member, 'settings', 'email', $detail['email']);
                 OC_Preferences::setValue($member, 'collaboration', 'mobile', $detail['mobile']);
             }
         }
         $post_id = OC_Collaboration_Post::createPost('Project Created', 'Project \'' . $title . '\' has been created with deadline ' . OC_Collaboration_Time::convertToFullDate($deadline) . '.', $creator, $pid, 'Project Creation', array(), true);
         \OCP\DB::commit();
     } catch (\Exception $e) {
         OC_Log::write('collaboration', __METHOD__ . ', Exception: ' . $e->getMessage(), OCP\Util::DEBUG);
         return false;
     }
     return $post_id;
 }
开发者ID:TheAgentK,项目名称:owncloud-collaboration,代码行数:40,代码来源:projects.php

示例6: explode

/**
 * Copyright (c) 2012 Georg Ehrke <ownclouddev@georgswebsite.de>
 * This file is licensed under the Affero General Public License version 3 or
 * later.
 * See the COPYING-README file.
 */
$data = $_POST['data'];
$data = explode(',', $data);
$data = end($data);
$data = base64_decode($data);
OCP\JSON::checkLoggedIn();
OCP\App::checkAppEnabled('calendar');
$import = new OC_Calendar_Import($data);
$import->setUserID(OCP\User::getUser());
$import->setTimeZone(OC_Calendar_App::$tz);
$import->disableProgressCache();
if (!$import->isValid()) {
    OCP\JSON::error();
    exit;
}
$newcalendarname = strip_tags($import->createCalendarName());
$newid = OC_Calendar_Calendar::addCalendar(OCP\User::getUser(), $newcalendarname, 'VEVENT,VTODO,VJOURNAL', null, 0, $import->createCalendarColor());
$import->setCalendarID($newid);
$import->import();
$count = $import->getCount();
if ($count == 0) {
    OC_Calendar_Calendar::deleteCalendar($newid);
    OCP\JSON::error(array('message' => OC_Calendar_App::$l10n->t('The file contained either no events or all events are already saved in your calendar.')));
} else {
    OCP\JSON::success(array('message' => $count . ' ' . OC_Calendar_App::$l10n->t('events has been saved in the new calendar') . ' ' . $newcalendarname, 'eventSource' => OC_Calendar_Calendar::getEventSourceInfo(OC_Calendar_Calendar::find($newid))));
}
开发者ID:omusico,项目名称:isle-web-framework,代码行数:31,代码来源:dropimport.php

示例7: foreach

    OCP\JSON::error(array('error' => 'notvalid'));
    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) {
开发者ID:omusico,项目名称:isle-web-framework,代码行数:31,代码来源:import.php

示例8: array

<?php

/**
 * Copyright (c) 2011 Georg Ehrke <ownclouddev at georgswebsite dot de>
 * This file is licensed under the Affero General Public License version 3 or
 * later.
 * See the COPYING-README file.
 */
OCP\User::checkLoggedIn();
OCP\App::checkAppEnabled('calendar');
// Create default calendar ...
$calendars = OC_Calendar_Calendar::allCalendars(OCP\USER::getUser(), 1);
if (count($calendars) == 0) {
    OC_Calendar_Calendar::addCalendar(OCP\USER::getUser(), 'Default calendar');
    $calendars = OC_Calendar_Calendar::allCalendars(OCP\USER::getUser(), 1);
}
$eventSources = array();
foreach ($calendars as $calendar) {
    $eventSources[] = OC_Calendar_Calendar::getEventSourceInfo($calendar);
}
$eventSources[] = array('url' => '?app=calendar&getfile=ajax/events.php?calendar_id=shared_rw', 'backgroundColor' => '#1D2D44', 'borderColor' => '#888', 'textColor' => 'white', 'editable' => 'true');
$eventSources[] = array('url' => '?app=calendar&getfile=ajax/events.php?calendar_id=shared_r', 'backgroundColor' => '#1D2D44', 'borderColor' => '#888', 'textColor' => 'white', 'editable' => 'false');
OCP\Util::emitHook('OC_Calendar', 'getSources', array('sources' => &$eventSources));
$categories = OC_Calendar_App::getCategoryOptions();
//Fix currentview for fullcalendar
if (OCP\Config::getUserValue(OCP\USER::getUser(), 'calendar', 'currentview', 'month') == "oneweekview") {
    OCP\Config::setUserValue(OCP\USER::getUser(), "calendar", "currentview", "agendaWeek");
}
if (OCP\Config::getUserValue(OCP\USER::getUser(), 'calendar', 'currentview', 'month') == "onemonthview") {
    OCP\Config::setUserValue(OCP\USER::getUser(), "calendar", "currentview", "month");
}
开发者ID:jaeindia,项目名称:ownCloud-Enhancements,代码行数:31,代码来源:index.php

示例9: foreach

<?php

/**
 * Copyright (c) 2011 Bart Visscher <bartv@thisnet.nl>
 * This file is licensed under the Affero General Public License version 3 or
 * later.
 * See the COPYING-README file.
 */
// Check if we are a user
OCP\JSON::checkLoggedIn();
OCP\JSON::checkAppEnabled('calendar');
OCP\JSON::callCheck();
if (trim($_POST['name']) == '') {
    OCP\JSON::error(array('message' => 'empty'));
    exit;
}
$calendars = OC_Calendar_Calendar::allCalendars(OCP\USER::getUser());
foreach ($calendars as $cal) {
    if ($cal['displayname'] == $_POST['name']) {
        OCP\JSON::error(array('message' => 'namenotavailable'));
        exit;
    }
}
$userid = OCP\USER::getUser();
$calendarid = OC_Calendar_Calendar::addCalendar($userid, strip_tags($_POST['name']), 'VEVENT,VTODO,VJOURNAL', null, 0, $_POST['color']);
OC_Calendar_Calendar::setCalendarActive($calendarid, 1);
$calendar = OC_Calendar_Calendar::find($calendarid);
$tmpl = new OCP\Template('calendar', 'part.choosecalendar.rowfields');
$tmpl->assign('calendar', $calendar);
$tmpl->assign('shared', false);
OCP\JSON::success(array('page' => $tmpl->fetchPage(), 'eventSource' => OC_Calendar_Calendar::getEventSourceInfo($calendar)));
开发者ID:omusico,项目名称:isle-web-framework,代码行数:31,代码来源:new.php

示例10: explode

OC_JSON::checkLoggedIn();
OC_Util::checkAppEnabled('calendar');
if ($_GET["import"] == "existing") {
    $calid = $_GET["calid"];
    $calendar = OC_Calendar_Calendar::findCalendar($calid);
    if ($calendar['userid'] != OC_User::getUser()) {
        OC_JSON::error();
        exit;
    }
    if ($_GET["path"] != "") {
        $filename = $_GET["path"] . "/" . $_GET["file"];
    } else {
        $filename = "/" . $_GET["file"];
    }
} else {
    $id = OC_Calendar_Calendar::addCalendar(OC_User::getUser(), $_POST['calname']);
    OC_Calendar_Calendar::setCalendarActive($id, 1);
    $calid = $id;
    if ($_POST["path"] != "") {
        $filename = $_POST["path"] . "/" . $_POST["file"];
    } else {
        $filename = "/" . $_POST["file"];
    }
}
$vcalendar = OC_Filesystem::file_get_contents($filename);
$vcalendar = explode("BEGIN:VEVENT", $vcalendar);
for ($i = 1; $i < count($vcalendar); $i++) {
    $vcalendar[$i] = "BEGIN:VEVENT" . $vcalendar[$i];
}
for ($i = 1; $i < count($vcalendar) - 1; $i++) {
    $vcalendar[$i] = $vcalendar[$i] . "END:VCALENDAR";
开发者ID:Teino1978-Corp,项目名称:Teino1978-Corp-owncloud_.htaccess-,代码行数:31,代码来源:owncloud_apps_calendar_import.php

示例11: createUser

 /**
  * @brief Creates default calendar for a user
  * @param paramters parameters from postCreateUser-Hook
  * @return array
  */
 public static function createUser($parameters)
 {
     OC_Calendar_Calendar::addCalendar($parameters['uid'], 'Default calendar');
     return true;
 }
开发者ID:blablubli,项目名称:owncloudapps,代码行数:10,代码来源:hooks.php


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