Пример #1
0
 /**
  * delete entry
  *
  * @param  string  $_collectionId
  * @param  string  $_id
  * @param  array   $_options
  */
 public function deleteEntry($_folderId, $_serverId, $_collectionData)
 {
     if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
         Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . " delete ColectionId: {$_folderId} Id: {$_serverId}");
     }
     $this->_contentController->delete($_serverId);
 }
 /**
  * (non-PHPdoc)
  * @see Syncroton_Data_IData::deleteEntry()
  */
 public function deleteEntry($folderId, $serverId, $collectionData)
 {
     if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
         Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . " delete ColectionId: {$folderId} Id: {$serverId}");
     }
     try {
         $this->_contentController->delete($serverId);
     } catch (Tinebase_Exception_AccessDenied $tead) {
         throw new Syncroton_Exception_AccessDenied();
     } catch (Tinebase_Exception_NotFound $tenf) {
         throw new Syncroton_Exception_NotFound();
     }
 }
 /**
  * Deletes a set of records.
  * 
  * If one of the records could not be deleted, no record is deleted
  * 
  * @param   array array of record identifiers
  * @return  void
  * @throws Tinebase_Exception_NotFound|Tinebase_Exception
  */
 public function delete($_ids)
 {
     $courses = $this->getMultiple($_ids);
     $groupsToDelete = array();
     $usersToDelete = array();
     foreach ($courses as $course) {
         $groupsToDelete[] = $course->group_id;
         $usersToDelete = array_merge($usersToDelete, $this->_groupController->getGroupMembers($course->group_id));
     }
     Courses_Controller::getInstance()->suspendEvents();
     $this->_userController->delete(array_unique($usersToDelete));
     $this->_groupController->delete(array_unique($groupsToDelete));
     Courses_Controller::getInstance()->resumeEvents();
     parent::delete($_ids);
 }
Пример #4
0
 /**
  * Deletes a set of records.
  * 
  * @param   array array of record identifiers
  * @return  void
  */
 public function delete($_ids)
 {
     parent::delete($_ids);
     // check if default account got deleted and set new default account
     if (in_array(Tinebase_Core::getPreference($this->_applicationName)->{Felamimail_Preference::DEFAULTACCOUNT}, (array) $_ids)) {
         $accounts = $this->search();
         $defaultAccountId = count($accounts) > 0 ? $accounts->getFirstRecord()->getId() : '';
         Tinebase_Core::getPreference($this->_applicationName)->{Felamimail_Preference::DEFAULTACCOUNT} = $defaultAccountId;
     }
 }
 /**
  * Deletes a set of records.
  * 
  * If one of the records could not be deleted, no record is deleted
  * 
  * @param   array $_ids array of record identifiers
  * @param   string $range
  * @return  NULL
  * @throws Tinebase_Exception_NotFound|Tinebase_Exception
  */
 public function delete($_ids, $range = Calendar_Model_Event::RANGE_THIS)
 {
     if ($_ids instanceof $this->_modelName) {
         $_ids = (array) $_ids->getId();
     }
     $records = $this->_backend->getMultiple((array) $_ids);
     if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
         Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . " Deleting " . count($records) . ' with range ' . $range . ' ...');
     }
     foreach ($records as $record) {
         if ($record->isRecurException() && in_array($range, array(Calendar_Model_Event::RANGE_ALL, Calendar_Model_Event::RANGE_THISANDFUTURE))) {
             $this->_deleteExdateRange($record, $range);
         }
         try {
             $db = $this->_backend->getAdapter();
             $transactionId = Tinebase_TransactionManager::getInstance()->startTransaction($db);
             // delete if delete grant is present
             if ($this->_doContainerACLChecks === FALSE || $record->hasGrant(Tinebase_Model_Grants::GRANT_DELETE)) {
                 // NOTE delete needs to update sequence otherwise iTIP based protocolls ignore the delete
                 $record->status = Calendar_Model_Event::STATUS_CANCELED;
                 $this->_touch($record);
                 if ($record->isRecurException()) {
                     try {
                         $baseEvent = $this->getRecurBaseEvent($record);
                         $this->_touch($baseEvent);
                     } catch (Tinebase_Exception_NotFound $tnfe) {
                         // base Event might be gone already
                         if (Tinebase_Core::isLogLevel(Zend_Log::NOTICE)) {
                             Tinebase_Core::getLogger()->notice(__METHOD__ . '::' . __LINE__ . " BaseEvent of exdate {$record->uid} to delete not found ");
                         }
                     }
                 }
                 parent::delete($record);
             } else {
                 if ($record->attendee instanceof Tinebase_Record_RecordSet) {
                     if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
                         Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . " user has no deleteGrant for event: " . $record->id . ", updating own status to DECLINED only");
                     }
                     $ownContact = Tinebase_Core::getUser()->contact_id;
                     foreach ($record->attendee as $attender) {
                         if ($attender->user_id == $ownContact && in_array($attender->user_type, array(Calendar_Model_Attender::USERTYPE_USER, Calendar_Model_Attender::USERTYPE_GROUPMEMBER))) {
                             $attender->status = Calendar_Model_Attender::STATUS_DECLINED;
                             $this->attenderStatusUpdate($record, $attender, $attender->status_authkey);
                         }
                     }
                 }
             }
             // increase display container content sequence for all attendee of deleted event
             if ($record->attendee instanceof Tinebase_Record_RecordSet) {
                 foreach ($record->attendee as $attender) {
                     $this->_increaseDisplayContainerContentSequence($attender, $record, Tinebase_Model_ContainerContent::ACTION_DELETE);
                 }
             }
             Tinebase_TransactionManager::getInstance()->commitTransaction($transactionId);
         } catch (Exception $e) {
             Tinebase_TransactionManager::getInstance()->rollBack();
             throw $e;
         }
     }
 }
 /**
  * delete access log entries
  *
  * @param   array $_ids list of logIds to delete
  */
 public function delete($_ids)
 {
     $this->checkRight('MANAGE_DEVICES');
     return parent::delete($_ids);
 }
