public function display($tpl = null)
 {
     $this->option = JFactory::getApplication()->input->get('option');
     $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_SOCIALCOMMUNITY_IMPORT_LOCATIONS_DATA');
             $this->uploadTask = 'import.locations';
             break;
         case 'countries':
             $this->legend = JText::_('COM_SOCIALCOMMUNITY_IMPORT_COUNTRIES_DATA');
             $this->uploadTask = 'import.countries';
             break;
         case 'states':
             $this->legend = JText::_('COM_SOCIALCOMMUNITY_IMPORT_STATES_DATA');
             $this->uploadTask = 'import.states';
             break;
         default:
             // Currencies
             $this->legend = JText::_('COM_SOCIALCOMMUNITY_IMPORT_CURRENCY_DATA');
             $this->uploadTask = 'import.currencies';
             break;
     }
     // Add submenu
     SocialCommunityHelper::addSubmenu($this->importType);
     // Prepare actions
     $this->addToolbar();
     $this->setDocument();
     parent::display($tpl);
 }
Ejemplo n.º 2
0
 /**
  * Add a menu on the sidebar of page
  */
 protected function addSidebar()
 {
     UserIdeasHelper::addSubmenu($this->getName());
     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, "trash" => false)), 'value', 'text', $this->state->get('filter.state'), true));
     $this->sidebar = JHtmlSidebar::render();
 }
Ejemplo n.º 3
0
 /**
  * Add a menu on the sidebar of page
  */
 protected function addSidebar()
 {
     JHtmlSidebar::setAction('index.php?option=' . $this->option . '&view=' . $this->getName());
     $states = array(JHtml::_("select.option", "0", JText::_("COM_SOCIALCOMMUNITY_DOES_NOT_EXISTS")), JHtml::_("select.option", "1", JText::_("COM_SOCIALCOMMUNITY_EXISTS")));
     JHtmlSidebar::addFilter(JText::_('COM_SOCIALCOMMUNITY_SELECT_PROFILE_STATE'), 'filter_profile', JHtml::_('select.options', $states, 'value', 'text', $this->state->get('filter.profile'), true));
     $this->sidebar = JHtmlSidebar::render();
 }
Ejemplo n.º 4
0
 /**
  * Execute and display a template script.
  *
  * @param   string $tpl The name of the template file to parse; automatically searches through the template paths.
  *
  * @throws  Exception
  *
  * @return  mixed  A string if successful, otherwise a Error object.
  *
  * @see     JViewLegacy::loadTemplate()
  * @since   1.0
  */
 public function display($tpl = null)
 {
     $app = JFactory::getApplication();
     if (!$app->input->get('id', 0, 'int')) {
         $app->redirect(JRoute::_('index.php?view=visibilities'), JText::_('JGLOBAL_RESOURCE_NOT_FOUND'), 'error');
     }
     // Get data from the model
     $this->state = $this->get('State');
     $this->item = $this->get('Item');
     if (!$this->item) {
         $app->redirect(JRoute::_('index.php?view=visibilities'), JText::_('JGLOBAL_RESOURCE_NOT_FOUND'), 'error');
     }
     $this->params = $this->state->get('params');
     /** @var SichtweitenModelVisibilities $visibilities_model */
     $visibilities_model = JModelLegacy::getInstance('Visibilities', 'SichtweitenModel');
     $this->vis_state = $visibilities_model->getState();
     $this->vis_state->set('filter.period', 0);
     $this->vis_state->set('filter.location', (int) $this->item->id);
     if ($this->vis_state->get('list.ordering') == 'g.displayName') {
         $this->vis_state->set('list.ordering', 'datum');
         $this->vis_state->set('list.direction', 'DESC');
     }
     $this->items = $visibilities_model->getItems();
     $this->pagination = $visibilities_model->getPagination();
     parent::display($tpl);
 }
