Example #1
0
 function process()
 {
     global $CONFIG;
     $query_args = array('_order' => 'e.type,e.open,e.close,e.registration_id');
     $season_id = $_GET['season'];
     if ($season_id > 0) {
         $current_season = Season::load(array('id' => $season_id));
         $query_args['season_id'] = $season_id;
         $this->title = "{$current_season->display_name} Registration";
     } else {
         $this->title = "Registration";
         $query_args['_extra'] = 'e.open < DATE_ADD(NOW(), INTERVAL 1 WEEK) AND e.close > NOW()';
         $season_id = -1;
     }
     $this->template_name = 'pages/event/list.tpl';
     $pulldown_choices = getOptionsFromQuery("SELECT s.id AS theKey, s.display_name AS theValue FROM season s, registration_events e WHERE e.season_id = s.id GROUP BY s.id HAVING count(*) > 0 ORDER BY s.year, s.season");
     $pulldown_choices[-1] = "All open events";
     $this->smarty->assign('seasons', $pulldown_choices);
     $this->smarty->assign('season_id', $season_id);
     $type_desc = event_types();
     $events = array();
     $sth = Event::query($query_args);
     while ($e = $sth->fetchObject('Event')) {
         $e->full_type = $type_desc[$e->type];
         $events[] = $e;
     }
     $this->smarty->assign('events', $events);
     return true;
 }
 /**
  * /
  * @param  [type] $id [description]
  * @return [type]     [description]
  */
 public function showEvent($id)
 {
     $result = Event::query($this->db, 'showPublished', $id);
     if ($result->isSuccessful()) {
         $this->renderArray['content'] = $result->getRecords();
     }
 }
