当前位置: 首页>>代码示例>>PHP>>正文


PHP Date::setYear方法代码示例

本文整理汇总了PHP中Date::setYear方法的典型用法代码示例。如果您正苦于以下问题:PHP Date::setYear方法的具体用法?PHP Date::setYear怎么用?PHP Date::setYear使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Date的用法示例。


在下文中一共展示了Date::setYear方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: checkDates

 /**
  * 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;
 }
开发者ID:villos,项目名称:tree_admin,代码行数:61,代码来源:Regenerate.php

示例2: getLinks

 public function getLinks()
 {
     $oDate = new Date($this->oStart);
     $oNow = new Date();
     $aLinks = array();
     $baseUrl = parent::getUrl(false);
     $year = $oDate->getYear();
     $aLinks['prev'] = array('label' => '< ' . ($year - 1), 'url' => $this->appendToUrl($baseUrl, 'year=' . ($year - 1)));
     $oDate->setYear($year + 1);
     $aLinks['next'] = array('label' => $year + 1 . ' >');
     if ($oNow->after($oDate)) {
         $aLinks['next']['url'] = $this->appendToUrl($baseUrl, 'year=' . ($year + 1));
     }
     return $aLinks;
 }
开发者ID:SamWinchester,项目名称:revive-adserver,代码行数:15,代码来源:Monthly.php

示例3: create_conference

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  ; 


}
开发者ID:BackupTheBerlios,项目名称:sipums,代码行数:95,代码来源:new_conference.php

示例4: explode

 /**
  * 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;
     }
 }
开发者ID:ballistiq,项目名称:revive-adserver,代码行数:38,代码来源:XmlRpcUtils.php

示例5: DaysNameofMonth

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;
}
开发者ID:hotveryspicy,项目名称:work_sneha,代码行数:17,代码来源:functions.php

示例6: expandPlannedTransactions

 /**
  * Expands the planned transactions.
  * 
  * All occurences of planned transactions between now and the targetFutureCalcDate will be inserted
  * in finishedTransactions. For distinction the planned transactions will have a 'p' as first character
  * in their id.
  * 
  * @throws BadgerException If an illegal repeat unit is used.
  */
 public function expandPlannedTransactions()
 {
     $now = new Date();
     $now->setHour(0);
     $now->setMinute(0);
     $now->setSecond(0);
     foreach ($this->plannedTransactions as $currentTransaction) {
         $date = new Date($currentTransaction->getBeginDate());
         $dayOfMonth = $date->getDay();
         //While we have not reached targetFutureCalcDate
         while ($this->targetFutureCalcDate->after($date) && !$date->after(is_null($tmp = $currentTransaction->getEndDate()) ? new Date('9999-12-31') : $tmp)) {
             $inRange = true;
             //Check if there is one or more valutaDate filter and apply them
             foreach ($this->filter as $currentFilter) {
                 if ($currentFilter['key'] == 'valutaDate') {
                     switch ($currentFilter['op']) {
                         case 'eq':
                             if (Date::compare($date, $currentFilter['val']) != 0) {
                                 $inRange = false;
                             }
                             break;
                         case 'lt':
                             if (Date::compare($date, $currentFilter['val']) >= 0) {
                                 $inRange = false;
                             }
                             break;
                         case 'le':
                             if (Date::compare($date, $currentFilter['val']) > 0) {
                                 $inRange = false;
                             }
                             break;
                         case 'gt':
                             if (Date::compare($date, $currentFilter['val']) <= 0) {
                                 $inRange = false;
                             }
                             break;
                         case 'ge':
                             if (Date::compare($date, $currentFilter['val']) < 0) {
                                 $inRange = false;
                             }
                             break;
                         case 'ne':
                             if (Date::compare($date, $currentFilter['val']) == 0) {
                                 $inRange = false;
                             }
                             break;
                         case 'bw':
                         case 'ew':
                         case 'ct':
                             if (strncasecmp($date->getFormatted(), $currentFilter['val']->getFormatted(), 9999) != 0) {
                                 $inRange = false;
                             }
                             break;
                     }
                     if (!$inRange) {
                         break;
                     }
                 }
             }
             if (!$date->before($now) && $inRange) {
                 $this->finishedTransactions[] = new FinishedTransaction($this->badgerDb, $this, 'p' . $currentTransaction->getId() . '_' . $date->getDate(), $currentTransaction->getTitle(), $currentTransaction->getAmount(), $currentTransaction->getDescription(), new Date($date), $currentTransaction->getTransactionPartner(), $currentTransaction->getCategory(), $currentTransaction->getOutsideCapital(), false, true, $currentTransaction, 'PlannedTransaction');
             }
             //do the date calculation
             switch ($currentTransaction->getRepeatUnit()) {
                 case 'day':
                     $date->addSeconds($currentTransaction->getRepeatFrequency() * 24 * 60 * 60);
                     break;
                 case 'week':
                     $date->addSeconds($currentTransaction->getRepeatFrequency() * 7 * 24 * 60 * 60);
                     break;
                 case 'month':
                     //Set the month
                     $date = new Date(Date_Calc::endOfMonthBySpan($currentTransaction->getRepeatFrequency(), $date->getMonth(), $date->getYear(), '%Y-%m-%d'));
                     //And count back as far as the last valid day of this month
                     while ($date->getDay() > $dayOfMonth) {
                         $date->subtractSeconds(24 * 60 * 60);
                     }
                     break;
                 case 'year':
                     $newYear = $date->getYear() + $currentTransaction->getRepeatFrequency();
                     if ($dayOfMonth == 29 && $date->getMonth() == 2 && !Date_Calc::isLeapYear($newYear)) {
                         $date->setDay(28);
                     } else {
                         $date->setDay($dayOfMonth);
                     }
                     $date->setYear($newYear);
                     break;
                 default:
                     throw new BadgerException('Account', 'IllegalRepeatUnit', $currentTransaction->getRepeatUnit());
                     exit;
             }
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:badger-svn,代码行数:101,代码来源:Account.class.php

示例7: computeSubscriptionDays

 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());
 }
开发者ID:nistormihai,项目名称:Newscoop,代码行数:21,代码来源:MetaActionEdit_Subscription.php

示例8: nombre_periodo

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;
}
开发者ID:Esleelkartea,项目名称:legedia-ESLE,代码行数:26,代码来源:FormularioModeloHelper.php