Ejemplo n.º 5
0
 /**
  * @throws Exception
  */
 protected function prepareDocument()
 {
     $app = JFactory::getApplication();
     $menus = $app->getMenu();
     $title = null;
     // Because the application sets a default page title,
     // we need to get it from the menu item itself
     $menu = $menus->getActive();
     if ($menu) {
         $this->params->def('page_heading', $this->params->get('page_title', $this->item->title));
     } else {
         $this->params->def('page_heading', $this->item->title);
     }
     $title = $this->params->get('page_title', '');
     if (empty($title)) {
         $title = $app->get('sitename');
     } elseif ($app->get('sitename_pagetitles', 0) == 1) {
         $title = JText::sprintf('JPAGETITLE', $app->get('sitename'), $title);
     } elseif ($app->get('sitename_pagetitles', 0) == 2) {
         $title = JText::sprintf('JPAGETITLE', $title, $app->get('sitename'));
     }
     $this->document->setTitle($title);
     if ($this->params->get('menu-meta_description')) {
         $this->document->setDescription($this->params->get('menu-meta_description'));
     }
     if ($this->params->get('menu-meta_keywords')) {
         $this->document->setMetadata('keywords', $this->params->get('menu-meta_keywords'));
     }
     if ($this->params->get('robots')) {
         $this->document->setMetadata('robots', $this->params->get('robots'));
     }
 }
Ejemplo n.º 6
0
 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);
 }
Ejemplo n.º 7
0
 /**
  * Add a menu on the sidebar of page
  */
 protected function addSidebar()
 {
     JHtmlSidebar::setAction('index.php?option=' . $this->option . '&view=' . $this->getName());
     $txnStatesOptions = array(JHtml::_("select.option", 1, JText::_("COM_CROWDFUNDINGDATA_COMPLETED")), JHtml::_("select.option", 0, JText::_("COM_CROWDFUNDINGDATA_NOT_COMPLETED")));
     JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_PUBLISHED'), 'filter_transaction_state', JHtml::_('select.options', $txnStatesOptions, 'value', 'text', $this->state->get('filter.transaction_state'), true));
     $this->sidebar = JHtmlSidebar::render();
 }
Ejemplo n.º 8
0
 protected function prepareFundingDurationType()
 {
     $this->fundingDuration = $this->params->get("project_funding_duration");
     switch ($this->fundingDuration) {
         case "days":
             // Only days type is enabled
             $this->checkedDays = 'checked="checked"';
             break;
         case "date":
             // Only date type is enabled
             $this->checkedDate = 'checked="checked"';
             break;
         default:
             // Both ( days and date ) types are enabled
             $fundingStartDateValidator = new Prism\Validator\Date($this->item->funding_end);
             $this->checkedDays = 0;
             $this->checkedDate = "";
             if (!empty($this->item->funding_days)) {
                 $this->checkedDays = 'checked="checked"';
                 $this->checkedDate = '';
             } elseif ($fundingStartDateValidator->isValid()) {
                 $this->checkedDays = '';
                 $this->checkedDate = 'checked="checked"';
             }
             // If missing both, select days
             if (!$this->checkedDays and !$this->checkedDate) {
                 $this->checkedDays = 'checked="checked"';
             }
             break;
     }
 }
Ejemplo n.º 9
0
 public function display($tpl = null)
 {
     $this->version = new CrowdfundingFinance\Version();
     // Load ITPrism library version
     if (!class_exists("Prism\\Version")) {
         $this->itprismVersion = JText::_("COM_CROWDFUNDINGFINANCE_PRISM_LIBRARY_DOWNLOAD");
     } else {
         $itprismVersion = new Prism\Version();
         $this->itprismVersion = $itprismVersion->getShortVersion();
     }
     /** @var  $cfParams Joomla\Registry\Registry */
     $cfParams = JComponentHelper::getParams("com_crowdfunding");
     $this->cfParams = $cfParams;
     // Get latest transactions.
     $this->latest = new Crowdfunding\Statistics\Transactions\Latest(JFactory::getDbo());
     $this->latest->load(5);
     $basic = new Crowdfunding\Statistics\Basic(JFactory::getDbo());
     $this->totalProjects = $basic->getTotalProjects();
     $this->totalTransactions = $basic->getTotalTransactions();
     $this->totalAmount = $basic->getTotalAmount();
     // Get currency.
     $currency = Crowdfunding\Currency::getInstance(JFactory::getDbo(), $this->cfParams->get("project_currency"));
     $this->amount = new Crowdfunding\Amount($this->cfParams);
     $this->amount->setCurrency($currency);
     // Add submenu
     CrowdfundingFinanceHelper::addSubmenu($this->getName());
     $this->addToolbar();
     $this->addSidebar();
     $this->setDocument();
     parent::display($tpl);
 }
