Ejemplo n.º 1
0
 public function updateTitre()
 {
     if (RequestUtils::isPost()) {
         $faq = DAO::getOne("Faq", $_POST["id"]);
         $faq->setTitre($_POST["titre"]);
         if (DAO::update($faq)) {
             $this->messageInfo($faq . " modifié", "5000");
             Jquery::get("sample/liste", "#liste");
             Jquery::doJquery(".alert", "hide", "3000");
             echo Jquery::compile();
         }
     }
 }
Ejemplo n.º 2
0
 public function frm($id = NULL)
 {
     $ticket = $this->getInstance($id);
     $categories = DAO::getAll("Categorie");
     if ($ticket->getCategorie() == null) {
         $cat = -1;
     } else {
         $cat = $ticket->getCategorie()->getId();
     }
     $listCat = Gui::select($categories, $cat, "Sélectionner une catégorie ...");
     $listType = Gui::select(array("demande", "intervention"), $ticket->getType(), "Sélectionner un type ...");
     $this->loadView("ticket/vAdd", array("ticket" => $ticket, "listCat" => $listCat, "listType" => $listType));
     echo Jquery::execute("CKEDITOR.replace( 'description');");
 }
Ejemplo n.º 3
0
	public function resetPassword($id){
		$token = DAO::getOne('Token', "token = '".$id[0]."'");
		
		if ($token == null) {
			$this->_showMessage("Impossible de réintialiser le mot de passe, le token n'est peut-être plus valide...", 'warning');
			return;
		}

		$_SESSION['resetPass'] = array('idUser' => $token->getUser()->getId(), "token" => $token->getToken());
		$this->loadView("main/vHeader",array("infoUser"=>Auth::getInfoUser()));
		$this->loadView("pass/vResetPass");
		$this->loadView("main/vFooter");
		echo Jquery::postFormOn('click', '#submitLogin', "Support/updatePass", "'#loginForm'", "#answer");

	}