示例9: Date

 function next_payment_date($pdate = '')
 {
     $date = new Date($pdate ? $pdate : $this->data['xp_pmt_date']);
     switch ($this->data['payment_frequency']) {
         case "W":
             $date->addSeconds(7 * 24 * 60 * 60);
             break;
         case "BW":
             $date->addSeconds(14 * 24 * 60 * 60);
             break;
         case "M":
             $date->addSeconds($date->getDaysInMonth() * 24 * 60 * 60);
             break;
         case "Q":
             $date->addSeconds($date->getDaysInMonth() * 24 * 60 * 60);
             $date->addSeconds($date->getDaysInMonth() * 24 * 60 * 60);
             $date->addSeconds($date->getDaysInMonth() * 24 * 60 * 60);
             break;
         case "SA":
             $date->addSeconds($date->getDaysInMonth() * 24 * 60 * 60);
             $date->addSeconds($date->getDaysInMonth() * 24 * 60 * 60);
             $date->addSeconds($date->getDaysInMonth() * 24 * 60 * 60);
             $date->addSeconds($date->getDaysInMonth() * 24 * 60 * 60);
             $date->addSeconds($date->getDaysInMonth() * 24 * 60 * 60);
             $date->addSeconds($date->getDaysInMonth() * 24 * 60 * 60);
             break;
         case "A":
             $date->setYear($date->getYear() + 1);
             break;
     }
     return $date->format('%Y-%m-%d');
 }
开发者ID:henkmahendra,项目名称:emms-devel,代码行数:32,代码来源:loan.php

示例10: testGetYear

 /**
  * @covers Geissler\Converter\Model\Date::getYear
  */
 public function testGetYear()
 {
     $this->assertInstanceOf($this->class, $this->object->setYear(1984));
     $this->assertEquals(1984, $this->object->getYear());
 }
开发者ID:avvertix,项目名称:converter,代码行数:8,代码来源:DateTest.php

