コード例 #1
0
ファイル: ajax.php プロジェクト: mrdeadmouse/u136006
 case 'CTaskCheckListItem::update()':
 case 'CTaskCheckListItem::moveAfterItem()':
     CTaskAssert::assert(isset($arAction['taskId'], $arAction['itemId']));
     // Is task id the result of previous operation in batch?
     $taskId = BXTasksResolveDynaParamValue($arAction['taskId'], array('$arOperationsResults' => $arOperationsResults));
     // Is item id the result of previous operation in batch?
     $itemId = BXTasksResolveDynaParamValue($arAction['itemId'], array('$arOperationsResults' => $arOperationsResults));
     CTaskAssert::assertLaxIntegers($taskId, $itemId);
     $oTask = CTaskItem::getInstanceFromPool($taskId, $loggedInUserId);
     $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();
コード例 #2
0
ファイル: checklist.php プロジェクト: DarneoStudio/bitrix
 /**
  * Move a specified check list item after another check list item
  */
 public function moveAfter($id, $afterId)
 {
     // you can move check list items ONLY when you have write access to the task
     global $USER;
     $result = array();
     if (($id = $this->checkId($id)) && ($afterId = $this->checkId($afterId))) {
         if ($id != $afterId) {
             // get task id
             $taskId = $this->getOwnerTaskId($id);
             if ($taskId) {
                 $task = \CTaskItem::getInstanceFromPool($taskId, $USER->GetId());
                 // or directly, new \CTaskItem($taskId, $USER->GetId());
                 if (!$task->isActionAllowed(\CTaskItem::ACTION_EDIT)) {
                     throw new Tasks\ActionNotAllowedException('Checklist move after', array('AUX' => array('ERROR' => array('TASK_ID' => $taskId, 'ITEM' => $id, 'AFTER_ITEM' => $afterId))));
                 }
                 $item = new \CTaskCheckListItem($task, $id);
                 $item->moveAfterItem($afterId);
             }
         }
     }
     return $result;
 }