PageRenderTime 46ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

/pdf/code/trunk/administrator/components/com_artofpdf/controllers/pdfs.php

https://bitbucket.org/eddieajau/the-art-of-joomla-archive
PHP | 69 lines | 29 code | 7 blank | 33 comment | 1 complexity | 1075e6f28b3bead4992c89ac8735274c MD5 | raw file
  1. <?php
  2. /**
  3. * @version $Id: pdfs.php 278 2010-09-14 11:11:09Z eddieajau $
  4. * @package NewLifeInIT
  5. * @subpackage com_artofpdf
  6. * @copyright Copyright 2010 New Life in IT Pty Ltd. All rights reserved.
  7. * @license GNU General Public License version 2 or later.
  8. * @link http://www.theartofjoomla.com
  9. */
  10. // No direct access
  11. defined('_JEXEC') or die;
  12. juimport('joomla.application.component.controlleradmin');
  13. /**
  14. * ArtofPdf display helper.
  15. *
  16. * @package NewLifeInIT
  17. * @subpackage com_artofpdf
  18. * @since 1.0
  19. */
  20. class ArtofPdfControllerPdfs extends JControllerAdmin
  21. {
  22. /**
  23. * Method to copy an existing PDF.
  24. *
  25. * @return void
  26. * @since 1.0
  27. */
  28. public function duplicate()
  29. {
  30. // Check for request forgeries
  31. JRequest::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
  32. // Initialise variables.
  33. $pks = JRequest::getVar('cid', array(), 'post', 'array');
  34. try
  35. {
  36. if (empty($pks)) {
  37. throw new Exception(JText::_('COM_ARTOFPDF_NO_PDF_SELECTED'));
  38. }
  39. $model = $this->getModel();
  40. $model->duplicate($pks);
  41. $this->setMessage(JText::_('COM_ARTOFPDF_SUCCESS_DUPLICATED'));
  42. }
  43. catch (Exception $e)
  44. {
  45. JError::raiseWarning(500, $e->getMessage());
  46. }
  47. $this->setRedirect('index.php?option=com_artofpdf&view=pdfs');
  48. }
  49. /**
  50. * Proxy to get the model for this controller.
  51. *
  52. * @param string $name The model name. Optional.
  53. * @param string $prefix The class prefix. Optional.
  54. *
  55. * @return object The model.
  56. * @since 1.0
  57. */
  58. public function getModel($name = 'Pdf', $prefix = 'ArtofPdfModel')
  59. {
  60. return parent::getModel($name, $prefix, array('ignore_request' => true));
  61. }
  62. }