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


PHP Calendar::find方法代码示例

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


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

示例1: __construct

 public function __construct()
 {
     $timeNow = time();
     //test
     $checkOffset = new \DateTime(date('d.m.Y', $timeNow), new \DateTimeZone(self::$tz));
     $calcSumWin = $checkOffset->getOffset();
     $this->nowTime = strtotime(date('d.m.Y H:i', $timeNow)) + $calcSumWin;
     if (\OC::$server->getSession()->get('public_link_token')) {
         $linkItem = \OCP\Share::getShareByToken(\OC::$server->getSession()->get('public_link_token', false));
         if (is_array($linkItem) && isset($linkItem['uid_owner'])) {
             if ($linkItem['item_type'] === App::SHARECALENDAR) {
                 $sPrefix = App::SHARECALENDARPREFIX;
             }
             if ($linkItem['item_type'] === App::SHAREEVENT) {
                 $sPrefix = App::SHAREEVENTPREFIX;
             }
             if ($linkItem['item_type'] === App::SHARETODO) {
                 $sPrefix = App::SHARETODOPREFIX;
             }
             $itemSource = App::validateItemSource($linkItem['item_source'], $sPrefix);
             $rootLinkItem = Calendar::find($itemSource);
             $this->aCalendars[] = $rootLinkItem;
         }
     } else {
         $this->aCalendars = Calendar::allCalendars(\OCP\User::getUser());
         $this->checkAlarm();
     }
 }
开发者ID:Bullnados,项目名称:calendarplus,代码行数:28,代码来源:alarm.php

示例2: postSave

 public function postSave($id = null)
 {
     $validator = Validator::make(Input::all(), Appointment::$rules);
     if ($validator->passes()) {
         $event = Appointment::find(Input::get('id'));
         if (!$event) {
             $event = new Appointment();
         }
         $calendar = Calendar::find(explode('/', Input::get('date'))[0]);
         if ($calendar) {
             $day = explode('/', Input::get('date'))[1];
             if ($day > 0 && $day <= $calendar->number_of_days) {
                 $event->name = Input::get('name');
                 $event->date = explode('/', Input::get('date'))[1];
                 $event->start_time = Input::get('start_time');
                 $event->end_time = Input::get('end_time');
                 $event->notes = Input::get('notes');
                 $event->calendar_id = $calendar->id;
                 $event->group_id = Input::get('group_id');
                 $event->user_id = Auth::user()->id;
                 $event->save();
                 return Response::json(array('status' => 'success', $event));
             } else {
                 $validator->messages()->add('date', 'The day is invalid.');
             }
         } else {
             $validator->messages()->add('date', 'The month is invalid.');
         }
     }
     return Response::json(array('status' => 'error', 'errors' => $validator->messages()));
 }
开发者ID:joreyesl,项目名称:calendar,代码行数:31,代码来源:CalendarController.php

示例3: calendar

 /**
  * @brief exports a calendar and convert all times to UTC
  * @param integer $id id of the calendar
  * @return string
  */
 private static function calendar($id)
 {
     $events = Object::all($id);
     $calendar = Calendar::find($id);
     $return = "BEGIN:VCALENDAR\nVERSION:2.0\nPRODID:ownCloud Calendar " . \OCP\App::getAppVersion(App::$appname) . "\nX-WR-CALNAME:" . $calendar['displayname'] . "\n";
     $return .= self::addVtimezone();
     foreach ($events as $event) {
         $return .= self::generateEvent($event);
     }
     $return .= "END:VCALENDAR";
     return $return;
 }
开发者ID:Rotzbua,项目名称:calendarplus,代码行数:17,代码来源:export.php

