Ejemplo n.º 1
0
/**
 * Rebind an event to a new Cal Event
 * @param [type] $oldEventId
 * @param [type] $newEventId
 * @param [type] $splitDate
 * @param [type] $untilEnd_yn
*/
function churchservice_rebindServicesToNewEvent($oldEventId, $newEventId, $splitDate, $untilEnd_yn)
{
    ct_log("Split CSEvent {$oldEventId} to {$newEventId} at " . $splitDate->format('Y-m-d H:i:s') . " until end: {$untilEnd_yn}", 2);
    db_update("cs_event")->fields(array("cc_cal_id" => $newEventId))->condition('cc_cal_id', $oldEventId, "=")->condition('DATE(startdate)', $splitDate->format('Y-m-d'), $untilEnd_yn ? ">=" : "=")->execute();
}
Ejemplo n.º 2
0
 /**
  * [setPassedPrestations description]
  * @param [type] $date      [description]
  * @param [type] $day       [description]
  * @param [type] $status    [description]
  * @param [type] $newStatus [description]
  */
 public function getPassedPrestation($date, $status)
 {
     $qb = $this->_em->createQueryBuilder();
     $qb->select('p')->from('MainCommonBundle:Prestations\\Prestation', 'p')->where('p.startTime < :day')->andWhere('p.status = :status')->setParameters(array('day' => $date->format('Y-m-d'), 'status' => $status));
     $query = $qb->getQuery();
     return $query->getResult();
 }
Ejemplo n.º 3
0
/**
 * is Day date (without Time) in $event
 * @param [type] $date
 * @param [type] $event
 */
function dateInCCEvent($date, $event)
{
    $ret = false;
    if ($event == null) {
        return false;
    }
    $ds = getAllDatesWithRepeats((object) $event, 0, 9999, new DateTime($event["startdate"]));
    if ($ds) {
        foreach ($ds as $d) {
            if ($date->format("Ymd") == $d->format("Ymd")) {
                $ret = true;
            }
        }
    }
    return $ret;
}