Zend_Date PHP Class Code Examples

This page contains top rated real world PHP examples of class Zend_Date extracted from open source projects. You can rate examples to help us improve the quality of examples

Example #1
Show file File: IssueReturn.php Project: sivarajankumar/eduis
0
 public function fetchDatewiseCirculation(Zend_Date $date = NULL, $process = NULL, array $orderby = array('tranc_id'))
 {
     $select = $this->select()->from($this->info('name'), array('acc_no', 'member_id'));
     if (empty($date)) {
         $dateobj = new Zend_Date();
     }
     $datestr = $date->toString('YYYY-MM-dd');
     // If process is given
     if (!empty($process)) {
         $key = array_search(strtolower($process), $this->processes);
         if (isset($key)) {
             $proName = array($this->processes[$key]);
         } else {
             throw new Exception("The '{$process}' is not available.", Zend_Log::NOTICE);
         }
         //include possible processes
     } else {
         $proName = $this->processes;
         $select->columns(array('issue_date', 'return_date'));
     }
     foreach ($proName as $key => $pro) {
         $select->orwhere($pro . '_date LIKE ?', $datestr . '%');
     }
     $select->order($orderby);
     return $select->query()->fetchAll();
 }
Example #2
Show file File: Default.php Project: aram93/mage-enhanced-admin-grids
0
 protected function _renderDateValue($value, $renderOptions, $formOptions, $fieldType)
 {
     if (empty($value)) {
         return '';
     }
     if (!$value instanceof Zend_Date) {
         if (preg_match('/^[0-9]+$/', $value)) {
             if ((int) $value > 3155760000) {
                 $value = 0;
             }
             $value = new Zend_Date($this->_toTimestamp((int) $value));
         } else {
             $format = isset($renderOptions['input_format']) ? $renderOptions['input_format'] : Varien_Date::DATETIME_INTERNAL_FORMAT;
             $locale = isset($renderOptions['input_locale']) ? $renderOptions['input_locale'] : null;
             try {
                 $value = new Zend_Date($value, $format, $locale);
             } catch (Exception $e) {
                 return $this->_defaultValue;
             }
         }
     }
     if (isset($renderOptions['output_format'])) {
         $format = $renderOptions['output_format'];
     } else {
         $format = Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT);
     }
     $locale = isset($renderOptions['output_locale']) ? $renderOptions['output_locale'] : null;
     return $value->toString($format, null, $locale);
 }
Example #3
Show file File: Serialz.php Project: BGCX067/faett-channel-svn-to-git
0
 /**
  * This method check's if the passed serialz is
  * valid.
  *
  * @param string $serialz The serialz to check
  * @return boolen TRUE if the serial is valid for the actual customer
  */
 public function isValid($serialz)
 {
     // decrypt the passed licence
     $this->decrypt($serialz);
     // check the start date of the serialz
     $from = new Zend_Date($this->_toIsoDate($this->_validFrom), Zend_Date::ISO_8601);
     if ($from->compare(Zend_Date::now()) == 1) {
         return false;
     }
     // check the runtime for the serialz
     $then = new Zend_Date($this->_toIsoDate($this->_validThru), Zend_Date::ISO_8601);
     if ($then->compare(Zend_Date::now()) == -1) {
         return false;
     }
     // check for the customer ID
     if ($this->_customerId != $this->_number + $this->_getCustomerId()) {
         return false;
     }
     // check fot the product ID
     if ($this->_productId != $this->_number + $this->_getProductId()) {
         return false;
     }
     // return TRUE if the serialz is valid
     return true;
 }
Example #4
Show file File: Abstract.php Project: hientruong90/ee_14_installer
0
 /**
  * Validate rule data
  *
  * @param Varien_Object $object
  *
  * @return bool|array - return true if validation passed successfully. Array with errors description otherwise
  */
 public function validateData(Varien_Object $object)
 {
     $result = array();
     $fromDate = $toDate = null;
     if ($object->hasFromDate() && $object->hasToDate()) {
         $fromDate = $object->getFromDate();
         $toDate = $object->getToDate();
     }
     if ($fromDate && $toDate) {
         $fromDate = new Zend_Date($fromDate, Varien_Date::DATE_INTERNAL_FORMAT);
         $toDate = new Zend_Date($toDate, Varien_Date::DATE_INTERNAL_FORMAT);
         if ($fromDate->compare($toDate) === 1) {
             $result[] = Mage::helper('rule')->__('End Date must be greater than Start Date.');
         }
     }
     if ($object->hasWebsiteIds()) {
         $websiteIds = $object->getWebsiteIds();
         if (empty($websiteIds)) {
             $result[] = Mage::helper('rule')->__('Websites must be specified.');
         }
     }
     if ($object->hasCustomerGroupIds()) {
         $customerGroupIds = $object->getCustomerGroupIds();
         if (empty($customerGroupIds)) {
             $result[] = Mage::helper('rule')->__('Customer Groups must be specified.');
         }
     }
     return !empty($result) ? $result : true;
 }
