/**
  * Contructor
  *
  * @access	public
  * @return	null
  */
 public function __construct()
 {
     //we don't want to run update on EE system update
     if (isset($GLOBALS['CI']) and get_class($GLOBALS['CI']) == 'Wizard') {
         return;
     }
     parent::__construct();
     // --------------------------------------------
     //  Module Actions
     // --------------------------------------------
     $this->module_actions = array('permissions_json');
     // --------------------------------------------
     //  Extension Hooks
     // --------------------------------------------
     $this->default_settings = array();
     $default = array('class' => $this->extension_name, 'settings' => '', 'priority' => 10, 'version' => CALENDAR_VERSION, 'enabled' => 'y');
     $this->hooks = array(array_merge($default, array('method' => 'delete_entries_loop', 'hook' => 'delete_entries_loop')));
     //these hooks are intended for 1.x only so we need to keep
     //seperate in case they ever impliment the hooks
     if (APP_VER < 2.0) {
         $this->hooks = array_merge($this->hooks, array(array_merge($default, array('method' => 'publish_form_headers', 'hook' => 'publish_form_headers')), array_merge($default, array('method' => 'publish_form_end', 'hook' => 'publish_form_end')), array_merge($default, array('method' => 'publish_form_start', 'hook' => 'publish_form_start')), array_merge($default, array('method' => 'submit_new_entry_start', 'hook' => 'submit_new_entry_start')), array_merge($default, array('method' => 'submit_new_entry_end', 'hook' => 'submit_new_entry_end'))));
     }
     //2.x+
     if (APP_VER >= 2.0) {
         $this->hooks = array_merge($this->hooks, array(array_merge($default, array('method' => 'entry_submission_end', 'hook' => 'entry_submission_end')), array_merge($default, array('method' => 'cp_js_end', 'hook' => 'cp_js_end')), array_merge($default, array('method' => 'edit_entries_additional_where', 'hook' => 'edit_entries_additional_where')), array_merge($default, array('method' => 'update_multi_entries_start', 'hook' => 'update_multi_entries_start')), array_merge($default, array('method' => 'delete_entries_start', 'hook' => 'delete_entries_start'))));
     }
 }
Beispiel #2
0
 /**
  * Constructor
  *
  * @access	public
  * @param	bool		Enable calling of methods based on URI string
  * @return	string
  */
 public function __construct($switch = TRUE)
 {
     parent::__construct();
     if ((bool) $switch === FALSE) {
         return;
     }
     // Install or Uninstall Request
     // -------------------------------------
     //  We need our actions
     // -------------------------------------
     $this->actions();
     if (!defined('CALENDAR_CALENDARS_CHANNEL_NAME')) {
         define('CALENDAR_CALENDARS_CHANNEL_NAME', $this->actions->calendar_channel_shortname());
         define('CALENDAR_EVENTS_CHANNEL_NAME', $this->actions->event_channel_shortname());
     }
     // --------------------------------------------
     //  Module Menu Items
     // --------------------------------------------
     $menu = array('view_calendars' => array('link' => $this->base . AMP . 'method=view_calendars', 'title' => lang('calendars')), 'view_events' => array('link' => $this->base . AMP . 'method=view_events', 'title' => lang('events')), 'permissions' => array('link' => $this->base . AMP . 'method=permissions', 'title' => lang('permissions')), 'preferences' => array('link' => $this->base . AMP . 'method=view_preferences', 'title' => lang('preferences')), 'module_demo_templates' => array('link' => $this->base . '&method=code_pack', 'title' => lang('demo_templates')), 'module_documentation' => array('link' => CALENDAR_DOCS_URL, 'title' => lang('online_documentation'), 'new_window' => TRUE));
     $this->cached_vars['lang_module_version'] = lang('calendar_module_version');
     $this->cached_vars['module_version'] = CALENDAR_VERSION;
     $this->cached_vars['module_menu_highlight'] = 'view_calendars';
     $this->cached_vars['module_menu'] = $menu;
     //needed for header.html file views
     $this->cached_vars['js_magic_checkboxes'] = $this->js_magic_checkboxes();
     // --------------------------------------------
     //  Sites
     // --------------------------------------------
     $this->cached_vars['sites'] = array();
     foreach ($this->data->get_sites() as $site_id => $site_label) {
         $this->cached_vars['sites'][$site_id] = $site_label;
     }
     // -------------------------------------
     //  We need our actions
     // -------------------------------------
     $this->actions();
     // -------------------------------------
     //  Grab the MOD file and related goodies
     // -------------------------------------
     if (!class_exists('Calendar')) {
         require_once CALENDAR_PATH . 'mod.calendar.php';
     }
     $this->CAL = new Calendar();
     $this->CAL->load_calendar_datetime();
     // -------------------------------------
     //  need a special case for our beta versions
     //  this shouldn't be hit for normal EE updates
     // -------------------------------------
     if ($this->version_compare($this->database_version(), '<', CALENDAR_VERSION) and !(CALENDAR_VERSION > $this->database_version()) or !$this->extensions_enabled()) {
         // For EE 2.x, we need to redirect the request to Update Routine
         $_GET['method'] = 'calendar_module_update';
         $updated = TRUE;
     }
 }
Beispiel #3
0
 /**
  * Contructor
  *
  * @access	public
  * @return	null
  */
 public function __construct()
 {
     parent::__construct();
     // --------------------------------------------
     //  Module Actions
     // --------------------------------------------
     $this->module_actions = array('permissions_json');
     // --------------------------------------------
     //  Extension Hooks
     // --------------------------------------------
     $this->default_settings = array();
     $default = array('class' => $this->extension_name, 'settings' => '', 'priority' => 10, 'version' => CALENDAR_VERSION, 'enabled' => 'y');
     $this->hooks = array(array_merge($default, array('method' => 'delete_entries_loop', 'hook' => 'delete_entries_loop')), array_merge($default, array('method' => 'entry_submission_end', 'hook' => 'entry_submission_end')), array_merge($default, array('method' => 'cp_js_end', 'hook' => 'cp_js_end')), array_merge($default, array('method' => 'edit_entries_additional_where', 'hook' => 'edit_entries_additional_where')), array_merge($default, array('method' => 'update_multi_entries_start', 'hook' => 'update_multi_entries_start')), array_merge($default, array('method' => 'delete_entries_start', 'hook' => 'delete_entries_start')));
 }
Beispiel #4
0
 /**
  * Constructor
  *
  * @access	public
  * @return	null
  */
 public function __construct($updated = FALSE)
 {
     parent::__construct();
     // -------------------------------------
     //  First day of the week
     // -------------------------------------
     if ($this->preference('first_day_of_week') !== FALSE) {
         $this->first_day_of_week = $this->preference('first_day_of_week');
     }
     $this->actions();
     if (!defined('CALENDAR_CALENDARS_CHANNEL_NAME')) {
         define('CALENDAR_CALENDARS_CHANNEL_NAME', $this->actions->calendar_channel_shortname());
         define('CALENDAR_EVENTS_CHANNEL_NAME', $this->actions->event_channel_shortname());
     }
 }
 /**
  * Constructor
  *
  * @access	public
  * @return	null
  */
 public function __construct($updated = FALSE)
 {
     parent::Module_builder_calendar('calendar');
     // -------------------------------------
     //  Module Installed and Up to Date?
     // -------------------------------------
     if ($updated === FALSE and ($this->database_version() == FALSE or $this->version_compare($this->database_version(), '<', CALENDAR_VERSION) or !$this->extensions_enabled())) {
         $this->disabled = TRUE;
         trigger_error(lang('calendar_module_disabled'), E_USER_NOTICE);
     }
     // -------------------------------------
     //  First day of the week
     // -------------------------------------
     if ($this->preference('first_day_of_week') !== FALSE) {
         $this->first_day_of_week = $this->preference('first_day_of_week');
     }
     $this->actions();
     if (!defined('CALENDAR_CALENDARS_CHANNEL_NAME')) {
         define('CALENDAR_CALENDARS_CHANNEL_NAME', $this->actions->calendar_channel_shortname());
         define('CALENDAR_EVENTS_CHANNEL_NAME', $this->actions->event_channel_shortname());
     }
 }
 /**
  * Constructor
  *
  * @access	public
  * @param	bool		Enable calling of methods based on URI string
  * @return	string
  */
 public function __construct($switch = TRUE)
 {
     parent::__construct();
     if ((bool) $switch === FALSE) {
         return;
     }
     // Install or Uninstall Request
     // -------------------------------------
     //  We need our actions
     // -------------------------------------
     $this->actions();
     if (!defined('CALENDAR_CALENDARS_CHANNEL_NAME')) {
         define('CALENDAR_CALENDARS_CHANNEL_NAME', $this->actions->calendar_channel_shortname());
         define('CALENDAR_EVENTS_CHANNEL_NAME', $this->actions->event_channel_shortname());
     }
     // --------------------------------------------
     //  Module Menu Items
     // --------------------------------------------
     $menu = array('view_calendars' => array('link' => $this->base . AMP . 'method=view_calendars', 'title' => lang('calendars')), 'view_events' => array('link' => $this->base . AMP . 'method=view_events', 'title' => lang('events')), 'permissions' => array('link' => $this->base . AMP . 'method=permissions', 'title' => lang('permissions')), 'preferences' => array('link' => $this->base . AMP . 'method=view_preferences', 'title' => lang('preferences')), 'module_documentation' => array('link' => CALENDAR_DOCS_URL, 'title' => lang('online_documentation') . (APP_VER < 2.0 ? ' (' . CALENDAR_VERSION . ')' : ''), 'new_window' => TRUE));
     //no permissions for you!
     if (APP_VER < 2.0) {
         unset($menu['permissions']);
     }
     $this->cached_vars['lang_module_version'] = lang('calendar_module_version');
     $this->cached_vars['module_version'] = CALENDAR_VERSION;
     $this->cached_vars['module_menu_highlight'] = 'view_calendars';
     $this->cached_vars['module_menu'] = $menu;
     //needed for header.html file views
     $this->cached_vars['js_magic_checkboxes'] = $this->js_magic_checkboxes();
     // --------------------------------------------
     //  Sites
     // --------------------------------------------
     $this->cached_vars['sites'] = array();
     foreach ($this->data->get_sites() as $site_id => $site_label) {
         $this->cached_vars['sites'][$site_id] = $site_label;
     }
     // -------------------------------------
     //  We need our actions
     // -------------------------------------
     $this->actions();
     // -------------------------------------
     //  Module Installed and What Version?
     //	added an extensions test
     // -------------------------------------
     $updated = FALSE;
     if ($this->database_version() == FALSE) {
         return;
     } elseif ($this->version_compare($this->database_version(), '<', CALENDAR_VERSION) or !$this->extensions_enabled()) {
         if (APP_VER < 2.0) {
             if ($this->calendar_module_update() === FALSE) {
                 return;
             }
         } else {
             // For EE 2.x, we need to redirect the request to Update Routine
             $_GET['method'] = 'calendar_module_update';
         }
         $updated = TRUE;
     }
     // -------------------------------------
     //  Grab the MOD file and related goodies
     // -------------------------------------
     if (!class_exists('Calendar')) {
         require_once CALENDAR_PATH . 'mod.calendar' . EXT;
     }
     $this->CAL = new Calendar($updated);
     $this->CAL->load_calendar_datetime();
     // -------------------------------------
     //  Request and View Builder
     // -------------------------------------
     if (APP_VER < 2.0 and $switch !== FALSE) {
         if (ee()->input->get('method') === FALSE) {
             $this->index();
         } elseif (!method_exists($this, ee()->input->get('method'))) {
             $this->add_crumb(lang('invalid_request'));
             $this->cached_vars['error_message'] = lang('invalid_request');
             return $this->ee_cp_view('error_page.html');
         } else {
             $this->{ee()->input->get('method')}();
         }
     }
 }