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


PHP Zend_Date::addYear方法代码示例

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


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

示例1: getIntervals

 public function getIntervals()
 {
     if (!$this->_intervals) {
         $this->_intervals = array();
         if (!$this->_from && !$this->_to) {
             return $this->_intervals;
         }
         $dateStart = new Zend_Date($this->_from);
         $dateEnd = new Zend_Date($this->_to);
         $t = array();
         $firstInterval = true;
         /** START AITOC FIX **/
         if (in_array((string) $this->_period, array('day', 'month', 'year'))) {
             /** END AITOC FIX **/
             while ($dateStart->compare($dateEnd) <= 0) {
                 switch ($this->_period) {
                     case 'day':
                         $t['title'] = $dateStart->toString(Mage::app()->getLocale()->getDateFormat());
                         $t['start'] = $dateStart->toString('yyyy-MM-dd HH:mm:ss');
                         $t['end'] = $dateStart->toString('yyyy-MM-dd 23:59:59');
                         $dateStart->addDay(1);
                         break;
                     case 'month':
                         $t['title'] = $dateStart->toString('MM/yyyy');
                         $t['start'] = $firstInterval ? $dateStart->toString('yyyy-MM-dd 00:00:00') : $dateStart->toString('yyyy-MM-01 00:00:00');
                         $lastInterval = $dateStart->compareMonth($dateEnd->getMonth()) == 0;
                         $t['end'] = $lastInterval ? $dateStart->setDay($dateEnd->getDay())->toString('yyyy-MM-dd 23:59:59') : $dateStart->toString('yyyy-MM-' . date('t', $dateStart->getTimestamp()) . ' 23:59:59');
                         $dateStart->addMonth(1);
                         if ($dateStart->compareMonth($dateEnd->getMonth()) == 0) {
                             $dateStart->setDay(1);
                         }
                         $firstInterval = false;
                         break;
                     case 'year':
                         $t['title'] = $dateStart->toString('yyyy');
                         $t['start'] = $firstInterval ? $dateStart->toString('yyyy-MM-dd 00:00:00') : $dateStart->toString('yyyy-01-01 00:00:00');
                         $lastInterval = $dateStart->compareYear($dateEnd->getYear()) == 0;
                         $t['end'] = $lastInterval ? $dateStart->setMonth($dateEnd->getMonth())->setDay($dateEnd->getDay())->toString('yyyy-MM-dd 23:59:59') : $dateStart->toString('yyyy-12-31 23:59:59');
                         $dateStart->addYear(1);
                         if ($dateStart->compareYear($dateEnd->getYear()) == 0) {
                             $dateStart->setMonth(1)->setDay(1);
                         }
                         $firstInterval = false;
                         break;
                 }
                 $this->_intervals[$t['title']] = $t;
             }
             /** START AITOC FIX **/
         }
         /** END AITOC FIX **/
     }
     return $this->_intervals;
 }
开发者ID:sagmahajan,项目名称:aswan_release,代码行数:53,代码来源:ReportsReportCollection.php

示例2: getIntervals

 public function getIntervals()
 {
     if (!$this->_intervals) {
         $this->_intervals = array();
         if (!$this->_from && !$this->_to) {
             return $this->_intervals;
         }
         $dateStart = new Zend_Date($this->_from);
         $dateStart2 = new Zend_Date($this->_from);
         $dateEnd = new Zend_Date($this->_to);
         $t = array();
         while ($dateStart->compare($dateEnd) <= 0) {
             switch ($this->_period) {
                 case 'day':
                     $t['title'] = $dateStart->toString(Mage::app()->getLocale()->getDateFormat());
                     $t['start'] = $dateStart->toString('yyyy-MM-dd HH:mm:ss');
                     $t['end'] = $dateStart->toString('yyyy-MM-dd 23:59:59');
                     $dateStart->addDay(1);
                     break;
                 case 'month':
                     $t['title'] = $dateStart->toString('MM/yyyy');
                     $t['start'] = $dateStart->toString('yyyy-MM-01 00:00:00');
                     $t['end'] = $dateStart->toString('yyyy-MM-' . date('t', $dateStart->getTimestamp()) . ' 23:59:59');
                     $dateStart->addMonth(1);
                     break;
                 case 'year':
                     $t['title'] = $dateStart->toString('yyyy');
                     $t['start'] = $dateStart->toString('yyyy-01-01 00:00:00');
                     $t['end'] = $dateStart->toString('yyyy-12-31 23:59:59');
                     $dateStart->addYear(1);
                     break;
             }
             $this->_intervals[$t['title']] = $t;
         }
         if ($this->_period != 'day') {
             $titles = array_keys($this->_intervals);
             if (count($titles) > 0) {
                 $this->_intervals[$titles[0]]['start'] = $dateStart2->toString('yyyy-MM-dd 00:00:00');
                 $this->_intervals[$titles[count($titles) - 1]]['end'] = $dateEnd->toString('yyyy-MM-dd 23:59:59');
             }
         }
     }
     return $this->_intervals;
 }
