/**
  * Get the full caption value for the slider with the 'hours' step type
  * @param Array dateArray
  * @param Boolean isLower
  * @return String
  */
 protected function getHoursCaption($dateArray, $isLower)
 {
     global $locale_info;
     $hours = $this->getAdjustedHoursValue($dateArray[3], $dateArray[4], $isLower);
     $dateArray[3] = $dateArray[4] = $dateArray[5] = 0;
     $dateArray = addHours($dateArray, $hours);
     $timeFormatString = str_replace($locale_info["LOCALE_STIME"] . "ss", "", $locale_info["LOCALE_STIMEFORMAT"]);
     return format_datetime_custom($dateArray, $timeFormatString);
 }
Esempio n. 2
0
function sync_project($gtdProj){
	#get all entries for that project
	#get staff, estimates and entries into arrays
	$staff = getStaff();
	$hours = getHours($gtdProj['id']);
	$est = getEsts($gtdProj['id']);

	$items = getBasecampHours($gtdProj['basecamp']);
	$x=0;
 	foreach ($items as $item) {
		#check entry to see if time entry enterned

		if (!$hours[$item->id]){
			#echo 'no hour entry movin forward <br>';
			#check to see if estimate is entered

			#echo 'est'.$est[$item->{'todo-item-id'}].'<br>' ;
			
			if (!$est[$item->{'todo-item-id'}] ){
				#echo 'no est entry moving forward <br>';
				#if no estimate create one
				$todo = getBasecampTodo($item->{'todo-item-id'});
			
				addEstimate($item->{'todo-item-id'},$todo->content,$gtdProj['id']);
				#echo 'added estimate '.$todo->content.'  '.$item->{'todo-item-id'}.'<br>';
				
			}

			# add hours 
			$est = getEsts($gtdProj['id']);

			addHours($item->{'id'}, $est[$item->{'todo-item-id'}], $staff[$item->{'person-id'}] ,$item->{'hours'}, $item->{'description'}, $item->{'date'});	
			#addHours($basecampID,$gtdEst,$gtdStaff,$hours,$desc,$date){	
			#echo 'added hour '.$staff[$item->{'person-id'}].' x '.$est[$item->{'todo-item-id'}].' <br>';
		#	echo $item->{'id'}.'   '. $est[$item->{'todo-item-id'}].'   '. $staff[$item->{'person-id'}] .'   '.$item->{'hours'}.'   '. $item->{'description'}.'   '. $item->{'date'}.'<br> dd  ';
			$hours = getHours($gtdProj['id']);
			#echo $item->description. ' entered <br><br><br>';	
			$x++;
		}
	}
	echo $x;
}
/**
* Get the date-time array with particular number of minutes added
* @param {number} minutes
* @param {array} dateArray		Date-time array
* @return {array}
*/
function addMinutes($dateArray, $minutes)
{
    $hours = floor($minutes / 60);
    if ($hours) {
        $dateArray = addHours($dateArray, $hours);
        $minutes = $minutes - $hours * 60;
    }
    if ($dateArray[4] + $minutes < 60) {
        $dateArray[4] = $dateArray[4] + $minutes;
    } else {
        $dateArray = addHours($dateArray, 1);
        $dateArray[4] = $dateArray[4] + $minutes - 60;
    }
    return $dateArray;
}
 /**
  * Get the step-rounded date/date-time formatted string
  * @param String value
  * @param Boolean isLower
  * @return String
  */
 protected function getRoundedDate($value, $isLower, $isKnob = false)
 {
     //array(year,month,day,hour,minute,second)
     $dateArray = $this->getDateTimeArray($value);
     switch ($this->stepType) {
         case FSST_SECONDS:
             if ($isKnob) {
                 return $this->getDateTimeString($dateArray);
             }
             $prepDateArray = $this->minDateArray;
             $diffSec = $this->getDifferenceInSecWithMin($value, $isLower);
             $prepDateArray = addSeconds($prepDateArray, $diffSec);
             return $this->getDateTimeString($prepDateArray);
         case FSST_MINUTES:
             if ($isKnob) {
                 return $this->getDateTimeString($dateArray);
             }
             $prepDateArray = $this->minDateArray;
             $diffSec = $this->getDifferenceInSecWithMin($value, $isLower);
             $minutes = floor($diffSec / 60);
             $prepDateArray = addMinutes($prepDateArray, $minutes);
             return $this->getDateTimeString($prepDateArray);
         case FSST_HOURS:
             $hours = $this->getAdjustedHoursValue($dateArray[3], $dateArray[4], $isLower);
             $dateArray[3] = $dateArray[4] = $dateArray[5] = 0;
             $dateArray = addHours($dateArray, $hours);
             return $this->getDateTimeString($dateArray);
         case FSST_DAYS:
             return format_shortdate($dateArray);
         case FSST_MONTHS:
             if ($isKnob) {
                 return format_shortdate($dateArray);
             }
             $dateArray[1] = $this->getAdjustedMonthNumber($dateArray[1], $isLower);
             $dateArray[2] = $isLower ? 1 : getLastMonthDayNumber($dateArray[0], $dateArray[1]);
             $dateArray[3] = $dateArray[4] = $dateArray[5] = 0;
             return format_shortdate($dateArray);
         case FSST_YEARS:
             $dateArray[3] = $dateArray[4] = $dateArray[5] = 0;
             $dateArray[1] = $isLower ? 1 : 12;
             $dateArray[2] = $isLower ? 1 : 31;
             return format_shortdate($dateArray);
         default:
             return $value;
     }
 }