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


PHP Date::setMinute方法代码示例

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


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

示例1: getSpan

 /**
  * A method that can be inherited and used by children classes to get the
  * required date span of a statistics page.
  *
  * @param object $oCaller      The calling object. Expected to have the
  *                             the following class variables:
  *                                  $oCaller->aPlugins    - An array of statistics fields plugins
  *                                  $oCaller->oStartDate  - Will be set by method
  *                                  $oCaller->spanDays    - Will be set by method
  *                                  $oCaller->spanWeeks   - Will be set by method
  *                                  $oCaller->spanMonths  - Will be set by method
  * @param array  $aParams      An array of query parameters for
  *                             {@link Admin_DA::fromCache()}.
  */
 function getSpan(&$oCaller, $aParams)
 {
     $oStartDate = new Date(date('Y-m-d'));
     $oStartDate->setHour(0);
     $oStartDate->setMinute(0);
     $oStartDate->setSecond(0);
     // Check span using all plugins
     foreach ($oCaller->aPlugins as $oPlugin) {
         $aPluginParams = call_user_func(array($oPlugin, 'getHistorySpanParams'));
         $aSpan = Admin_DA::fromCache('getHistorySpan', $aParams + $aPluginParams);
         if (!empty($aSpan['start_date'])) {
             $oDate = new Date($aSpan['start_date']);
             $oDate->setTZbyID('UTC');
             if ($oDate->before($oStartDate)) {
                 $oDate->convertTZ($oStartDate->tz);
                 $oStartDate = new Date($oDate);
             }
         }
     }
     $oStartDate->setHour(0);
     $oStartDate->setMinute(0);
     $oStartDate->setSecond(0);
     $oNow = new Date();
     $oSpan = new Date_Span(new Date($oStartDate), new Date($oNow->format('%Y-%m-%d')));
     // Store the span data required for stats display
     $oCaller->oStartDate = $oStartDate;
     $oCaller->spanDays = (int) ceil($oSpan->toDays());
     $oCaller->spanWeeks = (int) ceil($oCaller->spanDays / 7) + ($oCaller->spanDays % 7 ? 1 : 0);
     $oCaller->spanMonths = ($oNow->getYear() - $oStartDate->getYear()) * 12 + ($oNow->getMonth() - $oStartDate->getMonth()) + 1;
     // Set the caller's aDates span in the event that it's empty
     if (empty($oCaller->aDates)) {
         $oCaller->aDates['day_begin'] = $oStartDate->format('%Y-%m-%d');
         $oCaller->aDates['day_end'] = $oNow->format('%Y-%m-%d');
     }
 }
开发者ID:Apeplazas,项目名称:plazadelatecnologia,代码行数:49,代码来源:History.php

示例2: setTimeAndReturnUTC

 /**
  * A private method used to return a copy of a Date object after altering its time. It can work using
  * either UTC or the current TZ and eventually converting the result back to UTC.
  *
  * @param Date $oDate
  * @param bool $localTZ
  * @param int $hour
  * @param int $minute
  * @param int $second
  * @return Date
  */
 private function setTimeAndReturnUTC($oDate, $localTZ = false, $hour = 0, $minute = 0, $second = 0)
 {
     $oTz = $this->getTimeZone($localTZ);
     $oDateCopy = new Date($oDate);
     $oDateCopy->setHour($hour);
     $oDateCopy->setMinute($minute);
     $oDateCopy->setSecond($second);
     $oDateCopy->setTZ($oTz);
     $oDateCopy->toUTC();
     return $oDateCopy;
 }
开发者ID:Jaree,项目名称:revive-adserver,代码行数:22,代码来源:Statistics.php

示例3: create

  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;
  }
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:13,代码来源:Date.class.php

