Exemplo n.º 1
0
  static public function create($year=0, $month=0, $day=0, $hour=0, $minute=0, $second=0)
  {
    $d = new Date();

    $d->setYear($year);
    $d->setMonth($month);
    $d->setDay($day);
    $d->setHour($hour);
    $d->setMinute($minute);
    $d->setSecond($second);

    return $d;
  }
Exemplo n.º 2
0
 /**
  * Check start/end dates - note that check is the reverse of normal check:
  * if the operation interval is <= 60, must be start/end of an hour, to
  * make sure we update all the operation intervals in the hour, and if
  * the operation interval > 60, must be the start/end of an operation
  * interval, to make sure we update all the hours in the operation interval.
  *
  * @static
  * @param Date $oStartDate
  * @param Date $oEndDate
  * @return boolean
  */
 function checkDates($oStartDate, $oEndDate)
 {
     $aConf = $GLOBALS['_MAX']['CONF'];
     $operationInterval = $aConf['maintenance']['operation_interval'];
     if ($operationInterval <= 60) {
         // Must ensure that only one hour is being summarised
         if (!OX_OperationInterval::checkDatesInSameHour($oStartDate, $oEndDate)) {
             return false;
         }
         // Now check that the start and end dates are match the start and
         // end of the hour
         $oHourStart = new Date();
         $oHourStart->setYear($oStartDate->getYear());
         $oHourStart->setMonth($oStartDate->getMonth());
         $oHourStart->setDay($oStartDate->getDay());
         $oHourStart->setHour($oStartDate->getHour());
         $oHourStart->setMinute('00');
         $oHourStart->setSecond('00');
         $oHourEnd = new Date();
         $oHourEnd->setYear($oEndDate->getYear());
         $oHourEnd->setMonth($oEndDate->getMonth());
         $oHourEnd->setDay($oEndDate->getDay());
         $oHourEnd->setHour($oEndDate->getHour());
         $oHourEnd->setMinute('59');
         $oHourEnd->setSecond('59');
         if (!$oStartDate->equals($oHourStart)) {
             return false;
         }
         if (!$oEndDate->equals($oHourEnd)) {
             return false;
         }
     } else {
         // Must ensure that only one operation interval is being summarised
         $operationIntervalID = OX_OperationInterval::convertDaySpanToOperationIntervalID($oStartDate, $oEndDate, $operationInterval);
         if (is_bool($operationIntervalID) && !$operationIntervalID) {
             return false;
         }
         // Now check that the start and end dates match the start and end
         // of the operation interval
         list($oOperationIntervalStart, $oOperationIntervalEnd) = OX_OperationInterval::convertDateToOperationIntervalStartAndEndDates($oStartDate, $operationInterval);
         if (!$oStartDate->equals($oOperationIntervalStart)) {
             return false;
         }
         if (!$oEndDate->equals($oOperationIntervalEnd)) {
             return false;
         }
     }
     return true;
 }
