本文整理汇总了PHP中Date::getYear方法的典型用法代码示例。如果您正苦于以下问题:PHP Date::getYear方法的具体用法?PHP Date::getYear怎么用?PHP Date::getYear使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Date
的用法示例。
在下文中一共展示了Date::getYear方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
public function __construct(Date $base, $weekStart = Timestamp::WEEKDAY_MONDAY)
{
$firstDayOfMonth = Date::create($base->getYear() . '-' . $base->getMonth() . '-01');
$lastDayOfMonth = Date::create($base->getYear() . '-' . $base->getMonth() . '-' . date('t', $base->toStamp()));
$start = $firstDayOfMonth->getFirstDayOfWeek($weekStart);
$end = $lastDayOfMonth->getLastDayOfWeek($weekStart);
$this->monthRange = DateRange::create()->lazySet($firstDayOfMonth, $lastDayOfMonth);
$this->fullRange = DateRange::create()->lazySet($start, $end);
$rawDays = $this->fullRange->split();
$this->fullLength = 0;
foreach ($rawDays as $rawDay) {
$day = CalendarDay::create($rawDay->toStamp());
if ($this->monthRange->contains($day)) {
$day->setOutside(false);
} else {
$day->setOutside(true);
}
$this->days[$day->toDate()] = $day;
$weekNumber = floor($this->fullLength / 7);
if (!isset($this->weeks[$weekNumber])) {
$this->weeks[$weekNumber] = CalendarWeek::create();
}
$this->weeks[$weekNumber]->addDay($day);
++$this->fullLength;
}
++$this->fullLength;
}
示例2: testDateOffset
public function testDateOffset()
{
$date = new Date('2015-04-25+01:00');
$this->assertEquals(2015, $date->getYear());
$this->assertEquals(4, $date->getMonth());
$this->assertEquals(25, $date->getDay());
$this->assertEquals(3600, $date->getOffset());
$this->assertInstanceOf('DateTimeZone', $date->getTimeZone());
$this->assertEquals('2015-04-25+01:00', $date->toString());
}
示例3: testSetByLocaleStringShort
function testSetByLocaleStringShort()
{
$date = new Date();
$locale = new Locale('en');
$date->setByLocaleString($locale, 'Thu 20 Jan 2005', '%a %d %b %Y');
$this->assertEqual($date->getMonth(), 1);
$this->assertEqual($date->getYear(), 2005);
$this->assertEqual($date->getDay(), 20);
}
示例4: getLinks
public function getLinks()
{
$oDate = new Date($this->oStart);
$oNow = new Date();
$aLinks = array();
$baseUrl = parent::getUrl(false);
$year = $oDate->getYear();
$aLinks['prev'] = array('label' => '< ' . ($year - 1), 'url' => $this->appendToUrl($baseUrl, 'year=' . ($year - 1)));
$oDate->setYear($year + 1);
$aLinks['next'] = array('label' => $year + 1 . ' >');
if ($oNow->after($oDate)) {
$aLinks['next']['url'] = $this->appendToUrl($baseUrl, 'year=' . ($year + 1));
}
return $aLinks;
}
示例5: getLinks
public function getLinks()
{
$oDate = new Date($this->oStart);
$oNow = new Date();
$aLinks = array();
$baseUrl = parent::getUrl(false);
$date = $oDate->getYear();
$aLinks['up'] = array('label' => $date, 'url' => $this->appendToUrl($baseUrl, 'year=' . $date));
$oDate->subtractSpan(new Date_Span('1-0-0-0'));
$date = $oDate->format('%Y-%m');
$aLinks['prev'] = array('label' => '< ' . $date, 'url' => $this->appendToUrl($baseUrl, 'month=' . $date));
$oDate->addSpan(new Date_Span('34-0-0-0'));
$date = $oDate->format('%Y-%m');
$aLinks['next'] = array('label' => $date . ' >');
if ($oNow->after($oDate)) {
$aLinks['next']['url'] = $this->appendToUrl($baseUrl, 'month=' . $date);
}
return $aLinks;
}
示例6: isEquals
public function isEquals(Date $date)
{
return $this->year === $date->getYear() && $this->month === $date->getMonth() && $this->day === $date->getDay();
}
示例7: getConversions
/**
* Returns an array of conversions.
*
* @param array $aParams
* @return array
*/
function getConversions($aParams)
{
$conf = $GLOBALS['_MAX']['CONF'];
$oDbh =& OA_DB::singleton();
$where = '';
if (!empty($aParams['day'])) {
$aParams['day_begin'] = $aParams['day_end'] = $aParams['day'];
}
if (!empty($aParams['day_begin'])) {
$oStart = new Date($aParams['day_begin']);
$oStart->setHour(0);
$oStart->setMinute(0);
$oStart->setSecond(0);
$oStart->toUTC();
$where .= ' AND ac.tracker_date_time >= ' . $oDbh->quote($oStart->format('%Y-%m-%d %H:%M:%S'), 'timestamp');
}
if (!empty($aParams['day_end'])) {
$oEnd = new Date($aParams['day_end']);
$oEnd->setHour(23);
$oEnd->setMinute(59);
$oEnd->setSecond(59);
$oEnd->toUTC();
$where .= ' AND ac.tracker_date_time <= ' . $oDbh->quote($oEnd->format('%Y-%m-%d %H:%M:%S'), 'timestamp');
}
if (!empty($aParams['month'])) {
$oStart = new Date("{$aParams['month']}-01");
$oStart->setHour(0);
$oStart->setMinute(0);
$oStart->setSecond(0);
$oEnd = new Date(Date_Calc::beginOfNextMonth($oStart->getDay(), $oStart->getMonth, $oStart->getYear(), '%Y-%m-%d'));
$oEnd->setHour(0);
$oEnd->setMinute(0);
$oEnd->setSecond(0);
$oEnd->subtractSeconds(1);
$oStart->toUTC();
$oEnd->toUTC();
$where .= ' AND ac.tracker_date_time >= ' . $oDbh->quote($oStart->format('%Y-%m-%d %H:%M:%S'), 'timestamp');
$where .= ' AND ac.tracker_date_time <= ' . $oDbh->quote($oEnd->format('%Y-%m-%d %H:%M:%S'), 'timestamp');
}
if (!empty($aParams['day_hour'])) {
$oStart = new Date("{$aParams['day_hour']}:00:00");
$oStart->setMinute(0);
$oStart->setSecond(0);
$oEnd = new Date($oStart);
$oStart->setMinute(59);
$oStart->setSecond(59);
$where .= ' AND ac.tracker_date_time >= ' . $oDbh->quote($oStart->format('%Y-%m-%d %H:%M:%S'), 'timestamp');
$where .= ' AND ac.tracker_date_time <= ' . $oDbh->quote($oEnd->format('%Y-%m-%d %H:%M:%S'), 'timestamp');
}
if (!empty($aParams['agency_id'])) {
$where .= ' AND c.agencyid=' . $oDbh->quote($aParams['agency_id'], 'integer');
}
if (!empty($aParams['clientid'])) {
$where .= ' AND c.clientid=' . $oDbh->quote($aParams['clientid'], 'integer');
}
if (isset($aParams['zonesIds'])) {
$where .= ' AND ac.zone_id IN (' . $oDbh->escape(implode(',', $aParams['zonesIds'])) . ")";
}
if (!empty($aParams['campaignid'])) {
$where .= ' AND m.campaignid=' . $oDbh->quote($aParams['campaignid'], 'integer');
}
if (!empty($aParams['bannerid'])) {
$where .= ' AND d.bannerid=' . $oDbh->quote($aParams['bannerid'], 'integer');
}
if (!empty($aParams['statuses'])) {
$where .= ' AND ac.connection_status IN (' . $oDbh->escape(implode(',', $aParams['statuses'])) . ')';
}
if (isset($aParams['startRecord']) && is_numeric($aParams['startRecord']) && is_numeric($aParams['perPage'])) {
$limit = ' LIMIT ' . $oDbh->quote($aParams['perPage'], 'text', false) . ' OFFSET ' . $oDbh->quote($aParams['startRecord'], 'text', false);
} elseif (!empty($aParams['perPage'])) {
$limit = ' LIMIT ' . $oDbh->quote($aParams['perPage'], 'integer', false) . ' OFFSET 0';
} else {
$limit = '';
}
$query = "SELECT\n ac.data_intermediate_ad_connection_id as connection_id,\n c.clientid,\n m.campaignid,\n m.campaignname AS campaignname,\n ac.tracker_id as tracker_id,\n ac.connection_status,\n ac.connection_date_time AS connection_date_time,\n ac.tracker_date_time as date_time,\n t.trackername,\n ac.tracker_ip_address,\n ac.tracker_country,\n ac.connection_action,\n t.type AS connection_type,\n ac.tracker_country,\n ac.ad_id,\n ac.creative_id,\n ac.zone_id,\n ac.comments\n FROM\n {$conf['table']['prefix']}{$conf['table']['clients']} AS c,\n {$conf['table']['prefix']}{$conf['table']['data_intermediate_ad_connection']} AS ac,\n {$conf['table']['prefix']}{$conf['table']['banners']} AS d,\n {$conf['table']['prefix']}{$conf['table']['campaigns']} AS m,\n {$conf['table']['prefix']}{$conf['table']['trackers']} AS t\n WHERE\n c.clientid=m.clientid\n AND m.campaignid=d.campaignid\n AND d.bannerid=ac.ad_id\n AND t.trackerid=ac.tracker_id\n AND ac.inside_window = 1\n " . $where . "\n ORDER BY\n ac.tracker_date_time\n {$limit}";
$aStats = $oDbh->queryAll($query, null, MDB2_FETCHMODE_DEFAULT, true);
$oNow = new Date();
foreach (array_keys($aStats) as $k) {
$oDate = new Date($aStats[$k]['date_time']);
$oDate->setTZbyID('UTC');
$oDate->convertTZ($oNow->tz);
$aStats[$k]['date_time'] = $oDate->format('%Y-%m-%d %H:%M:%S');
$oDate = new Date($aStats[$k]['connection_date_time']);
$oDate->setTZbyID('UTC');
$oDate->convertTZ($oNow->tz);
$aStats[$k]['connection_date_time'] = $oDate->format('%Y-%m-%d %H:%M:%S');
}
return $aStats;
}
示例8: getTemplateArrayCalendar
function getTemplateArrayCalendar($o_minDay, $s_date, $period)
{
// today
$today = new Date(getDateFromTimestamp(time()));
$tsToday = $today->getTimestamp();
// date asked for statistics
$dateAsked = new Date($s_date);
// used for going througt the month
$date = new Date($s_date);
$month = $date->getMonth();
$year = $date->getYear();
$prefixDay = $year . "-" . $month . "-";
$date->setDate($prefixDay . '01');
$week = $date->getWeek();
$day = 1;
$ts = $date->getTimestamp();
while ($date->getMonth() == $month) {
// day exists in stats, isn't it too old or in the future ?
if ($date->getTimestamp() >= $o_minDay->getTimestamp() && $date->getTimestamp() <= $tsToday) {
$exists = 1;
} else {
$exists = 0;
}
// day selected for stats view ?
if ($period == DB_ARCHIVES_PERIOD_DAY && $date->getDay() == $dateAsked->getDay() || $period == DB_ARCHIVES_PERIOD_WEEK && $date->getWeek() == $dateAsked->getWeek() || $period == DB_ARCHIVES_PERIOD_MONTH || $period == DB_ARCHIVES_PERIOD_YEAR) {
$selected = 1;
} else {
$selected = 0;
}
$weekNo = $date->getWeek() - $week;
if (defined('MONDAY_FIRST') && MONDAY_FIRST == 'no' && date("w", $ts) == 0) {
$weekNo += 1;
}
$dayOfWeek = (int) (!defined('MONDAY_FIRST') || MONDAY_FIRST == 'yes' ? date("w", $ts) == 0 ? 6 : date("w", $ts) - 1 : date("w", $ts));
$return[$weekNo][$dayOfWeek] = array('day' => substr($date->getDay(), 0, 1) === '0' ? substr($date->getDay(), 1, 2) : $date->getDay(), 'date' => $date->get(), 'exists' => $exists, 'selected' => $selected);
$date->addDays(1);
//these 2 lines useless? to check
$ts = $date->getTimeStamp();
$date->setTimestamp($ts);
}
foreach ($return as $key => $r) {
$row =& $return[$key];
for ($i = 0; $i < 7; $i++) {
if (!isset($row[$i])) {
$row[$i] = "-";
}
}
ksort($row);
}
return $return;
}
示例9: getIntervalsRemaining
/**
* A method to get the number of operation intervals in a given
* start & end date range must be valid OI start & end date range
*
* @static
* @param object $oStartDate PEAR::Date object
* @param object $oEndDate PEAR::Date object
* @return integer number of operation intervals remaining
*/
function getIntervalsRemaining($oStartDate, $oEndDate)
{
$operationIntervalSeconds = OX_OperationInterval::getOperationInterval() * 60;
// Convert to UTC
$oStartCopy = new Date($oStartDate);
$oStartCopy->toUTC();
$oEndCopy = new Date($oEndDate);
$oEndCopy->toUTC();
// Get timestamp of start date/time - in seconds
$startDateSeconds = mktime($oStartCopy->getHour(), $oStartCopy->getMinute(), $oStartCopy->getSecond(), $oStartCopy->getMonth(), $oStartCopy->getDay(), $oStartCopy->getYear());
// Get timestamp of end date/time - in seconds
$endDateSeconds = mktime($oEndCopy->getHour(), $oEndCopy->getMinute(), $oEndCopy->getSecond(), $oEndCopy->getMonth(), $oEndCopy->getDay(), $oEndCopy->getYear());
// calculate interval length in seconds
$interval = $endDateSeconds - $startDateSeconds;
// find number of operation intervals during interval
return $interval <= 0 ? 0 : round($interval / $operationIntervalSeconds);
}
示例10: get_prior_year
function get_prior_year($template, $userID, $connection)
{
$calc = new Date_Calc();
$beg_date = new Date();
$end_date = new Date();
$beg_date->addYears(-1);
// Get current month dates.
$beg_date->setDayMonthYear(1, 1, $beg_date->getYear());
$end_date->setDayMonthYear(31, 12, $beg_date->getYear());
$query = "SELECT SUM(seconds) AS seconds, SUM(distance) AS distance, sbr_type FROM flmain WHERE workout_date>='" . $beg_date->format("%Y-%m-%d") . "' AND workout_date<='" . $end_date->format("%Y-%m-%d") . "' AND user_id=" . $userID . " AND plan_type='a' GROUP BY sbr_type";
$result = @mysql_query($query, $connection);
$template->setCurrentBlock("PRIORYR");
$template->setVariable("MONTHNAME", $beg_date->format("%Y"));
if (mysql_num_rows($result) > 0) {
while ($row = mysql_fetch_array($result)) {
switch ($row["sbr_type"]) {
case 's':
$template->setVariable("SWIMDUR", round(convert_seconds_minutes($row["seconds"]), 2) . "min");
$template->setVariable("SWIMDIST", $row["distance"] . " yds");
break;
case 'b':
$template->setVariable("BIKEDUR", round(convert_seconds_minutes($row["seconds"]), 2) . " min");
$template->setVariable("BIKEDIST", $row["distance"] . " mi");
break;
case 'r':
$template->setVariable("RUNDUR", round(convert_seconds_minutes($row["seconds"]), 2) . " min");
$template->setVariable("RUNDIST", $row["distance"] . " mi");
break;
}
}
}
/* Get the strength minutes */
$query = "SELECT SUM(seconds) AS seconds FROM flstrength WHERE workout_date>='" . $beg_date->format("%Y-%m-%d") . "' AND workout_date<='" . $end_date->format("%Y-%m-%d") . "' AND user_id=" . $userID . " AND plan_type='a'";
$results = @mysql_query($query, $connection);
if ($results) {
while ($row = mysql_fetch_array($results)) {
$template->setVariable("STRDUR", round(convert_seconds_minutes($row["seconds"]), 2) . " min");
}
}
$template->parseCurrentBlock();
}
示例11: expandPlannedTransactions
/**
* Expands the planned transactions.
*
* All occurences of planned transactions between now and the targetFutureCalcDate will be inserted
* in finishedTransactions. For distinction the planned transactions will have a 'p' as first character
* in their id.
*
* @throws BadgerException If an illegal repeat unit is used.
*/
public function expandPlannedTransactions()
{
$now = new Date();
$now->setHour(0);
$now->setMinute(0);
$now->setSecond(0);
foreach ($this->plannedTransactions as $currentTransaction) {
$date = new Date($currentTransaction->getBeginDate());
$dayOfMonth = $date->getDay();
//While we have not reached targetFutureCalcDate
while ($this->targetFutureCalcDate->after($date) && !$date->after(is_null($tmp = $currentTransaction->getEndDate()) ? new Date('9999-12-31') : $tmp)) {
$inRange = true;
//Check if there is one or more valutaDate filter and apply them
foreach ($this->filter as $currentFilter) {
if ($currentFilter['key'] == 'valutaDate') {
switch ($currentFilter['op']) {
case 'eq':
if (Date::compare($date, $currentFilter['val']) != 0) {
$inRange = false;
}
break;
case 'lt':
if (Date::compare($date, $currentFilter['val']) >= 0) {
$inRange = false;
}
break;
case 'le':
if (Date::compare($date, $currentFilter['val']) > 0) {
$inRange = false;
}
break;
case 'gt':
if (Date::compare($date, $currentFilter['val']) <= 0) {
$inRange = false;
}
break;
case 'ge':
if (Date::compare($date, $currentFilter['val']) < 0) {
$inRange = false;
}
break;
case 'ne':
if (Date::compare($date, $currentFilter['val']) == 0) {
$inRange = false;
}
break;
case 'bw':
case 'ew':
case 'ct':
if (strncasecmp($date->getFormatted(), $currentFilter['val']->getFormatted(), 9999) != 0) {
$inRange = false;
}
break;
}
if (!$inRange) {
break;
}
}
}
if (!$date->before($now) && $inRange) {
$this->finishedTransactions[] = new FinishedTransaction($this->badgerDb, $this, 'p' . $currentTransaction->getId() . '_' . $date->getDate(), $currentTransaction->getTitle(), $currentTransaction->getAmount(), $currentTransaction->getDescription(), new Date($date), $currentTransaction->getTransactionPartner(), $currentTransaction->getCategory(), $currentTransaction->getOutsideCapital(), false, true, $currentTransaction, 'PlannedTransaction');
}
//do the date calculation
switch ($currentTransaction->getRepeatUnit()) {
case 'day':
$date->addSeconds($currentTransaction->getRepeatFrequency() * 24 * 60 * 60);
break;
case 'week':
$date->addSeconds($currentTransaction->getRepeatFrequency() * 7 * 24 * 60 * 60);
break;
case 'month':
//Set the month
$date = new Date(Date_Calc::endOfMonthBySpan($currentTransaction->getRepeatFrequency(), $date->getMonth(), $date->getYear(), '%Y-%m-%d'));
//And count back as far as the last valid day of this month
while ($date->getDay() > $dayOfMonth) {
$date->subtractSeconds(24 * 60 * 60);
}
break;
case 'year':
$newYear = $date->getYear() + $currentTransaction->getRepeatFrequency();
if ($dayOfMonth == 29 && $date->getMonth() == 2 && !Date_Calc::isLeapYear($newYear)) {
$date->setDay(28);
} else {
$date->setDay($dayOfMonth);
}
$date->setYear($newYear);
break;
default:
throw new BadgerException('Account', 'IllegalRepeatUnit', $currentTransaction->getRepeatUnit());
exit;
}
//.........这里部分代码省略.........
示例12: prepareWeekBreakdown
/**
* A method to modify an array of history data so that it can be displayed in a format
* compatible with the weekly breakdown template.
*
* @param array $aData A reference to an array of arrays, containing the rows of data.
* @param object $oCaller The calling object. Expected to have the the class variable
* "statsBreakdown" set.
*/
function prepareWeekBreakdown(&$aData, $oCaller)
{
// Only prepare the weekly breakdown if the statsBreakdown
// in the caller is set to "week"
if ($oCaller->statsBreakdown != 'week') {
return;
}
$beginOfWeek = OA_Admin_DaySpan::getBeginOfWeek();
$aWeekData = array();
ksort($aData);
foreach ($aData as $key => $aRowData) {
// Get the date for this row's data
$oDate = new Date($key);
if ($beginOfWeek != 0) {
// Need to change the date used for the data so
// that the day appears in the correct week
$daysToGoback = (int) (SECONDS_PER_DAY * $beginOfWeek);
$oDate->subtractSeconds($daysToGoback);
}
// Get the week this date is in, in YYYY-MM format
$week = sprintf('%04d-%02d', $oDate->getYear(), $oDate->getWeekOfYear());
// Prepare the data array for this week, if not set, where
// the week is in the "week" index, there is a "data" index
// for all the rows that make up the week, and the array
// has all the columns of an empty data row
if (!isset($aWeekData[$week])) {
$aWeekData[$week] = $oCaller->aEmptyRow;
$aWeekData[$week]['week'] = $week;
$aWeekData[$week]['data'] = array();
}
// Add the data from the row to the totals of the week
foreach (array_keys($oCaller->aColumns) as $colKey) {
$aWeekData[$week][$colKey] += $aRowData[$colKey];
}
// Store the row in the week
$aWeekData[$week]['data'][$key] = $aRowData;
}
foreach (array_keys($aWeekData) as $week) {
// Now that the totals are complete, fill any
// remaining days in the week with empty data
$days = count($aWeekData[$week]['data']);
if ($days < 7) {
// Locate the first day of the week in the days that make
// up the week so far
ksort($aWeekData[$week]['data']);
$key = key($aWeekData[$week]['data']);
$oDate = new Date($key);
$firstDataDayOfWeek = $oDate->getDayOfWeek();
// Is this after the start of the week?
if ($firstDataDayOfWeek > $beginOfWeek) {
// Change the date to be the first day of this week
$daysToGoback = (int) (SECONDS_PER_DAY * ($firstDataDayOfWeek - $beginOfWeek));
$oDate->subtractSeconds($daysToGoback);
}
// Check each day in the week
for ($counter = 0; $counter < 7; $counter++) {
if (is_null($aWeekData[$week]['data'][$oDate->format('%Y-%m-%d')])) {
// Set the day's data to the empty row, plus the "day" heading for the day
$aWeekData[$week]['data'][$oDate->format('%Y-%m-%d')] = $oCaller->aEmptyRow;
$aWeekData[$week]['data'][$oDate->format('%Y-%m-%d')]['day'] = $oDate->format($GLOBALS['date_format']);
} elseif (!is_null($aWeekData[$week]['data'][$oDate->format('%Y-%m-%d')]) && !array_key_exists('day', $aWeekData[$week]['data'][$oDate->format('%Y-%m-%d')])) {
$aWeekData[$week]['data'][$oDate->format('%Y-%m-%d')]['day'] = $oDate->format($GLOBALS['date_format']);
}
$oDate->addSeconds(SECONDS_PER_DAY);
}
}
// Ensure the day data is sorted correctly
ksort($aWeekData[$week]['data']);
// Format all day rows
foreach (array_keys($aWeekData[$week]['data']) as $key) {
$oCaller->_formatStatsRowRecursive($aWeekData[$week]['data'][$key]);
}
// Calculate CTR and other columns, making sure that the method is available
if (is_callable(array($oCaller, '_summarizeStats'))) {
$oCaller->_summarizeStats($aWeekData[$week]);
}
}
// Set the new weekly-formatted data as the new data array to use
$aData = $aWeekData;
}
示例13: UInterface
function UInterface()
{
global $configArray;
global $timer;
$local = $configArray['Site']['local'];
$this->vufindTheme = $configArray['Site']['theme'];
$this->isMobile = mobile_device_detect();
$this->assign('isMobile', $this->isMobile ? 'true' : 'false');
$this->assign('device', get_device_name());
//Figure out google translate id
if (isset($configArray['Translation']['google_translate_key']) && strlen($configArray['Translation']['google_translate_key']) > 0) {
$this->assign('google_translate_key', $configArray['Translation']['google_translate_key']);
$this->assign('google_included_languages', $configArray['Translation']['includedLanguages']);
}
$thisYear = new Date();
$this->assign('lastYear', $thisYear->getYear() - 1);
if (isset($_REQUEST['print'])) {
$this->assign('print', true);
}
// Check to see if multiple themes were requested; if so, build an array,
// otherwise, store a single string.
$themeArray = explode(',', $this->vufindTheme);
//Make sure we always fall back to the default theme so a template does not have to be overridden.
$themeArray[] = 'default';
if (count($themeArray) > 1) {
$this->template_dir = array();
foreach ($themeArray as $currentTheme) {
$currentTheme = trim($currentTheme);
$this->template_dir[] = "{$local}/interface/themes/{$currentTheme}";
}
} else {
$this->template_dir = "{$local}/interface/themes/{$this->vufindTheme}";
}
$this->themes = $themeArray;
if (isset($timer)) {
$timer->logTime('Set theme');
}
// Create an MD5 hash of the theme name -- this will ensure that it's a
// writeable directory name (since some config.ini settings may include
// problem characters like commas or whitespace).
$md5 = md5($this->vufindTheme);
$this->compile_dir = "{$local}/interface/compile/{$md5}";
if (!is_dir($this->compile_dir)) {
if (!mkdir($this->compile_dir)) {
echo "Could not create compile directory {$this->compile_dir}";
die;
}
}
$this->cache_dir = "{$local}/interface/cache/{$md5}";
if (!is_dir($this->cache_dir)) {
if (!mkdir($this->cache_dir)) {
echo "Could not create cache directory {$this->cache_dir}";
die;
}
}
$this->plugins_dir = array('plugins', "{$local}/interface/plugins");
$this->caching = false;
$this->debug = true;
$this->compile_check = true;
unset($local);
$this->register_block('display_if_inconsistent', 'display_if_inconsistent');
$this->register_block('display_if_set', 'display_if_set');
$this->register_function('translate', 'translate');
$this->register_function('char', 'char');
$this->assign('site', $configArray['Site']);
$this->assign('path', $configArray['Site']['path']);
$defaultConfig = $configArray['Site']['path'];
$url = $_SERVER['SERVER_NAME'];
if (isset($_SERVER['HTTPS'])) {
$url = "https://" . $url;
} else {
$url = "http://" . $url;
}
if (strlen($configArray['Site']['path']) > 0) {
$url .= '/' . $configArray['Site']['path'];
}
$this->url = $url;
$this->assign('template_dir', $this->template_dir);
$this->assign('url', $url);
$this->assign('coverUrl', $configArray['Site']['coverUrl']);
$this->assign('fullPath', str_replace('&', '&', $_SERVER['REQUEST_URI']));
$this->assign('requestHasParams', strpos($_SERVER['REQUEST_URI'], '?') > 0);
if (isset($configArray['Site']['email'])) {
$this->assign('supportEmail', $configArray['Site']['email']);
}
if (isset($configArray['Site']['libraryName'])) {
$this->assign('consortiumName', $configArray['Site']['libraryName']);
}
$this->assign('libraryName', $configArray['Site']['title']);
$this->assign('ils', $configArray['Catalog']['ils']);
if (isset($configArray['Catalog']['url'])) {
$this->assign('classicCatalogUrl', $configArray['Catalog']['url']);
} else {
if (isset($configArray['Catalog']['hipUrl'])) {
$this->assign('classicCatalogUrl', $configArray['Catalog']['hipUrl']);
}
}
$this->assign('showConvertListsFromClassic', $configArray['Catalog']['showConvertListsFromClassic']);
$this->assign('theme', $this->vufindTheme);
$this->assign('primaryTheme', reset($themeArray));
//.........这里部分代码省略.........
示例14: Date
function next_payment_date($pdate = '')
{
$date = new Date($pdate ? $pdate : $this->data['xp_pmt_date']);
switch ($this->data['payment_frequency']) {
case "W":
$date->addSeconds(7 * 24 * 60 * 60);
break;
case "BW":
$date->addSeconds(14 * 24 * 60 * 60);
break;
case "M":
$date->addSeconds($date->getDaysInMonth() * 24 * 60 * 60);
break;
case "Q":
$date->addSeconds($date->getDaysInMonth() * 24 * 60 * 60);
$date->addSeconds($date->getDaysInMonth() * 24 * 60 * 60);
$date->addSeconds($date->getDaysInMonth() * 24 * 60 * 60);
break;
case "SA":
$date->addSeconds($date->getDaysInMonth() * 24 * 60 * 60);
$date->addSeconds($date->getDaysInMonth() * 24 * 60 * 60);
$date->addSeconds($date->getDaysInMonth() * 24 * 60 * 60);
$date->addSeconds($date->getDaysInMonth() * 24 * 60 * 60);
$date->addSeconds($date->getDaysInMonth() * 24 * 60 * 60);
$date->addSeconds($date->getDaysInMonth() * 24 * 60 * 60);
break;
case "A":
$date->setYear($date->getYear() + 1);
break;
}
return $date->format('%Y-%m-%d');
}
示例15: testGetYear
/**
* @covers Geissler\Converter\Model\Date::getYear
*/
public function testGetYear()
{
$this->assertInstanceOf($this->class, $this->object->setYear(1984));
$this->assertEquals(1984, $this->object->getYear());
}