function show()
 {
     if (isset($_GET['Kontakt'])) {
         return $this->kontakt();
     }
     if (isset($this->num_show_next_dates)) {
         return $this->next_dates();
     }
     if (preg_match("/\\.ics\$/i", SELF_URL)) {
         $this->http_login();
         $this->noframe();
         $ical_output = true;
     }
     $this->cal = new CalendarLinked();
     for ($i = 0; $i < count($this->uri_components); $i++) {
         if (preg_match('/^[0-9]{4}$/', $this->uri_components[$i])) {
             $year_offset = $i;
         }
     }
     $year_request = isset($year_offset) ? $this->uri_components[$year_offset] : Date::jahr();
     $month_request = isset($this->uri_components[$year_offset + 1]) && preg_match('/^[0-9]{1,2}$/', $this->uri_components[$year_offset + 1]) ? Date::add_0($this->uri_components[$year_offset + 1]) : Date::monat();
     $day_request = isset($this->uri_components[$year_offset + 2]) && preg_match('/^[0-9]{1,2}$/', $this->uri_components[$year_offset + 2]) ? Date::add_0($this->uri_components[$year_offset + 2]) : '01';
     //Date::tag();
     $page_root = '/' . rawurlencode($this->uri_components[0]) . '/' . rawurlencode($this->uri_components[1]);
     for ($i = 2; $i < ($year_offset ? $year_offset : count($this->uri_components)); $i++) {
         $page_root .= '/' . rawurlencode($this->uri_components[$i]);
     }
     $this->cal->root = $page_root;
     if ($this->check_right('KalenderIntern')) {
         $access = '';
     } elseif ($this->check_right('KalenderExtern')) {
         $access = "AND `CLASS` = 'PUBLIC'";
     } else {
         $allowed_categories = array();
         foreach ($this->categories as $cat) {
             if ($cat['Access'] == 'PUBLIC') {
                 $allowed_categories[] = "`CATEGORIES` = '" . $cat['Name'] . "'";
             }
         }
         $access = "AND `CLASS` = 'PUBLIC'";
         if ($allowed_categories) {
             $access .= " AND (" . implode(' OR ', $allowed_categories) . ")";
         }
     }
     if (isset($_GET['Kategorie'])) {
         $cat_filter = array();
         foreach ($_GET['Kategorie'] as $cat) {
             $cat_filter[] = "`CATEGORIES` = '" . rawurldecode($cat) . "'";
             $filter = "AND (" . implode(' OR ', $cat_filter) . ")";
         }
     } else {
         $filter = '';
     }
     $show_sql = "SELECT * FROM `{$this->db_table}` WHERE `DTSTART` >= '" . Date::unify_timestamp($year_request . $month_request . $day_request) . "' {$access} {$filter} ORDER BY `DTSTART` ASC";
     $overview_sql = "SELECT * FROM `{$this->db_table}` WHERE `DTSTART` >= NOW() {$access} {$filter} ORDER BY `DTSTART` ASC";
     $overview = $this->connection->db_assoc($overview_sql);
     $this->cal->dates = array();
     $this->cal->edit_enabled = $this->scaff->edit_enabled;
     foreach ($overview as $date) {
         $date['DTSTART'] = Date::unify_timestamp($date['DTSTART']);
         $day = Date::jahr($date['DTSTART']) . Date::monat($date['DTSTART']) . Date::tag($date['DTSTART']) . '000000';
         $end = Date::jahr($date['DTEND']) . Date::monat($date['DTEND']) . Date::tag($date['DTEND']) . '000000';
         $array = array();
         $array['start'] = $day;
         $array['SUMMARY'] = '';
         $array['SUMMARY'] .= intval(Date::stunde($date['DTSTART']) . Date::minute($date['DTSTART'])) != 0 ? Date::stunde($date['DTSTART']) . ':' . Date::minute($date['DTSTART']) : '';
         $array['SUMMARY'] .= $day == $end ? '-' . Date::stunde($date['DTEND']) . ':' . Date::minute($date['DTEND']) . ' ' : ' ';
         $array['SUMMARY'] .= $date['SUMMARY'];
         $array['time'] = Date::stunde($date['DTSTART']) . ':' . Date::minute($date['DTSTART']);
         $array['id'] = $date['id'];
         $this->cal->dates[$day][] = $array;
         if ($day != $end) {
             while ($day < $end) {
                 $day = Date::add($day, 'day', 1);
                 $this->cal->dates[$day][] = $array;
             }
         }
     }
     $month[0] = $month_request;
     $year[0] = $year_request;
     $month[1] = $month[0] + 1 != 13 ? $month[0] + 1 : 1;
     $year[1] = $month[0] + 1 != 13 ? $year[0] : $year[0] + 1;
     $month[2] = $month[1] + 1 != 13 ? $month[1] + 1 : 1;
     $year[2] = $month[1] + 1 != 13 ? $year[1] : $year[0] + 1;
     $prev_month = $month[0] - 1 != 0 ? $month[0] - 1 : 12;
     $prev_year = $month[0] - 1 != 0 ? $year[0] : $year[0] - 1;
     $this->template = $this->template ? $this->template : INSTALL_PATH . '/Module/Kalender/Templates/KalenderTabelle.template.html';
     $prev_month_link = Html::a($page_root . '/' . $prev_year . '/' . $prev_month . $this->cat_get(), '&lt;&lt; ');
     $next_month_link = Html::a($page_root . '/' . $year[1] . '/' . $month[1] . $this->cat_get(), ' &gt;&gt;');
     $sidebar[] = $this->cat_select();
     $sidebar[] = $this->cal->getMonthHTML($month[0], $year[0], 1, $prev_month_link, $next_month_link);
     $sidebar[] = $this->cal->getMonthHTML($month[1], $year[1]);
     $sidebar[] = $this->cal->getMonthHTML($month[2], $year[2]);
     $this->scaff->datumsformat = 'tag_kurz';
     $result_table = $this->scaff->make_table($show_sql, $this->template);
     if ($ical_output) {
         $events = $this->connection->db_assoc($show_sql);
         if (!class_exists('iCal')) {
             include_once 'Kalender/iCalExport.php';
         }
         //header("Content-Type: text/calendar");
         $ical = new iCal($events);
         return mb_convert_encoding($ical->display_ical(), 'UTF-8', 'ISO-8859-15');
     }
     $nav = array();
     if ($prev = $this->scaff->prev_link()) {
         $nav[0] = Html::a(SELF . '?' . $prev, 'Zurück');
     }
     if ($next = $this->scaff->next_link()) {
         $nav[1] = Html::a(SELF . '?' . $next, 'Weiter');
     }
     $return_string = '';
     $return_string .= Form::form_tag(SELF);
     $return_string .= $result_table;
     //$return_string .=implode(' | ',$nav);
     $return_string .= Form::close_form();
     return Html::div($return_string, array('id' => 'box-mitte', 'class' => 'box-mitte')) . Html::div(implode("\n", $sidebar), array('id' => 'monatskalender'));
 }