Ejemplo n.º 4
0
	public function update(){
		if(RequestUtils::isPost()){
			parent::updateNotForward();

			$ticket = DAO::getOne("Ticket",$_POST['idTicket']);
			$messages = DAO::getAll("Message", 'idTicket = '.$_POST['idTicket']);

			$users = array();
			foreach ($messages as $message) {
				$user = $message->getUser()->getId();
				if (!in_array($user, $users) && $user != Auth::getUser()->getId() ) {
					array_push($users, $message->getUser()->getId());
				}
				$message->setUser(DAO::getAll("User", "id=".$message->getUser()->getId())[0]);
			}
			
			$message = DAO::getOne("Message", "idUser="******" ORDER BY date DESC");

			foreach ($users as $user) {
				if (DAO::getOne("Notification", 'idUser = '******' AND idTicket = '.$ticket->getId()) == null) {
					$user = DAO::getOne("User", $user);
					$notif = new Notification();
					$notif->setUser($user);
					$notif->setTicket($ticket);
					$notif->setMessage($message);
					DAO::insert($notif);
				}
			}


			$this->loadView("ticket/vMessage",array("messages"=>$messages, "ticket" => $ticket));
			Jquery::execute("CKEDITOR.replace('contenu');");
			Jquery::executeOn('.submitMessage', "click", "
			for ( instance in CKEDITOR.instances )
        		CKEDITOR.instances[instance].updateElement();
			");
			Jquery::postFormOn("click",".submitMessage","messages/update","frm",".contentMessages");
			echo Jquery::compile();
			
		}
	}
Ejemplo n.º 5
0
	public function signin_with_hybridauth($provider) {
		global $config;
		$authConfig=ROOT."configHybrid.php";
		include ROOT."./../vendor/hybridauth/hybridauth/hybridauth/Hybrid/Auth.php";

		$hybridauth=new Hybrid_Auth($authConfig);
		$adapter=$hybridauth->authenticate($provider[0]);
		$user_profile=$adapter->getUserProfile();

		$dbProvider=DAO::getOne("AuthProvider", array (
				"name" => $provider[0]
		));
		if ($dbProvider!=NULL) {
			$user=DAO::getOne("User", array (
					"login" => $user_profile->displayName,"idAuthProvider" => $dbProvider->getId()
			));
			if ($user===null) {
				$user=new User();
				$user->setLogin($user_profile->displayName);
				$user->setMail($user_profile->email);
				$user->setGroupe(DAO::getOne("Groupe", "id=2"));
				$user->setAuthProvider($dbProvider);
				$user->setKey($user_profile->identifier);
				DAO::insert($user);
			}
			$_SESSION["user"]=$user;
			setcookie("autoConnect", $provider[0], time()+3600, "/");
			if (array_key_exists("action", $_SESSION)) {
				Startup::runAction($_SESSION["action"], false, false);
				unset($_SESSION["action"]);
			} else {
				echo '<h3>Connecté à '.$dbProvider->getName().'</h3>';
				echo '<h4>'.$user->getLogin().'</h4>';
				echo '<div class="row"><div class="col-xs-6 col-md-3"><img style="width: 230px;height:230px;border-radius: 6px;" src="'.$user_profile->photoURL.'&s=460" alt="avatar" width="230" height="230"></div></div>';
			}
			echo "<div id='divInfoUser'></div>";
			echo Jquery::get("Indexx/getInfoUser/", "#divInfoUser");
			header("Location: ".$config['siteUrl']."/Indexx");
		}
	}
 public function frm($id = NULL)
 {
     $ticket = $this->getInstance($id);
     $categories = DAO::getAll("Categorie");
     $statut = DAO::getAll("Statut");
     if ($ticket->getCategorie() == null) {
         $cat = -1;
         $stat = -1;
     } else {
         $cat = $ticket->getCategorie()->getId();
         $stat = $ticket->getStatut()->getId();
     }
     $listCat = Gui::select($categories, $cat, "Sélectionner une catégorie ...");
     $listStatut = Gui::select($statut, $stat, "Sélectionner un statut ...");
     $listType = Gui::select(array("demande", "intervention"), $ticket->getType(), "Sélectionner un type ...");
     $stat = $ticket->getStatut()->getId();
     $this->loadView("ticket/vAdd", array("ticket" => $ticket, "listCat" => $listCat, "listType" => $listType, "statut" => $statut, "listStatut" => $listStatut));
     echo Jquery::execute("CKEDITOR.replace( 'description');");
     //updteticket
     //s$statutUpdate='coucou1';
     /* '<select class="form-control" class="idStatut" name="idStatut"><br>$listStatut<br></select>'; */
 }
Ejemplo n.º 7
0
 public function ajaxSample()
 {
     echo $this->messageInfo("Cocher la case pour désactiver un utilisateur.<br>Cliquer sur une ligne pour modifier l'utilisateur associé." . "<div><label>Utilisateurs à désactiver : <input type='number' class='form-control' id='nb' value='0'></label></div>");
     echo $this->_showMessage("La condition de sortie n'est pas satisfaite !", "danger", 0, false, false);
     $users = DAO::getAll("User");
     echo '<form id="frmUsers"><ul class="list-group">';
     foreach ($users as $u) {
         echo '<li class="list-group-item" id="' . $u->getId() . '"><input type="checkbox" class="ck" name="user[]" id="user-' . $u->getId() . '">&nbsp;' . $u->toString() . "</li>";
     }
     echo "<li class='list-group-item list-group-item-info' id='divCount'><input type='hidden' id='res' value='0'>Aucun utilisateur désactivé</li>";
     echo "</ul></form>";
     echo "<button id='btClose' class='btn btn-primary'>Fermer</button>";
     Jquery::bindMethods(true, false);
     Jquery::getOn("click", ".list-group-item", "users/frm", "#response");
     Jquery::doJqueryOn(".ck", "click", "\$(event.target).parent()", "toggleClass", array("disabled", "\$(event.target).prop('checked')"));
     Jquery::postFormOn("click", ".ck", "sample/ajaxCount", "frmUsers", "#divCount");
     Jquery::doJqueryOn(".list-group-item", "mouseenter", "this", "addClass", array("active"));
     Jquery::doJqueryOn(".list-group-item", "mouseout", "this", "removeClass", "active");
     Jquery::startCondition("\$('#nb').val()==\$('#res').val()", "\$('.alert-danger').show();");
     Jquery::doJqueryOn("#btClose", "click", "#response", "html", "", Jquery::_doJquery("#main", "show"));
     Jquery::doJquery("#main", "hide");
     echo Jquery::compile();
 }
Ejemplo n.º 8
0
 public function frm($id = NULL)
 {
     if (Auth::isAdmin()) {
         $faq = $this->getInstance($id);
         $categories = DAO::getAll("Categorie");
         if ($faq->getCategorie() == null) {
             $cat = -1;
         } else {
             $cat = $faq->getCategorie()->getId();
         }
         $listCat = Gui::select($categories, $cat, "Sélectionner une catégorie ...");
         if (isset($id)) {
             $ajou_modif = "Modifier";
             $this->loadView("faq/vUpdateTitre", array("faq" => $faq, "ajou_modif" => $ajou_modif, "idCategorie" => $cat, "listCat" => $listCat));
         } else {
             $ajou_modif = "Ajouter";
             $this->loadView("faq/vUpdateTitre", array("faq" => $faq, "ajou_modif" => $ajou_modif, "idCategorie" => $cat, "listCat" => $listCat));
         }
     } else {
         echo "Vous devez vous connecter en tant qu'administrateur pour accéder à ce module";
     }
     echo Jquery::execute("CKEDITOR.replace( 'contenu');");
 }
Ejemplo n.º 9
0
$date = date("d-m-Y");
$heure = date("H:i");
?>
<form method="post" action="faqs/update">
	<fieldset>
		<legend>Ajouter</legend>
		<input name="id" type="hidden">
		<div class="form-group">
			<label>titre</label>
			<input name="titre" type="text" class="form-control">
		</div>
		<div class="form-group">
			<label>contenu</label>
			<?php 
echo "<textarea name='contenu' id='editor1'>Ecrivez votre article...</textarea>";
echo Jquery::execute("CKEDITOR.replace( 'editor1');");
?>
		</div>
		<div class="form-group">
			<label>date de creation</label>
			<input name="dateCreation" type="text" class="form-control" value="<?php 
echo $date . " " . $heure;
?>
" disabled>
		</div>
		<div class="form-group">
			<label>categorie</label>
			<select class="form-control" name="idCategorie">
				<?php 
echo $listCat;
?>
Ejemplo n.º 10
0
 /**
  * Désactive une condition activée avec l'option $persists à true
  */
 public static function endCondition()
 {
     Jquery::$condition = NULL;
     Jquery::$else = NULL;
     Jquery::$persists = false;
 }
Ejemplo n.º 11
0
	protected function listTickets(){
		$condition = $_SESSION['condition'];
		$tPerPage = $_SESSION['nbPerPage'];
		$page=$_SESSION['page'];
		$nbTickets = DAO::count($this->model, $condition);
		if ($condition == "") {
			$nCondition = "1 = 1";
		}else{
			$nCondition = $condition;
		}
		
		$min = (($page)*$tPerPage)-($tPerPage);
		$num = $tPerPage;
		if($min < 0){ 
			$min = 0;
		}
		$nCondition .= ' ORDER BY dateCreation ASC LIMIT '.$min.','. $num;
		$list=DAO::getAll($this->model, $nCondition);
		$this->loadView("ticket/vList", array("tickets" => $list, 'currPage' => $page, 'nbTickets' => $nbTickets));
		echo Jquery::getOn('click', '.chgList', 'Tickets/listFromJquery','#list');
		echo Jquery::getOn('click', '.updateStatut', 'Tickets/updateStatut', '#list');
	}
Ejemplo n.º 12
0
 	public function suspend($params){
 		$params = explode(";", $params[0]);
 		$faq = DAO::getOne($this->model, $params[0]);
 		$faq->setPublished($params[1]);
 		DAO::update($faq);
 		echo "<div class='test'></div>";
 		echo Jquery::postForm('Faqs/filter', 'searchForm', '.list');
 		
 	}
Ejemplo n.º 13
0
<?php

use micro\js\Jquery;
if (!isset($type)) {
    $type = "info";
}
$style = "";
if ($visible === false) {
    $style = 'style="display:none;"';
}
echo '<div class="alert alert-' . $type . '" ' . $style . '>';
if ($dismissable === true) {
    echo '<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>';
}
echo $message;
echo "</div>";
if (isset($timerInterval) && $timerInterval > 0) {
    echo Jquery::doJquery(".alert", "hide", $timerInterval);
}
Ejemplo n.º 14
0
 public function ajaxSample()
 {
     $users = DAO::getAll("User");
     echo '<ul class="list-group">';
     foreach ($users as $u) {
         echo '<li class="list-group-item" id="' . $u->getId() . '"><input type="checkbox" class="ck">&nbsp;' . $u->toString() . "</li>";
     }
     echo "</ul>";
     echo "<button id='btClose' class='btn btn-primary'>Fermer</button>";
     Jquery::bindMethods(true, false);
     Jquery::getOn("click", ".list-group-item", "users/frm", "#response");
     Jquery::doJqueryOn(".ck", "click", "\$(event.target).parent()", "toggleClass", array("disabled", "\$(event.target).prop('checked')"));
     Jquery::doJqueryOn(".list-group-item", "mouseenter", "this", "addClass", array("active"));
     Jquery::doJqueryOn(".list-group-item", "mouseout", "this", "removeClass", "active");
     Jquery::doJqueryOn("#btClose", "click", "#response", "html", "");
     Jquery::doJqueryOn("#btClose", "click", "#main", "show");
     Jquery::doJquery("#main", "hide");
     echo Jquery::compile();
 }
Ejemplo n.º 15
0
 public function frm($id = NULL)
 {
     $ticket = $this->getInstance($id);
     $categories = DAO::getAll("Categorie");
     $statut = DAO::getAll("Statut");
     if ($ticket->getCategorie() == null) {
         $cat = -1;
         $stat = -1;
     } else {
         $cat = $ticket->getCategorie()->getId();
         $stat = $ticket->getStatut()->getId();
     }
     $listCat = Gui::select($categories, $cat, "Sélectionner une catégorie ...");
     $listStatut = Gui::select($statut, $stat, "Sélectionner un statut ...");
     $listType = Gui::select(array("demande", "intervention"), $ticket->getType(), "Sélectionner un type ...");
     if (Auth::isAdmin() == false) {
         //$selectclass = '<select disabled class="form-control" name="idStatut"> '.statutNow.'</select>';
         $this->loadView("ticket/vAdd", array("ticket" => $ticket, "listCat" => $listCat, "listType" => $listType, "listStatut" => $listStatut));
         echo Jquery::execute("CKEDITOR.replace( 'description');");
         //statutupdate
         //$statutUpdate= 'coucou';
         /* '<div class="form-control" disabled name="idStatut"><br>
         				<input type="hidden" name="idStatut" value=" echo $ticket->getStatut()->getId()"><br>$ticket->getStatut();<br></div>';
         		 */
     }
     if (Auth::isAdmin()) {
         $stat = $ticket->getStatut()->getId();
         $this->loadView("ticket/vAdd", array("ticket" => $ticket, "listCat" => $listCat, "listType" => $listType, "statut" => $statut, "listStatut" => $listStatut));
         echo Jquery::execute("CKEDITOR.replace( 'description');");
         //updteticket
         //s$statutUpdate='coucou1';
         /* '<select class="form-control" class="idStatut" name="idStatut"><br>$listStatut<br></select>'; */
     }
 }