예제 #1
0
         unset($item);
         $itemsDatas['total']--;
         continue;
     }
 }
 //Undelete item
 if ($undelete && $object->isPrimaryResource()) {
     $item->undelete();
 }
 //unpublish
 if ($unpublish && $object->isPrimaryResource()) {
     //set item date end to yesterday
     $dt_end = new CMS_date();
     $dt_end->setDebug(false);
     $dt_end->setNow();
     $dt_end->moveDate('-1 day');
     $dateStart = $item->getPublicationDateStart(false);
     if (CMS_date::compare($dateStart, $dt_end, '>')) {
         $dateStart = $dt_end;
     }
     $item->setPublicationDates($dateStart, $dt_end);
     $item->writeToPersistence();
 }
 //publish
 if ($publish && $object->isPrimaryResource()) {
     //clear page date end
     $dt_end = new CMS_date();
     $dateStart = $item->getPublicationDateStart(false);
     $item->setPublicationDates($dateStart, $dt_end);
     $item->writeToPersistence();
 }
예제 #2
0
 /**
  * set object Values
  *
  * @param array $values : the POST result values
  * @param string $prefixname : the prefix used for post names
  * @return boolean true on success, false on failure
  * @access public
  */
 function writeToPersistence()
 {
     $params = $this->getParamsValues();
     $date = new CMS_date();
     if ($this->_subfieldValues[0]->getValue()) {
         $date->setFromDBValue($this->_subfieldValues[0]->getValue());
     }
     if ($params['updateDate'] || $date->isNull() && ($params['setNow'] || $params['creationDate'])) {
         $date->setNow();
         if ($params['moveDate']) {
             $date->moveDate($params['moveDate']);
         }
         if (!$this->_subfieldValues[0]->setValue($date->getDBValue())) {
             return false;
         }
     }
     return parent::writeToPersistence();
 }