Ejemplo n.º 1
0
 /**
  * @ZF-7154
  */
 public function testZF7154()
 {
     $locale = new Zend_Locale('de_AT');
     $date = new Zend_Date(1577833200, $locale);
     $date2 = new Zend_Date(2006, Zend_Date::YEAR);
     $date->setTimeZone(date_default_timezone_get());
     $date->setYear(2000);
     $date->setMonth('Apr.');
     $this->assertSame('2000-04-01T04:00:00+05:00', $date->get(Zend_Date::W3C));
     $date->setYear(2004);
     $date->setMonth('Februar');
     $this->assertSame('2004-02-01T04:00:00+05:00', $date->get(Zend_Date::W3C));
 }
Ejemplo n.º 2
0
 /**
  * test looseBehaviour
  */
 public function testLoose()
 {
     $date = new Zend_Date(0, 'de');
     try {
         $date->set(null, Zend_Date::YEAR);
         $this->fail();
     } catch (Zend_Date_Exception $e) {
         // success
     }
     $date->set(10, 'de');
     $this->assertEquals($date->getTimestamp(), 10);
     try {
         $date->add(null, Zend_Date::YEAR);
         $this->fail();
     } catch (Zend_Date_Exception $e) {
         // success
     }
     $date->add(10, 'de');
     $this->assertEquals($date->getTimestamp(), 20);
     try {
         $date->sub(null, Zend_Date::YEAR);
         $this->fail();
     } catch (Zend_Date_Exception $e) {
         // success
     }
     $date->sub(10, 'de');
     $this->assertEquals($date->getTimestamp(), 10);
     try {
         $date->compare(null, Zend_Date::YEAR);
         $this->fail();
     } catch (Zend_Date_Exception $e) {
         // success
     }
     try {
         $date->equals(null, Zend_Date::YEAR);
         $this->fail();
     } catch (Zend_Date_Exception $e) {
         // success
     }
     try {
         $date->isEarlier(null, Zend_Date::YEAR);
         $this->fail();
     } catch (Zend_Date_Exception $e) {
         // success
     }
     try {
         $date->isLater(null, Zend_Date::YEAR);
         $this->fail();
     } catch (Zend_Date_Exception $e) {
         // success
     }
     try {
         $date->setTime(null);
         $this->fail();
     } catch (Zend_Date_Exception $e) {
         // success
     }
     try {
         $date->addTime(null);
         $this->fail();
     } catch (Zend_Date_Exception $e) {
         // success
     }
     try {
         $date->subTime(null);
         $this->fail();
     } catch (Zend_Date_Exception $e) {
         // success
     }
     try {
         $date->compareTime(null);
         $this->fail();
     } catch (Zend_Date_Exception $e) {
         // success
     }
     try {
         $date->setDate(null);
         $this->fail();
     } catch (Zend_Date_Exception $e) {
         // success
     }
     try {
         $date->addDate(null);
         $this->fail();
     } catch (Zend_Date_Exception $e) {
         // success
     }
     try {
         $date->subDate(null);
         $this->fail();
     } catch (Zend_Date_Exception $e) {
         // success
     }
     try {
         $date->compareDate(null);
         $this->fail();
     } catch (Zend_Date_Exception $e) {
         // success
     }
     try {
         $date->setIso(null);
         $this->fail();
     } catch (Zend_Date_Exception $e) {
         // success
     }
     try {
         $date->addIso(null);
         $this->fail();
     } catch (Zend_Date_Exception $e) {
         // success
     }
     try {
         $date->subIso(null);
         $this->fail();
     } catch (Zend_Date_Exception $e) {
         // success
     }
     try {
         $date->compareIso(null);
         $this->fail();
     } catch (Zend_Date_Exception $e) {
         // 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) {
         // success
     }
     try {
         $date->compareMonth(null);
         $this->fail();
     } catch (Zend_Date_Exception $e) {
         // success
     }
     try {
         $date->setDay(null);
         $this->fail();
     } catch (Zend_Date_Exception $e) {
         // success
     }
     try {
         $date->addDay(null);
         $this->fail();
     } catch (Zend_Date_Exception $e) {
         // success
     }
     try {
         $date->subDay(null);
         $this->fail();
     } catch (Zend_Date_Exception $e) {
         // success
     }
     try {
         $date->compareDay(null);
         $this->fail();
     } catch (Zend_Date_Exception $e) {
         // success
     }
     try {
         $date->setWeekday(null);
         $this->fail();
     } catch (Zend_Date_Exception $e) {
         // success
     }
     try {
         $date->addWeekday(null);
         $this->fail();
     } catch (Zend_Date_Exception $e) {
         // success
     }
     try {
         $date->subWeekday(null);
         $this->fail();
     } catch (Zend_Date_Exception $e) {
         // success
     }
     try {
         $date->compareWeekday(null);
         $this->fail();
     } catch (Zend_Date_Exception $e) {
         // success
     }
     try {
         $date->setDayOfYear(null);
         $this->fail();
     } catch (Zend_Date_Exception $e) {
         // success
     }
     try {
         $date->addDayOfYear(null);
         $this->fail();
     } catch (Zend_Date_Exception $e) {
         // success
     }
     try {
         $date->subDayOfYear(null);
         $this->fail();
     } catch (Zend_Date_Exception $e) {
         // success
     }
     try {
         $date->compareDayOfYear(null);
         $this->fail();
     } catch (Zend_Date_Exception $e) {
         // success
     }
     try {
         $date->setHour(null);
         $this->fail();
     } catch (Zend_Date_Exception $e) {
         // success
     }
     try {
         $date->addHour(null);
         $this->fail();
     } catch (Zend_Date_Exception $e) {
         // success
     }
     try {
         $date->subHour(null);
         $this->fail();
     } catch (Zend_Date_Exception $e) {
         // success
     }
     try {
         $date->compareHour(null);
         $this->fail();
     } catch (Zend_Date_Exception $e) {
         // success
     }
     try {
         $date->setMinute(null);
         $this->fail();
     } catch (Zend_Date_Exception $e) {
         // success
     }
     try {
         $date->addMinute(null);
         $this->fail();
     } catch (Zend_Date_Exception $e) {
         // success
     }
     try {
         $date->subMinute(null);
         $this->fail();
     } catch (Zend_Date_Exception $e) {
         // success
     }
     try {
         $date->compareMinute(null);
         $this->fail();
     } catch (Zend_Date_Exception $e) {
         // success
     }
     try {
         $date->setSecond(null);
         $this->fail();
     } catch (Zend_Date_Exception $e) {
         // success
     }
     try {
         $date->addSecond(null);
         $this->fail();
     } catch (Zend_Date_Exception $e) {
         // success
     }
     try {
         $date->subSecond(null);
         $this->fail();
     } catch (Zend_Date_Exception $e) {
         // success
     }
     try {
         $date->compareSecond(null);
         $this->fail();
     } catch (Zend_Date_Exception $e) {
         // success
     }
     try {
         $date->setWeek(null);
         $this->fail();
     } catch (Zend_Date_Exception $e) {
         // success
     }
     try {
         $date->addWeek(null);
         $this->fail();
     } catch (Zend_Date_Exception $e) {
         // success
     }
     try {
         $date->subWeek(null);
         $this->fail();
     } catch (Zend_Date_Exception $e) {
         // success
     }
     try {
         $date->compareWeek(null);
         $this->fail();
     } catch (Zend_Date_Exception $e) {
         // success
     }
 }
