</div> <div class="checkbox checkbox-success"> <input type="checkbox" class="styled" > <label> </label> </div> </div> <div class="col-sm-3 col-xs-9 thumbnail"> <div id="datepicker-in"></div> </div> <div class="col-sm-4 col-sm-offset-2"> <div class="form-group"> <label class="col-sm-3 control-label">Day</label> <div class="col-sm-9"> <select class="selectpicker show-menu-arrow" data-style="btn-green"> <?php echo addDays(); ?> </select> </div> </div> <div class="form-group"> <label class="col-sm-3 control-label">Month</label> <div class="col-sm-9"> <select id="m" class="selectpicker show-menu-arrow" data-style="btn-green"> <?php echo addMonth(); ?> </select> </div> </div> <div class="form-group">
/* DOCS http://php.net/manual/en/function.strtotime.php http://php.net/manual/en/function.date.php */ echo '<br />'; /* now with functions... */ function addDays($date, $format, $days) { return date($format, strtotime($date . "+" . $days . " days")); } function addMonths($date, $format, $months) { return date($format, strtotime($date . "+" . $months . " months")); } function formatDate($date, $format) { return date($format, strtotime($date)); } $format = 'Y-m-d'; $date = "2016-02-22"; $date = addDays($date, $format, 4); $date = addMonths($date, $format, 3); echo formatDate($date, 'd/m/Y'); /* = thousands of tedious heavy-parametrized functions catalog, one for every problem to solve...*/ /* good luck finding the one you need */ /*now with objects...*/ $date = new MyDate("2016-02-22", 'Y-m-d'); $date->addDays(4); $date->addMonths(3); echo $date->format('d/m/Y'); /* perfectly understandable code, well organized (every object has its own set of functions) */
$search = "where movilid<>'' "; } if ($QPERMISO <= 3) { $search .= "and email='{$EMAIL}' "; } $table = ""; //////////////////////////////////////////////////// //INFORMES //////////////////////////////////////////////////// if ($QPERMISO >= 3) { if (!isset($resultados)) { $resultados = ""; } if (!isset($infechaini)) { $infechafin = $DATE; $infechaini = addDays($infechafin, "-180"); } $infecharango = fechaRango("infecharango", $infechaini, $infechafin); $table .= <<<T <div style="background:lightgray;padding:10px;margin:auto;width:90%"> <form> <input type="hidden" name="mode" value="lista"> <h3>Informes</h3> <p style="font-size:12px"> Rango de fechas: {$infecharango}<br/> <input type="submit" name="action" value="Informe"> </p> {$resultados} </form> </div> T;
} // reminder email every 7 days after removal if ($now > $to && $now->format('w') == $to->format('w') && $project->getState() != 'Pending Approval') { echo "Anniversary of deadline, sending reminder and logging\n"; mail($user->getEmail(), $subject, $message, $headers); $logmsg = 'Week anniversary of Passed Deadline, reminder email sent to owner'; $project->submitLog($logmsg, false); $project->submitMailingList($logmsg); } // a day after removal update the status to 'Passed Deadline' if ($now >= addDays($to, 1) && $project->getState() != 'Pending Approval' && $project->getState() != 'Passed Deadline') { echo "Setting status to Passed Deadline and updating Mailing List\n"; $project->setState('Passed Deadline'); $project->store(); $logmsg = 'Status automatically changed to ' . $project->getState(); $project->submitLog($logmsg, false); $project->submitMailingList($logmsg); } // if it was never approved (manually or automatically) three weeks after it was meant to start update the status to 'Archived' if ($now >= addDays($from, 21) && $project->getState() == 'Pending Approval') { echo "Old request detected, setting status to Archived\n"; $project->setState('Archived'); $project->store(); $project->submitLog('Status automatically changed to Unapproved', false); $project->submitLog('Status automatically changed to ' . $project->getState(), false); } } if (count($projects) == 0) { echo "No outstanding requests.\n"; } echo "All done.\n";