/** * Delete a check list item */ public function delete($id) { global $USER; $result = array(); if ($id = $this->checkId($id)) { // get task id $taskId = $this->getOwnerTaskId($id); if ($taskId) { $task = \CTaskItem::getInstanceFromPool($taskId, $USER->GetId()); // or directly, new \CTaskItem($taskId, $USER->GetId()); $item = new \CTaskCheckListItem($task, $id); $item->delete(); } } return $result; }
$oCheckListItem = new CTaskCheckListItem($oTask, $itemId); $returnValue = null; switch ($arAction['operation']) { case 'CTaskCheckListItem::moveAfterItem()': $insertAfterItemId = BXTasksResolveDynaParamValue($arAction['insertAfterItemId'], array('$arOperationsResults' => $arOperationsResults)); CTaskAssert::assertLaxIntegers($insertAfterItemId); $oCheckListItem->moveAfterItem($insertAfterItemId); break; case 'CTaskCheckListItem::complete()': $oCheckListItem->complete(); break; case 'CTaskCheckListItem::renew()': $oCheckListItem->renew(); break; case 'CTaskCheckListItem::delete()': $oCheckListItem->delete(); break; case 'CTaskCheckListItem::isComplete()': $returnValue = $oCheckListItem->isComplete(); break; case 'CTaskCheckListItem::update()': $arFields = array(); if (isset($arAction['checklistData']['TITLE'])) { $arFields['TITLE'] = $arAction['checklistData']['TITLE']; } if (isset($arAction['checklistData']['IS_COMPLETE'])) { $arFields['IS_COMPLETE'] = $arAction['checklistData']['IS_COMPLETE']; } $returnValue = $oCheckListItem->update($arFields); break; default: