Exemple #1
0
 public static function &get_instance()
 {
     // Create class instance if required
     if (!isset(self::$instance)) {
         self::$instance = new EL_Filterbar();
     }
     // Return class instance
     return self::$instance;
 }
Exemple #2
0
 public function __construct()
 {
     $this->db =& EL_Db::get_instance();
     $this->categories =& EL_Categories::get_instance();
     $this->filterbar =& EL_Filterbar::get_instance();
     $this->set_args();
     global $status, $page;
     //Set parent defaults
     parent::__construct(array('singular' => 'event', 'plural' => 'events', 'ajax' => false));
 }
Exemple #3
0
 private function __construct()
 {
     $this->db =& EL_Db::get_instance();
     $this->filterbar =& EL_Filterbar::get_instance();
     $this->event_table = new EL_Event_Table();
     $this->action = $this->event_table->current_action();
     // check for real actions
     if ($this->action) {
         switch ($this->action) {
             // real actions (redirect when finished)
             case 'new':
                 if (!empty($_POST)) {
                     $id = $this->update_event($_POST);
                     $error = !$id;
                     $this->redirect('added', $error, array('title' => urlencode($_POST['title']), 'id' => $id));
                 }
             case 'edited':
                 if (!empty($_POST)) {
                     $error = !$this->update_event($_POST);
                     $this->redirect('modified', $error, array('title' => urlencode($_POST['title']), 'id' => $_POST['id']));
                 }
                 break;
             case 'delete':
                 if (isset($_GET['id'])) {
                     $error = !$this->db->delete_events(explode(',', $_GET['id']));
                     $this->redirect('deleted', $error, array('id' => $_GET['id']));
                 }
                 break;
                 // proceed with header if a bulk action was triggered (required due to "noheader" attribute for all action above)
             // proceed with header if a bulk action was triggered (required due to "noheader" attribute for all action above)
             case 'delete_bulk':
                 require_once ABSPATH . 'wp-admin/admin-header.php';
         }
     }
     // cleanup query args when filter button was pressed
     if (isset($_GET['filter'])) {
         $this->redirect();
     }
 }
Exemple #4
0
 private function html_filterbar(&$a)
 {
     if (!$this->is_visible($a['show_filterbar'])) {
         return '';
     }
     require_once EL_PATH . 'includes/filterbar.php';
     $filterbar = EL_Filterbar::get_instance();
     return $filterbar->show($this->get_url($a), $a);
 }