| Server IP : 195.130.67.5 / Your IP : 216.73.217.127 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/views/all/ |
Upload File : |
<?php
/**
* File: view.html.php
*
* Staff Master 0_7_5_5
*
* Staff Master - Staff Members and Departments Manager
*
* @version 0.7.5.5
* @package StaffMaster_0_7_5_5
* @subpackage: view_all
* @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.view');
jimport('joomla.application.menu');
/**
* Staff View All Class
*/
class StaffViewAll extends JView {
/**
* Default display method for the class
*
* @param mixed $tpl can contain other display template params
* @param stdObj $staff_list contains all published staff sorted by department ordering and then by staff ordering
* @param stdObj $departments_list contains all published departments sorted by ordering
* @param stdObj $params contains all params from settings model
*/
function display( $tpl = null , $staff_list , $departments_list , $params , $contact_html , $parsed_acl ) {
global $option;
$cparams = JComponentHelper::getParams( $option );
$show_sm_link = $cparams->get( 'show_sm_link' );
//Colors
$page_title_color_html = '';
$dept_name_color_html = '';
$dept_desc_color_html = '';
$staff_name_color_html = '';
$staff_title_color_html = '';
$staff_bio_color_html = '';
$dept_unique_foot_color_html = '';
$dept_general_foot_color_html = '';
$contact_details_html = '';
$contact_details_link_html = '';
$custom_colors = array();
if( $params->use_custom_colors ) {
$cc = explode( ';' , $params->custom_colors );
foreach( $cc as $tcc ) {
$tcc = explode( '=' , $tcc );
$custom_colors[ trim( $tcc[ 0 ] ) ] = $tcc[ 1 ];
}
if( isset( $custom_colors['page_title_color'] ) ) {
if( !empty( $custom_colors['page_title_color'] ) )
$page_title_color_html = 'style="color:#' . $custom_colors['page_title_color'] .'"';
}
if( isset( $custom_colors['dept_name_color'] ) ) {
if( !empty( $custom_colors['dept_name_color'] ) )
$dept_name_color_html = 'style="color:#' . $custom_colors['dept_name_color'] .'"';
}
if( isset( $custom_colors['dept_desc_color'] ) ) {
if( !empty( $custom_colors['dept_desc_color'] ) )
$dept_desc_color_html = 'style="color:#' . $custom_colors['dept_desc_color'] .'"';
}
if( isset( $custom_colors['staff_name_color'] ) ) {
if( !empty( $custom_colors['staff_name_color'] ) )
$staff_name_color_html = 'style="color:#' . $custom_colors['staff_name_color'] .'"';
}
if( isset( $custom_colors['staff_title_color'] ) ) {
if( !empty( $custom_colors['staff_title_color'] ) )
$staff_title_color_html = 'style="color:#' . $custom_colors['staff_title_color'] .'"';
}
if( isset( $custom_colors['staff_bio_color'] ) ) {
if( !empty( $custom_colors['staff_bio_color'] ) )
$staff_bio_color_html = 'style="color:#' . $custom_colors['staff_bio_color'] .'"';
}
if( isset( $custom_colors['dept_unique_foot_color'] ) ) {
if( !empty( $custom_colors['dept_unique_foot_color'] ) )
$dept_unique_foot_color_html = 'style="color:#' . $custom_colors['dept_unique_foot_color'] .'"';
}
if( isset( $custom_colors['dept_general_foot_color'] ) ) {
if( !empty( $custom_colors['dept_general_foot_color'] ) )
$dept_general_foot_color_html = 'style="color:#' . $custom_colors['dept_general_foot_color'] .'"';
}
if( isset( $custom_colors['contact_details'] ) ) {
if( !empty( $custom_colors['contact_details'] ) )
$contact_details_html = 'style="color:#' . $custom_colors['contact_details'] .'"';
}
if( isset( $custom_colors['contact_details_link'] ) ) {
if( !empty( $custom_colors['contact_details_link'] ) )
$contact_details_link_html = 'style="color:#' . $custom_colors['contact_details_link'] .'"';
}
}
// not implemented yet
//$staff_image_pos_alt = 0;
$staff_html = array();
foreach( $staff_list as $staff_by_dept ) {
foreach( $staff_by_dept as $staff ) {
if( empty( $staff->title ) ) {
$staff_html['title'][ $staff->alias ] = $params->staff_title_default;
}
else {
$staff_html['title'][ $staff->alias ] = $staff->title;
}
if( $params->title_in_bio )
$staff_html['title'][ $staff->alias ] = '<span class="staff_title_bio" ' . $staff_title_color_html . '>' . $staff_html['title'][ $staff->alias ] . '</span>';
else
$staff_html['title'][ $staff->alias ] = '<span class="staff_title" ' . $staff_title_color_html . '>' . $staff_html['title'][ $staff->alias ] . '</span>';
$staff_html['contact'][ $staff->alias ] = $contact_html[ $staff->alias ];
/**** Staff Image Setup ****/
// If there is not an image set for this staff member
// use the image default set in settings
$image_src = $params->staff_image_path;
if( empty( $staff->image_file_name ) ) {
if( empty( $params->staff_image_default ) ) {
$image_src = '/components/' . $option . '/images/staff_empty.png';
}
else {
$image_src .= $params->staff_image_default;
}
}
else {
$image_src .= $staff->image_file_name;
}
// compile all variables to form image html
$image_html = '<img src="'.$image_src.'" '
. 'alt="' . $staff->name.'" '
. 'title="'.$staff->name.'" '
. 'class="staff_image" ';
if( isset( $parsed_acl['image_width'] ) )
$image_html .= 'width="' . $parsed_acl['image_width'] . '" ';
if( isset( $parsed_acl['image_height'] ) )
$image_html .= 'height="' . $parsed_acl['image_height'] . '" ';
$image_html .= ' />';
$staff_html['image'][ $staff->alias ] = $image_html;
/**** 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->bio ) ) {
$staff_html['bio'][ $staff->alias ] = $params->staff_bio_default;
}
else {
$text = stripslashes( str_replace('<br>', '<br />', $staff->bio ) );
$pattern = '#<hr\s+id=("|\')system-readmore("|\')\s*\/*>#i';
$tagPos = preg_match($pattern, $text);
if ($tagPos == 0) {
$staff_html['bio'][ $staff->alias ] = $text;
} else {
$staff->bio = preg_split($pattern, $text, 2);
$staff_name_link = JRoute::_( 'index.php?option=' . $option . '&view=staff&name=' . $staff->alias );
$staff_name_link_html = '<br /><a href="' . $staff_name_link .'" >' . '<span class="staff-readmore">' . JText::_('Read More...'). '</span></a>';
$staff_html['bio'][ $staff->alias ] = $staff->bio[0] . $staff_name_link_html;
}
}
/**** 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_name_link = JRoute::_( 'index.php?option=' . $option . '&view=staff&name=' . $staff->alias );
$staff_name_link_html = '<a href="' . $staff_name_link .'" ';
if( $params->use_custom_colors )
$staff_name_link_html .= $staff_name_color_html;
$staff_name_link_html .= '>' . $staff->name . '</a>';
$staff_html['name'][ $staff->alias ] = $staff_name_link_html;
}
else {
$staff_html['name'][ $staff->alias ] = $staff->name;
}
}
}
$staff_image_class = 'staff_image_' . $params->staff_image_pos ;
if( $params->staff_image_pos == 'right' ) {
$staff_name_class = 'staff_name_left';
$staff_bio_class = 'staff_bio_left';
$read_contact_class = 'read_contact_left';
}
else {
$staff_name_class = 'staff_name_right';
$staff_bio_class = 'staff_bio_right';
$read_contact_class = 'read_contact_right';
}
$dept_html = array();
foreach( $departments_list as $department ) {
if( $params->linkable_department ) {
$department_link = JRoute::_( 'index.php?option=' . $option . '&view=department&name=' . $department->alias );
$department_link_html = '<a href="' . $department_link .'" >' . $department->name . '</a>';
}
else {
$department_link_html = $department->name;
}
$dept_html['name'][ $department->alias ] = '<p class="department_name" ' . $dept_name_color_html . ' style="margin:50px 0 5px 0">' .$department_link_html .'</p>';
if( !empty( $department->description ) ) {
// Search for the {readmore} tag and split the text up accordingly.
$text = stripslashes( str_replace('<br>', '<br />', $department->description ) );
$pattern = '#<hr\s+id=("|\')system-readmore("|\')\s*\/*>#i';
$tagPos = preg_match($pattern, $text);
if ($tagPos == 0) {
$dept_html['desc'][ $department->alias ] = $text;
} else {
$department->description = preg_split($pattern, $text, 2);
$department_description_link = JRoute::_( 'index.php?option=' . $option . '&view=department&name=' . $department->alias );
$department_description_link_html = '<br /><a href="' . $department_description_link .'" >' . '<span class="staff-readmore">' . JText::_('Read More...'). '</span></a>';
$dept_html['desc'][ $department->alias ] = $department->description[0] . $department_description_link_html;
}
}
}
$this->assignRef( 'dept_html' , $dept_html );
$this->assignRef( 'staff_html' , $staff_html );
$this->assignRef( 'staff_name_color_html' , $staff_name_color_html );
$this->assignRef( 'read_contact_class' , $read_contact_class );
$this->assignRef( 'read_contact_label' , $params->cl_read_contact );
$this->assignRef( 'staff_name_class' , $staff_name_class );
$this->assignRef( 'staff_name_color_html' , $staff_name_color_html );
$this->assignRef( 'staff_bio_color_html' , $staff_bio_color_html );
$this->assignRef( 'staff_bio_class' , $staff_bio_class );
$this->assignRef( 'staff_image_class' , $staff_image_class );
$this->assignRef( 'page_title_color_html' , $page_title_color_html );
$this->assignRef( 'staff_title_color_html' , $staff_title_color_html );
$this->assignRef( 'dept_unique_foot_color_html' , $dept_unique_foot_color_html );
$this->assignRef( 'dept_general_foot_color_html' , $dept_general_foot_color_html );
$this->assignRef( 'contact_details_html' , $contact_details_html );
$this->assignRef( 'contact_details_link_html' , $contact_details_link_html );
$this->assignRef( 'staff_list' , $staff_list );
$this->assignRef( 'departments_list' , $departments_list );
$this->assignRef( 'params' , $params );
$this->assignRef( 'show_sm_link' , $show_sm_link );
parent::display($tpl);
}
}
?>