Your IP : 216.73.216.54


Current Path : /var/www/html/modules/mod_jomsocialbirth/
Upload File :
Current File : /var/www/html/modules/mod_jomsocialbirth/mod_jomsocialbirth.php

<?php
/**
* @copyright (C) 2015 Lujayn Infoways - All rights reserved.
* @license GNU General Public License, version 3 (http://www.gnu.org/licenses/gpl-2.0.html)
* @author lujayninfoways.com <info@lujayninfoways.com>
*/

	defined('_JEXEC') or die('Restricted access');

	$user = JFactory::getUser();  
	$user_id = $user->id; // getting user's id 

	require_once __DIR__ . '/helper.php';


	$friends = ModBirthdateHelper::getfriends($params); // getiting all friends details 
	$getfriends= array();
	foreach($friends as $key => $friend) // get array field from array
	{
		$day=date('z')+1; 
		$no_days = $params->get('no_days'); 
		$nextday = $day + $no_days; 
		$my = CFactory::getUser($friend->id); // object of getting friend's userid
		$birthdate = date('d-m-Y', strtotime($my->getInfo('FIELD_BIRTHDATE'))); // get friend's birthdate
		$getdate = array(); 
		$getdate['id'] = $friend->id;  
		$getdate['dob'] = $birthdate; 
		$date11 = date('F d', strtotime($my->getInfo('FIELD_BIRTHDATE'))); // get friend's birthday's date and month
		$date22 = date('Y'); // get current year
		if($nextday > 365){
			$date22 = $date22 + 1;
		}
		$date33 = $date11 . " " . $date22;  // for getting friend's current birthdate in current year
		$getdate['dob_formate'] = date('F d, D', strtotime($date33)); 
		$getdate['dob_str'] = strtotime($birthdate);
		$getdate['dob_day'] = date("z", strtotime($birthdate))+1; // converts birthdate to no of day from 365 days 
		$getdate['avtar'] = $my->getThumbAvatar();  // getting frind's avatar
		$getdate['name'] = $my->name; // get friend's name
		$getfriends[] = $getdate;
	}
	
/* compare birthdate of friends and sorting them in ascending order  */
	function sortByOrder($a, $b) {
		return $a['dob_day'] - $b['dob_day'];
	}
	
	usort($getfriends, 'sortByOrder');
	
	$moduleclass_sfx = htmlspecialchars($params->get('moduleclass_sfx'));
	
	require JModuleHelper::getLayoutPath('mod_jomsocialbirth', $params->get('layout', 'default'));