PHP Classes

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

Recommend this page to a friend!
  Info   View files Example   View files View files (35)   DownloadInstall with Composer Download .zip   Reputation   Support forum (1)   Blog (1)    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 122 This week: 2All time: 9,466 This week: 96Up
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: 18 packages by
Country: Latvia Latvia
Age: 54
All time rank: 19736 in Latvia Latvia
Week rank: 34 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  
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  /  accessRights  
File Role Description
  Plain text file D3PrinterFullUserRole.php Class Class source

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

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

  Files folder image Files  /  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  /  gii  /  d3yii2  
File Role Description
  Accessible without login Plain text file d3printerGiiantNModule.json Data Auxiliary data

  Files folder image Files  /  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  /  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  /  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  /  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  /  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  /  messages  
File Role Description
Files folder imagelv (1 file)

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

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

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

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

  Files folder image Files  /  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

 Version Control Unique User Downloads Download Rankings  
 100%
Total:122
This week:2
All time:9,466
This week:96Up