182 lines
7.2 KiB
PHP
Raw Normal View History

2020-12-03 16:35:44 +01:00
<?php
/**-----------------------------------------------
*
* Rooty, 2018 <rooty@rooty.me>
*
*
* This software is protected by copyright, please
* read the file COPYRIGHT.
* This program is distributed in the hope that it
* will be useful, but without any warranty; without
* even the implied warranty of merchantability or
* fitness for a particular purpose. Please
* read the file LICENCE.
*
* Fichier UserPrint.php
*
* Ce fichier contient la classe UserPrint
*
* @author Initiance <www.initiance.com|martial@initiance.com>
* @copyright Copyright &copy; 2009-2018, Rooty
* @since 2004/06/07
* @version 0.3
* @link www.rooty.me
* @package object_printing
* @subpackage UserPrint
*/
if ( !defined('SYSTEM_IN') )
{
die("Hacking attempt");
}
/**
* Classe UserPrint
*<p>Cette classe permet la recuperation des UserPrint</p>
* @package object_printing
* @subpackage UserPrint
*/
class UserPrint extends Printing
{
//
// Constructor
//
/**
* Constructeur de la classe UserPrint
* @access public
*/
function UserPrint()
{
$this->__construct();
}
function __construct()
{
parent::__construct("1.0", "Olivier DEVAINE", "Affichage soit du formulaire d'UserPrint, soit de déconnection (avec les infos utilisateurs)");
}
/**
* Remplace dans la template principale
* @access public
*/
function __print()
{
global $SERVER_NAME, $SCRIPT_NAME, $CONF_AUTH_SECURE;
if ($GLOBALS["SYSTEM_USER_SESSION"]->user->getId()==$GLOBALS["SYSTEM_DEFAULT_USER_GUEST"])
{
$MaTemplate = new ModeliXeQware($GLOBALS['SYSTEM_TEMPLATE_PATH'].$GLOBALS['SYSTEM_TEMPLATE_DIR']."object_printing/userprint/auth.mxt");
$MaTemplate->SetModeliXe(true);
2020-12-03 16:35:44 +01:00
$nodeId = $GLOBALS["SYSTEM_USER_SESSION"]->navigationNodeId;
$GLOBALS['SYSTEM_TEMPLATE']->MxText("imgPath", $GLOBALS['SYSTEM_TEMPLATE_PATH'].$GLOBALS['SYSTEM_TEMPLATE_DIR']);
/* création de l'url de login */
$url =$_SERVER['SCRIPT_NAME'];
$url.="?system=authSession";
$url=addIdToUrl($url);
$tabObject =$this->getObjectSon(eid());
2021-03-31 02:34:56 +02:00
// var_dump($tabObject);
2020-12-03 16:35:44 +01:00
for ($i=0; $i<count($tabObject);$i++)
{
2021-03-31 02:34:56 +02:00
if ($tabObject[$i][0]->getClassName()=="Home")
2020-12-03 16:35:44 +01:00
{
2021-03-31 02:34:56 +02:00
// var_dump($tabObject[$i][1]->getId());
2020-12-03 16:35:44 +01:00
$urlArray["id"]=$tabObject[$i][1]->getId();
}
}
/* Création de l'URL pour nouveau compte */
$urlNewAccount = $_SERVER['SCRIPT_NAME'];
$urlNewAccount.= "?system=authNewAccount";
$urlNewAccount = addIdToUrl($urlNewAccount);
// if( isset($_SERVER["HTTPS"]) )
// $proto = "https://";
// else
// $proto = "http://";
// $MaTemplate->MxAttribut("urlActionNewAccount", $proto."www.fab-l3.org/wwwfab_lorg-142-les_communautes-formlecture-2.htm?abs=1&amp;param=139");
2020-12-25 17:32:58 +01:00
$MaTemplate->MxAttribut("urlActionNewAccount", formatUrl($urlArray["id"],"Home","formLecture","",recupCommunity()));
$MaTemplate->MxAttribut("urlActionNewSubscription", formatUrl($urlArray["id"],"Home","formLectureAdh","",recupCommunity()));
2020-12-03 16:35:44 +01:00
/* Création de l'URL pour rappel du mot de passe */
$urlForgotPassword = $_SERVER['SCRIPT_NAME'];
// $urlForgotPassword.= "?system=authForgotPassword";
$urlForgotPassword.= "?msg=forgotPasswordTempDisabled";
$urlForgotPassword = addIdToUrl($urlForgotPassword);
/* picto en fonction de la template */
$MaTemplate->MxImage("pictoAuth", $GLOBALS['CONF_DATA_PATH']."data/template/".$GLOBALS['SYSTEM_TEMPLATE_DIR']."media/picto/authorise.png");
$MaTemplate->MxText("auth", getMessage("UserPrintAuth"));
$MaTemplate->MxText("LOGIN", getMessage("UserPrintLogin"));
$MaTemplate->MxFormField("login", "text", "login", "", "title='".getMessage("tipUserPrintLogin")."'");
$MaTemplate->MxText("PASSWORD", getMessage("UserPrintPassword"));
$MaTemplate->MxFormField("password", "password", "password", "", "title='".getMessage("tipUserPrintPassword")."'");
$MaTemplate->MxAttribut("urlActionNewAccount", $urlNewAccount);
$MaTemplate->MxText("NEWACCOUNT", getMessage("UserPrintNewAccount"));
$MaTemplate->MxText("NEWSUBSCRIPTION", getMessage("UserPrintNewSubscription"));
$MaTemplate->MxAttribut("urlActionForgotPassword", $urlForgotPassword);
$MaTemplate->MxText("FORGOTPASSWORD", getMessage("UserPrintForgotPassword"));
$MaTemplate->MxAttribut("urlActionLogin", $url);
$MaTemplate->MxAttribut("BtnEnter", getMessage("UserPrintEnter"));
$MaTemplate->MxText("BtnEnter", getMessage("UserPrintEnter"));
$MaTemplate->MxAttribut("titleButton", getMessage("tipUserPrintEnter"));
$data=$MaTemplate->MxWrite();
}else{
$MaTemplate = new ModeliXeQware($GLOBALS['SYSTEM_TEMPLATE_PATH'].$GLOBALS['SYSTEM_TEMPLATE_DIR']."object_printing/userprint/userinfo.mxt");
2020-12-03 16:35:44 +01:00
$MaTemplate->SetModeliXe(true);
/* picto en fonction de la template */
$MaTemplate->MxImage("picto", $GLOBALS['CONF_DATA_PATH']."data/template/".$GLOBALS['SYSTEM_TEMPLATE_DIR']."media/picto/user.png");
$MaTemplate->MxText("firstName", $GLOBALS["SYSTEM_USER_SESSION"]->user->getFirstName());
$MaTemplate->MxText("lastName", $GLOBALS["SYSTEM_USER_SESSION"]->user->getLastName());
$MaTemplate->MxText("id", $GLOBALS["SYSTEM_USER_SESSION"]->user->getId());
$MaTemplate->MxText("mail", $GLOBALS["SYSTEM_USER_SESSION"]->user->getMail());
$MaTemplate->MxText("organisation", $GLOBALS["SYSTEM_USER_SESSION"]->user->getOrganisation());
$MaTemplate->MxText("title", $GLOBALS["SYSTEM_USER_SESSION"]->user->getTitle());
$MaTemplate->MxText("postalAddress", $GLOBALS["SYSTEM_USER_SESSION"]->user->getPostalAddress());
$MaTemplate->MxText("postalCode", $GLOBALS["SYSTEM_USER_SESSION"]->user->getPostalCode());
$MaTemplate->MxText("state", $GLOBALS["SYSTEM_USER_SESSION"]->user->getState());
$MaTemplate->MxText("country", $GLOBALS["SYSTEM_USER_SESSION"]->user->getCountry());
$MaTemplate->MxText("login", $GLOBALS["SYSTEM_USER_SESSION"]->user->getLogin());
$MaTemplate->MxText("tel", $GLOBALS["SYSTEM_USER_SESSION"]->user->getTel());
$MaTemplate->MxText("decon", getMessage("UserPrintDecon"));
$MaTemplate->MxAttribut("decon", getMessage("UserPrintDecon"));
$MaTemplate->MxText("fax", $GLOBALS["SYSTEM_USER_SESSION"]->user->getFax());
$MaTemplate->MxText("TxtWelcome", getMessage("TxtWelcome"));
/* création de l'url de l'outil de gestion du compte utilisateur */
$tabObjectNode =$this->getObjectSon(eid());
for ($j=0; $j<count($tabObjectNode);$j++)
{
if ($tabObjectNode[$j][0]->getClassName()=="UserModif")
{
$MaTemplate->MxAttribut("urlAccount", formatUrl($tabObjectNode[$j][1]->getId(), $tabObjectNode[$j][0]->getClassName(), $tabObjectNode[$j][0]->getMethodName(), "", ""));
}
}
2020-12-03 16:35:44 +01:00
/* création de l'url de login */
$url =$_SERVER['SCRIPT_NAME'];
$url.="?system=disconnectSession";
$url=addIdToUrl($url);
/* picto en fonction de la template */
$MaTemplate->MxAttribut("pictoDisco", $GLOBALS['CONF_DATA_PATH']."data/template/".$GLOBALS['SYSTEM_TEMPLATE_DIR']."media/picto/exit.png");
$MaTemplate->MxAttribut("disconnectURL", $url);
2020-12-03 16:35:44 +01:00
$data=$MaTemplate->MxWrite();
}
$GLOBALS["SYSTEM_TEMPLATE"]->MxText("userprint", $data); // Et voila!!!!!
return true;
}
/**
* recupere les fils d'un noeud depuis le noeud principal
* @access public
*/
private function getObjectSon($nodeId)
{
$tab=$GLOBALS["SYSTEM_CONTROL"]->getListObjectForNavigation($nodeId);
return $tab;
}
}
?>