Пример #1
0
 function check_related_task()
 {
     ajx_current("empty");
     //I find all those related to the task to find out if the original
     $task_related = ProjectTasks::findByRelated(array_var($_REQUEST, 'related_id'));
     if (!$task_related) {
         $task_related = ProjectTasks::findById(array_var($_REQUEST, 'related_id'));
         //is not the original as the original look plus other related
         if ($task_related->getOriginalTaskId() != "0") {
             ajx_extra_data(array("status" => true));
         } else {
             ajx_extra_data(array("status" => false));
         }
     } else {
         ajx_extra_data(array("status" => true));
     }
 }
Пример #2
0
 /**
  * End task templates
  */
 function getArrayInfo($full = false)
 {
     if (config_option("wysiwyg_tasks")) {
         if ($this->getTypeContent() == "text") {
             $desc = nl2br(htmlspecialchars($this->getText()));
         } else {
             $desc = purify_html(nl2br($this->getText()));
         }
     } else {
         if ($this->getTypeContent() == "text") {
             $desc = htmlspecialchars($this->getText());
         } else {
             $desc = html_to_text(html_entity_decode(nl2br($this->getText()), null, "UTF-8"));
         }
     }
     $result = array('id' => $this->getId(), 't' => $this->getObjectName(), 'desc' => $desc, 'members' => $this->getMemberIds(), 'c' => $this->getCreatedOn() instanceof DateTimeValue ? $this->getCreatedOn()->getTimestamp() : 0, 'cid' => $this->getCreatedById(), 'otype' => $this->getObjectSubtype(), 'percentCompleted' => $this->getPercentCompleted(), 'memPath' => str_replace('"', "'", str_replace("'", "\\'", json_encode($this->getMembersToDisplayPath()))));
     if ($full) {
         $result['description'] = $this->getText();
     }
     $result['multiAssignment'] = $this->getColumnValue('multi_assignment', 0);
     if ($this->isCompleted()) {
         $result['s'] = 1;
     }
     if ($this->getParentId() > 0) {
         $result['pid'] = $this->getParentId();
     }
     //if ($this->getPriority() != 200)
     $result['pr'] = $this->getPriority();
     if ($this->getMilestoneId() > 0) {
         $result['mid'] = $this->getMilestoneId();
     }
     if ($this->getAssignedToContactId() > 0) {
         $result['atid'] = $this->getAssignedToContactId();
     }
     $result['atName'] = $this->getAssignedToName();
     if ($this->getCompletedById() > 0) {
         $result['cbid'] = $this->getCompletedById();
         $result['con'] = $this->getCompletedOn()->getTimestamp();
     }
     if ($this->getDueDate() instanceof DateTimeValue) {
         $result['dd'] = $this->getDueDate()->getTimestamp() + logged_user()->getTimezone() * 3600;
         $result['udt'] = $this->getUseDueTime() ? 1 : 0;
     }
     if ($this->getStartDate() instanceof DateTimeValue) {
         $result['sd'] = $this->getStartDate()->getTimestamp() + logged_user()->getTimezone() * 3600;
         $result['ust'] = $this->getUseStartTime() ? 1 : 0;
     }
     $time_estimate = $this->getTimeEstimate();
     $result['TimeEstimate'] = $this->getTimeEstimate();
     if ($time_estimate > 0) {
         $result['estimatedTime'] = DateTimeValue::FormatTimeDiff(new DateTimeValue(0), new DateTimeValue($time_estimate * 60), 'hm', 60);
     }
     $result['tz'] = logged_user()->getTimezone() * 3600;
     $ot = $this->getOpenTimeslots();
     if ($ot) {
         $users = array();
         $time = array();
         $paused = array();
         foreach ($ot as $t) {
             $time[] = $t->getSeconds();
             $users[] = $t->getContactId();
             $paused[] = $t->isPaused() ? 1 : 0;
             if ($t->isPaused() && $t->getContactId() == logged_user()->getId()) {
                 $result['wpt'] = $t->getPausedOn()->getTimestamp();
             }
         }
         $result['wt'] = $time;
         $result['wid'] = $users;
         $result['wp'] = $paused;
     }
     if ($this->isRepetitive()) {
         $result['rep'] = 1;
     } else {
         //I find all those related to the task to find out if the original
         $task_related = ProjectTasks::findByRelated($this->getObjectId());
         if (!$task_related) {
             //is not the original as the original look plus other related
             if ($this->getOriginalTaskId() != "0") {
                 $task_related = ProjectTasks::findByTaskAndRelated($this->getObjectId(), $this->getOriginalTaskId());
             }
         }
         if ($task_related) {
             $result['rep'] = 1;
         }
     }
     return $result;
 }