@link http://blog.idleman.fr @licence CC by nc sa @version 1.0.0 @type component @description Modele de plugin pour les modules */ include('Room.class.php'); function room_plugin_page($_){ if(isset($_['module']) && $_['module']=='room'){ $roomManager = new Room(); $rooms = $roomManager->loadAll(array('state'=>'0')); //if (!isset($_['id']) && count($rooms)>0) $_['id'] = $rooms[0]->getId(); $currentRoom = new Room(); ?>
getId()!=0){ Plugin::callHook("node_display", array($currentRoom)); } else { foreach($rooms as $room){ Plugin::callHook("node_display", array($room)); } } ?>
Pièces'; } function room_plugin_setting_page(){ global $myUser,$_; if(isset($_['section']) && $_['section']=='room' ){ if($myUser!=false){ $roomManager = new Room(); $rooms = $roomManager->loadAll(array('state'=>'0')); //Gestion des modifications if (isset($_['id'])){ $id_mod = $_['id']; $selected = $roomManager->getById($id_mod); $description = $selected->GetName(); $button = "Modifier"; } else { $description = "Ajout d'une pièce"; $button = "Ajouter"; } ?>

Pièces

Gestion des pièces

';} ?>


Nom Description
getName(); ?> getDescription(); ?>

Vous devez être connecté

loadRight(); switch($_['action']){ case 'room_add_room': $right_toverify = isset($_['id']) ? 'u' : 'c'; if($myUser->can('room',$right_toverify)){ $room = new Room(); if ($right_toverify == "u"){$room = $room->load(array("id"=>$_['id']));} $room->setName(ucfirst(strtolower($_['nameRoom']))); $room->setDescription(ucfirst(strtolower($_['descriptionRoom']))); $room->state=0; $room->save(); header('location:setting.php?section=room'); } else { header('location:setting.php?section=room&error=Vous n\'avez pas le droit de faire ça!'); } break; case 'room_delete_room': if($myUser->can('room','d')){ $roomManager = new Room(); $room = $roomManager->getById($_['id']); $room->state= -1; $room->save(); header('location:setting.php?section=room'); } else { header('location:setting.php?section=room&error=Vous n\'avez pas le droit de faire ça!'); } break; } } Plugin::addCss("/css/style.css"); Plugin::addHook("setting_menu", "room_plugin_setting_menu"); Plugin::addHook("setting_bloc", "room_plugin_setting_page"); Plugin::addHook("action_post_case", "room_action_room"); Plugin::addHook("home", "room_plugin_page"); ?>