Exemplo n.º 3
0
 public function getNextRunTime($date)
 {
     // check if $date is a timestamp...
     if ($date instanceof Date == false && is_integer($date)) {
         $date = new Date($date);
     }
     // assume now $date IS instanceof Date
     $cSecond = $date->getSecond();
     $cMinute = $date->getMinute();
     $cHour = $date->getHour();
     $cDay = $date->getDay();
     $cMonth = $date->getMonth();
     $cYear = $date->getYear();
     // required to check the number of days in the month
     $found = false;
     while ($found === false) {
         while ($found === false) {
             // iterate months...
             $cMonth = $this->findNextInArray($cMonth, $this->monthArray);
             if ($cMonth === null) {
                 break;
             }
             // find the day now
             while ($found === false) {
                 $cDay = $this->findNextInArray($cDay, $this->dayArray);
                 if ($cDay === null) {
                     break;
                 }
                 // here dayOfWeek and number of days in month should be checked!
                 $date = new Date();
                 $date->setYear($cYear);
                 $date->setMonth($cMonth);
                 $numberOfDaysInMonth = $date->getDaysInMonth();
                 if ($cDay > $numberOfDaysInMonth) {
                     break;
                 }
                 if ($this->dayOfWeekArray !== null) {
                     // get day of the week
                     $date->setDay($cDay);
                     $dayOfWeek = $date->getDayOfWeek();
                     if (!in_array($dayOfWeek, $this->dayOfWeekArray)) {
                         $cDay++;
                         continue;
                     }
                 }
                 while ($found === false) {
                     if ($cHour == 24) {
                         break;
                     }
                     $cHour = $this->findNextInArray($cHour, $this->hourArray);
                     if ($cHour === null) {
                         break;
                     }
                     while ($found === false) {
                         if ($cMinute == 60) {
                             break;
                         }
                         $cMinute = $this->findNextInArray($cMinute, $this->minuteArray);
                         if ($cMinute === null) {
                             break;
                         }
                         while ($found === false) {
                             if ($cSecond == 60) {
                                 break;
                             }
                             $cSecond = $this->findNextInArray($cSecond, $this->secondArray);
                             if ($cSecond === null) {
                                 break;
                             } else {
                                 // FOUND IT!!! WOOOO!
                                 // create Date object
                                 $date = new Date();
                                 $date->setYear($cYear);
                                 $date->setMonth($cMonth);
                                 $date->setDay($cDay);
                                 $date->setHour($cHour);
                                 $date->setMinute($cMinute);
                                 $date->setSecond($cSecond);
                                 return $date;
                             }
                         }
                         $cMinute++;
                         $cSecond = 0;
                     }
                     $cHour++;
                     $cMinute = 0;
                     $cSecond = 0;
                 }
                 $cDay++;
                 $cHour = 0;
                 $cMinute = 0;
                 $cSecond = 0;
             }
             $cMonth++;
             $cDay = 0;
             $cHour = 0;
             $cMinute = 0;
             $cSecond = 0;
         }
         $cYear++;
         $cMonth = 0;
         $cDay = 0;
         $cHour = 0;
         $cMinute = 0;
         $cSecond = 0;
     }
 }