Ejemplo n.º 10
0
 /**
  * Add a menu on the sidebar of page
  */
 protected function addSidebar()
 {
     JHtmlSidebar::setAction('index.php?option=' . $this->option . '&view=' . $this->getName());
     $statesOptions = array(JHtml::_("select.option", 0, JText::_("COM_IDENTITYPROOF_NOT_VERIFIED")), JHtml::_("select.option", 1, JText::_("COM_IDENTITYPROOF_VERIFIED")));
     JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_PUBLISHED'), 'filter_state', JHtml::_('select.options', $statesOptions, 'value', 'text', $this->state->get('filter.state'), true));
     $this->sidebar = JHtmlSidebar::render();
 }
Ejemplo n.º 11
0
 /**
  * Add a menu on the sidebar of page
  */
 protected function addSidebar()
 {
     JHtmlSidebar::setAction('index.php?option=' . $this->option . '&view=' . $this->getName());
     $filters = new Crowdfunding\Filters(JFactory::getDbo());
     $types = $filters->getLogTypes();
     JHtmlSidebar::addFilter(JText::_('COM_CROWDFUNDING_SELECT_TYPE'), 'filter_type', JHtml::_('select.options', $types, 'value', 'text', $this->state->get('filter.type'), true));
     $this->sidebar = JHtmlSidebar::render();
 }
Ejemplo n.º 12
0
 /**
  * Prepare sortable fields, sort values and filters.
  */
 protected function prepareSorting()
 {
     $this->listOrder = $this->escape($this->state->get('list.ordering'));
     $this->listDirn = $this->escape($this->state->get('list.direction'));
     $this->saveOrder = strcmp($this->listOrder, 'a.ordering') === 0;
     $this->filterForm = $this->get('FilterForm');
     $this->activeFilters = $this->get('ActiveFilters');
 }
Ejemplo n.º 13
0
 public function submitter()
 {
     $application = JFactory::getApplication();
     $input = $application->input;
     $name = $input->post->get("_" . md5($this->Params->get("sender0") . $application->cid . $application->mid), "", "string");
     $address = $input->post->get("_" . md5($this->Params->get("sender1") . $application->cid . $application->mid), "", "string");
     return array($address, $name);
 }
Ejemplo n.º 14
0
 /**
  * Prepare sortable fields, sort values and filters.
  */
 protected function prepareSorting()
 {
     // Prepare filters
     $this->listOrder = $this->escape($this->state->get('list.ordering'));
     $this->listDirn = $this->escape($this->state->get('list.direction'));
     $this->saveOrder = strcmp($this->listOrder, 'a.ordering') != 0 ? false : true;
     $this->sortFields = array('a.subject' => JText::_('COM_USERIDEAS_SUBJECT'), 'a.sender_name' => JText::_('COM_USERIDEAS_SENDER_NAME'), 'a.sender_email' => JText::_('COM_USERIDEAS_SENDER_EMAIL'), 'a.id' => JText::_('JGRID_HEADING_ID'));
 }
 /**
  * Add a menu on the sidebar of page
  */
 protected function addSidebar()
 {
     // Add submenu
     SocialCommunityHelper::addSubmenu($this->getName());
     JHtmlSidebar::setAction('index.php?option=' . $this->option . '&view=' . $this->getName());
     $states = array(JHtml::_('select.option', '0', JText::_('COM_SOCIALCOMMUNITY_DOES_NOT_EXISTS')), JHtml::_('select.option', '1', JText::_('COM_SOCIALCOMMUNITY_EXISTS')));
     JHtmlSidebar::addFilter(JText::_('COM_SOCIALCOMMUNITY_SELECT_PROFILE_STATE'), 'filter_profile', JHtml::_('select.options', $states, 'value', 'text', $this->state->get('filter.profile'), true));
     $this->sidebar = JHtmlSidebar::render();
 }
Ejemplo n.º 16
0
 /**
  * Add a menu on the sidebar of page
  */
 protected function addSidebar()
 {
     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, "trash" => false)), 'value', 'text', $this->state->get('filter.state'), true));
     JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_CATEGORY'), 'filter_category', JHtml::_('select.options', JHtml::_('category.options', 'com_userideas'), 'value', 'text', $this->state->get('filter.category'), true));
     // Item statuses
     jimport("userideas.statuses");
     $statuses = UserIdeasStatuses::getInstance(JFactory::getDbo());
     JHtmlSidebar::addFilter(JText::_('COM_USERIDEAS_SELECT_ITEM_STATUS'), 'filter_status', JHtml::_('select.options', $statuses->getStatusesOptions(), 'value', 'text', $this->state->get('filter.status'), true));
     $this->sidebar = JHtmlSidebar::render();
 }
