| 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 : C:/inetpub/wwwroot/icd/components/com_staffmaster/models/ |
Upload File : |
<?php
/**
* File: staff.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: 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_0_7_0_4
*/
class StaffModelStaff extends JModel {
/**
* Holds staff members
*
* @access private
* @var stdObj
*/
var $_staff_members = null;
/**
* Holds single staff member
*
* @access private
* @var stdObj
*/
var $_staff_member = null;
/**
* getList : returns all published staff members from all departments
*
* @return mixed
*/
function getList() {
// temporary storage array
$temp_staff_array = array();
if(!$this->_staff_members) {
$query = "SELECT * FROM #__staff WHERE published = '1' ORDER BY dept_id , ordering";
$this->_staff_members = $this->_getList($query, 0, 0);
}
$ct = 0;
$dept_id = 1;
foreach( $this->_staff_members as $member ) {
//if we're at a new department, reset counter
if( $member->dept_id > $dept_id ) {
$ct = 0;
$dept_id = $member->dept_id;
}
$temp_staff_array[ $dept_id ][ $ct ] = $member;
$ct++;
}
$this->_staff_members = $temp_staff_array;
return $this->_staff_members;
}
/**
* getListByDepartment : returns all published staff members by a department id
*
* @param int $dept_id
* @return mixed
*/
function getListByDepartment( $dept_id ) {
if( !$this->_staff_members ) {
$query = "SELECT * FROM #__staff WHERE dept_id = $dept_id AND published = '1' ";
$this->_staff_members = $this->_getList($query, 0, 0);
}
return $this->_staff_members;
}
/**
* getOneById : returns a single staff member by an id number
*
* @param int $id
* @return mixed
*/
function getOneById( $id ) {
if( !$this->_staff_member ) {
$query = "SELECT * FROM #__staff WHERE id = $id AND published = '1' ";
$this->_staff_member = $this->_getList( $query , 0 , 1 );
}
return $this->_staff_member;
}
/**
* getOneByAlias : returns a single staff member by alias
*
* @param string $alias
* @return mixed
*/
function getOneByAlias( $alias ) {
if( !$this->_staff_member ) {
$query = "SELECT * FROM #__staff WHERE alias = '$alias' AND published = '1' ";
$this->_db->setQuery( $query , 0 , 1 );
$this->_staff_member = $this->_db->loadObject();
}
return $this->_staff_member;
}
}
?>