Exemplo n.º 1
1
 /**
  * Class constructor.
  *
  * @param null $title
  * @param bool|int $action
  * @param bool $modal
  *
  * @throws \Exception
  */
 public function __construct($title = NULL, $action = CRM_Core_Action::NONE, $modal = TRUE)
 {
     parent::__construct($title, $modal, NULL, FALSE, TRUE);
     // New:            civicrm/mailing/send?reset=1
     // Re-use:         civicrm/mailing/send?reset=1&mid=%%mid%%
     // Continue:       civicrm/mailing/send?reset=1&mid=%%mid%%&continue=true
     $mid = CRM_Utils_Request::retrieve('mid', 'Positive');
     $continue = CRM_Utils_Request::retrieve('continue', 'String');
     if (!$mid) {
         CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/a/', NULL, TRUE, '/mailing/new'));
     }
     if ($mid && $continue) {
         //CRM-15979 - check if abtest exist for mailing then redirect accordingly
         $abtest = CRM_Mailing_BAO_MailingAB::getABTest($mid);
         if (!empty($abtest) && !empty($abtest->id)) {
             $redirect = CRM_Utils_System::url('civicrm/a/', NULL, TRUE, '/abtest/' . $abtest->id);
         } else {
             $redirect = CRM_Utils_System::url('civicrm/a/', NULL, TRUE, '/mailing/' . $mid);
         }
         CRM_Utils_System::redirect($redirect);
     }
     if ($mid && !$continue) {
         $clone = civicrm_api3('Mailing', 'clone', array('id' => $mid));
         CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/a/', NULL, TRUE, '/mailing/' . $clone['id']));
     }
 }
Exemplo n.º 2
0
 /**
  * Constructor.
  *
  * @param null $path
  *   The class Path of the form being implemented
  * @param bool $title
  * @param string $mode
  * @param bool $imageUpload
  * @param bool $addSequence
  *   Should we add a unique sequence number to the end of the key.
  * @param bool $ignoreKey
  *   Should we not set a qfKey for this controller (for standalone forms).
  * @param bool $attachUpload
  *
  * @return \CRM_Core_Controller_Simple
  */
 public function __construct($path, $title, $mode = NULL, $imageUpload = FALSE, $addSequence = FALSE, $ignoreKey = FALSE, $attachUpload = FALSE)
 {
     // by definition a single page is modal :). We use the form name as the scope for this controller
     parent::__construct($title, TRUE, $mode, $path, $addSequence, $ignoreKey);
     $this->_stateMachine = new CRM_Core_StateMachine($this);
     $params = array($path => NULL);
     $savedAction = CRM_Utils_Request::retrieve('action', 'String', $this, FALSE, NULL);
     if (!empty($savedAction) && $savedAction != $mode) {
         $mode = $savedAction;
     }
     $this->_stateMachine->addSequentialPages($params, $mode);
     $this->addPages($this->_stateMachine, $mode);
     //changes for custom data type File
     $uploadNames = $this->get('uploadNames');
     $config = CRM_Core_Config::singleton();
     if (is_array($uploadNames) && !empty($uploadNames)) {
         $uploadArray = $uploadNames;
         $this->addActions($config->customFileUploadDir, $uploadArray);
         $this->set('uploadNames', NULL);
     } else {
         // always allow a single upload file with same name
         if ($attachUpload) {
             $this->addActions($config->uploadDir, CRM_Core_BAO_File::uploadNames());
         } elseif ($imageUpload) {
             $this->addActions($config->imageUploadDir, array('uploadFile'));
         } else {
             $this->addActions();
         }
     }
 }
