<?php
/*
+--------------------------------------------------------------------+
| CiviCRM version 4.7                                                |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2015                                |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM.                                    |
|                                                                    |
| CiviCRM is free software; you can copy, modify, and distribute it  |
| under the terms of the GNU Affero General Public License           |
| Version 3, 19 November 2007 and the CiviCRM Licensing Exception.   |
|                                                                    |
| CiviCRM is distributed in the hope that it will be useful, but     |
| WITHOUT ANY WARRANTY; without even the implied warranty of         |
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.               |
| See the GNU Affero General Public License for more details.        |
|                                                                    |
| You should have received a copy of the GNU Affero General Public   |
| License and the CiviCRM Licensing Exception along                  |
| with this program; if not, contact CiviCRM LLC                     |
| at info[AT]civicrm[DOT]org. If you have questions about the        |
| GNU Affero General Public License or the licensing of CiviCRM,     |
| see the CiviCRM license FAQ at http://civicrm.org/licensing        |
+--------------------------------------------------------------------+
*/
/**
 * @package CRM
 * @copyright CiviCRM LLC (c) 2004-2015
 *
 * Generated from xml/schema/CRM/Campaign/Survey.xml
 * DO NOT EDIT.  Generated by CRM_Core_CodeGen
 */
require_once 'CRM/Core/DAO.php';
require_once 'CRM/Utils/Type.php';
class CRM_Campaign_DAO_Survey extends CRM_Core_DAO
{
  /**
   * static instance to hold the table name
   *
   * @var string
   */
  static $_tableName = 'civicrm_survey';
  /**
   * static instance to hold the field values
   *
   * @var array
   */
  static $_fields = null;
  /**
   * static instance to hold the keys used in $_fields for each field.
   *
   * @var array
   */
  static $_fieldKeys = null;
  /**
   * static instance to hold the FK relationships
   *
   * @var string
   */
  static $_links = null;
  /**
   * static instance to hold the values that can
   * be imported
   *
   * @var array
   */
  static $_import = null;
  /**
   * static instance to hold the values that can
   * be exported
   *
   * @var array
   */
  static $_export = null;
  /**
   * static value to see if we should log any modifications to
   * this table in the civicrm_log table
   *
   * @var boolean
   */
  static $_log = false;
  /**
   * Survey id.
   *
   * @var int unsigned
   */
  public $id;
  /**
   * Title of the Survey.
   *
   * @var string
   */
  public $title;
  /**
   * Foreign key to the Campaign.
   *
   * @var int unsigned
   */
  public $campaign_id;
  /**
   * Implicit FK to civicrm_option_value where option_group = activity_type
   *
   * @var int unsigned
   */
  public $activity_type_id;
  /**
   * Recontact intervals for each status.
   *
   * @var text
   */
  public $recontact_interval;
  /**
   * Script instructions for volunteers to use for the survey.
   *
   * @var text
   */
  public $instructions;
  /**
   * Number of days for recurrence of release.
   *
   * @var int unsigned
   */
  public $release_frequency;
  /**
   * Maximum number of contacts to allow for survey.
   *
   * @var int unsigned
   */
  public $max_number_of_contacts;
  /**
   * Default number of contacts to allow for survey.
   *
   * @var int unsigned
   */
  public $default_number_of_contacts;
  /**
   * Is this survey enabled or disabled/cancelled?
   *
   * @var boolean
   */
  public $is_active;
  /**
   * Is this default survey?
   *
   * @var boolean
   */
  public $is_default;
  /**
   * FK to civicrm_contact, who created this Survey.
   *
   * @var int unsigned
   */
  public $created_id;
  /**
   * Date and time that Survey was created.
   *
   * @var datetime
   */
  public $created_date;
  /**
   * FK to civicrm_contact, who recently edited this Survey.
   *
   * @var int unsigned
   */
  public $last_modified_id;
  /**
   * Date and time that Survey was edited last time.
   *
   * @var datetime
   */
  public $last_modified_date;
  /**
   * Used to store option group id.
   *
   * @var int unsigned
   */
  public $result_id;
  /**
   * Bypass the email verification.
   *
   * @var boolean
   */
  public $bypass_confirm;
  /**
   * Title for Thank-you page (header title tag, and display at the top of the page).
   *
   * @var string
   */
  public $thankyou_title;
  /**
   * text and html allowed. displayed above result on success page
   *
   * @var text
   */
  public $thankyou_text;
  /**
   * Can people share the petition through social media?
   *
   * @var boolean
   */
  public $is_share;
  /**
   * class constructor
   *
   * @return civicrm_survey
   */
  function __construct()
  {
    $this->__table = 'civicrm_survey';
    parent::__construct();
  }
  /**
   * Returns foreign keys and entity references
   *
   * @return array
   *   [CRM_Core_Reference_Interface]
   */
  static function getReferenceColumns()
  {
    if (!self::$_links) {
      self::$_links = static ::createReferenceColumns(__CLASS__);
      self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'campaign_id', 'civicrm_campaign', 'id');
      self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'created_id', 'civicrm_contact', 'id');
      self::$_links[] = new CRM_Core_Reference_Basic(self::getTableName() , 'last_modified_id', 'civicrm_contact', 'id');
    }
    return self::$_links;
  }
  /**
   * Returns all the column names of this table
   *
   * @return array
   */
  static function &fields()
  {
    if (!(self::$_fields)) {
      self::$_fields = array(
        'id' => array(
          'name' => 'id',
          'type' => CRM_Utils_Type::T_INT,
          'title' => ts('Survey ID') ,
          'description' => 'Survey id.',
          'required' => true,
        ) ,
        'title' => array(
          'name' => 'title',
          'type' => CRM_Utils_Type::T_STRING,
          'title' => ts('Survey Title') ,
          'description' => 'Title of the Survey.',
          'required' => true,
          'maxlength' => 255,
          'size' => CRM_Utils_Type::HUGE,
          'import' => true,
          'where' => 'civicrm_survey.title',
          'headerPattern' => '',
          'dataPattern' => '',
          'export' => true,
        ) ,
        'campaign_id' => array(
          'name' => 'campaign_id',
          'type' => CRM_Utils_Type::T_INT,
          'title' => ts('Survey Campaign ID') ,
          'description' => 'Foreign key to the Campaign.',
          'default' => 'NULL',
          'FKClassName' => 'CRM_Campaign_DAO_Campaign',
          'pseudoconstant' => array(
            'table' => 'civicrm_campaign',
            'keyColumn' => 'id',
            'labelColumn' => 'title',
          )
        ) ,
        'activity_type_id' => array(
          'name' => 'activity_type_id',
          'type' => CRM_Utils_Type::T_INT,
          'title' => ts('Activity Type') ,
          'description' => 'Implicit FK to civicrm_option_value where option_group = activity_type',
          'import' => true,
          'where' => 'civicrm_survey.activity_type_id',
          'headerPattern' => '',
          'dataPattern' => '',
          'export' => true,
          'default' => 'NULL',
          'html' => array(
            'type' => 'Select',
          ) ,
          'pseudoconstant' => array(
            'optionGroupName' => 'activity_type',
            'optionEditPath' => 'civicrm/admin/options/activity_type',
          )
        ) ,
        'recontact_interval' => array(
          'name' => 'recontact_interval',
          'type' => CRM_Utils_Type::T_TEXT,
          'title' => ts('Follow up Interval') ,
          'description' => 'Recontact intervals for each status.',
          'rows' => 20,
          'cols' => 80,
          'html' => array(
            'type' => 'TextArea',
          ) ,
        ) ,
        'instructions' => array(
          'name' => 'instructions',
          'type' => CRM_Utils_Type::T_TEXT,
          'title' => ts('Instructions') ,
          'description' => 'Script instructions for volunteers to use for the survey.',
          'rows' => 20,
          'cols' => 80,
          'html' => array(
            'type' => 'TextArea',
          ) ,
        ) ,
        'release_frequency' => array(
          'name' => 'release_frequency',
          'type' => CRM_Utils_Type::T_INT,
          'title' => ts('Survey Hold Duration') ,
          'description' => 'Number of days for recurrence of release.',
          'default' => 'NULL',
        ) ,
        'max_number_of_contacts' => array(
          'name' => 'max_number_of_contacts',
          'type' => CRM_Utils_Type::T_INT,
          'title' => ts('Maximum number of contacts') ,
          'description' => 'Maximum number of contacts to allow for survey.',
          'default' => 'NULL',
        ) ,
        'default_number_of_contacts' => array(
          'name' => 'default_number_of_contacts',
          'type' => CRM_Utils_Type::T_INT,
          'title' => ts('Default number of contacts') ,
          'description' => 'Default number of contacts to allow for survey.',
          'default' => 'NULL',
        ) ,
        'is_active' => array(
          'name' => 'is_active',
          'type' => CRM_Utils_Type::T_BOOLEAN,
          'title' => ts('Survey Is Active') ,
          'description' => 'Is this survey enabled or disabled/cancelled?',
          'default' => '1',
        ) ,
        'is_default' => array(
          'name' => 'is_default',
          'type' => CRM_Utils_Type::T_BOOLEAN,
          'title' => ts('Is Default Survey') ,
          'description' => 'Is this default survey?',
        ) ,
        'created_id' => array(
          'name' => 'created_id',
          'type' => CRM_Utils_Type::T_INT,
          'title' => ts('Survey Created By') ,
          'description' => 'FK to civicrm_contact, who created this Survey.',
          'FKClassName' => 'CRM_Contact_DAO_Contact',
        ) ,
        'created_date' => array(
          'name' => 'created_date',
          'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
          'title' => ts('Campaign Created Date') ,
          'description' => 'Date and time that Survey was created.',
        ) ,
        'last_modified_id' => array(
          'name' => 'last_modified_id',
          'type' => CRM_Utils_Type::T_INT,
          'title' => ts('Survey Modified') ,
          'description' => 'FK to civicrm_contact, who recently edited this Survey.',
          'FKClassName' => 'CRM_Contact_DAO_Contact',
        ) ,
        'last_modified_date' => array(
          'name' => 'last_modified_date',
          'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
          'title' => ts('Survey Modified On') ,
          'description' => 'Date and time that Survey was edited last time.',
        ) ,
        'result_id' => array(
          'name' => 'result_id',
          'type' => CRM_Utils_Type::T_INT,
          'title' => ts('Survey Result') ,
          'description' => 'Used to store option group id.',
          'default' => 'NULL',
        ) ,
        'bypass_confirm' => array(
          'name' => 'bypass_confirm',
          'type' => CRM_Utils_Type::T_BOOLEAN,
          'title' => ts('No Email Verification') ,
          'description' => 'Bypass the email verification.',
        ) ,
        'thankyou_title' => array(
          'name' => 'thankyou_title',
          'type' => CRM_Utils_Type::T_STRING,
          'title' => ts('Thank-you Title') ,
          'description' => 'Title for Thank-you page (header title tag, and display at the top of the page).',
          'maxlength' => 255,
          'size' => CRM_Utils_Type::HUGE,
        ) ,
        'thankyou_text' => array(
          'name' => 'thankyou_text',
          'type' => CRM_Utils_Type::T_TEXT,
          'title' => ts('Thank-you Text') ,
          'description' => 'text and html allowed. displayed above result on success page',
          'rows' => 8,
          'cols' => 60,
          'html' => array(
            'type' => 'TextArea',
          ) ,
        ) ,
        'is_share' => array(
          'name' => 'is_share',
          'type' => CRM_Utils_Type::T_BOOLEAN,
          'title' => ts('Is shared through social media') ,
          'description' => 'Can people share the petition through social media?',
          'default' => '1',
        ) ,
      );
    }
    return self::$_fields;
  }
  /**
   * Returns an array containing, for each field, the arary key used for that
   * field in self::$_fields.
   *
   * @return array
   */
  static function &fieldKeys()
  {
    if (!(self::$_fieldKeys)) {
      self::$_fieldKeys = array(
        'id' => 'id',
        'title' => 'title',
        'campaign_id' => 'campaign_id',
        'activity_type_id' => 'activity_type_id',
        'recontact_interval' => 'recontact_interval',
        'instructions' => 'instructions',
        'release_frequency' => 'release_frequency',
        'max_number_of_contacts' => 'max_number_of_contacts',
        'default_number_of_contacts' => 'default_number_of_contacts',
        'is_active' => 'is_active',
        'is_default' => 'is_default',
        'created_id' => 'created_id',
        'created_date' => 'created_date',
        'last_modified_id' => 'last_modified_id',
        'last_modified_date' => 'last_modified_date',
        'result_id' => 'result_id',
        'bypass_confirm' => 'bypass_confirm',
        'thankyou_title' => 'thankyou_title',
        'thankyou_text' => 'thankyou_text',
        'is_share' => 'is_share',
      );
    }
    return self::$_fieldKeys;
  }
  /**
   * Returns the names of this table
   *
   * @return string
   */
  static function getTableName()
  {
    return CRM_Core_DAO::getLocaleTableName(self::$_tableName);
  }
  /**
   * Returns if this table needs to be logged
   *
   * @return boolean
   */
  function getLog()
  {
    return self::$_log;
  }
  /**
   * Returns the list of fields that can be imported
   *
   * @param bool $prefix
   *
   * @return array
   */
  static function &import($prefix = false)
  {
    if (!(self::$_import)) {
      self::$_import = array();
      $fields = self::fields();
      foreach($fields as $name => $field) {
        if (CRM_Utils_Array::value('import', $field)) {
          if ($prefix) {
            self::$_import['survey'] = & $fields[$name];
          } else {
            self::$_import[$name] = & $fields[$name];
          }
        }
      }
    }
    return self::$_import;
  }
  /**
   * Returns the list of fields that can be exported
   *
   * @param bool $prefix
   *
   * @return array
   */
  static function &export($prefix = false)
  {
    if (!(self::$_export)) {
      self::$_export = array();
      $fields = self::fields();
      foreach($fields as $name => $field) {
        if (CRM_Utils_Array::value('export', $field)) {
          if ($prefix) {
            self::$_export['survey'] = & $fields[$name];
          } else {
            self::$_export[$name] = & $fields[$name];
          }
        }
      }
    }
    return self::$_export;
  }
}