Example #5
Show file File: DateAfter.php Project: GemsTracker/MUtil
0
 /**
  * Returns true if and only if $value meets the validation requirements
  *
  * If $value fails validation, then this method returns false, and
  * getMessages() will return an array of messages that explain why the
  * validation failed.
  *
  * @param  mixed $value
  * @return boolean
  * @throws \Zend_Valid_Exception If validation of $value is impossible
  */
 public function isValid($value, $context = null)
 {
     if (null === $this->_afterDate) {
         $this->_afterDate = new \Zend_Date();
     }
     if ($this->_afterDate instanceof \Zend_Date) {
         $after = $this->_afterDate;
     } elseif (isset($context[$this->_afterDate])) {
         if (empty($context[$this->_afterDate])) {
             $this->_error(self::NO_VALIDFROM);
             return false;
         }
         $after = new \Zend_Date($context[$this->_afterDate], $this->getDateFormat());
     } elseif (\Zend_Date::isDate($this->_afterDate, $this->getDateFormat())) {
         $after = new \Zend_Date($this->_afterDate, $this->getDateFormat());
     } else {
         // No date specified, return true
         return true;
     }
     $this->_afterValue = $after->toString($this->getDateFormat());
     $check = new \Zend_Date($value, $this->getDateFormat());
     if ($check->isEarlier($after)) {
         $this->_error(self::NOT_AFTER);
         return false;
     }
     return true;
 }
Example #6
Show file File: BookController.php Project: sivarajankumar/eduis
0
 public function circulationAction()
 {
     $request = $this->getRequest();
     $process = $request->getParam('process', 'issue');
     $pDate = $request->getParam('date');
     $format = $request->getParam('format', 'html');
     $book = new Lib_Model_Document_Book();
     if ($pDate) {
         $dateObj = new Zend_Date($pDate, 'dd-MM-YYYY');
     } else {
         $dateObj = new Zend_Date();
     }
     $result = $book->datewiseCirculation($dateObj, $process);
     switch (strtolower($format)) {
         case 'html':
             $this->_helper->viewRenderer->setNoRender(false);
             $this->_helper->layout()->enableLayout();
             $this->view->assign('transSet', $result);
             $this->view->assign('date', $dateObj);
             $this->view->assign('process', $process);
             return;
         case 'json':
             $this->_helper->json($result);
             return;
         case 'test':
             $this->_helper->logger->debug($result);
             return;
         case 'select':
             return;
         default:
             throw new Exception("Unsupported format '{$format}'", Zend_Log::NOTICE);
     }
 }
Example #7
Show file File: Container.php Project: cesarfelip3/clevermage_new
0
 public function getFilterData()
 {
     if (!$this->hasData('filter_data')) {
         $data = Mage::helper('adminhtml')->prepareFilterString($this->getRequest()->getParam('filter'));
         $data = $this->_filterDates($data, array('from', 'to'));
         $currentMonth = Mage::helper('helpdesk/report')->getInterval(Mirasvit_Helpdesk_Helper_Report::THIS_MONTH);
         if (!isset($data['from'])) {
             $data['from'] = $currentMonth->getFrom()->get(Varien_Date::DATETIME_INTERNAL_FORMAT);
         }
         if (!isset($data['to'])) {
             $data['to'] = $currentMonth->getTo()->get(Varien_Date::DATETIME_INTERNAL_FORMAT);
         }
         if (strpos($data['from'], ':') === false) {
             $data['from'] .= ' 00:00:00';
         }
         if (strpos($data['to'], ':') === false) {
             $data['to'] .= ' 23:59:59';
         }
         if (!isset($data['period'])) {
             $data['period'] = 'day';
         }
         $fromLocal = new Zend_Date(strtotime($data['from']) - Mage::getSingleton('core/date')->getGmtOffset());
         $data['from_local'] = $fromLocal->get(Varien_Date::DATETIME_INTERNAL_FORMAT);
         $toLocal = new Zend_Date(strtotime($data['to']) - Mage::getSingleton('core/date')->getGmtOffset());
         $data['to_local'] = $toLocal->get(Varien_Date::DATETIME_INTERNAL_FORMAT);
         $data['store_ids'] = array_filter(explode(',', $this->getRequest()->getParam('store_ids')));
         $data = array_filter($data);
         $this->setData('filter_data', new Varien_Object($data));
     }
     return $this->getData('filter_data');
 }
