2010-12-02 23:34:41 +00:00
|
|
|
<?php
|
2012-10-09 13:18:09 -04:00
|
|
|
|
2010-12-02 23:34:41 +00:00
|
|
|
/**
|
2012-10-09 13:18:09 -04:00
|
|
|
*
|
2011-02-01 12:49:40 +00:00
|
|
|
* @package workflow.engine.classes
|
|
|
|
|
*/
|
2017-08-11 13:29:22 -04:00
|
|
|
class ReplacementLogo
|
2012-10-09 13:18:09 -04:00
|
|
|
{
|
|
|
|
|
/**
|
2017-08-11 13:29:22 -04:00
|
|
|
* This function is the constructor of the ReplacementLogo class
|
2012-10-09 13:18:09 -04:00
|
|
|
* param
|
|
|
|
|
*
|
|
|
|
|
* @return void
|
|
|
|
|
*/
|
2019-08-02 15:57:22 -04:00
|
|
|
public function __construct()
|
2012-10-09 13:18:09 -04:00
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* This function upload a file
|
|
|
|
|
*
|
|
|
|
|
*
|
|
|
|
|
* @name upLoadFile
|
|
|
|
|
*
|
|
|
|
|
* @param string $dirUpload
|
|
|
|
|
* @param string $namefile
|
|
|
|
|
* @param string $typefile
|
|
|
|
|
* @param string $errorfile
|
|
|
|
|
* @param string $tpnfile
|
|
|
|
|
* @param string $formf
|
|
|
|
|
* @return string
|
|
|
|
|
*/
|
|
|
|
|
public function upLoadFile ($dirUpload, $namefile, $typefile, $errorfile, $tpnfile, $formf)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
//we are cheking the extension for file
|
|
|
|
|
$aExt = explode( ".", $namefile );
|
|
|
|
|
$infoupload = ''; //|| ($formf["type"]['uploadfile'] == "application/octet-stream")image/png
|
|
|
|
|
if (($typefile == "image/jpeg") || ($typefile == "image/png")) {
|
|
|
|
|
if ($errorfile > 0) {
|
|
|
|
|
$infoupload = "Return Code: " . $errorfile . "<br />";
|
|
|
|
|
} else {
|
|
|
|
|
if (file_exists( $dirUpload . $namefile )) {
|
|
|
|
|
$infoupload = $namefile . " already exist. ";
|
|
|
|
|
} else {
|
|
|
|
|
move_uploaded_file( $tpnfile, $dirUpload . $namefile );
|
|
|
|
|
$infoupload = "Stored in: " . $dirUpload . $namefile;
|
|
|
|
|
}
|
|
|
|
|
}
|
2010-12-02 23:34:41 +00:00
|
|
|
} else {
|
2012-10-09 13:18:09 -04:00
|
|
|
$infoupload = "- " . $typefile . " Invalid file your file should be jpeg";
|
2010-12-02 23:34:41 +00:00
|
|
|
}
|
2012-10-09 13:18:09 -04:00
|
|
|
return $infoupload;
|
2010-12-02 23:34:41 +00:00
|
|
|
}
|
|
|
|
|
|
2012-10-09 13:18:09 -04:00
|
|
|
/**
|
|
|
|
|
* This function gets the logos' names
|
|
|
|
|
*
|
|
|
|
|
*
|
|
|
|
|
* @name getNameLogo
|
|
|
|
|
*
|
|
|
|
|
* param
|
|
|
|
|
* @return array
|
|
|
|
|
*/
|
|
|
|
|
public function getNameLogo ($usrUid)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
require_once 'classes/model/Configuration.php';
|
|
|
|
|
$oCriteria = new Criteria( 'workflow' );
|
|
|
|
|
$oCriteria->addSelectColumn( ConfigurationPeer::CFG_VALUE );
|
|
|
|
|
$oCriteria->add( ConfigurationPeer::CFG_UID, 'USER_LOGO_REPLACEMENT' );
|
|
|
|
|
$oDataset = ConfigurationPeer::doSelectRS( $oCriteria );
|
|
|
|
|
$oDataset->next();
|
|
|
|
|
$aRow = $oDataset->getRow();
|
|
|
|
|
if (isset( $aRow[0] )) {
|
|
|
|
|
$ainfoLogo = @unserialize( $aRow[0] );
|
|
|
|
|
} else {
|
|
|
|
|
$ainfoLogo = null;
|
|
|
|
|
}
|
|
|
|
|
return ($ainfoLogo);
|
|
|
|
|
}
|
|
|
|
|
}
|