Ejemplo n.º 17
0
 /**
  * Display the view
  */
 public function display($tpl = null)
 {
     $this->state = $this->get('State');
     $this->item = $this->get('Item');
     $this->form = $this->get('Form');
     $this->params = $this->state->get("params");
     // Prepare actions, behaviors, scritps and document
     $this->addToolbar();
     $this->setDocument();
     parent::display($tpl);
 }
Ejemplo n.º 18
0
 /**
  * Add a menu on the sidebar of page
  */
 protected function addSidebar()
 {
     // Prepare options
     $approvedOptions = array(JHtml::_('select.option', 1, JText::_('COM_CROWDFUNDINGFINANCE_APPROVED')), JHtml::_('select.option', 0, JText::_('COM_CROWDFUNDINGFINANCE_DISAPPROVED')));
     $featuredOptions = array(JHtml::_('select.option', 1, JText::_('COM_CROWDFUNDINGFINANCE_FEATURED')), JHtml::_('select.option', 0, JText::_('COM_CROWDFUNDINGFINANCE_NOT_FEATURED')));
     JHtmlSidebar::setAction('index.php?option=' . $this->option . '&view=' . $this->getName());
     JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_PUBLISHED'), 'filter_state', JHtml::_('select.options', JHtml::_('jgrid.publishedOptions'), 'value', 'text', $this->state->get('filter.state'), true));
     JHtmlSidebar::addFilter(JText::_('COM_CROWDFUNDINGFINANCE_SELECT_APPROVED_STATUS'), 'filter_approved', JHtml::_('select.options', $approvedOptions, 'value', 'text', $this->state->get('filter.approved'), true));
     JHtmlSidebar::addFilter(JText::_('COM_CROWDFUNDINGFINANCE_SELECT_FEATURED_STATUS'), 'filter_featured', JHtml::_('select.options', $featuredOptions, 'value', 'text', $this->state->get('filter.featured'), true));
     JHtmlSidebar::addFilter(JText::_('JOPTION_SELECT_CATEGORY'), 'filter_category_id', JHtml::_('select.options', JHtml::_('category.options', 'com_crowdfunding'), 'value', 'text', $this->state->get('filter.category_id')));
     $this->sidebar = JHtmlSidebar::render();
 }
Ejemplo n.º 19
0
 /**
  * Prepare sortable fields, sort values and filters.
  */
 protected function prepareSorting()
 {
     // Prepare filters
     $this->listOrder = $this->escape($this->state->get('list.ordering'));
     $this->listDirn = $this->escape($this->state->get('list.direction'));
     $this->saveOrder = strcmp($this->listOrder, 'a.ordering') === 0;
     if ($this->saveOrder) {
         $this->saveOrderingUrl = 'index.php?option=' . $this->option . '&task=' . $this->getName() . '.saveOrderAjax&format=raw';
         JHtml::_('sortablelist.sortable', $this->getName() . 'List', 'adminForm', strtolower($this->listDirn), $this->saveOrderingUrl);
     }
     $this->sortFields = array('a.subject' => JText::_('COM_CROWDFUNDING_SUBJECT'), 'a.email' => JText::_('COM_CROWDFUNDING_EMAIL'), 'a.record_date' => JText::_('JDATE'), 'c.name' => JText::_('COM_CROWDFUNDING_USER'), 'a.id' => JText::_('JGRID_HEADING_ID'));
 }
Ejemplo n.º 20
0
 /**
  * Prepare sortable fields, sort values and filters.
  */
 protected function prepareSorting()
 {
     // Prepare filters
     $this->listOrder = $this->escape($this->state->get('list.ordering'));
     $this->listDirn = $this->escape($this->state->get('list.direction'));
     $this->saveOrder = strcmp($this->listOrder, 'a.ordering') != 0 ? false : true;
     if ($this->saveOrder) {
         $this->saveOrderingUrl = 'index.php?option=' . $this->option . '&task=' . $this->getName() . '.saveOrderAjax&format=raw';
         JHtml::_('sortablelist.sortable', $this->getName() . 'List', 'adminForm', strtolower($this->listDirn), $this->saveOrderingUrl);
     }
     $this->sortFields = array('a.title' => JText::_('COM_VIRTUALCURRENCY_TITLE'), 'a.abbr' => JText::_('COM_VIRTUALCURRENCY_ABBR'), 'a.id' => JText::_('JGRID_HEADING_ID'));
 }