Example #8
Show file File: Facebook.php Project: bklein01/SiberianCMS
0
 protected function _prepareFbPost($post_datas)
 {
     $post = new Core_Model_Default();
     $icon_url = "https://graph.facebook.com/{$post_datas['from']['id']}/picture";
     $count_comments = isset($post_datas['comments']['data']) ? count($post_datas['comments']['data']) : 0;
     if ($count_comments == 25) {
         $count_comments = ' > ' . $count_comments;
     }
     $count_likes = isset($post_datas['likes']['data']) ? count($post_datas['likes']['data']) : 0;
     if ($count_likes == 25) {
         $count_likes = ' > ' . $count_likes;
     }
     $comments = array();
     if (!empty($post_datas['comments']['data']) && is_array($post_datas['comments']['data'])) {
         foreach ($post_datas['comments']['data'] as $comment) {
             $created_at = new Zend_Date($comment['created_time'], Zend_Date::ISO_8601, new Zend_Locale('en_US'));
             $comments[] = new Core_Model_Default(array('id' => $comment['id'], 'name' => $comment['from']['name'], 'message' => $comment['message'], 'picture' => "https://graph.facebook.com/{$comment['from']['id']}/picture", 'created_at' => $created_at->toString($this->_("MM/dd/y hh:mm a"))));
         }
     }
     $created_at = new Zend_Date($post_datas['created_time'], Zend_Date::ISO_8601, new Zend_Locale('en_US'));
     $message = '';
     if (!empty($post_datas['message'])) {
         $message = $post_datas['message'];
     } else {
         if (!empty($post_datas['story'])) {
             $message = $post_datas['story'];
         }
     }
     $picture = !empty($post_datas['picture']) ? $post_datas['picture'] : '';
     $picture = !empty($post_datas['object_id']) ? "https://graph.facebook.com/{$post_datas['object_id']}/picture?width=200" : $picture;
     $datas = array('id' => $post_datas['id'], 'author' => $post_datas['from']['name'], "avatar_url" => $icon_url, 'message' => $message, 'short_message' => strlen($message) > 300 ? Core_Model_Lib_String::truncate($message, 300) : $message, 'picture' => $picture, 'details' => !empty($post_datas['name']) ? $post_datas['name'] : '', "link" => isset($post_datas['link']) ? $post_datas['link'] : '', "created_at" => $created_at->toString($this->_("MM/dd/y hh:mm a")), "comments" => $comments, "nbr_of_comments" => $count_comments, "nbr_of_likes" => $count_likes);
     $post->setData($datas);
     return $post;
 }
Example #9
Show file File: Govn.php Project: BGCX067/facebook-store-svn-to-git
0
 private function _updateUserDb()
 {
     $fb_users = HTS_Util::getDbTable('users');
     $fb_user = $fb_users->findOneByIdSocial($this->_id_social);
     if (empty($fb_user)) {
         $user_profile = $this->_social->api('/me');
         if (FB_DEBUG) {
             Zend_Debug::dump($user_profile);
         }
         $fb_user = HTS_Util::getDbRow('users');
         $birthday = new Zend_Date(@$user_profile['Birthday'], 'dd/MM/yyyy');
         $updated_time = new Zend_Date(@$user_profile['Updated_time']);
         //TODO some values are null -> undefined index warning
         $fb_user->id_social = $user_profile['Id'];
         $fb_user->name = $user_profile['Name'];
         $fb_user->first_name = @$user_profile['First_name'];
         $fb_user->middle_name = @$user_profile['Middle_name'];
         $fb_user->last_name = @$user_profile['Last_name'];
         $fb_user->link = $user_profile['Link'];
         $fb_user->birthday = @$birthday->toString('yyyy/MM/dd');
         $fb_user->gender = $user_profile['Gender'];
         $fb_user->timezone = @$user_profile['Timezone'];
         $fb_user->locale = @$user_profile['Locale'];
         $fb_user->time_created = time();
         $fb_user->time_modified = time();
         $fb_user->time_social_modified = $updated_time->toValue();
         $this->_id_user = $fb_user->save();
     }
     $this->_user = $fb_user;
     $this->_id_user = $fb_user->id;
 }
