當前位置: 首頁>>代碼示例>>PHP>>正文


PHP CrowdfundingHelper::getDateFormat方法代碼示例

本文整理匯總了PHP中CrowdfundingHelper::getDateFormat方法的典型用法代碼示例。如果您正苦於以下問題:PHP CrowdfundingHelper::getDateFormat方法的具體用法?PHP CrowdfundingHelper::getDateFormat怎麽用?PHP CrowdfundingHelper::getDateFormat使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在CrowdfundingHelper的用法示例。


在下文中一共展示了CrowdfundingHelper::getDateFormat方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: loadFormData

 /**
  * Method to get the data that should be injected in the form.
  *
  * @return    mixed    The data for the form.
  * @since    1.6
  */
 protected function loadFormData()
 {
     $app = JFactory::getApplication();
     /** @var $app JApplicationSite */
     $data = $app->getUserState($this->option . '.edit.funding.data', array());
     if (!$data) {
         $itemId = (int) $this->getState($this->getName() . '.id');
         $userId = JFactory::getUser()->get("id");
         $data = $this->getItem($itemId, $userId);
         // Prepare date format.
         $dateFormat = CrowdfundingHelper::getDateFormat();
         $dateValidator = new Prism\Validator\Date($data->funding_end);
         // Validate end date. If the date is not valid, generate a valid one.
         // Use minimum allowed days to generate end funding date.
         if (!$dateValidator->isValid()) {
             // Get minimum days.
             $params = $this->getState("params");
             $minDays = $params->get("project_days_minimum", 30);
             // Generate end date.
             $today = new Crowdfunding\Date();
             $fundingEndDate = $today->calculateEndDate($minDays);
             $data->funding_end = $fundingEndDate->format("Y-m-d");
         }
         $date = new JDate($data->funding_end);
         $data->funding_end = $date->format($dateFormat);
     }
     return $data;
 }
開發者ID:pashakiz,項目名稱:crowdf,代碼行數:34,代碼來源:funding.php

示例2: prepareRewards

 protected function prepareRewards()
 {
     $model = JModelLegacy::getInstance('Rewards', 'CrowdfundingModel', $config = array('ignore_request' => false));
     // Get state
     $this->state = $model->getState();
     // Get params
     $this->projectId = $this->state->get('rewards.project_id');
     // Check if rewards are enabled.
     if (!$this->rewardsEnabled) {
         $this->app->enqueueMessage(JText::_('COM_CROWDFUNDING_ERROR_REWARDS_DISABLED'), 'notice');
         $this->app->redirect(JRoute::_(CrowdfundingHelperRoute::getFormRoute($this->projectId, 'manager'), false));
         return;
     }
     $this->items = $model->getItems($this->projectId);
     // Get project and validate it
     $project = Crowdfunding\Project::getInstance(JFactory::getDbo(), $this->projectId);
     $project = $project->getProperties();
     $this->item = Joomla\Utilities\ArrayHelper::toObject($project);
     // Check if the item exists.
     if (!CrowdfundingHelper::isAuthorized($this->userId, $this->item, 'rewards')) {
         $this->app->enqueueMessage(JText::_('COM_CROWDFUNDING_ERROR_SOMETHING_WRONG'), 'notice');
         $this->app->redirect(JRoute::_(CrowdfundingHelperRoute::getDiscoverRoute()));
         return;
     }
     // Create a currency object.
     $this->currency = Crowdfunding\Currency::getInstance(JFactory::getDbo(), $this->params->get('project_currency'));
     $this->amount = new Crowdfunding\Amount($this->params);
     $this->amount->setCurrency($this->currency);
     // Get date format
     $this->dateFormat = CrowdfundingHelper::getDateFormat();
     $this->dateFormatCalendar = CrowdfundingHelper::getDateFormat(true);
     $language = JFactory::getLanguage();
     $languageTag = $language->getTag();
     $js = '
         // Rewards calendar date format.
         var projectWizard = {
             dateFormat: "' . $this->dateFormatCalendar . '",
             locale: "' . substr($languageTag, 0, 2) . '"
         };
     ';
     $this->document->addScriptDeclaration($js);
     // Prepare rewards images.
     $this->rewardsImagesEnabled = (bool) $this->params->get('rewards_images', 0);
     $this->rewardsImagesUri = CrowdfundingHelper::getImagesFolderUri($this->userId);
     $this->options['column_left'] = (!$this->rewardsImagesEnabled or count($this->items) === 0) ? 12 : 8;
     $this->options['column_right'] = (!$this->rewardsImagesEnabled or count($this->items) === 0) ? 0 : 4;
     $this->prepareProjectType();
     $this->pathwayName = JText::_('COM_CROWDFUNDING_STEP_REWARDS');
 }
開發者ID:bellodox,項目名稱:CrowdFunding,代碼行數:49,代碼來源:view.html.php

