summaryrefslogtreecommitdiffstats
path: root/system/libraries
diff options
context:
space:
mode:
authorAndrey Andreev <narf@devilix.net>2014-02-21 15:58:13 +0100
committerAndrey Andreev <narf@devilix.net>2014-02-21 15:58:13 +0100
commit6125a279693a54d04cbd63d7aee03cf7b9a85f00 (patch)
treea6e965c1f87f6fa5baa6efa7e602e2c92a1c9baa /system/libraries
parent742826c26c64656acf5cfc7df4cc5e1c5c8a68cc (diff)
Remove CI_Calendar::
Only use it in generate().
Diffstat (limited to 'system/libraries')
-rw-r--r--system/libraries/Calendar.php44
1 files changed, 19 insertions, 25 deletions
diff --git a/system/libraries/Calendar.php b/system/libraries/Calendar.php
index cdcbfe9d7..1a0d02ba0 100644
--- a/system/libraries/Calendar.php
+++ b/system/libraries/Calendar.php
@@ -40,20 +40,6 @@ defined('BASEPATH') OR exit('No direct script access allowed');
class CI_Calendar {
/**
- * Reference to CodeIgniter instance
- *
- * @var object
- */
- protected $CI;
-
- /**
- * Current local time
- *
- * @var int
- */
- public $local_time;
-
- /**
* Calendar layout template
*
* @var mixed
@@ -109,6 +95,17 @@ class CI_Calendar {
*/
public $show_other_days = FALSE;
+ // --------------------------------------------------------------------
+
+ /**
+ * CI Singleton
+ *
+ * @var object
+ */
+ protected $CI;
+
+ // --------------------------------------------------------------------
+
/**
* Class constructor
*
@@ -128,12 +125,7 @@ class CI_Calendar {
$this->CI->lang->load('calendar');
}
- $this->local_time = time();
-
- if (count($config) > 0)
- {
- $this->initialize($config);
- }
+ empty($config) OR $this->initialize($config);
log_message('debug', 'Calendar Class Initialized');
}
@@ -179,10 +171,12 @@ class CI_Calendar {
*/
public function generate($year = '', $month = '', $data = array())
{
+ $local_time = time();
+
// Set and validate the supplied month/year
if (empty($year))
{
- $year = date('Y', $this->local_time);
+ $year = date('Y', $local_time);
}
elseif (strlen($year) === 1)
{
@@ -195,7 +189,7 @@ class CI_Calendar {
if (empty($month))
{
- $month = date('m', $this->local_time);
+ $month = date('m', $local_time);
}
elseif (strlen($month) === 1)
{
@@ -226,9 +220,9 @@ class CI_Calendar {
// Set the current month/year/day
// We use this to determine the "today" date
- $cur_year = date('Y', $this->local_time);
- $cur_month = date('m', $this->local_time);
- $cur_day = date('j', $this->local_time);
+ $cur_year = date('Y', $local_time);
+ $cur_month = date('m', $local_time);
+ $cur_day = date('j', $local_time);
$is_current_month = ($cur_year == $year && $cur_month == $month);