Exemplo n.º 3
0
 /**
  * constructor
  *
  * @param string  path        the class Path of the form being implemented
  * @param string  title       the descriptive name for the page
  * @param int     mode        the mode that the form will operate on
  * @param boolean addSequence should we add a unique sequence number to the end of the key
  * @param boolean ignoreKey    should we not set a qfKey for this controller (for standalone forms)
  *
  * @return object
  * @access public
  */
 function __construct($path, $title, $mode = null, $imageUpload = false, $addSequence = false, $ignoreKey = false, $attachUpload = false)
 {
     // by definition a single page is modal :). We use the form name as the scope for this controller
     parent::__construct($title, true, $mode, $path, $addSequence, $ignoreKey);
     $this->_stateMachine =& new CRM_Core_StateMachine($this);
     $params = array($path => null);
     $this->_stateMachine->addSequentialPages($params, $mode);
     $this->addPages($this->_stateMachine, $mode);
     //changes for custom data type File
     $uploadNames = $this->get('uploadNames');
     $config =& CRM_Core_Config::singleton();
     if (is_array($uploadNames) && !empty($uploadNames)) {
         $uploadArray = $uploadNames;
         $this->addActions($config->customFileUploadDir, $uploadArray);
         $this->set('uploadNames', null);
     } else {
         // always allow a single upload file with same name
         if ($attachUpload) {
             require_once 'CRM/Core/BAO/File.php';
             $this->addActions($config->uploadDir, CRM_Core_BAO_File::uploadNames());
         } else {
             if ($imageUpload) {
                 $this->addActions($config->imageUploadDir, array('uploadFile'));
             } else {
                 $this->addActions();
             }
         }
     }
 }
Exemplo n.º 4
0
 /**
  * Class constructor.
  *
  * @param string $title
  * @param bool|int $action
  * @param bool $modal
  */
 public function __construct($title = NULL, $action = CRM_Core_Action::NONE, $modal = TRUE)
 {
     parent::__construct($title, $modal);
     $this->_stateMachine = new CRM_Contribute_StateMachine_ContributionPage($this, $action);
     // Create and instantiate the pages.
     $this->addPages($this->_stateMachine, $action);
     $this->addActions();
 }
Exemplo n.º 5
0
 /**
  * Class constructor.
  *
  * @param string $title
  * @param bool $modal
  * @param int|mixed|null $action
  */
 public function __construct($title = NULL, $modal = TRUE, $action = CRM_Core_Action::NONE)
 {
     parent::__construct($title, $modal);
     $this->_stateMachine = new CRM_Contact_StateMachine_Search($this, $action);
     // create and instantiate the pages
     $this->addPages($this->_stateMachine, $action);
     // add all the actions
     $this->addActions();
 }
 /**
  * class constructor
  */
 function __construct($title = NULL, $action = CRM_Core_Action::NONE, $modal = TRUE)
 {
     parent::__construct($title, $modal);
     $this->_stateMachine = new CRM_Activity_Import_StateMachine($this, $action);
     // create and instantiate the pages
     $this->addPages($this->_stateMachine, $action);
     // add all the actions
     $config = CRM_Core_Config::singleton();
     $this->addActions($config->uploadDir, array('uploadFile'));
 }
Exemplo n.º 7
0
 /**
  * class constructor
  */
 function __construct($title = NULL, $action = CRM_Core_Action::NONE, $modal = TRUE)
 {
     parent::__construct($title, $modal);
     $this->_stateMachine = new CRM_Member_StateMachine_Search($this, $action);
     // create and instantiate the pages
     $this->addPages($this->_stateMachine, $action);
     // add all the actions
     $config = CRM_Core_Config::singleton();
     $this->addActions();
 }
Exemplo n.º 8
0
 /**
  * class constructor
  */
 function CRM_Contribute_Controller_Contribution($title = null, $action = CRM_CORE_ACTION_NONE, $modal = true)
 {
     require_once 'CRM/Contribute/StateMachine/Contribution.php';
     parent::CRM_Core_Controller($title, $modal);
     $this->_stateMachine =& new CRM_Contribute_StateMachine_Contribution($this, $action);
     // create and instantiate the pages
     $this->addPages($this->_stateMachine, $action);
     // add all the actions
     $this->addActions();
 }
