Exemplo n.º 1
0
/**
 * Get information about PHP
 * 
 * @param Smarty $smarty
 * @return string 
 */
function smarty_function_info_php($smarty)
{
    return Default_Plugin_SysBox::getPHPInfo();
}
Exemplo n.º 2
0
 /**
  * Action - pdf
  * сreate a PDF document using the mPDF library
  *
  * Access to the action is possible in the following paths:
  * - /admin/tools/pdf
  *
  * @return void
  */
 public function pdfAction()
 {
     $isCommonFont = false;
     $pdfParams = array();
     //---------------------
     // Получим параметры
     $params = $this->getRequest()->getParams();
     $report = $params['name'];
     // Определим параметры для конвертации HTML в PDF
     switch ($report) {
         case 'phpinfo':
             // Установим параметры для отчета
             $html = Default_Plugin_SysBox::getPHPInfo();
             $pdfParams['pdfReport'] = $report;
             $pdfParams['html'] = $html;
             $pdfParams['isCommonFont'] = true;
             $pdfParams['pathStylesheet'] = 'css/report/phpinfo.css';
             $pdfParams['headerLeftMargin'] = 'Params of PHP';
             $pdfParams['headerCentreMargin'] = Default_Plugin_SysBox::getFullURL_Res('/images/system/settings32x32.png');
             $pdfParams['footerRightMargin'] = Default_Plugin_SysBox::getFullUrl_For_FilePDF($report);
             break;
         case 'zend-progress':
             $adapter = new Zend_ProgressBar_Adapter_JsPush(array('updateMethodName' => 'BSA.Dialogs.Zend_ProgressBar_Update', 'finishMethodName' => 'BSA.Dialogs.Zend_ProgressBar_Finish'));
             $progressBar = new Zend_ProgressBar($adapter, 0, 100);
             for ($i = 1; $i <= 100; $i++) {
                 if ($i < 20) {
                     $text = 'Just beginning';
                 } else {
                     if ($i < 50) {
                         $text = 'A bit done';
                     } else {
                         if ($i < 80) {
                             $text = 'Getting closer';
                         } else {
                             $text = 'Nearly done';
                         }
                     }
                 }
                 $progressBar->update($i, $text);
                 usleep(100000);
             }
             $progressBar->finish();
             die;
             break;
         default:
             break;
     }
     // Создать PDF файл из HTML
     $urlFilePDF = Default_Plugin_SysBox::mpdfGenerator_Html2PDF($pdfParams);
     // Установим свой и предыдущий Breadcrumbs
     $Zend_Auth = Zend_Registry::get("Zend_Auth");
     $lastBreadcrumbs = $Zend_Auth->lastBreadcrumbs;
     $this->_breadcrumbs->addStep($lastBreadcrumbs['title'], $this->getUrl($lastBreadcrumbs['action'], $lastBreadcrumbs['controller'], $lastBreadcrumbs['module']));
     $this->_breadcrumbs->addStep($this->Translate('Отчет в PDF формате'));
     $this->view->urlFilePDF = $urlFilePDF;
 }