Example #10
Show file File: DateTime.php Project: ingoratsdorf/Tine-2.0-Open-Source-Groupware-and-CRM
0
 /**
  * Returns the difference between two DateTime objects
  * 
  * @param  DateTime $datetime2
  * @param  bool     $absolute
  * @return DateInterval
  */
 public function php52compat_diff(DateTime $datetime2, $absolute = false)
 {
     // use Zend_Date for 32 bit compat
     $thisZD = new Zend_Date($this->format('U'));
     $datetime2ZD = new Zend_Date($datetime2->format('U'));
     return $datetime2ZD->sub($thisZD, Zend_Date::TIMESTAMP);
 }
Example #11
Show file File: Grid.php Project: cnglobal-sl/caterez
0
 protected function _setUpFilters()
 {
     $filter = $this->getParam($this->getVarNameFilter(), null);
     if (is_null($filter)) {
         $filter = $this->_defaultFilter;
     }
     if (is_string($filter)) {
         $data = array();
         $filter = base64_decode($filter);
         parse_str(urldecode($filter), $data);
         if (!isset($data['report_from'])) {
             // getting all reports from 2001 year
             $date = new Zend_Date(strtotime(date('m/01/y')));
             $data['report_from'] = $date->toString($this->getLocale()->getDateFormat('short'));
         }
         if (!isset($data['report_to'])) {
             // getting all reports from 2001 year
             $date = new Zend_Date();
             $data['report_to'] = $date->toString($this->getLocale()->getDateFormat('short'));
         }
         $this->_setFilterValues($data);
     } else {
         if ($filter && is_array($filter)) {
             $this->_setFilterValues($filter);
         } else {
             if (0 !== sizeof($this->_defaultFilter)) {
                 $this->_setFilterValues($this->_defaultFilter);
             }
         }
     }
     return $this;
 }
Example #12
Show file File: JobTrainingController.php Project: fredcido/simuweb
0
 /**
  * 
  */
 public function calculateMonthAction()
 {
     $dateIni = new Zend_Date($this->_getParam('data_ini'));
     $dateFin = new Zend_Date($this->_getParam('date_fim'));
     $diff = App_General_Date::getMonth($dateIni, $dateFin);
     $this->_helper->json(array('duration' => $diff));
 }
Example #13
Show file File: Locale.php Project: febryantosulistyo/ClassicSocial
0
 protected function _checkDateTime($datetime, $options = array())
 {
     if (is_numeric($datetime)) {
         $datetime = new Zend_Date($datetime);
     } else {
         if (is_string($datetime)) {
             $datetime = new Zend_Date(strtotime($datetime));
         } else {
             if (!$datetime instanceof Zend_Date) {
                 return false;
             }
         }
     }
     if (!$datetime instanceof Zend_Date) {
         throw new Engine_Exception('Not a valid date');
     }
     if (!isset($options['timezone']) && Zend_Registry::isRegistered('timezone')) {
         $options['timezone'] = Zend_Registry::get('timezone');
     }
     if (!isset($options['locale'])) {
         $options['locale'] = $this->getLocale();
     }
     if ($options['timezone']) {
         $datetime->setTimezone($options['timezone']);
     }
     if ($options['locale']) {
         $datetime->setLocale($options['locale']);
     }
     return $datetime;
 }
