Example #1
0
$middle = PDF_MIDDLE;
$titre = '<p style = "text-decoration:underline">TABLEAU D\'HONNEUR</p>';
$pdf->WriteHTMLCell(0, 50, $middle - 20, $y - 5, $titre);
$pdf->SetFont("Times", "", 10);
$titre = '<p>CLASSE  : <i>' . $classe['NIVEAUHTML'] . "</i></p>";
$pdf->WriteHTMLCell(0, 0, $middle + 30, $y, $titre);
if ($codeperiode === "S") {
    $pdf->WriteHTMLCell(0, 0, $middle - 40, $y, 'SEQUENCE N° : ' . $sequence['SEQUENCEORDRE']);
} else {
    $pdf->WriteHTMLCell(0, 0, $middle - 40, $y, 'TRIMESTRE N° : ' . $trimestre['ORDRE']);
}
$pdf->SetFont("Times", "", 8);
$col = [5, 8, 30, 17, 9, 15, 20];
$corps = '<table cellpadding="2"><thead><tr style="text-align:center;font-weight:bold;"><th border="1" width="' . $col[0] . '%">N°</th>' . '<th border="1" width="' . $col[1] . '%">Matricule</th>' . '<th border="1" width="' . $col[2] . '%">Noms et Pr&eacute;noms</th>' . '<th border="1" width="' . $col[3] . '%">Date/LieuNaiss</th>' . '<th border="1" width="' . $col[4] . '%">Redouble</th>' . '<th border="1" width="' . $col[5] . '%">Moyenne(>12)</th>' . '<th border="1" width="' . $col[6] . '%">Observation</th></tr></thead><tbody>';
$i = 1;
$array_of_redoublants = is_null($array_of_redoublants) ? array() : $array_of_redoublants;
foreach ($rangs as $rang) {
    if ($rang['MOYGENERALE'] >= 12) {
        $corps .= '<tr><td border="1" width="' . $col[0] . '%">' . $i . '</td>' . '<td border="1" width="' . $col[1] . '%">' . $rang['MATRICULEEL'] . '</td>' . '<td border="1" width="' . $col[2] . '%">' . $rang['NOMEL'] . ' ' . $rang['PRENOMEL'] . '</td>' . '<td border="1" width="' . $col[3] . '%">' . date("d/m/Y", strtotime($rang['DATENAISSEL'])) . '/' . $rang['LIEUNAISSEL'] . '</td>';
        if (in_array($rang['IDELEVE'], $array_of_redoublants)) {
            $redouble = "OUI";
        } else {
            $redouble = "NON";
        }
        $corps .= '<td border="1" width="' . $col[4] . '%" align="center">' . $redouble . '</td>' . '<td border="1" width="' . $col[5] . '%" align="center">' . sprintf("%.2f", $rang['MOYGENERALE']) . '</td>' . '<td border="1" width="' . $col[6] . '%">' . getMentions($rang['MOYGENERALE']) . '</td></tr>';
        $i++;
    }
}
$corps .= '</table>';
$pdf->WriteHTMLCell(0, 0, $x, $y + 10, $corps);
$pdf->Output();
 /**
  * Inserts or updates the discussion via form values.
  *
  * Events: BeforeSaveDiscussion, AfterSaveDiscussion.
  *
  * @since 2.0.0
  * @access public
  *
  * @param array $FormPostValues Data sent from the form model.
  * @param array $Settings Currently unused.
  * @return int $DiscussionID Unique ID of the discussion.
  */
 public function save($FormPostValues, $Settings = false)
 {
     $Session = Gdn::session();
     // Define the primary key in this model's table.
     $this->defineSchema();
     // Add & apply any extra validation rules:
     $this->Validation->applyRule('Body', 'Required');
     $this->Validation->addRule('MeAction', 'function:ValidateMeAction');
     $this->Validation->applyRule('Body', 'MeAction');
     $MaxCommentLength = Gdn::config('Vanilla.Comment.MaxLength');
     if (is_numeric($MaxCommentLength) && $MaxCommentLength > 0) {
         $this->Validation->SetSchemaProperty('Body', 'Length', $MaxCommentLength);
         $this->Validation->applyRule('Body', 'Length');
     }
     // Validate category permissions.
     $CategoryID = val('CategoryID', $FormPostValues);
     if ($CategoryID > 0) {
         $Category = CategoryModel::categories($CategoryID);
         if ($Category && !$Session->checkPermission('Vanilla.Discussions.Add', true, 'Category', val('PermissionCategoryID', $Category))) {
             $this->Validation->addValidationResult('CategoryID', 'You do not have permission to post in this category');
         }
     }
     // Get the DiscussionID from the form so we know if we are inserting or updating.
     $DiscussionID = val('DiscussionID', $FormPostValues, '');
     // See if there is a source ID.
     if (val('SourceID', $FormPostValues)) {
         $DiscussionID = $this->SQL->getWhere('Discussion', arrayTranslate($FormPostValues, array('Source', 'SourceID')))->value('DiscussionID');
         if ($DiscussionID) {
             $FormPostValues['DiscussionID'] = $DiscussionID;
         }
     } elseif (val('ForeignID', $FormPostValues)) {
         $DiscussionID = $this->SQL->getWhere('Discussion', array('ForeignID' => $FormPostValues['ForeignID']))->value('DiscussionID');
         if ($DiscussionID) {
             $FormPostValues['DiscussionID'] = $DiscussionID;
         }
     }
     $Insert = $DiscussionID == '' ? true : false;
     $this->EventArguments['Insert'] = $Insert;
     if ($Insert) {
         unset($FormPostValues['DiscussionID']);
         // If no categoryid is defined, grab the first available.
         if (!val('CategoryID', $FormPostValues) && !c('Vanilla.Categories.Use')) {
             $FormPostValues['CategoryID'] = val('CategoryID', CategoryModel::defaultCategory(), -1);
         }
         $this->addInsertFields($FormPostValues);
         // The UpdateUserID used to be required. Just add it if it still is.
         if (!$this->Schema->getProperty('UpdateUserID', 'AllowNull', true)) {
             $FormPostValues['UpdateUserID'] = $FormPostValues['InsertUserID'];
         }
         // $FormPostValues['LastCommentUserID'] = $Session->UserID;
         $FormPostValues['DateLastComment'] = $FormPostValues['DateInserted'];
     } else {
         // Add the update fields.
         $this->addUpdateFields($FormPostValues);
     }
     // Set checkbox values to zero if they were unchecked
     if (val('Announce', $FormPostValues, '') === false) {
         $FormPostValues['Announce'] = 0;
     }
     if (val('Closed', $FormPostValues, '') === false) {
         $FormPostValues['Closed'] = 0;
     }
     if (val('Sink', $FormPostValues, '') === false) {
         $FormPostValues['Sink'] = 0;
     }
     //	Prep and fire event
     $this->EventArguments['FormPostValues'] =& $FormPostValues;
     $this->EventArguments['DiscussionID'] = $DiscussionID;
     $this->fireEvent('BeforeSaveDiscussion');
     // Validate the form posted values
     $this->validate($FormPostValues, $Insert);
     $ValidationResults = $this->validationResults();
     // If the body is not required, remove it's validation errors.
     $BodyRequired = c('Vanilla.DiscussionBody.Required', true);
     if (!$BodyRequired && array_key_exists('Body', $ValidationResults)) {
         unset($ValidationResults['Body']);
     }
     if (count($ValidationResults) == 0) {
         // If the post is new and it validates, make sure the user isn't spamming
         if (!$Insert || !$this->checkForSpam('Discussion')) {
             // Get all fields on the form that relate to the schema
             $Fields = $this->Validation->schemaValidationFields();
             // Check for spam.
             $spam = SpamModel::isSpam('Discussion', $Fields);
             if ($spam) {
                 return SPAM;
             }
             // Get DiscussionID if one was sent
             $DiscussionID = intval(val('DiscussionID', $Fields, 0));
             // Remove the primary key from the fields for saving.
             unset($Fields['DiscussionID']);
             $StoredCategoryID = false;
             if ($DiscussionID > 0) {
                 // Updating
                 $Stored = $this->getID($DiscussionID, DATASET_TYPE_OBJECT);
                 // Block Format change if we're forcing the formatter.
                 if (c('Garden.ForceInputFormatter')) {
                     unset($Fields['Format']);
                 }
                 // Clear the cache if necessary.
                 $CacheKeys = array();
                 if (val('Announce', $Stored) != val('Announce', $Fields)) {
                     $CacheKeys[] = $this->getAnnouncementCacheKey();
                     $CacheKeys[] = $this->getAnnouncementCacheKey(val('CategoryID', $Stored));
                 }
                 if (val('CategoryID', $Stored) != val('CategoryID', $Fields)) {
                     $CacheKeys[] = $this->getAnnouncementCacheKey(val('CategoryID', $Fields));
                 }
                 foreach ($CacheKeys as $CacheKey) {
                     Gdn::cache()->remove($CacheKey);
                 }
                 self::serializeRow($Fields);
                 $this->SQL->put($this->Name, $Fields, array($this->PrimaryKey => $DiscussionID));
                 setValue('DiscussionID', $Fields, $DiscussionID);
                 LogModel::logChange('Edit', 'Discussion', (array) $Fields, $Stored);
                 if (val('CategoryID', $Stored) != val('CategoryID', $Fields)) {
                     $StoredCategoryID = val('CategoryID', $Stored);
                 }
             } else {
                 // Inserting.
                 if (!val('Format', $Fields) || c('Garden.ForceInputFormatter')) {
                     $Fields['Format'] = c('Garden.InputFormatter', '');
                 }
                 if (c('Vanilla.QueueNotifications')) {
                     $Fields['Notified'] = ActivityModel::SENT_PENDING;
                 }
                 // Check for approval
                 $ApprovalRequired = checkRestriction('Vanilla.Approval.Require');
                 if ($ApprovalRequired && !val('Verified', Gdn::session()->User)) {
                     LogModel::insert('Pending', 'Discussion', $Fields);
                     return UNAPPROVED;
                 }
                 // Create discussion
                 $this->serializeRow($Fields);
                 $DiscussionID = $this->SQL->insert($this->Name, $Fields);
                 $Fields['DiscussionID'] = $DiscussionID;
                 // Update the cache.
                 if ($DiscussionID && Gdn::cache()->activeEnabled()) {
                     $CategoryCache = array('LastDiscussionID' => $DiscussionID, 'LastCommentID' => null, 'LastTitle' => Gdn_Format::text($Fields['Name']), 'LastUserID' => $Fields['InsertUserID'], 'LastDateInserted' => $Fields['DateInserted'], 'LastUrl' => DiscussionUrl($Fields));
                     CategoryModel::setCache($Fields['CategoryID'], $CategoryCache);
                     // Clear the cache if necessary.
                     if (val('Announce', $Fields)) {
                         Gdn::cache()->remove($this->getAnnouncementCacheKey(val('CategoryID', $Fields)));
                         if (val('Announce', $Fields) == 1) {
                             Gdn::cache()->remove($this->getAnnouncementCacheKey());
                         }
                     }
                 }
                 // Update the user's discussion count.
                 $InsertUser = Gdn::userModel()->getID($Fields['InsertUserID']);
                 $this->updateUserDiscussionCount($Fields['InsertUserID'], val('CountDiscussions', $InsertUser, 0) > 100);
                 // Mark the user as participated.
                 $this->SQL->replace('UserDiscussion', array('Participated' => 1), array('DiscussionID' => $DiscussionID, 'UserID' => val('InsertUserID', $Fields)));
                 // Assign the new DiscussionID to the comment before saving.
                 $FormPostValues['IsNewDiscussion'] = true;
                 $FormPostValues['DiscussionID'] = $DiscussionID;
                 // Do data prep.
                 $DiscussionName = val('Name', $Fields, '');
                 $Story = val('Body', $Fields, '');
                 $NotifiedUsers = array();
                 $UserModel = Gdn::userModel();
                 $ActivityModel = new ActivityModel();
                 if (val('Type', $FormPostValues)) {
                     $Code = 'HeadlineFormat.Discussion.' . $FormPostValues['Type'];
                 } else {
                     $Code = 'HeadlineFormat.Discussion';
                 }
                 $HeadlineFormat = t($Code, '{ActivityUserID,user} started a new discussion: <a href="{Url,html}">{Data.Name,text}</a>');
                 $Category = CategoryModel::categories(val('CategoryID', $Fields));
                 $Activity = array('ActivityType' => 'Discussion', 'ActivityUserID' => $Fields['InsertUserID'], 'HeadlineFormat' => $HeadlineFormat, 'RecordType' => 'Discussion', 'RecordID' => $DiscussionID, 'Route' => DiscussionUrl($Fields), 'Data' => array('Name' => $DiscussionName, 'Category' => val('Name', $Category)));
                 // Allow simple fulltext notifications
                 if (c('Vanilla.Activity.ShowDiscussionBody', false)) {
                     $Activity['Story'] = $Story;
                 }
                 // Notify all of the users that were mentioned in the discussion.
                 $Usernames = getMentions($DiscussionName . ' ' . $Story);
                 // Use our generic Activity for events, not mentions
                 $this->EventArguments['Activity'] = $Activity;
                 // Notify everyone that has advanced notifications.
                 if (!c('Vanilla.QueueNotifications')) {
                     try {
                         $Fields['DiscussionID'] = $DiscussionID;
                         $this->notifyNewDiscussion($Fields, $ActivityModel, $Activity);
                     } catch (Exception $Ex) {
                         throw $Ex;
                     }
                 }
                 // Notifications for mentions
                 foreach ($Usernames as $Username) {
                     $User = $UserModel->getByUsername($Username);
                     if (!$User) {
                         continue;
                     }
                     // Check user can still see the discussion.
                     if (!$this->canView($Fields, $User->UserID)) {
                         continue;
                     }
                     $Activity['HeadlineFormat'] = t('HeadlineFormat.Mention', '{ActivityUserID,user} mentioned you in <a href="{Url,html}">{Data.Name,text}</a>');
                     $Activity['NotifyUserID'] = val('UserID', $User);
                     $ActivityModel->queue($Activity, 'Mention');
                 }
                 // Throw an event for users to add their own events.
                 $this->EventArguments['Discussion'] = $Fields;
                 $this->EventArguments['NotifiedUsers'] = $NotifiedUsers;
                 $this->EventArguments['MentionedUsers'] = $Usernames;
                 $this->EventArguments['ActivityModel'] = $ActivityModel;
                 $this->fireEvent('BeforeNotification');
                 // Send all notifications.
                 $ActivityModel->saveQueue();
             }
             // Get CategoryID of this discussion
             $Discussion = $this->getID($DiscussionID, DATASET_TYPE_OBJECT);
             $CategoryID = val('CategoryID', $Discussion, false);
             // Update discussion counter for affected categories.
             if ($Insert || $StoredCategoryID) {
                 $this->incrementNewDiscussion($Discussion);
             }
             if ($StoredCategoryID) {
                 $this->updateDiscussionCount($StoredCategoryID);
             }
             // Fire an event that the discussion was saved.
             $this->EventArguments['FormPostValues'] = $FormPostValues;
             $this->EventArguments['Fields'] = $Fields;
             $this->EventArguments['DiscussionID'] = $DiscussionID;
             $this->fireEvent('AfterSaveDiscussion');
         }
     }
     return $DiscussionID;
 }