Exemplo n.º 4
0
function create_conference() {
  global $log, $spUser,$_POST,$data; 
  $msgs = array(); 
  // check the title
  if (!$_POST[conference_name] ) { 
    $msgs[] = "Conference must have a title";
    return $msgs  ; 
  } 

  // validate the date ... 
  if (($conference_uts = strtotime($_POST[conference_date]))===false )  { 
    $msgs[] = "Conference date is an Invalid date.";
    return $msgs  ; 
  } 
  list ($m,$d,$y) = split('-',$_POST[conference_date]);

  // Make date objects...
  $confDate = new Date(); 
  $confDate->setMonth($m); 
  $confDate->setYear($y); 
  $confDate->setDay($d); 
  $confDate->setHour(0); 
  $confDate->setMinute(0); 
  $confDate->setSecond(0); 
  $beginTime = $confDate; 
  $endTime = $confDate; 

  list ($beginHour,$beginMinute) = split(':', $_POST[begin_time] ); 
  list ($endHour,$endMinute) = split(':', $_POST[end_time] ); 

  $beginTime->setHour($beginHour); 
  $beginTime->setMinute($beginMinute); 
  $endTime->setHour($endHour); 
  $endTime->setMinute($endMinute); 

  // see if it's the past
  if ($endTime->isPast() ){ 
    $msgs[] = "Conference date is in the Past.";
    return $msgs ; 
  }   

  // Make sure the end time is not less than the begin time
  if (Date::compare($endTime, $beginTime) != 1     ){ 
    $msgs[] = "Start time must be before end time.";
    return $msgs ; 
  }   
  
  // create a new Conference object

  $conference = new Conference($data->db, $spUser->username,$spUser->domain); 

  // get the user's company Id and load the companies constraints
  $conference->getCompanyId(); 
  $conference->loadConstraints() ; 
  // set the date objects.
  $conference->conferenceDate = $confDate; 
  $conference->beginTime = $beginTime; 
  $conference->endTime = $endTime; 
  $conference->conferenceName = $_POST[conference_name] ; 

  // Is the conference too long
  if (!$conference->isMaxTime()) {
    $msgs[] = "Your conference exceeds the maximum amount of minutes.";
    return $msgs  ; 
  } 
  
  // Are there other conferences scheduled for this time.
  if (!$conference->isMaxConcurrent()) {
    $msgs[] = "Your company has other conferences scheduled for this time.";
    return $msgs  ; 
  } 
  $error = "nay!"; 
  if ($conference->create($error) ) { 
    $msgs[] = "Conference created id = " . $conference->conferenceId;
    Header("Location: conference.php?msg=Conference created ") ;
  } else {
    $msgs[] = "Failed to create conference. ";
     $msgs[] = "$error";
  } 
  $owner = new Invitee($data->db, $conference->conferenceId);
  $owner->domain = $spUser->domain;
  $owner->username = $spUser->username;
  $owner->companyId = $conference->companyId; 
  $owner->inviteeEmail = $spUser->dbFields[email_address] ; 
  $owner->ownerFlag =  1; 
  $owner->inviteeName = $spUser->dbFields[first_name] . " " . $spUser->dbFields[last_name] ; 
  // genereate that unique code
  $owner->generateInviteeCode();   
  $owner->create();   
  $owner->sendNotify();   
  
  return $msgs  ; 


}
Exemplo n.º 5
0
 /**
  * Convert Date from iso 8601 format.
  *
  * @access private
  *
  * @param string $date  date string in ISO 8601 format
  * @param PEAR::Date &$oResult  transformed date
  * @param XML_RPC_Response &$oResponseWithError  response with error message
  *
  * @return boolean  shows true if method was executed successfully
  */
 function _convertDateFromIso8601Format($date, &$oResult, &$oResponseWithError)
 {
     $datetime = explode('T', $date);
     $year = substr($datetime[0], 0, strlen($datetime[0]) - 4);
     $month = substr($datetime[0], -4, 2);
     $day = substr($datetime[0], -2, 2);
     // Explicitly allow the "zero date" value to be set
     if ($year == 0 && $month == 0 && $day == 0) {
         return new Date('0000-00-00');
     }
     if ($year < 1970 || $year > 2038) {
         $oResponseWithError = XmlRpcUtils::generateError('Year should be in range 1970-2038');
         return false;
     } elseif ($month < 1 || $month > 12) {
         $oResponseWithError = XmlRpcUtils::generateError('Month should be in range 1-12');
         return false;
     } elseif ($day < 1 || $day > 31) {
         $oResponseWithError = XmlRpcUtils::generateError('Day should be in range 1-31');
         return false;
     } else {
         $oResult = new Date();
         $oResult->setYear($year);
         $oResult->setMonth($month);
         $oResult->setDay($day);
         return true;
     }
 }
