/** * Commentaires d'une procedure * * @author Christophe Beyer <*****@*****.**> * @since 2008/01/30 * @param object $rFiche Recordset de la procedure */ public function _createContent(&$toReturn) { $tpl = new CopixTpl(); $rFiche = $this->getParam('rFiche'); $mondroit = $this->getParam('mondroit'); $daoinfo =& _dao('infosupp'); $sql = 'SELECT * FROM module_teleprocedure_infosupp WHERE idinter=' . $rFiche->idinter . ''; $canCheckVisible = TeleproceduresService::canMakeInTelep('CHECK_VISIBLE', $mondroit); $canAddComment = TeleproceduresService::canMakeInTelep('ADD_COMMENT', $mondroit); if (!$canCheckVisible) { $sql .= " AND info_message!='' AND info_message IS NOT NULL"; } $sql .= " ORDER BY dateinfo ASC, idinfo ASC"; $results = _doQuery($sql); // Pour chaque message on cherche les infos de son auteur $list = array(); foreach ($results as $r) { $userInfo = Kernel::getUserInfo("ID", $r->iduser); //var_dump($userInfo); $avatar = Prefs::get('prefs', 'avatar', $r->iduser); $userInfo['avatar'] = $avatar ? CopixConfig::get('prefs|avatar_path') . $avatar : ''; $r->user = $userInfo; $list[] = $r; } //print_r($rFiche); $tpl->assign('info_message_edition', CopixZone::process('kernel|edition', array('field' => 'info_message', 'format' => $rFiche->type_format, 'content' => '', 'width' => 350, 'height' => 135, 'options' => array('toolbarSet' => 'IconitoBasic', 'enterMode' => 'br', 'toolbarStartupExpanded' => 'false')))); $tpl->assign('info_commentaire_edition', CopixZone::process('kernel|edition', array('field' => 'info_commentaire', 'format' => $rFiche->type_format, 'content' => '', 'width' => 350, 'height' => 135, 'options' => array('toolbarSet' => 'IconitoBasic', 'enterMode' => 'br', 'toolbarStartupExpanded' => 'false')))); $tpl->assign('canCheckVisible', $canCheckVisible); $tpl->assign('canAddComment', $canAddComment); $tpl->assign('list', $list); $tpl->assign('rFiche', $rFiche); $toReturn = $tpl->fetch('fiche-comms-zone.tpl'); return true; }
public function _createContent(&$toReturn) { $tpl = new CopixTpl(); $motcle = $this->getParam('motcle'); $clos = $this->getParam('clos'); $type = $this->getParam('type'); $ecole = $this->getParam('ecole'); $rTelep = $this->getParam('rTelep'); $admin = $this->getParam('admin'); $mondroit = $this->getParam('mondroit'); $daoType =& _dao('teleprocedures|type'); $tpl->assign('arTypes', $daoType->findForTeleprocedure($rTelep->id)); //print_r($rTelep); $canViewComboEcoles = TeleproceduresService::canMakeInTelep('VIEW_COMBO_ECOLES', $mondroit); if ($canViewComboEcoles) { $tpl->assign('comboEcolesLinesSup', array(0 => array('value' => '', 'libelle' => '---'), 1 => array('value' => '', 'libelle' => CopixI18N::get('annuaire|annuaire.comboAllEcoles')))); } $tpl->assign('rTelep', $rTelep); $tpl->assign('admin', $admin); $tpl->assign('motcle', $motcle); $tpl->assign('clos', $clos); $tpl->assign('type', $type); $tpl->assign('ecole', $ecole); $tpl->assign('canViewComboEcoles', $canViewComboEcoles); $toReturn = $tpl->fetch('filtre-zone.tpl'); return true; }
/** * Actions d'une procedure * * @author Christophe Beyer <*****@*****.**> * @since 2009/01/21 * @param object $rFiche Recordset de la procedure */ public function _createContent(&$toReturn) { $tpl = new CopixTpl(); $rFiche = $this->getParam('rFiche'); $mondroit = $this->getParam('mondroit'); $canChangeStatut = TeleproceduresService::canMakeInTelep('CHANGE_STATUT', $mondroit, array('idinter' => $rFiche->idinter)); $canDelegue = TeleproceduresService::canMakeInTelep('DELEGUE', $mondroit, array('idinter' => $rFiche->idinter)); $canSendMails = TeleproceduresService::canMakeInTelep('SEND_MAILS', $mondroit, array('idinter' => $rFiche->idinter)); $daoStat =& _dao('statu'); $tpl->assign('arStat', $daoStat->findAll()); $tpl->assign('rFiche', $rFiche); $tpl->assign('canChangeStatut', $canChangeStatut); $tpl->assign('canDelegue', $canDelegue); $tpl->assign('canSendMails', $canSendMails); $tpl->assign('mailEnabled', CopixConfig::get('|mailEnabled')); $tpl->assign('linkpopup_responsables', CopixZone::process('annuaire|linkpopup', array('field' => 'responsables', 'profil' => 'USER_VIL'))); $toReturn = $tpl->fetch('fiche-actions-zone.tpl'); return true; }
/** * Detail d'une procedure * * @author Christophe Beyer <*****@*****.**> * @since 2008/01/30 * @param object $rFiche Recordset de la procedure */ public function _createContent(&$toReturn) { $tpl = new CopixTpl(); $rFiche = $this->getParam('rFiche'); $errors = $this->getParam('errors'); $ok = $this->getParam('ok'); $print = $this->getParam('print'); //var_dump($rFiche); //$daoType = & _dao ('type'); //$tpl->assign ('arTypes', $daoType->findAll ()); $arResponsables = preg_split('/[\\s,]+/', $rFiche->responsables); $rFiche->tabResponsables = $arResponsables; $mondroit = $this->getParam('mondroit'); $rEcole = Kernel::getNodeInfo('BU_ECOLE', $rFiche->idetabliss, false); //var_dump($rEcole); $rFiche->ecole_nom = $rEcole['ALL']->eco_nom; $rFiche->ecole_type = $rEcole['ALL']->eco_type; $rFiche->ecole_tel = $rEcole['ALL']->eco_tel; $rFiche->ecole_dir = AnnuaireService::getDirecteurInEcole($rFiche->idetabliss); $daoType =& _dao('teleprocedures|type'); if ($tmp = $daoType->get($rFiche->idtype)) { $rFiche->idtype_nom = $tmp->nom; } $daoStatu =& _dao('teleprocedures|statu'); if ($tmp = $daoStatu->get($rFiche->idstatu)) { $rFiche->idstatu_nom = $tmp->nom; } $canDelegue = TeleproceduresService::canMakeInTelep('DELEGUE', $mondroit, array('idinter' => $rFiche->idinter)); $tpl->assign('canDelegue', $canDelegue); $tpl->assign('canViewDelai', TeleproceduresService::canMakeInTelep('VIEW_DELAI', $mondroit)); $tpl->assign('rFiche', $rFiche); $tpl->assign('errors', $errors); $tpl->assign('ok', $ok); $tpl->assign('print', $print); $tplFiche = $tpl->fetch('fiche-zone.tpl'); $toReturn = $tplFiche; return true; }
/** * Ajout d'une info supplementaire * * @author Christophe Beyer <*****@*****.**> * @since 2008/01/30 * @param integer $id Id de la procedure */ public function insertInfoSupp() { $id = $this->getRequest('id', null); $info_message = $this->getRequest('info_message', null); $info_commentaire = $this->getRequest('info_commentaire', null); $visible = $this->getRequest('visible', null); $daoIntervention = CopixDAOFactory::create("intervention"); $daoInfoSupp = CopixDAOFactory::create("infosupp"); $criticErrors = $errors = array(); if ($id && ($rFiche = $daoIntervention->get($id))) { $title = $rFiche->objet; $mondroit = Kernel::getLevel("MOD_TELEPROCEDURES", $rFiche->type_teleprocedure); if (!TeleproceduresService::canMakeInTelep('ADD_COMMENT', $mondroit)) { $criticErrors[] = CopixI18N::get('kernel|kernel.error.noRights'); } } else { $criticErrors[] = CopixI18N::get('teleprocedures|teleprocedures.error.prob.telep'); } if ($criticErrors) { return CopixActionGroup::process('genericTools|Messages::getError', array('message' => implode('<br/>', $criticErrors), 'back' => CopixUrl::get('teleprocedures||'))); } if ($info_message || $info_commentaire) { //$canCheckVisible = TeleproceduresService::canMakeInTelep('CHECK_VISIBLE', $mondroit); $rFiche->insertInfoSupp($info_message, $info_commentaire); } return new CopixActionReturn(COPIX_AR_REDIRECT, CopixUrl::get('|fiche', array('id' => $id))); }
/** * Formulaire de saisie/modif d'un type de teleprocedure * * @author Christophe Beyer <*****@*****.**> * @since 2009/01/15 * @param integer $save 1 si submit du formulaire */ public function formtype() { $idtype = $this->getRequest('idtype'); $teleprocedure = $this->getRequest('teleprocedure'); $save = $this->getRequest('save'); $daoType =& CopixDAOFactory::create('teleprocedures|type'); $criticErrors = $errors = array(); $tplForm = new CopixTpl(); $tplForm->assign('is_online', array('values' => array(1, 0), 'output' => array(CopixI18N::get('blog|blog.oui'), CopixI18N::get('blog|blog.non')))); $formats = CopixConfig::get('teleprocedures|formats_types'); $tabFormats = preg_split('/[\\s,]+/', $formats); $values = $output = array(); foreach ($tabFormats as $k) { $values[] = $k; $output[] = CopixI18N::get('blog|blog.default_format_articles.' . $k); } $tplForm->assign('format', array('values' => $values, 'output' => $output)); $tplForm->assign('linkpopup_responsables', CopixZone::process('annuaire|linkpopup', array('field' => 'responsables', 'profil' => 'USER_VIL'))); $tplForm->assign('linkpopup_lecteurs', CopixZone::process('annuaire|linkpopup', array('field' => 'lecteurs', 'profil' => 'USER_VIL'))); // Verifications if ($idtype) { if ($rType = $daoType->get($idtype)) { $mondroit = Kernel::getLevel("MOD_TELEPROCEDURES", $rType->teleprocedure); if (!TeleproceduresService::canMakeInTelep('ADMIN', $mondroit)) { $criticErrors[] = CopixI18N::get('kernel|kernel.error.noRights'); } } else { $criticErrors[] = CopixI18N::get('teleprocedures|teleprocedures.error.noParameter'); } } elseif ($teleprocedure) { $mondroit = Kernel::getLevel("MOD_TELEPROCEDURES", $teleprocedure); if (!TeleproceduresService::canMakeInTelep('ADMIN', $mondroit)) { $criticErrors[] = CopixI18N::get('kernel|kernel.error.noRights'); } } else { $criticErrors[] = CopixI18N::get('teleprocedures|teleprocedures.error.noParameter'); } if ($criticErrors) { return CopixActionGroup::process('genericTools|Messages::getError', array('message' => implode('<br/>', $criticErrors), 'back' => CopixUrl::get('teleprocedures||'))); } // Traitement if ($idtype) { // Modif $title = CopixI18N::get('teleprocedures|teleprocedures.title.modifType'); if ($save) { // Responsables $responsables = $this->getRequest('responsables'); $responsables = str_replace(array(" "), "", $responsables); $responsables = str_replace(array(",", ";"), ",", $responsables); $responsables = preg_split('/[\\s,]+/', $responsables); $tabResponsables = array(); $deja = array(); // On vérifie que les membres existent while (list(, $login) = each($responsables)) { if (!$login) { continue; } $userInfo = Kernel::getUserInfo("LOGIN", $login); if (!$userInfo) { $errors[] = CopixI18N::get('teleprocedures|teleprocedures.error.memberNoUser', array($login)); } elseif ($userInfo['type'] != 'USER_VIL') { $errors[] = CopixI18N::get('teleprocedures|teleprocedures.error.memberNoVille', array($login)); } else { $tabResponsables[] = $userInfo; $deja[] = $login; } } //print_r($tabResponsables); // Lecteurs $lecteurs = $this->getRequest('lecteurs'); $lecteurs = str_replace(array(" "), "", $lecteurs); $lecteurs = str_replace(array(",", ";"), ",", $lecteurs); $lecteurs = preg_split('/[\\s,]+/', $lecteurs); $tabLecteurs = array(); // On vérifie que les membres existent while (list(, $login) = each($lecteurs)) { if (!$login) { continue; } $userInfo = Kernel::getUserInfo("LOGIN", $login); if (!$userInfo) { $errors[] = CopixI18N::get('teleprocedures|teleprocedures.error.memberNoUser', array($login)); } elseif ($userInfo['type'] != 'USER_VIL') { $errors[] = CopixI18N::get('teleprocedures|teleprocedures.error.memberNoVille', array($login)); } elseif (in_array($login, $deja)) { $errors[] = CopixI18N::get('teleprocedures|teleprocedures.error.memberDeja', array($login)); } else { $tabLecteurs[] = $userInfo; } } $type = $rType; $type->nom = $this->getRequest('nom'); $type->is_online = $this->getRequest('is_online'); $type->teleprocedure = $this->getRequest('teleprocedure'); $type->format = $this->getRequest('format'); $type->texte_defaut = $this->getRequest('texte_defaut'); $type->responsables = $this->getRequest('responsables'); $type->lecteurs = $this->getRequest('lecteurs'); $type->mail_from = $this->getRequest('mail_from'); $type->mail_to = $this->getRequest('mail_to'); $type->mail_cc = $this->getRequest('mail_cc'); $type->mail_message = $this->getRequest('mail_message'); if ($type->mail_from && !validateEMail($type->mail_from)) { $errors[] = CopixI18N::get('teleprocedures|teleprocedures.error.incorrectMail', $type->mail_from); } if ($type->mail_to) { $list = preg_split('/[\\s,]+/', $type->mail_to); foreach ($list as $email) { if (!validateEMail($email)) { $errors[] = CopixI18N::get('teleprocedures|teleprocedures.error.incorrectMail', $email); } } } if ($type->mail_cc) { $list = preg_split('/[\\s,]+/', $type->mail_cc); foreach ($list as $email) { if (!validateEMail($email)) { $errors[] = CopixI18N::get('teleprocedures|teleprocedures.error.incorrectMail', $email); } } } if ($type->mail_to && !$type->mail_from) { $errors[] = CopixI18N::get('teleprocedures|teleprocedures.error.mail_from'); } $errorsDao = _dao('teleprocedures|type')->check($type); //die(); if (count($errors) || is_array($errorsDao)) { // Erreurs if (is_array($errorsDao)) { $errors = array_merge($errorsDao, $errors); } } else { // Pas d'erreurs $daoType->update($type); TeleproceduresService::saveDroits("type", $idtype, 'responsables', $tabResponsables); TeleproceduresService::saveDroits("type", $idtype, 'lecteurs', $tabLecteurs); return new CopixActionReturn(COPIX_AR_REDIRECT, CopixUrl::get('admin|admin', array('id' => $type->teleprocedure))); } } else { $type = $rType; } } else { // Creation $title = CopixI18N::get('teleprocedures|teleprocedures.title.newType'); $type = CopixDAOFactory::createRecord('teleprocedures|type'); if ($save) { // Responsables $responsables = $this->getRequest('responsables'); $responsables = str_replace(array(" "), "", $responsables); $responsables = str_replace(array(",", ";"), ",", $responsables); $responsables = preg_split('/[\\s,]+/', $responsables); $tabResponsables = array(); while (list(, $login) = each($responsables)) { if (!$login) { continue; } $userInfo = Kernel::getUserInfo("LOGIN", $login); if (!$userInfo) { $errors[] = CopixI18N::get('teleprocedures|teleprocedures.error.memberNoUser', array($login)); } elseif ($userInfo['type'] != 'USER_VIL') { $errors[] = CopixI18N::get('teleprocedures|teleprocedures.error.memberNoVille', array($login)); } else { $tabResponsables[] = $userInfo; $deja[] = $login; } } // Lecteurs $lecteurs = $this->getRequest('lecteurs'); $lecteurs = str_replace(array(" "), "", $lecteurs); $lecteurs = str_replace(array(",", ";"), ",", $lecteurs); $lecteurs = preg_split('/[\\s,]+/', $lecteurs); $tabLecteurs = array(); // On vérifie que les membres existent while (list(, $login) = each($lecteurs)) { if (!$login) { continue; } $userInfo = Kernel::getUserInfo("LOGIN", $login); if (!$userInfo) { $errors[] = CopixI18N::get('teleprocedures|teleprocedures.error.memberNoUser', array($login)); } elseif ($userInfo['type'] != 'USER_VIL') { $errors[] = CopixI18N::get('teleprocedures|teleprocedures.error.memberNoVille', array($login)); } elseif (in_array($login, $deja)) { $errors[] = CopixI18N::get('teleprocedures|teleprocedures.error.memberDeja', array($login)); } else { $tabLecteurs[] = $userInfo; } } $type->nom = $this->getRequest('nom'); $type->is_online = $this->getRequest('is_online'); $type->teleprocedure = $this->getRequest('teleprocedure'); $type->format = $this->getRequest('format'); $type->texte_defaut = $this->getRequest('texte_defaut'); $type->responsables = $this->getRequest('responsables'); $type->lecteurs = $this->getRequest('lecteurs'); $type->mail_from = $this->getRequest('mail_from'); $type->mail_to = $this->getRequest('mail_to'); $type->mail_cc = $this->getRequest('mail_cc'); $type->mail_message = $this->getRequest('mail_message'); $errorsDao = _dao('teleprocedures|type')->check($type); if (count($errors) || is_array($errorsDao)) { // Erreurs if (is_array($errorsDao)) { $errors = array_merge($errorsDao, $errors); } } else { // Pas d'erreurs $daoType->insert($type); if ($type->idtype) { TeleproceduresService::saveDroits("type", $type->idtype, 'responsables', $tabResponsables); TeleproceduresService::saveDroits("type", $type->idtype, 'lecteurs', $tabLecteurs); } return new CopixActionReturn(COPIX_AR_REDIRECT, CopixUrl::get('admin|admin', array('id' => $type->teleprocedure))); } } else { $type->teleprocedure = $teleprocedure; $type->is_online = 1; $type->format = CopixConfig::get('teleprocedures|default_format'); } } //print_r($type); $tplForm->assign('type', $type); $tplForm->assign('edition_texte_defaut', CopixZone::process('kernel|edition', array('field' => 'texte_defaut', 'format' => $type->format, 'content' => $type->texte_defaut, 'height' => 460))); $tplForm->assign('errors', $errors); $tplForm->assign('mailEnabled', CopixConfig::get('|mailEnabled')); $main = $tplForm->fetch('form-type.tpl'); $tpl = new CopixTpl(); $tpl->assign('TITLE_PAGE', $title); $tpl->assign("MAIN", $main); return new CopixActionReturn(COPIX_AR_DISPLAY, $tpl); }