Beispiel #1
0
 /**
  * Delete a task
  */
 public function delete($id, array $parameters = array())
 {
     global $USER;
     $result = array();
     if ($id = $this->checkTaskId($id)) {
         $task = new \CTaskItem($id, $USER->GetId());
         $task->delete();
     }
     return $result;
 }
Beispiel #2
0
} catch (Exception $e) {
    $arTask = null;
}
if (isset($_REQUEST["ACTION"]) && check_bitrix_sessid()) {
    if ($arTask) {
        $action = $_REQUEST['ACTION'];
        $taskID = $arTask["ID"];
        $redirectTo = null;
        try {
            if ($action == "delete") {
                if ($_REQUEST["back_url"]) {
                    $redirectTo = $_REQUEST["back_url"];
                } else {
                    $redirectTo = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_TASKS"]);
                }
                $oTask->delete();
            } elseif ($action == "elapsed_add") {
                $redirectTo = $APPLICATION->GetCurPageParam(RandString(8), array("ACTION", "sessid")) . "#elapsed";
                $minutes = (int) $_POST['HOURS'] * 60 + (int) $_POST['MINUTES'];
                CTaskElapsedItem::add($oTask, array('MINUTES' => $minutes, 'COMMENT_TEXT' => trim($_POST["COMMENT_TEXT"])));
            } elseif ($action === 'elapsed_update') {
                $seconds = (int) $_POST['HOURS'] * 3600 + (int) $_POST['MINUTES'] * 60;
                if (isset($_POST['SECONDS']) && $_POST['SECONDS'] > 0) {
                    $seconds += (int) $_POST['SECONDS'];
                }
                $redirectTo = $APPLICATION->GetCurPageParam("", array("ACTION", "sessid")) . "#elapsed";
                $oElapsedItem = new CTaskElapsedItem($oTask, (int) $_POST['ELAPSED_ID']);
                $oElapsedItem->update(array('SECONDS' => $seconds, 'COMMENT_TEXT' => trim($_POST["COMMENT_TEXT"])));
            } elseif ($action === 'elapsed_delete') {
                $redirectTo = $APPLICATION->GetCurPageParam("", array("ACTION", "sessid", "ELAPSED_ID")) . "#elapsed";
                $oElapsedItem = new CTaskElapsedItem($oTask, (int) $_GET['ELAPSED_ID']);