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
21 * This class defines the DataSource interface but must be subclassed to be
24 abstract class CRM_Import_DataSource
{
27 * Provides information about the data source.
30 * Description of this data source, including:
31 * - title: string, translated, required
32 * - permissions: array, optional
35 abstract public function getInfo();
38 * Set variables up before form is built.
40 * @param CRM_Core_Form $form
42 abstract public function preProcess(&$form);
45 * This is function is called by the form object to get the DataSource's form snippet.
47 * It should add all fields necessary to get the data uploaded to the temporary table in the DB.
49 * @param CRM_Core_Form $form
51 abstract public function buildQuickForm(&$form);
54 * Process the form submission.
56 * @param array $params
58 * @param CRM_Core_Form $form
60 abstract public function postProcess(&$params, &$db, &$form);
63 * Determine if the current user has access to this data source.
67 public function checkPermission() {
68 $info = $this->getInfo();
69 return empty($info['permissions']) || CRM_Core_Permission
::check($info['permissions']);