Exemplo n.º 1
0
<?php

if (cfr('PLDOCS')) {
    $altcfg = $ubillingConfig->getAlter();
    if ($altcfg['DOCX_SUPPORT']) {
        $documents = new ProfileDocuments();
        $date = wf_CheckPost(array('showdate')) ? $_POST['showdate'] : '';
        $documents->loadAllUsersDocuments($date);
        //existing document downloading
        if (wf_CheckGet(array('documentdownload'))) {
            zb_DownloadFile($documents::DOCUMENTS_PATH . $_GET['documentdownload'], 'docx');
        }
        //document deletion from database
        if (wf_CheckGet(array('deletedocument'))) {
            $documents->unregisterDocument($_GET['deletedocument']);
            rcms_redirect('?module=report_documents');
        }
        //controls
        $actionLinks = wf_Link('?module=report_documents', __('Grid view') . ' ' . wf_img('skins/icon_table.png'), false, 'ubButton');
        $actionLinks .= wf_Link('?module=report_documents&calendarview=true', __('As calendar') . ' ' . wf_img('skins/icon_calendar.gif'), false, 'ubButton');
        show_window('', $actionLinks);
        if (!wf_CheckGet(array('calendarview'))) {
            //show calendar control
            show_window(__('By date'), $documents->dateControl());
            //list available documents
            show_window(__('Previously generated documents'), $documents->renderAllUserDocuments());
        } else {
            //or calendar view
            show_window(__('Previously generated documents'), $documents->renderAllUserDocumentsCalendar());
        }
    } else {
Exemplo n.º 2
0
                 show_window('', wf_Link('?module=pl_documents&username='******'&addtemplate', 'Create new document template', true, 'ubButton'));
             } else {
                 show_window('', wf_Link('?module=pl_documents&username='******'Back', true, 'ubButton'));
             }
             zb_DocsShowAllTemplates($login);
             show_window('', web_UserControls($login));
         } else {
             //document print subroutine
             $parsed_template = zb_DocsParseTemplate($_GET['printtemplate'], $login);
             print $parsed_template;
             die;
         }
     }
 } else {
     //new docx templates processing
     $documents = new ProfileDocuments();
     if (wf_CheckGet(array('username'))) {
         $documents->setLogin($_GET['username']);
     }
     //template printing subroutine
     if (wf_CheckGet(array('print'))) {
         //back link
         show_window('', wf_Link('?module=pl_documents&username='******'Back', true, 'ubButton'));
         $docId = vf($_GET['print'], 3);
         $availableTemplates = $documents->getTemplates();
         $templatePath = $documents::TEMPLATES_PATH;
         $documentsSavePath = $documents::DOCUMENTS_PATH;
         $templateFile = $availableTemplates[$docId]['path'];
         $templateName = $availableTemplates[$docId]['name'];
         $fullPath = $templatePath . $templateFile;
         $saveFileName = $documents->getLogin() . '_' . $docId . '_' . zb_rand_string(8) . '.docx';