Beispiel #1
0
 * @author    Johan Cwiklinski <*****@*****.**>
 * @copyright 2004-2014 The Galette Team
 * @license   http://www.gnu.org/licenses/gpl-3.0.html GPL License 3.0 or (at your option) any later version
 * @version   SVN: $Id: picture.php 877 2011-06-01 06:08:18Z trashy $
 * @link      http://galette.tuxfamily.org
 * @since     Available since 0.62
 */
/** @ignore */
require_once 'includes/galette.inc.php';
//we do not check if user is logged to display main logo
if (isset($_GET['logo']) && $_GET['logo'] == 'true') {
    $logo->display();
} else {
    if (isset($_GET['print_logo']) && $_GET['print_logo'] == 'true') {
        //displays the logo for printing
        $print_logo = new Galette\Core\PrintLogo();
        $print_logo->display();
    } else {
        //displays the picture
        $id_adh = (int) $_GET['id_adh'];
        $deps = array('picture' => true, 'groups' => false, 'dues' => false);
        //if loggedin user is a group manager, we have to check
        //he manages a group requested member belongs to.
        if ($login->isGroupManager()) {
            $deps['groups'] = true;
        }
        $adh = new Galette\Entity\Adherent($id_adh, $deps);
        $is_manager = false;
        if (!$login->isAdmin() && !$login->isStaff() && $login->isGroupManager()) {
            $groups = $adh->groups;
            foreach ($groups as $group) {
Beispiel #2
0
}
$m = new Members();
$members = $m->getArrayList($mailing_adh, array('nom_adh', 'prenom_adh'), true);
if (!is_array($members) || count($members) < 1) {
    Analog::log('An error has occured, unable to get members list.', Analog::ERROR);
    die;
}
// Set PDF headings
$doc_title = _T("Member's Cards");
$doc_subject = _T("Generated by Galette");
$doc_keywords = _T("Cards");
// Get fixed data from preferences
// and convert strings to utf-8 for tcpdf
$an_cot = '<strong>' . $preferences->pref_card_year . '</strong>';
$abrev = '<strong>' . $preferences->pref_card_abrev . '</strong>';
$print_logo = new Galette\Core\PrintLogo();
if ($logo->hasPicture()) {
    $logofile = $print_logo->getPath();
    // Set logo size to max width 30 mm or max height 25 mm
    $ratio = $print_logo->getWidth() / $print_logo->getHeight();
    if ($ratio < 1) {
        if ($print_logo->getHeight() > 16) {
            $hlogo = 25;
        } else {
            $hlogo = $print_logo->getHeight();
        }
        $wlogo = round($hlogo * $ratio);
    } else {
        if ($print_logo->getWidth() > 16) {
            $wlogo = 30;
        } else {
Beispiel #3
0
 /**
  * Draws PDF page header
  *
  * @param string $title Additionnal title to display just after logo
  *
  * @return void
  */
 function PageHeader($title = null)
 {
     if (isset($this->_model)) {
         $html = null;
         if (trim($this->_model->hstyles) !== '') {
             $html .= "<style>\n" . $this->_model->hstyles . "\n</style>\n\n";
         }
         $html .= $this->_model->hheader;
         $this->writeHtml($html, true, false, true, false, '');
         if (trim($this->_model->title) !== '') {
             $htitle = '';
             if (trim($this->_model->hstyles) !== '') {
                 $htitle .= "<style>\n" . $this->_model->hstyles . "\n</style>\n\n";
             }
             $htitle .= '<div id="pdf_title">' . $this->_model->htitle . '</div>';
             $this->writeHtml($htitle);
         }
         if (trim($this->_model->subtitle) !== '') {
             $hsubtitle = '';
             if (trim($this->_model->hstyles) !== '') {
                 $hsubtitle .= "<style>\n" . $this->_model->hstyles . "\n</style>\n\n";
             }
             $hsubtitle .= '<div id="pdf_subtitle">' . $this->_model->hsubtitle . '</div>';
             $this->writeHtml($hsubtitle);
         }
         if (trim($this->_model->title) !== '' || trim($this->_model->subtitle) !== '') {
             $this->Ln(5);
         }
     } else {
         //default header
         $print_logo = new \Galette\Core\PrintLogo();
         if ($print_logo->hasPicture()) {
             $logofile = $print_logo->getPath();
             // Set logo size to max width 30 mm or max height 25 mm
             $ratio = $print_logo->getWidth() / $print_logo->getHeight();
             if ($ratio < 1) {
                 if ($print_logo->getHeight() > 16) {
                     $hlogo = 25;
                 } else {
                     $hlogo = $print_logo->getHeight();
                 }
                 $wlogo = round($hlogo * $ratio);
             } else {
                 if ($print_logo->getWidth() > 16) {
                     $wlogo = 30;
                 } else {
                     $wlogo = $print_logo->getWidth();
                 }
                 $hlogo = round($wlogo / $ratio);
             }
         }
         $this->SetFont(self::FONT, 'B', self::FONT_SIZE + 4);
         $this->SetTextColor(0, 0, 0);
         $y = $this->GetY();
         $this->Ln(2);
         $ystart = $this->GetY();
         $this->Cell(0, 6, $this->preferences->pref_nom, 0, 1, 'L', 0, $this->preferences->pref_website);
         $this->SetFont(self::FONT, 'B', self::FONT_SIZE + 2);
         if ($title !== null) {
             $this->Cell(0, 6, $title, 0, 1, 'L', 0);
         }
         $yend = $this->getY();
         //store position at the end of the text
         $this->SetY($ystart);
         $x = 190 - $wlogo;
         //right align
         $this->Image($logofile, $x, $this->GetY(), $wlogo, $hlogo);
         $this->y += $hlogo + 3;
         //if position after logo is < than position after text,
         //we have to change y
         if ($this->getY() < $yend) {
             $this->setY($yend);
         }
     }
 }