示例11: Date

 /**
  * 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);
 }
开发者ID:nyarla,项目名称:fluxflex-rep2ex,代码行数:21,代码来源:Date.php

示例12: transferFinishedTransactions

function transferFinishedTransactions($account, $plannedTransaction)
{
    $now = new Date();
    $date = new Date($plannedTransaction->getBeginDate());
    $dayOfMonth = $date->getDay();
    //While we are before now and the end date of this transaction
    while (!$date->after($now) && !$date->after(is_null($tmp = $plannedTransaction->getEndDate()) ? new Date('9999-12-31') : $tmp)) {
        $account->addFinishedTransaction($plannedTransaction->getAmount(), $plannedTransaction->getTitle(), $plannedTransaction->getDescription(), new Date($date), $plannedTransaction->getTransactionPartner(), $plannedTransaction->getCategory(), $plannedTransaction->getOutsideCapital(), false, true);
        //do the date calculation
        switch ($plannedTransaction->getRepeatUnit()) {
            case 'day':
                $date->addSeconds($plannedTransaction->getRepeatFrequency() * 24 * 60 * 60);
                break;
            case 'week':
                $date->addSeconds($plannedTransaction->getRepeatFrequency() * 7 * 24 * 60 * 60);
                break;
            case 'month':
                //Set the month
                $date = new Date(Date_Calc::endOfMonthBySpan($plannedTransaction->getRepeatFrequency(), $date->getMonth(), $date->getYear(), '%Y-%m-%d'));
                //And count back as far as the last valid day of this month
                while ($date->getDay() > $dayOfMonth) {
                    $date->subtractSeconds(24 * 60 * 60);
                }
                break;
            case 'year':
                $newYear = $date->getYear() + $plannedTransaction->getRepeatFrequency();
                if ($dayOfMonth == 29 && $date->getMonth() == 2 && !Date_Calc::isLeapYear($newYear)) {
                    $date->setDay(28);
                } else {
                    $date->setDay($dayOfMonth);
                }
                $date->setYear($newYear);
                break;
            default:
                throw new BadgerException('Account', 'IllegalRepeatUnit', $plannedTransaction->getRepeatUnit());
                exit;
        }
    }
}
开发者ID:BackupTheBerlios,项目名称:badger-svn,代码行数:39,代码来源:Transaction.php

示例13: previousOccurence

 private function previousOccurence($date, $start = null)
 {
     if (is_null($start)) {
         $start = $this->beginDate;
     }
     $dayOfMonth = $start->getDay();
     //do the date calculation
     switch ($this->repeatUnit) {
         case 'day':
             $date->subtractSeconds($this->repeatFrequency * 24 * 60 * 60);
             break;
         case 'week':
             $date->subtractSeconds($this->repeatFrequency * 7 * 24 * 60 * 60);
             break;
         case 'month':
             //Set the month
             $date = new Date(Date_Calc::endOfMonthBySpan(-$this->repeatFrequency, $date->getMonth(), $date->getYear(), '%Y-%m-%d'));
             //And count back as far as the last valid day of this month
             while ($date->getDay() > $dayOfMonth) {
                 $date->subtractSeconds(24 * 60 * 60);
             }
             break;
         case 'year':
             $newYear = $date->getYear() - $this->repeatFrequency;
             if ($dayOfMonth == 29 && $date->getMonth() == 2 && !Date_Calc::isLeapYear($newYear)) {
                 $date->setDay(28);
             } else {
                 $date->setDay($dayOfMonth);
             }
             $date->setYear($newYear);
             break;
         default:
             throw new BadgerException('Account', 'IllegalRepeatUnit', $this->repeatUnit);
             exit;
     }
     //switch
     return $date;
 }
开发者ID:BackupTheBerlios,项目名称:badger-svn,代码行数:38,代码来源:PlannedTransaction.class.php

示例14: getWeekOfYear

  public function getWeekOfYear()
  {
    $day = $this->day;
    $month = $this->month;
    $year = $this->year;

    $mnth = array (0,31,59,90,120,151,181,212,243,273,304,334);
    $y_isleap = $this->isLeapYear();

    $d = new Date($this);
    $d->setYear($this->year - 1);

    $y_1_isleap = $d->isLeapYear();

    $day_of_year_number = $day + $mnth[$month - 1];
    if ($y_isleap &&  $month > 2)
      $day_of_year_number++;

    // find Jan 1 weekday (monday = 1, sunday = 7)
    $yy = ($year - 1) % 100;
    $c = ($year - 1) - $yy;
    $g = $yy + intval($yy/4);
    $jan1_weekday = 1 + intval((((($c / 100) % 4) * 5) + $g) % 7);

    // weekday for year-month-day
    $h = $day_of_year_number + ($jan1_weekday - 1);
    $weekday = 1 + intval(($h - 1) % 7);

    // find if Y M D falls in YearNumber Y-1, WeekNumber 52 or
    if ($day_of_year_number <= (8 - $jan1_weekday) &&  $jan1_weekday > 4)
    {
      $yearnumber = $year - 1;
      if ($jan1_weekday == 5 ||  ($jan1_weekday == 6 &&  $y_1_isleap))
        $weeknumber = 53;
      else
        $weeknumber = 52;
    }
    else
      $yearnumber = $year;

    // find if Y M D falls in YearNumber Y+1, WeekNumber 1
    if ($yearnumber == $year)
    {
      if ($y_isleap)
        $i = 366;
      else
        $i = 365;

      if (($i - $day_of_year_number) < (4 - $weekday))
      {
        $yearnumber++;
        $weeknumber = 1;
      }
    }
    // find if Y M D falls in YearNumber Y, WeekNumber 1 through 53
    if ($yearnumber == $year)
    {
      $j = $day_of_year_number + (7 - $weekday) + ($jan1_weekday - 1);
      $weeknumber = intval($j / 7); // kludge!!! - JMC
      if ($jan1_weekday > 4)
        $weeknumber--;
    }

    return $weeknumber;
  }
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:65,代码来源:Date.class.php

示例15: createCalendarioMes

 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");
             }
         }
//.........这里部分代码省略.........
开发者ID:Esleelkartea,项目名称:legedia-ESLE,代码行数:101,代码来源:TareaPeer.php


注:本文中的Date::setYear方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。