示例4: generateTimeperiodsCfg

   function generateTimeperiodsCfg($file=0) {

      PluginMonitoringToolbox::logIfExtradebug(
         'pm-shinken',
         "Starting generateTimeperiodsCfg ...\n"
      );
      $calendar         = new Calendar();
      $calendarSegment  = new CalendarSegment();
      $calendar_Holiday = new Calendar_Holiday();
      $holiday          = new Holiday();

      $a_timeperiods = array();
      $i=0;

      $a_listcalendar = $calendar->find();
      foreach ($a_listcalendar as $datacalendar) {
         $a_timeperiods[$i]['timeperiod_name'] = $datacalendar['name'];
         $a_timeperiods[$i]['alias'] = $datacalendar['name'];
         $a_listsegment = $calendarSegment->find("`calendars_id`='".$datacalendar['id']."'");
         $a_cal = array();
         foreach ($a_listsegment as $datasegment) {
            $begin = preg_replace("/:00$/", "", $datasegment['begin']);
            $end = preg_replace("/:00$/", "", $datasegment['end']);
            $day = "";
            switch ($datasegment['day']) {

               case "0":
                  $day = "sunday";
                  break;

               case "1":
                  $day = "monday";
                  break;

               case "2":
                  $day = "tuesday";
                  break;

               case "3":
                  $day = "wednesday";
                  break;

               case "4":
                  $day = "thursday";
                  break;

               case "5":
                  $day = "friday";
                  break;

               case "6":
                  $day = "saturday";
                  break;

            }
            $a_cal[$day][] = $begin."-".$end;
         }
         foreach ($a_cal as $day=>$a_times) {
            $a_timeperiods[$i][$day] = implode(',', $a_times);
         }
         $a_cholidays = $calendar_Holiday->find("`calendars_id`='".$datacalendar['id']."'");
         foreach ($a_cholidays as $a_choliday) {
            $holiday->getFromDB($a_choliday['holidays_id']);
            if ($holiday->fields['is_perpetual'] == 1
                    && $holiday->fields['begin_date'] == $holiday->fields['end_date']) {
               $datetime = strtotime($holiday->fields['begin_date']);
               $a_timeperiods[$i][strtolower(date('F', $datetime)).
                   ' '.date('j', $datetime)] = '00:00-00:00';
            }
         }
         $i++;
      }

      PluginMonitoringToolbox::logIfExtradebug(
         'pm-shinken',
         "End generateTimeperiodsCfg\n"
      );

      if ($file == "1") {
         $config = "# Generated by plugin monitoring for GLPI\n# on ".date("Y-m-d H:i:s")."\n\n";

         foreach ($a_timeperiods as $data) {
            $config .= $this->writeFile("timeperiod", $data);
         }
         return array('timeperiods.cfg', $config);

      } else {
         return $a_timeperiods;
      }
   }
开发者ID:euqip,项目名称:glpi-smartcities,代码行数:90,代码来源:shinken.class.php