Esempio n. 2
0
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 *
 * HUBzero is a registered trademark of Purdue University.
 *
 * @package   hubzero-cms
 * @author    Shawn Rice <*****@*****.**>
 * @copyright Copyright 2005-2015 HUBzero Foundation, LLC.
 * @license   http://opensource.org/licenses/MIT MIT
 */
// No direct access
defined('_HZEXEC_') or die;
$this->css();
$now = Date::toSql();
$week = Date::add('1 week')->toSql();
$database = App::get('db');
$query = "SELECT sd.*\n\t\tFROM `#__courses_offering_section_dates` AS sd\n\t\tWHERE sd.section_id=" . $this->offering->section()->get('id') . "\n\t\tAND (sd.publish_up >= " . $database->Quote($now) . " AND sd.publish_up <= " . $database->Quote($week) . ")\n\t\tAND sd.scope!='asset'\n\t\tORDER BY sd.publish_up LIMIT 20";
$database->setQuery($query);
$rows = $database->loadObjectList();
$base = $this->offering->link();
?>

	<h3 class="heading">
		<a name="dashboard"></a>
		<?php 
echo Lang::txt('PLG_COURSES_DASHBOARD');
?>
	</h3>

	<div class="sub-section">
Esempio n. 3
0
 function modify($whereFields = "")
 {
     global $gorumuser, $now;
     hasAdminRights($isAdm);
     $_S =& new AppSettings();
     $_EC = EComm::createObject();
     if (!$isAdm && !$_S->allowModify) {
         return;
     }
     $this->getCid();
     $this->activateVariableFields();
     $this->initClassVars();
     LocationHistory::savePost($this);
     G::load($old, $this->id, "item");
     if (!$isAdm && !$old->status) {
         return;
     }
     // inactive itemet nem modosithat a tulaj
     if (!$this->checkCharacterLimit() || !$this->checkAndSetExpirationDays() || !$_EC->checkConsumptionOfAction($purchaseItem, $consumption, $this, $old)) {
         return;
     }
     if (!$isAdm) {
         // ha a tulaj modosit, ujra inactive lesz az item:
         if (!$this->getImmediateAppear($consumption, TRUE)) {
             $this->status = FALSE;
         } elseif (G::getAttr($this->cid, "appcategory", "restartExpOnModify")) {
             if (!$this->expirationAppearsInForm() && $this->expiration) {
                 $this->expEmailSent = FALSE;
                 $this->expirationTime = Date::add($this->expiration, Date_Day);
             }
         }
     }
     // ha az expiration megjelent a formban es modositottak is, akkor az expirationTime-ot megfeleloen modositani kell:
     if ($this->expirationAppearsInForm() && ($this->expiration != round($old->expirationTime->getDayDiff()) || $this->expiration > 0 && $old->expirationTime->isPast() || $this->expiration < 0 && $old->expirationTime->isFuture())) {
         $this->expirationTime = Date::add($this->expiration, Date_Day);
     }
     parent::modify();
     load($this);
     if (!Roll::isFormInvalid()) {
         if (!$this->getImmediateAppear($consumption, TRUE) && $this->status != $old->status) {
             $this->changeStatus($this->status);
         }
         if ($this->getRenewOnModify()) {
             executeQuery("UPDATE @item SET creationtime=NOW() WHERE id=#id#", $this->id);
         }
         if (!$isAdm && $old->status && !$this->status) {
             if (!$purchaseItem) {
                 Roll::addInfoText("adScheduled");
             }
             G::load($n, Notification_adCreated, "notification");
             if ($n->active) {
                 $_S =& new AppSettings();
                 $this->getEmailParams($params, FALSE);
                 $n->send($_S->adminEmail, $params);
             }
         }
         $this->storeAttachment();
         if ($purchaseItem) {
             $purchaseItem->save($this);
         }
         CacheManager::resetCache($this->cid);
     }
 }
	/**
	 *  renders an event into vcal format.
	 *  @param  object  $event
	 *  @return string
	 */
	function event_to_vcal($event) {

		$uid = $event['UID'];
		$start = $event['DTSTART'];
		$end =  (intval(Date::unify_timestamp($event['DTEND'])) != 0)?$event['DTEND'] :'';
		$stamp = $event['DTSTAMP'];

		if ($end)
		{
			if (intval(Date::stunde($end).Date::minute($end)) !=0)
			{
				$dtend = "\r\nDTEND:".date("Ymd\THi00", Date::timestamp2unix($end));
			}
			else
			{
				$end = Date::add(Date::unify_timestamp($end),'day',1);
				$dtend = "\r\nDTEND;VALUE=DATE:".date("Ymd", Date::timestamp2unix($end));
			}
		}

		if (intval(Date::stunde($start).Date::minute($start)) !=0)
		{
			$dtstart = "\r\nDTSTART:".date("Ymd\THi00", Date::timestamp2unix($start));
		}
		else
		{
			$dtstart = "\r\nDTSTART;VALUE=DATE:".date("Ymd", Date::timestamp2unix($start));

		}
		if (!end)
		{
			$end = Date::add(Date::unify_timestamp($start),'day',1);
			$dtend = "\r\nDTEND;VALUE=DATE:".date("Ymd", Date::timestamp2unix($end));
		}
		$dtstamp = date("Ymd\THi00", Date::timestamp2unix($stamp));


		$text = 'BEGIN:VEVENT';
		$text .= "\r\nUID:". $uid;
		($event['CATEGORIES']) ? $text .= "\r\nCATEGORIES:" . $event['CATEGORIES'] :'';

		$text .= "\r\nSUMMARY:" . $this->cleanup($event['SUMMARY']);
		$text .= "\r\nDESCRIPTION: ". $this->cleanup($event['DESCRIPTION']);
		($event['LOCATION']) ? $text .= "\r\nLOCATION:" . $this->cleanup($event['LOCATION']) : '';
		($event['CONTACT']) ? $text .= "\r\nATTENDEE;ROLE=OWNER;STATUS=CONFIRMED: ".$event['CONTACT'] :'';
		$text .= "\r\nCLASS:PUBLIC";
		$text .= "\r\nSTATUS:".$event['STATUS'];
		($event['URL']) ? $text .= "\r\nURL:".$event['URL'] :'';

		$text .= $dtstart;
		($dtend) ? $text .= $dtend :'';
		$text .= "\r\nDTSTAMP:$dtstamp";
		$text .= "\r\nEND:VEVENT";

		return $text;
	}