Exemplo n.º 9
0
 /**
  * class constructor
  */
 function __construct($title = null, $modal = true, $action = CRM_Core_Action::NONE)
 {
     require_once 'CRM/Contact/StateMachine/Search.php';
     parent::__construct($title, $modal);
     $this->_stateMachine =& new CRM_Contact_StateMachine_Search($this, $action);
     // create and instantiate the pages
     $this->addPages($this->_stateMachine, $action);
     // add all the actions
     $this->addActions();
 }
Exemplo n.º 10
0
 /**
  * class constructor
  */
 function __construct($title = null, $action = CRM_Core_Action::NONE, $modal = true)
 {
     require_once 'CRM/Campaign/StateMachine/Search.php';
     parent::__construct($title, $modal);
     $this->_stateMachine = new CRM_Campaign_StateMachine_Search($this, $action);
     // create and instantiate the pages
     $this->addPages($this->_stateMachine, $action);
     // add all the actions
     $config = CRM_Core_Config::singleton();
     $this->addActions();
 }
Exemplo n.º 11
0
 /**
  * class constructor
  */
 function CRM_Contact_Controller_Search($title = null, $action = CRM_CORE_ACTION_NONE, $modal = true)
 {
     require_once 'CRM/Contact/StateMachine/Search.php';
     parent::CRM_Core_Controller($title, $modal);
     $this->_stateMachine =& new CRM_Contact_StateMachine_Search($this, $action);
     // create and instantiate the pages
     $this->addPages($this->_stateMachine, $action);
     // add all the actions
     $config =& CRM_Core_Config::singleton();
     $this->addActions();
 }
Exemplo n.º 12
0
 /**
  * class constructor
  */
 function CRM_Import_Controller($title = null, $action = CRM_CORE_ACTION_NONE, $modal = true)
 {
     parent::CRM_Core_Controller($title, $modal);
     require_once 'CRM/Import/StateMachine.php';
     $this->_stateMachine =& new CRM_Import_StateMachine($this, $action);
     // create and instantiate the pages
     $this->addPages($this->_stateMachine, $action);
     // add all the actions
     $config =& CRM_Core_Config::singleton();
     $this->addActions($config->uploadDir, array('uploadFile'));
 }
Exemplo n.º 13
0
 /**
  * class constructor
  */
 function __construct($title = null, $action = CRM_Core_Action::NONE, $modal = true)
 {
     parent::__construct($title, $modal);
     require_once 'CRM/Upgrade/StateMachine.php';
     $this->_stateMachine = new CRM_Upgrade_StateMachine($this, $this->getPages(), $action);
     // create and instantiate the pages
     $this->addPages($this->_stateMachine, $action);
     // add all the actions
     $config = CRM_Core_Config::singleton();
     $this->addActions();
 }
Exemplo n.º 14
0
 /**
  * class constructor
  */
 function CRM_Mailing_Controller_Send($title = null, $action = CRM_CORE_ACTION_NONE, $modal = true)
 {
     require_once 'CRM/Mailing/StateMachine/Send.php';
     parent::CRM_Core_Controller($title, $modal);
     $this->_stateMachine =& new CRM_Mailing_StateMachine_Send($this, $action);
     // create and instantiate the pages
     $this->addPages($this->_stateMachine, $action);
     // add all the actions
     $config =& CRM_Core_Config::singleton();
     $this->addActions($config->uploadDir, array('textFile', 'htmlFile'));
 }