示例5: prepareActivityLog

 public static function prepareActivityLog($shareData)
 {
     $aApp = array(App::SHARECALENDAR => 'calendar', App::SHAREEVENT => 'calendar', App::SHARETODO => App::SHARECALENDAR);
     //shared_with_by, shared_user_self,shared_group_self,shared_link_self
     if (array_key_exists($shareData['itemType'], $aApp)) {
         $sType = '';
         $sL10nDescr = '';
         if ($shareData['itemType'] === App::SHARECALENDAR) {
             $sType = App::SHARECALENDARPREFIX;
             $sL10nDescr = 'calendar';
         }
         if ($shareData['itemType'] === App::SHAREEVENT) {
             $sType = App::SHAREEVENTPREFIX;
             $sL10nDescr = 'event';
         }
         if ($shareData['itemType'] === App::SHARETODO) {
             $sType = App::SHARETODOPREFIX;
             $sL10nDescr = 'todo';
         }
         $sApp = $aApp[$shareData['itemType']];
         $l = \OC::$server->getL10N(App::$appname);
         $type = 'shared_' . $sApp;
         if ($shareData['token'] !== '' && $shareData['shareType'] === \OCP\Share::SHARE_TYPE_LINK) {
             $shareData['itemSource'] = App::validateItemSource($shareData['itemSource'], $sType);
             if ($shareData['itemType'] === App::SHAREEVENT || $shareData['itemType'] === App::SHARECALENDAR) {
                 $link = \OC::$server->getURLGenerator()->linkToRoute(App::$appname . '.public.index', ['token' => $shareData['token']]);
             }
             if ($shareData['itemType'] === App::SHARETODO) {
                 $link = \OC::$server->getURLGenerator()->linkToRoute('tasksplus.public.index', ['token' => $shareData['token']]);
             }
             if ($shareData['itemType'] === App::SHAREEVENT || $shareData['itemType'] === App::SHARETODO) {
                 $aObject = Object::find($shareData['itemSource']);
                 $aCalendar = Calendar::find($aObject['calendarid']);
                 $description = $l->t($sL10nDescr) . ' ' . $aObject['summary'] . ' (' . $l->t('calendar') . ' ' . $aCalendar['displayname'] . ')';
             } else {
                 $description = $l->t($sL10nDescr) . ' ' . $shareData['itemTarget'];
             }
             \OC::$server->getActivityManager()->publishActivity(App::$appname, 'shared_link_self_' . $sApp, array($description), '', '', '', $link, \OCP\User::getUser(), $type, '');
         }
         if ($shareData['shareType'] === \OCP\Share::SHARE_TYPE_USER) {
             $link = '';
             $shareData['itemSource'] = App::validateItemSource($shareData['itemSource'], $sType);
             if ($shareData['itemType'] === App::SHARETODO) {
                 $link = \OC::$server->getURLGenerator()->linkToRoute('tasksplus.page.index') . '#' . urlencode($shareData['itemSource']);
             }
             if ($shareData['itemType'] === App::SHAREEVENT) {
                 $link = \OC::$server->getURLGenerator()->linkToRoute(App::$appname . '.page.index') . '#' . urlencode($shareData['itemSource']);
             }
             $description = $shareData['itemTarget'];
             if ($shareData['itemType'] === App::SHARETODO || $shareData['itemType'] === App::SHAREEVENT) {
                 $aObject = Object::find($shareData['itemSource']);
                 $aCalendar = Calendar::find($aObject['calendarid']);
                 $description = $aObject['summary'] . ' (' . $l->t('calendar') . ' ' . $aCalendar['displayname'] . ')';
             }
             \OC::$server->getActivityManager()->publishActivity(App::$appname, 'shared_user_self_' . $sApp, array($l->t($sL10nDescr) . ' ' . $description, $shareData['shareWith']), '', '', '', $link, \OCP\User::getUser(), $type, '');
             \OC::$server->getActivityManager()->publishActivity(App::$appname, 'shared_with_by_' . $sApp, array($l->t($sL10nDescr) . ' ' . $description, \OCP\User::getUser()), '', '', '', $link, $shareData['shareWith'], $type, '');
         }
         if ($shareData['shareType'] === \OCP\Share::SHARE_TYPE_GROUP) {
             $link = '';
             $shareData['itemSource'] = App::validateItemSource($shareData['itemSource'], $sType);
             if ($shareData['itemType'] === App::SHARETODO) {
                 $link = \OC::$server->getURLGenerator()->linkToRoute('tasksplus.page.index') . '#' . urlencode($shareData['itemSource']);
             }
             if ($shareData['itemType'] === App::SHAREEVENT) {
                 $link = \OC::$server->getURLGenerator()->linkToRoute('calendar.page.index') . '#' . urlencode($shareData['itemSource']);
             }
             $description = $shareData['itemTarget'];
             if ($shareData['itemType'] === App::SHARETODO || $shareData['itemType'] === App::SHAREEVENT) {
                 $aObject = Object::find($shareData['itemSource']);
                 $aCalendar = Calendar::find($aObject['calendarid']);
                 $description = $aObject['summary'] . ' (' . $l->t('calendar') . ' ' . $aCalendar['displayname'] . ')';
             }
             \OC::$server->getActivityManager()->publishActivity(App::$appname, 'shared_group_self_' . $sApp, array($l->t($sL10nDescr) . ' ' . $description, $shareData['shareWith']), '', '', '', $link, \OCP\User::getUser(), $type, '');
             $usersInGroup = \OC_Group::usersInGroup($shareData['shareWith']);
             foreach ($usersInGroup as $user) {
                 \OC::$server->getActivityManager()->publishActivity(App::$appname, 'shared_with_by_' . $sApp, array($l->t($sL10nDescr) . ' ' . $description, \OCP\User::getUser()), '', '', '', $link, $user, 'shared_' . $sApp, '');
             }
         }
     }
 }
开发者ID:Rotzbua,项目名称:calendarplus,代码行数:80,代码来源:hooks.php

示例6: getowner

 /**
  * @brief returns the owner of an object
  * @param integer $id
  * @return string
  */
 public static function getowner($id)
 {
     $event = self::find($id);
     $cal = Calendar::find($event['calendarid']);
     //\OCP\Util::writeLog(App::$appname,'OWNER'.$event['calendarid'].' of '.$event['summary'], \OCP\Util::DEBUG);
     if ($cal === false || is_array($cal) === false) {
         return null;
     }
     if (array_key_exists('userid', $cal)) {
         return $cal['userid'];
     } else {
         return null;
     }
 }
