コード例 #1
0
ファイル: PrintingExtension.php プロジェクト: tchern0/LabDB
 /**
  * Check if printing is enabled
  *
  * @return boolean
  */
 public function canPrintFunction()
 {
     $host = $this->printHost;
     $queue = $this->printQueue;
     if (null !== $host && null !== $queue) {
         try {
             $ipp = new CupsPrintIPP();
             $ipp->setLog('', 0, 0);
             $ipp->setHost($host);
             $ipp->setPrinterURI($queue);
             $ipp->getPrinterAttributes();
             return implode('\\n', $ipp->status) == 'successfull-ok';
         } catch (IPPException $e) {
         }
     }
     return false;
 }
コード例 #2
0
ファイル: PrintController.php プロジェクト: tchern0/LabDB
 /**
  * Check if printer is available
  *
  * @return boolean
  */
 protected function canPrint()
 {
     $host = $this->container->getParameter('print_host', null);
     $queue = $this->container->getParameter('print_queue', null);
     if (null !== $host && null !== $queue) {
         try {
             $ipp = new CupsPrintIPP();
             $ipp->setLog('', 0, 0);
             $ipp->setHost($host);
             $ipp->setPrinterURI($queue);
             $ipp->getPrinterAttributes();
             return implode('\\n', $ipp->status) == 'successfull-ok';
         } catch (IPPException $e) {
         }
     }
     return false;
 }