Exemplo n.º 15
0
 /**
  * Class constructor.
  *
  * @param string $title
  * @param bool|int $action
  * @param bool $modal
  */
 public function __construct($title = NULL, $action = CRM_Core_Action::NONE, $modal = TRUE)
 {
     parent::__construct($title, $modal);
     // lets get around the time limit issue if possible, CRM-2113
     if (!ini_get('safe_mode')) {
         set_time_limit(0);
     }
     $this->_stateMachine = new CRM_Import_StateMachine($this, $action);
     // create and instantiate the pages
     $this->addPages($this->_stateMachine, $action);
     // add all the actions
     $config = CRM_Core_Config::singleton();
     $this->addActions($config->uploadDir, array('uploadFile'));
 }
Exemplo n.º 16
0
Arquivo: PCP.php Projeto: kidaa30/yes
 /**
  * Class constructor.
  *
  * @param string $title
  * @param bool|int $action
  * @param bool $modal
  */
 public function __construct($title = NULL, $action = CRM_Core_Action::NONE, $modal = TRUE)
 {
     parent::__construct($title, $modal);
     $this->_stateMachine = new CRM_PCP_StateMachine_PCP($this, $action);
     // create and instantiate the pages
     $this->addPages($this->_stateMachine, $action);
     // add all the actions
     $uploadNames = $this->get('uploadNames');
     if (!empty($uploadNames)) {
         $config = CRM_Core_Config::singleton();
         $this->addActions($config->customFileUploadDir, $uploadNames);
     } else {
         $this->addActions();
     }
 }
Exemplo n.º 17
0
 /**
  * @param null $title
  * @param bool|int $action
  * @param bool $modal
  */
 public function __construct($title = NULL, $action = CRM_Core_Action::NONE, $modal = TRUE)
 {
     parent::__construct($title, $modal);
     $this->_stateMachine = new CRM_Event_Cart_StateMachine_Checkout($this, $action);
     $this->addPages($this->_stateMachine, $action);
     $config = CRM_Core_Config::singleton();
     //changes for custom data type File
     $uploadNames = $this->get('uploadNames');
     if (is_array($uploadNames) && !empty($uploadNames)) {
         $this->addActions($config->customFileUploadDir, $uploadNames);
     } else {
         // add all the actions
         $this->addActions();
     }
 }
Exemplo n.º 18
0
 /**
  * class constructor
  */
 function __construct($title = null, $action = CRM_Core_Action::NONE, $modal = true)
 {
     parent::__construct($title, $modal);
     // lets get around the time limit issue if possible, CRM-2113
     if (!ini_get('safe_mode')) {
         set_time_limit(0);
     }
     require_once 'CRM/Member/Import/StateMachine.php';
     $this->_stateMachine =& new CRM_Member_Import_StateMachine($this, $action);
     // create and instantiate the pages
     $this->addPages($this->_stateMachine, $action);
     // add all the actions
     $config =& CRM_Core_Config::singleton();
     $this->addActions($config->uploadDir, array('uploadFile'));
 }
 /**
  * class constructor
  */
 function __construct($title = null, $action = CRM_Core_Action::NONE, $modal = true)
 {
     parent::__construct($title, $modal, null, false, true);
     $this->_stateMachine = new CRM_Core_StateMachine($this, $action);
     //matusz: TODO how to add extra step for justgiving?
     $source = $this->get('sourceName');
     if ($source == 'JustGiving') {
         $p = array('CRM_Finance_Form_Import_SourceType' => null, 'CRM_Finance_Form_Import_JustGiving_SourceUpload' => null, 'CRM_Finance_Form_Import_Validate' => null, 'CRM_Finance_Form_Import_ExtraData' => null);
     } else {
         $p = array('CRM_Finance_Form_Import_SourceType' => null, 'CRM_Finance_Form_Import_SourceUpload' => null, 'CRM_Finance_Form_Import_Validate' => null, 'CRM_Finance_Form_Import_ExtraData' => null);
     }
     $this->_stateMachine->addSequentialPages($p, $action);
     // create and instantiate the pages
     $this->addPages($this->_stateMachine, $action);
     $this->addActions();
 }
