Exemplo n.º 1
0
 public static function update($userId, $taskId, $itemId, array $data, array $parameters = array('PUBLIC_MODE' => false))
 {
     $errors = static::ensureHaveErrorCollection($parameters);
     if ($parameters['PUBLIC_MODE']) {
         $data = static::filterData($data, $errors);
     }
     if ($errors->checkNoFatals()) {
         $task = static::getTask($userId, $taskId);
         $item = new \CTaskCheckListItem($task, $itemId);
         $item->update($data);
     }
     return array('TASK' => $task, 'ERRORS' => $errors);
 }
Exemplo n.º 2
0
 /**
  * Update a check list item
  */
 public function update($id, array $data, array $parameters = array())
 {
     global $USER;
     $result = array();
     if ($id = $this->checkId($id)) {
         if (isset($data['TASK_ID'])) {
             $this->add('FIELD_NOT_ALLOWED', 'You are not allowed to pass TASK_ID field', Collection::TYPE_WARNING, array('TASK_ID'));
             unset($data['TASK_ID']);
             // not allowed to change TASK_ID of an existing item
         }
         // 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->update($data);
         }
     }
     return $result;
 }
Exemplo n.º 3
0
             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:
             throw new Exception('Unknown operation: ' . $arAction['operation']);
             break;
     }
     $arCurOperationResult = array('returnValue' => $returnValue, 'requestedItemId' => $itemId);
     break;
 case 'CTaskTimerManager::start()':
 case 'CTaskTimerManager::stop()':
     CTaskAssert::assert(isset($arAction['taskData'], $arAction['taskData']['ID']));
     // Is task id the result of previous operation in batch?
     $taskId = BXTasksResolveDynaParamValue($arAction['taskData']['ID'], array('$arOperationsResults' => $arOperationsResults));
     CTaskAssert::assertLaxIntegers($taskId);
     $oTaskTimer = CTaskTimerManager::getInstance($loggedInUserId);
     if ($arAction['operation'] === 'CTaskTimerManager::start()') {