Ejemplo n.º 3
0
 public function getWeek($week, $year, $locationId = null)
 {
     $zd = new Zend_Date();
     $event = new Event();
     $workshop = new Workshop();
     if ($week == 1) {
         $calData['prevWeekNum'] = 52;
         $calData['prevYear'] = $year - 1;
         $calData['nextWeekNum'] = 2;
         $calData['nextYear'] = $year;
     } else {
         if ($week == 52) {
             $calData['prevWeekNum'] = 51;
             $calData['prevYear'] = $year;
             $calData['nextWeekNum'] = 1;
             $calData['nextYear'] = $year + 1;
         } else {
             $calData['prevWeekNum'] = $week - 1;
             $calData['prevYear'] = $year;
             $calData['nextWeekNum'] = $week + 1;
             $calData['nextYear'] = $year;
         }
     }
     // go back to the current week
     $zd->setYear($year);
     $zd->setWeek($week);
     // set the weekday to sunday for the display purposes
     $zd->setWeekday("sunday");
     $month = $zd->get(Zend_Date::MONTH_SHORT);
     for ($x = 0; $x < 7; $x++) {
         $tmp = array();
         $tmp['startDay'] = $zd->get(Zend_Date::WEEKDAY_DIGIT);
         $tmp['month'] = $zd->get(Zend_Date::MONTH_SHORT);
         $tmp['day'] = $zd->get(Zend_Date::DAY_SHORT);
         $tmp['monthName'] = $zd->get(Zend_Date::MONTH_NAME);
         $tmp['monthDays'] = $zd->get(Zend_Date::MONTH_DAYS);
         $tmp['year'] = $zd->get(Zend_Date::YEAR);
         $tmp['weekNum'] = $zd->get(Zend_Date::WEEK);
         $tmp['date'] = $zd->getTimestamp();
         $calData[$x] = $tmp;
         $where = $event->getAdapter()->quoteInto('date = ?', $tmp['year'] . "-" . $tmp['month'] . "-" . $tmp['day']);
         $where .= " AND ";
         $where .= $event->getAdapter()->quoteInto('status = ?', 'open');
         if (!is_null($locationId)) {
             $where .= " AND ";
             $where .= $event->getAdapter()->quoteInto('locationId = ?', $locationId);
         }
         $calData[$x]['events'] = $event->fetchAll($where, 'startTime')->toArray();
         for ($y = 0; $y < count($calData[$x]['events']); $y++) {
             if (isset($calData[$x]['events'][$y]['workshopId'])) {
                 $tmpStart = strtotime($calData[$x]['events'][$y]['startTime']);
                 $tmpEnd = strtotime($calData[$x]['events'][$y]['endTime']);
                 $calData[$x]['events'][$y]['numMinutes'] = ($tmpEnd - $tmpStart) / 60;
                 $workshopId = $calData[$x]['events'][$y]['workshopId'];
                 $calData[$x]['events'][$y]['workshop'] = $workshop->find($workshopId)->toArray();
             }
         }
         $zd->addDay(1);
     }
     $calData['weekNum'] = $zd->get(Zend_Date::WEEK);
     $calData['year'] = $year;
     return $calData;
 }