Exemplo n.º 20
0
 /**
  * class constructor
  */
 function __construct($title = null, $action = CRM_Core_Action::NONE, $modal = true)
 {
     parent::__construct($title, $modal);
     require_once 'CRM/Contribute/StateMachine/Contribution.php';
     $this->_stateMachine =& new CRM_Contribute_StateMachine_Contribution($this, $action);
     // create and instantiate the pages
     $this->addPages($this->_stateMachine, $action);
     // add all the actions
     $uploadNames = $this->get('uploadNames');
     if (!empty($uploadNames)) {
         $config =& CRM_Core_Config::singleton();
         $this->addActions($config->customFileUploadDir, $uploadNames);
     } else {
         $this->addActions();
     }
 }
Exemplo n.º 21
0
 /**
  * constructor
  *
  * @param string path   the class Path of the form being implemented
  * @param string title  the descriptive name for the page
  * @param int    mode   the mode that the form will operate on
  *
  * @return object
  * @access public
  */
 function CRM_Core_Controller_Simple($path, $title, $mode, $imageUpload = false)
 {
     // by definition a single page is modal :). We use the form name as the scope for this controller
     parent::CRM_Core_Controller($title, true, $path);
     $this->_stateMachine =& new CRM_Core_StateMachine($this);
     $params = array($path);
     $this->_stateMachine->addSequentialPages($params, $mode);
     $this->addPages($this->_stateMachine, $mode);
     // always allow a single upload file with same name
     $config =& CRM_Core_Config::singleton();
     if ($imageUpload) {
         $this->addActions($config->imageUploadDir, array('uploadFile'));
     } else {
         $this->addActions($config->uploadDir, array('uploadFile'));
     }
 }
Exemplo n.º 22
0
 /**
  * class constructor
  */
 function __construct($title = NULL, $action = CRM_Core_Action::NONE, $modal = TRUE)
 {
     parent::__construct($title, $modal, NULL, FALSE, TRUE);
     $bookingID = CRM_Utils_Request::retrieve('id', 'Positive', $this, FALSE, 0);
     //if booking id exist assume so we entering edit mode
     if ($bookingID) {
         $action = CRM_Core_Action::UPDATE;
     } else {
         //force action to add
         $action = CRM_Core_Action::ADD;
     }
     $this->_stateMachine = new CRM_Booking_StateMachine_Booking($this, $action);
     // create and instantiate the pages
     $this->addPages($this->_stateMachine, $action);
     // add all the actions
     $this->addActions();
 }
Exemplo n.º 23
0
Arquivo: Send.php Projeto: kidaa30/yes
 /**
  * Class constructor.
  *
  * @param string $title
  * @param bool|int $action
  * @param bool $modal
  */
 public function __construct($title = NULL, $action = CRM_Core_Action::NONE, $modal = TRUE)
 {
     parent::__construct($title, $modal, NULL, FALSE, TRUE);
     $mailingID = CRM_Utils_Request::retrieve('mid', 'String', $this, FALSE, NULL);
     // also get the text and html file
     $txtFile = CRM_Utils_Request::retrieve('txtFile', 'String', CRM_Core_DAO::$_nullObject, FALSE, NULL);
     $config = CRM_Core_Config::singleton();
     if ($txtFile && file_exists($config->uploadDir . $txtFile)) {
         $this->set('textFilePath', $config->uploadDir . $txtFile);
     }
     $this->_stateMachine = new CRM_SMS_StateMachine_Send($this, $action, $mailingID);
     // create and instantiate the pages
     $this->addPages($this->_stateMachine, $action);
     // add all the actions
     $uploadNames = array_merge(array('textFile'), CRM_Core_BAO_File::uploadNames());
     $this->addActions(CRM_Core_Config::singleton()->uploadDir, $uploadNames);
 }