示例4: getStats

 function getStats()
 {
     // Set time zone to local
     OA_setTimeZoneLocal();
     $oEnd = new Date();
     $oEnd->setHour(0);
     $oEnd->setMinute(0);
     $oEnd->setSecond(0);
     $oEnd->toUTC();
     $oStart = new Date($oEnd);
     $oStart->subtractSpan(new Date_Span('7-0-0-0'));
     $oStart->toUTC();
     $doDsah = OA_Dal::factoryDO('data_summary_ad_hourly');
     $doDsah->selectAdd();
     $doDsah->selectAdd("DATE_FORMAT(date_time, '%Y-%m-%d') AS day");
     $doDsah->selectAdd('SUM(' . $doDsah->tableName() . '.impressions) AS total_impressions');
     $doDsah->selectAdd('SUM(' . $doDsah->tableName() . '.clicks) AS total_clicks');
     $doDsah->whereAdd("date_time >= '" . $doDsah->escape($oStart->format('%Y-%m-%d %H:%M:%S')) . "'");
     $doDsah->whereAdd("date_time < '" . $doDsah->escape($oEnd->format('%Y-%m-%d %H:%M:%S')) . "'");
     if (OA_Permission::isAccount(OA_ACCOUNT_MANAGER)) {
         $doBanners = OA_Dal::factoryDO('banners');
         $doCampaigns = OA_Dal::factoryDO('campaigns');
         $doClients = OA_Dal::factoryDO('clients');
         $doClients->agencyid = OA_Permission::getEntityId();
         $doCampaigns->joinAdd($doClients);
         $doBanners->joinAdd($doCampaigns);
         $doBanners->selectAdd();
         $doBanners->selectAdd("bannerid");
         $doBanners->find();
         $ad_ids = array();
         while ($doBanners->fetch()) {
             $ad_ids[] = $doBanners->bannerid;
         }
         if (empty($ad_ids)) {
             return array();
         }
         $doDsah->whereAdd("ad_id IN (" . implode(",", $ad_ids) . ")");
     }
     $doDsah->groupBy('day');
     $doDsah->orderBy('day');
     $doDsah->find();
     $aStats = array();
     while ($doDsah->fetch()) {
         $row = $doDsah->toArray();
         $aStats[0][date('D', strtotime($row['day']))] = $row['total_impressions'];
         $aStats[1][date('D', strtotime($row['day']))] = $row['total_clicks'];
     }
     return $aStats;
 }
开发者ID:Spark-Eleven,项目名称:revive-adserver,代码行数:49,代码来源:GraphOAP.php

示例5: 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

示例6: _setPeriodFilter

 protected function _setPeriodFilter($request)
 {
     $locale = Limb::toolkit()->getLocale();
     $start_date = new Date();
     $start_date->setHour(0);
     $start_date->setMinute(0);
     $start_date->setSecond(0);
     if ($stats_start_date = $request->get('stats_start_date')) {
         $start_date->setByLocaleString($locale, $stats_start_date, $locale->getShortDateTimeFormat());
     }
     $finish_date = new Date();
     if ($stats_finish_date = $request->get('stats_finish_date')) {
         $finish_date->setByLocaleString($locale, $stats_finish_date, $locale->getShortDateTimeFormat());
     }
     $finish_date->setHour(23);
     $finish_date->setMinute(59);
     $finish_date->setSecond(59);
     $this->_stats_report->setPeriodFilter($start_date, $finish_date);
 }
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:19,代码来源:StatsSearchEnginesListDatasource.class.php

示例7: process

 function process(&$sql)
 {
     $toolkit =& Limb::toolkit();
     $request =& $toolkit->getRequest();
     $start_date = new Date();
     $start_date->setHour(0);
     $start_date->setMinute(0);
     $start_date->setSecond(0);
     if ($stats_start_date = $request->get('start_date')) {
         $start_date->setByString($stats_start_date);
     }
     $finish_date = new Date();
     if ($stats_finish_date = $request->get('finish_date')) {
         $finish_date->setByString($stats_finish_date);
     }
     $finish_date->setHour(23);
     $finish_date->setMinute(59);
     $finish_date->setSecond(59);
     $start_stamp = $start_date->getStamp();
     $finish_stamp = $finish_date->getStamp();
     $sql->addCondition("master.time BETWEEN {$start_stamp} AND {$finish_stamp}");
 }
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:22,代码来源:StatsPeriodCriteria.class.php