开发者ID:joebushi,项目名称:magento-mirror,代码行数:44,代码来源:Collection.php

示例3: getIntervals

 /**
  * Retrieve array of intervals
  *
  * @param string $from
  * @param string $to
  * @param string $period
  * @return array
  */
 public function getIntervals($from, $to, $period = self::REPORT_PERIOD_TYPE_DAY)
 {
     $intervals = array();
     if (!$from && !$to) {
         return $intervals;
     }
     $start = new Zend_Date($from, Varien_Date::DATE_INTERNAL_FORMAT);
     if ($period == self::REPORT_PERIOD_TYPE_DAY) {
         $dateStart = $start;
     }
     if ($period == self::REPORT_PERIOD_TYPE_MONTH) {
         $dateStart = new Zend_Date(date("Y-m", $start->getTimestamp()), Varien_Date::DATE_INTERNAL_FORMAT);
     }
     if ($period == self::REPORT_PERIOD_TYPE_YEAR) {
         $dateStart = new Zend_Date(date("Y", $start->getTimestamp()), Varien_Date::DATE_INTERNAL_FORMAT);
     }
     $dateEnd = new Zend_Date($to, Varien_Date::DATE_INTERNAL_FORMAT);
     while ($dateStart->compare($dateEnd) <= 0) {
         switch ($period) {
             case self::REPORT_PERIOD_TYPE_DAY:
                 $t = $dateStart->toString('yyyy-MM-dd');
                 $dateStart->addDay(1);
                 break;
             case self::REPORT_PERIOD_TYPE_MONTH:
                 $t = $dateStart->toString('yyyy-MM');
                 $dateStart->addMonth(1);
                 break;
             case self::REPORT_PERIOD_TYPE_YEAR:
                 $t = $dateStart->toString('yyyy');
                 $dateStart->addYear(1);
                 break;
         }
         $intervals[] = $t;
     }
     return $intervals;
 }
开发者ID:ravi2jdesign,项目名称:solvingmagento_1.7.0,代码行数:44,代码来源:Data.php

示例4: testLoose