开发者ID:Bullnados,项目名称:calendarplus,代码行数:19,代码来源:object.php

示例7: generateTimeperiodsCfg

 function generateTimeperiodsCfg($file = 0)
 {
     $calendar = new Calendar();
     $calendarSegment = new CalendarSegment();
     $a_timeperiods = array();
     $i = 0;
     $a_listcalendar = $calendar->find();
     foreach ($a_listcalendar as $datacalendar) {
         $a_timeperiods[$i]['timeperiod_name'] = $datacalendar['name'];
         $a_timeperiods[$i]['alias'] = $datacalendar['name'];
         $a_listsegment = $calendarSegment->find("`calendars_id`='" . $datacalendar['id'] . "'");
         foreach ($a_listsegment as $datasegment) {
             $begin = preg_replace("/:00\$/", "", $datasegment['begin']);
             $end = preg_replace("/:00\$/", "", $datasegment['end']);
             $day = "";
             switch ($datasegment['day']) {
                 case "0":
                     $day = "sunday";
                     break;
                 case "1":
                     $day = "monday";
                     break;
                 case "2":
                     $day = "tuesday";
                     break;
                 case "3":
                     $day = "wednesday";
                     break;
                 case "4":
                     $day = "thursday";
                     break;
                 case "5":
                     $day = "friday";
                     break;
                 case "6":
                     $day = "saturday";
                     break;
             }
             $a_timeperiods[$i][$day] = $begin . "-" . $end;
         }
         //         if (!isset($a_timeperiods[$i]["sunday"])) {
         //            $a_timeperiods[$i]["sunday"]= '';
         //         }
         //         if (!isset($a_timeperiods[$i]["monday"])) {
         //            $a_timeperiods[$i]["monday"]= '';
         //         }
         //         if (!isset($a_timeperiods[$i]["tuesday"])) {
         //            $a_timeperiods[$i]["tuesday"]= '';
         //         }
         //         if (!isset($a_timeperiods[$i]["wednesday"])) {
         //            $a_timeperiods[$i]["wednesday"]= '';
         //         }
         //         if (!isset($a_timeperiods[$i]["thursday"])) {
         //            $a_timeperiods[$i]["thursday"]= '';
         //         }
         //         if (!isset($a_timeperiods[$i]["friday"])) {
         //            $a_timeperiods[$i]["friday"]= '';
         //         }
         //         if (!isset($a_timeperiods[$i]["saturday"])) {
         //            $a_timeperiods[$i]["saturday"]= '';
         //         }
         $i++;
     }
     if ($file == "1") {
         $config = "# Generated by plugin monitoring for GLPI\n# on " . date("Y-m-d H:i:s") . "\n\n";
         foreach ($a_timeperiods as $data) {
             $config .= $this->constructFile("timeperiod", $data);
         }
         return array('timeperiods.cfg', $config);
     } else {
         return $a_timeperiods;
     }
 }
开发者ID:RubichonL,项目名称:glpi_monitoring,代码行数:73,代码来源:shinken.class.php