Ejemplo n.º 21
0
 /**
  * Prepare sortable fields, sort values and filters.
  */
 protected function prepareSorting()
 {
     // Prepare filters
     $this->listOrder = $this->escape($this->state->get('list.ordering'));
     $this->listDirn = $this->escape($this->state->get('list.direction'));
     $this->saveOrder = strcmp($this->listOrder, 'a.ordering') != 0 ? false : true;
     if ($this->saveOrder) {
         $this->saveOrderingUrl = 'index.php?option=' . $this->option . '&task=' . $this->getName() . '.saveOrderAjax&format=raw';
         JHtml::_('sortablelist.sortable', $this->getName() . 'List', 'adminForm', strtolower($this->listDirn), $this->saveOrderingUrl);
     }
     $this->sortFields = array('a.name' => JText::_('COM_CROWDFUNDING_NAME'), 'a.registerDate' => JText::_('COM_CROWDFUNDING_REGISTRATION_DATE'), 'a.id' => JText::_('JGRID_HEADING_ID'));
 }
Ejemplo n.º 22
0
 /**
  * Prepare sortable fields, sort values and filters.
  */
 protected function prepareSorting()
 {
     // Prepare filters
     $this->listOrder = $this->escape($this->state->get('list.ordering'));
     $this->listDirn = $this->escape($this->state->get('list.direction'));
     $this->saveOrder = strcmp($this->listOrder, 'a.ordering') != 0 ? false : true;
     if ($this->saveOrder) {
         $this->saveOrderingUrl = 'index.php?option=' . $this->option . '&task=' . $this->getName() . '.saveOrderAjax&format=raw';
         JHtml::_('sortablelist.sortable', $this->getName() . 'List', 'adminForm', strtolower($this->listDirn), $this->saveOrderingUrl);
     }
     $this->sortFields = array('a.name' => JText::_('COM_CROWDFUNDING_NAME'), 'a.code' => JText::_('COM_CROWDFUNDING_COUNTRY_CODE'), 'a.locale' => JText::_('COM_CROWDFUNDING_COUNTRY_LOCALE'), 'a.latitude' => JText::_('COM_CROWDFUNDING_COUNTRY_LATITUDE'), 'a.longitude' => JText::_('COM_CROWDFUNDING_COUNTRY_LONGITUDE'), 'a.timezone' => JText::_('COM_CROWDFUNDING_COUNTRY_TIMEZONE'), 'a.id' => JText::_('JGRID_HEADING_ID'));
 }
Ejemplo n.º 23
0
 /**
  * Execute and display a template script.
  *
  * @param   string $tpl The name of the template file to parse; automatically searches through the template paths.
  *
  * @throws  Exception
  *
  * @return  mixed  A string if successful, otherwise a Error object.
  *
  * @see     JViewLegacy::loadTemplate()
  * @since   1.0
  */
 public function display($tpl = null)
 {
     // Get data from the models
     $this->state = $this->get('State');
     $this->state->set('list.start', 0);
     $this->state->set('list.limit', 0);
     $this->items = $this->get('Items');
     // Check for errors
     if (count($errors = $this->get('Errors'))) {
         throw new Exception(implode("\n", $errors), 500);
     }
     $this->params = $this->state->get('params');
     parent::display($tpl);
 }
Ejemplo n.º 24
0
 /**
  * Method to set up the document properties
  *
  * @return void
  */
 protected function setDocument()
 {
     $this->document->setTitle($this->documentTitle);
     // Add scripts
     JHtml::_('bootstrap.tooltip');
     JHtml::_('behavior.keepalive');
     JHtml::_('behavior.formvalidation');
     $d3Cdn = (bool) $this->params->get('d3_cdn', true);
     JHtml::_('Prism.ui.d3', $d3Cdn);
     $js = '
         cfProjectId = ' . $this->item->id . ';
     ';
     $this->document->addScriptDeclaration($js);
     $this->document->addScript('../media/' . $this->option . '/js/admin/' . JString::strtolower($this->getName()) . '.js');
 }
