Exemple #1
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();
         }
     }
 }
Exemple #2
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();
             }
         }
     }
 }
Exemple #3
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, 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);
 }
Exemple #4
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);
 }
Exemple #5
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);
 }
Exemple #6
0
 /**
  * Class constructor.
  *
  * @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_Tournament_Team_StateMachine($this, $action);
     // create and instantiate the pages
     $this->addPages($this->_stateMachine, $action);
     // hack for now, set Search to Basic mode
     //$this->_pages['Basic']->setAction(CRM_Core_Action::BASIC);
     // add all the actions
     $config = CRM_Core_Config::singleton();
     // to handle file type custom data
     $uploadDir = $config->uploadDir;
     $uploadNames = $this->get('uploadNames');
     if (!empty($uploadNames)) {
         $uploadNames = array_merge($uploadNames, CRM_Core_BAO_File::uploadNames());
     } else {
         $uploadNames = CRM_Core_BAO_File::uploadNames();
     }
     // add all the actions
     $this->addActions($uploadDir, $uploadNames);
 }
Exemple #7
0
 /**
  * class constructor
  */
 function __construct($title = null, $action = CRM_Core_Action::NONE, $modal = true)
 {
     parent::__construct($title, $modal);
     require_once 'CRM/Group/StateMachine.php';
     $this->_stateMachine =& new CRM_Group_StateMachine($this, $action);
     // create and instantiate the pages
     $this->addPages($this->_stateMachine, $action);
     // hack for now, set Search to Basic mode
     $this->_pages['Basic']->setAction(CRM_Core_Action::BASIC);
     // add all the actions
     $config =& CRM_Core_Config::singleton();
     // to handle file type custom data
     $uploadDir = $config->uploadDir;
     require_once 'CRM/Core/BAO/File.php';
     $uploadNames = $this->get('uploadNames');
     if (!empty($uploadNames)) {
         $uploadNames = array_merge($uploadNames, CRM_Core_BAO_File::uploadNames());
     } else {
         $uploadNames = CRM_Core_BAO_File::uploadNames();
     }
     // add all the actions
     $this->addActions($uploadDir, $uploadNames);
 }
Exemple #8
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);
 }
Exemple #9
0
 public function addUploadAction($uploadDir, $uploadNames)
 {
     if (empty($uploadDir)) {
         $config = CRM_Core_Config::singleton();
         $uploadDir = $config->uploadDir;
     }
     if (empty($uploadNames)) {
         $uploadNames = $this->get('uploadNames');
         if (!empty($uploadNames)) {
             $uploadNames = array_merge($uploadNames, CRM_Core_BAO_File::uploadNames());
         } else {
             $uploadNames = CRM_Core_BAO_File::uploadNames();
         }
     }
     $action = new CRM_Core_QuickForm_Action_Upload($this->_stateMachine, $uploadDir, $uploadNames);
     $this->addAction('upload', $action);
 }
Exemple #10
0
 public function addUploadAction($uploadDir, $uploadNames)
 {
     if (empty($uploadDir)) {
         $config =& CRM_Core_Config::singleton();
         $uploadDir = $config->uploadDir;
     }
     require_once 'CRM/Core/BAO/File.php';
     if (empty($uploadNames)) {
         $uploadNames = $this->get('uploadNames');
         if (!empty($uploadNames)) {
             $uploadNames = array_merge($uploadNames, CRM_Core_BAO_File::uploadNames());
         } else {
             $uploadNames = CRM_Core_BAO_File::uploadNames();
         }
     }
     require_once 'CRM/Core/QuickForm/Action/Upload.php';
     $action =& new CRM_Core_QuickForm_Action_Upload($this->_stateMachine, $uploadDir, $uploadNames);
     $this->addAction('upload', $action);
 }
Exemple #11
0
 /**
  * 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);
 }