protected function __construct() { $this->singular_item = __('Question Option', 'event_espresso'); $this->plural_item = __('Question Options', 'event_espresso'); $this->_tables = array('Question_Option' => new EE_Primary_Table('esp_question_option', 'QSG_ID')); $this->_fields = array('Question_Option' => array('QSO_ID' => new EE_Primary_Key_Int_Field('QSO_ID', __('Question Option ID', 'event_espresso')), 'QST_ID' => new EE_Foreign_Key_Int_Field('QST_ID', __('Question ID', 'event_espresso'), false, 0, 'Question'), 'QSO_value' => new EE_Plain_Text_Field('QSO_value', __("Question Option Value", "event_espresso"), false, ''), 'QSO_desc' => new EE_Full_HTML_Field('QSO_desc', __('Question Option Description', 'event_espresso'), false, ''), 'QSO_order' => new EE_Integer_Field('QSO_order', __('Question Option Order', 'event_espresso'), false, 0), 'QSO_deleted' => new EE_Trashed_Flag_Field('QSO_deleted', __('Flag indicating Option was trashed', 'event_espresso'), false, false))); $this->_model_relations = array('Question' => new EE_Belongs_To_Relation()); parent::__construct(); }
/** * private constructor to prevent direct creation * @Constructor * @access private * @param string $timezone string representing the timezone we want to set for returned Date Time Strings (and any incoming timezone data that gets saved). Note this just sends the timezone info to the date time model field objects. Default is NULL (and will be assumed using the set timezone in the 'timezone_string' wp option) * @return void */ protected function __construct($timezone) { $this->singular_item = __('Ticket', 'event_espresso'); $this->plural_item = __('Tickets', 'event_espresso'); $this->_tables = array('Ticket' => new EE_Primary_Table('esp_ticket', 'TKT_ID')); $this->_fields = array('Ticket' => array('TKT_ID' => new EE_Primary_Key_Int_Field('TKT_ID', __('Ticket ID', 'event_espresso')), 'TTM_ID' => new EE_Foreign_Key_Int_Field('TTM_ID', __('Ticket Template ID', 'event_espresso'), false, 0, 'Ticket_Template'), 'TKT_name' => new EE_Plain_Text_Field('TKT_name', __('Ticket Name', 'event_espresso'), false, ''), 'TKT_description' => new EE_Full_HTML_Field('TKT_description', __('Description of Ticket', 'event_espresso'), false, ''), 'TKT_start_date' => new EE_Datetime_Field('TKT_start_date', __('Start time/date of Ticket', 'event_espresso'), false, current_time('timestamp'), $timezone), 'TKT_end_date' => new EE_Datetime_Field('TKT_end_date', __('End time/date of Ticket', 'event_espresso'), false, current_time('timestamp'), $timezone), 'TKT_min' => new EE_Integer_Field('TKT_min', __('Minimum quantity of this ticket that must be purchased', 'event_espresso'), false, 0), 'TKT_max' => new EE_Infinite_Integer_Field('TKT_max', __('Maximum quantity of this ticket that can be purchased in one transaction', 'event_espresso'), false, INF), 'TKT_price' => new EE_Money_Field('TKT_price', 'Final calculated price for ticket', false, 0), 'TKT_sold' => new EE_Integer_Field('TKT_sold', __('Number of this ticket sold', 'event_espresso'), false, 0), 'TKT_qty' => new EE_Infinite_Integer_Field('TKT_qty', __('Quantity of this ticket that is available', 'event_espresso'), false, INF), 'TKT_uses' => new EE_Infinite_Integer_Field('TKT_uses', __('Number of datetimes this ticket can be used at', 'event_espresso'), false, INF), 'TKT_required' => new EE_Boolean_Field('TKT_required', __("Flag indicating whether this ticket must be purchased with a transaction", "event_espresso"), false, false), 'TKT_taxable' => new EE_Boolean_Field('TKT_taxable', __("Flag indicating whether there is tax applied on this ticket", "event_espresso"), false, false), 'TKT_is_default' => new EE_Boolean_Field('TKT_is_default', __('Flag indicating that this ticket is a default ticket', 'event_espresso'), false, false), 'TKT_order' => new EE_Integer_Field('TKT_order', __('The order in which the Ticket is displayed in the editor (used for autosaves when the form doesn\'t have the ticket ID yet)', 'event_espresso'), false, 0), 'TKT_row' => new EE_Integer_Field('TKT_row', __('How tickets are displayed in the ui', 'event_espresso'), false, 0), 'TKT_deleted' => new EE_Trashed_Flag_Field('TKT_deleted', __('Flag indicating if this has been archived or not', 'event_espresso'), false, false), 'TKT_parent' => new EE_Integer_Field('TKT_parent', __('Indicates what TKT_ID is the parent of this TKT_ID (used in autosaves/revisions)'), true, 0))); $this->_model_relations = array('Datetime' => new EE_HABTM_Relation('Datetime_Ticket'), 'Datetime_Ticket' => new EE_Has_Many_Relation(), 'Price' => new EE_HABTM_Relation('Ticket_Price'), 'Ticket_Template' => new EE_Belongs_To_Relation(), 'Registration' => new EE_Has_Many_Relation()); parent::__construct($timezone); }
protected function __construct() { $this->singular_item = __('Message Template Group', 'event_espresso'); $this->plural_item = __('Message Template Groups', 'event_espresso'); $this->_tables = array('Message_Template_Group' => new EE_Primary_Table('esp_message_template_group', 'GRP_ID')); $this->_fields = array('Message_Template_Group' => array('GRP_ID' => new EE_Primary_Key_Int_Field('GRP_ID', __('Message Template Group ID', 'event_espresso')), 'MTP_name' => new EE_Plain_Text_Field('MTP_name', __('The name of the temlpate group', 'event_espresso'), FALSE, ''), 'MTP_description' => new EE_Simple_HTML_Field('MTP_description', __('A brief description about this template.', 'event_espresso'), FALSE, ''), 'MTP_user_id' => new EE_Integer_Field('MTP_user_id', __('User who created this template', 'event_espresso'), FALSE, 1), 'MTP_messenger' => new EE_Plain_Text_Field('MTP_messenger', __('Messenger Used for Template', 'event_espresso'), FALSE, 'email'), 'MTP_message_type' => new EE_Plain_Text_Field('MTP_message_type', __('Message Type', 'event_espresso'), false, 'registration'), 'MTP_is_global' => new EE_Boolean_Field('MTP_is_global', __('Flag indicating if Template Group is Global', 'event_espresso'), false, true), 'MTP_is_override' => new EE_Boolean_Field('MTP_is_override', __('Flag indicating if Template Group overrides any other Templates for the messenger/messagetype combination', 'event_espresso'), false, false), 'MTP_deleted' => new EE_Trashed_Flag_Field('MTP_deleted', __('Flag indicating whether this has been trashed', 'event_espresso'), false, false), 'MTP_is_active' => new EE_Boolean_Field('MTP_is_active', __('Flag indicating whether template group is active', 'event_espresso'), false, true))); $this->_model_relations = array('Message_Template' => new EE_Has_Many_Relation(), 'Event' => new EE_HABTM_Relation('Event_Message_Template')); parent::__construct(); }
/** * private constructor to prevent direct creation * @Constructor * @access private * @param string $timezone string representing the timezone we want to set for returned Date Time Strings (and any incoming timezone data that gets saved). Note this just sends the timezone info to the date time model field objects. Default is NULL (and will be assumed using the set timezone in the 'timezone_string' wp option) * @return void */ protected function __construct($timezone) { $this->singular_item = __('Datetime', 'event_espresso'); $this->plural_item = __('Datetimes', 'event_espresso'); $this->_tables = array('Datetime' => new EE_Primary_Table('esp_datetime', 'DTT_ID')); $this->_fields = array('Datetime' => array('DTT_ID' => new EE_Primary_Key_Int_Field('DTT_ID', __('Datetime ID', 'event_espresso')), 'EVT_ID' => new EE_Foreign_Key_Int_Field('EVT_ID', __('Event ID', 'event_espresso'), false, 0, 'Event'), 'DTT_name' => new EE_Plain_Text_Field('DTT_name', __('Datetime Name', 'event_espresso'), false, ''), 'DTT_description' => new EE_Full_HTML_Field('DTT_description', __('Description for Datetime', 'event_espresso'), false, ''), 'DTT_EVT_start' => new EE_Datetime_Field('DTT_EVT_start', __('Start time/date of Event', 'event_espresso'), false, current_time('timestamp'), $timezone), 'DTT_EVT_end' => new EE_Datetime_Field('DTT_EVT_end', __('End time/date of Event', 'event_espresso'), false, current_time('timestamp'), $timezone), 'DTT_reg_limit' => new EE_Infinite_Integer_Field('DTT_reg_limit', __('Registration Limit for this time', 'event_espresso'), true, INF), 'DTT_sold' => new EE_Integer_Field('DTT_sold', __('How many sales for this Datetime that have occurred', 'event_espresso'), true, 0), 'DTT_is_primary' => new EE_Boolean_Field('DTT_is_primary', __("Flag indicating datetime is primary one for event", "event_espresso"), false, false), 'DTT_order' => new EE_Integer_Field('DTT_order', __('The order in which the Datetime is displayed', 'event_espresso'), false, 0), 'DTT_parent' => new EE_Integer_Field('DTT_parent', __('Indicates what DTT_ID is the parent of this DTT_ID'), true, 0), 'DTT_deleted' => new EE_Trashed_Flag_Field('DTT_deleted', __('Flag indicating datetime is archived', 'event_espresso'), false, false))); $this->_model_relations = array('Ticket' => new EE_HABTM_Relation('Datetime_Ticket'), 'Event' => new EE_Belongs_To_Relation(), 'Checkin' => new EE_Has_Many_Relation()); parent::__construct($timezone); }
/** * @return EEM_Promotion */ protected function __construct() { $this->singular_item = __('Promotion', 'event_espresso'); $this->plural_item = __('Promotions', 'event_espresso'); $this->_tables = array('Promotion' => new EE_Primary_Table('esp_promotion', 'PRO_ID')); $this->_fields = array('Promotion' => array('PRO_ID' => new EE_Primary_Key_Int_Field('PRO_ID', __('ID', 'event_espresso')), 'PRC_ID' => new EE_Foreign_Key_Int_Field('PRC_ID', __("Price ID", "event_espresso"), FALSE, 0, 'Price'), 'PRO_scope' => new EE_Plain_Text_Field('PRO_scope', __("Scope", "event_espresso"), FALSE, ''), 'PRO_start' => new EE_Datetime_Field('PRO_start', __("Start Date/Time", "event_espresso"), TRUE, NULL), 'PRO_end' => new EE_Datetime_Field('PRO_end', __("End Date/Time", "event_espresso"), TRUE, NULL), 'PRO_code' => new EE_Plain_Text_Field('PRO_code', __("Code", "event_espresso"), TRUE, ''), 'PRO_uses' => new EE_Integer_Field('PRO_uses', __("Times this can be used in a given scope", "event_espresso"), FALSE, EE_INF_IN_DB), 'PRO_global' => new EE_Boolean_Field('PRO_global', __("Applies to ALL Scope items", "event_espresso"), FALSE, FALSE), 'PRO_global_uses' => new EE_Integer_Field('PRO_global_uses', __("Times it can be used in all scopes", "event_espresso"), FALSE, EE_INF_IN_DB), 'PRO_exclusive' => new EE_Boolean_Field('PRO_exclusive', __("Exclusive? (ie, can't be used with other promotions)", "event_espresso"), false, apply_filters('FHEE__EEM_Promotion__promotions_exclusive_default', true)), 'PRO_accept_msg' => new EE_Simple_HTML_Field('PRO_accept_msg', __("Acceptance Message", "event_espresso"), FALSE, __("Accepted", "event_espresso")), 'PRO_decline_msg' => new EE_Simple_HTML_Field('PRO_decline_msg', __("Declined Message", "event_espresso"), FALSE, __("Declined", "event_espresso")), 'PRO_default' => new EE_Boolean_Field('PRO_default', __("Usable by default on all new items within promotion's scope", "event_espresso"), FALSE, FALSE), 'PRO_order' => new EE_Integer_Field('PRO_order', __("Order", "event_espresso"), FALSE, 0), 'PRO_deleted' => new EE_Trashed_Flag_Field('PRO_deleted', __("Deleted", 'event_espresso'), FALSE, FALSE), 'PRO_wp_user' => new EE_WP_User_Field('PRO_wp_user', __('Promotion Creator', 'event_espresso'), false))); $this->_model_relations = array('Price' => new EE_Belongs_To_Relation(), 'Promotion_Object' => new EE_Has_Many_Relation(), 'Line_Item' => new EE_Has_Many_Any_Relation()); parent::__construct(); }
protected function __construct() { $this->singular_item = __('Question Group', 'event_espresso'); $this->plural_item = __('Question Groups', 'event_espresso'); $this->_tables = array('Question_Group' => new EE_Primary_Table('esp_question_group', 'QSG_ID')); $this->_fields = array('Question_Group' => array('QSG_ID' => new EE_Primary_Key_Int_Field('QSG_ID', __('Question Group ID', 'event_espresso')), 'QSG_name' => new EE_Plain_Text_Field('QSG_name', __('Question Group Name', 'event_espresso'), false, ''), 'QSG_identifier' => new EE_Plain_Text_Field('QSG_identifier', __('Text ID for question Group', 'event_espresso'), false, ''), 'QSG_desc' => new EE_Full_HTML_Field('QSG_desc', __('Description of Question Group', 'event_espresso'), true, ''), 'QSG_order' => new EE_Integer_Field('QSG_order', __('Order in which to show the question group', 'event_espresso'), true, 0), 'QSG_show_group_name' => new EE_Boolean_Field('QSG_show_group_name', __('Flag indicating whether to show the group\'s name on the registration page', 'event_espresso'), false, true), 'QSG_show_group_desc' => new EE_Boolean_Field('QSG_show_group_desc', __('Flag indicating whether to show the group\\s description on the registration page', 'event_espresso'), false, false), 'QSG_system' => new EE_Integer_Field('QSG_system', __('Indicate IF this is a system group and if it is what system group it corresponds to.', 'event_espresso'), false, 0), 'QSG_deleted' => new EE_Trashed_Flag_Field('QSG_deleted', __('Flag indicating this question group was deleted', 'event_espresso'), false, false))); $this->_model_relations = array('Question' => new EE_HABTM_Relation('Question_Group_Question'), 'Event' => new EE_HABTM_Relation('Event_Question_Group'), 'Event_Question_Group' => new EE_Has_Many_Relation()); parent::__construct(); }
protected function __construct() { $this->singular_item = __('Question', 'event_espresso'); $this->plural_item = __('Questions', 'event_espresso'); $this->_allowed_question_types = apply_filters('FHEE__EEM_Question__construct__allowed_question_types', array(EEM_Question::QST_type_text => __('Text', 'event_espresso'), EEM_Question::QST_type_textarea => __('Textarea', 'event_espresso'), EEM_Question::QST_type_single => __('Single', 'event_espresso'), EEM_Question::QST_type_dropdown => __('Dropdown', 'event_espresso'), EEM_Question::QST_type_multiple => __('Multiple Choice', 'event_espresso'), EEM_Question::QST_type_date => __('Date', 'event_espresso'))); $this->_tables = array('Question' => new EE_Primary_Table('esp_question', 'QST_ID')); $this->_fields = array('Question' => array('QST_ID' => new EE_Primary_Key_Int_Field('QST_ID', __('Question ID', 'event_espresso')), 'QST_display_text' => new EE_Full_HTML_Field('QST_display_text', __('Question Text', 'event_espresso'), true, ''), 'QST_admin_label' => new EE_Plain_Text_Field('QST_admin_label', __('Question Label (admin-only)', 'event_espresso'), true, ''), 'QST_system' => new EE_Plain_Text_Field('QST_system', __('Internal string ID for question', 'event_espresso'), TRUE, NULL), 'QST_type' => new EE_Enum_Text_Field('QST_type', __('Question Type', 'event_espresso'), false, 'TEXT', $this->_allowed_question_types), 'QST_required' => new EE_Boolean_Field('QST_required', __('Required Question?', 'event_espresso'), false, false), 'QST_required_text' => new EE_Simple_HTML_Field('QST_required_text', __('Text to Display if Not Provided', 'event_espresso'), true, ''), 'QST_order' => new EE_Integer_Field('QST_order', __('Question Order', 'event_espresso'), false, 0), 'QST_admin_only' => new EE_Boolean_Field('QST_admin_only', __('Admin-Only Question?', 'event_espresso'), false, false), 'QST_wp_user' => new EE_Integer_Field('QST_wp_user', __('Wp User ID who created question', 'event_espresso'), false, 1), 'QST_deleted' => new EE_Trashed_Flag_Field('QST_deleted', __('Flag Indicating question was deleted', 'event_espresso'), false, false))); $this->_model_relations = array('Question_Group' => new EE_HABTM_Relation('Question_Group_Question'), 'Question_Option' => new EE_Has_Many_Relation(), 'Answer' => new EE_Has_Many_Relation(), 'Question_Group_Question' => new EE_Has_Many_Relation()); parent::__construct(); }
/** * private constructor to prevent direct creation * @Constructor * @access protected * @param string $timezone string representing the timezone we want to set for returned Date Time Strings (and any incoming timezone data that gets saved). Note this just sends the timezone info to the date time model field objects. Default is NULL (and will be assumed using the set timezone in the 'timezone_string' wp option) * @return void */ protected function __construct($timezone) { require_once EE_MODELS . 'EEM_Price_Type.model.php'; $this->singular_item = __('Price', 'event_espresso'); $this->plural_item = __('Prices', 'event_espresso'); $this->_tables = array('Price' => new EE_Primary_Table('esp_price', 'PRC_ID')); $this->_fields = array('Price' => array('PRC_ID' => new EE_Primary_Key_Int_Field('PRC_ID', 'Price ID'), 'PRT_ID' => new EE_Foreign_Key_Int_Field('PRT_ID', 'Price type Id', false, NULL, 'Price_Type'), 'PRC_amount' => new EE_Money_Field('PRC_amount', 'Price Amount', false, 0), 'PRC_name' => new EE_Plain_Text_Field('PRC_name', 'Name of Price', false, ''), 'PRC_desc' => new EE_Post_Content_Field('PRC_desc', 'Price Description', false, ''), 'PRC_is_default' => new EE_Boolean_Field('PRC_is_default', 'Flag indicating whether price is a default price', false, true), 'PRC_overrides' => new EE_Integer_Field('PRC_overrides', 'Price ID for a global Price that will be overridden by this Price ( for replacing default prices )', true, 0), 'PRC_order' => new EE_Integer_Field('PRC_order', 'Order of Application of Price (lower numbers apply first?)', false, 1), 'PRC_deleted' => new EE_Trashed_Flag_Field('PRC_deleted', 'Flag Indicating if this has been deleted or not', false, false), 'PRC_parent' => new EE_Integer_Field('PRC_parent', __('Indicates what PRC_ID is the parent of this PRC_ID'), true, 0))); $this->_model_relations = array('Ticket' => new EE_HABTM_Relation('Ticket_Price'), 'Price_Type' => new EE_Belongs_To_Relation()); parent::__construct($timezone); require_once EE_CLASSES . 'EE_Price.class.php'; }
protected function __construct($timezone = NULL) { $this->singular_item = __('Message Template Group', 'event_espresso'); $this->plural_item = __('Message Template Groups', 'event_espresso'); $this->_tables = array('Message_Template_Group' => new EE_Primary_Table('esp_message_template_group', 'GRP_ID')); $this->_fields = array('Message_Template_Group' => array('GRP_ID' => new EE_Primary_Key_Int_Field('GRP_ID', __('Message Template Group ID', 'event_espresso')), 'MTP_name' => new EE_Plain_Text_Field('MTP_name', __('The name of the temlpate group', 'event_espresso'), FALSE, ''), 'MTP_description' => new EE_Simple_HTML_Field('MTP_description', __('A brief description about this template.', 'event_espresso'), FALSE, ''), 'MTP_user_id' => new EE_WP_User_Field('MTP_user_id', __('Template Creator ID', 'event_espresso'), FALSE, get_current_user_id()), 'MTP_messenger' => new EE_Plain_Text_Field('MTP_messenger', __('Messenger Used for Template', 'event_espresso'), FALSE, 'email'), 'MTP_message_type' => new EE_Plain_Text_Field('MTP_message_type', __('Message Type', 'event_espresso'), false, 'registration'), 'MTP_is_global' => new EE_Boolean_Field('MTP_is_global', __('Flag indicating if Template Group is Global', 'event_espresso'), false, true), 'MTP_is_override' => new EE_Boolean_Field('MTP_is_override', __('Flag indicating if Template Group overrides any other Templates for the messenger/messagetype combination', 'event_espresso'), false, false), 'MTP_deleted' => new EE_Trashed_Flag_Field('MTP_deleted', __('Flag indicating whether this has been trashed', 'event_espresso'), false, false), 'MTP_is_active' => new EE_Boolean_Field('MTP_is_active', __('Flag indicating whether template group is active', 'event_espresso'), false, true))); $this->_model_relations = array('Message_Template' => new EE_Has_Many_Relation(), 'Event' => new EE_HABTM_Relation('Event_Message_Template'), 'WP_User' => new EE_Belongs_To_Relation()); foreach ($this->_cap_contexts_to_cap_action_map as $context => $action) { $this->_cap_restriction_generators[$context] = new EE_Restriction_Generator_Global('MTP_is_global'); } $this->_caps_slug = 'messages'; parent::__construct($timezone); }
protected function __construct($timezone = NULL) { $this->singular_item = __('Question Group', 'event_espresso'); $this->plural_item = __('Question Groups', 'event_espresso'); $this->_tables = array('Question_Group' => new EE_Primary_Table('esp_question_group', 'QSG_ID')); $this->_fields = array('Question_Group' => array('QSG_ID' => new EE_Primary_Key_Int_Field('QSG_ID', __('Question Group ID', 'event_espresso')), 'QSG_name' => new EE_Plain_Text_Field('QSG_name', __('Question Group Name', 'event_espresso'), false, ''), 'QSG_identifier' => new EE_Plain_Text_Field('QSG_identifier', __('Text ID for question Group', 'event_espresso'), false, ''), 'QSG_desc' => new EE_Full_HTML_Field('QSG_desc', __('Description of Question Group', 'event_espresso'), true, ''), 'QSG_order' => new EE_Integer_Field('QSG_order', __('Order in which to show the question group', 'event_espresso'), true, 0), 'QSG_show_group_name' => new EE_Boolean_Field('QSG_show_group_name', __('Flag indicating whether to show the group\'s name on the registration page', 'event_espresso'), false, true), 'QSG_show_group_desc' => new EE_Boolean_Field('QSG_show_group_desc', __('Flag indicating whether to show the group\\s description on the registration page', 'event_espresso'), false, false), 'QSG_wp_user' => new EE_WP_User_Field('QSG_wp_user', __('Question Group Creator ID', 'event_espresso'), FALSE), 'QSG_system' => new EE_Integer_Field('QSG_system', __('Indicate IF this is a system group and if it is what system group it corresponds to.', 'event_espresso'), false, 0), 'QSG_deleted' => new EE_Trashed_Flag_Field('QSG_deleted', __('Flag indicating this question group was deleted', 'event_espresso'), false, false))); $this->_model_relations = array('Question' => new EE_HABTM_Relation('Question_Group_Question'), 'Event' => new EE_HABTM_Relation('Event_Question_Group'), 'Event_Question_Group' => new EE_Has_Many_Relation(), 'WP_User' => new EE_Belongs_To_Relation()); //this model is generally available for reading $this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Public(); $this->_cap_restriction_generators[EEM_Base::caps_read_admin] = new EE_Restriction_Generator_Reg_Form('QSG_system'); $this->_cap_restriction_generators[EEM_Base::caps_edit] = new EE_Restriction_Generator_Reg_Form('QSG_system'); $this->_cap_restriction_generators[EEM_Base::caps_delete] = new EE_Restriction_Generator_Reg_Form('QSG_system'); parent::__construct($timezone); }
/** * private constructor to prevent direct creation * @Constructor * @access private * @param string $timezone string representing the timezone we want to set for returned Date Time Strings (and any incoming timezone data that gets saved). Note this just sends the timezone info to the date time model field objects. Default is NULL (and will be assumed using the set timezone in the 'timezone_string' wp option) */ protected function __construct($timezone) { $this->singular_item = __('Datetime', 'event_espresso'); $this->plural_item = __('Datetimes', 'event_espresso'); $this->_tables = array('Datetime' => new EE_Primary_Table('esp_datetime', 'DTT_ID')); $this->_fields = array('Datetime' => array('DTT_ID' => new EE_Primary_Key_Int_Field('DTT_ID', __('Datetime ID', 'event_espresso')), 'EVT_ID' => new EE_Foreign_Key_Int_Field('EVT_ID', __('Event ID', 'event_espresso'), false, 0, 'Event'), 'DTT_name' => new EE_Plain_Text_Field('DTT_name', __('Datetime Name', 'event_espresso'), false, ''), 'DTT_description' => new EE_Post_Content_Field('DTT_description', __('Description for Datetime', 'event_espresso'), false, ''), 'DTT_EVT_start' => new EE_Datetime_Field('DTT_EVT_start', __('Start time/date of Event', 'event_espresso'), false, time(), $timezone), 'DTT_EVT_end' => new EE_Datetime_Field('DTT_EVT_end', __('End time/date of Event', 'event_espresso'), false, time(), $timezone), 'DTT_reg_limit' => new EE_Infinite_Integer_Field('DTT_reg_limit', __('Registration Limit for this time', 'event_espresso'), true, EE_INF), 'DTT_sold' => new EE_Integer_Field('DTT_sold', __('How many sales for this Datetime that have occurred', 'event_espresso'), true, 0), 'DTT_is_primary' => new EE_Boolean_Field('DTT_is_primary', __("Flag indicating datetime is primary one for event", "event_espresso"), false, false), 'DTT_order' => new EE_Integer_Field('DTT_order', __('The order in which the Datetime is displayed', 'event_espresso'), false, 0), 'DTT_parent' => new EE_Integer_Field('DTT_parent', __('Indicates what DTT_ID is the parent of this DTT_ID'), true, 0), 'DTT_deleted' => new EE_Trashed_Flag_Field('DTT_deleted', __('Flag indicating datetime is archived', 'event_espresso'), false, false))); $this->_model_relations = array('Ticket' => new EE_HABTM_Relation('Datetime_Ticket'), 'Event' => new EE_Belongs_To_Relation(), 'Checkin' => new EE_Has_Many_Relation()); $this->_model_chain_to_wp_user = '******'; //this model is generally available for reading $this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Event_Related_Public('Event'); $this->_cap_restriction_generators[EEM_Base::caps_read_admin] = new EE_Restriction_Generator_Event_Related_Protected('Event'); $this->_cap_restriction_generators[EEM_Base::caps_edit] = new EE_Restriction_Generator_Event_Related_Protected('Event'); $this->_cap_restriction_generators[EEM_Base::caps_delete] = new EE_Restriction_Generator_Event_Related_Protected('Event', EEM_Base::caps_edit); parent::__construct($timezone); }
protected function __construct($timezone = NULL) { $this->singular_item = __('Question', 'event_espresso'); $this->plural_item = __('Questions', 'event_espresso'); $this->_allowed_question_types = apply_filters('FHEE__EEM_Question__construct__allowed_question_types', array(EEM_Question::QST_type_text => __('Text', 'event_espresso'), EEM_Question::QST_type_textarea => __('Textarea', 'event_espresso'), EEM_Question::QST_type_checkbox => __('Checkboxes', 'event_espresso'), EEM_Question::QST_type_radio => __('Radio Buttons', 'event_espresso'), EEM_Question::QST_type_dropdown => __('Dropdown', 'event_espresso'), EEM_Question::QST_type_state => __('State/Province Dropdown', 'event_espresso'), EEM_Question::QST_type_country => __('Country Dropdown', 'event_espresso'), EEM_Question::QST_type_date => __('Date Picker', 'event_espresso'), EEM_Question::QST_type_html_textarea => __('HTML Textarea', 'event_espresso'))); $this->_question_type_categories = apply_filters('FHEE__EEM_Question__construct__question_type_categories', array('text' => array(self::QST_type_text, self::QST_type_textarea, self::QST_type_html_textarea), 'single-answer-enum' => array(self::QST_type_radio, self::QST_type_dropdown))); $this->_tables = array('Question' => new EE_Primary_Table('esp_question', 'QST_ID')); $this->_fields = array('Question' => array('QST_ID' => new EE_Primary_Key_Int_Field('QST_ID', __('Question ID', 'event_espresso')), 'QST_display_text' => new EE_Full_HTML_Field('QST_display_text', __('Question Text', 'event_espresso'), true, ''), 'QST_admin_label' => new EE_Plain_Text_Field('QST_admin_label', __('Question Label (admin-only)', 'event_espresso'), true, ''), 'QST_system' => new EE_Plain_Text_Field('QST_system', __('Internal string ID for question', 'event_espresso'), TRUE, NULL), 'QST_type' => new EE_Enum_Text_Field('QST_type', __('Question Type', 'event_espresso'), false, 'TEXT', $this->_allowed_question_types), 'QST_required' => new EE_Boolean_Field('QST_required', __('Required Question?', 'event_espresso'), false, false), 'QST_required_text' => new EE_Simple_HTML_Field('QST_required_text', __('Text to Display if Not Provided', 'event_espresso'), true, ''), 'QST_order' => new EE_Integer_Field('QST_order', __('Question Order', 'event_espresso'), false, 0), 'QST_admin_only' => new EE_Boolean_Field('QST_admin_only', __('Admin-Only Question?', 'event_espresso'), false, false), 'QST_wp_user' => new EE_WP_User_Field('QST_wp_user', __('Question Creator ID', 'event_espresso'), false), 'QST_deleted' => new EE_Trashed_Flag_Field('QST_deleted', __('Flag Indicating question was deleted', 'event_espresso'), false, false))); $this->_model_relations = array('Question_Group' => new EE_HABTM_Relation('Question_Group_Question'), 'Question_Option' => new EE_Has_Many_Relation(), 'Answer' => new EE_Has_Many_Relation(), 'WP_User' => new EE_Belongs_To_Relation(), 'Question_Group_Question' => new EE_Has_Many_Relation()); //this model is generally available for reading $this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Public(); $this->_cap_restriction_generators[EEM_Base::caps_read_admin] = new EE_Restriction_Generator_Reg_Form('QST_system'); $this->_cap_restriction_generators[EEM_Base::caps_edit] = new EE_Restriction_Generator_Reg_Form('QST_system'); $this->_cap_restriction_generators[EEM_Base::caps_delete] = new EE_Restriction_Generator_Reg_Form('QST_system'); parent::__construct($timezone); }
/** * private constructor to prevent direct creation * @Constructor * @access protected * @param string $timezone string representing the timezone we want to set for returned Date Time Strings (and any incoming timezone data that gets saved). Note this just sends the timezone info to the date time model field objects. Default is NULL (and will be assumed using the set timezone in the 'timezone_string' wp option) * @return void */ protected function __construct($timezone) { require_once EE_MODELS . 'EEM_Price_Type.model.php'; $this->singular_item = __('Price', 'event_espresso'); $this->plural_item = __('Prices', 'event_espresso'); $this->_tables = array('Price' => new EE_Primary_Table('esp_price', 'PRC_ID')); $this->_fields = array('Price' => array('PRC_ID' => new EE_Primary_Key_Int_Field('PRC_ID', 'Price ID'), 'PRT_ID' => new EE_Foreign_Key_Int_Field('PRT_ID', 'Price type Id', false, NULL, 'Price_Type'), 'PRC_amount' => new EE_Money_Field('PRC_amount', 'Price Amount', false, 0), 'PRC_name' => new EE_Plain_Text_Field('PRC_name', 'Name of Price', false, ''), 'PRC_desc' => new EE_Post_Content_Field('PRC_desc', 'Price Description', false, ''), 'PRC_is_default' => new EE_Boolean_Field('PRC_is_default', 'Flag indicating whether price is a default price', false, true), 'PRC_overrides' => new EE_Integer_Field('PRC_overrides', 'Price ID for a global Price that will be overridden by this Price ( for replacing default prices )', true, 0), 'PRC_order' => new EE_Integer_Field('PRC_order', 'Order of Application of Price (lower numbers apply first?)', false, 1), 'PRC_deleted' => new EE_Trashed_Flag_Field('PRC_deleted', 'Flag Indicating if this has been deleted or not', false, false), 'PRC_parent' => new EE_Integer_Field('PRC_parent', __('Indicates what PRC_ID is the parent of this PRC_ID'), true, 0), 'PRC_wp_user' => new EE_WP_User_Field('PRC_wp_user', __('Price Creator ID', 'event_espresso'), FALSE))); $this->_model_relations = array('Ticket' => new EE_HABTM_Relation('Ticket_Price'), 'Price_Type' => new EE_Belongs_To_Relation(), 'WP_User' => new EE_Belongs_To_Relation()); //this model is generally available for reading $this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Default_Public('PRC_is_default', 'Ticket.Datetime.Event'); //account for default tickets in the caps $this->_cap_restriction_generators[EEM_Base::caps_read_admin] = new EE_Restriction_Generator_Default_Protected('PRC_is_default', 'Ticket.Datetime.Event'); $this->_cap_restriction_generators[EEM_Base::caps_edit] = new EE_Restriction_Generator_Default_Protected('PRC_is_default', 'Ticket.Datetime.Event'); $this->_cap_restriction_generators[EEM_Base::caps_delete] = new EE_Restriction_Generator_Default_Protected('PRC_is_default', 'Ticket.Datetime.Event'); parent::__construct($timezone); }
protected function __construct($timezone = NULL) { $this->singular_item = __('Question Option', 'event_espresso'); $this->plural_item = __('Question Options', 'event_espresso'); $this->_tables = array('Question_Option' => new EE_Primary_Table('esp_question_option', 'QSO_ID')); $this->_fields = array('Question_Option' => array('QSO_ID' => new EE_Primary_Key_Int_Field('QSO_ID', __('Question Option ID', 'event_espresso')), 'QST_ID' => new EE_Foreign_Key_Int_Field('QST_ID', __('Question ID', 'event_espresso'), false, 0, 'Question'), 'QSO_value' => new EE_Plain_Text_Field('QSO_value', __("Question Option Value", "event_espresso"), false, ''), 'QSO_desc' => new EE_Full_HTML_Field('QSO_desc', __('Question Option Description', 'event_espresso'), false, ''), 'QSO_order' => new EE_Integer_Field('QSO_order', __('Question Option Order', 'event_espresso'), false, 0), 'QSO_system' => new EE_Plain_Text_Field('QSO_system', __('Internal string ID for question option', 'event_espresso'), TRUE, NULL), 'QSO_deleted' => new EE_Trashed_Flag_Field('QSO_deleted', __('Flag indicating Option was trashed', 'event_espresso'), false, false))); $this->_model_relations = array('Question' => new EE_Belongs_To_Relation()); $this->_model_chain_to_wp_user = '******'; //this model is generally available for reading $this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Public(); $this->_cap_restriction_generators[EEM_Base::caps_read_admin] = new EE_Restriction_Generator_Reg_Form('Question_Option'); $this->_cap_restriction_generators[EEM_Base::caps_edit] = new EE_Restriction_Generator_Reg_Form('Question_Option'); $this->_cap_restriction_generators[EEM_Base::caps_delete] = new EE_Restriction_Generator_Reg_Form('Question_Option'); $this->_caps_slug = 'questions'; parent::__construct($timezone); }
/** * Adds a relationship to Term_Taxonomy for each CPT_Base * @param string $timezone */ protected function __construct($timezone = null) { //adds a relationship to Term_Taxonomy for all these models. For this to work //Term_Relationship must have a relation to each model subclassing EE_CPT_Base explicitly //eg, in EEM_Term_Relationship, inside the _model_relations array, there must be an entry //with key equalling the subclassing model's model name (eg 'Event' or 'Venue'), and the value //must also be new EE_HABTM_Relation('Term_Relationship'); $this->_model_relations['Term_Taxonomy'] = new EE_HABTM_Relation('Term_Relationship'); $primary_table_name = NULL; //add the common _status field to all CPT primary tables. foreach ($this->_tables as $alias => $table_obj) { if ($table_obj instanceof EE_Primary_Table) { $primary_table_name = $alias; } } //set default wp post statuses if child has not already set. if (!isset($this->_fields[$primary_table_name]['status'])) { $this->_fields[$primary_table_name]['status'] = new EE_WP_Post_Status_Field('post_status', __("Event Status", "event_espresso"), false, 'draft'); } parent::__construct($timezone); }
/** * Adds a relationship to Term_Taxonomy for each CPT_Base * * @param string $timezone * @throws \EE_Error */ protected function __construct($timezone = NULL) { //adds a relationship to Term_Taxonomy for all these models. For this to work //Term_Relationship must have a relation to each model subclassing EE_CPT_Base explicitly //eg, in EEM_Term_Relationship, inside the _model_relations array, there must be an entry //with key equalling the subclassing model's model name (eg 'Event' or 'Venue'), and the value //must also be new EE_HABTM_Relation('Term_Relationship'); $this->_model_relations['Term_Taxonomy'] = new EE_HABTM_Relation('Term_Relationship'); $primary_table_name = NULL; //add the common _status field to all CPT primary tables. foreach ($this->_tables as $alias => $table_obj) { if ($table_obj instanceof EE_Primary_Table) { $primary_table_name = $alias; } } //set default wp post statuses if child has not already set. if (!isset($this->_fields[$primary_table_name]['status'])) { $this->_fields[$primary_table_name]['status'] = new EE_WP_Post_Status_Field('post_status', __("Event Status", "event_espresso"), false, 'draft'); } if (!isset($this->_fields[$primary_table_name]['to_ping'])) { $this->_fields[$primary_table_name]['to_ping'] = new EE_DB_Only_Text_Field('to_ping', __('To Ping', 'event_espresso'), FALSE, ''); } if (!isset($this->_fields[$primary_table_name]['pinged'])) { $this->_fields[$primary_table_name]['pinged'] = new EE_DB_Only_Text_Field('pinged', __('Pinged', 'event_espresso'), FALSE, ''); } if (!isset($this->_fields[$primary_table_name]['comment_status'])) { $this->_fields[$primary_table_name]['comment_status'] = new EE_Plain_Text_Field('comment_status', __('Comment Status', 'event_espresso'), FALSE, 'open'); } if (!isset($this->_fields[$primary_table_name]['ping_status'])) { $this->_fields[$primary_table_name]['ping_status'] = new EE_Plain_Text_Field('ping_status', __('Ping Status', 'event_espresso'), FALSE, 'open'); } if (!isset($this->_fields[$primary_table_name]['post_content_filtered'])) { $this->_fields[$primary_table_name]['post_content_filtered'] = new EE_DB_Only_Text_Field('post_content_filtered', __('Post Content Filtered', 'event_espresso'), FALSE, ''); } if (!isset($this->_model_relations['Post_Meta'])) { //don't block deletes though because we want to maintain the current behaviour $this->_model_relations['Post_Meta'] = new EE_Has_Many_Relation(false); } parent::__construct($timezone); }
/** * private constructor to prevent direct creation * @Constructor * @access protected * @param string $timezone string representing the timezone we want to set for returned Date Time Strings (and any incoming timezone data that gets saved). * Note this just sends the timezone info to the date time model field objects. Default is NULL (and will be assumed using the set timezone in the 'timezone_string' wp option) * @return void */ protected function __construct($timezone) { $this->singular_item = __('Registration', 'event_espresso'); $this->plural_item = __('Registrations', 'event_espresso'); $this->_get_registration_status_array(); // require_once(EE_CLASSES . 'EE_Registration.class.php'); $this->_allowed_statuses = apply_filters('FHEE__EEM_Registration__allowed_statuses', self::$_reg_status); $this->_tables = array('Registration' => new EE_Primary_Table('esp_registration', 'REG_ID')); $this->_fields = array('Registration' => array('REG_ID' => new EE_Primary_Key_Int_Field('REG_ID', __('Registration ID', 'event_espresso')), 'EVT_ID' => new EE_Foreign_Key_Int_Field('EVT_ID', __('Even tID', 'event_espresso'), false, 0, 'Event'), 'ATT_ID' => new EE_Foreign_Key_Int_Field('ATT_ID', __('Attendee ID', 'event_espresso'), false, 0, 'Attendee'), 'TXN_ID' => new EE_Foreign_Key_Int_Field('TXN_ID', __('Transaction ID', 'event_espresso'), false, 0, 'Transaction'), 'TKT_ID' => new EE_Foreign_Key_Int_Field('TKT_ID', __('Ticket ID', 'event_espresso'), false, 0, 'Ticket'), 'STS_ID' => new EE_Foreign_Key_String_Field('STS_ID', __('Status ID', 'event_espresso'), false, EEM_Registration::status_id_pending_payment, 'Status'), 'REG_date' => new EE_Datetime_Field('REG_date', __('Time registration occurred', 'event_espresso'), false, current_time('timestamp'), $timezone), 'REG_final_price' => new EE_Money_Field('REG_final_price', __('Final Price of registration', 'event_espresso'), false, 0), 'REG_session' => new EE_Plain_Text_Field('REG_session', __('Session ID of registration', 'event_espresso'), false, ''), 'REG_code' => new EE_Plain_Text_Field('REG_code', __('Unique Code for this registration', 'event_espresso'), false, ''), 'REG_url_link' => new EE_Plain_Text_Field('REG_url_link', __('String to be used in URL for identifying registration', 'event_espresso'), false, ''), 'REG_count' => new EE_Integer_Field('REG_count', __('Count of this registration in the group registration ', 'event_espresso'), true, 1), 'REG_group_size' => new EE_Integer_Field('REG_group_size', __('Number of registrations on this group', 'event_espresso'), false, 1), 'REG_att_is_going' => new EE_Boolean_Field('REG_att_is_going', __('Flag indicating the registrant plans on attending', 'event_espresso'), false, false), 'REG_deleted' => new EE_Trashed_Flag_Field('REG_deleted', __('Flag indicating if registration has been archived or not.', 'event_espresso'), false, false))); $this->_model_relations = array('Event' => new EE_Belongs_To_Relation(), 'Attendee' => new EE_Belongs_To_Relation(), 'Transaction' => new EE_Belongs_To_Relation(), 'Ticket' => new EE_Belongs_To_Relation(), 'Status' => new EE_Belongs_To_Relation(), 'Answer' => new EE_Has_Many_Relation(), 'Checkin' => new EE_Has_Many_Relation()); parent::__construct($timezone); }
/** * * @param type $query_params * @param boolean $allow_blocking if TRUE, matched objects will only be deleted if there is no related model info * that blocks it (ie, there' sno other data that depends on this data); if false, deletes regardless of other objects * which may depend on it. Its generally advisable to always leave this as TRUE, otherwise you could easily corrupt your DB * @return boolean */ public function delete_permanently($query_params = array(), $allow_blocking = true) { $would_be_deleted_price_types = $this->get_all_deleted_and_undeleted($query_params); $would_be_deleted_price_type_ids = array_keys($would_be_deleted_price_types); $ID = $query_params[0][$this->get_primary_key_field()->get_name()]; //check if any prices use this price type $prc_query_params = array(array('PRT_ID' => array('IN', $would_be_deleted_price_type_ids))); if ($prices = $this->get_all_related($ID, 'Price', $prc_query_params)) { $prices_names_and_ids = array(); foreach ($prices as $price) { /* @var $price EE_Price */ $prices_names_and_ids[] = $price->name() . "(" . $price->ID() . ")"; } $msg = sprintf(__('The Price Type(s) could not be deleted because there are existing Prices that currently use this Price Type. If you still wish to delete this Price Type, then either delete those Prices or change them to use other Price Types.The prices are: %s', 'event_espresso'), implode(",", $prices_names_and_ids)); EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); return FALSE; } return parent::delete_permanently($query_params); }
/** * EEM_Question constructor. * * @param null $timezone */ protected function __construct($timezone = NULL) { $this->singular_item = __('Question', 'event_espresso'); $this->plural_item = __('Questions', 'event_espresso'); $this->_allowed_question_types = apply_filters('FHEE__EEM_Question__construct__allowed_question_types', array(EEM_Question::QST_type_text => __('Text', 'event_espresso'), EEM_Question::QST_type_textarea => __('Textarea', 'event_espresso'), EEM_Question::QST_type_checkbox => __('Checkboxes', 'event_espresso'), EEM_Question::QST_type_radio => __('Radio Buttons', 'event_espresso'), EEM_Question::QST_type_dropdown => __('Dropdown', 'event_espresso'), EEM_Question::QST_type_state => __('State/Province Dropdown', 'event_espresso'), EEM_Question::QST_type_country => __('Country Dropdown', 'event_espresso'), EEM_Question::QST_type_date => __('Date Picker', 'event_espresso'), EEM_Question::QST_type_html_textarea => __('HTML Textarea', 'event_espresso'), EEM_Question::QST_type_email => __('Email', 'event_espresso'), EEM_Question::QST_type_us_phone => __('USA - Format Phone', 'event_espresso'), EEM_Question::QST_type_decimal => __('Number', 'event_espresso'), EEM_Question::QST_type_int => __('Whole Number', 'event_espresso'), EEM_Question::QST_type_url => __('URL', 'event_espresso'), EEM_Question::QST_type_year => __('Year', 'event_espresso'), EEM_Question::QST_type_multi_select => __('Multi Select', 'event_espresso'))); $this->_question_descriptions = apply_filters('FHEE__EEM_Question__construct__allowed_question_types', array(EEM_Question::QST_type_text => __('A single line text input field', 'event_espresso'), EEM_Question::QST_type_textarea => __('A multi line text input field', 'event_espresso'), EEM_Question::QST_type_checkbox => __('Allows multiple preset options to be selected', 'event_espresso'), EEM_Question::QST_type_radio => __('Allows a single preset option to be selected', 'event_espresso'), EEM_Question::QST_type_dropdown => __('A dropdown that allows a single selection', 'event_espresso'), EEM_Question::QST_type_state => __('A dropdown that lists states/provinces', 'event_espresso'), EEM_Question::QST_type_country => __('A dropdown that lists countries', 'event_espresso'), EEM_Question::QST_type_date => __('A popup calendar that allows date selections', 'event_espresso'), EEM_Question::QST_type_html_textarea => __('A multi line text input field that allows HTML', 'event_espresso'), EEM_Question::QST_type_email => __('A text field that must contain a valid Email address', 'event_espresso'), EEM_Question::QST_type_us_phone => __('A text field that must contain a valid US phone number', 'event_espresso'), EEM_Question::QST_type_decimal => __('A text field that allows number values with decimals', 'event_espresso'), EEM_Question::QST_type_int => __('A text field that only allows whole numbers (no decimals)', 'event_espresso'), EEM_Question::QST_type_url => __('A text field that must contain a valid URL', 'event_espresso'), EEM_Question::QST_type_year => __('A dropdown that lists the last 100 years', 'event_espresso'), EEM_Question::QST_type_multi_select => __('A dropdown that allows multiple selections', 'event_espresso'))); $this->_question_type_categories = (array) apply_filters('FHEE__EEM_Question__construct__question_type_categories', array('text' => array(EEM_Question::QST_type_text, EEM_Question::QST_type_textarea, EEM_Question::QST_type_html_textarea, EEM_Question::QST_type_email, EEM_Question::QST_type_us_phone, EEM_Question::QST_type_int, EEM_Question::QST_type_decimal, EEM_Question::QST_type_url), 'single-answer-enum' => array(EEM_Question::QST_type_radio, EEM_Question::QST_type_dropdown), 'multi-answer-enum' => array(EEM_Question::QST_type_checkbox, EEM_Question::QST_type_multi_select))); $this->_tables = array('Question' => new EE_Primary_Table('esp_question', 'QST_ID')); $this->_fields = array('Question' => array('QST_ID' => new EE_Primary_Key_Int_Field('QST_ID', __('Question ID', 'event_espresso')), 'QST_display_text' => new EE_Post_Content_Field('QST_display_text', __('Question Text', 'event_espresso'), true, ''), 'QST_admin_label' => new EE_Plain_Text_Field('QST_admin_label', __('Question Label (admin-only)', 'event_espresso'), true, ''), 'QST_system' => new EE_Plain_Text_Field('QST_system', __('Internal string ID for question', 'event_espresso'), false, ''), 'QST_type' => new EE_Enum_Text_Field('QST_type', __('Question Type', 'event_espresso'), false, 'TEXT', $this->_allowed_question_types), 'QST_required' => new EE_Boolean_Field('QST_required', __('Required Question?', 'event_espresso'), false, false), 'QST_required_text' => new EE_Simple_HTML_Field('QST_required_text', __('Text to Display if Not Provided', 'event_espresso'), true, ''), 'QST_order' => new EE_Integer_Field('QST_order', __('Question Order', 'event_espresso'), false, 0), 'QST_admin_only' => new EE_Boolean_Field('QST_admin_only', __('Admin-Only Question?', 'event_espresso'), false, false), 'QST_max' => new EE_Infinite_Integer_Field('QST_max', __('Max Size', 'event_espresso'), false, EE_INF), 'QST_wp_user' => new EE_WP_User_Field('QST_wp_user', __('Question Creator ID', 'event_espresso'), false), 'QST_deleted' => new EE_Trashed_Flag_Field('QST_deleted', __('Flag Indicating question was deleted', 'event_espresso'), false, false))); $this->_model_relations = array('Question_Group' => new EE_HABTM_Relation('Question_Group_Question'), 'Question_Option' => new EE_Has_Many_Relation(), 'Answer' => new EE_Has_Many_Relation(), 'WP_User' => new EE_Belongs_To_Relation(), 'Question_Group_Question' => new EE_Has_Many_Relation()); //this model is generally available for reading $this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Public(); $this->_cap_restriction_generators[EEM_Base::caps_read_admin] = new EE_Restriction_Generator_Reg_Form('QST_system'); $this->_cap_restriction_generators[EEM_Base::caps_edit] = new EE_Restriction_Generator_Reg_Form('QST_system'); $this->_cap_restriction_generators[EEM_Base::caps_delete] = new EE_Restriction_Generator_Reg_Form('QST_system'); parent::__construct($timezone); }
/** * private constructor to prevent direct creation * * @Constructor * @access protected * @param string $timezone string representing the timezone we want to set for returned Date Time Strings (and any incoming timezone data that gets saved). * Note this just sends the timezone info to the date time model field objects. Default is NULL (and will be assumed using the set timezone in the 'timezone_string' wp option) * @return \EEM_Registration */ protected function __construct($timezone) { $this->singular_item = __('Registration', 'event_espresso'); $this->plural_item = __('Registrations', 'event_espresso'); $this->_tables = array('Registration' => new EE_Primary_Table('esp_registration', 'REG_ID')); $this->_fields = array('Registration' => array('REG_ID' => new EE_Primary_Key_Int_Field('REG_ID', __('Registration ID', 'event_espresso')), 'EVT_ID' => new EE_Foreign_Key_Int_Field('EVT_ID', __('Even tID', 'event_espresso'), false, 0, 'Event'), 'ATT_ID' => new EE_Foreign_Key_Int_Field('ATT_ID', __('Attendee ID', 'event_espresso'), false, 0, 'Attendee'), 'TXN_ID' => new EE_Foreign_Key_Int_Field('TXN_ID', __('Transaction ID', 'event_espresso'), false, 0, 'Transaction'), 'TKT_ID' => new EE_Foreign_Key_Int_Field('TKT_ID', __('Ticket ID', 'event_espresso'), false, 0, 'Ticket'), 'STS_ID' => new EE_Foreign_Key_String_Field('STS_ID', __('Status ID', 'event_espresso'), false, EEM_Registration::status_id_incomplete, 'Status'), 'REG_date' => new EE_Datetime_Field('REG_date', __('Time registration occurred', 'event_espresso'), false, current_time('timestamp'), $timezone), 'REG_final_price' => new EE_Money_Field('REG_final_price', __('Final Price of registration after all ticket/price modifications', 'event_espresso'), false, 0), 'REG_paid' => new EE_Money_Field('REG_paid', __('Amount paid to date towards registration', 'event_espresso'), false, 0), 'REG_session' => new EE_Plain_Text_Field('REG_session', __('Session ID of registration', 'event_espresso'), false, ''), 'REG_code' => new EE_Plain_Text_Field('REG_code', __('Unique Code for this registration', 'event_espresso'), false, ''), 'REG_url_link' => new EE_Plain_Text_Field('REG_url_link', __('String to be used in URL for identifying registration', 'event_espresso'), false, ''), 'REG_count' => new EE_Integer_Field('REG_count', __('Count of this registration in the group registration ', 'event_espresso'), true, 1), 'REG_group_size' => new EE_Integer_Field('REG_group_size', __('Number of registrations on this group', 'event_espresso'), false, 1), 'REG_att_is_going' => new EE_Boolean_Field('REG_att_is_going', __('Flag indicating the registrant plans on attending', 'event_espresso'), false, false), 'REG_deleted' => new EE_Trashed_Flag_Field('REG_deleted', __('Flag indicating if registration has been archived or not.', 'event_espresso'), false, false))); $this->_model_relations = array('Event' => new EE_Belongs_To_Relation(), 'Attendee' => new EE_Belongs_To_Relation(), 'Transaction' => new EE_Belongs_To_Relation(), 'Ticket' => new EE_Belongs_To_Relation(), 'Status' => new EE_Belongs_To_Relation(), 'Answer' => new EE_Has_Many_Relation(), 'Checkin' => new EE_Has_Many_Relation(), 'Payment' => new EE_HABTM_Relation('Registration_Payment')); $this->_model_chain_to_wp_user = '******'; parent::__construct($timezone); }
/** * Performs the deletion of a single or multiple questions or question groups. * @param EEM_Base $model * @return int number of items deleted permanenetly */ private function _delete_items(EEM_Soft_Delete_Base $model) { $success = 0; do_action('AHEE_log', __FILE__, __FUNCTION__, ''); if (!empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { // if array has more than one element than success message should be plural $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; // cycle thru bulk action checkboxes while (list($ID, $value) = each($this->_req_data['checkbox'])) { if (!$model->delete_permanently_by_ID(absint($ID))) { $success = 0; } } } elseif (!empty($this->_req_data['QSG_ID'])) { $success = $model->delete_permanently_by_ID($this->_req_data['QSG_ID']); } elseif (!empty($this->_req_data['QST_ID'])) { $success = $model->delete_permanently_by_ID($this->_req_data['QST_ID']); } else { EE_Error::add_error(sprintf(__("No Questions or Question Groups were selected for deleting. This error usually shows when you've attempted to delete via bulk action but there were no selections.", "event_espresso")), __FILE__, __FUNCTION__, __LINE__); } return $success; }
/** * Internally used to delete or restore items, using the request data. Meant to be * flexible between question or question groups * *@param EEM_Soft_Delete_Base $model * @param boolean $trash whether to trash or restore */ private function _trash_or_restore_items(EEM_Soft_Delete_Base $model, $trash = TRUE) { do_action('AHEE_log', __FILE__, __FUNCTION__, ''); $success = 1; //Checkboxes //echo "trash $trash"; //var_dump($this->_req_data['checkbox']);die; if (isset($this->_req_data['checkbox'])) { if (!empty($this->_req_data['checkbox']) && is_array($this->_req_data['checkbox'])) { // if array has more than one element than success message should be plural $success = count($this->_req_data['checkbox']) > 1 ? 2 : 1; // cycle thru bulk action checkboxes while (list($ID, $value) = each($this->_req_data['checkbox'])) { if (!$model->delete_or_restore_by_ID($trash, absint($ID))) { $success = 0; } } } else { // grab single id and delete $ID = absint($this->_req_data['checkbox']); if (!$model->delete_or_restore_by_ID($trash, $ID)) { $success = 0; } } } else { // delete via trash link // grab single id and delete $ID = absint($this->_req_data[$model->primary_key_name()]); if (!$model->delete_or_restore_by_ID($trash, $ID)) { $success = 0; } } $action = $model instanceof EEM_Question ? 'default' : 'question_groups'; //strtolower( $model->item_name(2) ); //echo "action :$action"; //$action = 'questions' ? 'default' : $action; if ($trash) { $action_desc = 'trashed'; $status = 'trash'; } else { $action_desc = 'restored'; $status = 'all'; } $this->_redirect_after_action($success, $model->item_name($success), $action_desc, array('action' => $action, 'status' => $status)); }
/** * Deletes the specified question (and its associated question options) or question group * @param int $id * @param EEM_Soft_Delete_Base $model * @return boolean */ protected function _delete_item($id, $model) { if ($model instanceof EEM_Question) { EEM_Question_Option::instance()->delete_permanently(array(array('QST_ID' => absint($id)))); } return $model->delete_permanently_by_ID(absint($id)); }