Exemplo n.º 6
0
function DaysNameofMonth($Month, $Year)
{
    $date = new Date();
    $Date_Calc = new Date_Calc();
    $date->setYear($Year);
    $date->setMonth($Month);
    $NodaysMonth = $date->getDaysInMonth();
    $firstDate = $Year . "-" . $Month . "-01";
    $date->setDate($firstDate);
    $daysName = array();
    for ($i = 0; $i < $NodaysMonth; $i++) {
        $daysName[$i] = $date->getDayName(True, 3);
        $getNextday = $date->getNextDay();
        $date->setDate($getNextday);
    }
    return $daysName;
}
Exemplo n.º 7
0
function showSelectPage()
{
    global $tpl;
    global $us;
    global $badgerDb;
    handleOldFinishedTransactions(new AccountManager($badgerDb));
    $widgets = new WidgetEngine($tpl);
    $widgets->addCalendarJS();
    $widgets->addToolTipJS();
    $tpl->addJavaScript("js/behaviour.js");
    $tpl->addJavaScript("js/prototype.js");
    $tpl->addJavaScript("js/statistics.js");
    $tpl->addHeaderTag('<script type="text/javascript">var badgerHelpChapter = "Statistiken";</script>');
    $dataGrid = new DataGrid($tpl);
    $dataGrid->sourceXML = BADGER_ROOT . "/core/XML/getDataGridXML.php?q=AccountManager";
    $dataGrid->headerName = array(getBadgerTranslation2('statistics', 'accColTitle'), getBadgerTranslation2('statistics', 'accColBalance'), getBadgerTranslation2('statistics', 'accColCurrency'));
    $dataGrid->columnOrder = array("title", "balance", 'currency');
    $dataGrid->initialSort = "title";
    $dataGrid->initialSortDirection = "asc";
    $dataGrid->headerSize = array(160, 100, 75);
    $dataGrid->cellAlign = array("left", 'right', 'left');
    $dataGrid->width = '30em';
    $dataGrid->height = '7em';
    $dataGrid->initDataGridJS();
    try {
        $preselectedAccounts = $us->getProperty('statisticsPreselectedAccounts');
        foreach ($preselectedAccounts as $currentPreselectedAccount) {
            $tpl->addOnLoadEvent("dgPreselectId('{$currentPreselectedAccount}');");
        }
    } catch (BadgerException $ex) {
    }
    $tpl->addOnLoadEvent("Behaviour.register(statisticsBehaviour);");
    $tpl->addOnLoadEvent("Behaviour.apply();");
    $widgets->addNavigationHead();
    $selectTitle = getBadgerTranslation2('statistics', 'pageTitle');
    echo $tpl->getHeader($selectTitle);
    $widgets->addToolTipLayer();
    $selectFormAction = BADGER_ROOT . '/modules/statistics/statistics.php';
    $graphTypeText = getBadgerTranslation2('statistics', 'type');
    $categoryTypeText = getBadgerTranslation2('statistics', 'category');
    $timeFrameText = getBadgerTranslation2('statistics', 'period');
    $summarizeCategoriesText = getBadgerTranslation2('statistics', 'catMerge');
    $accountsText = getBadgerTranslation2('statistics', 'accounts');
    $differentCurrencyWarningText = getBadgerTranslation2('statistics', 'attention');
    $fromText = getBadgerTranslation2('statistics', 'from');
    $toText = getBadgerTranslation2('statistics', 'to');
    $trendRadio = $widgets->createField('mode', null, 'trendPage', '', false, 'radio', 'checked="checked"');
    $trendLabel = $widgets->createLabel('mode', getBadgerTranslation2('statistics', 'trend'));
    $categoryRadio = $widgets->createField('mode', null, 'categoryPage', '', false, 'radio');
    $categoryLabel = $widgets->createLabel('mode', getBadgerTranslation2('statistics', 'categories'));
    $accountSelect = $dataGrid->writeDataGrid();
    $accountField = $widgets->createField('accounts', null, null, '', false, 'hidden');
    $monthArray = array('fullYear' => getBadgerTranslation2('statistics', 'fullYear'), '1' => getBadgerTranslation2('statistics', 'jan'), '2' => getBadgerTranslation2('statistics', 'feb'), '3' => getBadgerTranslation2('statistics', 'mar'), '4' => getBadgerTranslation2('statistics', 'apr'), '5' => getBadgerTranslation2('statistics', 'may'), '6' => getBadgerTranslation2('statistics', 'jun'), '7' => getBadgerTranslation2('statistics', 'jul'), '8' => getBadgerTranslation2('statistics', 'aug'), '9' => getBadgerTranslation2('statistics', 'sep'), '10' => getBadgerTranslation2('statistics', 'oct'), '11' => getBadgerTranslation2('statistics', 'nov'), '12' => getBadgerTranslation2('statistics', 'dec'));
    $monthSelect = $widgets->createSelectField('monthSelect', $monthArray, 'fullYear', '', false, 'onchange="updateDateRange();"');
    $now = new Date();
    $beginOfYear = new Date();
    $beginOfYear->setMonth(1);
    $beginOfYear->setDay(1);
    $yearInput = $widgets->createField('yearSelect', 4, $now->getYear(), '', false, 'text', 'onchange="updateDateRange();"');
    $startDateField = $widgets->addDateField("startDate", $beginOfYear->getFormatted());
    $endDateField = $widgets->addDateField("endDate", $now->getFormatted());
    $inputRadio = $widgets->createField('type', null, 'i', '', false, 'radio', 'checked="checked"');
    $inputLabel = $widgets->createLabel('type', getBadgerTranslation2('statistics', 'income'));
    $outputRadio = $widgets->createField('type', null, 'o', '', false, 'radio');
    $outputLabel = $widgets->createLabel('type', getBadgerTranslation2('statistics', 'expenses'));
    $summarizeRadio = $widgets->createField('summarize', null, 't', '', false, 'radio', 'checked="checked"');
    $summarizeLabel = $widgets->createLabel('summarize', getBadgerTranslation2('statistics', 'subCat'));
    $distinguishRadio = $widgets->createField('summarize', null, 'f', '', false, 'radio');
    $distinguishLabel = $widgets->createLabel('summarize', getBadgerTranslation2('statistics', 'subCat2'));
    $dateFormatField = $widgets->createField('dateFormat', null, $us->getProperty('badgerDateFormat'), null, false, 'hidden');
    $errorMsgAccountMissingField = $widgets->createField('errorMsgAccountMissing', null, getBadgerTranslation2('statistics', 'errorMissingAcc'), null, false, 'hidden');
    $errorMsgStartBeforeEndField = $widgets->createField('errorMsgStartBeforeEnd', null, getBadgerTranslation2('statistics', 'errorDate'), null, false, 'hidden');
    $errorMsgEndInFutureField = $widgets->createField('errorMsgEndInFuture', null, getBadgerTranslation2('statistics', 'errorEndDate'), null, false, 'hidden');
    $submitButton = $widgets->createButton('submit', getBadgerTranslation2('statistics', 'showButton'), 'submitSelect();', "Widgets/accept.gif");
    eval('echo "' . $tpl->getTemplate('statistics/select') . '";');
    eval('echo "' . $tpl->getTemplate('badgerFooter') . '";');
}
 private function computeSubscriptionDays($p_publication, $p_subscriptionTime) {
     $startDate = new Date();
     if ($p_publication->getTimeUnit() == 'D') {
         return $p_subscriptionTime;
     } elseif ($p_publication->getTimeUnit() == 'W') {
         return 7 * $p_subscriptionTime;
     } elseif ($p_publication->getTimeUnit() == 'M') {
         $endDate = new Date();
         $months = $p_subscriptionTime + $endDate->getMonth();
         $years = (int)($months / 12);
         $months = $months % 12;
         $endDate->setYear($endDate->getYear() + $years);
         $endDate->setMonth($months);
     } elseif ($p_publication->getTimeUnit() == 'Y') {
         $endDate = new Date();
         $endDate->setYear($endDate->getYear() + $p_subscriptionTime);
     }
     $dateCalc = new Date_Calc();
     return $dateCalc->dateDiff($endDate->getDay(), $endDate->getMonth(),
     $endDate->getYear(), $startDate->getDay(), $startDate->getMonth(), $startDate->getYear());
 }
