コード例 #1
0
ファイル: IndexController.php プロジェクト: nyeholt/relapse
 public function deletefavouriteAction()
 {
     $fav = $this->byId(null, 'PanelFavourite');
     if ($fav) {
         $this->dbService->delete($fav);
     }
     echo $this->ajaxResponse($fav->id);
 }
コード例 #2
0
ファイル: TagService.php プロジェクト: nyeholt/relapse
 /**
  * Delete the tags for the given object
  *
  * @param object $item
  */
 public function deleteTags($item)
 {
     $type = mb_strtolower(get_class($item));
     $id = (int) $item->id;
     // okay, delete ahoy
     $this->dbService->delete('tag', 'itemtype=' . $this->dbService->quote($type) . ' and itemid=' . $id);
 }
コード例 #3
0
ファイル: FileService.php プロジェクト: nyeholt/relapse
 /**
  * Deletes a file object from the system
  *
  * @param File $file
  * @return boolean
  */
 public function deleteFile(File $file)
 {
     if (!$this->removeFile($file->path . DIRECTORY_SEPARATOR . $file->filename)) {
         $this->log->debug("Failed to delete file " . $file->filename);
         return false;
     }
     return $this->dbService->delete($file);
 }
コード例 #4
0
ファイル: FeatureService.php プロジェクト: nyeholt/relapse
 /**
  * Delete a feature and all sub features.
  */
 public function deleteFeature(Feature $feature)
 {
     $this->dbService->beginTransaction();
     $childFeatures = $this->getChildFeatures($feature);
     foreach ($childFeatures as $child) {
         $this->deleteFeature($child);
     }
     $this->dbService->delete($feature);
     $this->dbService->commit();
 }
コード例 #5
0
ファイル: ItemLinkService.php プロジェクト: nyeholt/relapse
 /**
  * Deletes an item 
  */
 public function deleteItem($item)
 {
     try {
         $this->dbService->beginTransaction();
         $this->dbService->delete('itemlink', 'toid = ' . $item->id . ' OR fromid = ' . $item->id);
         $this->dbService->commit();
     } catch (Exception $e) {
         $this->log->error("Failed deleting item " . get_class($item) . ' #' . $item->id);
         $this->dbService->rollback();
     }
 }
コード例 #6
0
ファイル: ProjectService.php プロジェクト: nyeholt/relapse
 /**
  * Removes a timesheet record from the system
  */
 public function removeTimesheetRecord(TimesheetRecord $record)
 {
     $task = $this->getTask($record->taskid);
     if (!$task) {
         throw new Exception("Cannot delete time from non-existent task");
     }
     $this->dbService->beginTransaction();
     $this->dbService->delete($record);
     $this->updateTaskTime($task);
     $this->dbService->commit();
 }
コード例 #7
0
 /**
  * Deletes the specified object. 
  */
 public function deleteAction()
 {
     if ((int) $this->_getParam('id')) {
         $model = $this->byId();
         if ($model) {
             $this->dbService->delete($model);
         }
     } else {
         throw new Exception("No object specified");
     }
     $this->onModelDeleted($model);
 }
コード例 #8
0
ファイル: DbAuthService.php プロジェクト: nyeholt/relapse
 /**
  * Remove access from a particular item 
  * 
  * @param object $item the item to remove access from
  * @param String $user The user to remove access for
  * @param String $role The role to remove (optional)
  */
 public function removeAccess($item, $user, $role = null)
 {
     if (!$item) {
         throw new Exception("Cannot remove access from null object");
     }
     $fields = array('itemid' => $item->id, 'itemtype' => get_class($item), 'authority' => $user->getUsername());
     if ($role != null) {
         $fields['role'] = $role;
     }
     $existing = $this->dbService->getByField($fields, 'UserRole');
     if ($existing != null) {
         // delete away
         $this->dbService->delete($existing);
     }
 }
コード例 #9
0
 /**
  * Remove a watch
  *
  * @param CrmUser $user
  * @param int $id
  * @param string $type
  */
 public function removeWatch($user, $id, $type)
 {
     // just delete direct, no need to get the
     // object first...
     $this->dbService->delete('itemwatch', "userid=" . $this->dbService->quote($user->username) . " AND itemid={$id} AND itemtype='{$type}'");
 }