Ejemplo n.º 4
0
 public function printLists($period, $definition, &$processArray)
 {
     set_time_limit(0);
     ignore_user_abort(true);
     $processArray = array();
     $values = array('VOR' => array(), 'JETZT' => array(), 'NACH' => array());
     $fixValues = array('prev_period' => $period - 1, 'now_period' => $period, 'next_period' => $period + 1);
     $periods = array('VOR' => $period - 1, 'JETZT' => $period, 'NACH' => $period + 1);
     $res = array('VOR' => array(), 'JETZT' => array(), 'NACH' => array());
     // Mitgliederbeiträge nach Beitragsgruppen:
     $date = new Zend_Date();
     $date->setYear($period);
     $beginDate = $definition->getStartDate(new Zend_Date());
     $endDate = $definition->getEndDate(new Zend_Date());
     /*$beginDate = clone $date;
     		$endDate = clone $date;
     		
     		$beginDate->setMonth(1);
     		$beginDate->setDay(1);
     		
     		$endDate->setMonth(12);
     		$endDate->setDay(31);*/
     $baseOpFilter = array();
     $baseDonationFilter = array();
     $baseOpFilter[] = array('field' => 'payment_date', 'operator' => 'afterOrAt', 'value' => $beginDate->toString('yyyy-MM-dd'));
     $baseOpFilter[] = array('field' => 'payment_date', 'operator' => 'beforeOrAt', 'value' => $endDate->toString('yyyy-MM-dd'));
     $baseOpFilter[] = array('field' => 'state', 'operator' => 'not', 'value' => 'OPEN');
     $baseDonationFilter[] = array('field' => 'donation_date', 'operator' => 'afterOrAt', 'value' => $beginDate->toString('yyyy-MM-dd'));
     $baseDonationFilter[] = array('field' => 'donation_date', 'operator' => 'beforeOrAt', 'value' => $endDate->toString('yyyy-MM-dd'));
     $baseOpFilter = new Billing_Model_OpenItemFilter($baseOpFilter, 'AND');
     $baseDonationFilter = new Donator_Model_DonationFilter($baseDonationFilter, 'AND');
     $feeGroups = Membership_Controller_FeeGroup::getInstance()->getAllFeeGroups('key');
     $feeGroupSum = 0;
     $resultValues = array();
     $nowSum = $previousSum = $nextSum = $totalDonationSum = 0;
     $opPaging = new Tinebase_Model_Pagination(array('sort' => array('payment_date', 'pay.debitor_id'), 'dir' => 'ASC'));
     $bgMap = array();
     foreach ($feeGroups as $feeGroup) {
         $opFilter = null;
         $opFilter = clone $baseOpFilter;
         $opFilter->addFilter($opFilter->createFilter('fee_group_id', 'equals', $feeGroup->__get('id'), 'rc'));
         $innerArray = array();
         $innerArray['bg_name'] = $feeGroup->__get('name');
         $bgMap[$feeGroup->__get('name')] = $feeGroup->__get('key');
         foreach ($values as $key => $value) {
             $innerOpFilter = null;
             $innerOpFilter = clone $opFilter;
             switch ($key) {
                 case 'VOR':
                     $innerOpFilter->addFilter($innerOpFilter->createFilter('period', 'less', $period, 'rc'));
                     $ids = Billing_Controller_OpenItem::getInstance()->search($innerOpFilter, $opPaging, false, true);
                     $res['VOR'][$feeGroup->__get('name')] = $ids;
                 case 'JETZT':
                     $innerOpFilter->addFilter($innerOpFilter->createFilter('period', 'equals', $period, 'rc'));
                     $ids = Billing_Controller_OpenItem::getInstance()->search($innerOpFilter, $opPaging, false, true);
                     $res['JETZT'][$feeGroup->__get('name')] = $ids;
                     break;
                 case 'NACH':
                     $innerOpFilter->addFilter($innerOpFilter->createFilter('period', 'greater', $period, 'rc'));
                     $ids = Billing_Controller_OpenItem::getInstance()->search($innerOpFilter, $opPaging, false, true);
                     $res['NACH'][$feeGroup->__get('name')] = $ids;
             }
         }
     }
     foreach ($res as $key => $bgOps) {
         foreach ($bgOps as $bgName => $ops) {
             $items = array();
             $total = 0;
             foreach ($ops as $opId) {
                 //var_dump($opId);
                 $openItem = Billing_Controller_OpenItem::getInstance()->get($opId);
                 $debi = $openItem->getForeignRecord('debitor_id', Billing_Controller_Debitor::getInstance());
                 $contact = $debi->getForeignRecord('contact_id', Addressbook_Controller_Contact::getInstance());
                 $openSum = $openItem->__get('open_sum');
                 $payedSum = $openItem->__get('payed_sum');
                 /*##CNR##
                 ##COMPANY##
                 ##LASTNAME##
                 ##FORENAME##
                 ##DDATE##
                 ##USAGE##
                 ##AMOUNT##
                 */
                 $items[] = array('CNR' => $contact->__get('id'), 'COMPANY' => $contact->__get('org_name'), 'LASTNAME' => $contact->__get('n_family'), 'FORENAME' => $contact->__get('n_given'), 'SDATE' => \org\sopen\app\util\format\Date::format($openItem->__get('receipt_date')), 'PDATE' => \org\sopen\app\util\format\Date::format($openItem->__get('payment_date')), 'USAGE' => $openItem->__get('usage'), 'TOTAL' => number_format($openItem->__get('total_brutto'), 2, ',', '.'), 'PAYED' => number_format($payedSum, 2, ',', '.'), 'OPEN' => number_format($openSum, 2, ',', '.'));
                 $total += $payedSum;
             }
             $processArray[] = array('values' => $items, 'sums' => array(), 'header' => array('BGKEY' => $bgMap[$bgName], 'BGNAME' => $bgName, 'PERIOD' => $periods[$key], 'total' => $total));
         }
     }
 }