Example #14
Show file File: Rss.php Project: kobmaki/icingaweb2
0
 /**
  * Get the feed lastBuild date
  *
  * @return Zend_Date
  */
 public function getLastBuildDate()
 {
     if (array_key_exists('lastBuildDate', $this->_data)) {
         return $this->_data['lastBuildDate'];
     }
     $lastBuildDate = null;
     $date = null;
     if ($this->getType() !== Zend_Feed_Reader::TYPE_RSS_10 && $this->getType() !== Zend_Feed_Reader::TYPE_RSS_090) {
         $lastBuildDate = $this->_xpath->evaluate('string(/rss/channel/lastBuildDate)');
         if ($lastBuildDate) {
             $lastBuildDateParsed = strtotime($lastBuildDate);
             if ($lastBuildDateParsed) {
                 $date = new Zend_Date($lastBuildDateParsed);
             } else {
                 $dateStandards = array(Zend_Date::RSS, Zend_Date::RFC_822, Zend_Date::RFC_2822, Zend_Date::DATES);
                 $date = new Zend_Date();
                 foreach ($dateStandards as $standard) {
                     try {
                         $date->set($lastBuildDate, $standard);
                         break;
                     } catch (Zend_Date_Exception $e) {
                         if ($standard == Zend_Date::DATES) {
                             throw new Zend_Feed_Exception('Could not load date due to unrecognised' . ' format (should follow RFC 822 or 2822):' . $e->getMessage(), 0, $e);
                         }
                     }
                 }
             }
         }
     }
     if (!$date) {
         $date = null;
     }
     $this->_data['lastBuildDate'] = $date;
     return $this->_data['lastBuildDate'];
 }
Example #15
Show file File: Collection.php Project: cesarfelip3/clevermage_new
0
 protected function _getTZOffsetTransitions($timezone, $from = null, $to = null)
 {
     $tzTransitions = array();
     try {
         if ($from == null) {
             $from = new Zend_Date($from, Varien_Date::DATETIME_INTERNAL_FORMAT);
             $from = $from->getTimestamp();
         }
         $to = new Zend_Date($to, Varien_Date::DATETIME_INTERNAL_FORMAT);
         $nextPeriod = $this->getConnection()->formatDate($to->toString(Varien_Date::DATETIME_INTERNAL_FORMAT));
         $to = $to->getTimestamp();
         $dtz = new DateTimeZone($timezone);
         $transitions = $dtz->getTransitions();
         $dateTimeObject = new Zend_Date('c');
         for ($i = count($transitions) - 1; $i >= 0; $i--) {
             $tr = $transitions[$i];
             if (!$this->_isValidTransition($tr, $to)) {
                 continue;
             }
             $dateTimeObject->set($tr['time']);
             $tr['time'] = $this->getConnection()->formatDate($dateTimeObject->toString(Varien_Date::DATETIME_INTERNAL_FORMAT));
             $tzTransitions[$tr['offset']][] = array('from' => $tr['time'], 'to' => $nextPeriod);
             if (!empty($from) && $tr['ts'] < $from) {
                 break;
             }
             $nextPeriod = $tr['time'];
         }
     } catch (Exception $e) {
         $this->_logException($e);
     }
     return $tzTransitions;
 }
Example #16
Show file File: Login.php Project: roquebrasilia/sgdoc-codigo
0
 /**
  * @deprecated
  * @todo colocar essa camada de banco de dados no seu devido lugar.
  * 
  * Query antida:
  * SELECT
  * DATEDIFF(CURRENT_DATE(),A.DT_ACESSO) AS DIAS
  * FROM TB_USUARIOS U
  * INNER JOIN TB_CONTROLE_ACESSO A ON U.ID = A.ID_USUARIO
  * WHERE USUARIO = '$usuario'
  * ORDER BY A.ID DESC
  * LIMIT 1;
  * @return stdClass
  */
 public function ultimoAcesso()
 {
     $idUsuario = (int) $this->_auth->getIdentity()->ID;
     $result = new stdClass();
     //camada de banco de dados
     $sql = "SELECT A.DT_ACESSO FROM TB_CONTROLE_ACESSO AS A WHERE A.ID_USUARIO = ? ORDER BY A.ID DESC LIMIT 1";
     $stmt = $this->_db->prepare($sql);
     $stmt->bindParam(1, $idUsuario, PDO::PARAM_INT);
     $stmt->execute();
     $rs = $stmt->fetch(PDO::FETCH_ASSOC);
     //fim camada de banco de dados;
     $ultimo_acesso = new Zend_Date($rs['DT_ACESSO'], 'YYYY-MM-dd HH:mm:ss');
     $hoje = new Zend_Date();
     $seconds = $hoje->getTimestamp() - $ultimo_acesso->getTimestamp();
     $dias = floor($seconds / 60 / 60 / 24);
     $this->logAcesso();
     try {
         if ($dias > __MAXIMO_DIAS_NAO_LOGADO__) {
             $rsDesabilitarUsuario = $this->desabilitarUsuario();
             $this->clearAuth();
             if (isset($rsDesabilitarUsuario->error)) {
                 throw new Exception($rsDesabilitarUsuario->error);
             } else {
                 throw new Exception(self::MSG_USUARIO_INATIVO);
             }
         }
         $result->success = $dias;
     } catch (Exception $e) {
         $result->error = $e->getMessage();
         $this->_db->closeConnection();
     }
     return $result;
 }
