| 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/models/ |
Upload File : |
<?php
/**
* File: page.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: models
* @copyright (C) 2007-2008 Travis Hubbard
* @license http://www.gnu.org/licenses/ GNU/GPL v3
* @link http://www.systemsunited.net/
**/
defined( '_JEXEC' ) or die( 'Restricted access' );
jimport( 'joomla.application.component.model' );
/**
* Staff Model Class
* @package StaffMaster_1_0
*/
class StaffModelPage extends JModel {
var $page_title = '';
var $page_header_text = '';
var $department;
var $_dept_list;
var $_dept_total;
var $_dept_current = 0;
var $staff;
var $_staff_list;
var $_staff_total;
var $_staff_current = 0;
var $sm_footer;
// Variables for ListAllView
var $useStaffImages = null;
var $useStaffBios = null;
var $styles;
var $staff_name_class;
var $staff_bio_class;
var $staff_image_class;
var $read_contact_class;
function buildPage( $view , $params , $staff_list = null , $departments_list = null , $custom_colors = null , $attribs = null )
{
//if( $custom_colors )
// $this->createStyles( $custom_colors );
// Check PHP Version, if less than 5.0
$phpversion = version_compare( phpversion() , '5.0' );
if( $phpversion == -1 )
$phpversion = 0;
$this->page_title = $params->page_title;
$this->page_header_text = $params->header_text;
if( $params->staff_image_pos == 'right' )
{
$this->staff_name_class = 'staff_name_left';
$this->staff_bio_class = 'staff_bio_left';
$this->read_contact_class = 'read_contact_left';
}
else
{
$this->staff_name_class = 'staff_name_right';
$this->staff_bio_class = 'staff_bio_right';
$this->read_contact_class = 'read_contact_right';
}
$this->staff_image_class = 'staff_image_' . $params->staff_image_pos;
$crop_at_readmore_staff = true;
$crop_at_readmore_depts = true;
if( $view == 'staff' )
$crop_at_readmore_staff = false;
if( $view == 'department' )
$crop_at_readmore_depts = false;
if( $view == 'listall' )
{
$this->useStaffImages = $attribs['useStaffImages'];
$this->useStaffBios = $attribs['useStaffBios'];
}
if( is_array( $staff_list ) )
{
foreach( $staff_list as $key => $value )
{
if( !$phpversion )
$s =& $staff_list[ $key ];
else
$s = $value;
// IMAGE SETUP
$image_src = SMUtilityHelper::createImageSource( $params->staff_image_path , $s->image_file_name , $params->staff_image_default );
$abs_src = SMUtilityHelper::createImageAbsoluteSource( $params->staff_image_path , $s->image_file_name , $params->staff_image_default );
$w = $h = '100%';
if( $image_src )
{
$image_size = SMUtilityHelper::getImageSize( $abs_src );
if( $image_size )
{
$w = $image_size->width;
$h = $image_size->height;
}
// compile all variables to form image html
$image_attribs->src = $image_src;
$image_attribs->alt = $s->name;
$image_attribs->title = $s->name;;
$image_attribs->class = 'staff_image_' . $params->staff_image_pos;
$image_attribs->id = 'staff_image_' . $s->alias;
$image_attribs->style = '';
$image_attribs->width = $w;
$image_attribs->height = $h;
$s->image_file_name = SMOutputHelper::createImageHtml( $image_attribs );
}
if( $view != 'listall' )
{
if( !empty( $s->bio ) )
{
$s->bio = SMOutputHelper::parseReadMore( 'staff' , $s->bio , $s->alias , $crop_at_readmore_staff , $params->biodesc_replace_string );
}
else
{
$s->bio = $params->staff_bio_default;
}
}
else
{
if( $attribs['bioCrop'] )
$s->bio = SMOutputHelper::cropBios( $s , $attribs['bioLen'] );
$s->bio = SMOutputHelper::parseReadMore( 'staff' , $s->bio , $s->alias , $crop_at_readmore_staff , $params->biodesc_replace_string );
}
/**** Staff Position Setup ****/
// If there is not a staff position set for this staff member
// use the staff position default set in settings
if( $params->linkable_staff_name )
{
$s->name = SMOutputHelper::createNameLink( $view , 'staff' , $s->name , $s->alias , $custom_colors['staff_name_style'] );
}
$title = '';
if( empty( $s->title ) )
$title = $params->staff_title_default;
else
$title = $s->title;
$s->title = SMOutputHelper::createStaffTitleHtml( $params->title_in_bio , $custom_colors['staff_title_style'] , $title );
$s->contact = SMOutputHelper::createContactInfo( $params , $s );
if( !$phpversion )
$staff_list[ $key ] = $s;
else
$value = $s;
}
}
else
{
$image_src = SMUtilityHelper::createImageSource( $params->staff_image_path , $staff_list->image_file_name , $params->staff_image_default );
// compile all variables to form image html
$image_attribs->src = $image_src;
$image_attribs->alt = $staff_list->name;
$image_attribs->title = $staff_list->name;;
$image_attribs->class = 'staff_image_' . $params->staff_image_pos;
$image_attribs->id = 'staff_image_' . $staff_list->alias;
$image_attribs->style = '';
$image_attribs->width = '';
$image_attribs->height = '';
$staff_list->image_file_name = SMOutputHelper::createImageHtml( $image_attribs );
/**** Staff Bio Setup ****/
// If there is not a staff bio set for this staff member
// use the staff bio default set in settings
if( !empty( $staff_list->bio ) )
{
$staff_list->bio = SMOutputHelper::parseReadMore( 'staff' , $staff_list->bio , $staff_list->alias , $crop_at_readmore_staff , $params->biodesc_replace_string );
}
else
{
$staff_list->bio = $params->staff_bio_default;
}
/**** Staff Position Setup ****/
// If there is not a staff position set for this staff member
// use the staff position default set in settings
if( $params->linkable_staff_name )
{
$staff_list->name = SMOutputHelper::createNameLink( $view , 'staff' , $staff_list->name , $staff_list->alias , $custom_colors['staff_name_style'] );
}
$title = '';
if( empty( $staff_list->title ) )
$title = $params->staff_title_default;
else
$title = $staff_list->title;
$staff_list->title = SMOutputHelper::createStaffTitleHtml( $params->title_in_bio , $custom_colors['staff_title_style'] , $title );
$staff_list->contact = SMOutputHelper::createContactInfo( $params , $staff_list );
}
if( is_array( $departments_list ) )
{
foreach( $departments_list as $key => $value )
{
if( !$phpversion )
$d =& $departments_list[ $key ];
else
$d = $value;
if( $view != 'department' )
{
if( $params->linkable_department )
{
$d->name = SMOutputHelper::createNameLink( $view , 'department' , $d->name , $d->alias , $custom_colors[ 'dept_name_style' ] );
}
if( !empty( $d->description ) )
{
$d->description = SMOutputHelper::parseReadMore( 'department' , $d->description , $d->alias , $crop_at_readmore_depts , $params->biodesc_replace_string );
}
else
{
$d->description = '';
}
}
if( !$phpversion )
$departments_list[ $key ] = $d;
else
$value = $d;
}
}
else
{
if( $params->linkable_department && $view != 'department' )
{
$departments_list->name = SMOutputHelper::createNameLink( $view , 'department' , $departments_list->name , $departments_list->alias , $custom_colors[ 'dept_name_style' ] );
}
else
{
$departments_list->name = $departments_list->name;
}
if( !empty( $departments_list->description ) )
{
$departments_list->description = SMOutputHelper::parseReadMore( 'department' , $departments_list->description , $departments_list->alias , $crop_at_readmore_depts , $params->biodesc_replace_string );
}
else
{
$departments_list->description = '';
}
}
$this->_staff_list = $staff_list;
$this->_staff_total = count( $this->_staff_list );
$this->_dept_list =& $departments_list;
$this->_dept_total = count( $this->_dept_list );
if( $this->_staff_total )
{
if( $this->_staff_total > 1 )
$this->staff = $this->_staff_list[ $this->_staff_current ];
else
$this->staff = $this->_staff_list;
if( is_array( $this->staff ) )
$this->staff = $this->staff[0];
}
if( $this->_dept_total )
{
if( $this->_dept_total > 1 )
$this->department = $this->_dept_list[ $this->_dept_current ];
else
$this->department = $this->_dept_list;
if( is_array( $this->department ) )
$this->department = $this->department[0];
}
$this->sm_footer = SMOutputHelper::createPoweredByTag( $params->version );
}
function buildErrorPage( $error_screen )
{
global $mainframe;
JHTML::stylesheet( 'staffmaster_error.css' , $mainframe->getCfg('live_site') . SDS . 'components' . SDS . 'com_staffmaster' . SDS . 'css' . SDS);
echo '<div class="staffmaster_error">';
echo JText::_( 'VERROR' );
echo '</div>';
}
function getNextStaff()
{
$this->_staff_current++;
// Test if there is another staff member
if( $this->_staff_current < $this->_staff_total )
{
$this->staff =& $this->staff;
$this->_staff_list =& $this->_staff_list;
$this->staff = $this->_staff_list[ $this->_staff_current ];
if( $this->staff->dept_id != $this->department->id )
{
return false;
}
else
{
return true;
}
}
}
function getNextDepartment()
{
$this->_dept_current++;
// Test if there is another staff member
if( $this->_dept_current < $this->_dept_total )
{
$this->department =& $this->department;
$this->_dept_list =& $this->_dept_list;
$this->department = $this->_dept_list[ $this->_dept_current ];
return true;
}
else
{
return false;
}
}
function resetStaffCounter()
{
$this->_staff_current = 0;
}
function resetDepartmentCounter()
{
$this->_dept_current = 0;
}
function resetCounters()
{
$this->resetStaffCounter();
$this->resetDepartmentCounter();
}
function checkDeptHasStaff( $dept_id )
{
foreach( $this->_staff_list as $s )
{
if( $s->dept_id == $dept_id )
return true;
}
return false;
}
function createStyles( $colors )
{
$STYLE_TAG = 'span';
foreach( $colors as $key => $val )
{
$this->styles[ trim( $key ) ] = '<' . $STYLE_TAG . ' ' . $val . '>';
$this->styles[ trim( $key ).'_close' ] = '</' . $STYLE_TAG . '>';
}
}
}
?>