本文整理汇总了PHP中add_date函数的典型用法代码示例。如果您正苦于以下问题:PHP add_date函数的具体用法?PHP add_date怎么用?PHP add_date使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了add_date函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: debit
public function debit()
{
$this->fondos_model->extract(CFG_COSTO_CUENTAPLUS);
$user_id = $this->session->userdata('user_id');
$date_end = add_date(date('d-m-Y'), 0, 0, CFG_TIME_CUENTAPLUS);
$query = $this->db->get_where(TBL_CUENTAPLUS, array('user_id' => $user_id));
if ($query->num_rows == 0) {
$sql = "INSERT INTO " . TBL_CUENTAPLUS . "(user_id, date_start, date_end) VALUES(";
$sql .= $user_id . ",";
$sql .= "now(),";
$sql .= "'" . $date_end . "'";
$sql .= ")";
if (!$this->db->query($sql)) {
display_error(__FILE__, "debit", ERR_DB_INSERT, array(TBL_CUENTAPLUS));
}
} else {
$sql = "UPDATE " . TBL_CUENTAPLUS . " SET ";
$sql .= "date_start = now(),";
$sql .= "date_end = '" . $date_end . "' ";
$sql .= "WHERE user_id=" . $user_id;
if (!$this->db->query($sql)) {
display_error(__FILE__, "debit", ERR_DB_UPDATE, array(TBL_CUENTAPLUS));
}
}
return true;
}
示例2: get_edition_data
function get_edition_data($edition_num, $is_package)
{
$pages = array();
$num_pages = get_number_of_pages($edition_num);
for ($page_num = 1; $page_num <= $num_pages; $page_num++) {
$pages[] = get_page_id($edition_num, $page_num);
}
$cycle = $edition_num % 10 + 1;
$edition_date = add_date(time(), $edition_num);
return array('key' => get_edition_id($edition_num), 'date' => $edition_date, 'title' => "Edition Number {$edition_num}", 'modified' => time(), 'packaged' => time(), 'status' => 'published', 'price' => 'FREE', 'thumbnail' => "http://lorempixel.com/600/800/abstract/{$cycle}/Issue-{$edition_num}-{$edition_date}/", 'newsstand_cover_art_icon_source' => "http://dummyimage.com/768x1024/000000/ffffff.png?text=Newstand+Cover+768x1024+Issue+{$edition_num}/", 'summary' => "Summary Number {$edition_num}", 'tombstone' => FALSE, 'url_type' => $is_package ? 'application/pugpigpkg+xml' : 'application/atom+xml', 'url' => "edition/{$edition_num}/" . ($is_package ? 'package.xml' : 'content.xml'), 'newsstand_summary' => "Newsstand sumamry number {$edition_num}", 'page_ids' => $pages);
}
示例3: disting
public function disting($prop_id)
{
$date_end = substr(add_date(date('d-m-Y'), 0, CFG_TIME_DISTPROP), 0, 10);
$this->fondos_model->extract(CFG_COSTO_PROPDISTING);
$sql = "INSERT INTO " . TBL_PROPERTIES_DISTING . "(prop_id, date_start, date_end) VALUES";
foreach ($prop_id as $id) {
$sql .= "(";
$sql .= $id . ",";
$sql .= "now(),";
$sql .= "'" . $date_end . "'";
$sql .= "),";
}
$sql = substr($sql, 0, -1);
if (!$this->db->query($sql)) {
display_error(__FILE__, "disting", ERR_DB_INSERT, array(TBL_PROPERTIES_DISTING));
}
return true;
}
示例4: attendance
/**
* Display employee attendance
*
* @param string $employeenumber
* @param date $start
* @param date $end
* @return string
*/
public function attendance($employeenumber, $start = NULL, $end = NULL)
{
$sdate = iif(isset($start), date_format(date_create($start), 'm/d/Y'), date('m/d/Y'));
$edate = iif(isset($end), date_format(date_create($end), 'm/d/Y'), add_date(14, date_create($start), 'm/d/Y'));
$empty[] = array('No results found.', '', '', '', '');
$params = array('header' => $this->_attendance, 'class' => array('table table-striped table-bordered dt-table'), 'id' => 'agent-attendance');
$this->_ci->load->library('MY_table', $params, 'attendance');
$attendance = $this->_ci->employeelogs->getattendance($employeenumber, $sdate, $edate);
if (isset($attendance) && !empty($attendance)) {
for ($i = 0; $i < count($attendance); $i++) {
if (!is_null($attendance[$i]->TimeIn)) {
$tabledata[] = array($attendance[$i]->Day, $attendance[$i]->Schedule, iif($attendance[$i]->Late * 60 >= 1, 'Late', ''), iif(!is_null($attendance[$i]->TimeIn), convert_date($attendance[$i]->TimeIn, 'M d, Y H:i:s'), ''), iif(!is_null($attendance[$i]->Timeout), convert_date($attendance[$i]->Timeout, 'M d, Y H:i:s'), ''));
}
}
if (isset($tabledata) && !empty($tabledata)) {
return $this->_ci->attendance->generate($tabledata);
} else {
return $this->_ci->attendance->generate($empty);
}
} else {
return $this->_ci->attendance->generate($empty);
}
}
示例5: ajouter_emploi
function ajouter_emploi($emp, $fil, $conn)
{
$str = $emp;
$time = array("1" => 8, "2" => 10, "3" => 13, "4" => 15);
$php = json_decode($str);
$json = json_encode($php, JSON_PRETTY_PRINT);
$dsemestre = "2015-09-14";
$dsemestre = new DateTime($dsemestre);
$id_f = $fil;
$dsemestre = $dsemestre->format("Y-m-d h:i:s");
$sql_s = 'INSERT INTO `disponibilite` (`id_s`, `id_ens`, `id_mat`, `sdebut`, `sfin`, `hour`, `day`,`id_f`) VALUES ';
$sql = "INSERT INTO emplois (id_m,id_f,id_e,date_debut,date_fin,id_s) VALUES ";
foreach ($php as $key => $day) {
$weekdate = add_date($dsemestre, $key - 1);
//echo $weekdate .' week date <br>';
foreach ($day as $keey => $class) {
// $keey => séance key
foreach ($class as $clas) {
$daydate = add_date($weekdate, ($clas->sdebut - 1) * 7);
//echo $daydate .' day date <br>';
$sdate = $daydate;
$sql_s .= '(' . $clas->salle . ',' . $clas->enseignant . ',' . $clas->matiere . ',' . $clas->sdebut . ',' . $clas->sfin . ',' . $keey . ',' . $key . ',' . $fil . '),';
for ($i = 0; $i < $clas->sfin - $clas->sdebut + 1; $i++) {
//echo $sdate .' Semaine '. ($class[0]->sdebut+$i) .' <br>';
$sql .= '(' . $clas->matiere . ',' . $id_f . ',' . $clas->enseignant . ',"' . add_hours($sdate, $time[$keey]) . '","' . add_hours($sdate, $time[$keey] + 2) . '",' . $clas->salle . '),';
$sdate = add_date($sdate, 7);
}
}
}
}
$sql = rtrim($sql, ',');
$sql_s = rtrim($sql_s, ',');
$request = $conn->query($sql);
$request_s = $conn->query($sql_s);
echo "1";
}
示例6: get_visits
function get_visits($fields_result, $data, $first_event_id)
{
$vals_array = array();
while ($fields = db_fetch_assoc($fields_result)) {
foreach ($data AS $subject_id => $subject) {
$dsstdtc = $subject[$first_event_id]['consent_dssstdtc'];
$rfstdtc = $subject[$first_event_id]['dm_rfstdtc'];
$usubjid = $subject[$first_event_id]['dm_usubjid'];
foreach ($subject AS $event_id => $event) {
$inner_vals = array();
/**
* events with date for this field, and the date is not prior to baseline
*/
if ($event[$fields['svstdtc']] != '' && ($event[$fields['svstdtc']] >= $rfstdtc || $event[$fields['svstdtc']] >= $dsstdtc)) {
/**
* set up date objects and interval
*/
$rfstdtc_ob = new DateTime($rfstdtc);
$visit_date_ob = new DateTime($event[$fields['svstdtc']]);
$interval_ob = $rfstdtc_ob->diff($visit_date_ob, false);
$interval = $interval_ob->format('%r%a');
/**
* Because TARGET is observational/standard of care, and such things are not defined by the protocol,
* we can't call them planned visits, so they're defined as 'expected'
*/
$expected_visits = array(28 => 'WEEK 4', 56 => 'WEEK 8', 84 => 'WEEK 12', 168 => 'WEEK24');
$visit_data = array();
$visit_week = NULL;
/**
* iterate the expected visits
*/
foreach ($expected_visits AS $day => $week) {
/**
* test fit of date to expected visits
*/
if (add_date($rfstdtc, $day) == $event[$fields['svstdtc']]) {
/**
* exact fit
* the tested date is exactly $day days after $rfstdtc
*/
$visit_week = $week;
$visit_data['visitdy'] = $day;
/**
* if a previous date was fit to this $week, delete it and use this one
*/
$have_week_index = array_search_recursive($week, $vals_array[$usubjid]);
if (false !== $have_week_index) {
unset($vals_array[$usubjid][$have_week_index]);
}
} elseif ((($day - 6) < $interval) && ($interval <= $day + 7) && false === array_search_recursive($week, $vals_array[$usubjid])) {
/**
* loose fit
* the tested date is within the $week, and we haven't already assigned this $week to another date
*/
$visit_week = $week;
$visit_data['visitdy'] = $day;
}
}
$visit_data['visit'] = $visit_week;
$visit_data['svstdy'] = $interval;
/**
* assign attributes to this visit
*/
switch ($fields['svstdtc']) {
case 'consent_dssstdtc':
/**
* handle consent_dssstdtc exception
*/
$inner_vals['visit'] = 'CONSENT';
$inner_vals['svstdtc'] = $event[$fields['svstdtc']];
$inner_vals['svstdy'] = $visit_data['svstdy'];
$inner_vals['visitdy'] = $visit_data['svstdy'];
break;
case 'dm_rfstdtc':
/**
* handle dm_rfstdtc exception
*/
$inner_vals['visit'] = 'DAY 1';
$inner_vals['svstdtc'] = $event[$fields['svstdtc']];
$inner_vals['svstdy'] = 1;
$inner_vals['visitdy'] = 1;
break;
default:
/**
* all other fields
*/
if (false === array_search_recursive($event[$fields['svstdtc']], $vals_array[$usubjid])) {
$inner_vals['visit'] = $visit_data['visit'];
$inner_vals['svstdtc'] = $event[$fields['svstdtc']];
$inner_vals['svstdy'] = $visit_data['svstdy'];
$inner_vals['visitdy'] = $visit_data['visitdy'];
if (!isset($visit_data['visit'])) {
switch ($fields['svstdtc']) {
case 'ae_aestdtc':
$inner_vals['svupdes'] = 'Adverse event';
break;
case 'chem_lbdtc':
case 'chem_im_lbdtc':
case 'cbc_lbdtc':
case 'cbc_im_lbdtc':
//.........这里部分代码省略.........
示例7: Stock
Forecast Monthly Consumption
</th>
<th style="text-align:right">
Stock on Hand
</th>
<th style="text-align:right">
Forecast Month of Stock(mos)
</th>
</tr>
</thead>
<tbody>
<?php
if (!empty($period)) {
foreach ($period as $p) {
$pd = add_date($p->forecast_start_date, $p->forecast_period * 12);
if ($pe <= $pd) {
echo "<tr>";
?>
<td>
<?php
echo $p->commodity_name;
?>
</td>
<td>
<?php
$fmc = ceil($p->forecast_monthly_consumption);
echo number_format($fmc);
?>
示例8: json_decode
include 'connect.php';
include 'facility_level_year.php';
//API login Credentials
$username = "Bootcamp";
$password = "Bootcamp2015";
$html = json_decode($period_json);
function add_date($date, $interval)
{
$date = $date;
$date = substr_replace($date, "-", 4, 0);
//echo($date);
$newdate = strtotime('+' . $interval . ' month', strtotime($date));
$newdate = date('Y-m', $newdate);
return str_replace("-", null, $newdate);
}
$last_month = add_date($html[0], 1);
//print_r($last_month);
//HTTP GET request -Using Curl -Response JSON
$url = "http://test.hiskenya.org/api/analytics?dimension=dx:BnGDrFwyQp9;c0MB4RmVjxk;qnZmg5tNSMy;gVp1KSFI69G;cPlWFYbBacW&dimension=pe:LAST_12_MONTHS&dimension=co&filter=ou:HfVjCurKxh2&displayProperty=NAME";
// $url_orgUnit="http://test.hiskenya.org/api/organisationUnits";
// $data = array("dataSet" => "$dataset", "period" => "$period", "orgUnit" => "$orgUnit");
// $data_string = http_build_query($data);
// $url.="$data_string";
// initailizing curl
$ch = curl_init();
//curl options
curl_setopt($ch, CURLOPT_POST, false);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_USERPWD, "{$username}:{$password}");
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
示例9: add_xml_observations
//.........这里部分代码省略.........
}
}
}
}
$siteInfoArray["latitude"] = $latitude;
// Get the timezone
$xmlfile2 = "http://api.geonames.org/timezone?lat=" . $latitude . "&lng=" . $longitude . "&username=deepskylog";
$timezones = simplexml_load_file($xmlfile2);
$siteInfoArray["timezone"] = $timezones->timezone->timezoneId;
$siteInfoArray["country"] = $timezones->timezone->countryName;
$siteInfoArray["country"] = $timezones->timezone->countryName;
if ($siteInfoArray["timezone"] == "") {
$siteInfoArray["timezone"] = "UTC";
}
$siteArray[$siteid] = $siteInfoArray;
}
// SESSIONS
$sessions = $dom->getElementsByTagName("sessions");
$session = $sessions->item(0)->getElementsByTagName("session");
$sessionArray = array();
foreach ($session as $session) {
$sessionInfoArray = array();
$sessionid = $session->getAttribute("id");
$sessionLang = $session->getAttribute("lang");
$sessionInfoArray['lang'] = $sessionLang;
// Get the begindate and convert it to the DeepskyLog format
$tmpBegin = $session->getElementsByTagName("begin")->item(0)->nodeValue;
$beginDate = substr($tmpBegin, 0, 10);
$beginTime = substr($tmpBegin, 11, 8);
$timeDiff = substr($tmpBegin, 19, 6);
$timeDiffHours = substr($timeDiff, 0, 3);
$timeDiffMinutes = substr($timeDiff, 4, 2);
if ($timeDiffHours > 0) {
$beginDate2 = add_date($beginDate . " " . $beginTime, -$timeDiffHours, -$timeDiffMinutes);
} else {
$beginDate2 = add_date($beginDate . " " . $beginTime, -$timeDiffHours, $timeDiffMinutes);
}
$sessionInfoArray["begindate"] = $beginDate2;
$tmpEnd = $session->getElementsByTagName("end")->item(0)->nodeValue;
$endDate = substr($tmpEnd, 0, 10);
$endTime = substr($tmpEnd, 11, 8);
$timeDiff = substr($tmpEnd, 19, 6);
$timeDiffHours = substr($timeDiff, 0, 3);
$timeDiffMinutes = substr($timeDiff, 4, 2);
if ($timeDiffHours > 0) {
$endDate2 = add_date($endDate . " " . $endTime, -$timeDiffHours, -$timeDiffMinutes);
} else {
$endDate2 = add_date($endDate . " " . $endTime, -$timeDiffHours, $timeDiffMinutes);
}
$sessionInfoArray["enddate"] = $endDate2;
// Get siteid -> Maybe we still have to add the site later
$siteid = $session->getElementsByTagName("site")->item(0)->nodeValue;
$sessionInfoArray["site"] = $siteid;
// Get all coObservers
if ($session->getElementsByTagName("coObserver")->item(0)) {
$coObs = $session->getElementsByTagName("coObserver");
$coObsArray = array();
foreach ($coObs as $coObs) {
$coObsArray[] = $coObs->nodeValue;
}
$sessionInfoArray["coObservers"] = $coObsArray;
}
// Get weather
if ($session->getElementsByTagName("weather")->item(0)) {
$sessionInfoArray["weather"] = htmlentities($session->getElementsByTagName("weather")->item(0)->nodeValue, ENT_COMPAT, "UTF-8", 0);
}
示例10: set_hcvrna_outcome
/**
* @param $record
* @param $debug
*/
public static function set_hcvrna_outcome($record, $debug)
{
global $Proj, $project_id, $ie_criteria_labels;
$enable_kint = $debug && (isset($record) && $record != '') ? true : false;
Kint::enabled($enable_kint);
$baseline_event_id = $Proj->firstEventId;
$fieldsets = array('abstracted' => array(array('date_field' => 'hcv_lbdtc'), array('value_field' => 'hcv_lbstresn'), array('detect_field' => 'hcv_supplb_hcvdtct')), 'imported' => array(array('date_field' => 'hcv_im_lbdtc'), array('value_field' => 'hcv_im_lbstresn'), array('detect_field' => 'hcv_im_supplb_hcvdtct'), array('trust' => 'hcv_im_nxtrust')));
$data = array();
$field_translate = array();
$reverse_translate = array();
foreach ($fieldsets as $formtype => $fieldset) {
$filter_logic = $formtype == 'abstracted' ? "[hcv_lbdtc] != ''" : "[hcv_im_lbdtc] != '' AND [hcv_im_nxtrust] != 'N'";
$fields = array();
foreach ($fieldset as $field) {
foreach ($field as $key => $value) {
$fields[] = $value;
$field_translate[$formtype][$key] = $value;
$reverse_translate[$formtype][$value] = $key;
}
}
$data[$formtype] = REDCap::getData('array', $record, $fields, null, null, false, false, false, $filter_logic);
}
/**
* Main
*/
$ie_fields = array('ie_ietestcd');
$ie_data = REDCap::getData('array', $record, $ie_fields);
$date_fields = array('dm_usubjid', 'dm_rfstdtc', 'dis_suppfa_txendt', 'eot_dsterm', 'dis_dsstdy', 'hcv_suppfa_fuelgbl', 'hcv_suppfa_nlgblrsn', 'hcv_suppfa_hcvout', 'hcv_suppfa_wk10rna', 'hcv_suppfa_lastbloq', 'dis_suppds_funcmprsn', 'hcv_suppfa_fudue', 'dm_suppdm_hcvt2id', 'dm_actarmcd', 'dm_suppdm_rtrtsdtc');
$date_data = REDCap::getData('array', $record, $date_fields, $baseline_event_id);
foreach ($date_data as $subject_id => $subject) {
$all_events = array();
$post_tx_dates = array();
$post_tx_bloq_dates = array();
$re_treat_candidate = false;
$re_treat_dates = array();
foreach ($subject as $date_event_id => $date_event) {
/**
* HCV RNA Outcome
*/
$hcvrna_improved = false;
$on_tx_scores = array();
$hcvrna_previous_score = '';
$post_tx_scores = array();
$post_tx_plus10w_scores = array();
$post_tx_plus10d_scores = array();
$last_hcvrna_bloq = false;
$stop_date_plus_10w = null;
$stop_date_plus_10d = null;
$tx_stopped_10_wks_ago = false;
$started_tx = false;
$stopped_tx = false;
$hcv_fu_eligible = true;
$hcv_fu_ineligible_reason = array();
$lost_to_followup = false;
$hcv_data_due = false;
$tx_start_date = isset($date_event['dm_rfstdtc']) && $date_event['dm_rfstdtc'] != '' ? $date_event['dm_rfstdtc'] : null;
$stop_date = isset($date_event['dis_suppfa_txendt']) && $date_event['dis_suppfa_txendt'] != '' ? $date_event['dis_suppfa_txendt'] : null;
$dis_dsstdy = isset($date_event['dis_dsstdy']) && $date_event['dis_dsstdy'] != '' ? $date_event['dis_dsstdy'] : null;
$eot_dsterm = isset($date_event['eot_dsterm']) && $date_event['eot_dsterm'] != '' ? $date_event['eot_dsterm'] : null;
/**
* look for this dm_usubjid in dm_suppdm_hcvt2id. This is a foreign key between TARGET 2 and TARGET 3 patients.
* Get the start date of the TARGET 3 patient if dm_suppdm_hcvt2id is not empty.
*/
$t3_fk_result = db_query("SELECT record FROM redcap_data WHERE project_id = '{$project_id}' AND field_name = 'dm_suppdm_hcvt2id' AND value = '{$date_event['dm_usubjid']}'");
if ($t3_fk_result) {
$t3_fk = db_fetch_assoc($t3_fk_result);
$t3_start_date_value = get_single_field($t3_fk['record'], $project_id, $baseline_event_id, 'dm_rfstdtc', '');
}
$t3_start_date = isset($t3_start_date_value) ? $t3_start_date_value : '';
/**
* where are we in treatment?
*/
if (isset($tx_start_date)) {
// started treatment
$started_tx = true;
/**
* treatment must have started to stop
*/
if (isset($stop_date)) {
// completed treatment
$stopped_tx = true;
$stop_date_plus_10d = add_date($stop_date, 10, 0, 0);
$stop_date_plus_10w = add_date($stop_date, 64, 0, 0);
if (date("Y-m-d") >= $stop_date_plus_10w && isset($stop_date_plus_10w)) {
$tx_stopped_10_wks_ago = true;
}
} else {
// not completed treatment
$stopped_tx = false;
$hcv_fu_eligible = false;
$hcv_fu_ineligible_reason[] = 'TX Not Completed';
}
} else {
// not started treatment
$started_tx = false;
$hcv_fu_eligible = false;
//.........这里部分代码省略.........
示例11: print_rolling_week
function print_rolling_week($start, $where_clause, $query, $f, $g, $empty)
{
/***************************************************
* Create calendar array (start time, day of week) *
***************************************************/
global $resolution;
$days_result = @mysql_query("SELECT DISTINCT day_of_week FROM Weekly_Shift {$where_clause} ORDER BY day_of_week");
while ($day = @mysql_fetch_array($days_result)) {
$days[] = $day['day_of_week'];
}
$times_result = @mysql_query("SELECT DISTINCT start_time FROM Weekly_Shift {$where_clause} ORDER BY start_time");
while ($time = @mysql_fetch_array($times_result)) {
$times[] = $time['start_time'];
}
$query_result = @mysql_query($query);
while ($row = @mysql_fetch_array($query_result)) {
$calendar[$row['start_time']][$row['day_of_week']][] = $f($row);
}
/********************
* Fill in closures *
********************/
$closures_result = @mysql_query("SELECT * FROM Closure WHERE (start_datetime BETWEEN '{$start}' AND '{$start}' + INTERVAL 7 DAY) OR (end_datetime BETWEEN '{$start}' AND '{$start}' + INTERVAL 7 DAY)");
$is_new_day = true;
$cur_day = "";
while ($row = @mysql_fetch_array($closures_result)) {
$datetime = $row['start_datetime'];
while ($datetime != $row['end_datetime'] && date_diff($datetime, date("Y-m-d 00:00:00", strtotime(add_date($start, 0, 0, 0, 0, 7, 0)))) < 0) {
while (date_diff($datetime, date("Y-m-d 00:00:00", strtotime($start))) < 0) {
$datetime = add_date($datetime, 0, $resolution * 60, 0, 0, 0, 0);
}
$day_of_week = date("l", strtotime($datetime));
$datetime_array = explode(" ", $datetime);
$date = $datetime_array[0];
$time = $datetime_array[1];
if ($day_of_week != $cur_day) {
if (isset($newcol_start_time) && isset($newcol_start_day)) {
$calendar[$newcol_start_time][$newcol_start_day][1] = $count;
}
$newcol_start_time = $time;
$newcol_start_day = $day_of_week;
$is_new_day = true;
}
if ($is_new_day && in_array($time, $times)) {
$calendar[$time][$day_of_week][0] = "Closed: {$row['reason']}";
$is_new_day = false;
$cur_day = $day_of_week;
$count = 1;
} elseif (in_array($time, $times)) {
$calendar[$time][$day_of_week][0] = "empty";
$count++;
}
$datetime = add_date($datetime, 0, $resolution * 60, 0, 0, 0, 0);
}
if (isset($newcol_start_time) && isset($newcol_start_day)) {
$calendar[$newcol_start_time][$newcol_start_day][1] = $count;
}
}
/****************
* Render table *
****************/
echo "<table class=\"calendar\">";
echo "<tr>";
echo "<th class=\"time\"><span>Time</span></th>";
$date = date("Y-m-d H:i:00", strtotime($start));
for ($offset = 0; $offset < 7; $offset++) {
$day_of_week = date("l", strtotime($date));
if (in_array($day_of_week, $days)) {
$ordered_dates[] = $date;
$formatted_date = date("D, M j", strtotime($date));
echo "<th>{$formatted_date}</th>";
}
$date = add_date($date, 0, 0, 0, 0, 1, 0);
}
echo "</tr>";
$alt = "alt";
foreach ($times as $time) {
$alt = empty($alt) ? "alt" : "";
$time_array = explode(":", $time);
$is_hour = $time_array[1] == "00" ? "hour" : "not_hour";
$formatted_time = format_time($time);
echo "<tr>";
echo "<td class=\"time\"><span class=\"{$is_hour}\">{$formatted_time}</span></td>";
foreach ($ordered_dates as $datetime) {
$day = date("l", strtotime($datetime));
if (strpos($calendar[$time][$day][0], "Closed") !== false) {
echo "<td class=\"closed{$alt} {$is_hour}\" rowspan=\"{$calendar[$time][$day][1]}\">";
echo $calendar[$time][$day][0];
echo "</td>";
} else {
if (strpos($calendar[$time][$day][0], "empty") !== false) {
continue;
// multicolumn closure, make this one blank
} else {
$q_result = @mysql_query("SELECT capacity FROM Weekly_Shift WHERE day_of_week='{$day}' AND start_time='{$time}'");
$q = @mysql_fetch_array($q_result);
$capacity = $q[0] ? $q[0] : 0;
echo "<td class=\"cap{$capacity}{$alt} {$is_hour}\">";
if ($cell = $calendar[$time][$day]) {
$datetime_array = explode(" ", $datetime);
echo $g($cell, "{$datetime_array[0]} {$time}");
//.........这里部分代码省略.........
示例12: PintarColecciones
function PintarColecciones($colecciones)
{
$ahora = date("Y-m-d");
$hace_un_ano = add_date($ahora, -9);
// seis meses de antiguedad
$contador = 0;
foreach ($colecciones as $row) {
if ($contador < 500) {
echo "<li>";
if ($row["f_alta"] > $hace_un_ano && $row["coleccionistas"] > 9) {
echo "<strong>";
}
echo anchor('coleccion/ficha/' . $row["esc_nombre"] . '/' . $row["id"], $row["nombre"], array("title" => $row["ano_publica"] . " " . $row["editorial_nombre"] . $row["f_alta"]));
if ($row["f_alta"] > $hace_un_ano) {
echo "</strong>";
}
echo "</li>";
$contador++;
}
}
}
示例13: imp_dates
<?php
$title = 'Важни дати';
include '/php/phplogin.php';
include '/includes/headerin.php';
imp_dates($con);
if (isset($_GET['add_date'])) {
add_date($con);
}
?>
<div class='maincontent'>
<form method='POST' action="/php/phplogin.php">
<div class="fffbackg">
<div class="inheading">
<h2><?php
echo $title;
?>
</h2><img class="imglogoin" src="/test/<?php
echo $uni['pic_logo'];
?>
" title="" alt=""/>
<h1><?php
echo $uni['uniname'];
?>
</h1>
</div>
<div class="menuonpage">
<div class="datenote">
<a href="/imp_dates.php" ><img style='background:#ddd;' alt='ImpDates' title='Важни дати' src='/img/datesimp.png'/></a>
<a href="/imp_notes.php"><img alt='ImpNotes' title='Важни бележки' src='/img/notesimp.png'/></a>
示例14: get_gregorian_date
$midpoint = $midpoint_obj->format('Y-m-d');
/**
* format dates so we can use them on timeline
*/
$start_date = get_gregorian_date($event['dm_rfstdtc']);
$end_date = get_gregorian_date($end_obj->format('Y-m-d'));
$tx_4_weeks_start = get_gregorian_date(add_date($event['dm_rfstdtc'], 21));
$tx_4_weeks_end = get_gregorian_date(add_date($event['dm_rfstdtc'], 28));
$tx_12_weeks_start = get_gregorian_date(add_date($event['dm_rfstdtc'], 77));
$tx_12_weeks_end = get_gregorian_date(add_date($event['dm_rfstdtc'], 84));
$tx_24_weeks_start = get_gregorian_date(add_date($event['dm_rfstdtc'], 161));
$tx_24_weeks_end = get_gregorian_date(add_date($event['dm_rfstdtc'], 168));
$svr12_weeks_start = get_gregorian_date(add_date($event['eot_dsstdtc'], 63));
$svr12_weeks_end = get_gregorian_date(add_date($event['eot_dsstdtc'], 84));
$svr24_weeks_start = get_gregorian_date(add_date($event['eot_dsstdtc'], 147));
$svr24_weeks_end = get_gregorian_date(add_date($event['eot_dsstdtc'], 168));
}
}
}
/**
* enqueue javascript
*/
$script = "<script type='text/javascript'>
var tl;
function onLoad() {
var theme = Timeline.ClassicTheme.create();
theme.event.bubble.width = 300;
theme.event.bubble.height = 300;
theme.event.track.height = 0;
theme.event.tape.height = 4;
示例15: save_invoice
public function save_invoice($id)
{
$this->db->trans_begin();
try {
$this->invoice->order_id = $id;
$this->invoice->no = $this->input->post('no');
$this->invoice->due_date = add_date(date('Y-m-d'), 1, 0, 0);
$this->invoice->total = $this->input->post('total');
$save = $this->invoice->insert($this->invoice);
if (!$save) {
throw new ErrorException('Menyimpan invoice gagal.');
}
//Update orders after invoice created
$this->order->isInvoiceCreated = '1';
$this->order->update($id, $this->order);
$this->db->trans_commit();
return json_view('success');
} catch (ErrorException $e) {
$this->db->trans_rollback();
return json_view($e->getMessage());
}
}