Example #1
0
 public function send()
 {
     // Check for request forgeries.
     JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
     $redirectOptions = array("view" => "discover");
     $params = JComponentHelper::getParams("com_crowdfunding");
     /** @var  $params Joomla\Registry\Registry */
     if (!$params->get("security_display_friend_form", 0)) {
         $this->displayNotice(JText::_('COM_CROWDFUNDING_ERROR_CANT_SEND_MAIL'), $redirectOptions);
         return;
     }
     // Get the data from the form POST
     $data = $this->input->post->get('jform', array(), 'array');
     $itemId = JArrayHelper::getValue($data, "id", 0, "uint");
     // Get project
     jimport("crowdfunding.project");
     $item = CrowdFundingProject::getInstance(JFactory::getDbo(), $itemId);
     // Prepare redirect link
     $link = CrowdFundingHelperRoute::getEmbedRoute($item->getSlug(), $item->getCatSlug(), "email");
     $redirectOptions = array("force_direction" => $link);
     $model = $this->getModel();
     /** @var $model CrowdFundingModelFriendMail */
     $form = $model->getForm($data, false);
     /** @var $form JForm */
     if (!$form) {
         throw new Exception(JText::_("COM_CROWDFUNDING_ERROR_FORM_CANNOT_BE_LOADED"));
     }
     // Test if the data is valid.
     $validData = $model->validate($form, $data);
     // Check for validation errors.
     if ($validData === false) {
         $this->displayNotice($form->getErrors(), $redirectOptions);
         return;
     }
     try {
         $model->send($validData);
     } catch (Exception $e) {
         JLog::add($e->getMessage());
         throw new Exception(JText::_('COM_CROWDFUNDING_ERROR_SYSTEM'));
     }
     // Redirect to next page
     $this->displayMessage(JText::_("COM_CROWDFUNDING_FRIEND_MAIL_SUCCESSFULLY_SEND"), $redirectOptions);
 }
 /**
  * @param string $slug
  * @param string $catslug
  * @param Joomla\Registry\Registry $params
  * @param string $url
  *
  * @return string
  */
 private function getEmbeded($slug, $catslug, $params, $url)
 {
     $html = "";
     if (!$params->get("display_embed_link", 1) and !$params->get("display_embed_button", 1) and !$params->get("display_embed_email", 1)) {
         return $html;
     }
     $html = '<div class="clearfix"></div>';
     $html .= '<div class="crowdf-embeded">';
     if ($params->get("display_embed_link", 1)) {
         $html .= '<input type="text" name="share_url" value="' . html_entity_decode($url, ENT_COMPAT, 'UTF-8') . '" class="crowdf-embeded-input" />';
     }
     if ($params->get("display_embed_button", 1)) {
         $link = JRoute::_(CrowdFundingHelperRoute::getEmbedRoute($slug, $catslug), false);
         $html .= '<a href="' . $link . '" class="btn"><i class="icon-th-large"></i> ' . JText::_("PLG_CONTENT_CROWDFUNDINGSHARE_EMBED") . '</a>';
     }
     if ($params->get("display_embed_email", 1)) {
         $link = JRoute::_(CrowdFundingHelperRoute::getEmbedRoute($slug, $catslug, "email"), false);
         $html .= '<a class="btn" href="' . $link . '"><i class="icon-envelope"></i> ' . JText::_("PLG_CONTENT_CROWDFUNDINGSHARE_EMAIL") . '</a>';
     }
     $html .= '</div>';
     return $html;
 }
Example #3
0
echo $this->params->get("pageclass_sfx");
?>
">
	
	<div class="row-fluid">
    	<div class="span11">
    	    <h2><?php 
echo JText::_("COM_CROWDFUNDING_SEND_TO_FRIEND");
?>
</h2>
            <p><?php 
echo JText::_("COM_CROWDFUNDING_SEND_TO_FRIEND_HELP");
?>
</p>
            <form method="post" action="<?php 
echo JRoute::_(CrowdFundingHelperRoute::getEmbedRoute($this->item->slug, $this->item->catslug) . "&task=friendmail.send");
?>
" class="bs-docs-example cfbf" id="form-send-to-friend" autocomplete="off">
            		
            		<?php 
echo $this->form->getLabel('subject');
?>
                    <?php 
echo $this->form->getInput('subject');
?>
                    
            		<?php 
echo $this->form->getLabel('sender_name');
?>
                    <?php 
echo $this->form->getInput('sender_name');
Example #4
0
 /**
  * Generate HTML code for embeding.
  *
  * @param object $item
  * @param string $host
  *
  * @return string
  *
  * @todo check this method
  */
 protected function prepareEmbedCode($item, $host)
 {
     // Generate embed link
     $this->embedLink = $host . JRoute::_(CrowdFundingHelperRoute::getEmbedRoute($this->item->slug, $this->item->catslug) . "&layout=widget&tmpl=component", false);
     $code = '<iframe src="' . $this->embedLink . '" width="280px" height="560px" frameborder="0" scrolling="no"></iframe>';
     return $code;
 }