3 +--------------------------------------------------------------------+
4 | Copyright CiviCRM LLC. All rights reserved. |
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 +--------------------------------------------------------------------+
15 * @copyright CiviCRM LLC https://civicrm.org/licensing
19 * This class defines the DataSource interface but must be subclassed to be
22 abstract class CRM_Import_DataSource
{
25 * Provides information about the data source.
28 * Description of this data source, including:
29 * - title: string, translated, required
30 * - permissions: array, optional
33 abstract public function getInfo();
36 * Set variables up before form is built.
38 * @param CRM_Core_Form $form
40 abstract public function preProcess(&$form);
43 * This is function is called by the form object to get the DataSource's form snippet.
45 * It should add all fields necessary to get the data uploaded to the temporary table in the DB.
47 * @param CRM_Core_Form $form
49 abstract public function buildQuickForm(&$form);
52 * Process the form submission.
54 * @param array $params
56 * @param CRM_Core_Form $form
58 abstract public function postProcess(&$params, &$db, &$form);
61 * Determine if the current user has access to this data source.
65 public function checkPermission() {
66 $info = $this->getInfo();
67 return empty($info['permissions']) || CRM_Core_Permission
::check($info['permissions']);