Exemplo n.º 9
0
 public static function createCalendarioMes($mes, $ano, $modo)
 {
     //include_once('CalendarShow.class.php');
     $cal = new CalendarShow();
     $fecha = new Date();
     $fecha->setDay(1);
     $fecha->setMonth($mes);
     $fecha->setYear($ano);
     $fecha_uno = $fecha->toString(FMT_DATEMYSQL);
     $fecha->addMonths(1);
     $fecha->addDays(-1);
     $fecha_dos = $fecha->toString(FMT_DATEMYSQL);
     $diasEvento = array();
     $diasTareas = array();
     $c1 = TareaPeer::getCriterioAlcance();
     $crit0 = $c1->getNewCriterion(TareaPeer::FECHA_INICIO, $fecha_uno . " 00:00:00", Criteria::GREATER_EQUAL);
     $crit1 = $c1->getNewCriterion(TareaPeer::FECHA_INICIO, $fecha_dos . " 23:59:59", Criteria::LESS_EQUAL);
     $crit0->addAnd($crit1);
     $crit2 = $c1->getNewCriterion(TareaPeer::FECHA_VENCIMIENTO, $fecha_uno . " 00:00:00", Criteria::GREATER_EQUAL);
     $crit3 = $c1->getNewCriterion(TareaPeer::FECHA_VENCIMIENTO, $fecha_dos . " 23:59:59", Criteria::LESS_EQUAL);
     $crit2->addAnd($crit3);
     $crit0->addOr($crit2);
     $c1->add($crit0);
     $c1->setDistinct();
     $dias = TareaPeer::doSelect($c1);
     $ruta = UsuarioPeer::getRuta();
     foreach ($dias as $dia) {
         $fecha_inicio = $dia->getFechaInicio('Y-m-d');
         $fecha_fin = $dia->getFechaVencimiento('Y-m-d');
         if ($fecha_inicio == $fecha_fin) {
             if ($dia->getEsEvento() == '1') {
                 if (!isset($diasEvento[$fecha_inicio])) {
                     $diasEvento[$fecha_inicio] = "";
                 }
                 //$diasEvento[$fecha_inicio] .= "<div style=\"background-color: #4078B5; color: #ffffff;\"><a href=\"".$ruta."/tareas/show/?id_tarea=".$dia->getIdTarea()."\" style=\"color: #ffffff;\">".$dia->getResumen()."</a></div>";
                 $diasEvento[$fecha_inicio] .= $dia->getResumen();
             } else {
                 if (!isset($diasTareas[$fecha_inicio])) {
                     $diasTareas[$fecha_inicio] = "";
                 }
                 //$diasTareas[$fecha_inicio] .= "<div style=\"background-color: #76BB5F; color: #fff;\"><a href=\"".$ruta."/tareas/show/?id_tarea=".$dia->getIdTarea()."\" style=\"color: #ffffff;\">".$dia->getResumen()."</a></div>";
                 $diasTareas[$fecha_inicio] .= $dia->getResumen();
             }
         } else {
             if ($dia->getEsEvento() == '1') {
                 if (!isset($diasEvento[$fecha_inicio])) {
                     $diasEvento[$fecha_inicio] = "";
                 }
                 if (!isset($diasEvento[$fecha_fin])) {
                     $diasEvento[$fecha_fin] = "";
                 }
                 //$diasEvento[$fecha_inicio] .= "<div style=\"background-color: #4078B5; color: #ffffff;\"><a href=\"".$ruta."/tareas/show/?id_tarea=".$dia->getIdTarea()."\" style=\"color: #ffffff;\">Inicio Evento: ".$dia->getResumen()."</a></div>";
                 $diasEvento[$fecha_inicio] .= $dia->getResumen();
                 //$diasEvento[$fecha_fin] .= "<div style=\"background-color: #4078B5; color: #ffffff;\"><a href=\"".$ruta."/tareas/show/?id_tarea=".$dia->getIdTarea()."\" style=\"color: #ffffff;\">Vencimiento Evento: ".$dia->getResumen()."</a></div>";
                 $diasEvento[$fecha_fin] .= $dia->getResumen();
             } else {
                 if (!isset($diasTareas[$fecha_inicio])) {
                     $diasTareas[$fecha_inicio] = "";
                 }
                 if (!isset($diasTareas[$fecha_fin])) {
                     $diasTareas[$fecha_fin] = "";
                 }
                 //$diasTareas[$fecha_inicio] .= "<div style=\"background-color: #76BB5F; color: #fff;\"><a href=\"".$ruta."/tareas/show/?id_tarea=".$dia->getIdTarea()."\" style=\"color: #ffffff;\">Inicio Tarea: ".$dia->getResumen()."</a></div>";
                 $diasTareas[$fecha_inicio] .= $dia->getResumen();
                 //$diasTareas[$fecha_fin] .= "<div style=\"background-color: #76BB5F; color: #fff;\"><a href=\"".$ruta."/tareas/show/?id_tarea=".$dia->getIdTarea()."\" style=\"color: #ffffff;\">Vencimiento Tarea: ".$dia->getResumen()."</a></div>";
                 $diasTareas[$fecha_fin] .= $dia->getResumen();
             }
         }
         /*
         if ($dia->getEsEvento() == '1') {
             if (isset($diasEvento[$fecha]))
                 $diasEvento[$fecha] .= "<div style=\"background-color: #4078B5; color: #ffffff;\"><a href=\"".$ruta."/tareas/show/?id_tarea=".$dia->getIdTarea()."\" style=\"color: #ffffff;\">".$dia->getResumen()."</a></div>";
             else
                 $diasEvento[$fecha] = "<div style=\"background-color: #4078B5; color: #ffffff;\"><a href=\"".$ruta."/tareas/show/?id_tarea=".$dia->getIdTarea()."\" style=\"color: #ffffff;\">".$dia->getResumen()."</a></div>";		 		
         }
         else {
         		if (isset($diasTareas[$fecha]))
                 $diasTareas[$fecha] .= "<div style=\"background-color: #76BB5F; color: #fff;\"><a href=\"".$ruta."/tareas/show/?id_tarea=".$dia->getIdTarea()."\" style=\"color: #ffffff;\">".$dia->getResumen()."</a></div>";
         		else
         		    $diasTareas[$fecha] = "<div style=\"background-color: #76BB5F; color: #fff;\"><a href=\"".$ruta."/tareas/show/?id_tarea=".$dia->getIdTarea()."\" style=\"color: #ffffff;\">".$dia->getResumen()."</a></div>";
         }
         */
         $filters = array();
         $filters['fecha_inicio']['from'] = $dia->getFechaInicio('d/m/Y');
         $filters['fecha_inicio']['to'] = $dia->getFechaVencimiento('d/m/Y');
         if ($modo) {
             if ($fecha_inicio != $fecha_fin) {
                 $cal->setDateLink($fecha_inicio, "tareas/list?mes=" . $dia->getFechaInicio('m') . "&year=" . $dia->getFechaInicio('Y') . "&filters=" . $filters);
                 $cal->setDateLink($fecha_fin, "tareas/list?mes=" . $dia->getFechaInicio('m') . "&year=" . $dia->getFechaInicio('Y') . "&filters=" . $filters);
             } else {
                 $cal->setDateLink($fecha_inicio, "tareas/list?mes=" . $dia->getFechaInicio('m') . "&year=" . $dia->getFechaInicio('Y') . "&filters=" . $filters);
             }
         } else {
             if ($fecha_inicio != $fecha_fin) {
                 $cal->setDateLink($fecha_inicio, "1");
                 $cal->setDateLink($fecha_fin, "1");
             } else {
                 $cal->setDateLink($fecha_inicio, "1");
             }
         }
     }
     $cal->setDaysInColor($diasEvento);
     $cal->setDaysFree($diasTareas);
     return $cal;
 }