Exemplo n.º 24
0
Arquivo: Send.php Projeto: kidaa30/yes
 /**
  * Class constructor.
  *
  * @param null $title
  * @param bool|int $action
  * @param bool $modal
  *
  * @throws \Exception
  */
 public function __construct($title = NULL, $action = CRM_Core_Action::NONE, $modal = TRUE)
 {
     parent::__construct($title, $modal, NULL, FALSE, TRUE);
     if (!defined('CIVICRM_CIVIMAIL_UI_LEGACY')) {
         // New:            civicrm/mailing/send?reset=1
         // Re-use:         civicrm/mailing/send?reset=1&mid=%%mid%%
         // Continue:       civicrm/mailing/send?reset=1&mid=%%mid%%&continue=true
         $mid = CRM_Utils_Request::retrieve('mid', 'Positive');
         $continue = CRM_Utils_Request::retrieve('continue', 'String');
         if (!$mid) {
             CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/a/', NULL, TRUE, '/mailing/new'));
         }
         if ($mid && $continue) {
             //CRM-15979 - check if abtest exist for mailing then redirect accordingly
             $abtest = CRM_Mailing_BAO_MailingAB::getABTest($mid);
             if (!empty($abtest) && !empty($abtest->id)) {
                 $redirect = CRM_Utils_System::url('civicrm/a/', NULL, TRUE, '/abtest/' . $abtest->id);
             } else {
                 $redirect = CRM_Utils_System::url('civicrm/a/', NULL, TRUE, '/mailing/' . $mid);
             }
             CRM_Utils_System::redirect($redirect);
         }
         if ($mid && !$continue) {
             $clone = civicrm_api3('Mailing', 'clone', array('id' => $mid));
             CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/a/', NULL, TRUE, '/mailing/' . $clone['id']));
         }
     }
     $mailingID = CRM_Utils_Request::retrieve('mid', 'String', $this, FALSE, NULL);
     // also get the text and html file
     $txtFile = CRM_Utils_Request::retrieve('txtFile', 'String', CRM_Core_DAO::$_nullObject, FALSE, NULL);
     $htmlFile = CRM_Utils_Request::retrieve('htmlFile', 'String', CRM_Core_DAO::$_nullObject, FALSE, NULL);
     $config = CRM_Core_Config::singleton();
     if ($txtFile && file_exists($config->uploadDir . $txtFile)) {
         $this->set('textFilePath', $config->uploadDir . $txtFile);
     }
     if ($htmlFile && file_exists($config->uploadDir . $htmlFile)) {
         $this->set('htmlFilePath', $config->uploadDir . $htmlFile);
     }
     $this->_stateMachine = new CRM_Mailing_StateMachine_Send($this, $action, $mailingID);
     // create and instantiate the pages
     $this->addPages($this->_stateMachine, $action);
     // add all the actions
     $uploadNames = array_merge(array('textFile', 'htmlFile'), CRM_Core_BAO_File::uploadNames());
     $config = CRM_Core_Config::singleton();
     $this->addActions($config->uploadDir, $uploadNames);
 }
Exemplo n.º 25
0
 /**
  * class constructor
  */
 function __construct($title = null, $action = CRM_Core_Action::NONE, $modal = true)
 {
     parent::__construct($title, $modal);
     require_once 'CRM/Event/StateMachine/Registration.php';
     $this->_stateMachine =& new CRM_Event_StateMachine_Registration($this, $action);
     // create and instantiate the pages
     $this->addPages($this->_stateMachine, $action);
     $config =& CRM_Core_Config::singleton();
     //changes for custom data type File
     $uploadNames = $this->get('uploadNames');
     if (is_array($uploadNames) && !empty($uploadNames)) {
         $this->addActions($config->customFileUploadDir, $uploadNames);
     } else {
         // add all the actions
         $this->addActions();
     }
 }