Пример #7
0
 /**
  * Deletes a set of records.
  * 
  * If one of the records could not be deleted, no record is deleted
  * 
  * @param   array array of record identifiers
  * @return  Tinebase_Record_RecordSet
  */
 public function delete($_ids)
 {
     $deletedRecords = parent::delete($_ids);
     Tinebase_Core::getCache()->clean(Zend_Cache::CLEANING_MODE_MATCHING_TAG, array('container'));
     return $deletedRecords;
 }
Пример #8
0
 /**
  * Deletes a set of records.
  * 
  * If one of the records could not be deleted, no record is deleted
  * 
  * @param   array array of record identifiers
  * @return  Tinebase_Record_RecordSet
  * @throws Tinebase_Exception_NotFound|Tinebase_Exception
  */
 public function delete($_ids)
 {
     if ($_ids instanceof $this->_modelName) {
         $_ids = (array) $_ids->getId();
     }
     $records = $this->_backend->getMultiple((array) $_ids);
     foreach ($records as $record) {
         try {
             $db = $this->_backend->getAdapter();
             $transactionId = Tinebase_TransactionManager::getInstance()->startTransaction($db);
             // delete if delete grant is present
             if ($this->_doContainerACLChecks === FALSE || $record->hasGrant(Tinebase_Model_Grants::GRANT_DELETE)) {
                 // NOTE delete needs to update sequence otherwise iTIP based protocolls ignore the delete
                 $this->_touch($record);
                 parent::delete($record);
             } else {
                 if ($record->attendee instanceof Tinebase_Record_RecordSet) {
                     if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
                         Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . " user has no deleteGrant for event: {$records->id}, updating own status to DECLINED only");
                     }
                     $ownContact = Tinebase_Core::getUser()->contact_id;
                     foreach ($record->attendee as $attender) {
                         if ($attender->user_id == $ownContact && in_array($attender->user_type, array(Calendar_Model_Attender::USERTYPE_USER, Calendar_Model_Attender::USERTYPE_GROUPMEMBER))) {
                             $attender->status = Calendar_Model_Attender::STATUS_DECLINED;
                             $this->attenderStatusUpdate($record, $attender, $attender->status_authkey);
                         }
                     }
                 }
             }
             // increase display container content sequence for all attendee of deleted event
             if ($record->attendee instanceof Tinebase_Record_RecordSet) {
                 foreach ($record->attendee as $attender) {
                     $this->_increaseDisplayContainerContentSequence($attender, $record, Tinebase_Model_ContainerContent::ACTION_DELETE);
                 }
             }
             Tinebase_TransactionManager::getInstance()->commitTransaction($transactionId);
         } catch (Exception $e) {
             Tinebase_TransactionManager::getInstance()->rollBack();
             throw $e;
         }
     }
 }