Ejemplo n.º 5
0
 /**
  * The main scheduler page.  This allows a user to view and edit the schedule.  Users
  * will almost certainly need access to this entire controller to make the
  * scheduler work properly and look right.
  *
  */
 public function indexAction()
 {
     $this->view->acl = array('addEvent' => $this->_helper->hasAccess('add-event'));
     $get = Zend_Registry::get('getFilter');
     if (isset($get->workshopId)) {
         $workshopId = $get->workshopId;
         $this->view->workshopId = $workshopId;
         $this->view->startInAddMode = 1;
     }
     if (isset($get->startYear)) {
         $this->view->startYear = $get->startYear;
     } else {
         $this->view->startYear = date('Y');
     }
     if (isset($get->startMonth)) {
         $this->view->startMonth = $get->startMonth;
     } else {
         $this->view->startMonth = date('m');
     }
     $eventId = null;
     if (isset($get->eventId)) {
         $eventId = $get->eventId;
         $this->view->eventId = $eventId;
         $this->view->startInEditMode = 1;
         $e = new Event();
         $thisEvent = $e->find($eventId)->toArray();
         $this->view->locationId = $thisEvent['locationId'];
     }
     $zd = new Zend_Date();
     $this->view->workshopLength = mktime(1, 0, 0, 1, 1, 1970);
     $this->view->startTime = mktime(0, 0, 0, 1, 1, 1970);
     $this->view->endTime = mktime(23, 30, 0, 1, 1, 1970);
     $this->view->baseTime = mktime(0, 0, 0, 1, 1, 1970);
     $this->view->today = $zd->get(Zend_Date::MONTH) . "/" . $zd->get(Zend_Date::DAY) . "/" . $zd->get(Zend_Date::YEAR);
     $this->view->thisYear = $zd->get(Zend_Date::YEAR);
     $this->view->thisWeek = $zd->get(Zend_Date::WEEK);
     if (!is_null($eventId)) {
         $tmpDate = explode('-', $thisEvent['date']);
         $zd->setYear($tmpDate[0]);
         $zd->setMonth($tmpDate[1]);
         $zd->setDay($tmpDate[2]);
     }
     $this->view->year = $zd->get(Zend_Date::YEAR);
     $this->view->week = $zd->get(Zend_Date::WEEK);
     $this->_helper->pageTitle('workshop-schedule-index:title');
     $workshop = new Workshop();
     $where = $workshop->getAdapter()->quoteInto('status = ?', 'enabled');
     $workshops = $workshop->fetchAll($where, 'title');
     $workshopList = array();
     $workshopList[0] = "";
     foreach ($workshops as $w) {
         $workshopList[$w->workshopId] = $w->title;
     }
     $this->view->workshops = $workshopList;
     $location = new Location();
     $where = $location->getAdapter()->quoteInto('status = ?', 'enabled');
     $locations = $location->fetchAll($where, 'name');
     if (count($locations) == 0) {
         $this->_helper->redirector->gotoUrl('/workshop/schedule/noLocationsFound');
     }
     foreach ($locations as $l) {
         $locationList[$l->locationId] = $l->name;
     }
     $this->view->locationList = $locationList;
     //get all the users available for the instructor list
     $profile = new Ot_Account();
     $profiles = $profile->fetchAll(null, array('lastName', 'firstName'))->toArray();
     $instructors = array();
     foreach ($profiles as $p) {
         $instructors[$p['username']] = $p['lastName'] . ", " . $p['firstName'];
     }
     $this->view->messages = $this->_helper->flashMessenger->getMessages();
     $this->view->instructors = $instructors;
     $this->view->headScript()->appendFile($this->view->baseUrl() . '/public/scripts/jMonthCalendar-1.1.0.js');
     //$this->view->headScript()->appendFile($this->view->baseUrl() . '/scripts/jMonthCalendar-1.2.2.js');
     $this->view->headScript()->appendFile($this->view->baseUrl() . '/public/scripts/jquery.bt.min.js');
 }