Exemplo n.º 26
0
 /**
  * class constructor
  */
 function __construct($title = NULL, $action = CRM_Core_Action::NONE, $modal = TRUE)
 {
     parent::__construct($title, $modal);
     $this->_stateMachine = new CRM_Event_StateMachine_Search($this, $action);
     // create and instantiate the pages
     $this->addPages($this->_stateMachine, $action);
     $session = CRM_Core_Session::singleton();
     $uploadNames = $session->get('uploadNames');
     if (!empty($uploadNames)) {
         $uploadNames = array_merge($uploadNames, CRM_Core_BAO_File::uploadNames());
     } else {
         $uploadNames = CRM_Core_BAO_File::uploadNames();
     }
     $config = CRM_Core_Config::singleton();
     $uploadDir = $config->uploadDir;
     // add all the actions
     $this->addActions($uploadDir, $uploadNames);
 }
Exemplo n.º 27
0
 /**
  * class constructor
  */
 function __construct($title = null, $action = CRM_Core_Action::NONE, $modal = true)
 {
     require_once 'CRM/Event/StateMachine/Search.php';
     parent::__construct($title, $modal);
     $this->_stateMachine =& new CRM_Event_StateMachine_Search($this, $action);
     // create and instantiate the pages
     $this->addPages($this->_stateMachine, $action);
     require_once 'CRM/Core/BAO/File.php';
     $session =& CRM_Core_Session::singleton();
     $uploadNames = $session->get('uploadNames');
     if (!empty($uploadNames)) {
         $uploadNames = array_merge($uploadNames, CRM_Core_BAO_File::uploadNames());
     } else {
         $uploadNames = CRM_Core_BAO_File::uploadNames();
     }
     $config =& CRM_Core_Config::singleton();
     $uploadDir = $config->uploadDir;
     // add all the actions
     $this->addActions($uploadDir, $uploadNames);
 }
Exemplo n.º 28
0
 /**
  * class constructor
  */
 function __construct($title = null, $action = CRM_Core_Action::NONE, $modal = true)
 {
     require_once 'CRM/Mailing/StateMachine/Send.php';
     parent::__construct($title, $modal, null, false, true);
     $mailingID = CRM_Utils_Request::retrieve('mid', 'String', $this, false, null);
     // also get the text and html file
     $txtFile = CRM_Utils_Request::retrieve('txtFile', 'String', CRM_Core_DAO::$_nullObject, false, null);
     $htmlFile = CRM_Utils_Request::retrieve('htmlFile', 'String', CRM_Core_DAO::$_nullObject, false, null);
     $config =& CRM_Core_Config::singleton();
     if ($txtFile && file_exists($config->uploadDir . $txtFile)) {
         $this->set('textFilePath', $config->uploadDir . $txtFile);
     }
     if ($htmlFile && file_exists($config->uploadDir . $htmlFile)) {
         $this->set('htmlFilePath', $config->uploadDir . $htmlFile);
     }
     $this->_stateMachine =& new CRM_Mailing_StateMachine_Send($this, $action, $mailingID);
     // create and instantiate the pages
     $this->addPages($this->_stateMachine, $action);
     // add all the actions
     require_once 'CRM/Core/BAO/File.php';
     $uploadNames = array_merge(array('textFile', 'htmlFile'), CRM_Core_BAO_File::uploadNames());
     $config =& CRM_Core_Config::singleton();
     $this->addActions($config->uploadDir, $uploadNames);
 }
Exemplo n.º 29
0
 /**
  * @param $elementName
  */
 public function addUploadElement($elementName)
 {
     $uploadNames = $this->get('uploadNames');
     if (!$uploadNames) {
         $uploadNames = array();
     }
     if (is_array($elementName)) {
         foreach ($elementName as $name) {
             if (!in_array($name, $uploadNames)) {
                 $uploadNames[] = $name;
             }
         }
     } else {
         if (!in_array($elementName, $uploadNames)) {
             $uploadNames[] = $elementName;
         }
     }
     $this->set('uploadNames', $uploadNames);
     $config = CRM_Core_Config::singleton();
     if (!empty($uploadNames)) {
         $this->controller->addUploadAction($config->customFileUploadDir, $uploadNames);
     }
 }
