Пример #1
0
 public function assureValueObject($value)
 {
     if ($value) {
         return \Bitrix\Tasks\Util\Type\DateTime::createFromInstance($value);
     }
     return $value;
 }
Пример #2
0
 /**
  * Set task END_DATE_PLAN from user time string as GMT
  * 
  * @param string $timeString Datetime that treated as GMT
  * @return void
  */
 public function setEndDatePlanUserTimeGmt($timeString)
 {
     $this->ensureDataLoaded();
     if ((string) $timeString == '') {
         $this->endDatePlanGmt = null;
         $this->arTaskData['END_DATE_PLAN'] = null;
     } else {
         $this->endDatePlanGmt = DateTime::createFromUserTimeGmt($timeString);
         $this->arTaskData['END_DATE_PLAN'] = DateTime::createFromUserTime($timeString);
     }
 }
Пример #3
0
 protected function getTaskRelationHash()
 {
     $id = $this->taskId;
     $result = array();
     if ($id) {
         global $DB;
         $sql = DependenceTable::getSubTreeSql($id);
         $res = $DB->query($sql);
         $items = array();
         // all items
         $taskData = array($id => true);
         // actual task list in bundle
         while ($item = $res->fetch()) {
             // make datetime objects
             if ($item['CREATED_DATE']) {
                 $item['CREATED_DATE'] = DateTime::createFromUserTimeGmt($item['CREATED_DATE']);
             }
             if ($item['START_DATE_PLAN']) {
                 $item['START_DATE_PLAN'] = DateTime::createFromUserTimeGmt($item['START_DATE_PLAN']);
             }
             if ($item['END_DATE_PLAN']) {
                 $item['END_DATE_PLAN'] = DateTime::createFromUserTimeGmt($item['END_DATE_PLAN']);
             }
             $items[] = $item;
             $taskId = $item['TASK_ID'];
             unset($item['TASK_ID']);
             unset($item['TYPE']);
             unset($item['FROM_TASK_ID']);
             $taskData[$taskId] = $item;
         }
         $relations = array();
         foreach ($items as $item) {
             if (isset($taskData[$item['FROM_TASK_ID']])) {
                 $pid = $item['FROM_TASK_ID'];
                 $relations[$pid][$item['TASK_ID']] = array('TASK_ID' => $item['TASK_ID'], 'TYPE' => $item['TYPE'], 'FROM_TASK_ID' => $item['FROM_TASK_ID']);
             }
             // else skip this relation
         }
         $this->makeRelationTree($this->taskId, $relations, $taskData);
         $filteredRelations = array();
     }
 }
Пример #4
0
 public function getEndOfCurrentDayGmt()
 {
     $dateTime = DateTime::createFromUserTimeGmt((string) new DateTime());
     $dateTime->stripTime();
     // this will only work on GMT zone
     $dateTime->addDay(1);
     return $dateTime;
 }