Esempio n. 1
0
 /**
  * Create one or more calendar items
  *
  * @param $items CalendarItem[]|CalendarItem|Array or more calendar items to create
  * @return \jamesiarmes\PEWS\API\CreateItemResponseType
  */
 public function createCalendarItems($items)
 {
     //If the item passed in is an object, or if it's an assosiative array waiting to be an object, let's put it in to an array
     if (!is_array($items) || Type::arrayIsAssoc($items)) {
         $items = array($items);
     }
     $item = array('CalendarItem' => $items);
     $options = array('SendMeetingInvitations' => Enumeration\CalendarItemCreateOrDeleteOperationType::SEND_TO_NONE, 'SavedItemFolderId' => $this->getFolderIdsArray(), 'ParentFolderIds' => $this->getFolderIdsArray());
     $items = $this->createItems($item, $options);
     if (!is_array($items)) {
         $items = array($items);
     }
     return $items;
 }
Esempio n. 2
0
 /**
  * @param $items Type\ItemIdType|Type\ItemIdType[]
  * @param array $options
  * @return bool
  */
 public function deleteItems($items, $options = array())
 {
     if (!is_array($items) || Type::arrayIsAssoc($items)) {
         $items = array($items);
     }
     $itemIds = array();
     foreach ($items as $item) {
         if ($item instanceof Type\ItemIdType) {
             $item = $item->toArray();
         }
         $item = (array) $item;
         $itemIds[] = array('Id' => $item['Id'], 'ChangeKey' => $item['ChangeKey']);
     }
     $request = array('ItemIds' => array('ItemId' => $itemIds), 'DeleteType' => 'MoveToDeletedItems');
     $request = array_replace_recursive($request, $options);
     $request = Type::buildFromArray($request);
     $this->getClient()->DeleteItem($request);
     //If the delete fails, an Exception will be thrown in processResponse before it gets here
     return true;
 }
Esempio n. 3
0
 public function deleteItems($items, $options = array())
 {
     if (!is_array($items) || Type::arrayIsAssoc($items)) {
         $items = array($items);
     }
     $itemIds = array();
     foreach ($items as $item) {
         $item = (array) $item;
         $itemIds[] = array('Id' => $item['Id'], 'ChangeKey' => $item['ChangeKey']);
     }
     $request = array('ItemIds' => array('ItemId' => $itemIds), 'DeleteType' => 'MoveToDeletedItems');
     $request = array_merge($request, $options);
     $request = Type::buildFromArray($request);
     return $this->getClient()->DeleteItem($request);
 }