PHP Classes

d3 PHP Printer Monitoring: Display and alert about the status of a printer

Recommend this page to a friend!
     
  Info   Example   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 124 All time: 9,459 This week: 68Up
Version License PHP version Categories
d3printer 1.0.0Freeware5PHP 5, System information, Printing, H...
Description 

Author

This package can display and alert about the status of a printer.

It implements an application that can query the status of the printer to provide monitoring services.

The package can display the printer's status and alerts that can let the user know if the printer is not operating for some reason, like the need to replace the ink supply.

Innovation Award
PHP Programming Innovation award nominee
May 2021
Number 5
Many users need to print documents and graphics to printers available in their networks.

This package provides a solution to monitor the status of certain printers, so the users are aware of any issues that they need to fix or not.

Manuel Lemos
Picture of Uldis Nelsons
Name: Uldis Nelsons <contact>
Classes: 19 packages by
Country: Latvia Latvia
Age: 55
All time rank: 19466 in Latvia Latvia
Week rank: 76 Up1 in Latvia Latvia Up
Innovation award
Innovation award
Nominee: 12x

Winner: 2x

Example

<?php

use d3system\yii2\web\D3SystemView;
use
d3yii2\d3printer\logic\health\DeviceHealth;
use
d3yii2\d3printer\logic\read\ReadConfiguration;
use
eaBlankonThema\assetbundles\layout\LayoutAsset;
use
eaBlankonThema\components\FlashHelper;
use
eaBlankonThema\widget\ThAlertList;
use
eaBlankonThema\widget\ThButton;
use
eaBlankonThema\widget\ThReturnButton;
use
yii\helpers\Url;

LayoutAsset::register($this);

/**
 * @var D3SystemView $this
 * @var d3yii2\d3printer\models\AlertSettings $model
 * @var DeviceHealth $deviceHealth
 * @var ReadConfiguration $configHealth
 * @var bool $statusOk
 * @var string $status
 * @var bool $cartridgeOk
 * @var string $cartridge
 * @var bool $drumOk
 * @var string $drum
 * @var array $lastLoggedErrors;
 * @var string $printerCode;
 * @var string $component;
 */


$this->title = 'DeviceHealth info';

$this->setPageHeader($this->title);
$this->setPageIcon('');
$this->setSettingButton([
   
'alert-settings',
   
'addSectionKey' => $printerCode,
   
'component' => $component
]);

if (
$configHealth) {
   
$configAttributeLabels = $configHealth->device->attributeLabels();
}
?>
<div class="row">
    <?= ThAlertList::widget() ?>
<div class="col-md-9">
        <div class="panel rounded shadow">
            <div class="panel-body rounded-bottom">
                <h4><?= $deviceHealth->printerName ?? '' ?></h4>
                <?php if ($deviceHealth): ?>
Status: <?= $statusOk
                       
? '<span style="color:darkgreen">' . $status . '</span>'
                       
: '<span style="color:red">' . $status . '</span>'
                   
?><br>
                    Cartridge: <?= $cartridgeOk
                   
? '<span style="color:darkgreen">' . $cartridge . '</span>'
                   
: '<span style="color:red">' . $cartridge . '</span>'
                   
?><br>
                    Drum: <?= $drumOk
                       
? '<span style="color:darkgreen">' . $drum . '</span>'
                       
: '<span style="color:red">' . $drum . '</span>'
                   
?>
<?php endif; ?>
<hr>
                <?= ThButton::widget([
                   
'type' => ThButton::TYPE_PRIMARY,
                   
'label' => 'Set Printer defaults',
                   
'link' => Url::to(['set-default-settings', 'component' => Yii::$app->request->get('component')])
                ])
?>
</div>
        </div>
        <div class="panel rounded shadow">
            <div class="panel-body rounded-bottom">
                <h4>Print Settings</h4>
                <?php
               
if ($configHealth) {
                    foreach (
$configHealth->device->printSettings() as $key => $value) {
                        echo
$configAttributeLabels[$key] . ': ' . $value . '<br>';
                    }
                }
?>
</div>
        </div>
        <div class="panel rounded shadow">
            <div class="panel-body rounded-bottom">
                <h4>Paper Settings</h4>
                <?php
               
if ($configHealth) {
                    foreach (
$configHealth->device->paperSettings() as $key => $value) {
                        echo
$configAttributeLabels[$key] . ': ' . $value . '<br>';
                    }
                }
?>
</div>
        </div>
        <div class="panel rounded shadow">
            <div class="panel-body rounded-bottom">
                <h4>Energy Settings</h4>
                <?php
               
