本文整理汇总了PHP中CrowdfundingHelper类的典型用法代码示例。如果您正苦于以下问题:PHP CrowdfundingHelper类的具体用法?PHP CrowdfundingHelper怎么用?PHP CrowdfundingHelper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CrowdfundingHelper类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: display
public function display($tpl = null)
{
$this->option = JFactory::getApplication()->input->getCmd('option');
$container = Prism\Container::getContainer();
$this->state = $this->get('State');
$this->items = $this->get('Items');
$this->pagination = $this->get('Pagination');
// Get params
$this->params = $this->state->get('params');
/** @var $this->params Joomla\Registry\Registry */
$this->numberInRow = (int) $this->params->get('featured_items_row', 3);
$helperBus = new Prism\Helper\HelperBus($this->items);
$helperBus->addCommand(new Crowdfunding\Helper\PrepareItemsHelper());
$helperBus->handle();
$this->displayCreator = (bool) $this->params->get('integration_display_creator', true);
// Prepare integration. Load avatars and profiles.
if ($this->displayCreator) {
$userIds = Prism\Utilities\ArrayHelper::getIds($this->items, 'user_id');
$this->socialProfiles = CrowdfundingHelper::prepareIntegration($this->params->get('integration_social_platform'), $userIds);
}
$this->layoutData = new stdClass();
$this->layoutData->items = $this->items;
$this->layoutData->params = $this->params;
$this->layoutData->money = $this->getMoneyFormatter($container, $this->params);
$this->layoutData->socialProfiles = $this->socialProfiles;
$this->layoutData->imageFolder = $this->params->get('images_directory', 'images/crowdfunding');
$this->prepareDocument();
parent::display($tpl);
}
开发者ID:ITPrism,项目名称:CrowdfundingDistribution,代码行数:29,代码来源:view.html.php
示例2: addSidebar
/**
* Add a menu on the sidebar of page
*/
protected function addSidebar()
{
// Add submenu
CrowdfundingHelper::addSubmenu($this->getName());
JHtmlSidebar::setAction('index.php?option=' . $this->option . '&view=' . $this->getName());
$this->sidebar = JHtmlSidebar::render();
}
开发者ID:ITPrism,项目名称:CrowdfundingDistribution,代码行数:10,代码来源:view.html.php
示例3: 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
示例4: onBeforeDelete
/**
* Pre-processor for $table->delete($pk)
*
* @param mixed $pk An optional primary key value to delete. If not set the instance property value is used.
*
* @return void
*
* @since 3.1.2
* @throws UnexpectedValueException
*/
public function onBeforeDelete($pk)
{
$userId = CrowdfundingHelper::getUserIdByRewardId($this->table->id);
$imagesFolder = CrowdfundingHelper::getImagesFolder($userId);
// Remove image.
if (!empty($this->table->image)) {
$fileSource = $imagesFolder . DIRECTORY_SEPARATOR . $this->table->image;
if (JFile::exists($fileSource)) {
JFile::delete($fileSource);
}
}
// Remove thumbnail.
if (!empty($this->table->image_thumb)) {
$fileSource = $imagesFolder . DIRECTORY_SEPARATOR . $this->table->image_thumb;
if (JFile::exists($fileSource)) {
JFile::delete($fileSource);
}
}
// Remove square image.
if (!empty($this->table->image_square)) {
$fileSource = $imagesFolder . DIRECTORY_SEPARATOR . $this->table->image_square;
if (JFile::exists($fileSource)) {
JFile::delete($fileSource);
}
}
}
开发者ID:pashakiz,项目名称:crowdf,代码行数:36,代码来源:reward.php
示例5: display
public function display($tpl = null)
{
$this->state = $this->get('State');
$this->form = $this->get('Form');
$this->importType = $this->state->get("import.context");
switch ($this->importType) {
case "locations":
$this->legend = JText::_("COM_CROWDFUNDING_IMPORT_LOCATIONS_DATA");
$this->uploadTask = "import.locations";
break;
case "countries":
$this->legend = JText::_("COM_CROWDFUNDING_IMPORT_COUNTRIES_DATA");
$this->uploadTask = "import.countries";
break;
case "states":
$this->legend = JText::_("COM_CROWDFUNDING_IMPORT_STATES_DATA");
$this->uploadTask = "import.states";
break;
default:
// Currencies
$this->legend = JText::_("COM_CROWDFUNDING_IMPORT_CURRENCY_DATA");
$this->uploadTask = "import.currencies";
break;
}
// Add submenu
CrowdfundingHelper::addSubmenu($this->importType);
// Prepare actions
$this->addToolbar();
$this->setDocument();
parent::display($tpl);
}
开发者ID:ITPrism,项目名称:CrowdfundingDistribution,代码行数:31,代码来源:view.html.php
示例6: display
public function display($tpl = null)
{
$this->option = JFactory::getApplication()->input->getCmd('option');
$this->state = $this->get('State');
$this->items = $this->get('Items');
$this->pagination = $this->get('Pagination');
// Get params
$this->params = $this->state->get('params');
/** @var $this->params Joomla\Registry\Registry */
$this->numberInRow = (int) $this->params->get('featured_items_row', 3);
$this->items = CrowdfundingHelper::prepareItems($this->items, $this->numberInRow);
// Get the folder with images
$this->imageFolder = $this->params->get('images_directory', 'images/crowdfunding');
// Get currency
$currency = Crowdfunding\Currency::getInstance(JFactory::getDbo(), $this->params->get('project_currency'));
$this->amount = new Crowdfunding\Amount($this->params);
$this->amount->setCurrency($currency);
$this->displayCreator = (bool) $this->params->get('integration_display_creator', true);
// Prepare integration. Load avatars and profiles.
if ($this->displayCreator) {
$socialProfilesBuilder = new Prism\Integration\Profiles\Builder(array('social_platform' => $this->params->get('integration_social_platform'), 'users_ids' => CrowdfundingHelper::fetchUserIds($this->items)));
$socialProfilesBuilder->build();
$this->socialProfiles = $socialProfilesBuilder->getProfiles();
}
$this->layoutData = array('items' => $this->items, 'params' => $this->params, 'amount' => $this->amount, 'socialProfiles' => $this->socialProfiles, 'imageFolder' => $this->imageFolder, 'titleLength' => $this->params->get('discover_title_length', 0), 'descriptionLength' => $this->params->get('discover_description_length', 0), 'span' => $this->numberInRow > 0 ? round(12 / $this->numberInRow) : 4);
$this->prepareDocument();
parent::display($tpl);
}
开发者ID:bellodox,项目名称:CrowdFunding,代码行数:28,代码来源:view.html.php
示例7: display
public function display($tpl = null)
{
$this->state = $this->get('State');
$this->items = $this->get('Items');
$this->pagination = $this->get('Pagination');
$this->params = $this->state->get("params");
$currency = Crowdfunding\Currency::getInstance(JFactory::getDbo(), $this->state->params->get("project_currency"));
$this->amount = new Crowdfunding\Amount($this->params);
$this->amount->setCurrency($currency);
// Get rewards number
$usersIds = array();
foreach ($this->items as $item) {
$usersIds[] = $item->id;
}
// Get number of rewards.
$statistics = new Crowdfunding\Statistics\Users(JFactory::getDbo(), $usersIds);
$this->projects = $statistics->getProjectsNumber();
$this->amounts = $statistics->getAmounts();
// Add submenu
CrowdfundingHelper::addSubmenu($this->getName());
// Prepare sorting data
$this->prepareSorting();
// Prepare actions
$this->addToolbar();
$this->addSidebar();
$this->setDocument();
parent::display($tpl);
}
开发者ID:Eautentik,项目名称:CrowdFunding,代码行数:28,代码来源:view.html.php
示例8: display
public function display($tpl = null)
{
$this->option = JFactory::getApplication()->input->getCmd('option');
$this->state = $this->get('State');
$this->items = $this->get('Items');
$this->pagination = $this->get('Pagination');
$this->params = $this->state->get('params');
$this->numberInRow = (int) $this->params->get('items_row', 3);
$this->prepareItems($this->items);
// Get the folder with images
$this->imageFolder = $this->params->get('images_directory', 'images/crowdfunding');
// Get currency
$currency = Crowdfunding\Currency::getInstance(JFactory::getDbo(), $this->params->get('project_currency'));
$this->amount = new Crowdfunding\Amount($this->params);
$this->amount->setCurrency($currency);
$this->displayCreator = (bool) $this->params->get('display_creator', true);
// Prepare social integration.
if ($this->displayCreator !== false) {
$usersIds = CrowdfundingHelper::fetchIds($this->items, 'user_id');
$this->socialProfiles = CrowdfundingHelper::prepareIntegrations($this->params->get('integration_social_platform'), $usersIds);
}
$this->layoutData = array('items' => $this->items, 'params' => $this->params, 'amount' => $this->amount, 'socialProfiles' => $this->socialProfiles, 'imageFolder' => $this->imageFolder, 'titleLength' => $this->params->get('discover_title_length', 0), 'descriptionLength' => $this->params->get('discover_description_length', 0), 'span' => $this->numberInRow > 0 ? round(12 / $this->numberInRow) : 4);
$this->prepareDocument();
parent::display($tpl);
}
开发者ID:sis-direct,项目名称:CrowdFunding,代码行数:25,代码来源:view.html.php
示例9: display
public function display($tpl = null)
{
$this->state = $this->get('State');
$this->items = $this->get('Items');
$this->pagination = $this->get('Pagination');
$this->params = $this->state->get("params");
// Get currencies
$currencies = array();
foreach ($this->items as $item) {
$currencies[] = $item->txn_currency;
}
$currencies = array_unique($currencies);
if (!empty($currencies)) {
$options = new Joomla\Registry\Registry();
$options->set("locale_intl", $this->params->get("locale_intl"));
$options->set("amount_format", $this->params->get("amount_format"));
$this->currencies = new Crowdfunding\Currencies(JFactory::getDbo(), $options);
$this->currencies->loadByCode($currencies);
}
$this->amount = new Crowdfunding\Amount($this->params);
// Get enabled specefic plugins.
$extensions = new Prism\Extensions(JFactory::getDbo(), $this->specificPlugins);
$this->enabledSpecificPlugins = $extensions->getEnabled();
// Add submenu
CrowdfundingHelper::addSubmenu($this->getName());
// Prepare sorting data
$this->prepareSorting();
// Prepare actions
$this->addToolbar();
$this->addSidebar();
$this->setDocument();
parent::display($tpl);
}
开发者ID:bharatthakkar,项目名称:CrowdFunding,代码行数:33,代码来源:view.html.php
示例10: display
public function display($tpl = null)
{
// Initialise variables
$this->state = $this->get("State");
$this->items = $this->get('Items');
$this->pagination = $this->get('Pagination');
// Get params
$this->params = $this->state->get("params");
/** @var $this->params Joomla\Registry\Registry */
$this->numberInRow = $this->params->get("items_row", 3);
$this->items = CrowdfundingHelper::prepareItems($this->items, $this->numberInRow);
// Get the folder with images
$this->imageFolder = $this->params->get("images_directory", "images/crowdfunding");
// Get currency
$currency = Crowdfunding\Currency::getInstance(JFactory::getDbo(), $this->params->get("project_currency"));
$this->amount = new Crowdfunding\Amount($this->params);
$this->amount->setCurrency($currency);
$this->displayCreator = $this->params->get("integration_display_creator", true);
// Prepare social integration.
if (!empty($this->displayCreator)) {
$socialProfilesBuilder = new Prism\Integration\Profiles\Builder(array("social_platform" => $this->params->get("integration_social_platform"), "users_ids" => CrowdfundingHelper::fetchUserIds($this->items)));
$socialProfilesBuilder->build();
$this->socialProfiles = $socialProfilesBuilder->getProfiles();
}
$this->layoutData = array("items" => $this->items, "params" => $this->params, "amount" => $this->amount, "socialProfiles" => $this->socialProfiles, "imageFolder" => $this->imageFolder, "titleLength" => $this->params->get("discover_title_length", 0), "descriptionLength" => $this->params->get("discover_description_length", 0), "span" => !empty($this->numberInRow) ? round(12 / $this->numberInRow) : 4);
$this->prepareDocument();
parent::display($tpl);
}
开发者ID:Eautentik,项目名称:CrowdFunding,代码行数:28,代码来源:view.html.php
示例11: onAfterDispatch
public function onAfterDispatch()
{
$app = JFactory::getApplication();
/** @var $app JApplicationSite */
if ($app->isAdmin()) {
return;
}
$document = JFactory::getDocument();
/** @var $document JDocumentHtml */
$type = $document->getType();
if (strcmp('html', $type) !== 0) {
return;
}
// It works only for GET and POST requests.
$method = strtolower($app->input->getMethod());
if (!in_array($method, array('get', 'post'), true)) {
return;
}
// Check component enabled
if (!JComponentHelper::isEnabled('com_crowdfunding')) {
return;
}
$view = $app->input->getCmd('view');
$option = $app->input->getCmd('option');
$isCrowdfundingComponent = strcmp($option, 'com_crowdfunding') === 0;
$isDetailsPage = (strcmp($option, 'com_crowdfunding') === 0 and strcmp($view, 'details') === 0);
// Allowed views for the module Crowdfunding Details
$allowedViewsModuleDetails = array('backing', 'embed', 'report', 'friendmail');
$allowedViewsModuleFilters = array('discover', 'category');
// Hide some modules if it is not details page.
if (!$isDetailsPage) {
$this->hideModule('mod_crowdfundinginfo');
$this->hideModule('mod_crowdfundingprofile');
$this->hideModule('mod_crowdfundingreporting');
}
// Module Crowdfunding Rewards (mod_crowdfundingrewards).
if (!$isDetailsPage) {
$this->hideModule('mod_crowdfundingrewards');
} else {
// Check project type. If the rewards are disable, hide the module.
$projectId = $app->input->getInt('id');
if ($projectId > 0 and !CrowdfundingHelper::isRewardsEnabled($projectId)) {
// Hide the module Crowdfunding Rewards, if rewards are disabled.
$this->hideModule('mod_crowdfundingrewards');
}
}
// Module Crowdfunding Details (mod_crowdfundingdetails) on backing and embed pages.
if (!$isCrowdfundingComponent or strcmp($option, 'com_crowdfunding') === 0 and !in_array($view, $allowedViewsModuleDetails, true)) {
$this->hideModule('mod_crowdfundingdetails');
}
// Module Crowdfunding Filters (mod_crowdfundingfilters).
if (!$isCrowdfundingComponent or strcmp($option, 'com_crowdfunding') === 0 and !in_array($view, $allowedViewsModuleFilters, true)) {
$this->hideModule('mod_crowdfundingfilters');
}
// Module Crowdfunding Filters (mod_crowdfundingsearch).
if (!$isCrowdfundingComponent or strcmp($option, 'com_crowdfunding') === 0 and !in_array($view, $allowedViewsModuleFilters, true)) {
$this->hideModule('mod_crowdfundingsearch');
}
}
开发者ID:ITPrism,项目名称:CrowdfundingDistribution,代码行数:59,代码来源:crowdfundingmodules.php
示例12: addSidebar
/**
* Add a menu on the sidebar of page
*/
protected function addSidebar()
{
// Add submenu
CrowdfundingHelper::addSubmenu('projects');
JHtmlSidebar::setAction('index.php?option=' . $this->option . '&view=' . $this->getName());
JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_PUBLISHED'), 'filter_state', JHtml::_('select.options', JHtml::_('jgrid.publishedOptions', array('archived' => false)), 'value', 'text', $this->state->get('filter.state'), true));
$this->sidebar = JHtmlSidebar::render();
}
开发者ID:bellodox,项目名称:CrowdFunding,代码行数:11,代码来源:view.html.php
示例13: onAfterDispatch
public function onAfterDispatch()
{
$app = JFactory::getApplication();
/** @var $app JApplicationSite */
if ($app->isAdmin()) {
return;
}
$document = JFactory::getDocument();
/** @var $document JDocumentHtml */
$type = $document->getType();
if (strcmp("html", $type) != 0) {
return;
}
// It works only for GET and POST requests.
$method = JString::strtolower($app->input->getMethod());
if (!in_array($method, array("get", "post"))) {
return;
}
// Check component enabled
if (!JComponentHelper::isEnabled('com_crowdfunding', true)) {
return;
}
$view = $app->input->getCmd("view");
$option = $app->input->getCmd("option");
$isCrowdfundingComponent = strcmp($option, "com_crowdfunding") == 0;
$isDetailsPage = (strcmp($option, "com_crowdfunding") == 0 and strcmp($view, "details") == 0);
// Allowed views for the module Crowdfunding Details
$allowedViewsModuleDetails = array("backing", "embed", "report");
$allowedViewsModuleFilters = array("discover", "category");
// Hide some modules if it is not details page.
if (!$isDetailsPage) {
$this->hideModule("mod_crowdfundinginfo");
$this->hideModule("mod_crowdfundingprofile");
$this->hideModule("mod_crowdfundingreporting");
}
// Module Crowdfunding Rewards (mod_crowdfundingrewards).
if (!$isDetailsPage) {
$this->hideModule("mod_crowdfundingrewards");
} else {
// Check project type. If the rewards are disable, hide the module.
$projectId = $app->input->getInt("id");
if (!empty($projectId)) {
// Hide the module Crowdfunding Rewards, if rewards are disabled.
if (!CrowdfundingHelper::isRewardsEnabled($projectId)) {
$this->hideModule("mod_crowdfundingrewards");
}
}
}
// Module Crowdfunding Details (mod_crowdfundingdetails) on backing and embed pages.
if (!$isCrowdfundingComponent or strcmp($option, "com_crowdfunding") == 0 and !in_array($view, $allowedViewsModuleDetails)) {
$this->hideModule("mod_crowdfundingdetails");
}
// Module Crowdfunding Filters (mod_crowdfundingfilters).
if (!$isCrowdfundingComponent or strcmp($option, "com_crowdfunding") == 0 and !in_array($view, $allowedViewsModuleFilters)) {
$this->hideModule("mod_crowdfundingfilters");
}
}
开发者ID:Eautentik,项目名称:CrowdFunding,代码行数:57,代码来源:crowdfundingmodules.php
示例14: 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()
{
// Check the session for previously entered form data.
$data = JFactory::getApplication()->getUserState($this->option . '.edit.report.data', array());
if (empty($data)) {
$data = $this->getItem();
$data->title = CrowdfundingHelper::getProjectTitle($data->project_id);
}
return $data;
}
开发者ID:pashakiz,项目名称:crowdf,代码行数:16,代码来源:report.php
示例15: save
public function save($key = null, $urlVar = null)
{
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
$data = $this->input->post->get('jform', array(), 'array');
$itemId = JArrayHelper::getValue($data, "id");
$redirectOptions = array("task" => $this->getTask(), "id" => $itemId);
// Parse formatted goal and funded amounts.
$data["goal"] = CrowdfundingHelper::parseAmount($data["goal"]);
$data["funded"] = CrowdfundingHelper::parseAmount($data["funded"]);
$model = $this->getModel();
/** @var $model CrowdfundingModelProject */
$form = $model->getForm($data, false);
/** @var $form JForm */
if (!$form) {
throw new Exception(JText::_("COM_Crowdfunding_ERROR_FORM_CANNOT_BE_LOADED"), 500);
}
// Validate the form
$validData = $model->validate($form, $data);
$validData["duration_type"] = JArrayHelper::getValue($data, "funding_duration_type");
// Check for errors.
if ($validData === false) {
$this->displayNotice($form->getErrors(), $redirectOptions);
return;
}
try {
// Get image
$files = $this->input->files->get('jform', array(), 'array');
$image = JArrayHelper::getValue($files, "image");
$pitchImage = JArrayHelper::getValue($files, "pitch_image");
// Upload image
if (!empty($image['name'])) {
$imageNames = $model->uploadImage($image);
if (!empty($imageNames["image"])) {
$validData = array_merge($validData, $imageNames);
}
}
// Upload pitch image
if (!empty($pitchImage['name'])) {
$pitchImageName = $model->uploadPitchImage($pitchImage);
if (!empty($pitchImageName)) {
$validData["pitch_image"] = $pitchImageName;
}
}
$itemId = $model->save($validData);
$redirectOptions["id"] = $itemId;
} catch (Exception $e) {
JLog::add($e->getMessage());
throw new Exception(JText::_('COM_Crowdfunding_ERROR_SYSTEM'));
}
$this->displayMessage(JText::_('COM_Crowdfunding_PROJECT_SAVED'), $redirectOptions);
}
开发者ID:pashakiz,项目名称:crowdf,代码行数:51,代码来源:project.php
示例16: onExtrasDisplay
/**
* This method prepares a code that will be included to step "Extras" on project wizard.
*
* @param string $context This string gives information about that where it has been executed the trigger.
* @param object $item A project data.
* @param Joomla\Registry\Registry $params The parameters of the component
*
* @return null|string
*/
public function onExtrasDisplay($context, &$item, &$params)
{
if (strcmp("com_crowdfunding.project.extras", $context) != 0) {
return null;
}
if ($this->app->isAdmin()) {
return null;
}
$doc = JFactory::getDocument();
/** @var $doc JDocumentHtml */
// Check document type
$docType = $doc->getType();
if (strcmp("html", $docType) != 0) {
return null;
}
if (empty($item->user_id)) {
return null;
}
// Create a media folder.
$mediaFolder = CrowdfundingFilesHelper::getMediaFolder();
if (!JFolder::exists($mediaFolder)) {
CrowdfundingHelper::createFolder($mediaFolder);
}
// Create a media folder for a user.
$mediaFolder = CrowdfundingFilesHelper::getMediaFolder($item->user_id);
if (!JFolder::exists($mediaFolder)) {
CrowdfundingHelper::createFolder($mediaFolder);
}
$componentParams = JComponentHelper::getParams("com_crowdfundingfiles");
/** @var $componentParams Joomla\Registry\Registry */
$mediaUri = CrowdfundingFilesHelper::getMediaFolderUri($item->user_id);
$options = array("project_id" => $item->id, "user_id" => $item->user_id);
$files = new CrowdfundingFiles\Files(JFactory::getDbo());
$files->load($options);
// Load jQuery
JHtml::_("jquery.framework");
JHtml::_("prism.ui.pnotify");
JHtml::_('prism.ui.fileupload');
JHtml::_('prism.ui.joomlaHelper');
// Include the translation of the confirmation question.
JText::script('PLG_CROWDFUNDING_FILES_DELETE_QUESTION');
// Get the path for the layout file
$path = JPath::clean(JPluginHelper::getLayoutPath('crowdfunding', 'files'));
// Render the login form.
ob_start();
include $path;
$html = ob_get_clean();
return $html;
}
开发者ID:pashakiz,项目名称:crowdf,代码行数:58,代码来源:files.php
示例17: display
public function display($tpl = null)
{
$this->state = $this->get('State');
$this->items = $this->get('Items');
$this->pagination = $this->get('Pagination');
// Add submenu
CrowdfundingHelper::addSubmenu($this->getName());
// Prepare sorting data
$this->prepareSorting();
// Prepare actions
$this->addToolbar();
$this->addSidebar();
$this->setDocument();
parent::display($tpl);
}
开发者ID:pashakiz,项目名称:crowdf,代码行数:15,代码来源:view.html.php
示例18: prepareDefaultLayout
protected function prepareDefaultLayout()
{
$this->rewards = new Crowdfunding\User\Rewards(JFactory::getDbo());
$this->rewards->load(array('reward_id' => $this->item->id));
$this->rewardOwnerId = CrowdfundingHelper::getUserIdByRewardId($this->item->id);
$dateValidator = new Prism\Validator\Date($this->item->delivery);
$this->deliveryDate = $dateValidator->isValid() ? JHtml::_('date', $this->item->delivery, JText::_('DATE_FORMAT_LC3')) : '--';
$this->imagesFolder = CrowdfundingHelper::getImagesFolderUri($this->rewardOwnerId);
// Get social profile
$socialPlatform = $this->params->get('integration_social_platform');
if ($socialPlatform) {
$this->socialProfile = CrowdfundingHelper::prepareIntegration($socialPlatform, $this->rewardOwnerId);
$this->profileLink = $this->socialProfile->getLink();
}
$this->returnUrl = base64_encode('index.php?option=com_crowdfunding&view=reward&id=' . $this->item->id);
}
开发者ID:ITPrism,项目名称:CrowdfundingDistribution,代码行数:16,代码来源:view.html.php
示例19: validate
public function validate($data)
{
if (!is_array($data) or count($data) === 0) {
throw new InvalidArgumentException(JText::_('COM_CROWDFUNDING_ERROR_INVALID_REWARDS'));
}
$filter = JFilterInput::getInstance();
$params = JComponentHelper::getParams('com_crowdfunding');
/** @var $params Joomla\Registry\Registry */
$money = $this->getMoneyFormatter($params);
foreach ($data as $key => &$item) {
$item['amount'] = $money->setAmount($item['amount'])->parse();
// Filter data
if (!is_numeric($item['amount'])) {
$item['amount'] = 0.0;
}
$item['title'] = $filter->clean($item['title'], 'string');
$item['title'] = JString::trim($item['title']);
$item['title'] = JString::substr($item['title'], 0, 128);
$item['description'] = $filter->clean($item['description'], 'string');
$item['description'] = JString::trim($item['description']);
$item['description'] = JString::substr($item['description'], 0, 500);
$item['number'] = (int) $item['number'];
$item['delivery'] = trim($item['delivery']);
$item['delivery'] = $filter->clean($item['delivery'], 'string');
if (!empty($item['delivery'])) {
$item['delivery'] = CrowdfundingHelper::convertToSql($item['delivery']);
$validatorDate = new Prism\Validator\Date($item['delivery']);
if (!$validatorDate->isValid()) {
$item['delivery'] = '';
}
}
if (!$item['title']) {
throw new RuntimeException(JText::_('COM_CROWDFUNDING_ERROR_INVALID_TITLE'));
}
if (!$item['description']) {
throw new RuntimeException(JText::_('COM_CROWDFUNDING_ERROR_INVALID_DESCRIPTION'));
}
if (!$item['amount']) {
throw new RuntimeException(JText::_('COM_CROWDFUNDING_ERROR_INVALID_AMOUNT'));
}
}
unset($item);
return $data;
}
开发者ID:ITPrism,项目名称:CrowdfundingDistribution,代码行数:44,代码来源:rewards.php
示例20: prepareDefaultLayout
protected function prepareDefaultLayout()
{
$this->rewards = new Crowdfunding\User\Rewards(JFactory::getDbo());
$this->rewards->load(array("reward_id" => $this->item->id));
$this->rewardOwnerId = CrowdfundingHelper::getUserIdByRewardId($this->item->id);
$dateValidator = new Prism\Validator\Date($this->item->delivery);
$this->deliveryDate = $dateValidator->isValid() ? JHtml::_('date', $this->item->delivery, JText::_('DATE_FORMAT_LC3')) : "--";
$this->imagesFolder = CrowdfundingHelper::getImagesFolderUri($this->rewardOwnerId);
// Get social profile
$socialPlatform = $this->params->get("integration_social_platform");
if (!empty($socialPlatform)) {
$options = array("social_platform" => $socialPlatform, "user_id" => $this->rewardOwnerId);
$profileBuilder = new Prism\Integration\Profile\Builder($options);
$profileBuilder->build();
$this->socialProfile = $profileBuilder->getProfile();
$this->profileLink = $this->socialProfile->getLink();
}
$this->returnUrl = base64_encode("index.php?option=com_crowdfunding&view=reward&id=" . $this->item->id);
}
开发者ID:pashakiz,项目名称:crowdf,代码行数:19,代码来源:view.html.php
注:本文中的CrowdfundingHelper类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论