/** * Update last post * @param (int) topic ID *required * @param (array) data */ public function updateLastPost($topic_id = null, $data = null) { if (empty($data)) { App::import('Contoller', 'Forum'); $forum = new ForumController(); $this->ForumPost->unbindModel(array('belongsTo' => array('Topic', 'Forum'))); $t = $this->ForumPost->find('first', array('conditions' => array('ForumPost.forum_topic_id' => $topic_id), 'order' => 'ForumPost.created DESC', 'recursive' => 1)); $this->recursive = -1; $post = $this->read('replies', $topic_id); $data = array('last_post_id' => $t['ForumPost']['id'], 'last_post_page' => $forum->getLastPageNumber($topic_id, $post), 'last_post_created' => $t['ForumPost']['created'], 'last_post_user_id' => $t['User']['id'], 'last_post_username' => $t['User']['username']); } $this->id = $topic_id; $this->save($data, false); }
if (empty($action)) { $cont->accueilAction(); } else { if (strcmp($action, "telechargement") == 0) { $cont->telechargementAction(); } } } else { if (strcmp($controller, "profil") == 0) { $cont = new ProfilController(); if (empty($action)) { $cont->indexAction(); } } else { if (strcmp($controller, "forum") == 0) { $cont = new ForumController(); if (empty($action)) { $cont->indexAction(); } } else { if (strcmp($controller, "cours") == 0) { $cont = new CoursController(); if (empty($action)) { $cont->indexAction(); } } else { if (strcmp($controller, "evaluations") == 0) { $cont = new EvaluationsController(); if (empty($action)) { $cont->indexAction(); }
}); $routes->get('/groups/:group_id/edit', function ($group_id) { GroupController::edit($group_id); }); $routes->post('/groups/:group_id/edit', function ($group_id) { GroupController::update($group_id); }); $routes->post('/groups/:group_id/expel/:user_id', function ($group_id, $user_id) { GroupController::expel($group_id, $user_id); }); $routes->post('/groups/:group_id/invite', function ($group_id) { GroupController::invite($group_id); }); $routes->post('/groups/:group_id/delete', function ($group_id) { GroupController::destroy($group_id); }); $routes->get('/topics/:topic_id', function ($topic_id) { ForumController::topic($topic_id); }); $routes->post('/topics/:topic_id/', function ($topic_id) { MessageController::store($topic_id); }); $routes->get('/topics/:topic_id/:message_id/edit', function ($topic_id, $message_id) { MessageController::edit($message_id, $topic_id); }); $routes->post('/topics/:topic_id/:message_id/edit', function ($topic_id, $message_id) { MessageController::update($message_id, $topic_id); }); $routes->post('/topics/:topic_id/:message_id/delete', function ($topic_id, $message_id) { MessageController::delete($message_id, $topic_id); });