示例8: PluginMonitoringContact

 function _addContactUser($a_contacts, $users_id, $i)
 {
     $pmContact = new PluginMonitoringContact();
     $pmNotificationcommand = new PluginMonitoringNotificationcommand();
     $pmContacttemplate = new PluginMonitoringContacttemplate();
     $user = new User();
     $calendar = new Calendar();
     $user->getFromDB($users_id);
     // Get contact template
     $a_pmcontact = current($pmContact->find("`users_id`='" . $users_id . "'", "", 1));
     if (empty($a_pmcontact) or isset($a_pmcontact['plugin_monitoring_contacttemplates_id']) and $a_pmcontact['plugin_monitoring_contacttemplates_id'] == '0') {
         // Use default template
         $a_pmcontact = current($pmContacttemplate->find("`is_default`='1'", "", 1));
     } else {
         // Use contact defined template
         $a_pmcontact = current($pmContacttemplate->find("`id`='" . $a_pmcontact['plugin_monitoring_contacttemplates_id'] . "'", "", 1));
     }
     $a_contacts[$i]['contact_name'] = $user->fields['name'];
     $a_contacts[$i]['alias'] = $user->getName();
     PluginMonitoringToolbox::logIfExtradebug('pm-shinken', "- contact " . $user->fields['name'] . " - " . $user->getName() . "\n");
     // Toolbox::logInFile("pm-contacts", "- contact ".serialize($user->fields)."\n");
     if (!isset($a_pmcontact['host_notification_period'])) {
         $a_calendars = current($calendar->find("", "", 1));
         $cal = '24x7';
         if (isset($a_calendars['name'])) {
             $cal = $a_calendars['name'];
         }
         $a_pmcontact['host_notifications_enabled'] = '0';
         $a_pmcontact['service_notifications_enabled'] = '0';
         $a_pmcontact['service_notification_period'] = $cal;
         $a_pmcontact['host_notification_period'] = $cal;
         $a_pmcontact['service_notification_options_w'] = '0';
         $a_pmcontact['service_notification_options_u'] = '0';
         $a_pmcontact['service_notification_options_c'] = '0';
         $a_pmcontact['service_notification_options_r'] = '0';
         $a_pmcontact['service_notification_options_f'] = '0';
         $a_pmcontact['service_notification_options_n'] = '0';
         $a_pmcontact['host_notification_options_d'] = '0';
         $a_pmcontact['host_notification_options_u'] = '0';
         $a_pmcontact['host_notification_options_r'] = '0';
         $a_pmcontact['host_notification_options_f'] = '0';
         $a_pmcontact['host_notification_options_s'] = '0';
         $a_pmcontact['host_notification_options_n'] = '0';
         $a_pmcontact['service_notification_commands'] = '2';
         $a_pmcontact['host_notification_commands'] = '1';
     }
     $a_contacts[$i]['host_notifications_enabled'] = $a_pmcontact['host_notifications_enabled'];
     $a_contacts[$i]['service_notifications_enabled'] = $a_pmcontact['service_notifications_enabled'];
     $calendar->getFromDB($a_pmcontact['service_notification_period']);
     if (isset($calendar->fields['name'])) {
         $a_contacts[$i]['service_notification_period'] = $calendar->fields['name'];
     } else {
         $a_contacts[$i]['service_notification_period'] = '24x7';
     }
     $calendar->getFromDB($a_pmcontact['host_notification_period']);
     if (isset($calendar->fields['name'])) {
         $a_contacts[$i]['host_notification_period'] = $calendar->fields['name'];
     } else {
         $a_contacts[$i]['host_notification_period'] = '24x7';
     }
     $a_servicenotif = array();
     if ($a_pmcontact['service_notification_options_w'] == '1') {
         $a_servicenotif[] = "w";
     }
     if ($a_pmcontact['service_notification_options_u'] == '1') {
         $a_servicenotif[] = "u";
     }
     if ($a_pmcontact['service_notification_options_c'] == '1') {
         $a_servicenotif[] = "c";
     }
     if ($a_pmcontact['service_notification_options_r'] == '1') {
         $a_servicenotif[] = "r";
     }
     if ($a_pmcontact['service_notification_options_f'] == '1') {
         $a_servicenotif[] = "f";
     }
     if ($a_pmcontact['service_notification_options_n'] == '1') {
         $a_servicenotif = array("n");
     }
     if (count($a_servicenotif) == "0") {
         $a_servicenotif = array("n");
     }
     $a_contacts[$i]['service_notification_options'] = implode(",", $a_servicenotif);
     $a_hostnotif = array();
     if ($a_pmcontact['host_notification_options_d'] == '1') {
         $a_hostnotif[] = "d";
     }
     if ($a_pmcontact['host_notification_options_u'] == '1') {
         $a_hostnotif[] = "u";
     }
     if ($a_pmcontact['host_notification_options_r'] == '1') {
         $a_hostnotif[] = "r";
     }
     if ($a_pmcontact['host_notification_options_f'] == '1') {
         $a_hostnotif[] = "f";
     }
     if ($a_pmcontact['host_notification_options_s'] == '1') {
         $a_hostnotif[] = "s";
     }
     if ($a_pmcontact['host_notification_options_n'] == '1') {
//.........这里部分代码省略.........
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:101,代码来源:shinken.class.php


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