Ejemplo n.º 1
0
 public function messages($id)
 {
     $ticket = DAO::getOne("Ticket", $id[0]);
     if ($ticket != NULL) {
         echo "<h2>" . $ticket . "</h2>";
         $messages = DAO::getOneToMany($ticket, "messages");
         echo "<table class='table table-striped'>";
         echo "<thead><tr><th>Messages</th></tr></thead>";
         echo "<tbody>";
         foreach ($messages as $msg) {
             echo "<tr>";
             echo "<td title='message' data-content='" . htmlentities($msg->getContenu()) . "' data-container='body' data-toggle='popover' data-placement='bottom'>" . $msg->toString() . "</td>";
             echo "</tr>";
         }
         echo "</tbody>";
         echo "</table>";
         echo Jquery::execute("\$(function () {\n\t\t\t\t\t  \$('[data-toggle=\"popover\"]').popover({'trigger':'hover','html':true})\n\t\t\t\t})");
     }
 }
Ejemplo n.º 2
0
	public function frm($id=NULL){
		$ticket=$this->getInstance($id);
		if ($ticket->getTitre() != "") {
			$notif = DAO::getOne("Notification", 'idUser = '******' AND idTicket = '.$ticket->getId());
			if ($notif != null) {
				DAO::delete($notif);
			}
		}
		
		//recuperer les message associé au ticket
		DAO::getOneToMany($ticket,"messages");
		$messages=$ticket->getMessages();
		foreach ($messages as $message){
			$message->setUser(DAO::getAll("User", "id=".$message->getUser()->getId())[0]);
		}

		//recuperer la ou les catégorie(s) du ticket
		$categories=DAO::getAll("Categorie");
		if($ticket->getCategorie()==null){
			$cat=-1;
		}else{
			$cat=$ticket->getCategorie()->getId();
		}
		
		//permet la séléction d'une catégorie
		$listCat=Gui::select($categories,$cat,"Sélectionner une catégorie ...");
		$listType=Gui::select(array("demande","incident"),$ticket->getType(),"Sélectionner un type ...");

		//affiche la vue vAdd du ticket
		$this->loadView("ticket/vAdd",array("ticket"=>$ticket,"listCat"=>$listCat,"listType"=>$listType));
		//affiche la vue permettant l'affichage des information du ticket
		$this->loadView("ticket/vInfoTicket",array("ticket"=>$ticket,"listCat"=>$listCat,"listType"=>$listType));
		
		//div contenant les messages
		echo "<div class='container contentMessages'>";
		//charge les messages et les affiches
		$this->loadView("ticket/vMessage",array("messages"=>$messages, "ticket" => $ticket));
		//instancie CKEditor
		echo Jquery::executeOn('.submitMessage', "click", "
			for ( instance in CKEDITOR.instances )
        		CKEDITOR.instances[instance].updateElement();
		");
		//lors du clic sur le bouton submitMessage, éxécute l'update du message et l'affiche
		echo Jquery::postFormOn("click",".submitMessage","Messages/update","frm",".contentMessages");

		if($ticket->getTitre() != "") echo Jquery::execute("$('.panel-body.infoTicket').hide();");
		echo "</div>";
		
		echo Jquery::executeOn(".montreInfoTicket","click", 
				"$('.montreInfoTicket').toggleClass('glyphicon-chevron-up');
				$('.montreInfoTicket').toggleClass('glyphicon-chevron-down');
				$('.panel-body.infoTicket').slideToggle('slow');");
	}