| Server IP : 195.130.67.5 / Your IP : 216.73.217.154 Web Server : Microsoft-IIS/10.0 System : Windows NT WEBSERVER1 10.0 build 17763 (Windows Server 2016) i586 User : IUSR ( 0) PHP Version : 7.4.19 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /inetpub/wwwroot/icd/components/com_staffmaster/helper/ |
Upload File : |
<?php
/**
* File: smutilityhelper.php
*
* Staff Master 1.0 RC 1
*
* Staff Master - Staff Members and Departments Manager
*
* @version 1.0.rc.1
* @package StaffMaster_1_0_rc_1
* @subpackage: frontend_helper
* @copyright (C) 2007-2008 Travis Hubbard
* @license http://www.gnu.org/licenses/ GNU/GPL v3
* @link http://www.systemsunited.net/
**/
class SMUtilityHelper
{
/**
* Creates the Title for the HTML Document
*
* @param String $page_title get page name
* @param String $dept_title get department name if any
* @param String $staff_title get staff name if any
* @return String $ret_docTitle returns parsed document title
*/
function createDocTitle( $page_title , $dept_title = '' , $staff_title = '' )
{
$DOC_TITLE_SEPARATOR = ' - ';
$ret_docTitle = $page_title;
if( !empty( $dept_title ) )
$ret_docTitle .= $DOC_TITLE_SEPARATOR . $dept_title;
if( !empty( $staff_title ) )
$ret_docTitle .= $DOC_TITLE_SEPARATOR . $staff_title;
return $ret_docTitle;
}
/**
* setHeader takes params then outputs appropriate stylesheets and javascripts for the specific view
*
* @param object $params params/settings model object
* @param string $view which view is calling this function
* @param string $docTitle title for the HTML document
* @param string $layout_style view style clean/default
*/
function setHeader( $params , $view , $docTitle , $layout_style ) {
global $option , $mainframe;
$document =& JFactory::getDocument();
/**
* To Append Staff Master Document Title to Current Title::
*/
// UNCOMMENT THESE 3 LINES
//$title = $document->getTitle();
//$title .= ' - ' . $docTitle;
//$document->setTitle( $title );
// AND COMMENT/DELETE THE FOLLOWING 1 LINE
$document->setTitle( $docTitle );
$use_js = $params->use_js_frontend;
$contact = $params->use_js_contact;
$roundedCorners = $params->use_js_corners ;
jimport( 'joomla.environment.browser' );
$browser = new JBrowser();
$currentBrowser = $browser->getBrowser();
$css_file_path = 'components/' . $option . '/css/' ;
$css_file_name = 'staffmaster_default.css';
JHTML::stylesheet( $css_file_name , $css_file_path );
if( $layout_style == 'clean' )
{
$css_file_name = 'staffmaster_' . $layout_style . '.css';
JHTML::stylesheet( $css_file_name , $css_file_path );
}
if( $currentBrowser == "msie" )
{
$stylesheet_browser = 'staffmaster_' . $currentBrowser . '.css';
JHTML::stylesheet( $stylesheet_browser , $css_file_path );
// Check which IE Version we are dealing with
$browserVersion = $browser->getMajor();
if( $browserVersion <= 7 )
{
$stylesheet_browser = 'staffmaster_' . $currentBrowser . '_lte7.css';
JHTML::stylesheet( $stylesheet_browser , $css_file_path );
}
// to cover IE5/6 styles
if( $browserVersion <= 6 )
{
$stylesheet_browser = 'staffmaster_' . $currentBrowser . '_lte6.css';
JHTML::stylesheet( $stylesheet_browser , $css_file_path );
}
}
if( $currentBrowser == "opera" )
{
$stylesheet_browser = 'staffmaster_' . $currentBrowser . '.css';
JHTML::stylesheet( $stylesheet_browser , $css_file_path );
}
if( $currentBrowser == "konqueror" )
{
$stylesheet_browser = 'staffmaster_' . $currentBrowser . '.css';
JHTML::stylesheet( $stylesheet_browser , $css_file_path );
}
if( $view == 'staff' )
{
$css_file_name = 'staffmaster_staff.css';
JHTML::stylesheet( $css_file_name , $css_file_path );
if( $currentBrowser == 'opera' )
{
$css_file_name = 'staffmaster_staff_opera.css';
JHTML::stylesheet( $css_file_name , $css_file_path );
}
}
if( $use_js && $browser->hasFeature('javascript') )
{
$slide_mode = "vertical";
if( $params->staff_image_pos == 'right' )
$read_contact_class = 'read_contact_left';
else
$read_contact_class = 'read_contact_right';
// Load the moo.fx scripts
$document->addScript( $mainframe->getCfg('live_site') . '/media/system/js/mootools.js' );
// Add a script declaration as well
$document->addScriptDeclaration("
window.addEvent('domready', function(){
$$( '.sm_contact_div_wrapper' ).each( function(item){
var thisSlider = new Fx.Slide( item.getElement( '.sm_contact_div' ) , { duration: 500 } );
thisSlider.hide();
if( item.getElement( 'a." . $read_contact_class ."' ) )
{
item.getElement( 'a." . $read_contact_class ."' ).addEvent( 'click', function(){
thisSlider.toggle();
});
}
});});"
);
}
}
/**
* takes in the source path of the image and returns the width / height
*
* @param string $src path
* @return object $img width and height
*/
function getImageSize( $src )
{
if( file_exists( $src ) )
{
$image_dimensions = getimagesize( $src );
$img->width = $image_dimensions[ 0 ];
$img->height = $image_dimensions[ 1 ];
return $img;
}
else
return false;
}
/**
* Helper Function to Create src="" text for the image
*
* @param String $path path
* @param String $file_name this staff's image name
* @param String $default_image default image name
* @return String $image_src source path for image
*/
function createImageSource( $path , $file_name , $default_image )
{
global $option;
$image_src = $path;
if( empty( $file_name ) )
{
if( empty( $default_image ) )
{
$image_src = SM_DEFAULT_IMAGE;
}
else
{
if( $default_image == SM_DEFAULT_IMAGE_NAME )
$image_src = SM_DEFAULT_IMAGE;
else
$image_src .= $default_image;
}
}
else
{
$image_src .= $file_name;
}
if( substr( $image_src , 0 , 4 ) != 'http' && substr( $image_src , 0 , 1 ) != '/' )
$image_src = '/' . $image_src;
return $image_src;
}
/**
* Helper Function to Create src="" text for the image
*
* @param String $path path
* @param String $file_name this staff's image name
* @param String $default_image default image name
* @return String $image_src source path for image
*/
function createImageAbsoluteSource( $path , $file_name , $default_image )
{
global $option;
$image_src = JPATH_SITE . DS . $path . DS;
if( empty( $file_name ) )
{
if( empty( $default_image ) )
{
$image_src = SM_DEFAULT_IMAGE;
}
else
{
if( $default_image == SM_DEFAULT_IMAGE_NAME )
$image_src = SM_DEFAULT_IMAGE;
else
$image_src .= $default_image;
}
}
else
{
$image_src .= $file_name;
}
if( substr( $image_src , 0 , 4 ) != 'http' && substr( $image_src , 0 , 1 ) != '/' )
$image_src = '/' . $image_src;
return $image_src;
}
/**
* Helper Function to set Pathway/Breadcrumbs
*
* @param String $page_title
* @param String $dept_name
* @param String $dept_alias
* @param String $staff_name
* @param String $staff_alias
*/
function setPathway( $page_title , $dept_name = '' , $dept_alias = '' , $staff_name = '' , $staff_alias = '' )
{
global $option , $mainframe;
$pathway = &$mainframe->getPathway();
$link_page = JRoute::_( 'index.php?option=' . $option . '&view=all' );
$pathway->setItemName( 1 , $page_title , $link_page );
if( !empty( $dept_name ) )
{
$link_dept = JRoute::_( 'index.php?option=' . $option . '&view=department&name=' . $dept_alias );
$pathway->addItem( $dept_name , $link_dept );
}
if( !empty( $staff_name ) )
{
$link_staff = JRoute::_( 'index.php?option=' . $option . '&view=staff&name=' . $staff_alias );
$pathway->addItem( $staff_name , $link_staff );
}
}
}
?>