//.........这里部分代码省略.........
         // success
     }
     try {
         $date->setArpa(null);
         $this->fail();
     } catch (Zend_Date_Exception $e) {
         // success
     }
     try {
         $date->addArpa(null);
         $this->fail();
     } catch (Zend_Date_Exception $e) {
         // success
     }
     try {
         $date->subArpa(null);
         $this->fail();
     } catch (Zend_Date_Exception $e) {
         // success
     }
     try {
         $date->compareArpa(null);
         $this->fail();
     } catch (Zend_Date_Exception $e) {
         // success
     }
     try {
         $date->setYear(null);
         $this->fail();
     } catch (Zend_Date_Exception $e) {
         // success
     }
     try {
         $date->addYear(null);
         $this->fail();
     } catch (Zend_Date_Exception $e) {
         // success
     }
     try {
         $date->subYear(null);
         $this->fail();
     } catch (Zend_Date_Exception $e) {
         // success
     }
     try {
         $date->compareYear(null);
         $this->fail();
     } catch (Zend_Date_Exception $e) {
         // success
     }
     try {
         $date->setMonth(null);
         $this->fail();
     } catch (Zend_Date_Exception $e) {
         // success
     }
     try {
         $date->addMonth(null);
         $this->fail();
     } catch (Zend_Date_Exception $e) {
         // success
     }
     try {
         $date->subMonth(null);
         $this->fail();
     } catch (Zend_Date_Exception $e) {
开发者ID:jsnshrmn,项目名称:Suma,代码行数:67,代码来源:DateTest.php

示例5: getIntervals

 /**
  * Overrides standard getIntervals
  * @return array
  */
 public function getIntervals()
 {
     if (!$this->_intervals) {
         $this->_intervals = array();
         if (!$this->_from && !$this->_to) {
             return $this->_intervals;
         }
         $dateStart = new Zend_Date($this->_from);
         $dateStart2 = new Zend_Date($this->_from);
         $dateEnd = new Zend_Date($this->_to);
         $t = array();
         while ($dateStart->compare($dateEnd) <= 0) {
             switch ($this->_period) {
                 case 'day':
                     $t['title'] = $dateStart->toString(Mage::app()->getLocale()->getDateFormat());
                     $t['start'] = $dateStart->toString('yyyy-MM-dd HH:mm:ss');
                     $t['end'] = $dateStart->toString('yyyy-MM-dd 23:59:59');
                     $dateStart->addDay(1);
                     break;
                 case 'week':
                     $t['title'] = $dateStart->toString(Mage::app()->getLocale()->getDateFormat());
                     $t['start'] = $dateStart->toString('yyyy-MM-dd 00:00:00');
                     $dateStart->addWeek(1)->subDay(1);
                     $t['title'] .= ' - ' . $dateStart->toString(Mage::app()->getLocale()->getDateFormat());
                     $t['end'] = $dateStart->toString('yyyy-MM-dd 23:59:59');
                     $dateStart->addDay(1);
                     break;
                 case 'month':
                     $t['title'] = $dateStart->toString('MM/yyyy');
                     $t['start'] = $dateStart->toString('yyyy-MM-01 00:00:00');
                     $t['end'] = $dateStart->toString('yyyy-MM-' . date('t', $dateStart->getTimestamp()) . ' 23:59:59');
                     $dateStart->addMonth(1);
                     break;
                 case 'quarter':
                     $month = (int) $dateStart->toString('MM');
                     $num = round($month / 3) + 1;
                     $t['title'] = Mage::helper('advancedreports')->__('Q') . $num . $dateStart->toString('/yyyy');
                     $t['start'] = $dateStart->toString('yyyy-MM-01 00:00:00');
                     $dateStart->addMonth(2);
                     $t['end'] = $dateStart->toString('yyyy-MM-' . date('t', $dateStart->getTimestamp()) . ' 23:59:59');
                     $dateStart->addMonth(1);
                     break;
                 case 'year':
                     $t['title'] = $dateStart->toString('yyyy');
                     $t['start'] = $dateStart->toString('yyyy-01-01 00:00:00');
                     $t['end'] = $dateStart->toString('yyyy-12-31 23:59:59');
                     $dateStart->addYear(1);
                     break;
             }
             $this->_intervals[$t['title']] = $t;
             //		echo $t['start'].' - '.$t['end'].'<hr>';
         }
         if ($this->_period != 'day') {
             $titles = array_keys($this->_intervals);
             if (count($titles) > 0) {
                 $this->_intervals[$titles[0]]['start'] = $dateStart2->toString('yyyy-MM-dd 00:00:00');
                 $this->_intervals[$titles[count($titles) - 1]]['end'] = $dateEnd->toString('yyyy-MM-dd 23:59:59');
                 if ($this->_period == 'week') {
                     $t = $this->_intervals[$titles[count($titles) - 1]];
                     unset($this->_intervals[$titles[count($titles) - 1]]);
                     $date = new Zend_Date($t['start']);
                     $t['title'] = $date->toString(Mage::app()->getLocale()->getDateFormat());
                     unset($date);
                     $date = new Zend_Date($t['end']);
                     $t['title'] .= ' - ' . $date->toString(Mage::app()->getLocale()->getDateFormat());
                     $this->_intervals[$t['title']] = $t;
                 }
             }
         }
     }
     return $this->_intervals;
 }
开发者ID:xiaoguizhidao,项目名称:autotech_design,代码行数:76,代码来源:Collection.php

示例6: getIntervals

 /**
  * Overrides standard getIntervals
  * @return array
  */
 public function getIntervals()
 {
     if (!$this->_intervals) {
         $this->_intervals = array();
         if (!$this->_from && !$this->_to) {
             return $this->_intervals;
         }
         $t = array();
         $diff = 0;
         if ($this->_period == 'week') {
             $firstWeekDay = Mage::getStoreConfig('general/locale/firstday');
             $dateStart = new Zend_Date($this->_from);
             $curWeekDay = $dateStart->toString('e');
             if ($curWeekDay > $firstWeekDay) {
                 $firstWeekDay += 7;
             }
             $diff = abs($curWeekDay - $firstWeekDay);
         }
         if ($this->_period == 'week' && $diff > 0) {
             $dateStart = new Zend_Date($this->_from);
             $dateStart2 = new Zend_Date($this->_from);
             $dateStart2->addDay($diff);
             $t['title'] = $dateStart->toString(Mage::app()->getLocale()->getDateFormat());
             $t['start'] = $dateStart->toString('yyyy-MM-dd 00:00:00');
             $dateStart->addDay($diff)->subDay(1);
             $t['title'] .= ' - ' . $dateStart->toString(Mage::app()->getLocale()->getDateFormat());
             $t['end'] = $dateStart->toString('yyyy-MM-dd 23:59:59');
             $dateStart->addDay(1);
             if (isset($t['title'])) {
                 $this->_intervals[$t['title']] = $t;
             }
             $dateStart2 = new Zend_Date($this->_from);
             $dateEnd = new Zend_Date($this->_to);
         } else {
             $dateStart = new Zend_Date($this->_from);
             $dateStart2 = new Zend_Date($this->_from);
             $dateEnd = new Zend_Date($this->_to);
         }
         while ($dateStart->compare($dateEnd) <= 0) {
             switch ($this->_period) {
                 case 'day':
                     $t['title'] = $dateStart->toString(Mage::app()->getLocale()->getDateFormat());
                     $t['start'] = $dateStart->toString('yyyy-MM-dd HH:mm:ss');
                     $t['end'] = $dateStart->toString('yyyy-MM-dd 23:59:59');
                     $dateStart->addDay(1);
                     break;
                 case 'week':
                     $t['title'] = $dateStart->toString(Mage::app()->getLocale()->getDateFormat());
                     $t['start'] = $dateStart->toString('yyyy-MM-dd 00:00:00');
                     $dateStart->addWeek(1)->subDay(1);
                     $t['title'] .= ' - ' . $dateStart->toString(Mage::app()->getLocale()->getDateFormat());
                     $t['end'] = $dateStart->toString('yyyy-MM-dd 23:59:59');
                     $dateStart->addDay(1);
                     break;
                 case 'month':
                     $t['title'] = $dateStart->toString('MM/yyyy');
                     $t['start'] = $dateStart->toString('yyyy-MM-01 00:00:00');
                     $t['end'] = $dateStart->toString('yyyy-MM-' . date('t', $dateStart->getTimestamp()) . ' 23:59:59');
                     $dateStart->addMonth(1);
                     break;
                 case 'quarter':
                     $month = (int) $dateStart->toString('MM');
                     $num = round($month / 3) + 1;
                     $t['title'] = Mage::helper('advancedreports')->__('Q') . $num . $dateStart->toString('/yyyy');
                     $t['start'] = $dateStart->toString('yyyy-MM-01 00:00:00');
                     $dateStart->addMonth(2);
                     $t['end'] = $dateStart->toString('yyyy-MM-' . date('t', $dateStart->getTimestamp()) . ' 23:59:59');
                     $dateStart->addMonth(1);
                     break;
                 case 'year':
                     $t['title'] = $dateStart->toString('yyyy');
                     $t['start'] = $dateStart->toString('yyyy-01-01 00:00:00');
                     $t['end'] = $dateStart->toString('yyyy-12-31 23:59:59');
                     $dateStart->addYear(1);
                     break;
                 default:
                     Mage::throwException("Report tried to get intervals without a period.");
             }
             if (isset($t['title'])) {
                 $this->_intervals[$t['title']] = $t;
             }
             //                echo $t['start'].' - '.$t['end'].'<hr>';
         }
         if ($this->_period != 'day') {
             $titles = array_keys($this->_intervals);
             if (count($titles) > 0) {
                 $this->_intervals[$titles[0]]['start'] = $dateStart2->toString('yyyy-MM-dd 00:00:00');
                 $this->_intervals[$titles[count($titles) - 1]]['end'] = $dateEnd->toString('yyyy-MM-dd 23:59:59');
                 if ($this->_period == 'week') {
                     $t = $this->_intervals[$titles[count($titles) - 1]];
                     unset($this->_intervals[$titles[count($titles) - 1]]);
                     $date = new Zend_Date($t['start'], 'yyyy-MM-dd 00:00:00');
                     $t['title'] = $date->toString(Mage::app()->getLocale()->getDateFormat());
                     unset($date);
                     $date = new Zend_Date($t['end'], 'yyyy-MM-dd 23:59:59');
                     $t['title'] .= ' - ' . $date->toString(Mage::app()->getLocale()->getDateFormat());
//.........这里部分代码省略.........
开发者ID:cnglobal-sl,项目名称:caterez,代码行数:101,代码来源:Collection.php

示例7: getNearestAvailableDay

 /**
  * Returns nearest available date starting from today
  * @return Zend_Date
  */
 public function getNearestAvailableDay()
 {
     $Date = new Zend_Date();
     Zend_Date::setOptions(array('extend_month' => true));
     $Date->addDayOfYear((int) $this->getPaymentOffset());
     $exclDays = $this->getExcludedWeekdays();
     Zend_Date::setOptions(array('extend_month' => true));
     // Fix Zend_Date::addMonth unexpected result
     if (count($exclDays) == 7) {
         return $Date->addYear(99);
     }
     while (!$this->isAllowedDate($Date)) {
         $Date = $Date->addDayOfYear(1);
     }
     return $Date;
 }
开发者ID:par-orillonsoft,项目名称:magento_work,代码行数:20,代码来源:Period.php

示例8: getPaymentHistory

 /**
  * (non-PHPdoc)
  * @see Oara/Network/Oara_Network_Publisher_Base#getPaymentHistory()
  */
 public function getPaymentHistory()
 {
     $paymentHistory = array();
     $pointer = new Zend_Date("2010-01-01", "yyyy-MM-dd");
     $now = new Zend_Date();
     while ($now->getYear() >= $pointer->getYear()) {
         $valuesFormExport = array();
         $valuesFormExport[] = new Oara_Curl_Parameter('csv', 'csv');
         $valuesFormExport[] = new Oara_Curl_Parameter('ajax', 'ajax');
         $valuesFormExport[] = new Oara_Curl_Parameter('type', 'csv');
         $valuesFormExport[] = new Oara_Curl_Parameter('sortColumn', 'paymentid');
         $valuesFormExport[] = new Oara_Curl_Parameter('sortType', 'ASC');
         $valuesFormExport[] = new Oara_Curl_Parameter('startdate', $pointer->toString("yyyy") . "-01-01");
         $valuesFormExport[] = new Oara_Curl_Parameter('enddate', $pointer->toString("yyyy") . "-12-31");
         $valuesFormExport[] = new Oara_Curl_Parameter('payid_search', '');
         $urls = array();
         $urls[] = new Oara_Curl_Request('http://www.pepperjamnetwork.com/affiliate/report_payment_history.php?', $valuesFormExport);
         $exportReport = $this->_client->get($urls);
         $exportData = str_getcsv($exportReport[0], "\n");
         $num = count($exportData);
         for ($i = 1; $i < $num; $i++) {
             $paymentExportArray = str_getcsv($exportData[$i], ",");
             $obj = array();
             $obj['date'] = $paymentExportArray[5];
             $obj['pid'] = $paymentExportArray[0];
             if (preg_match('/[-+]?[0-9]*\\.?[0-9]+/', $paymentExportArray[4], $match)) {
                 $obj['value'] = (double) $match[0];
             }
             $obj['method'] = $paymentExportArray[2];
             $paymentHistory[] = $obj;
         }
         $pointer->addYear(1);
     }
     return $paymentHistory;
 }
开发者ID:garygarside,项目名称:php-oara,代码行数:39,代码来源:PepperJam.php

示例9: _getYearInterval

 /**
  * Get Interval for a year
  *
  * @param Zend_Date $dateStart
  * @param Zend_Date $dateEnd
  * @param bool $firstInterval
  * @return array
  */
 protected function _getYearInterval(Zend_Date $dateStart, Zend_Date $dateEnd, $firstInterval)
 {
     $interval = array();
     $interval['period'] = $dateStart->toString('yyyy');
     $interval['start'] = $firstInterval ? $dateStart->toString('yyyy-MM-dd 00:00:00') : $dateStart->toString('yyyy-01-01 00:00:00');
     $lastInterval = $dateStart->compareYear($dateEnd->getYear()) == 0;
     $interval['end'] = $lastInterval ? $dateStart->setMonth($dateEnd->getMonth())->setDay($dateEnd->getDay())->toString('yyyy-MM-dd 23:59:59') : $dateStart->toString('yyyy-12-31 23:59:59');
     $dateStart->addYear(1);
     if ($dateStart->compareYear($dateEnd->getYear()) == 0) {
         $dateStart->setMonth(1)->setDay(1);
     }
     return $interval;
 }
开发者ID:natxetee,项目名称:magento2,代码行数:21,代码来源:Collection.php

示例10: exportAction

 /**
  * 
  */
 public function exportAction()
 {
     $id = $this->_getParam('id');
     $row = $this->_mapper->fetchBusinessPlan($id);
     $contractFiles = array('CEG' => 'Contrato_CEG_tet.xlsx', 'CEC' => 'Contrato_CEC_II_tet.xlsx', 'CED' => 'Contrato_CED_II_tet.xlsx');
     // Fetch Contract
     $mapperContract = new Fefop_Model_Mapper_Contract();
     $contract = $mapperContract->detail($row->fk_id_fefop_contract);
     $data = $row->toArray();
     $data += $contract->toArray();
     $reserve_fund = $this->_mapper->getTotal($id, 'reserve_fund');
     $reserve_fund = $reserve_fund < 1 ? 600 : $reserve_fund;
     $data['contract'] = Fefop_Model_Mapper_Contract::buildNumById($row->fk_id_fefop_contract);
     $data['business_plan'] = External_Model_Mapper_Pce::buildNumRow($row);
     $data['date_inserted'] = $this->view->date($data['date_inserted']);
     $dateInsert = new Zend_Date($data['date_inserted']);
     $data['date_finish'] = $dateInsert->addYear(2)->toString('dd/MM/yyyy');
     $mapperClient = new Client_Model_Mapper_Client();
     $client = $mapperClient->detailClient($row->fk_id_perdata);
     $data['evidence_card'] = Client_Model_Mapper_Client::buildNumRow($client);
     $data['client_name'] = Client_Model_Mapper_Client::buildName($client);
     $data['is_handicapped'] = Client_Model_Mapper_Client::isHandicapped($row->fk_id_perdata);
     $data['electoral'] = $client->electoral;
     $data['gender'] = $client->gender;
     $data['client_fone'] = $client->client_fone;
     $group = array();
     $rowsGroup = $this->_mapper->listClientBusinessPlan($id);
     foreach ($rowsGroup as $rowGroup) {
         $group[] = array('name' => Client_Model_Mapper_Client::buildName($rowGroup), 'evidence_card' => Client_Model_Mapper_Client::buildNumRow($rowGroup), 'electoral' => $client->electoral, 'gender' => $client->gender, 'is_handicapped' => Client_Model_Mapper_Client::isHandicapped($client->id_perdata));
     }
     $expensesRows = $mapperContract->listExpensesContract($row->fk_id_fefop_contract);
     $expenses = array();
     $total = 0;
     foreach ($expensesRows as $expense) {
         $expenses[] = array('name' => $expense->description, 'amount' => (double) $expense->amount);
         $total += (double) $expense->amount;
     }
     $excelPath = APPLICATION_PATH . '/../library/PHPExcel/';
     require_once $excelPath . 'PHPExcel/IOFactory.php';
     $objReader = PHPExcel_IOFactory::createReader('Excel2007');
     $objPHPExcel = $objReader->load(APPLICATION_PATH . '/../public/forms/FEFOP/' . $contractFiles[$data['num_module']]);
     $activeSheet = $objPHPExcel->getActiveSheet();
     $activeSheet->setCellValue('P12', $data['contract']);
     $activeSheet->setCellValue('Q40', $data['business_plan']);
     $activeSheet->setCellValue('T8', $data['date_inserted']);
     $activeSheet->setCellValue('F45', $data['date_inserted']);
     $activeSheet->setCellValue('F46', $data['date_finish']);
     $activeSheet->setCellValue('F16', $data['evidence_card']);
     $activeSheet->setCellValue('F17', $data['electoral']);
     $activeSheet->setCellValue('E19', $data['client_name']);
     $activeSheet->setCellValue('D117', $data['client_name']);
     $activeSheet->setCellValue('Q19', $data['client_fone']);
     $activeSheet->setCellValue('O20', $data['email']);
     $activeSheet->setCellValue('H25', $data['total_partisipants']);
     // Responsible
     $activeSheet->setCellValue('E28', $data['client_name']);
     $activeSheet->setCellValue('M28', $data['evidence_card']);
     $activeSheet->setCellValue('O28', $data['electoral']);
     $activeSheet->setCellValue('Q28', $data['gender']);
     $activeSheet->setCellValue('R28', $data['is_handicapped'] ? 'Sin' : 'Lae');
     $startPerson = 29;
     foreach ($group as $person) {
         $activeSheet->setCellValue('E' . $startPerson, $person['name']);
         $activeSheet->setCellValue('M' . $startPerson, $person['evidence_card']);
         $activeSheet->setCellValue('O' . $startPerson, $person['electoral']);
         $activeSheet->setCellValue('Q' . $startPerson, $person['gender']);
         $activeSheet->setCellValue('R' . $startPerson, $person['is_handicapped'] ? 'Sin' : 'Lae');
         $startPerson++;
     }
     $activeSheet->setCellValue('F38', $data['name_disivion']);
     $activeSheet->setCellValue('L38', $data['name_classtimor']);
     $activeSheet->setCellValue('F40', $data['project_name']);
     $activeSheet->setCellValue('P45', $data['district']);
     $activeSheet->setCellValue('P46', $data['sub_district']);
     $activeSheet->setCellValue('P47', $data['sucu']);
     $startExpense = 52;
     $count = 'A';
     foreach ($expenses as $expense) {
         $activeSheet->setCellValue('B' . $startExpense, $count++);
         $activeSheet->setCellValue('C' . $startExpense, $expense['name']);
         $activeSheet->setCellValue('S' . $startExpense, $expense['amount']);
         $startExpense++;
     }
     $activeSheet->setCellValue('B' . $startExpense, $count++);
     $activeSheet->setCellValue('C' . $startExpense, 'Fundu Maneiu (600 USD + 10% rubrika sira iha leten)');
     $activeSheet->setCellValue('S' . $startExpense, $reserve_fund);
     header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
     $file = sprintf('Contract_%s.xlsx', $data['contract']);
     header(sprintf('Content-Disposition: attachment;filename="%s"', $file));
     header('Cache-Control: max-age=0');
     $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
     $objWriter->save('php://output');
     exit;
 }
开发者ID:fredcido,项目名称:simuweb,代码行数:97,代码来源:PceContractController.php


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