示例8: modify

 /**
  * This method modifies an existing campaign. Undefined fields do not change
  * and defined fields with a NULL value also remain unchanged.
  *
  * @access public
  *
  * @param OA_Dll_CampaignInfo &$oCampaign <br />
  *          <b>For adding</b><br />
  *          <b>Required properties:</b> advertiserId<br />
  *          <b>Optional properties:</b> campaignName, startDate, endDate, impressions, clicks, priority, weight<br />
  *
  *          <b>For modify</b><br />
  *          <b>Required properties:</b> campaignId<br />
  *          <b>Optional properties:</b> advertiserId, campaignName, startDate, endDate, impressions, clicks, priority, weight, viewWindow, clickWindow<br />
  *
  * @return boolean  True if the operation was successful
  *
  */
 function modify(&$oCampaign)
 {
     if (!isset($oCampaign->campaignId)) {
         // Add
         $oCampaign->setDefaultForAdd();
         if (!$this->checkPermissions(array(OA_ACCOUNT_ADMIN, OA_ACCOUNT_MANAGER), 'clients', $oCampaign->advertiserId)) {
             return false;
         }
     } else {
         // Edit
         if (!$this->checkPermissions(array(OA_ACCOUNT_ADMIN, OA_ACCOUNT_MANAGER), 'campaigns', $oCampaign->campaignId)) {
             return false;
         }
     }
     $oStartDate = $oCampaign->startDate;
     $oEndDate = $oCampaign->endDate;
     $campaignData = (array) $oCampaign;
     $campaignData['campaignid'] = $oCampaign->campaignId;
     $campaignData['campaignname'] = $oCampaign->campaignName;
     $campaignData['clientid'] = $oCampaign->advertiserId;
     $oNow = new Date();
     if (is_object($oStartDate)) {
         $oDate = new Date($oStartDate);
         $oDate->setTZ($oNow->tz);
         $oDate->setHour(0);
         $oDate->setMinute(0);
         $oDate->setSecond(0);
         $oDate->toUTC();
         $campaignData['activate_time'] = $oDate->getDate(DATE_FORMAT_ISO);
     }
     if (is_object($oEndDate)) {
         $oDate = new Date($oEndDate);
         $oDate->setTZ($oNow->tz);
         $oDate->setHour(23);
         $oDate->setMinute(59);
         $oDate->setSecond(59);
         $oDate->toUTC();
         $campaignData['expire_time'] = $oDate->getDate(DATE_FORMAT_ISO);
     }
     $campaignData['views'] = $oCampaign->impressions;
     $campaignData['target_impression'] = $oCampaign->targetImpressions;
     $campaignData['target_click'] = $oCampaign->targetClicks;
     $campaignData['target_conversion'] = $oCampaign->targetConversions;
     $campaignData['revenue_type'] = $oCampaign->revenueType;
     $campaignData['capping'] = $oCampaign->capping > 0 ? $oCampaign->capping : 0;
     $campaignData['session_capping'] = $oCampaign->sessionCapping > 0 ? $oCampaign->sessionCapping : 0;
     $campaignData['block'] = $oCampaign->block > 0 ? $oCampaign->block : 0;
     $campaignData['viewwindow'] = $oCampaign->viewWindow;
     $campaignData['clickwindow'] = $oCampaign->clickWindow;
     if ($this->_validate($oCampaign)) {
         $doCampaign = OA_Dal::factoryDO('campaigns');
         if (!isset($oCampaign->campaignId)) {
             $doCampaign->setFrom($campaignData);
             $oCampaign->campaignId = $doCampaign->insert();
         } else {
             $doCampaign->get($campaignData['campaignid']);
             $doCampaign->setFrom($campaignData);
             $doCampaign->update();
         }
         return true;
     } else {
         return false;
     }
 }
开发者ID:Jaree,项目名称:revive-adserver,代码行数:82,代码来源:Campaign.php

示例9: isMidnightMaintenance

 /**
  * A method to check if midnight tasks should run
  *
  * @param Date $oLastRun
  * @return boolean
  */
 function isMidnightMaintenance($oLastRun)
 {
     global $serverTimezone;
     if (empty($oLastRun)) {
         return true;
     }
     $oServiceLocator =& OA_ServiceLocator::instance();
     $lastMidnight = new Date($oServiceLocator->get('now'));
     if (!empty($serverTimezone)) {
         $lastMidnight->convertTZbyID($serverTimezone);
     }
     $lastMidnight->setHour(0);
     $lastMidnight->setMinute(0);
     $lastMidnight->setSecond(0);
     $oLastRunCopy = new Date($oLastRun);
     return $oLastRunCopy->before($lastMidnight);
 }