if ($configHealth) {
                    foreach (
$configHealth->device->energySettings() as $key => $value) {
                        echo
$configAttributeLabels[$key] . ': ' . $value . '<br>';
                    }
                }
?>
</div>
        </div>
        <div class="panel rounded shadow">
            <div class="panel-body rounded-bottom">
                <h4>Last Errors</h4>
                <?php
               
foreach ($lastLoggedErrors as $error) {
                    echo
str_replace(PHP_EOL, '<br>', $error) . '<hr>';
                }
?>
</div>
        </div>
    </div>
</div>


Details

Printer Monitoring"

Features

Installation

The preferred way to install this extension is through composer.

Either run

$ composer require d3yii2/d3printer "*"

or add

"d3yii2/d3printer": "*"

to the require section of your composer.json file.

Methods

Usage

Examples


  Files folder image Files (35)  
File Role Description
Files folder imageaccessRights (1 file)
Files folder imagecomponents (1 file)
Files folder imagecontrollers (2 files)
Files folder imagegii (3 files, 1 directory)
Files folder imagelogic (3 files, 4 directories)
Files folder imagemessages (1 directory)
Files folder imagemigrations (1 file)
Files folder imagemodels (2 files)
Files folder imageviews (1 directory)
Accessible without login Plain text file composer.json Data Auxiliary data
Plain text file Module.php Class Class source
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files (35)  /  accessRights  
File Role Description
  Plain text file D3PrinterFullUserRole.php Class Class source

  Files folder image Files (35)  /  components  
File Role Description
  Plain text file D3Printer.php Class Class source

  Files folder image Files (35)  /  controllers  
File Role Description
  Plain text file DeviceInfoController.php Class Class source
  Plain text file HealthCronController.php Class Class source

  Files folder image Files (35)  /  gii  
File Role Description
Files folder imaged3yii2 (1 file)
  Accessible without login Plain text file AlertSettingsGiiantSettings.json Data Auxiliary data
  Accessible without login Plain text file PrinterAccessSettingsGiiantSettings.json Data Auxiliary data
  Accessible without login Plain text file printerHealthGiiantCommand.json Data Auxiliary data

  Files folder image Files (35)  /  gii  /  d3yii2  
File Role Description
  Accessible without login Plain text file d3printerGiiantNModule.json Data Auxiliary data

  Files folder image Files (35)  /  logic  
File Role Description
Files folder imagehealth (4 files)
Files folder imageread (3 files)
Files folder imageset (4 files)
Files folder imagesettings (4 files)
  Plain text file Connect.php Class Class source
  Plain text file Logger.php Class Class source
  Plain text file Mailer.php Class Class source

  Files folder image Files (35)  /  logic  /  health  
File Role Description
  Plain text file CommonHealth.php Class Class source
  Plain text file ConfigurationHealth.php Class Class source
  Plain text file DeviceHealth.php Class Class source
  Plain text file Health.php Class Class source

  Files folder image Files (35)  /  logic  /  read  
File Role Description
  Plain text file Read.php Class Class source
  Plain text file ReadConfiguration.php Class Class source
  Plain text file ReadDevice.php Class Class source

  Files folder image Files (35)  /  logic  /  set  
File Role Description
  Plain text file Set.php Class Class source
  Plain text file SetEnergy.php Class Class source
  Plain text file SetPaper.php Class Class source
  Plain text file SetPrint.php Class Class source

  Files folder image Files (35)  /  logic  /  settings  
File Role Description
  Plain text file AlertSettings.php Class Class source
  Plain text file EnergySettings.php Class Class source
  Plain text file PaperSettings.php Class Class source
  Plain text file PrintSettings.php Class Class source

  Files folder image Files (35)  /  messages  
File Role Description
Files folder imagelv (1 file)

  Files folder image Files (35)  /  messages  /  lv  
File Role Description
  Accessible without login Plain text file d3printer.php Aux. Auxiliary script

  Files folder image Files (35)  /  migrations  
File Role Description
  Plain text file m201102_110707_cre...leD3PrinterFull.php Class Class source

  Files folder image Files (35)  /  models  
File Role Description
  Plain text file AlertSettings.php Class Class source
  Plain text file DeviceInfo.php Class Class source

  Files folder image Files (35)  /  views  
File Role Description
Files folder imagedevice-info (2 files)

  Files folder image Files (35)  /  views  /  device-info  
File Role Description
  Plain text file alert_settings.php Class Class source
  Accessible without login Plain text file index.php Example Example script

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 100%
Total:124
This week:0
All time:9,459
This week:68Up