Example #3
0
 /**
  * /
  * @param  [type] $app [description]
  * @return [type]      [description]
  */
 public function route($app)
 {
     $app->view->setLayout($layout);
     $app->get('/tag/:tag', function ($tag) use($app) {
     })->name('tag')->conditions(array('' => ''));
     $app->get('/', function () use($app) {
         $result = Content::query($app->db, 'findPublished');
         $app->view->setData($result);
         $app->view->render('');
     })->name('home');
     $app->get('/perfil', function () use($app) {
         $result = User::query($app->db, 'show', $app->sessionDataStore->getUserId());
         $app->view->setData($result);
         $app->view->render('');
     })->name('perfil');
     $app->get('/perfil/editar', function () use($app) {
         $app->view->setData($result);
         $app->view->render('');
     })->name('salvar_perfil');
     $app->post('/perfil/salvar', function () use($app) {
         $record = $app->handler->handlePostRequest();
         $app->redirect($app->urlFor(''));
     })->name('salvar_perfil');
     $app->post('/comentar', function () use($app) {
         $record = $app->handler->handlePostRequest();
         $app->redirect($app->urlFor(''));
     })->name('comentar');
     $app->get('/programacao(/:pagina)', function ($pagina = 1) use($app) {
         $result = Event::query($app->db, 'findPublished', $pagina);
         $app->view->setData($result);
         $app->view->render('');
     })->name('programacao')->conditions(array('' => ''));
     $app->get('/evento/:slug/:id', function ($slug, $id) use($app) {
         $result = Event::query($app->db, 'showPublished', $id);
         $app->view->setData($result);
         $app->view->render('');
     })->name('evento')->conditions(array('' => ''));
     $app->get('/espacos(/:pagina)', function ($pagina = 1) use($app) {
         $result = Content::query($app->db, 'findPublished', $pagina);
         $app->view->setData($result);
         $app->view->render('');
     })->name('espacos')->conditions(array('' => ''));
     $app->get('/espaco/:slug/:id', function ($slug, $id) use($app) {
         $result = Content::query($app->db, 'showPublished', $id);
         $app->view->setData($result);
         $app->view->render('');
     })->name('espaco')->conditions(array('' => ''));
     $app->get('/galerias(/:pagina)', function ($pagina = 1) use($app) {
         $result = Content::query($app->db, 'findPublished', $pagina);
         $app->view->setData($result);
         $app->view->render('');
     })->name('galerias')->conditions(array('' => ''));
     $app->get('/galeria/:slug/:id', function ($slug, $id) use($app) {
         $result = Content::query($app->db, 'showPublished', $id);
         $app->view->setData($result);
         $app->view->render('');
     })->name('galeria')->conditions(array('' => ''));
     $app->get('/revista(/:pagina)', function ($pagina = 1) use($app) {
         $result = Content::query($app->db, 'findPublished', $pagina);
         $app->view->setData($result);
         $app->view->render('');
     })->name('revista')->conditions(array('' => ''));
     $app->get('/materia/:slug/:id', function ($slug, $id) use($app) {
         $result = Content::query($app->db, 'showPublished', $id);
         $app->view->setData($result);
         $app->view->render('');
     })->name('materia')->conditions(array('' => ''));
     $app->get('/notas(/:pagina)', function ($pagina = 1) use($app) {
         $result = Content::query($app->db, 'findPublished', $pagina);
         $app->view->setData($result);
         $app->view->render('');
     })->name('notas')->conditions(array('' => ''));
     $app->get('/secao/:slug/:id', function ($id) use($app) {
         $result = Content::query($app->db, 'showPublished', $id);
         $app->view->setData($result);
         $app->view->render('');
     })->name('nota')->conditions(array('' => ''));
     $app->get('/equipe', function () use($app) {
         $result = Equipe::query($app->db, 'findPublished', $pagina);
         $app->view->setData($result);
         $app->view->render('');
     })->name('equipe');
     $app->get('/consultas(/:pagina)', function ($pagina = 1) use($app) {
         $result = ConsultaPublica::query($app->db, 'findPublished', $pagina);
         $app->view->setData($result);
         $app->view->render('');
     })->name('consultas')->conditions(array('' => ''));
     $app->get('/consulta/:id', function ($id) use($app) {
         $result = ConsultaPublica::query($app->db, 'showPublished', $id);
         $app->view->setData($result);
         $app->view->render('');
     })->name('consulta')->conditions(array('' => ''));
     $app->get('/editais(/:pagina)', function ($pagina = 1) use($app) {
         $result = Edital::query($app->db, 'findPublished', $pagina);
         $app->view->setData($result);
         $app->view->render('');
     })->name('editais')->conditions(array('' => ''));
     $app->get('/edital/:id', function ($id) use($app) {
         $result = Edital::query($app->db, 'showPublished', $id);
         $app->view->setData($result);
         $app->view->render('');
     })->name('edital')->conditions(array('' => ''));
     $app->get('/projetos(/:pagina)', function ($pagina = 1) use($app) {
         $result = Content::query($app->db, 'findPublished', $pagina);
         $app->view->setData($result);
         $app->view->render('');
     })->name('projetos')->conditions(array('' => ''));
     $app->get('/projeto/:id', function ($id) use($app) {
         $result = Content::query($app->db, 'showPublished', $id);
         $app->view->setData($result);
         $app->view->render('');
     })->name('projeto')->conditions(array('' => ''));
     $app->get('/leis(/:pagina)', function ($pagina = 1) use($app) {
         $result = LeiIncentivo::query($app->db, 'findPublished', $pagina);
         $app->view->setData($result);
         $app->view->render('');
     })->name('leis')->conditions(array('' => ''));
     $app->get('/lei/:id', function ($id) use($app) {
         $result = LeiIncentivo::query($app->db, 'showPublished', $id);
         $app->view->setData($result);
         $app->view->render('');
     })->name('lei')->conditions(array('id' => '\\d+'));
     return $app;
 }
 public function v152()
 {
     // Regenerate cache
     Cache::clear(false);
     // Timezone
     $this->Setting->setOption('timezone', 'Europe/Paris');
     // Update events registration end date
     App::uses('Event', 'Model');
     $EventModel = new Event();
     $params = array();
     $params['recursive'] = -1;
     $params['fields'] = array('id', 'time_start', 'time_inscription');
     $params['conditions']['time_inscription'] = null;
     if ($events = $EventModel->find('all', $params)) {
         foreach ($events as $event) {
             $EventModel->query("UPDATE " . $EventModel->tablePrefix . "events SET time_inscription='" . $event['Event']['time_start'] . "' WHERE id = " . $event['Event']['id']);
         }
     }
 }