Esempio n. 5
0
echo template_simple('<p>
<table border="0" cellpadding="3" cellspacing="0" width="100%">
	<tr>
		<td width="35%" align="left" style="border-right: 1px solid #aaa; border-bottom: 1px solid #aaa">
			<a href="{site/prefix}/index/usradm-browse-action?list=log&_date={previous}&orderBy={cgi/orderBy}&sort={cgi/sort}&_range={cgi/_range}&_type={cgi/type}&_user={cgi/user}"><img src="{site/prefix}/inc/app/usradm/pix/arrow.prev.gif" alt="{intl Previous}" border="0" /> {intl Previous}: {filter usradm_filter_stats_date}{previous}{end filter}</a>
		</td>
		<td width="30%" align="center" style="border-right: 1px solid #aaa; border-bottom: 1px solid #aaa">
			<strong>{filter usradm_filter_stats_date}{cgi/_date}{end filter}</strong>
		</td>
		<td width="35%" align="right" style="border-bottom: 1px solid #aaa">
			<a href="{site/prefix}/index/usradm-browse-action?list=log&_date={next}&orderBy={cgi/orderBy}&sort={cgi/sort}&_range={cgi/_range}&_type={cgi/type}&_user={cgi/user}">{intl Next}: {filter usradm_filter_stats_date}{next}{end filter} <img src="{site/prefix}/inc/app/usradm/pix/arrow.next.gif" alt="{intl Next}" border="0" /></a>
		</td>
	</tr>
</table>
</p>
	', array('previous' => Date::subtract($cgi->_date, '1 ' . $cgi->_range), 'next' => Date::add($cgi->_date, '1 ' . $cgi->_range)));
template_simple_register('pager', $pg);
echo template_simple('<table border="0" cellpadding="3" width="100%">
	<tr>
		<td>{spt PAGER_TEMPLATE_FROM_TO}</td>
		<td align="right">{if pager.total}{spt PAGER_TEMPLATE_PREV_PAGE_LIST_NEXT}{end if}</td>
	</tr>
</table>' . NEWLINEx2);
// header
echo '<table border="0" cellpadding="3" cellspacing="1" width="100%">
		<tr>' . NEWLINE;
foreach ($headers as $header) {
    echo TABx3 . '<th><a href="' . site_prefix() . '/index/usradm-browse-action?list=log&orderBy=' . $header->name . '&sort=' . $header->getSort() . '&offset=' . urlencode($cgi->offset) . '&_type=' . urlencode($cgi->_type) . '&_user='******'&_range=' . urlencode($cgi->_range) . '">' . $header->fullname . '</a>';
    if ($header->isCurrent()) {
        echo ' <img src="' . site_prefix() . '/inc/app/usradm/pix/arrow.' . $cgi->sort . '.gif" alt="' . $cgi->sort . '" border="0" />';
    }
Esempio n. 6
0
 /**
  * Determines the previous and next date preriods.
  */
 function getTotalDates($date)
 {
     loader_import('saf.Date');
     return array(Date::subtract($date, '1 month'), Date::add($date, '1 month'));
 }
 function overview()
 {
     $this->pics_scaff->add_search_field('Name');
     $this->pics_scaff->add_search_field('Jahr');
     $this->pics_scaff->template_vars['Name_value'] = $_GET['Name'] ? $_GET['Name'] : '';
     if ($name = $_GET['Name']) {
         $_GET['Name'] = "%{$name}%";
     }
     $this->pics_scaff->template_vars['Jahr_value'] = $_GET['Jahr'] ? $_GET['Jahr'] : '';
     if ($jahr = $_GET['Jahr']) {
         $_GET['Jahr'] = "%{$jahr}%";
     }
     $where = array();
     foreach ($this->pics_scaff->enable_search_for as $spalte) {
         if ($_GET[$spalte]) {
             $value = General::input_clean($_GET[$spalte], true);
             $where[] = "`{$spalte}` LIKE '{$value}'";
         }
     }
     $where = $where ? "WHERE " . implode($this->pics_scaff->search_combinate, $where) : '';
     $images_sql = $all_images_sql = "SELECT * FROM `{$this->pics_db_table}` {$where}";
     $order = $_GET['order'] ? "&amp;order=" . $_GET['order'] : '';
     if ($_GET['dir'] == 'desc') {
         $auf = 'Aufsteigend';
         $ab = Html::bold(Html::italic('Absteigend'));
         $dir = 'DESC';
         $desc = '&amp;dir=asc';
     } else {
         if ($_GET['dir'] == 'asc') {
             $auf = Html::bold(Html::italic('Aufsteigend'));
             $ab = 'Absteigend';
             $dir = 'ASC';
             $desc = '&amp;dir=desc';
         } else {
             $dir = 'ASC';
             $desc = '&amp;dir=desc';
         }
     }
     $return .= '&nbsp;';
     $this->pics_scaff->edit_enabled = true;
     foreach ($this->pics_scaff->cols_array as $col) {
         $name = $_GET['order'] == $col['name'] ? Html::bold(Html::italic($col['name'])) : $col['name'];
         $desc = $_GET['order'] == $col['name'] ? $_GET['dir'] == 'desc' ? '&amp;dir=asc' : '&amp;dir=desc' : '&amp;dir=desc';
         $this->pics_scaff->template_vars[$col['name'] . '_button'] = Html::a('/Admin/RheinaufExhibitionAdmin/Pictures?order=' . rawurlencode($col['name']) . $desc, $name);
     }
     $this->pics_scaff->results_per_page = 30;
     $pages = $this->pics_scaff->get_pages($all_images_sql);
     $pagination = $this->pics_scaff->num_rows . " Bilder auf {$pages} Seiten  ";
     $prev_link = ($prev = $this->pics_scaff->prev_link()) ? Html::a(SELF . '?order=' . $_GET['order'] . '&amp;dir=' . $_GET['dir'] . '&amp;' . $prev, htmlspecialchars('<<<'), array('class' => 'button')) : '';
     $next_link = ($next = $this->pics_scaff->next_link()) ? Html::a(SELF . '?order=' . $_GET['order'] . '&amp;dir=' . $_GET['dir'] . '&amp;' . $next, htmlspecialchars('>>>'), array('class' => 'button')) : '';
     $this->pics_scaff->template_vars['pagination'] = $pagination . $prev_link . "Seite " . $this->pics_scaff->get_page() . ' von ' . $pages . ' ' . $next_link;
     $order = $_GET['order'] ? rawurldecode($_GET['order']) : 'Name';
     //Bild des Monats
     $sql = "SELECT * FROM `{$this->db_table}` WHERE `BildDesMonats` != '' ORDER BY `BildDesMonats` DESC";
     //BDM_Monat`='$month' AND `BDM_Jahr`='$year'";
     $result = $this->connection->db_single_row($sql);
     $last_bdm = $result['BildDesMonats'];
     $this->pics_scaff->template_vars['next_bdm'] = $next_bdm = substr(Date::add($last_bdm . '01', 'month', 1), 0, 6);
     $this->pics_scaff->template_vars['next_bdm_str'] = substr($next_bdm, 4, 2) . '/' . substr($next_bdm, 0, 4);
     $this->pics_scaff->cols_array['BildDesMonats']['transform'] = '($value) ? substr($value,4,2). "/" .substr($value,0,4):"";';
     $this->pics_scaff->cols_array['Beschreibung']['transform'] = '($value) ? "ja":"nein";';
     $this->pics_scaff->cols_array['Höhe']['transform'] = '($value) ? $value :"n.a.";';
     $this->pics_scaff->cols_array['Breite']['transform'] = '($value) ? $value :"n.a.";';
     $this->pics_scaff->cols_array['Name']['transform'] = 'General::wrap_string($value,20);';
     $sql = "{$images_sql} ORDER BY {$order} {$dir}";
     return Html::h(2, 'Alle Bilder') . $this->pics_scaff->make_table($sql, INSTALL_PATH . '/Module/RheinaufExhibition/Backend/Templates/ExhibitionPicturesOverview.template.html');
 }
Esempio n. 8
0
 function handleImmediateAppearChanges($oldImmediateAppear)
 {
     if (!$oldImmediateAppear && $this->immediateAppear) {
         // ha eppen imediateAppear-ra allitottak, akkor minden inactive
         // ad-ot aktivra allitunk a kategoriaban:
         getDbCount($count, array("SELECT COUNT(*) FROM @item WHERE cid=#this->id# AND status=0", $this->id));
         if ($this->expiration) {
             $expirationTime = Date::add($exp, Date_Day);
             $exp = ", expirationTime = '" . $expirationTime->getDbFormat() . "', expEmailSent=0";
         } else {
             $exp = "";
         }
         executeQuery("UPDATE @item SET status=1 {$exp} WHERE cid=#this->id# AND status=0", $this->id);
         load($this);
         // hogy a directItemNum betoltodjon
         $this->increaseDirectItemNum($count);
     }
 }
Esempio n. 9
0
            $event->time .= ltrim(strftime('%I:%M %p', mktime($h, $m, $s, $d, $mm, $y)), '0');
        }
    }
    $event->time = str_replace(':00', '', $event->time);
    if (substr_count($event->time, 'AM') > 1) {
        $event->time = str_replace(' AM ', ' ', $event->time);
    }
    if (substr_count($event->time, 'PM') > 1) {
        $event->time = str_replace(' PM ', ' ', $event->time);
    }
}
list($y, $m, $d) = split('-', $parameters['day']);
page_title(intl_get('Events For') . ' ' . strftime('%B %e, %Y', mktime(5, 0, 0, $m, $d, $y)));
page_title(appconf('siteevent_title'));
echo template_simple('categories.spt', array('list' => db_fetch_array('select * from siteevent_category order by name asc'), 'current' => $parameters['category'], 'alist' => db_fetch_array('select * from siteevent_audience order by name asc'), 'audience' => $parameters['audience'], 'simplecal' => $parameters['simplecal'], 'view' => $parameters['view']));
echo template_simple('day.spt', array('list' => $events, 'date' => strftime(appconf('date_format'), strtotime($parameters['day'])), 'prevDate' => Date::subtract($parameters['day'], '1 day'), 'prevDay' => strftime(appconf('date_format'), strtotime(Date::subtract($parameters['day'], '1 day'))), 'nextDate' => Date::add($parameters['day'], '1 day'), 'nextDay' => strftime(appconf('date_format'), strtotime(Date::add($parameters['day'], '1 day')))));
echo '<p>';
if (appconf('ical_links')) {
    if (!empty($parameters['category'])) {
        $cat = '?category=' . $parameters['category'];
    } else {
        $cat = '';
    }
    echo '<a href="' . site_prefix() . '/index/siteevent-ical-action' . $cat . '">' . intl_get('Subscribe (iCalendar)') . '</a> &nbsp; &nbsp; &nbsp; &nbsp;';
}
if (appconf('rss_links')) {
    if (!empty($parameters['category'])) {
        $cat = '?category=' . $parameters['category'];
    } else {
        $cat = '';
    }
Esempio n. 10
0
 function test()
 {
     $d = new Date("hjsgdf");
     echo "Invalid date:<br>";
     echo "<pre>" . print_r($d, TRUE) . "</pre>";
     $d = new Date();
     echo "Default date:<br>";
     echo "<pre>" . print_r($d, TRUE) . "</pre>";
     $d = new Date("now");
     echo "Current date:<br>";
     echo "<pre>" . print_r($d, TRUE) . "</pre>";
     $d = new Date('1960-02-10 01:02:03');
     echo "From string - '1960-02-10 01:02:03':<br>";
     echo "<pre>" . print_r($d, TRUE) . "</pre>";
     $d = new Date('Wed, 01/16/2008 07:20');
     echo "From string - 'Wed, 01/16/2008 07:20':<br>";
     echo "<pre>" . print_r($d, TRUE) . "</pre>";
     $d = new Date(1907, 1);
     echo "From 2 separate parameters:<br>";
     echo "<pre>" . print_r($d, TRUE) . "</pre>";
     $d = new Date(1907, 1, 15);
     echo "From 3 separate parameters:<br>";
     echo "<pre>" . print_r($d, TRUE) . "</pre>";
     $d = new Date(1907, 1, 15, 1);
     echo "From 4 separate parameters:<br>";
     echo "<pre>" . print_r($d, TRUE) . "</pre>";
     $d = new Date(1907, 1, 15, 1, 2);
     echo "From 5 separate parameters:<br>";
     echo "<pre>" . print_r($d, TRUE) . "</pre>";
     $d = new Date(1907, 1, 15, 1, 2, 3);
     echo "From 6 separate parameters:<br>";
     echo "<pre>" . print_r($d, TRUE) . "</pre>";
     $d = new Date(array("year" => 1, "month" => 2, "day" => 3, "hour" => 4, "minute" => 5, "second" => 6));
     echo "From array of 6:<br>";
     echo "<pre>" . print_r($d, TRUE) . "</pre>";
     $d = new Date(array("year" => 1, "month" => 2, "day" => 3, "hour" => 4, "minute" => 5));
     echo "From array of 5:<br>";
     echo "<pre>" . print_r($d, TRUE) . "</pre>";
     $d = new Date(array("year" => 1, "month" => 2, "day" => 3, "hour" => 4));
     echo "From array of 4:<br>";
     echo "<pre>" . print_r($d, TRUE) . "</pre>";
     $d = new Date(array("year" => 1, "month" => 2, "day" => 3));
     echo "From array of 3:<br>";
     echo "<pre>" . print_r($d, TRUE) . "</pre>";
     echo "<h3>Comparision test:</h3><br>";
     $d1 = new Date('1907-6-15 12:30:30');
     $d11 = new Date('1907-6-15 12:30:30');
     $d2 = new Date('1907-6-16 12:30:30');
     $d3 = new Date('1907-6-17 12:30:30');
     echo "{$d1}=={$d11}: " . ($d1->compare('==', $d11) ? 'ok' : '<font color=red>NOK</font>') . "<br>";
     echo "{$d1}!={$d11}: " . (!$d1->compare('!=', $d11) ? 'ok' : '<font color=red>NOK</font>') . "<br>";
     echo "{$d1}<{$d11}: " . (!$d1->compare('<', $d11) ? 'ok' : '<font color=red>NOK</font>') . "<br>";
     echo "{$d1}>{$d11}: " . (!$d1->compare('>', $d11) ? 'ok' : '<font color=red>NOK</font>') . "<br>";
     echo "{$d1}<={$d11}: " . ($d1->compare('<=', $d11) ? 'ok' : '<font color=red>NOK</font>') . "<br>";
     echo "{$d1}>={$d11}: " . ($d1->compare('>=', $d11) ? 'ok' : '<font color=red>NOK</font>') . "<br>";
     echo "{$d1}=={$d2}: " . (!$d1->compare('==', $d2) ? 'ok' : '<font color=red>NOK</font>') . "<br>";
     echo "{$d1}!={$d2}: " . ($d1->compare('!=', $d2) ? 'ok' : '<font color=red>NOK</font>') . "<br>";
     echo "{$d1}<{$d2}: " . ($d1->compare('<', $d2) ? 'ok' : '<font color=red>NOK</font>') . "<br>";
     echo "{$d1}>{$d2}: " . (!$d1->compare('>', $d2) ? 'ok' : '<font color=red>NOK</font>') . "<br>";
     echo "{$d1}<={$d2}: " . ($d1->compare('<=', $d2) ? 'ok' : '<font color=red>NOK</font>') . "<br>";
     echo "{$d1}>={$d2}: " . (!$d1->compare('>=', $d2) ? 'ok' : '<font color=red>NOK</font>') . "<br>";
     echo "{$d1}<{$d2}<{$d3}: " . ($d2->isBetween($d1, $d3) ? 'ok' : '<font color=red>NOK</font>') . "<br>";
     echo "{$d1}<={$d11}<{$d3}: " . ($d11->isBetween($d1, $d3, '<=>') ? 'ok' : '<font color=red>NOK</font>') . "<br>";
     echo "{$d1}<{$d2}: " . ($d1->isBefore($d2) ? 'ok' : '<font color=red>NOK</font>') . "<br>";
     echo "{$d3}>{$d2}: " . ($d3->isAfter($d2) ? 'ok' : '<font color=red>NOK</font>') . "<br>";
     echo "{$d1}=={$d2}(day): " . (!$d1->compare('==', $d2, Date_Day) ? 'ok' : '<font color=red>NOK</font>') . "<br>";
     echo "{$d1}!={$d2}(day): " . ($d1->compare('!=', $d2, Date_Day) ? 'ok' : '<font color=red>NOK</font>') . "<br>";
     echo "{$d1}<{$d2}(day): " . ($d1->compare('<', $d2, Date_Day) ? 'ok' : '<font color=red>NOK</font>') . "<br>";
     echo "{$d1}>{$d2}(day): " . (!$d1->compare('>', $d2, Date_Day) ? 'ok' : '<font color=red>NOK</font>') . "<br>";
     echo "{$d1}<={$d2}(day): " . ($d1->compare('<=', $d2, Date_Day) ? 'ok' : '<font color=red>NOK</font>') . "<br>";
     echo "{$d1}>={$d2}(day): " . (!$d1->compare('>=', $d2, Date_Day) ? 'ok' : '<font color=red>NOK</font>') . "<br>";
     echo "{$d1}=={$d2}(month): " . ($d1->compare('==', $d2, Date_Month) ? 'ok' : '<font color=red>NOK</font>') . "<br>";
     echo "{$d1}=={$d2}(year): " . ($d1->compare('==', $d2, Date_Year) ? 'ok' : '<font color=red>NOK</font>') . "<br>";
     echo "{$d1}=={$d2}(hour): " . (!$d1->compare('==', $d2, Date_Hour) ? 'ok' : '<font color=red>NOK</font>') . "<br>";
     echo "<h3>Diff test:</h3><br>";
     $d1 = new Date('1907-6-15 12:30:30');
     $d2 = new Date('1907-6-17 12:30:30');
     $d3 = new Date('1907-6-15 13:32:33');
     echo "Diff of {$d1} and {$d2}:<br>";
     echo "<pre>" . print_r($d1->getFullDiff($d2), TRUE) . "</pre>";
     echo "Diff of {$d1} and {$d3}:<br>";
     echo "<pre>" . print_r($d1->getFullDiff($d3), TRUE) . "</pre>";
     echo "Diff of {$d2} and {$d3}:<br>";
     echo "<pre>" . print_r($d2->getFullDiff($d3), TRUE) . "</pre>";
     echo "Diff of {$d1} and {$d1}:<br>";
     echo "<pre>" . print_r($d1->getFullDiff($d1), TRUE) . "</pre>";
     echo "Diff of {$d1} and {$d2}:<br>";
     echo "<pre>" . $d1->getHoursMinutesDiff($d2) . "</pre>";
     echo "Diff of {$d1} and {$d3}:<br>";
     echo "<pre>" . $d1->getHoursMinutesDiff($d3) . "</pre>";
     echo "Diff of {$d2} and {$d3}:<br>";
     echo "<pre>" . $d2->getHoursMinutesDiff($d3) . "</pre>";
     echo "Diff of {$d1} and {$d1}:<br>";
     echo "<pre>" . $d1->getHoursMinutesDiff($d1) . "</pre>";
     echo "firstSecondOfDay {$d1}:<br>";
     echo "<pre>" . $d1->firstSecondOfDay() . "</pre>";
     echo "firstSecondOfDay {$d1}:<br>";
     echo "<pre>" . Date::firstSecondOfDay($d1) . "</pre>";
     echo "firstSecondOfDay today:<br>";
     echo "<pre>" . Date::firstSecondOfDay() . "</pre>";
     echo "lastSecondOfDay {$d1}:<br>";
     echo "<pre>" . $d1->lastSecondOfDay() . "</pre>";
     echo "firstDayOfWeek {$d1}:<br>";
     echo "<pre>" . $d1->firstDayOfWeek() . "</pre>";
     echo "lastDayOfWeek {$d1}:<br>";
     echo "<pre>" . $d1->lastDayOfWeek() . "</pre>";
     echo "firstDayOfMonth {$d1}:<br>";
     echo "<pre>" . $d1->firstDayOfMonth() . "</pre>";
     echo "lastDayOfMonth {$d1}:<br>";
     echo "<pre>" . $d1->lastDayOfMonth() . "</pre>";
     echo "firstDayOfYear {$d1}:<br>";
     echo "<pre>" . $d1->firstDayOfYear() . "</pre>";
     echo "lastDayOfYear {$d1}:<br>";
     echo "<pre>" . $d1->lastDayOfYear() . "</pre>";
     echo "lastSecondOfWeek {$d1}:<br>";
     echo "<pre>" . $d1->lastSecondOfWeek() . "</pre>";
     echo "lastSecondOfMonth {$d1}:<br>";
     echo "<pre>" . $d1->lastSecondOfMonth() . "</pre>";
     echo "lastSecondOfYear {$d1}:<br>";
     echo "<pre>" . $d1->lastSecondOfYear() . "</pre>";
     echo "<h3>Datum aritmetika:</h3><br>";
     echo "{$d1} ->add( 1, Date_Second ):<br>";
     echo "<pre>" . $d1->add(1, Date_Second) . "</pre>";
     echo "{$d1} ->add( 1, Date_Minute ):<br>";
     echo "<pre>" . $d1->add(1, Date_Minute) . "</pre>";
     echo "{$d1} ->add( 1, Date_Hour ):<br>";
     echo "<pre>" . $d1->add(1, Date_Hour) . "</pre>";
     echo "{$d1} ->add( 1, Date_Day ):<br>";
     echo "<pre>" . $d1->add(1, Date_Day) . "</pre>";
     echo "{$d1} ->add( 1, Date_Week ):<br>";
     echo "<pre>" . $d1->add(1, Date_Week) . "</pre>";
     echo "{$d1} ->add( 1, Date_Month ):<br>";
     echo "<pre>" . $d1->add(1, Date_Month) . "</pre>";
     echo "{$d1} ->add( 1, Date_Year ):<br>";
     echo "<pre>" . $d1->add(1, Date_Year) . "</pre>";
     echo "1 nap mulva:<br>";
     echo "<pre>" . Date::add(1, Date_Day) . "</pre>";
     echo "1 honap mulva:<br>";
     echo "<pre>" . Date::add(1, Date_Month) . "</pre>";
     echo "1 ev mulva:<br>";
     echo "<pre>" . Date::add(1, Date_Year) . "</pre>";
     echo "1 nappal ezelott:<br>";
     echo "<pre>" . Date::subtract(1, Date_Day) . "</pre>";
     echo "1 honappal ezelott:<br>";
     echo "<pre>" . Date::subtract(1, Date_Month) . "</pre>";
     echo "1 evvel ezelott:<br>";
     echo "<pre>" . Date::subtract(1, Date_Year) . "</pre>";
 }
Esempio n. 11
0
            for ($i = $first; $i <= $last; $i = Date::add($i, '1 day')) {
                if (isset($items[$i])) {
                    $items[$i][] = array('id' => $item->id, 'title' => $title, 'link' => site_prefix() . '/index/siteevent-details-action/id.' . $item->id . '/title.' . siteevent_filter_link_title($item->title), 'priority' => $item->priority, 'alt' => $alt, 'time' => $item->time);
                }
            }
            break;
    }
}
if (false && session_admin()) {
    echo loader_box('cms/buttons/add', array('collection' => 'siteevent_event', 'float' => true));
    echo '<br clear="all" />';
    echo template_simple('users.spt', array('list' => db_fetch_array('select * from siteevent_category order by name asc'), 'current' => $parameters['category'], 'user_list' => db_fetch_array('select sitellite_owner, count(*) as total from siteevent_event where ' . session_allowed_sql() . ' group by sitellite_owner asc'), 'current_user' => $parameters['user'], 'simplecal' => $parameters['simplecal']));
} else {
    echo template_simple('categories.spt', array('list' => db_fetch_array('select * from siteevent_category order by name asc'), 'current' => $parameters['category'], 'alist' => db_fetch_array('select * from siteevent_audience order by name asc'), 'audience' => $parameters['audience'], 'simplecal' => $parameters['simplecal'], 'view' => $parameters['view']));
}
echo template_simple('week.spt', array('list' => $items, 'date' => date('Y-m-d'), 'dateName' => intl_get('Week of') . ' ' . strftime(appconf('date_format'), strtotime($week_of)), 'prev' => Date::subtract($week_of, '7 day'), 'next' => Date::add($week_of, '7 day')));
echo '<p>';
if (appconf('ical_links')) {
    if (!empty($parameters['category'])) {
        $cat = '?category=' . $parameters['category'];
    } else {
        $cat = '';
    }
    echo '<a href="' . site_prefix() . '/index/siteevent-ical-action' . $cat . '">' . intl_get('Subscribe (iCalendar)') . '</a> &nbsp; &nbsp; &nbsp; &nbsp;';
}
if (appconf('rss_links')) {
    if (!empty($parameters['category'])) {
        $cat = '?category=' . $parameters['category'];
    } else {
        $cat = '';
    }
Esempio n. 12
0
 function getUpcoming($limit = 10, $cat, $aud = '')
 {
     $list = $this->_eventsInRange(date('Y-m-d'), false, $cat, $aud, '', '*', $limit);
     //dump_items ($list);
     $items = array();
     $month = date('m');
     $year = date('Y');
     $cur = 0;
     while (count($items) < $limit && count($list) > 0) {
         list($year, $month, $day) = explode('-', date('Y-m-d', time() + $cur));
         for ($k = 0; $k < count($list); $k++) {
             if (count($items) >= $limit) {
                 break;
             }
             $item = clone $list[$k];
             list($y, $m, $d) = explode('-', $item->date);
             list($yy, $mm, $dd) = explode('-', $item->until_date);
             if ($year . '-' . $month . '-' . $day < $item->date) {
                 continue;
             }
             if ($yy != '0000' && $year . '-' . $month . '-' . $day > $item->until_date) {
                 //unset ($list[$k]);
                 array_splice($list, $k, 1);
                 $k--;
                 continue;
             }
             switch ($item->recurring) {
                 case 'yearly':
                     if ($m == $month && $d == $day) {
                         $item->date = $year . '-' . $month . '-' . $day;
                         $items[] = $item;
                     }
                     break;
                 case 'monthly':
                     if ($d == $day) {
                         $item->date = $year . '-' . $month . '-' . $day;
                         $items[] = $item;
                     }
                     break;
                 case 'weekly':
                     $cwd = date('w', mktime(5, 0, 0, $month, $day, $year));
                     $wd = date('w', mktime(5, 0, 0, $m, $d, $y));
                     if ($cwd == $wd) {
                         $item->date = $year . '-' . $month . '-' . $day;
                         $items[] = $item;
                     }
                     break;
                 case 'daily':
                     //$item->date = $year . '-' . $month . '-' . $day;
                     $items[] = $item;
                     //unset ($list[$k]);
                     //array_splice ($list, $k, 1);
                     //$k--;
                     $next = Date::add($item->date, '1 day');
                     if ($next > $item->until_date) {
                         array_splice($list, $k, 1);
                         $k--;
                     } else {
                         $list[$k]->date = $next;
                     }
                     break;
                 case 'no':
                     if ($item->until_date > $item->date) {
                         $items[] = $item;
                         $next = Date::add($item->date, '1 day');
                         if ($next > $item->until_date) {
                             array_splice($list, $k, 1);
                             $k--;
                         } else {
                             $list[$k]->date = $next;
                         }
                         break;
                     }
                     if ($item->date == $year . '-' . $month . '-' . $day) {
                         $items[] = $item;
                         //unset ($list[$k]);
                         array_splice($list, $k, 1);
                         $k--;
                     }
                     break;
                 default:
                     die('recurring value invalid!');
                     /*
                     if ($yy == '0000' && $item->recurring == 'daily') {
                     	//$item->date = $year . '-' . $month . '-' . $day;
                     	$items[] = $item;
                     	unset ($list[$k]);
                     } elseif ($yy != '0000') {
                     	//$item->date = $year . '-' . $month . '-' . $day;
                     	$items[] = $item;
                     	unset ($list[$k]);
                     } elseif ($item->date == $year . '-' . $month . '-' . $day) {
                     	$items[] = $item;
                     }
                     break;
                     */
             }
         }
         $cur += 86400;
     }
     //dump_items ($items);
     return $items;
 }