Exemplo n.º 1
0
function start()
{
    $availableMoviesToWatch = array();
    $url = $_POST['url'];
    $data = file_get_contents($url);
    $dom = new DomDocument();
    if ($dom->loadHTML($data)) {
        $xpath = new DOMXPath($dom);
        $items = $xpath->query('//li/a');
        $calendarIndex = $items->item(0)->getAttribute("href");
        $availableDays = getCalendarItems(trimSlashFromUrl($url) . $calendarIndex, $dom);
        $movieIndex = $items->item(1)->getAttribute("href");
        $getMovies = getMovieValues(trimSlashFromUrl($url) . $movieIndex, $dom);
        $movieOptions = checkAvailableCinema($availableDays, $getMovies, trimSlashFromUrl($url) . $movieIndex);
        foreach ($movieOptions as $movieOption) {
            if ($movieOption["movie"] == 01) {
                $movieOption["movie"] = "Söderkåkar";
            }
            if ($movieOption["movie"] == 02) {
                $movieOption["movie"] = "Fabian Bom";
            }
            if ($movieOption["movie"] == 03) {
                $movieOption["movie"] = "Pensionat Paradiset";
            }
            if ($movieOption[0] == 01) {
                $movieOption[0] = "Fredag";
            }
            if ($movieOption[0] == 02) {
                $movieOption[0] = "Lördag";
            }
            if ($movieOption[0] == 03) {
                $movieOption[0] = "Söndag";
            }
            array_push($availableMoviesToWatch, $movieOption);
        }
        foreach ($availableMoviesToWatch as $movie) {
            echo "Alla kan se " . $movie["movie"] . " klockan " . $movie["time"] . " på " . $movie[0] . "<br/>";
        }
    }
}
 /**
  * Function which checks whether received meeting request is either conflicting with other appointments or not.
  *@return mixed(boolean/integer) true if normal meeting is conflicting or an integer which specifies no of instances
  * conflict of recurring meeting and false if meeting is not conflicting.
  */
 function isMeetingConflicting($message = false, $userStore = false, $calFolder = false, $msgprops = false)
 {
     $returnValue = false;
     $conflicting = false;
     $noOfInstances = 0;
     if (!$message) {
         $message = $this->message;
     }
     if (!$userStore) {
         $userStore = $this->store;
     }
     if (!$calFolder) {
         $root = mapi_msgstore_openentry($userStore);
         $rootprops = mapi_getprops($root, array(PR_STORE_ENTRYID, PR_IPM_APPOINTMENT_ENTRYID, PR_FREEBUSY_ENTRYIDS));
         if (!isset($rootprops[PR_IPM_APPOINTMENT_ENTRYID])) {
             return;
         }
         $calFolder = mapi_msgstore_openentry($userStore, $rootprops[PR_IPM_APPOINTMENT_ENTRYID]);
     }
     if (!$msgprops) {
         $msgprops = mapi_getprops($message, array($this->proptags['goid'], $this->proptags['goid2'], $this->proptags['startdate'], $this->proptags['duedate'], $this->proptags['recurring'], $this->proptags['clipstart'], $this->proptags['clipend']));
     }
     if ($calFolder) {
         // Meeting request is recurring, so get all occurrence and check for each occurrence whether it conflicts with other appointments in Calendar.
         if (isset($msgprops[$this->proptags['recurring']]) && $msgprops[$this->proptags['recurring']]) {
             // Apply recurrence class and retrieve all occurrences(max: 30 occurrence because recurrence can also be set as 'no end date')
             $recurr = new Recurrence($userStore, $message);
             $items = $recurr->getItems($msgprops[$this->proptags['clipstart']], $msgprops[$this->proptags['clipend']] * (24 * 24 * 60), 30);
             foreach ($items as $item) {
                 // Get all items in the timeframe that we want to book, and get the goid and busystatus for each item
                 $calendarItems = $recurr->getCalendarItems($userStore, $calFolder, $item[$this->proptags['startdate']], $item[$this->proptags['duedate']], array($this->proptags['goid'], $this->proptags['busystatus'], PR_OWNER_APPT_ID));
                 foreach ($calendarItems as $calendarItem) {
                     if ($calendarItem[$this->proptags['busystatus']] != fbFree) {
                         /**
                          * Only meeting requests have globalID, normal appointments do not have globalID
                          * so if any normal appointment if found then it is assumed to be conflict.
                          */
                         if (isset($calendarItem[$this->proptags['goid']])) {
                             if ($calendarItem[$this->proptags['goid']] !== $msgprops[$this->proptags['goid']]) {
                                 $noOfInstances++;
                                 break;
                             }
                         } else {
                             $noOfInstances++;
                             break;
                         }
                     }
                 }
             }
             $returnValue = $noOfInstances;
         } else {
             // Get all items in the timeframe that we want to book, and get the goid and busystatus for each item
             $items = getCalendarItems($userStore, $calFolder, $msgprops[$this->proptags['startdate']], $msgprops[$this->proptags['duedate']], array($this->proptags['goid'], $this->proptags['busystatus'], PR_OWNER_APPT_ID));
             foreach ($items as $item) {
                 if ($item[$this->proptags['busystatus']] != fbFree) {
                     if (isset($item[$this->proptags['goid']])) {
                         if ($item[$this->proptags['goid']] !== $msgprops[$this->proptags['goid']] && $item[$this->proptags['goid']] !== $msgprops[$this->proptags['goid2']]) {
                             $conflicting = true;
                             break;
                         }
                     } else {
                         $conflicting = true;
                         break;
                     }
                 }
             }
             if ($conflicting) {
                 $returnValue = true;
             }
         }
     }
     return $returnValue;
 }
 /**
  * Function which checks whether received meeting request is either conflicting with other appointments or not.
  * @return mixed(boolean/integer) true if normal meeting is conflicting or an integer which specifies no of instances
  * conflict of recurring meeting and false if meeting is not conflicting.
  * @param MAPIMessage $message meeting request item that should be checked for conflicts in calendar
  * @param MAPIStore $userStore store containing calendar folder that will be used for confilict checking
  * @param MAPIFolder $calFolder calendar folder for conflict checking
  * @return Mixed if boolean then true/false for indicating confict, if number then items that are conflicting with the message.
  */
 function isMeetingConflicting($message = false, $userStore = false, $calFolder = false)
 {
     $returnValue = false;
     $noOfInstances = 0;
     if ($message === false) {
         $message = $this->message;
     }
     $messageProps = mapi_getprops($message, array(PR_MESSAGE_CLASS, $this->proptags['goid'], $this->proptags['goid2'], $this->proptags['startdate'], $this->proptags['duedate'], $this->proptags['recurring'], $this->proptags['clipstart'], $this->proptags['clipend'], PR_RCVD_REPRESENTING_NAME));
     if ($userStore === false) {
         $userStore = $this->store;
         // check if delegate is processing the response
         if (isset($messageProps[PR_RCVD_REPRESENTING_NAME])) {
             $delegatorStore = $this->getDelegatorStore($messageProps[PR_RCVD_REPRESENTING_NAME], array(PR_IPM_APPOINTMENT_ENTRYID));
             $userStore = $delegatorStore['store'];
             $calFolder = $delegatorStore[PR_IPM_APPOINTMENT_ENTRYID];
         }
     }
     if ($calFolder === false) {
         $calFolder = $this->openDefaultCalendar($userStore);
     }
     if ($calFolder) {
         // Meeting request is recurring, so get all occurrence and check for each occurrence whether it conflicts with other appointments in Calendar.
         if (isset($messageProps[$this->proptags['recurring']]) && $messageProps[$this->proptags['recurring']] === true) {
             // Apply recurrence class and retrieve all occurrences(max: 30 occurrence because recurrence can also be set as 'no end date')
             $recurr = new Recurrence($userStore, $message);
             $items = $recurr->getItems($messageProps[$this->proptags['clipstart']], $messageProps[$this->proptags['clipend']] * (24 * 24 * 60), 30);
             foreach ($items as $item) {
                 // Get all items in the timeframe that we want to book, and get the goid and busystatus for each item
                 $calendarItems = $recurr->getCalendarItems($userStore, $calFolder, $item[$this->proptags['startdate']], $item[$this->proptags['duedate']], array($this->proptags['goid'], $this->proptags['busystatus']));
                 foreach ($calendarItems as $calendarItem) {
                     if ($calendarItem[$this->proptags['busystatus']] !== fbFree) {
                         /**
                          * Only meeting requests have globalID, normal appointments do not have globalID
                          * so if any normal appointment if found then it is assumed to be conflict.
                          */
                         if (isset($calendarItem[$this->proptags['goid']])) {
                             if ($calendarItem[$this->proptags['goid']] !== $messageProps[$this->proptags['goid']]) {
                                 $noOfInstances++;
                                 break;
                             }
                         } else {
                             $noOfInstances++;
                             break;
                         }
                     }
                 }
             }
             if ($noOfInstances > 0) {
                 $returnValue = $noOfInstances;
             }
         } else {
             // Get all items in the timeframe that we want to book, and get the goid and busystatus for each item
             $items = getCalendarItems($userStore, $calFolder, $messageProps[$this->proptags['startdate']], $messageProps[$this->proptags['duedate']], array($this->proptags['goid'], $this->proptags['busystatus']));
             foreach ($items as $item) {
                 if ($item[$this->proptags['busystatus']] !== fbFree) {
                     if (isset($item[$this->proptags['goid']])) {
                         if ($item[$this->proptags['goid']] !== $messageProps[$this->proptags['goid']] && $item[$this->proptags['goid']] !== $messageProps[$this->proptags['goid2']]) {
                             $returnValue = true;
                             break;
                         }
                     } else {
                         $returnValue = true;
                         break;
                     }
                 }
             }
         }
     }
     return $returnValue;
 }
Exemplo n.º 4
0
 /**
  * Note: Static function, more like a utility function.
  *
  * Gets all the items (including recurring items) in the specified calendar in the given timeframe. Items are
  * included as a whole if they overlap the interval <$start, $end> (non-inclusive). This means that if the interval
  * is <08:00 - 14:00>, the item [6:00 - 8:00> is NOT included, nor is the item [14:00 - 16:00>. However, the item
  * [7:00 - 9:00> is included as a whole, and is NOT capped to [8:00 - 9:00>.
  *
  * @param $store resource The store in which the calendar resides
  * @param $calendar resource The calendar to get the items from
  * @param $viewstart int Timestamp of beginning of view window
  * @param $viewend int Timestamp of end of view window
  * @param $propsrequested array Array of properties to return
  * @param $rows array Array of rowdata as if they were returned directly from mapi_table_queryrows. Each recurring item is
  *                    expanded so that it seems that there are only many single appointments in the table.
  */
 static function getCalendarItems($store, $calendar, $viewstart, $viewend, $propsrequested)
 {
     return getCalendarItems($store, $calendar, $viewstart, $viewend, $propsrequested);
 }