Exemplo n.º 30
0
 /**
  * All CRM single or multi page pages should inherit from this class.
  *
  * @param string  title        descriptive title of the controller
  * @param boolean whether      controller is modal
  * @param string  scope        name of session if we want unique scope, used only by Controller_Simple
  * @param boolean addSequence  should we add a unique sequence number to the end of the key
  * @param boolean ignoreKey    should we not set a qfKey for this controller (for standalone forms)
  *
  * @access public
  *
  * @return void
  *
  */
 function __construct($title = NULL, $modal = TRUE, $mode = NULL, $scope = NULL, $addSequence = FALSE, $ignoreKey = FALSE)
 {
     // this has to true for multiple tab session fix
     $addSequence = TRUE;
     // let the constructor initialize this, should happen only once
     if (!isset(self::$_template)) {
         self::$_template = CRM_Core_Smarty::singleton();
         self::$_session = CRM_Core_Session::singleton();
     }
     // lets try to get it from the session and/or the request vars
     // we do this early on in case there is a fatal error in retrieving the
     // key and/or session
     $this->_entryURL = CRM_Utils_Request::retrieve('entryURL', 'String', $this);
     // add a unique validable key to the name
     $name = CRM_Utils_System::getClassName($this);
     if ($name == 'CRM_Core_Controller_Simple' && !empty($scope)) {
         // use form name if we have, since its a lot better and
         // definitely different for different forms
         $name = $scope;
     }
     $name = $name . '_' . $this->key($name, $addSequence, $ignoreKey);
     $this->_title = $title;
     if ($scope) {
         $this->_scope = $scope;
     } else {
         $this->_scope = CRM_Utils_System::getClassName($this);
     }
     $this->_scope = $this->_scope . '_' . $this->_key;
     // only use the civicrm cache if we have a valid key
     // else we clash with other users CRM-7059
     if (!empty($this->_key)) {
         CRM_Core_Session::registerAndRetrieveSessionObjects(array("_{$name}_container", array('CiviCRM', $this->_scope)));
     }
     $this->HTML_QuickForm_Controller($name, $modal);
     $snippet = CRM_Utils_Array::value('snippet', $_REQUEST);
     if ($snippet) {
         if ($snippet == 3) {
             $this->_print = CRM_Core_Smarty::PRINT_PDF;
         } elseif ($snippet == 4) {
             // this is used to embed fragments of a form
             $this->_print = CRM_Core_Smarty::PRINT_NOFORM;
             self::$_template->assign('suppressForm', TRUE);
             $this->_generateQFKey = FALSE;
         } elseif ($snippet == 5) {
             // this is used for popups and inlined ajax forms
             // also used for the various tabs via TabHeader
             $this->_print = CRM_Core_Smarty::PRINT_NOFORM;
         } elseif ($snippet == 6) {
             $this->_print = CRM_Core_Smarty::PRINT_NOFORM;
             $this->_QFResponseType = 'json';
         } else {
             $this->_print = CRM_Core_Smarty::PRINT_SNIPPET;
         }
     }
     // if the request has a reset value, initialize the controller session
     if (CRM_Utils_Array::value('reset', $_GET)) {
         $this->reset();
         // in this case we'll also cache the url as a hidden form variable, this allows us to
         // redirect in case the session has disappeared on us
         $this->_entryURL = CRM_Utils_System::makeURL(NULL, TRUE, FALSE, NULL, TRUE);
         $this->set('entryURL', $this->_entryURL);
     }
     // set the key in the session
     // do this at the end so we have initialized the object
     // and created the scope etc
     $this->set('qfKey', $this->_key);
     // also retrieve and store destination in session
     $this->_destination = CRM_Utils_Request::retrieve('civicrmDestination', 'String', $this, FALSE, NULL, $_REQUEST);
 }