Example #3
0
function printTravail($rang, $travail, $el, $prev)
{
    $colt = array();
    $colt[0] = 0;
    $colt[1] = 20;
    $colt[2] = $colt[3] = 8;
    $colt[5] = 7;
    $colt[7] = $colt[8] = 8;
    $colt[4] = 10;
    $colt[6] = 8;
    $colt[9] = 25;
    $str = '<table style="text-align:center" cellpadding="2"><tr style="font-weight:bold">' . '<td width="' . $colt[1] . '%"  border="1">TRAVAIL</td><td width="' . $colt[2] . '%" border="1">Points</td>' . '<td width="' . $colt[3] . '%" border="1">Coef</td><td width="' . $colt[4] . '%" border="1">Moyenne</td>' . '<td width="' . $colt[5] . '%" border="1">Rang</td><td width="' . $colt[6] . '%" border="1">MOY.CL</td>' . '<td width="' . $colt[7] . '%" border="1">Min</td><td width="' . $colt[8] . '%" border="1">Max</td>' . '<td width="' . $colt[9] . '%" border="1">Mention</td></tr>';
    $str .= '<tr><td></td><td  border="1">' . sprintf("%.2f", $rang['POINTS']) . '</td>';
    $str .= '<td  border="1">' . $rang['SUMCOEFF'] . '</td>';
    # Moyenne generale
    $str .= '<td  border="1">' . sprintf("%.2f", $rang['MOYGENERALE']) . '</td>';
    # Rang sequentielle
    $expo = "<sup>&egrave;me</sup>";
    if ($rang['RANG'] == 1) {
        $expo = '<sup>' . ($el['SEXE'] == "F" ? "&egrave;re" : "er") . '</sup>';
    }
    $execo = "";
    if ($rang['RANG'] == $prev) {
        $execo = "ex";
    }
    $str .= '<td  border="1">' . $rang['RANG'] . $expo . ' ' . $execo . '</td>';
    # Moyenne generale de la classe
    $str .= '<td  border="1">' . sprintf("%.2f", $travail['MOYCLASSE']) . '</td>';
    #Moyenne Min de la classe
    $str .= '<td  border="1">' . sprintf("%.2f", $travail['MOYMIN']) . '</td>';
    #Moyenne Max de la classe
    $str .= '<td  border="1">' . sprintf("%.2f", $travail['MOYMAX']) . '</td>';
    # Mention en fonction de la moyenne generale
    $mention = getMentions($rang['MOYGENERALE']);
    if (strlen($mention) > 20) {
        $str .= '<td  border="1" style="font-size:5px">' . $mention . '</td>';
    } else {
        $str .= '<td  border="1" >' . $mention . '</td>';
    }
    $str .= '</tr></table>';
    return $str;
}
Example #4
0
function printTravailTrimestre($rang, $travail, $prev, $seq1, $seq2)
{
    $col = [0, 11, 6, 20, 20, 7, 7, 20, 6, 5];
    $ordretrimestre = 3;
    if ($seq1['ORDRE'] === 1) {
        $ordretrimestre = 1;
    } elseif ($seq1['ORDRE'] === 3) {
        $ordretrimestre = 2;
    }
    $corps = '<table>' . '<tr style="background-color:#CCC;font-weight:bold;text-align:center;font-size:8px">' . '<td border="1" width="' . $col[1] . '%" style="background-color:#FFF">TRAVAIL</td>' . '<td border="1" align="center"  width="' . $col[5] . '%">Points</td>' . '<td border="1" align="center"  width="' . $col[9] . '%">Coef</td>' . '<td colspan="3" border="1" align="center" width="' . $col[3] . '%">Moyenne</td>' . '<td colspan="3" border="1" align="center" width="' . $col[4] . '%">RANG</td>' . '<td border="1" align="center"  width="' . $col[5] . '%">Moy.CL</td>' . '<td border="1" align="center"  width="' . $col[8] . '%">MIN</td>' . '<td border="1" align="center"  width="' . $col[8] . '%">MAX</td>' . '<td border="1" align="center"  width="' . $col[7] . '%">Mention</td>' . '</tr>' . '<tr align="center" style="text-align:center;font-weight:bold;font-size:10px"><td></td>' . '<td border="1" rowspan="2" style="line-height:21px" width="' . $col[5] . '%">' . sprintf("%.2f", $rang['POINTS']) . '</td>' . '<td border="1" rowspan="2" style="line-height:21px" width="' . $col[9] . '%">' . sprintf("%.0f", $rang['SUMCOEFF']) . '</td>' . '<td border="1"  width="' . $col[2] . '%" style="font-size:6px">SEQ' . $seq1['ORDRE'] . '</td>' . '<td border="1" width="' . $col[2] . '%" style="font-size:6px">SEQ' . $seq2['ORDRE'] . '</td>' . '<td border="1" width="' . ($col[2] + 2) . '%" style="font-size:6px">TRIM' . $ordretrimestre . '</td>' . '<td border="1" width="' . $col[2] . '%" style="font-size:6px">SEQ' . $seq1['ORDRE'] . '</td>' . '<td border="1" width="' . $col[2] . '%" style="font-size:6px">SEQ' . $seq2['ORDRE'] . '</td>' . '<td border="1" width="' . ($col[2] + 2) . '%" style="font-size:6px">TRIM' . $ordretrimestre . '</td>' . '<td border="1" rowspan="2" style="line-height:21px" width="' . $col[5] . '%">' . sprintf("%.2f", $travail['MOYCLASSE']) . '</td>' . '<td border="1" rowspan="2" style="line-height:21px" width="' . $col[8] . '%">' . sprintf("%.2f", $travail['MOYMIN']) . '</td>' . '<td border="1" rowspan="2" style="line-height:21px" width="' . $col[8] . '%">' . sprintf("%.2f", $travail['MOYMAX']) . '</td>';
    # MENTION
    $mention = getMentions($rang['MOYGENERALE']);
    $corps .= '<td  border="1" rowspan="2"  width="' . $col[7] . '%" >' . $mention . '</td>';
    $corps .= '</tr>';
    $corps .= '<tr align="center"><td></td>' . '<td border="1">' . sprintf("%.2f", $seq1['MOYGENERALE']) . '</td>' . '<td border="1">' . sprintf("%.2f", $seq2['MOYGENERALE']) . '</td>' . '<td border="1" style="background-color:#CCC;"><b>' . sprintf("%.2f", $rang['MOYGENERALE']) . '</b></td>' . '<td border="1">' . $seq1['RANG'] . '<sup>e</sup></td>' . '<td border="1">' . $seq2['RANG'] . '<sup>e</sup></td>';
    # Rang TRIMESTRIEL
    $expo = "<sup>&egrave;me</sup>";
    if ($rang['RANG'] == 1) {
        $expo = '<sup>' . ($rang['SEXEEL'] == "F" ? "&egrave;re" : "er") . '</sup>';
    }
    $execo = "";
    if ($rang['RANG'] == $prev) {
        $execo = "ex";
    }
    $corps .= '<td border="1" style="background-color:#CCC;"><b>' . $rang['RANG'] . $expo . ' ' . $execo . '</b></td>' . '</tr></table>';
    return $corps;
}
Example #5
0
function printMoyRangAnnuel($rang, $prev, $moyclasse, $moymax, $moymin)
{
    $colt = [15, 15, 15, 15, 15, 29];
    $str = '<table style="text-align:center"><tr style="font-weight:bold;line-height:12px;font-size:8px">
            <td border="1" rowspan="2" width="' . $colt[0] . '%">Moyenne Annuelle</td>
            <td border="1" rowspan="2" width="' . $colt[1] . '%">Rang Annuel</td>
            <td border="1" rowspan="2" width="' . $colt[2] . '%">Moyenne Classe</td>
            <td border="1" rowspan="2" width="' . $colt[3] . '%">Moyenne Max</td>
            <td border="1" rowspan="2" width="' . $colt[4] . '%">Moyenne Min</td>
      <td border="1" width="' . $colt[5] . '%">Appr&eacute;ciation</td></tr>';
    $mention = getMentions($rang['MOYGENERALE']);
    $str .= '<tr>
              <td style="line-height:7px;font-size:8px" border="1" rowspan = "2" width="' . $colt[5] . '%">' . $mention . '</td></tr>';
    # Moyenne generale
    $str .= '<tr  style="font-weight:bold;line-height:12px;font-size:8px">
              <td  border="1" style="background-color:#CCC" width="' . $colt[0] . '%">' . sprintf("%.2f", $rang['MOYGENERALE']) . '</td>';
    # Rang Annuelle
    $expo = "<sup>&egrave;me</sup>";
    if ($rang['RANG'] == 1) {
        $expo = '<sup>' . ($rang['SEXEEL'] == "F" ? "&egrave;re" : "er") . '</sup>';
    }
    $execo = "";
    if ($rang['RANG'] == $prev) {
        $execo = "ex";
    }
    $str .= '<td width="' . $colt[1] . '%" border="1" style="background-color:#CCC">' . $rang['RANG'] . $expo . ' ' . $execo . '</td>';
    $str .= '<td border="1">' . sprintf("%.2f", $moyclasse) . '</td>' . '<td border="1">' . sprintf("%.2f", $moymax) . '</td>' . '<td border="1">' . sprintf("%.2f", $moymin) . '</td></tr></table>';
    return $str;
}