Example #5
0
 public function patchNeeded()
 {
     // bĂȘta 2
     $sql = "SELECT * FROM information_schema.COLUMNS WHERE TABLE_SCHEMA=DATABASE() AND COLUMN_NAME='default_role_id' AND TABLE_NAME='" . Configure::read('Database.prefix') . "characters'";
     if (!$this->controller->Character->query($sql)) {
         return $this->redirectToPatch('/admin/patcher/apply/beta-2');
     }
     // bĂȘta 3
     $sql = "SELECT * FROM information_schema.COLUMNS WHERE TABLE_SCHEMA=DATABASE() AND COLUMN_NAME='status' AND TABLE_NAME='" . Configure::read('Database.prefix') . "dungeons'";
     if (!$this->controller->User->query($sql)) {
         return $this->redirectToPatch('/admin/patcher/apply/beta-3');
     }
     // v1.1
     $sql = "SELECT * FROM information_schema.COLUMNS WHERE TABLE_SCHEMA=DATABASE() AND COLUMN_NAME='status' AND TABLE_NAME='" . Configure::read('Database.prefix') . "characters'";
     if (!$this->controller->User->query($sql)) {
         return $this->redirectToPatch('/admin/patcher/apply/v-1.1');
     }
     // v1.3
     $sql = "SELECT * FROM information_schema.COLUMNS WHERE TABLE_SCHEMA=DATABASE() AND COLUMN_NAME='bridge' AND TABLE_NAME='" . Configure::read('Database.prefix') . "users'";
     if (!$this->controller->User->query($sql)) {
         return $this->redirectToPatch('/admin/patcher/apply/v-1.3');
     }
     // v1.3.5
     App::uses('EventsTemplate', 'Model');
     $EventsTemplate = new EventsTemplate();
     $sql = "SELECT * FROM information_schema.COLUMNS WHERE TABLE_SCHEMA=DATABASE() AND COLUMN_NAME='time_invitation' AND TABLE_NAME='" . Configure::read('Database.prefix') . "events_templates'";
     if (!$EventsTemplate->query($sql)) {
         return $this->redirectToPatch('/admin/patcher/apply/v-1.3.5');
     }
     // v1.4
     App::uses('RaidsRole', 'Model');
     $RaidsRole = new RaidsRole();
     $sql = "SELECT * FROM information_schema.COLUMNS WHERE TABLE_SCHEMA=DATABASE() AND COLUMN_NAME='order' AND TABLE_NAME='" . Configure::read('Database.prefix') . "raids_roles'";
     if (!$RaidsRole->query($sql)) {
         return $this->redirectToPatch('/admin/patcher/apply/v-1.4');
     }
     // v1.4.1
     App::uses('EventsCharacter', 'Model');
     $EventsCharacter = new EventsCharacter();
     $sql = "SELECT * FROM information_schema.COLUMNS WHERE TABLE_SCHEMA=DATABASE() AND COLUMN_NAME='last_notification' AND TABLE_NAME='" . Configure::read('Database.prefix') . "events_characters'";
     if (!$EventsCharacter->query($sql)) {
         return $this->redirectToPatch('/admin/patcher/apply/v-1.4.1');
     }
     // v1.5
     App::uses('Event', 'Model');
     $Event = new Event();
     $sql = "SELECT * FROM information_schema.COLUMNS WHERE TABLE_SCHEMA=DATABASE() AND COLUMN_NAME='open' AND TABLE_NAME='" . Configure::read('Database.prefix') . "events'";
     if (!$Event->query($sql)) {
         return $this->redirectToPatch('/admin/patcher/apply/v-1.5');
     }
     // v1.5.2
     App::uses('Event', 'Model');
     $Event = new Event();
     $sql = "SELECT * FROM information_schema.COLUMNS WHERE TABLE_SCHEMA=DATABASE() AND COLUMN_NAME='time_inscription' AND TABLE_NAME='" . Configure::read('Database.prefix') . "events'";
     if (!$Event->query($sql)) {
         return $this->redirectToPatch('/admin/patcher/apply/v-1.5.2');
     }
     // v1.6
     App::uses('User', 'Model');
     $User = new User();
     $sql = "SELECT * FROM information_schema.COLUMNS WHERE TABLE_SCHEMA=DATABASE() AND COLUMN_NAME='calendar_key' AND TABLE_NAME='" . Configure::read('Database.prefix') . "users'";
     if (!$User->query($sql)) {
         return $this->redirectToPatch('/admin/patcher/apply/v-1.6');
     }
     // v1.6.2
     App::uses('Setting', 'Model');
     $SettingModel = new Setting();
     $notifications = json_decode($SettingModel->getOption('notifications'), true);
     if (!isset($notifications['comments'])) {
         return $this->redirectToPatch('/admin/patcher/apply/v-1.6.2');
     }
 }