Example #17
Show file File: ListController.php Project: bklein01/siberian_cms_2
0
 public function findallAction()
 {
     if ($value_id = $this->getRequest()->getParam('value_id')) {
         try {
             $option = $this->getCurrentOptionValue();
             $start_at = new Zend_Date();
             $end_at = new Zend_Date();
             $format = 'y-MM-dd HH:mm:ss';
             $offset = $this->getRequest()->getParam('offset', 0);
             $events = $option->getObject()->getEvents($offset);
             $data = array('collection' => array());
             foreach ($events as $key => $event) {
                 $start_at->set($event->getStartAt(), $format);
                 $end_at->set($event->getEndAt(), $format);
                 $formatted_start_at = $start_at->toString($this->_("MM.dd.y"));
                 $subtitle2 = $this->_("Entrance: %s", $event->getStartTimeAt());
                 if ($event->getLocationLabel()) {
                     $subtitle2 .= " | " . $this->_("Location: %s", $event->getLocationLabel());
                 }
                 $data['collection'][] = array("id" => $key, "title" => $event->getName(), "title2" => "{$start_at->toString(Zend_Date::WEEKDAY_NAME)} {$formatted_start_at}", "name" => $event->getName(), "subtitle" => $event->getSubtitle(), "subtitle2" => $subtitle2, "description" => $event->getDescription(), "month_name_short" => $start_at->toString(Zend_Date::MONTH_NAME_SHORT), "day" => $start_at->toString('dd'), "weekday_name" => $start_at->toString(Zend_Date::WEEKDAY_NAME), "start_time_at" => $event->getStartTimeAt(), "location" => $event->getLocation(), "url" => $this->getPath("event/mobile_view/index", array('value_id' => $option->getId(), "event_id" => $key)));
             }
             $data['page_title'] = $option->getTabbarName();
             $data['displayed_per_page'] = Event_Model_Event::DISPLAYED_PER_PAGE;
         } catch (Exception $e) {
             $data = array('error' => 1, 'message' => $e->getMessage());
         }
         $this->_sendHtml($data);
     }
 }
Example #18
Show file File: Lines.php Project: ngchie/system
0
 protected function formatCsvCell($row, $header)
 {
     if (($header == 'from' || $header == 'to' || $header == 'urt' || $header == 'notify_time') && $row) {
         if (!empty($row["tzoffset"])) {
             // TODO change this to regex; move it to utils
             $tzoffset = $row['tzoffset'];
             $sign = substr($tzoffset, 0, 1);
             $hours = substr($tzoffset, 1, 2);
             $minutes = substr($tzoffset, 3, 2);
             $time = $hours . ' hours ' . $minutes . ' minutes';
             if ($sign == "-") {
                 $time .= ' ago';
             }
             $timsetamp = strtotime($time, $row['urt']->sec);
             $zend_date = new Zend_Date($timsetamp);
             $zend_date->setTimezone('UTC');
             return $zend_date->toString("d/M/Y H:m:s") . $row['tzoffset'];
         } else {
             $zend_date = new Zend_Date($row[$header]->sec);
             return $zend_date->toString("d/M/Y H:m:s");
         }
     } else {
         return parent::formatCsvCell($row, $header);
     }
 }
