Merge pull request #13232 from JO0st/core-574
[civicrm-core.git] / CRM / SMS / Controller / Send.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
5 | |
6 | This work is published under the GNU AGPLv3 license with some |
7 | permitted exceptions and without any warranty. For full license |
8 | and copyright information, see https://civicrm.org/licensing |
9 +--------------------------------------------------------------------+
10 */
11
12 /**
13 *
14 * @package CRM
15 * @copyright CiviCRM LLC https://civicrm.org/licensing
16 */
17 class CRM_SMS_Controller_Send extends CRM_Core_Controller {
18
19 /**
20 * Class constructor.
21 *
22 * @param string $title
23 * @param bool|int $action
24 * @param bool $modal
25 */
26 public function __construct($title = NULL, $action = CRM_Core_Action::NONE, $modal = TRUE) {
27 parent::__construct($title, $modal, NULL, FALSE, TRUE);
28
29 $mailingID = CRM_Utils_Request::retrieve('mid', 'String', $this, FALSE, NULL);
30
31 // also get the text and html file
32 $txtFile = CRM_Utils_Request::retrieve('txtFile', 'String',
33 CRM_Core_DAO::$_nullObject, FALSE, NULL
34 );
35
36 $config = CRM_Core_Config::singleton();
37 if ($txtFile &&
38 file_exists($config->uploadDir . $txtFile)
39 ) {
40 $this->set('textFilePath', $config->uploadDir . $txtFile);
41 }
42
43 $this->_stateMachine = new CRM_SMS_StateMachine_Send($this, $action, $mailingID);
44
45 // create and instantiate the pages
46 $this->addPages($this->_stateMachine, $action);
47
48 // add all the actions
49 $uploadNames = array_merge(['textFile'],
50 CRM_Core_BAO_File::uploadNames()
51 );
52
53 $this->addActions(CRM_Core_Config::singleton()->uploadDir,
54 $uploadNames
55 );
56 }
57
58 }