示例3: prepareRewards

 protected function prepareRewards()
 {
     $model = JModelLegacy::getInstance("Rewards", "CrowdfundingModel", $config = array('ignore_request' => false));
     // Get state
     $this->state = $model->getState();
     // Get params
     $this->projectId = $this->state->get("rewards.project_id");
     // Check if rewards are enabled.
     if (!$this->rewardsEnabled) {
         $this->app->enqueueMessage(JText::_("COM_CROWDFUNDING_ERROR_REWARDS_DISABLED"), "notice");
         $this->app->redirect(JRoute::_(CrowdfundingHelperRoute::getFormRoute($this->projectId, "manager"), false));
         return;
     }
     $this->items = $model->getItems($this->projectId);
     // Get project and validate it
     $project = Crowdfunding\Project::getInstance(JFactory::getDbo(), $this->projectId);
     $project = $project->getProperties();
     $this->item = Joomla\Utilities\ArrayHelper::toObject($project);
     // Check if the item exists.
     if (!$this->isValid()) {
         return;
     }
     // Create a currency object.
     $this->currency = Crowdfunding\Currency::getInstance(JFactory::getDbo(), $this->params->get("project_currency"));
     $this->amount = new Crowdfunding\Amount($this->params);
     $this->amount->setCurrency($this->currency);
     // Get date format
     $this->dateFormat = CrowdfundingHelper::getDateFormat();
     $this->dateFormatCalendar = CrowdfundingHelper::getDateFormat(true);
     $language = JFactory::getLanguage();
     $languageTag = $language->getTag();
     $js = '
         // Rewards calendar date format.
         var projectWizard = {
             dateFormat: "' . $this->dateFormatCalendar . '",
             locale: "' . substr($languageTag, 0, 2) . '"
         };
     ';
     $this->document->addScriptDeclaration($js);
     // Prepare rewards images.
     $this->rewardsImagesEnabled = $this->params->get("rewards_images", 0);
     $this->rewardsImagesUri = CrowdfundingHelper::getImagesFolderUri($this->userId);
     $this->prepareProjectType();
     $this->pathwayName = JText::_("COM_CROWDFUNDING_STEP_REWARDS");
 }
開發者ID:pashakiz,項目名稱:crowdf,代碼行數:45,代碼來源:view.html.php

示例4: calendar

 /**
  * Displays a calendar control field based on Twitter Bootstrap 3
  *
  * @param   string $value      The date value
  * @param   string $name       The name of the text field
  * @param   string $id         The id of the text field
  * @param   string $format     The date format
  * @param   mixed  $attributes Additional HTML attributes
  *
  * @return  string  HTML markup for a calendar field
  *
  * @since   1.5
  * @see     http://eonasdan.github.io/bootstrap-datetimepicker/
  */
 public static function calendar($value, $name, $id, $format = 'Y-m-d', $attributes = null)
 {
     static $done;
     if ($done === null) {
         $done = array();
     }
     $readonly = isset($attributes['readonly']) && $attributes['readonly'] == 'readonly';
     $disabled = isset($attributes['disabled']) && $attributes['disabled'] == 'disabled';
     if (is_array($attributes)) {
         $attributes['class'] = isset($attributes['class']) ? $attributes['class'] : 'form-control';
         $attributes['class'] = trim($attributes['class'] . ' hasTooltip');
         $attributes = JArrayHelper::toString($attributes);
     }
     // Format value when not nulldate ('0000-00-00 00:00:00'), otherwise blank it as it would result in 1970-01-01.
     if ((int) $value && $value != JFactory::getDbo()->getNullDate()) {
         $date = new DateTime($value, new DateTimeZone('UTC'));
         $inputvalue = $date->format($format);
     } else {
         $inputvalue = '';
     }
     // Load the calendar behavior
     JHtml::_('prism.ui.bootstrap3Datepicker');
     $languageTag = JFactory::getLanguage()->getTag();
     $locale = substr($languageTag, 0, 2);
     // Only display the triggers once for each control.
     if (!in_array($id, $done)) {
         $calendarDateFormat = CrowdfundingHelper::getDateFormat(true);
         $document = JFactory::getDocument();
         $document->addScriptDeclaration('jQuery(document).ready(function($) {
                     jQuery("#' . $id . '_datepicker").datetimepicker({
                         format: "' . $calendarDateFormat . '",
                         locale: "' . \JString::strtolower($locale) . '",
                         allowInputToggle: true
                     });
                 });');
         $done[] = $id;
     }
     // Hide button using inline styles for readonly/disabled fields
     $btn_style = $readonly || $disabled ? ' style="display:none;"' : '';
     return '<div class="input-group date" id="' . $id . '_datepicker">
                 <input type="text" title="' . ($inputvalue ? JHtml::_("date", $value, null, null) : "") . '"
                 name="' . $name . '" id="' . $id . '" value="' . htmlspecialchars($inputvalue, ENT_COMPAT, 'UTF-8') . '" ' . $attributes . ' />
                 <span class="input-group-addon" id="' . $id . '_img">
                     <span class="glyphicon glyphicon-calendar" id="' . $id . '_icon"' . $btn_style . '></span>
                 </span>
             </div>';
 }
開發者ID:pashakiz,項目名稱:crowdf,代碼行數:61,代碼來源:ui.php


注:本文中的CrowdfundingHelper::getDateFormat方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。