| 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/administrator/components/com_staffmaster/ |
Upload File : |
<?php
/**
* File: staffmaster.functions.inc.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 admin
* @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' );
/**
* Generates the HTML for our Ordering Select List
*
* @param StdDB Object $params
* @returns string HTML for the select list
*/
function checkDB( ) {
// Do we need to update the db?
$update_db = false;
$db =& JFactory::getDBO();
$staffmaster_tables = array( "#__staff" , "#__staff_departments" , "#__staff_settings" );
$result = $db->getTableFields( $staffmaster_tables );
$fieldCt['staff'] = count( $result[ $staffmaster_tables[ 0 ] ] );
$fieldCt['department'] = count( $result[ $staffmaster_tables[ 1 ] ] );
$fieldCt['settings'] = count( $result[ $staffmaster_tables[ 2 ] ] );
if( $fieldCt['staff'] != 18 )
$update_db = true;
if( $fieldCt['department'] != 7 )
$update_db = true;
if( $fieldCt['settings'] != 54 )
$update_db = true;
return $update_db;
}
/**
* updateDatabase : imports the file with the functions to upgrade our database to 0_7_0_4
*
*/
function updateDatabase() {
require_once('files/update_0_7_0.php');
updateStaff();
updateDepartments();
updateSettings();
}
/**
* Generates the HTML for our Ordering Select List
*
* @param StdDB Object $params
* @returns string HTML for the select list
*/
function allowComponentAccess( $user ) {
$access = md5( JText::_("SM_ACCESS_TOKEN") );
$types = array( "Super Administrator" , "Administrator" );
if ( $user->id == 0 )
$access = "nologin";
if ( !in_array( $user->usertype , $types ) )
$access = "noauth";
return md5( $access );
}
/**
* Steps through component to check values and entered data
* returning a 'checklist' back to the main admin page
*/
function doComCheck( $option , $staff , $departments , $params , $sm_version ) {
//some variables in use for comcheck
$rcch_li_err = '<li class="error">';
$rcch_li_ok = '<li class="ok">';
$rcch_li = '<li>';
$close_li = '</li>';
$rcch_link_adddept = '<a href="'.JRoute::_('index.php?option='.$option.'&task=adddepartment')
. '" >' . JText::_( 'CP_CC_LINK_ADD_DEPT' ) . '</a>';
$return_com_check_html = '<ul id="staff_com_check" >';
$return_com_check_html .= '<li id="staff_com_dept_hdr" >' . JText::_( 'CP_CC_DEPT_CHK' ) . '</li>';
//Begin Departments Check
if( empty( $departments ) ) {
$return_com_check_html .= $rcch_li_err . JText::_( 'CP_CC_NODEPT' ) . $rcch_link_adddept . $close_li;
}
else {
$dep_pub = 0;
$dep_unpub = 0;
foreach( $departments as $d ) {
$rcch_dept_link = '<a href="'.JRoute::_('index.php?option='.$option.'&task=editdepartment&cid[]='.$d->id )
. '" >' . JText::_( 'CP_CC_DEPT_ID' ) . $d->name . '</a>';
if( ( empty( $d->name ) ) || ( strlen( $d->name ) < 3 ) ) {
$return_com_check_html .= $rcch_li_err . JText::_( 'CP_CC_NODESC' ) . ' ' . $d->name . ' ';
$return_com_check_html .= $rcch_dept_link . $close_li;
}
if( ( empty( $d->description ) ) || ( strlen( $d->description ) < 3 ) ) {
$return_com_check_html .= $rcch_li_err . JText::_( 'CP_CC_NODESC' ) . ' ' . $d->name . ' ';
$return_com_check_html .= $rcch_dept_link . $close_li;
}
if( $d->published == 1 )
$dep_pub++;
else
$dep_unpub++;
}
if( $dep_pub > 0 )
$return_com_check_html .= $rcch_li . JText::_( 'CP_CC_DEP_PUB' ) . ': ' . $dep_pub . $close_li;
if( $dep_unpub > 0 ) {
$link = '<a href="'.JRoute::_('index.php?option=' . $option . '&task=departments' )
. '" >' . JText::_( 'CP_CC_LINK_EDIT_DEPT' ) . '</a>';
$return_com_check_html .= $rcch_li . JText::_( 'CP_CC_DEP_UNPUB' ) . ': ' . $dep_unpub . $close_li;
}
else {
$return_com_check_html .= $rcch_li . JText::_( 'CP_CC_DEP_UNPUB' ) . ': ' . $dep_unpub . $close_li;
}
}
$return_com_check_html .= '<li> </li>';
$return_com_check_html .= '<li id="staff_com_staff_hdr" >' . JText::_( 'CP_CC_STAFF' ) . '</li>';
//Begin Staff Check
if( empty( $staff ) ) {
$rcch_link = '<a href="'.JRoute::_('index.php?option='.$option.'&task=add' )
. '" >' . JText::_( 'CP_CC_LINK_ADD_STAFF' ) . '</a>';
$return_com_check_html .= $rcch_li_err . JText::_( 'CP_CC_NOSTAFF' ) . $rcch_link . $close_li;
}
else {
$staff_pub = 0;
$staff_unpub = 0;
foreach( $staff as $s ) {
$rcch_link = '<a href="'.JRoute::_('index.php?option=' . $option . '&task=edit&cid[]='.$s->id )
. '" >'.JText::_( 'CP_CC_LINK_EDIT_STAFF' ) . $s->name . '</a>';
if( ( empty( $s->name ) ) || ( strlen( $s->name ) < 3 ) ) {
$return_com_check_html .= $rcch_li_err . JText::_( 'CP_CC_NONAME' ) . ' ' . $s->name . ' ';
$return_com_check_html .= $rcch_link . $close_li;
}
if( ( empty( $s->title ) ) || ( strlen( $s->title ) < 3 ) ) {
$return_com_check_html .= $rcch_li_err . JText::_( 'CP_CC_NOTITLE' ) . ' ' . $s->name . ' ';
$return_com_check_html .= $rcch_link . $close_li;
}
if( ( empty( $s->bio ) ) || ( strlen( $s->bio ) < 3 ) ) {
$return_com_check_html .= $rcch_li_err . JText::_( 'CP_CC_NOBIO' ) . ' ' . $s->name . ' ';
$return_com_check_html .= $rcch_link . $close_li;
}
if( ( empty( $s->image_file_name ) ) || ( is_null( $s->image_file_name ) ) ) {
$return_com_check_html .= $rcch_li_err . JText::_( 'CP_CC_NOIMG' ) . ' ' . $s->name . ' ';
$return_com_check_html .= $rcch_link . $close_li;
}
if( ( $s->dept_id == 0 ) || ( is_null( $s->dept_id ) ) ) {
$return_com_check_html .= $rcch_li_err . JText::_( 'CP_CC_NODEPT_SET' ) . ' ' . $s->name . ' ';
$return_com_check_html .= $rcch_link . $close_li;
}
if( $s->published == 1 )
$staff_pub++;
else
$staff_unpub++;
}
if( $staff_pub > 0 )
$return_com_check_html .= $rcch_li . JText::_( 'CP_CC_STAFF_PUB' ) . ': ' . $staff_pub . $close_li;
if( $staff_unpub > 0 ) {
$link = '<a href="'.JRoute::_('index.php?option='.$option.'&task=departments' )
. '" >' . JText::_( 'CP_CC_LINK_EDIT_STAFF' ) . '</a>';
$return_com_check_html .= $rcch_li . JText::_( 'CP_CC_STAFF_UNPUB' ) . ': ' . $staff_unpub . $link . $close_li;
}
else {
$return_com_check_html .= $rcch_li . JText::_( 'CP_CC_STAFF_UNPUB' ) . ': ' . $staff_unpub . $close_li;
}
}
$return_com_check_html .= '<li> </li>';
$return_com_check_html .= '<li id="staff_com_params_hdr" >' . JText::_( 'CP_CC_SETTINGS_CHK' ) . '</li>';
//Begin Params Check
if( empty( $params ) ) {
$rcch_link = '<a href="'.JRoute::_( 'index.php?option='.$option.'&task=editsettings' )
. '" > ' . JText::_( 'CP_CC_LINK_EDIT_CFG' ) . '</a>';
$return_com_check_html .= $rcch_li_err . JText::_( 'CP_CC_NOCFG' ) . $rcch_link . $close_li;
}
else {
$rcch_link = '<a href="'.JRoute::_('index.php?option='.$option.'&task=editsettings' )
. '" > ' . JText::_( 'CP_CC_LINK_EDIT_CFG' ) . '</a>';
if( empty( $params->page_title ) ) {
$return_com_check_html .= $rcch_li_err . JText::_( 'CP_CC_NOTITLE_CFG' );
$return_com_check_html .= $rcch_link . $close_li;
}
elseif( strlen( $params->page_title ) < 3 ) {
$return_com_check_html .= $rcch_li_err . JText::_( 'CP_CC_SHTITLE_CFG' );
$return_com_check_html .= $rcch_link . $close_li;
}
if( ( $params->show_dept_footer == 1 ) && ( $params->show_dept_footer_text1 == 1 ) && ( empty( $params->job_text1 ) ) ) {
$return_com_check_html .= $rcch_li_err . JText::_( 'CP_CC_DEP1_ON_NOTEXT' );
$return_com_check_html .= $rcch_link . $close_li;
}
if( ( $params->show_dept_footer == 1 ) && ( $params->show_dept_footer_text2 == 1 ) && ( empty( $params->job_text2 ) ) ) {
$return_com_check_html .= $rcch_li_err . JText::_( 'CP_CC_DEP2_ON_NOTEXT' );
$return_com_check_html .= $rcch_link . $close_li;
}
if( ( $params->show_dept_footer == 1 ) && ( $params->show_dept_footer_text3 == 1 ) && ( empty( $params->job_text3 ) ) ) {
$return_com_check_html .= $rcch_li_err . JText::_( 'CP_CC_DEP3_ON_NOTEXT' );
$return_com_check_html .= $rcch_link . $close_li;
}
}
$return_com_check_html .= '</ul>';
return $return_com_check_html;
}
/**
* Generates the HTML for our Ordering Select List
*
* @param StdDB Object $ordering with all Staff to be put in the list
* @param StdDB Object $depts with all of our Department Names and IDs ordered
* @param string $staff_name current staff member we're editing
* @returns string HTML for the select list
*/
function createOrderingHtml( $staff_order , $staff_name ) {
$task = JRequest::getVar( 'task' );
// Return HTML String
$return_order_html = '<select name="ordering" id="ordering" ><option value="first"> > '. JText::_( 'ST_ORD_FIRST' ) .' < </option>';
//used during jQuery ajax calls to put this staff at the end of the list
$last_return_order_html = '';
foreach( $staff_order as $order ) {
// Only time this is an int is during jQuery ajax calls
if( is_int( $staff_name ) ) {
if( $order->id == $staff_name ) {
$last_return_order_html .= '<option '
. 'selected="selected" '
. 'value ="'
. $order->ordering . '" '
. '>' . $order->name . '</option>';
}
else {
$return_order_html .= '<option value ="'
. $order->ordering . '" '
. '>' . $order->name . '</option>';
}
}
else {
$return_order_html .= '<option value ="'
. $order->ordering . '" ';
if( $order->name == $staff_name )
$return_order_html .= 'selected="selected" ';
$return_order_html .= '>' . $order->name . '</option>';
}
} // END foreach( $ordering as $order )
//if there is data from an Ajax call, add it to the end of this list now
if( !empty( $last_return_order_html ) )
$return_order_html .= $last_return_order_html;
$return_order_html .= '<option value="last" ';
if( $task == 'add' )
$return_order_html .= 'selected="selected"';
$return_order_html .= ' > > '. JText::_( 'ST_ORD_LAST' ) .' < </option></select>';
return $return_order_html;
}
/**
* Generates the HTML for our Department Select List
*
* @param StdDB Object $departments with all departments to be put in the list
* @param StdDB Object $row with all of the db info for this staff member we're editing
* @returns string HTML for the select list
*/
function createDepartmentHtml( $departments , $row ) {
// Return HTML String
$return_department_html = '<select name="dept_id" id="department_id" alt="'.$row->id.'" >';
foreach( $departments as $dept ) {
$return_department_html .= '<option value ="' . $dept->id . '" ';
if( $dept->id == $row->dept_id ) {
$return_department_html .= 'selected="selected" ';
}
$return_department_html .= '>'
. $dept->name
. '</option>';
}
$return_department_html .= '</select>';
return $return_department_html;
}
/**
* Reorders a department or multiple departments after members have been deleted
*/
function reorderDepartmentsAfterDelete( $dept_ids , $cids ) {
$db =& JFactory::getDBO();
$query = "SELECT id , dept_id , ordering "
. "FROM #__staff ";
// If we pulled in an array of department IDs
// also means there are multiple user IDs
if( is_array( $dept_ids ) ) {
$dept_id_str = '';
foreach( $dept_ids as $dept_id ) {
$dept_id_str .= $dept_id->dept_id.', ';
}
$dept_id_str = substr( $dept_id_str , 0 , -2 );
$query .= "WHERE dept_id IN ( $dept_id_str ) AND id NOT IN ( $cids ) ";
}
else {
$query .= "WHERE dept_id = $dept_ids AND id NOT $cids ";
}
$query .= "ORDER BY dept_id , ordering ";
$db->setQuery( $query );
$rows = $db->loadObjectList();
$ct_order = 1;
$old_department = 0;
foreach( $rows as $row ) {
//if we moved on to a new department
if( $row->dept_id != $old_department ) {
$old_department = $row->dept_id;
$ct_order = 1;
}
$row_id = $row->id;
$order = $ct_order;
$query_update = "UPDATE #__staff "
. "SET ordering = $order "
. "WHERE id = $row_id ";
$db->setQuery( $query_update );
$db->Query();
$ct_order++;
}
}
/**
* quickly grabs the last ordering value we've used, adds 1,
* and returns so we have the next available ordering value
*/
function getLastOrder( $dept_id ) {
$db =& JFactory::getDBO();
//Get the largest number in ordering for this dept, so we can add 1 and append this new guy
$query = "SELECT MAX(ordering) as max_ordering FROM #__staff WHERE dept_id = $dept_id ";
$db->setQuery( $query );
$staff_max_order = $db->loadObject();
// Add 1 to MAX and then assign to next_order
$next_order = ++$staff_max_order->max_ordering;
return $next_order;
}
/**
* When users select to reorder a staff member to ">First<" from the Ordering select list
*/
function setFirstReorder( $dept_id , $id , $is_dept = false ) {
$db =& JFactory::getDBO();
//Get the largest number in ordering for this dept, so we can add 1 and append this new guy
if( $is_dept )
$query = "SELECT id , ordering FROM #__staff_departments ORDER BY ordering";
else
$query = "SELECT id , ordering FROM #__staff WHERE dept_id = $dept_id ORDER BY ordering";
$db->setQuery( $query );
$results = $db->loadObjectList();
$next = 2;
foreach( $results as $r ) {
if( $r->id == $id )
continue;
if( $is_dept )
$q = "UPDATE #__staff_departments SET ordering = {$next} WHERE id = {$r->id} ";
else
$q = "UPDATE #__staff SET ordering = {$next} WHERE id = {$r->id} ";
$db->setQuery( $q );
$db->query();
$next++;
}
if( $is_dept )
$q2 = "UPDATE #__staff_departments SET ordering = 1 WHERE id = $id ";
else
$q2 = "UPDATE #__staff SET ordering = 1 WHERE id = $id ";
$db->setQuery( $q2 );
$db->query();
// Returns 1 in case we needed a return value for where we ordered this staff
return 1;
}
/**
* When users select to reorder a staff member to ">Last<" from the Ordering select list
*/
function setLastReorder( $dept_id , $id , $is_dept = false ) {
$db =& JFactory::getDBO();
//Get the largest number in ordering for this dept, so we can add 1 and append this new guy
if( $is_dept )
$query = "SELECT id , ordering FROM #__staff_departments ORDER BY ordering";
else
$query = "SELECT id , ordering FROM #__staff WHERE dept_id = $dept_id ORDER BY ordering";
$db->setQuery( $query );
$results = $db->loadObjectList();
$next = 1;
foreach( $results as $r ) {
if( $r->id == $id )
continue;
if( $is_dept )
$q = "UPDATE #__staff_departments SET ordering = {$next} WHERE id = {$r->id} ";
else
$q = "UPDATE #__staff SET ordering = {$next} WHERE id = {$r->id} ";
$db->setQuery( $q );
$db->query();
$next++;
}
if( $is_dept )
$q2 = "UPDATE #__staff_departments SET ordering = {$next} WHERE id = {$id} ";
else
$q2 = "UPDATE #__staff SET ordering = {$next} WHERE id = {$id} ";
$db->setQuery( $q2 );
$db->query();
// Returns the ordering value that we gave to this staff member
return $next;
}
/**
* When users select to reorder a staff member somewhere other than ">First<" or ">Last<"
* from the Ordering select list
*/
function setOtherReorder( $dept_id , $id , $order , $is_dept = false ) {
$db =& JFactory::getDBO();
//Get the largest number in ordering for this dept, so we can add 1 and append this new guy
if( $is_dept )
$query = "SELECT id , ordering FROM #__staff_departments WHERE id <> $id ORDER BY ordering";
else
$query = "SELECT id , ordering FROM #__staff WHERE dept_id = $dept_id AND id <> $id ORDER BY ordering ";
$db->setQuery( $query );
$results = $db->loadObjectList();
$next = 1;
foreach( $results as $r ) {
if( $r->ordering == $order ) {
if( $next < $r->ordering ) {
// If next < ordering, dont do anything to next
}
elseif( $next == 1 ) {
$next++;
}
elseif( $next == $r->ordering ) {
$next++;
}
if( $is_dept )
$q = "UPDATE #__staff_departments SET ordering = {$next} WHERE id = {$r->id} ";
else
$q = "UPDATE #__staff SET ordering = {$next} WHERE id = {$r->id} ";
}
else {
if( $next == $order )
$next++;
if( $is_dept )
$q = "UPDATE #__staff_departments SET ordering = {$next} WHERE id = {$r->id} ";
else
$q = "UPDATE #__staff SET ordering = {$next} WHERE id = {$r->id} ";
}
$db->setQuery( $q );
$db->query();
$next++;
}
if( $is_dept )
$q2 = "UPDATE #__staff_departments SET ordering = {$next} WHERE id = {$id} ";
else
$q2 = "UPDATE #__staff SET ordering = {$order} WHERE id = {$id} ";
$db->setQuery( $q2 );
$db->query();
return $order;
}
/**
* When we move a staff member from one department to another,
* this function reorders the previous department
*/
function reorderLastDepartment( $dept_id ) {
$db =& JFactory::getDBO();
$q = "SELECT id , ordering FROM #__staff WHERE dept_id = $dept_id ORDER BY ordering ";
$db->setQuery( $q );
$rows = $db->loadObjectList();
//Counter used during iteration
$ct_order = 1;
if( !is_null( $rows ) ) {
foreach( $rows as $row ) {
$query_update = "UPDATE #__staff "
. "SET ordering = $ct_order "
. "WHERE id = $row->id ";
$db->setQuery( $query_update );
$db->query();
$ct_order++;
}
}
}
/**
* doComCheckHtml : Create HTML Radiolist for ComCheck
*
* @param int $show_com_check
* @return string $show_com_check_html
*/
function doComCheckHtml( $show_com_check ) {
$show_com_check_html = '<div class="labelInputBox">'
. '<div class="labeldiv"><label for="show_com_check0">'. JText::_( 'ST_NO' ) .'</label></div>'
. '<input id="show_com_check0" class="inputbox" type="radio" value="0" name="show_com_check"';
if( $show_com_check == 0 ) {
$show_com_check_html .= ' checked="checked" ';
}
$show_com_check_html .= '/>'
. '<div class="labeldiv"><label for="show_com_check1">'. JText::_( 'ST_YES' ) .'</label></div>'
. '<input id="show_com_check1" class="inputbox" type="radio" value="1" name="show_com_check"';
if( $show_com_check == 1 ) {
$show_com_check_html .= ' checked="checked" ';
}
$show_com_check_html .= '/></div>';
return $show_com_check_html;
}
/**
* doRadioHtml : Generic Staff Master function used to Create HTML Radiolist
*
* @param string $name
* @param string $value
* @param bool $titleinbio
* @return string $show_com_check_html
*/
function doRadioHtml( $name , $value , $titleinbio = false ) {
if( !$titleinbio ) {
$no = JText::_( 'ST_NO' );
$yes = JText::_( 'ST_YES' );
}
else {
$no = JText::_( 'ST_NAME' );
$yes = JText::_( 'ST_BIO' );
}
// Create HTML Radiolist for use custom css
$radio_html = '<div class="labelInputBox">'
. '<div class="labeldiv"><label for="' . $name . '0">' . $no . '</label></div>'
. '<input id="' . $name . '0" class="inputbox" type="radio" value="0" name="' . $name . '"';
if( $value == 0 ) {
$radio_html .= ' checked="checked" ';
}
$radio_html .= '/>'
. '<div class="labeldiv"><label for="' . $name . '1">'. $yes .'</label></div>'
. '<input id="' . $name . '1" class="inputbox" type="radio" value="1" name="' . $name . '"';
if( $value == 1 ) {
$radio_html .= ' checked="checked" ';
}
$radio_html .= '/></div>';
return $radio_html;
}
/**
* doRadioLeftRightHtml : Generic Staff Master function used to Create HTML Radiolist for "Left" "Right" options
*
* @param string $name
* @param string $value
* @return string $radio_html
*/
function doRadioLeftRightHtml( $name , $value ) {
// Create HTML Radiolist for use custom css
$radio_html = '<div class="labelInputBox">'
. '<div class="labeldiv"><label for="' . $name . '0">'. JText::_( 'ST_LEFT' ) .'</label></div>'
. '<input id="' . $name . '0" class="inputbox" type="radio" value="left" name="' . $name . '"';
if( $value == 'left' ) {
$radio_html .= ' checked="checked" ';
}
$radio_html .= '/>'
. '<div class="labeldiv"><label for="' . $name . '1">'. JText::_( 'ST_RIGHT' ) .'</label></div>'
. '<input id="' . $name . '1" class="inputbox" type="radio" value="right" name="' . $name . '"';
if( $value == 'right' ) {
$radio_html .= ' checked="checked" ';
}
$radio_html .= '/></div>';
return $radio_html;
}
/**
* Function Creates the HTML radio buttons to set the default stylesheet
*
* @param string $name The 'name' for this radio group item
* @param string $value The current value of the setting from the settings table
* @return string $radio_html a string that contains all the html to display a radio select group for stylesheets
*/
function doStylesheetHtml( $name , $value ) {
// Create HTML Radiolist for use custom css
$radio_html = '<div class="labelInputBox">'
. '<div class="labeldiv"><label for="' . $name . '0">'. JText::_( 'ST_DEFAULT' ) .'</label></div>'
. '<input id="' . $name . '0" class="inputbox" type="radio" value="default" name="' . $name . '"';
if( $value == 'default' ) {
$radio_html .= ' checked="checked" ';
}
$radio_html .= '/>'
. '<div class="labeldiv"><label for="' . $name . '1">'. JText::_( 'ST_CLEAN' ) .'</label></div>'
. '<input id="' . $name . '1" class="inputbox" type="radio" value="clean" name="' . $name . '"';
if( $value == 'clean' ) {
$radio_html .= ' checked="checked" ';
}
$radio_html .= '/></div>';
return $radio_html;
}
/**
* Function Creates the HTML radio buttons to set the default stylesheet
*
* @param int $show_dept_footer The 'name' for this radio group item
* @param bool $foot_num The current value of the setting from the settings table
* @return string $show_dept_footer_html a string that contains all the html to display a radio select group for stylesheets
*/
function doShowDeptFooterHtml( $show_dept_footer , $foot_num = false ) {
if( !$foot_num ) {
$show_dept_footer_html = '<div class="labelInputBox">'
. '<div class="labeldiv"><label for="show_dept_footer0">'. JText::_( 'ST_NO' ) .'</label></div>'
. '<input id="show_dept_footer0" class="inputbox" type="radio" value="0" name="show_dept_footer"';
if( $show_dept_footer == 0 ) {
$show_dept_footer_html .= ' checked="checked" ';
}
$show_dept_footer_html .= '/>'
. '<div class="labeldiv"><label for="show_dept_footer1">'. JText::_( 'ST_YES' ) .'</label></div>'
. '<input id="show_dept_footer1" class="inputbox" type="radio" value="1" name="show_dept_footer"';
if( $show_dept_footer == 1 ) {
$show_dept_footer_html .= ' checked="checked" ';
}
$show_dept_footer_html .= '/></div>';
}
else {
$show_dept_footer_html = '<div class="labelInputBox">'
. '<div class="labeldiv"><label for="show_dept_footer' . $foot_num .'0">'. JText::_( 'ST_NO' ) .'</label></div>'
. '<input id="show_dept_footer_text' . $foot_num .'0" class="inputbox" type="radio" value="0" name="show_dept_footer_text' . $foot_num .'"';
if( $show_dept_footer == 0 ) {
$show_dept_footer_html .= ' checked="checked" ';
}
$show_dept_footer_html .= '/>'
. '<div class="labeldiv"><label for="show_dept_footer' . $foot_num .'1">'. JText::_( 'ST_YES' ) .'</label></div>'
. '<input id="show_dept_footer_text' . $foot_num .'1" class="inputbox" type="radio" value="1" name="show_dept_footer_text' . $foot_num .'"';
if( $show_dept_footer == 1 ) {
$show_dept_footer_html .= ' checked="checked" ';
}
$show_dept_footer_html .= '/></div>';
}
return $show_dept_footer_html;
}
/**
* Function Creates the HTML radio buttons to set the default stylesheet
*
* @param int $use_custom_colors 1/0 yes/no
* @return string $show_dept_footer_html a string that contains all the html to display a radio select group for stylesheets
*/
function doUseCustomColorHtml( $use_custom_colors ) {
// Create HTML Radiolist for use custom css
$use_custom_colors_html = '<div class="labelInputBox">'
. '<div class="labeldiv"><label for="use_custom_colors0">'. JText::_( 'ST_NO' ) .'</label></div>'
. '<input id="use_custom_colors0" class="inputbox" type="radio" value="0" name="use_custom_colors"';
if( $use_custom_colors == 0 ) {
$use_custom_colors_html .= ' checked="checked" ';
}
$use_custom_colors_html .= '/>'
. '<div class="labeldiv"><label for="use_custom_colors1">'. JText::_( 'ST_YES' ) .'</label></div>'
. '<input id="use_custom_colors1" class="inputbox" type="radio" value="1" name="use_custom_colors"';
if( $use_custom_colors == 1 ) {
$use_custom_colors_html .= ' checked="checked" ';
}
$use_custom_colors_html .= '/></div>';
return $use_custom_colors_html;
}
/**
* createPublishedHtml : Function Creates the HTML for our publish/unpublish
*
* @param int $published 1/0 yes/no
* @return string $show_dept_footer_html a string that contains all the html to display a radio select group for stylesheets
*/
function createPublishedHtml( $published ) {
// Create HTML Radiolist for use custom css
$published_html = '<div class="labelInputBox">'
. '<div class="labeldiv"><label for="published0">'. JText::_( 'ST_NO' ) .'</label></div>'
. '<input id="published0" class="inputbox" type="radio" value="0" name="published"';
if( $published == 0 ) {
$published_html .= ' checked="checked" ';
}
$published_html .= '/>'
. '<div class="labeldiv"><label for="published1">'. JText::_( 'ST_YES' ) .'</label></div>'
. '<input id="published1" class="inputbox" type="radio" value="1" name="published"';
if( $published == 1 ) {
$published_html .= ' checked="checked" ';
}
$published_html .= '/></div>';
return $published_html;
}
/**
* doStaffColorsHtml : creates the input boxes for all the custom color settings in the admin area
*
* @param stdObj $row
* @param string $TT_BG_COLOR
* @return string
*/
function doStaffColorsHtml( $row , $TT_BG_COLOR ) {
// Create HTML Radiolist for custom colors of the component
$staff_colors_html = '<table border="0" cellpadding="2" cellspacing="2" >';
$staff_colors_html .= '<tr class="labelInputBox" ><td><div class="labeldiv_custom_colors"><label for="page_title_color">'
. JText::_( 'CFG_COL_PG_TITLE' ) . '</label></div></td>'
. '<td><input id="page_title_color" class="inputbox_custom_colors" type="text" value="'
. $row['page_title_color'] . '" name="page_title_color" /></td></tr>';
$staff_colors_html .= '<tr class="labelInputBox" ><td><div class="labeldiv_custom_colors"><label for="dept_name_color">'
. JText::_( 'CFG_COL_DEPT_NAME' ) . '</label></div></td>'
. '<td><input id="dept_name_color" class="inputbox_custom_colors" type="text" value="'
. $row['dept_name_color'] . '" name="dept_name_color" /></td></tr>';
$staff_colors_html .= '<tr class="labelInputBox" ><td><div class="labeldiv_custom_colors"><label for="dept_desc_color">'
. JText::_( 'CFG_COL_DEPT_DESC' ) . '</label></div></td>'
. '<td><input id="dept_desc_color" class="inputbox_custom_colors" type="text" value="'
. $row['dept_desc_color'] . '" name="dept_desc_color" /></td></tr>';
$staff_colors_html .= '<tr class="labelInputBox" ><td><div class="labeldiv_custom_colors"><label for="staff_name_color">'
. JText::_( 'CFG_COL_STAFF_NAME' ) . '</label></div></td>'
. '<td><input id="staff_name_color" class="inputbox_custom_colors" type="text" value="'
. $row['staff_name_color'] . '" name="staff_name_color" /></td></tr>';
$staff_colors_html .= '<tr class="labelInputBox" ><td><div class="labeldiv_custom_colors"><label for="staff_title_color">'
. JText::_( 'CFG_COL_STAFF_TITLE' ) . '</label></div></td>'
. '<td><input id="staff_title_color" class="inputbox_custom_colors" type="text" value="'
. $row['staff_title_color'] . '" name="staff_title_color" /></td></tr>';
$staff_colors_html .= '<tr class="labelInputBox" ><td><div class="labeldiv_custom_colors"><label for="contact_details">'
. JText::_( 'CFG_COL_CONTACT_DETAILS' ) . '</label></div></td>'
. '<td><input id="contact_details" class="inputbox_custom_colors" type="text" value="'
. $row['contact_details'] . '" name="contact_details" /></td></tr>';
$staff_colors_html .= '<tr class="labelInputBox" ><td><div class="labeldiv_custom_colors"><label for="contact_details_link">'
. JText::_( 'CFG_COL_CONTACT_DETAILS_LINK' ) . '</label></div></td>'
. '<td><input id="contact_details_link" class="inputbox_custom_colors" type="text" value="'
. $row['contact_details_link'] . '" name="contact_details_link" /></td></tr>';
$staff_colors_html .= '<tr class="labelInputBox" ><td><div class="labeldiv_custom_colors"><label for="staff_bio_color">'
. JText::_( 'CFG_COL_STAFF_BIO' ) . '</label></div></td>'
. '<td><input id="staff_bio_color" class="inputbox_custom_colors" type="text" value="'
. $row['staff_bio_color'] . '" name="staff_bio_color" /></td></tr>';
$staff_colors_html .= '<tr class="labelInputBox" ><td><div class="labeldiv_custom_colors"><label for="dept_unique_foot_color">'
. JText::_( 'CFG_COL_SPFC_DEPT_FOOT' ) . '</label></div></td>'
. '<td><input id="dept_unique_foot_color" class="inputbox_custom_colors" type="text" value="'
. $row['dept_unique_foot_color'] . '" name="dept_unique_foot_color" /></td></tr>';
$staff_colors_html .= '<tr class="labelInputBox" ><td><div class="labeldiv_custom_colors"><label for="dept_general_foot_color">'
. JText::_( 'CFG_COL_GEN_DEPT_FOOT' ) . '</label></div></td>'
. '<td><input id="dept_general_foot_color" class="inputbox_custom_colors" type="text" value="'
. $row['dept_general_foot_color'] . '" name="dept_general_foot_color" /></td></tr>';
$tt_background = makeToolTip( JText::_( 'TT_BG_COLOR' ) , true );
$staff_colors_html .= '<tr class="labelInputBox" ><td><div class="labeldiv_custom_colors"><label for="background_color">' . $tt_background
. JText::_( 'TH_BG_COLOR' ) . '</label></div></td>'
. '<td><input id="background_color" class="inputbox_custom_colors" type="text" value="FFFFFF" name="background_color" /></td></tr>';
$staff_colors_html .= '</table>';
return $staff_colors_html;
}
/**
* makeToolTip :
*
* @param string $tip_text
* @param string $tt_float_side
* @param string $isWarning
* @return mixed
*/
function makeToolTip( $tip_text , $tt_float_side = 'left' , $isWarning = false ) {
$tt_image = FILE_TOOLTIP_IMAGE;
if( $isWarning )
$tt_image = FILE_TOOLTIP_WARNING;
$tooltip_html = '<div class="sm_tooltips_' . $tt_float_side . '">'
. '<img src="' . $tt_image . '" alt="' . $tip_text . '" title="' . $tip_text . '" />'
. '</div>';
return $tooltip_html;
}
/**
* getStaffParams : Returns a list of Params
*
* @return unknown
*/
function getStaffParams() {
$params =& JTable::getInstance('settings', 'Table');
$params->load( 1 );
return $params;
}
/**
* getAllStaffList : gets a list of all staff members just like in the model
*
* redundant... needs to be removed
*
* @return mixed $rows
*/
function getAllStaffList() {
$db =& JFactory::getDBO();
$query_getStaff = "SELECT * "
. "FROM #__staff "
. "ORDER BY dept_id , ordering ";
$db->setQuery( $query_getStaff );
$rows = $db->loadObjectList();
if ($db->getErrorNum()) {
echo $db->stderr();
return false;
}
return $rows;
}
/**
* getAllDepartmentList : gets a list of all staff $departments just like in the department model
*
* redundant... needs to be removed
*
* @return mixed $departments
*/
function getAllDepartmentList( ) {
$db =& JFactory::getDBO();
$query_getDepts = "SELECT * "
. "FROM #__staff_departments "
. "ORDER BY ordering ";
$db->setQuery( $query_getDepts );
$departments = $db->loadObjectList();
if ($db->getErrorNum()) {
echo $db->stderr();
return false;
}
return $departments;
}
/**
* checkLatestVersion : uses the snoopy class found in admin/classes/snoopy.class.php
*
* snoopy is a an open-source way to get files and data from across websites and the internet
*
* @param string $sm_version
* @return mixed
*/
function checkLatestVersion( $sm_version ) {
global $mainframe;
include_once( JPATH_COMPONENT . DS . 'classes' . DS . 'snoopy.class.php' );
$s = new Snoopy();
$s->read_timeout = 90;
$s->referer = $mainframe->getCfg('live_site');
@$s->fetch('http://smverchk.systemsunited.net/version_checker.php?checkversion=' . urlencode( $sm_version ) );
return stripslashes( $s->results );
}
?>