<?php

/**

* @version		1.1

* @package		DJ Classifieds

* @subpackage	DJ Classifieds Component

* @copyright	Copyright (C) 2010 Blue Constant Media LTD, All rights reserved.

* @license		http://www.gnu.org/licenses GNU/GPL

* @autor url    http://design-joomla.eu

* @autor email  contact@design-joomla.eu

* @Developer    Lukasz Ciastek - lukasz.ciastek@design-joomla.eu

* 

* 

* DJ Classifieds is free software: you can redistribute it and/or modify

* it under the terms of the GNU General Public License as published by

* the Free Software Foundation, either version 3 of the License, or

* (at your option) any later version.

*

* DJ Classifieds is distributed in the hope that it will be useful,

* but WITHOUT ANY WARRANTY; without even the implied warranty of

* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the

* GNU General Public License for more details.

*

* You should have received a copy of the GNU General Public License

* along with DJ Classifieds. If not, see <http://www.gnu.org/licenses/>.

* 

*/

defined('_JEXEC') or die('Restricted access');



$url_ok = JURI::base().'index.php?option=com_djclassifieds&view=paypal&pay=ok';

$url_error = JURI::base().'index.php?option=com_djclassifieds&view=paypal&pay=error';

$url_notify = JURI::base().'index.php?option=com_djclassifieds&view=paypal_notify';

if(strstr($this->item->pay_type, 'cat')){

	$price=$this->price/100;	

}else{

	$price = 0;

}

$t = JRequest::getVar('t', '', '', 'string');

if( $t== 'renew'){

	$title = 'Renew Ad';

}else if($t== 'edit'){

	$title = 'Edit Ad';

}else{

	$title = 'New Ad';

}



?>

<div id="dj-classifieds" class="clearfix">

<div class="dj-additempp clearfix" >

<div class="title_top"><?php echo JText::_($title)?></div>

<form action="https://www.paypal.com/cgi-bin/webscr" method="post" name="paypal">



  <input type="hidden" name="cmd" value="_xclick" />

  <input type="hidden" name="custom" value="<?php echo $this->session_id; ?>" />

  <input type="hidden" name="business" value="<?php echo $this->par->get('paypal_user'); ?>" />

  <input type="hidden" name="currency_code" value="<?php echo $this->par->get('unit_price'); ?>" />

  <input type="hidden" name="item_name" value="<?php echo $this->item->name;?>" />

  <input type="hidden" name="return" value="<?php echo $url_ok; ?>" />

  <input type="hidden" name="notify_url" value="<?php echo $url_notify; ?>" />

  <input type="hidden" name="cancel_return" value="<?php echo $url_error; ?>" />

  <input type="hidden" name="rm" value="2" />



  <table cellspacing="0" cellpadding="0" id="additem_paypal">

	<tr>

       <td width="100" align="left" class="label">

           <?php echo JText::_('Title');?>

       </td>

       <td class="title">

           <?php echo $this->item->name; ?>

       </td>

 	</tr>

	<tr>

       <td width="100" align="left" class="label">

           <?php echo JText::_('Category');?>

       </td>

       <td class="title">

           <?php echo $this->cat_name; ?>

       </td>

 	</tr>

	<tr>

       <td width="100" align="left" class="label">

           <?php echo JText::_('Intro description');?>

       </td>

       <td class="intro_desc">

           <?php echo $this->item->intro_desc; ?>

       </td>

 	</tr>

	<?php

	if(strstr($this->item->pay_type, 'cat')){ 

	?>

	<tr>

       <td width="100" align="left" class="label">

           <?php echo JText::_('Ad price');?>

       </td>

       <td class="price">

           <?php echo $price; ?>&nbsp;<?php echo $this->par->get('unit_price'); ?>

       </td>

 	</tr>

	

	<?php

	}

	if(strstr($this->item->pay_type, 'special')){	 

		$price_prom=$this->par->get('prom_price');

		$price +=$price_prom;

	?>

	<tr>

       <td width="100" align="left" class="label">

           <?php echo JText::_('Promotion first');?>

       </td>

       <td class="price_prom">

           <?php echo $price_prom; ?>&nbsp;<?php echo $this->par->get('unit_price'); ?>

       </td>

 	</tr>

	<?php } ?>

    <tr>

      <td class="label">   

        <?php echo JText::_('Total price');?>

      </td>

      <td class="price_total">

		<?php echo $price; ?>&nbsp;<?php echo $this->par->get('unit_price'); ?>

        <input type="hidden" id="price" name="amount" value="<?php echo $price; ?>" class="inputbox" />  

      </td>

    </tr>

    <tr>

      <td align="left">

        <?php 

		echo '<a class="button2" id="cancel_b" href="index.php?option=com_djclassifieds&view=useritems">'.JText::_("Cancel Ad").'</a>'; ?>

      </td>

      <td align="right">

        <input type="submit" id="submit_b" name="submit_send" value="<?php echo JText::_('Pay with PayPal'); ?>" class="button2" />

      </td>

    </tr>

	<tr>

		<td colspan="2" class="remember_back"> 

        	<?php echo JText::_('REMEMBER_TO_BACK');?>

		</td>

	</tr>

  </table>

  </form>

</div>

</div>