function f_sidebar_getmerged()
{
    global $e, $m, $e_script, $e_template, $sidebar;
    include_once 'tbs_class.php';
    $TBS = new clsTinyButStrong();
    $TBS->Source = '[sidebar;file;getbody=body]';
    $TBS->MergeField('sidebar', $sidebar);
    $TBS->Show(TBS_NOTHING);
    return $TBS->Source;
}
 function getTemplateMerge($templateFileName, $vars = null)
 {
     $tbs = new clsTinyButStrong();
     $tbs->LoadTemplate($this->getTemplateDir() . $templateFileName);
     foreach ($vars as $name => $value) {
         if (is_array($value)) {
             $tbs->MergeBlock($name, $value);
         } else {
             $tbs->MergeField($name, $value);
         }
     }
     $tbs->Show(TBS_NOTHING);
     echo $tbs->Source;
 }
if ($affichage == 'tableur') {
    include_once 'lib/function.php';
    // load the TinyButStrong libraries
    include_once '../tbs/tbs_class.php';
    // TinyButStrong template engine
    //include_once('../tbs/plugins/tbsdb_php.php');
    $TBS = new clsTinyButStrong();
    // new instance of TBS
    include_once '../tbs/plugins/tbs_plugin_opentbs.php';
    $TBS->Plugin(TBS_INSTALL, OPENTBS_PLUGIN);
    // load OpenTBS plugin
    // Load the template
    $extraction_traitement = repertoire_modeles('absence_extraction_traitements.ods');
    $TBS->LoadTemplate($extraction_traitement, OPENTBS_ALREADY_UTF8);
    $titre = 'Extrait des traitement d\'absences';
    $TBS->MergeField('titre', $titre);
    $traitement_array_avec_data = array();
    foreach ($results as $traitement) {
        if (isset($_POST['envoye_depuis_liste_traitements'])) {
            if (isset($_POST['liste_traitements_id_traitement']) && in_array($traitement->getPrimaryKey(), $_POST['liste_traitements_id_traitement'])) {
                $extraire_ce_traitement = "y";
            } else {
                $extraire_ce_traitement = "n";
            }
        } else {
            $extraire_ce_traitement = "y";
        }
        if ($extraire_ce_traitement == "y") {
            $traitement_data = array();
            $traitement_data['traitement'] = $traitement;
            if ($traitement->getUtilisateurProfessionnel() != null) {
    // Load the template
	$extraction_demi_journees=repertoire_modeles('absence_extraction_demi-journees.ods');
    $TBS->LoadTemplate($extraction_demi_journees, OPENTBS_ALREADY_UTF8);

    $titre = 'Extrait des demi-journées d\'absences du '.$dt_date_absence_eleve_debut->format('d/m/Y').' au '.$dt_date_absence_eleve_fin->format('d/m/Y');
    $classe = null;
    if ($id_classe != null && $id_classe != '') {
	$classe = ClasseQuery::create()->findOneById($id_classe);
	if ($classe != null) {
	    $titre .= ' pour la classe '.$classe->getNom();
	}
    }
    if ($nom_eleve != null && $nom_eleve != '' ) {
	$titre .= ' pour les élèves dont le nom ou le prénom contient '.$nom_eleve;
    }
    $TBS->MergeField('titre', $titre);

    $eleve_array_avec_data = Array();
    $nb_demijournees = 0;
    $nb_nonjustifiees = 0;
    $nb_retards = 0;
    foreach ($eleve_col as $eleve) {
	$eleve_array_avec_data[$eleve->getPrimaryKey()] = Array(
	    'eleve' => $eleve
	    , 'getDemiJourneesAbsencePreRempli' => $eleve->getNbAbsences()
	    , 'getDemiJourneesNonJustifieesPreRempli' => $eleve->getNbNonJustifiees()
	    , 'getRetardsPreRempli' => $eleve->getNbRetards()
		);

	    $nb_demijournees = $nb_demijournees + $eleve->getNbAbsences();
	    $nb_nonjustifiees = $nb_nonjustifiees + $eleve->getNbNonJustifiees();
Exemple #5
0
// On insère le récapitulatif des années
//~ $OOo->mergeXml(
    //~ array(
      //~ 'name'      => 'recap_annees',
      //~ 'type'      => 'block',
      //~ 'data_type' => 'array',
      //~ 'charset'   => 'UTF-8'
    //~ ),'recap_annees[%p1%]');
    
$OOo->MergeBlock('recap_annees','array','recap_annees[%p1%]');

$nom_fic_logo = getSettingValue("logo_etab");
$nom_fic_logo_c = "../images/".$nom_fic_logo;
if (($nom_fic_logo != '') and (file_exists($nom_fic_logo_c))) {
    $OOo->MergeField('logo',$nom_fic_logo_c);
} else {
    $OOo->MergeField('logo','../images/blank.gif'); 
}

// Fin de traitement des tableaux


//~ $OOo->saveXml(); //traitement du fichier extrait
//~ $OOo->close();
//~ 

//Génération du nom du fichier
$now = gmdate('d_M_Y_H:i:s');
$nom_fichier_modele = explode('.',$nom_fichier_modele_ooo);
$nom_fic = $nom_fichier_modele[0]."_généré_le_".$now.".".$nom_fichier_modele[1];
Exemple #6
0
            // Load the template
            $extraction_taux_absenteisme = repertoire_modeles('absence_taux_absenteisme.ods');
            $TBS->LoadTemplate($extraction_taux_absenteisme, OPENTBS_ALREADY_UTF8);

            $titre = 'Extrait du Taux d\'absentéisme d\'absences du ' . $dt_date_absence_eleve_debut->format('d/m/Y') . ' au ' . $dt_date_absence_eleve_fin->format('d/m/Y');
            $classe = null;
            if ($id_classe != null && $id_classe != '') {
                $classe = ClasseQuery::create()->findOneById($id_classe);
                if ($classe != null) {
                    $titre .= ' pour la classe ' . $classe->getNom();
                }
            }
            if ($nom_eleve != null && $nom_eleve != '') {
                $titre .= ' pour les élèves dont le nom ou le prénom contient ' . $nom_eleve;
            }
            $TBS->MergeField('titre', $titre);
            $TBS->MergeField('dj_ouvrees', $nbre_demi_journees);

            if ($affichage_motifs) {
                $nbre_colonnes = 3 + $motifs_col->count();
            } else {
                $nbre_colonnes = 3;
            }
            //colonnes toujours présentes
            $colonnes_individu = array();
            $colonnes_individu[1] = 'nom';
            $colonnes_individu[2] = 'prenom';
            $colonnes_individu[3] = 'classe';
            $colonnes_donnes = Array();
            $colonnes_donnes[1] = 'taux_1';
            $colonnes_donnes[2] = 'taux_2';
Exemple #7
0
/**
 * Crée et envoie un fichier .ods avec le tableau des justifications
 * @param array $donnees
 * @param objet $justifications 
 */
function creeODS($donnees, $justifications) {
  $date = date("d-m-Y_H-i");
  $nom_fichier = "Justifications_".$date.".ods";
  
  $nbre_colonnes = count($justifications);
  foreach ($justifications as $justifie) {
	$libelle[] = $justifie->getNom();
  }
  
  $titre = 'extraction des justifications du ';
  $titre .= unserialize($_SESSION['statJustifie']['date_absence_eleve_debut']);
  $titre .= ' au ';
  $titre .= unserialize($_SESSION['statJustifie']['date_absence_eleve_fin']); 
  if (isset ($_SESSION['statJustifie']['erreur']) && $_SESSION['statJustifie']['erreur']) {
	$titre .=  ' (Total des justifications différent des absences justifiées)';
  }
  
  $colonnes_individu = array();
  $colonnes_individu[1] = 'nom';
  $colonnes_individu[2] = 'classe';
  
  if (count($donnees)) {
  	foreach ($donnees as &$donnee) {
	  $j=1;
	  foreach ($donnee['traitement'] as $justifie) {
		$donnee['traite_'.$j] = $justifie;
		$j++;
	  }
	}
  }
  
  // load the TinyButStrong libraries
  include_once('../tbs/tbs_class.php'); // TinyButStrong template engine
  $TBS = new clsTinyButStrong; // new instance of TBS
  include_once('../tbs/plugins/tbs_plugin_opentbs.php');
  $TBS->Plugin(TBS_INSTALL, OPENTBS_PLUGIN); // load OpenTBS plugin
  // Load the template
  $extraction_Justifications = repertoire_modeles('absence_nb_justifications.ods');
  $TBS->LoadTemplate($extraction_Justifications, OPENTBS_ALREADY_UTF8);
  
  $TBS->MergeBlock('c2', 'num', $nbre_colonnes);
  $TBS->MergeField('titre', $titre);
  $TBS->MergeBlock('a', $libelle);
  $TBS->MergeBlock('b2', $donnees);
  
  // Output as a download file (some automatic fields are merged here)
  $TBS->Show(OPENTBS_DOWNLOAD + TBS_EXIT, $nom_fichier);
  die ();
}
// prepare the body's template
$TBS = new clsTinyButStrong();
$TBS->LoadTemplate('tbs_us_examples_email.txt', false);
$tpl_subject = $TBS->TplVars['subject'];
// retrieve the subject from the template
$tpl_body = $TBS->Source;
// prepare the mailer
$Mail = new PHPMailer();
$Mail->FromName = 'TBS example';
$Mail->From = '*****@*****.**';
// merge and send each email
foreach ($data as $recipiant) {
    // merge the body
    $TBS->Source = $tpl_body;
    // initialize TBS with the body template
    $TBS->MergeField('i', $recipiant);
    // merge the current recipiant
    $TBS->MergeBlock('a', $recipiant['articles']);
    $TBS->Show(TBS_NOTHING);
    // merge automatic TBS fields
    // prepare the email
    $Mail->AddAddress($recipiant['email']);
    $Mail->Subject = $tpl_subject;
    $Mail->Body = $TBS->Source;
    // send the email
    //$Mail->Send(); // canceled because there must be no email sending in the examples, we display the messages instead
    $txt = 'To: ' . $recipiant['email'] . "\r\n" . 'Subject: ' . $tpl_subject . "\r\n" . $Mail->Body . "\r\n\r\n============================================\r\n\r\n";
    $TBS->Source = '<html><head><link href="./tbs_us_examples_styles.css" rel="stylesheet" type="text/css"></head><body><h1>Example of emailing</h1><div id="main-body"><pre>' . $txt . '</pre></div></body></html>';
    $TBS->Show();
    break;
}
  /**
   * Charge le modele TBS et Merge les données établissement  *
   *
   * @param String $modele chemin du modele tbs   *
   */
  public static function MergeInfosEtab($modele){
        // load the TinyButStrong libraries
    include_once(dirname(__FILE__).'/../../tbs/tbs_class.php'); // TinyButStrong template engine    
    include_once(dirname(__FILE__).'/../../tbs/plugins/tbsdb_php.php');

    $TBS = new clsTinyButStrong; // new instance of TBS
    if (mb_substr($modele, -3) == "odt" ||mb_substr($modele, -3) == "ods") {
	include_once(dirname(__FILE__).'/../../tbs/plugins/tbs_plugin_opentbs.php');
	$TBS->Plugin(TBS_INSTALL, OPENTBS_PLUGIN); // load OpenTBS plugin
    $TBS->LoadTemplate($modele, OPENTBS_ALREADY_UTF8);
    } else {
    $TBS->LoadTemplate($modele);
    }
    //merge des champs commun
    $TBS->MergeField('nom_etab',getSettingValue("gepiSchoolName"));
    $TBS->MergeField('tel_etab',getSettingValue("gepiSchoolTel"));
    $TBS->MergeField('fax_etab',getSettingValue("gepiSchoolFax"));
    $email_abs_etab = getSettingValue("gepiAbsenceEmail");
    if ($email_abs_etab == null || $email_abs_etab == '') {
	$email_abs_etab = getSettingValue("gepiSchoolEmail");
    }
    $TBS->MergeField('mail_etab', $email_abs_etab);
    $TBS->MergeField('annee_scolaire', getSettingValue("gepiYear"));
    $adr_etablissement = new Adresse();
	$adr_etablissement->setAdr1(getSettingValue("gepiSchoolAdress1"));
	$adr_etablissement->setAdr2(getSettingValue("gepiSchoolAdress2"));
	$adr_etablissement->setCp(getSettingValue("gepiSchoolZipCode"));
	$adr_etablissement->setCommune(getSettingValue("gepiSchoolCity"));
	$TBS->MergeField('adr_etab',$adr_etablissement);
    return($TBS);
    }
Exemple #10
0
            //all is ok, load the step
            include_once "steps/step{$step}.php";
        } else {
            //reset step
            $step = 1;
            //load step 1
            include_once 'steps/step1.php';
            //show error
            $vars['wi_notice_error'] = 1;
            $vars['notice'] = 'Some installatin steps have not been completed. Please start again';
        }
    } else {
        //load step 1
        include_once 'steps/step1.php';
    }
}
$TBS = new clsTinyButStrong();
$TBS->NoErr = true;
$TBS->LoadTemplate($template);
$TBS->MergeField('vars', $vars);
$TBS->Render = TBS_OUTPUT;
$TBS->Show();
/** DEBUGGING */
if ($debug == 1) {
    echo "<pre>";
    print_r($vars);
    echo "</pre>";
    echo "<pre>";
    print_r($_SESSION);
    echo "</pre>";
}