Example #19
Show file File: PartnerUsageFilter.php Project: DBezemer/server
0
 public function init()
 {
     $this->setMethod('post');
     $this->setDecorators(array('FormElements', 'Form', array('HtmlTag', array('tag' => 'fieldset'))));
     // filter type
     $this->addElement('select', 'filter_type', array('required' => true, 'multiOptions' => array('none' => 'None', 'byid' => 'Publisher ID', 'byname' => 'Publisher Name', 'free' => 'Free-form text'), 'decorators' => array('ViewHelper', 'Label')));
     // search input
     $this->addElement('text', 'filter_input', array('required' => true, 'filters' => array('StringTrim'), 'decorators' => array('ViewHelper', array('HtmlTag', array('tag' => 'div', 'id' => 'filter_text')))));
     // active status
     $this->addElement('checkbox', 'include_active', array('label' => 'partner-usage filter active', 'checked' => true, 'decorators' => array('ViewHelper', array('Label', array('placement' => 'append')))));
     // blocked status
     $this->addElement('checkbox', 'include_blocked', array('label' => 'partner-usage filter blocked', 'checked' => true, 'decorators' => array('ViewHelper', array('Label', array('placement' => 'append')))));
     // removed status
     $this->addElement('checkbox', 'include_removed', array('label' => 'partner-usage filter removed', 'decorators' => array('ViewHelper', array('Label', array('placement' => 'append')))));
     //partner package
     $this->addElement('select', 'partner_package', array('filters' => array('StringTrim'), 'decorators' => array('ViewHelper', 'Label')));
     // from
     $from = new Zend_Date(time() - 60 * 60 * 24 * 30);
     $this->addElement('text', 'from_date', array('value' => $from->toString(self::getDefaultTranslator()->translate('datepicker format')), 'filters' => array('StringTrim'), 'decorators' => array('ViewHelper')));
     // from - to separator
     $this->addElement('text', 'dates_separator', array('description' => '&nbsp;-&nbsp;', 'filters' => array('StringTrim'), 'decorators' => array(array('Description', array('escape' => false, 'tag' => '')))));
     // to
     $to = new Zend_Date(time());
     $this->addElement('text', 'to_date', array('value' => $to->toString(self::getDefaultTranslator()->translate('datepicker format')), 'filters' => array('StringTrim'), 'decorators' => array('ViewHelper')));
     $this->addElement('text', 'clear_dates', array('description' => 'partner-usage filter clear dates', 'decorators' => array(array('Description', array('tag' => 'a', 'id' => 'clear_dates')))));
     $this->addElement('text', 'filter_input_help', array('decorators' => array(array('HtmlTag', array('tag' => 'div', 'class' => 'help', 'placement' => 'append')))));
     $this->addDisplayGroup(array('filter_type', 'filter_input', 'filter_input_help'), 'filter_type_group', array('description' => 'partner-usage filter by', 'decorators' => array(array('Description', array('tag' => 'legend')), 'FormElements', 'Fieldset')));
     $this->addDisplayGroup(array('include_active', 'include_blocked', 'include_removed'), 'statuses', array('description' => 'partner-usage filter status types', 'decorators' => array(array('Description', array('tag' => 'legend')), 'FormElements', 'Fieldset')));
     $this->addDisplayGroup(array('partner_package'), 'partnerPackage', array('description' => 'Show Service Editions:', 'decorators' => array(array('Description', array('tag' => 'legend')), 'FormElements', 'Fieldset')));
     $this->addDisplayGroup(array('from_date', 'dates_separator', 'to_date', 'clear_dates'), 'dates', array('description' => 'partner-usage filter range limit', 'decorators' => array(array('Description', array('tag' => 'legend')), 'FormElements', 'Fieldset')));
     // submit button
     $this->addElement('button', 'submit', array('type' => 'submit', 'id' => 'do_filter', 'label' => 'partner-usage filter search', 'decorators' => array('ViewHelper')));
 }
Example #20
Show file File: Serialz.php Project: BGCX067/faett-channel-svn-to-git
0
 /**
  * This method check's if the passed serialz is
  * valid.
  *
  * @param string $serialz The serialz to check
  * @return boolen TRUE if the serial is valid for the actual customer
  */
 public function isValid($serialz)
 {
     // decrypt the passed licence
     $this->decrypt($serialz);
     // check the start date of the serialz
     $from = new Zend_Date($this->_toIsoDate($this->_validFrom), Zend_Date::ISO_8601);
     if ($from->compare(Zend_Date::now()) == 1) {
         Mage::log('Runtime starts on ' . $from);
         return false;
     }
     // check the runtime for the serialz
     $then = new Zend_Date($this->_toIsoDate($this->_validThru), Zend_Date::ISO_8601);
     if ($then->compare(Zend_Date::now()) == -1) {
         Mage::log('Runtime ends on ' . $then);
         return false;
     }
     // check for the customer ID
     if ($this->_customerId != $this->_number + $this->_getCustomerId()) {
         Mage::log('Customer ID ' . $this->_customerId . ' does not match');
         return false;
     }
     // check fot the product ID
     if ($this->_productId != $this->_number + $this->_getProductId()) {
         Mage::log('Product ID ' . $this->_productId . ' does not match');
         return false;
     }
     // return TRUE if the serialz is valid
     return true;
 }