Ejemplo n.º 25
0
 protected function sendReportMail($report, $emailId)
 {
     $app = JFactory::getApplication();
     /** @var $app JApplicationSite */
     // Send mail to the administrator
     if (!$emailId) {
         return false;
     }
     // Get website
     $uri = JUri::getInstance();
     $website = $uri->toString(array("scheme", "host"));
     $emailMode = $this->params->get("email_mode", "plain");
     // Get project
     $project = Crowdfunding\Project::getInstance(JFactory::getDbo(), $report->project_id);
     // Prepare data for parsing
     $data = array("site_name" => $app->get("sitename"), "site_url" => JUri::root(), "item_title" => $project->getTitle(), "item_url" => $website . JRoute::_(CrowdfundingHelperRoute::getDetailsRoute($project->getSlug(), $project->getCatSlug())), "report_subject" => $report->subject, "report_description" => $report->description);
     $email = new EmailTemplates\Email();
     $email->setDb(JFactory::getDbo());
     $email->load($emailId);
     if (!$email->getSenderName()) {
         $email->setSenderName($app->get("fromname"));
     }
     if (!$email->getSenderEmail()) {
         $email->setSenderEmail($app->get("mailfrom"));
     }
     // Prepare recipient data.
     $componentParams = JComponentHelper::getParams("com_crowdfunding");
     /** @var  $componentParams Joomla\Registry\Registry */
     $recipientId = $componentParams->get("administrator_id");
     if (!empty($recipientId)) {
         $recipient = JFactory::getUser($recipientId);
         $recipientName = $recipient->get("name");
         $recipientMail = $recipient->get("email");
     } else {
         $recipientName = $app->get("fromname");
         $recipientMail = $app->get("mailfrom");
     }
     // Prepare data for parsing
     $data["sender_name"] = $email->getSenderName();
     $data["sender_email"] = $email->getSenderEmail();
     $data["recipient_name"] = $recipientName;
     $data["recipient_email"] = $recipientMail;
     $email->parse($data);
     $subject = $email->getSubject();
     $body = $email->getBody($emailMode);
     $mailer = JFactory::getMailer();
     if (strcmp("html", $emailMode) == 0) {
         // Send as HTML message
         $result = $mailer->sendMail($email->getSenderEmail(), $email->getSenderName(), $recipientMail, $subject, $body, Prism\Constants::MAIL_MODE_HTML);
     } else {
         // Send as plain text.
         $result = $mailer->sendMail($email->getSenderEmail(), $email->getSenderName(), $recipientMail, $subject, $body, Prism\Constants::MAIL_MODE_PLAIN);
     }
     // Log the error.
     if ($result !== true) {
         $this->log->add(JText::sprintf("PLG_CONTENT_CROWDFUNDINGADMINMAIL_ERROR_SEND_MAIL", $this->name), "PLG_CONTENT_ADMIN_EMAIL_ERROR", JText::sprintf("PLG_CONTENT_CROWDFUNDINGADMINMAIL_ERROR_SEND_MAIL_NOTE", $mailer->ErrorInfo));
         return false;
     }
     return true;
 }
Ejemplo n.º 26
0
 /**
  * @param int $projectId
  * @param Joomla\Registry\Registry $params
  * @param object $paymentSession
  *
  * @return stdClass
  * @throws UnexpectedValueException
  */
 public function prepareItem($projectId, $params, $paymentSession)
 {
     $project = new Crowdfunding\Project(JFactory::getDbo());
     $project->load($projectId);
     if (!$project->getId()) {
         throw new UnexpectedValueException(JText::_("COM_CROWDFUNDING_ERROR_INVALID_PROJECT"));
     }
     if ($project->isCompleted()) {
         throw new UnexpectedValueException(JText::_("COM_CROWDFUNDING_ERROR_COMPLETED_PROJECT"));
     }
     // Get currency
     $currency = Crowdfunding\Currency::getInstance(JFactory::getDbo(), $params->get("project_currency"));
     // Create amount object.
     $amount = new Crowdfunding\Amount($params);
     $amount->setCurrency($currency);
     $item = new stdClass();
     $item->id = $project->getId();
     $item->title = $project->getTitle();
     $item->slug = $project->getSlug();
     $item->catslug = $project->getCatSlug();
     $item->rewardId = $paymentSession->rewardId;
     $item->starting_date = $project->getFundingStart();
     $item->ending_date = $project->getFundingEnd();
     $item->amount = $paymentSession->amount;
     $item->currencyCode = $currency->getCode();
     $item->amountFormated = $amount->setValue($item->amount)->format();
     $item->amountCurrency = $amount->setValue($item->amount)->formatCurrency();
     return $item;
 }
