public function importFromPost(array $a_post = null) { $post = $this->extractPostValues($a_post); if ($post && $this->shouldBeImportedFromPost($post)) { include_once "Services/ADT/classes/class.ilADTDateSearchUtil.php"; if ((bool) $this->text_input) { $date = ilADTDateSearchUtil::handleTextInputPost(ilADTDateSearchUtil::MODE_DATETIME, $post); } else { $date = ilADTDateSearchUtil::handleSelectInputPost(ilADTDateSearchUtil::MODE_DATETIME, $post); } // :TODO: all dates are imported as valid if ($date) { $date = new ilDateTime($date, IL_CAL_UNIX); } if ($this->getForm() instanceof ilPropertyFormGUI) { $item = $this->getForm()->getItemByPostVar($this->getElementId()); $item->setDate($date); } else { if (array_key_exists($this->getElementId(), $this->table_filter_fields)) { $this->table_filter_fields[$this->getElementId()]->setDate($date); $this->writeFilter($date->get(IL_CAL_DATETIME)); } } $this->getADT()->setDate($date); } else { $this->writeFilter(); $this->getADT()->setDate(); } }
public function importFromPost(array $a_post = null) { $post = $this->extractPostValues($a_post); if ($post && $this->shouldBeImportedFromPost($post)) { $start = $end = null; include_once "Services/ADT/classes/class.ilADTDateSearchUtil.php"; if (!$this->getForm() instanceof ilPropertyFormGUI || (bool) $this->text_input) { $start = ilADTDateSearchUtil::handleTextInputPost(ilADTDateSearchUtil::MODE_DATE, $post["lower"]); $end = ilADTDateSearchUtil::handleTextInputPost(ilADTDateSearchUtil::MODE_DATE, $post["upper"]); } else { // if checkInput() is called before, this will not work $start = ilADTDateSearchUtil::handleSelectInputPost(ilADTDateSearchUtil::MODE_DATE, $post["lower"]); $end = ilADTDateSearchUtil::handleSelectInputPost(ilADTDateSearchUtil::MODE_DATE, $post["upper"]); } if ($start && $end && $start > $end) { $tmp = $start; $start = $end; $end = $tmp; } // :TODO: all dates are imported as valid if ($start) { $start = new ilDate($start, IL_CAL_UNIX); } if ($end) { $end = new ilDate($end, IL_CAL_UNIX); } if ($this->getForm() instanceof ilPropertyFormGUI) { $item = $this->getForm()->getItemByPostVar($this->getElementId() . "[lower]"); $item->setDate($start); $item = $this->getForm()->getItemByPostVar($this->getElementId() . "[upper]"); $item->setDate($end); if (!(bool) $this->text_input) { $item = $this->getForm()->getItemByPostVar($this->getElementId() . "[tgl]"); $item->setChecked(true); } } else { if (array_key_exists($this->getElementId(), $this->table_filter_fields)) { $this->table_filter_fields[$this->getElementId()]->getCombinationItem("lower")->setDate($start); $this->table_filter_fields[$this->getElementId()]->getCombinationItem("upper")->setDate($end); $this->writeFilter(array("lower" => !$start || $start->isNull() ? null : $start->get(IL_CAL_DATE), "upper" => !$end || $end->isNull() ? null : $end->get(IL_CAL_DATE))); } } $this->getLowerADT()->setDate($start); $this->getUpperADT()->setDate($end); } else { if ($this->getForm() instanceof ilPropertyFormGUI && !(bool) $this->text_input) { $item = $this->getForm()->getItemByPostVar($this->getElementId() . "[tgl]"); $item->setChecked(false); } $this->getLowerADT()->setDate(); $this->getUpperADT()->setDate(); } }