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,460 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
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

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,460
This week:68Up