Skip to content
Snippets Groups Projects
Select Git revision
  • e17c31fcf5242ff3c09ae19f66555b59c3ec0ced
  • master default protected
  • simple-task/7248-eol-check-add-node-22
  • 6877_check_iml_deployment
4 results

check_disk-io

Blame
  • project_gui.class.php 76.06 KiB
    <?php
    
    require_once 'project.class.php';
    require_once 'htmlguielements.class.php';
    
    
    /* ######################################################################
    
      IML DEPLOYMENT
    
      class project for all actions for single project
      Rendering of web ui
    
      ---------------------------------------------------------------------
      2013-11-08  Axel <axel.hahn@iml.unibe.ch>
      ###################################################################### */
    
    /**
     * class for single project
     */
    // class project {
    class projectgui extends project {
    
        /**
         * constructor
         * @param string $sId  id of the project
         */
        public function __construct($sId = false) {
            parent::__construct($sId);
            $this->_oHtml = new htmlguielements();
        }
    
        // ----------------------------------------------------------------------
        // private functions
        // ----------------------------------------------------------------------
    
        /**
         * return html code for a div with background color based on a checksum of the given text
         * @param string $sText      text that is used for checksum; if false ist returns a gray
         * @param string $sContent   optional: text to show
         * @return string
         */
        private function _getChecksumDiv($sText, $sContent='') {
            if ($sText){
                
                // color ranges in decimal values for RGB from ... to
                $iFgStart=60;  $iFgEnd=160;
                $iBgStart=200; $iBgEnd=250;
    
                // deivider: 3 digits of md5 will be extracted
                $iFgDivider=16*16*16/($iFgEnd-$iFgStart);
                $iBgDivider=16*16*16/($iBgEnd-$iBgStart);
                
                $sHash=md5($sText);
                $sColor=''
                    . 'color: rgba(' 
                    . ($iFgStart + round(hexdec(substr($sHash,0,3))/$iFgDivider)) . ','
                    . ($iFgStart + round(hexdec(substr($sHash,3,3))/$iFgDivider)) . ','
                    . ($iFgStart + round(hexdec(substr($sHash,6,3))/$iFgDivider)) . ','
                    . '1'
                    . ');'
                    . 'background: rgba(' 
                    . ($iBgStart + round(hexdec(substr($sHash,0,3))/$iBgDivider)) . ','
                    . ($iBgStart + round(hexdec(substr($sHash,3,3))/$iBgDivider)) . ','
                    . ($iBgStart + round(hexdec(substr($sHash,6,3))/$iBgDivider)) . ','
                    . '1'
                    . ');'
                    ;
            } else {
                $sColor = "color: #888; background: #ccc;";