Ejemplo n.º 27
0
 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);
 }
Ejemplo n.º 28
0
 /**
  * Generate links to a user avatar and profile.
  *
  * @param CrowdfundingPartners\Partners $partners
  * @param string $socialPlatform
  */
 protected function prepareIntegration($partners, $socialPlatform)
 {
     $defaultAvatar = "media/com_crowdfunding/images/no-profile.png";
     if (!empty($socialPlatform)) {
         $usersIds = array();
         foreach ($partners as $partner) {
             $usersIds[] = $partner["partner_id"];
         }
         $config = array("social_platform" => $socialPlatform, "users_ids" => $usersIds);
         $socialProfilesBuilder = new Prism\Integration\Profiles\Builder($config);
         $socialProfilesBuilder->build();
         $socialProfiles = $socialProfilesBuilder->getProfiles();
         foreach ($partners as $key => $value) {
             $value["avatar"] = $socialProfiles->getAvatar($value["partner_id"], $this->params->get("image_size", "small"));
             $value["link"] = $socialProfiles->getLink($value["partner_id"]);
             $partners[$key] = $value;
         }
     } else {
         // Set default avatar
         foreach ($partners as $key => $value) {
             $value["avatar"] = $defaultAvatar;
             $value["link"] = "";
             $partners[$key] = $value;
         }
     }
 }
Ejemplo n.º 29
0
 /**
  *
  * Add a menu on the sidebar of page
  */
 protected function addSidebar()
 {
     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, "trash" => false)), 'value', 'text', $this->state->get('filter.state'), true));
     JHtmlSidebar::addFilter(JText::_('COM_ITPMETA_SELECT_AUTOUPDATE'), 'filter_autoupdate', JHtml::_('select.options', JHtml::_('itpmeta.enabledOptions'), 'value', 'text', $this->state->get('filter.autoupdate'), true));
     $this->sidebar = JHtmlSidebar::render();
 }
Ejemplo n.º 30
0
 /**
  * This method prepares a payment gateway - buttons, forms,...
  * That gateway will be displayed on the summary page as a payment option.
  *
  * @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 onPaymentExtras($context, &$item, &$params)
 {
     if (strcmp("com_crowdfunding.payment.step2", $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;
     }
     // Load language file of the component.
     $language = JFactory::getLanguage();
     $language->load('com_crowdfundingdata', CROWDFUNDINGDATA_PATH_COMPONENT_SITE);
     $componentParams = JComponentHelper::getParams("com_crowdfunding");
     /** @var  $componentParams Joomla\Registry\Registry */
     // Get payment session.
     $paymentSessionContext = Crowdfunding\Constants::PAYMENT_SESSION_CONTEXT . $item->id;
     $paymentSession = $this->app->getUserState($paymentSessionContext);
     if (!isset($paymentSession->step1)) {
         $path = JPath::clean(JPluginHelper::getLayoutPath('crowdfundingpayment', 'data', 'error'));
         // Render error layout.
         ob_start();
         include $path;
         return ob_get_clean();
     }
     // Get the value of therms and conditions.
     $this->terms = $paymentSession->terms;
     // Check for duplication of session ID.
     $this->prepareSessionId($item);
     // Load the form.
     JForm::addFormPath(CROWDFUNDINGDATA_PATH_COMPONENT_SITE . '/models/forms');
     JForm::addFieldPath(CROWDFUNDINGDATA_PATH_COMPONENT_SITE . '/models/fields');
     $form = JForm::getInstance('com_crowdfundingdata.record', 'record', array('control' => "jform", 'load_data' => false));
     // Prepare default name of a user.
     $user = JFactory::getUser();
     if ($user->get("id")) {
         $form->setValue("name", null, $user->get("name"));
     }
     // Set item id to the form.
     $form->setValue("project_id", null, $item->id);
     $this->form = $form;
     // Load jQuery
     JHtml::_("jquery.framework");
     // Include Chosen
     if ($this->params->get("enable_chosen", 0)) {
         JHtml::_('formbehavior.chosen', '#jform_country_id');
     }
     // Get the path for the layout file
     $path = JPath::clean(JPluginHelper::getLayoutPath('crowdfundingpayment', 'data'));
     // Render the form.
     ob_start();
     include $path;
     $html = ob_get_clean();
     return $html;
 }