Exemplo n.º 10
0
 /**
  * @covers Geissler\Converter\Model\Date::getMonth
  */
 public function testGetMonth()
 {
     $this->assertInstanceOf($this->class, $this->object->setMonth(10));
     $this->assertEquals(10, $this->object->getMonth());
 }
Exemplo n.º 11
0
 /**
  * Compares the given date and the current date.
  *
  * @return integer
  * @link http://www.php.net/manual/en/function.mktime.php
  */
 function _compareGivenDateAndCurrentDate()
 {
     $givenDate = new Date();
     $givenDate->setYear($this->_year);
     $givenDate->setMonth($this->_month);
     $givenDate->setDay($this->_day);
     $givenDate->setHour(0);
     $givenDate->setMinute(0);
     $givenDate->setSecond(0);
     $currentDate = new Date();
     $currentDate->setHour(0);
     $currentDate->setMinute(0);
     $currentDate->setSecond(0);
     return @Date::compare($givenDate, $currentDate);
 }
function nombre_periodo($duracion_periodo_meses = 1, $numero_periodo = null, $anio = null)
{
    $resultado = null;
    if (isset($anio)) {
        if ($duracion_periodo_meses == 1) {
            if ($numero_periodo) {
                $mi_date = new Date();
                $mi_date->setMonth($numero_periodo);
                $mi_date->setYear($anio);
                $resultado = format_date($mi_date->getTimestamp(), 'MMMM yyyy');
            } else {
                $resultado = $anio;
            }
        } else {
            $lista_posiciones = array('1' => __('primer'), '2' => __('segundo'), '3' => __('tercer'), '4' => __('cuarto'), '5' => __('quinto'), '6' => __('sexto'));
            $tipos_periodo = CampoPeer::getTiposPeriodo();
            $periodo = __('%posicion% %periodo%', array('%posicion%' => isset($lista_posiciones[$numero_periodo]) ? $lista_posiciones[$numero_periodo] : '', '%periodo%' => isset($tipos_periodo[$duracion_periodo_meses]) ? $tipos_periodo[$duracion_periodo_meses] : ''));
            if (isset($numero_periodo) && $numero_periodo != '') {
                $resultado = __('%periodo% de %year%', array('%periodo%' => $periodo, '%year%' => $anio));
            } else {
                $resultado = $anio;
            }
        }
    }
    return $resultado;
}