开发者ID:ballistiq,项目名称:revive-adserver,代码行数:23,代码来源:Maintenance.php

示例10: uniqid

 /**
  * Tests that an e-mail reporting on impending campaign expiration
  * is able to be generated correctly.
  */
 function testSendAndPrepareCampaignImpendingExpiryEmail()
 {
     $adminContact = 'Andrew Hill';
     $adminName = 'OpenX Limited';
     $adminMail = 'send@example.com';
     $adminCompany = 'Admin company name';
     $adminAccountId = 100;
     $agencyName = 'Agency Ltd.';
     $agencyContact = 'Mr. Foo Bar Agency';
     $agencyMail = 'send@agency.com';
     $advertiserName = 'Foo Client';
     $advertiserMail = 'advertiser@example.com';
     $advertiserUsername = 'advertiserusername';
     $aConf =& $GLOBALS['_MAX']['CONF'];
     $aConf['webpath']['admin'] = 'example.com';
     $aConf['email']['fromAddress'] = $adminMail;
     $aConf['email']['fromName'] = $adminName;
     $aConf['email']['fromCompany'] = $adminCompany;
     $aConf['email']['useManagerDetails'] = true;
     $aConf['email']['logOutgoing'] = true;
     $mockName = uniqid('PartialMockOA_Email_');
     Mock::generatePartial('OA_Email', $mockName, array('sendMail'));
     $oEmail = new $mockName();
     $oEmail->setReturnValue('sendMail', true);
     // Prepare valid test data
     $dateReason = 'date';
     $dateValue = '2007-05-15';
     $impReason = 'impressions';
     $impValue = 100;
     // The tests below assume that the number of days before a campaign expires when the
     $oCampaignDate = new Date($dateValue);
     $oCampaignDate->setHour(23);
     $oCampaignDate->setMinute(59);
     $oCampaignDate->setSecond(59);
     $oCampaignDate->toUTC();
     $oTwoDaysPriorDate = new Date($dateValue);
     $oTwoDaysPriorDate->subtractSeconds(2 * 24 * 60 * 60 - 10);
     $oNowDate = new Date($dateValue);
     // Prepare an admin user
     // Create the admin account
     $doAccounts = OA_Dal::factoryDO('accounts');
     $doAccounts->account_name = 'System Administrator';
     $doAccounts->account_type = OA_ACCOUNT_ADMIN;
     $adminAccountId = DataGenerator::generateOne($doAccounts);
     // Setup the admin account id
     $doAppVar = OA_Dal::factoryDO('application_variable');
     $doAppVar->name = 'admin_account_id';
     $doAppVar->value = $adminAccountId;
     // Create an user
     $doAdminUser = OA_Dal::factoryDO('users');
     $doAdminUser->contact_name = $adminContact;
     $doAdminUser->email_address = $adminMail;
     $doAdminUser->username = $adminName;
     $doAdminUser->password = md5('password');
     $doAdminUser->language = 'en';
     $doAdminUser->default_account_id = $adminAccountId;
     $adminUserId = DataGenerator::generateOne($doAdminUser);
     $doAdminUser = OA_Dal::staticGetDO('users', $adminUserId);
     $aAdminUser = $doAdminUser->toArray();
     // Create admin account-user association
     $doAUA = OA_Dal::factoryDO('account_user_assoc');
     $doAUA->account_id = $adminAccountId;
     $doAUA->user_id = $adminUserId;
     $doAUA->insert();
     // Prepare an agency
     $doAgency = OA_Dal::factoryDO('agency');
     $doAgency->name = $agencyName;
     $doAgency->contact = $agencyContact;
     $doAgency->email = $agencyMail;
     $agencyId = DataGenerator::generateOne($doAgency);
     $doAgency = OA_Dal::staticGetDO('agency', $agencyId);
     //get('agencyid', $agencyId);
     $agencyAccountId = $doAgency->account_id;
     // Prepare an agency user
     $doUser = OA_Dal::factoryDO('users');
     $doUser->contact_name = $agencyContact;
     $doUser->email_address = $agencyMail;
     $doUser->username = $agencyName;
     $doUser->language = 'en';
     $agencyUserId = DataGenerator::generateOne($doUser);
     $doAgencyUser = OA_Dal::staticGetDO('users', $agencyUserId);
     $aAgencyUser = $doAgencyUser->toArray();
     $oUserAccess = new OA_Admin_UI_UserAccess();
     // Agency user
     $oUserAccess->linkUserToAccount($agencyUserId, $doAgency->account_id, array(), array());
     // Generate an advertiser owned by the agency with no email adddress,
     // but no placements, and ensure false is returned
     $doClients = OA_Dal::factoryDO('clients');
     $doClients->agencyid = $agencyId;
     $doClients->clientname = $advertiserName;
     $doClients->email = '';
     $advertiserId1 = DataGenerator::generateOne($doClients);
     $doClients = OA_Dal::staticGetDO('clients', 'clientid', $advertiserId1);
     // ->get('clientid', $advertiserId1);
     $advertiserAccountId = $doClients->account_id;
     // Create an advertiser user
//.........这里部分代码省略.........
开发者ID:Spark-Eleven,项目名称:revive-adserver,代码行数:101,代码来源:Email.mtc.test.php

示例11: checkIntervalDates

 /**
  * A method to check that two Dates represent either the start and end
  * of an operation interval, if the operation interval is less than an
  * hour, or the start and end of an hour otherwise.
  *
  * @static
  * @param Date $oStart The interval start date.
  * @param Date $oEnd The interval end date.
  * @param integer $operationInterval The operation interval in minutes.
  * @return bool Returns true if the dates are correct interval
  *              start/end dates, false otherwise.
  */
 function checkIntervalDates($oStart, $oEnd, $operationInterval = 0)
 {
     if ($operationInterval < 1) {
         $operationInterval = OX_OperationInterval::getOperationInterval();
     }
     if ($operationInterval <= 60) {
         // Must ensure that only one operation interval is being summarised
         $operationIntervalID = OX_OperationInterval::convertDateRangeToOperationIntervalID($oStart, $oEnd, $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
         $aDates = OX_OperationInterval::convertDateToOperationIntervalStartAndEndDates($oStart, $operationInterval);
         if (!$oStart->equals($aDates['start'])) {
             return false;
         }
         if (!$oEnd->equals($aDates['end'])) {
             return false;
         }
     } else {
         // Must ensure that only one hour is being summarised
         if (!OX_OperationInterval::checkDatesInSameHour($oStart, $oEnd)) {
             return false;
         }
         // Now check that the start and end dates are match the start and
         // end of the hour
         $oHourStart = new Date();
         $oHourStart->copy($oStart);
         $oHourStart->setMinute('00');
         $oHourStart->setSecond('00');
         $oHourEnd = new Date();
         $oHourEnd->copy($oEnd);
         $oHourEnd->setMinute('59');
         $oHourEnd->setSecond('59');
         if (!$oStart->equals($oHourStart)) {
             return false;
         }
         if (!$oEnd->equals($oHourEnd)) {
             return false;
         }
     }
     return true;
 }
开发者ID:villos,项目名称:tree_admin,代码行数:56,代码来源:OperationInterval.php

示例12: Date

 function _midnight($date)
 {
     $processed_date = new Date($date);
     $processed_date->setHour(0);
     $processed_date->setMinute(0);
     $processed_date->setSecond(0);
     return $processed_date;
 }
开发者ID:ballistiq,项目名称:revive-adserver,代码行数:8,代码来源:DateRange.php

示例13: Date

 function _dayToDateTime($day, $begin = true)
 {
     $oDate = new Date($day);
     if (!$begin) {
         $oDate->setHour(23);
         $oDate->setMinute(59);
         $oDate->setSecond(59);
     }
     $oDate->toUTC();
     return $oDate->format('%Y-%m-%d %H:%M:%S');
 }
开发者ID:ballistiq,项目名称:revive-adserver,代码行数:11,代码来源:SqlBuilder.php

示例14: testGetDaysLeftString


//.........这里部分代码省略.........
     $oDate = new Date();
     $impressions = 50;
     $clicks = 5;
     $conversions = 1;
     $doDSAH = OA_Dal::factoryDO('data_intermediate_ad');
     $doDSAH->day = $oDate->format('%Y-%m-%d');
     $doDSAH->hour = 10;
     $doDSAH->ad_id = $bannerId;
     $doDSAH->impressions = $impressions;
     $doDSAH->clicks = $clicks;
     $doDSAH->conversions = $conversions;
     $dsahId = DataGenerator::generateOne($doDSAH);
     // Delivered 50 impressions in 1 day. So, expect to take 19 days to
     // deliver remaining 950
     // Delivered 5 clicks in 1 day. So, expect to take 99 days to deliver
     // remaining 495
     // Delivered 1 conversion in 1 day. So, expect to take 9 days to deliver
     // remaining 9
     // The estimated expiration will be calucalated based on impression targets
     // or based on click targets or based on conversion targets (following this order).
     $daysLeft = 19;
     $oExpirationDate = new Date();
     $oExpirationDate->copy($oDate);
     $oExpirationDate->addSeconds($daysLeft * SECONDS_PER_DAY);
     $expected = array('estimatedExpiration' => $GLOBALS['strEstimated'] . ": " . $oExpirationDate->format('%d.%m.%Y') . " (" . $GLOBALS['strDaysLeft'] . ": " . $daysLeft . ")", 'campaignExpiration' => $GLOBALS['strNoExpiration']);
     $actual = $this->oDalCampaigns->getDaysLeftString($campaignId);
     $this->assertEqual($actual, $expected);
     // Case 3
     // Test a campaign with expiration date and without a estimated expiration date
     // Prepare a date 10 days in the future
     $daysLeft = 10;
     $oDate = new Date();
     $oDate->setHour(23);
     $oDate->setMinute(59);
     $oDate->setSecond(59);
     $oDate->addSeconds($daysLeft * SECONDS_PER_DAY);
     $oDate->toUTC();
     // Test an unlimited campaign which expires 10 days in the future
     $doCampaigns = OA_Dal::factoryDO('campaigns');
     $doCampaigns->views = 0;
     $doCampaigns->clicks = 0;
     $doCampaigns->conversions = 0;
     $doCampaigns->expire_time = $oDate->getDate(DATE_FORMAT_ISO);
     $aData = array('reportlastdate' => array('2007-04-03 18:39:45'));
     $dg = new DataGenerator();
     $dg->setData('clients', $aData);
     $aCampaignIds = $dg->generate($doCampaigns, 1, true);
     $campaignId = $aCampaignIds[0];
     // Link a banner to this campaign
     $doBanners = OA_Dal::factoryDO('banners');
     $doBanners->campaignid = $campaignId;
     $doBanners->acls_updated = '2007-04-03 18:39:45';
     $bannerId = DataGenerator::generateOne($doBanners);
     $expected = array('estimatedExpiration' => $GLOBALS['strEstimated'] . ": " . $GLOBALS['strNoExpirationEstimation'], 'campaignExpiration' => $GLOBALS['strExpirationDate'] . ": " . $oDate->format('%d.%m.%Y') . " (" . $GLOBALS['strDaysLeft'] . ": " . $daysLeft . ")");
     $actual = $this->oDalCampaigns->getDaysLeftString($campaignId);
     $this->assertEqual($actual, $expected);
     // Case 4
     // Campaign with expiration date reached
     // Prepare a campaign with expiration date reached
     $daysExpired = 5;
     $oDate = new Date();
     $oDate->setHour(23);
     $oDate->setMinute(59);
     $oDate->setSecond(59);
     $oDate->subtractSeconds($daysExpired * SECONDS_PER_DAY);
     $oDate->toUTC();
开发者ID:Jaree,项目名称:revive-adserver,代码行数:67,代码来源:Campaigns.dal.test.php

示例15: 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


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