本文整理汇总了PHP中EEM_Base类的典型用法代码示例。如果您正苦于以下问题:PHP EEM_Base类的具体用法?PHP EEM_Base怎么用?PHP EEM_Base使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了EEM_Base类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* @param string $validation_error_message
* @param string $model_name name of an EEM_Base model
* @param array $query_params @see EEM_Base::get_all()
* @param string $input_field_name the input will be treated as this field's value
* @throws \EE_Error
*/
public function __construct($validation_error_message = NULL, $model_name = '', $query_params = array(), $input_field_name = '')
{
if (!EE_Registry::instance()->is_model_name($model_name)) {
throw new EE_Error(sprintf(__('You must provide a valid model object ', 'event_espresso'), $model_name));
}
$this->_model = EE_Registry::instance()->load_model($model_name);
$this->_query_params = $query_params;
if (empty($input_field_name)) {
$input_field_name = $this->_model->primary_key_name();
}
$this->_input_field_name = $input_field_name;
parent::__construct($validation_error_message);
}
开发者ID:aaronfrey,项目名称:PepperLillie-GSP,代码行数:20,代码来源:EE_Model_Matching_Query_Validation_Strategy.strategy.php
示例2: __construct
protected function __construct($timezone = NULL)
{
$this->singular_item = __('Term Taxonomy', 'event_espresso');
$this->plural_item = __('Term Taxonomy', 'event_espresso');
$this->_tables = array('Term_Taxonomy' => new EE_Primary_Table('term_taxonomy', 'term_taxonomy_id'));
$this->_fields = array('Term_Taxonomy' => array('term_taxonomy_id' => new EE_Primary_Key_Int_Field('term_taxonomy_id', __('Term-Taxonomy ID', 'event_espresso')), 'term_id' => new EE_Foreign_Key_Int_Field('term_id', __("Term Id", "event_espresso"), false, 0, 'Term'), 'taxonomy' => new EE_Plain_Text_Field('taxonomy', __('Taxonomy Name', 'event_espresso'), false, 'category'), 'description' => new EE_Post_Content_Field('description', __("Description of Term", "event_espresso"), false, ''), 'parent' => new EE_Integer_Field('parent', __("Parent Term ID", "event_espresso"), false, 0), 'term_count' => new EE_Integer_Field('count', __("Count of Objects attached", 'event_espresso'), false, 0)));
$this->_model_relations = array('Term_Relationship' => new EE_Has_Many_Relation(), 'Term' => new EE_Belongs_To_Relation());
$cpt_models = array_keys(EE_Registry::instance()->cpt_models());
foreach ($cpt_models as $model_name) {
$this->_model_relations[$model_name] = new EE_HABTM_Relation('Term_Relationship');
}
$this->_indexes = array('term_id_taxonomy' => new EE_Unique_Index(array('term_id', 'taxonomy')));
$path_to_tax_model = '';
$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_Taxonomy_Protected($path_to_tax_model);
$this->_cap_restriction_generators[EEM_Base::caps_edit] = false;
$this->_cap_restriction_generators[EEM_Base::caps_delete] = false;
//add cap restrictions for editing relating to the "ee_edit_*"
$this->_cap_restrictions[EEM_Base::caps_edit]['ee_edit_event_category'] = new EE_Default_Where_Conditions(array($path_to_tax_model . 'taxonomy*ee_edit_event_category' => array('!=', 'espresso_event_categories')));
$this->_cap_restrictions[EEM_Base::caps_edit]['ee_edit_venue_category'] = new EE_Default_Where_Conditions(array($path_to_tax_model . 'taxonomy*ee_edit_venue_category' => array('!=', 'espresso_venue_categories')));
$this->_cap_restrictions[EEM_Base::caps_edit]['ee_edit_event_type'] = new EE_Default_Where_Conditions(array($path_to_tax_model . 'taxonomy*ee_edit_event_type' => array('!=', 'espresso_event_type')));
//add cap restrictions for deleting relating to the "ee_deleting_*"
$this->_cap_restrictions[EEM_Base::caps_delete]['ee_delete_event_category'] = new EE_Default_Where_Conditions(array($path_to_tax_model . 'taxonomy*ee_delete_event_category' => array('!=', 'espresso_event_categories')));
$this->_cap_restrictions[EEM_Base::caps_delete]['ee_delete_venue_category'] = new EE_Default_Where_Conditions(array($path_to_tax_model . 'taxonomy*ee_delete_venue_category' => array('!=', 'espresso_venue_categories')));
$this->_cap_restrictions[EEM_Base::caps_delete]['ee_delete_event_type'] = new EE_Default_Where_Conditions(array($path_to_tax_model . 'taxonomy*ee_delete_event_type' => array('!=', 'espresso_event_type')));
parent::__construct($timezone);
}
示例3: _save_related_info
/**
* Automatically finds the related model info from the form, if present, and
* save the relations indicated
* @type string $relation_name
* @return bool
* @throws EE_Error
*/
protected function _save_related_info($relation_name)
{
$relation_obj = $this->_model->related_settings_for($relation_name);
if ($relation_obj instanceof EE_Belongs_To_Relation) {
//there is just a foreign key on this model pointing to that one
$this->_model_object->_add_relation_to($this->get_input_value($relation_name), $relation_name);
} elseif ($relation_obj instanceof EE_Has_Many_Relation) {
//then we want to consider all of its currently-related things.
//if they're in this list, keep them
//if they're not in this list, remove them
//and lastly add all the new items
throw new EE_Error(sprintf(__('Automatic saving of related info across a "has many" relation is not yet supported', "event_espresso")));
} elseif ($relation_obj instanceof EE_HABTM_Relation) {
//delete everything NOT in this list
$normalized_input_value = $this->get_input_value($relation_name);
if ($normalized_input_value && is_array($normalized_input_value)) {
$where_query_params = array($relation_obj->get_other_model()->primary_key_name() => array('NOT_IN', $normalized_input_value));
} else {
$where_query_params = array();
}
$this->_model_object->_remove_relations($relation_name, $where_query_params);
foreach ($normalized_input_value as $id) {
$this->_model_object->_add_relation_to($id, $relation_name);
}
}
return TRUE;
}
示例4: prepare_where_conditions_for_querying
/**
* Takes the default query parameters, and traverses them, adding the model relation chain
* onto them (intelligently doesn't do that to logic query params like NOT, OR, and AND)
* @param array $where_conditions
* @param string $model_relation_chain
* @return array
* @throws \EE_Error
*/
public function prepare_where_conditions_for_querying($where_conditions, $model_relation_chain)
{
$where_conditions_with_model_relation_chain_prefixes = array();
if (!is_array($where_conditions)) {
$where_conditions = array();
}
foreach ($where_conditions as $key => $value) {
if (in_array($key, array('OR', 'AND', 'NOT')) || strpos($key, 'OR*') !== false || strpos($key, 'AND*') !== false || strpos($key, 'NOT*') !== false) {
$where_conditions_with_model_relation_chain_prefixes[$key] = $this->prepare_where_conditions_for_querying($value, $model_relation_chain);
} else {
if ($model_relation_chain != '' && $model_relation_chain[strlen($model_relation_chain) - 1] != '.') {
$model_relation_chain = $model_relation_chain . ".";
}
//check for the current user id place holder, and if present change it
if ($value === self::current_user_placeholder) {
$value = get_current_user_id();
}
//check for user field placeholder
if ($key == self::user_field_name_placeholder) {
if (!$this->_model->wp_user_field_name()) {
throw new EE_Error(sprintf(__('There is no foreign key to the WP_User model on model %s. Please either modify your default where conditions, add a _model_chain_to_wp_user onto the model, or a proper EE_WP_User_Field onto the model', 'event_espresso'), $this->_model->get_this_model_name()));
}
$key = $this->_model->wp_user_field_name();
}
$where_conditions_with_model_relation_chain_prefixes[$model_relation_chain . $key] = $value;
}
}
return $where_conditions_with_model_relation_chain_prefixes;
}
开发者ID:adrianjonmiller,项目名称:hearts-being-healed,代码行数:37,代码来源:EE_Default_Where_Conditions.strategy.php
示例5: __construct
protected function __construct($timezone = null)
{
$this->_tables = array('New_Addon_Thing' => new EE_Primary_Table('esp_new_addon_thing', 'NEW_ID'));
$this->_fields = array('New_Addon_Thing' => array('NEW_ID' => new EE_Primary_Key_Int_Field('NEW_ID', __("New Addon Thing ID", 'event_espresso')), 'NEW_name' => new EE_Plain_Text_Field('NEW_name', __('Name', 'event_espresso'), false), 'NEW_wp_user' => new EE_WP_User_Field('NEW_wp_user', __('Things Creator', 'event_espresso'), false)));
$this->_model_relations = array('Attendee' => new EE_Has_Many_Relation(), 'WP_User' => new EE_Belongs_To_Relation());
parent::__construct($timezone);
}
示例6: __construct
public function __construct($timezone = NULL)
{
$this->_tables = array('Person_Post' => new EE_Primary_Table('esp_people_to_post', 'PTP_ID'));
$this->_fields = array('Person_Post' => array('PTP_ID' => new EE_Primary_Key_Int_Field('PTP_ID', __('Person to Event Link ID', 'event_espresso')), 'PER_ID' => new EE_Foreign_Key_Int_Field('PER_ID', __('Person Primary ID', 'event_espresso'), false, 0, 'Person'), 'OBJ_ID' => new EE_Foreign_Key_Int_Field('OBJ_ID', __('Event ID', 'event_espresso'), false, 0, array('Event')), 'OBJ_type' => new EE_Any_Foreign_Model_Name_Field('OBJ_type', __('Model Person Related to', 'event_espresso'), false, 'Event', array('Event')), 'PER_OBJ_order' => new EE_Integer_Field('P2P_Order', __('Person to Event Order', 'event_Espresso'), false, 0), 'PT_ID' => new EE_Foreign_Key_Int_Field('PT_ID', __('People Type ID', 'event_espresso'), false, 0, 'Term_Taxonomy')));
$this->_model_relations = array('Person' => new EE_Belongs_To_Relation(), 'Event' => new EE_Belongs_To_Any_Relation(), 'Term_Taxonomy' => new EE_Belongs_to_Relation());
parent::__construct();
}
示例7: __construct
protected function __construct($timezone = NULL)
{
$this->singular_item = __('Registration Payment', 'event_espresso');
$this->plural_item = __('Registration Payments', 'event_espresso');
$this->_tables = array('Registration_Payment' => new EE_Primary_Table('esp_registration_payment', 'RPY_ID'));
$this->_fields = array('Registration_Payment' => array('RPY_ID' => new EE_Primary_Key_Int_Field('RPY_ID', __('Registration Payment ID', 'event_espresso')), 'REG_ID' => new EE_Foreign_Key_Int_Field('REG_ID', __('Registration ID', 'event_espresso'), false, 0, 'Registration'), 'PAY_ID' => new EE_Foreign_Key_Int_Field('PAY_ID', __('Payment ID', 'event_espresso'), true, null, 'Payment'), 'RPY_amount' => new EE_Money_Field('RPY_amount', __('Amount attributed to the registration', 'event_espresso'), false, 0)));
$this->_model_relations = array('Registration' => new EE_Belongs_To_Relation(), 'Payment' => new EE_Belongs_To_Relation());
parent::__construct($timezone);
}
示例8: __construct
/**
* private constructor to prevent direct creation
* @Constructor
* @access private
* @return void
*/
protected function __construct()
{
$this->singlular_item = __('Event Message Template', 'event_espresso');
$this->plural_item = __('Event Message Templates', 'event_espresso');
$this->_tables = array('Event_Message_Template' => new EE_Primary_Table('esp_event_message_template', 'EMT_ID'));
$this->_fields = array('Event_Message_Template' => array('EMT_ID' => new EE_Primary_Key_Int_Field('EMT_ID', __('Event Message Template ID', 'event_espresso')), 'EVT_ID' => new EE_Foreign_Key_Int_Field('EVT_ID', __('The ID to the Event', 'event_espresso'), false, 0, 'Event'), 'GRP_ID' => new EE_Foreign_Key_Int_Field('GRP_ID', __('The ID to the Message Template Group', 'event_espresso'), false, 0, 'Message_Template_Group')));
$this->_model_relations = array('Event' => new EE_Belongs_To_Relation(), 'Message_Template_Group' => new EE_Belongs_To_Relation());
parent::__construct();
}
示例9: __construct
/**
* constructor
*/
protected function __construct()
{
$this->singular_item = __('Answer', 'event_espresso');
$this->plural_item = __('Answers', 'event_espresso');
$this->_tables = array('Answer' => new EE_Primary_Table('esp_answer', 'ANS_ID'));
$this->_fields = array('Answer' => array('ANS_ID' => new EE_Primary_Key_Int_Field('ANS_ID', __('Answer ID', 'event_espresso')), 'REG_ID' => new EE_Foreign_Key_Int_Field('REG_ID', __('Registration ID', 'event_espresso'), false, 0, 'Registration'), 'QST_ID' => new EE_Foreign_Key_Int_Field('QST_ID', __('Question ID', 'event_espresso'), false, 0, 'Question'), 'ANS_value' => new EE_Maybe_Serialized_Text_Field('ANS_value', __('Answer Value', 'event_espresso'), false, '')));
$this->_model_relations = array('Registration' => new EE_Belongs_To_Relation(), 'Question' => new EE_Belongs_To_Relation());
parent::__construct();
}
示例10: __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)
{
$this->singular_item = __('Check-In', 'event_espresso');
$this->plural_item = __('Check-Ins', 'event_espresso');
$this->_tables = array('Checkin' => new EE_Primary_Table('esp_checkin', 'CHK_ID'));
$this->_fields = array('Checkin' => array('CHK_ID' => new EE_Primary_Key_Int_Field('CHK_ID', 'Check-in ID'), 'REG_ID' => new EE_Foreign_Key_Int_Field('REG_ID', 'Registration Id', false, 0, 'Registration'), 'DTT_ID' => new EE_Foreign_Key_Int_Field('DTT_ID', 'Datetime Id', false, 0, 'Datetime'), 'CHK_in' => new EE_Boolean_Field('CHK_in', 'Whether a person has checked in or checked out', false, true), 'CHK_timestamp' => new EE_Datetime_Field('CHK_timestamp', __('When the row was modified', 'event_espresso'), false, current_time('timestamp'), $timezone)));
$this->_model_relations = array('Registration' => new EE_Belongs_To_Relation(), 'Datetime' => new EE_Belongs_To_Relation());
parent::__construct($timezone);
}
示例11: __construct
protected function __construct()
{
$this->singular_item = __('Question Group to Question Link', 'event_espresso');
$this->plural_item = __('Question Group to Question Links', 'event_espresso');
$this->_tables = array('Question_Group_Question' => new EE_Primary_Table('esp_question_group_question', 'QGQ_ID'));
$this->_fields = array('Question_Group_Question' => array('QGQ_ID' => new EE_Primary_Key_Int_Field('QGQ_ID', __('Question Group to Question Link ID', 'event_espresso')), 'QSG_ID' => new EE_Foreign_Key_Int_Field('QSG_ID', __('Question Group ID', 'event_espresso'), false, 0, 'Question_Group'), 'QST_ID' => new EE_Foreign_Key_Int_Field('QST_ID', __('Question Id', 'event_espresso'), false, 0, 'Question'), 'QGQ_order' => new EE_Integer_Field('QGQ_order', __('Question Group Question Order', 'event_espresso'), false, 0)));
$this->_model_relations = array('Question_Group' => new EE_Belongs_To_Relation(), 'Question' => new EE_Belongs_To_Relation());
parent::__construct();
}
示例12: __construct
/**
* @return EEM_Status
*/
protected function __construct()
{
$this->singular_item = __('Status', 'event_espresso');
$this->plural_item = __('Stati', 'event_espresso');
$this->_tables = array('Status' => new EE_Primary_Table('esp_status', 'STS_ID'));
$this->_fields = array('Status' => array('STS_ID' => new EE_Primary_Key_String_Field('STS_ID', __('Status ID', 'event_espresso')), 'STS_code' => new EE_Plain_Text_Field('STS_code', __('Status Code', 'event_espresso'), false, ''), 'STS_type' => new EE_Enum_Text_Field('STS_type', __("Type", "event_espresso"), false, 'event', array('event' => __("Event", "event_espresso"), 'registration' => __("Registration", "event_espresso"), 'transaction' => __("Transaction", "event_espresso"), 'payment' => __("Payment", "event_espresso"), 'email' => __("Email", "event_espresso"))), 'STS_can_edit' => new EE_Boolean_Field('STS_can_edit', __('Editable?', 'event_espresso'), false), 'STS_desc' => new EE_Simple_HTML_Field('STS_desc', __("Description", "event_espresso"), false, ''), 'STS_open' => new EE_Boolean_Field('STS_open', __("Open?", "event_espresso"), false, false)));
$this->_model_relations = array('Registration' => new EE_Has_Many_Relation(), 'Transaction' => new EE_Has_Many_Relation(), 'Payment' => new EE_Has_Many_Relation());
parent::__construct();
}
示例13: __construct
protected function __construct()
{
$this->singular_item = __('Country', 'event_espresso');
$this->plural_item = __('Countries', 'event_espresso');
$this->_tables = array('Country' => new EE_Primary_Table('esp_country', 'CNT_ISO'));
$this->_fields = array('Country' => array('CNT_active' => new EE_Boolean_Field('CNT_active', __('Country Appears in Dropdown Select Lists', 'event_espresso'), false, true), 'CNT_ISO' => new EE_Primary_Key_String_Field('CNT_ISO', __('Country ISO Code', 'event_espresso')), 'CNT_ISO3' => new EE_All_Caps_Text_Field('CNT_ISO3', __('Country ISO3 Code', 'event_espresso'), false, ''), 'RGN_ID' => new EE_All_Caps_Text_Field('RGN_ID', __('Region ID', 'event_espresso'), false, 0), 'CNT_name' => new EE_Plain_Text_Field('CNT_name', __('Country Name', 'event_espresso'), false, ''), 'CNT_cur_code' => new EE_All_Caps_Text_Field('CNT_cur_code', __('Country Currency Code', 'event_espresso'), false), 'CNT_cur_single' => new EE_Plain_Text_Field('CNT_cur_single', __('Currency Name Singular', 'event_espresso'), false), 'CNT_cur_plural' => new EE_Plain_Text_Field('CNT_cur_plural', __('Currency Name Plural', 'event_espresso'), false), 'CNT_cur_sign' => new EE_Plain_Text_Field('CNT_cur_sign', __('Currency Sign', 'event_espresso'), false), 'CNT_cur_sign_b4' => new EE_Boolean_Field('CNT_cur_sign_b4', __('Currency Sign Before Number', 'event_espresso'), false, true), 'CNT_cur_dec_plc' => new EE_Integer_Field('CNT_cur_dec_plc', __('Currency Decimal Places', 'event_espresso'), false, 2), 'CNT_cur_dec_mrk' => new EE_Plain_Text_Field('CNT_cur_dec_mrk', __('Currency Decimal Mark', 'event_espresso'), false, '.'), 'CNT_cur_thsnds' => new EE_Plain_Text_Field('CNT_cur_thsnds', __('Currency Thousands Seperator', 'event_espresso'), false, ','), 'CNT_tel_code' => new EE_Plain_Text_Field('CNT_tel_code', __('Country Telephone Code', 'event_espresso'), false, ''), 'CNT_is_EU' => new EE_Boolean_Field('CNT_is_EU', __('Country is Member of EU', 'event_espresso'), false, false)));
$this->_model_relations = array('Attendee' => new EE_Has_Many_Relation(), 'State' => new EE_Has_Many_Relation(), 'Venue' => new EE_Has_Many_Relation());
parent::__construct();
}
示例14: __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)
{
$this->singular_item = __('Transaction', 'event_espresso');
$this->plural_item = __('Transactions', 'event_espresso');
$this->_tables = array('Transaction' => new EE_Primary_Table('esp_transaction', 'TXN_ID'));
$this->_fields = array('Transaction' => array('TXN_ID' => new EE_Primary_Key_Int_Field('TXN_ID', __('Transaction ID', 'event_espresso')), 'TXN_timestamp' => new EE_Datetime_Field('TXN_timestamp', __('date when transaction was created', 'event_espresso'), false, current_time('timestamp'), $timezone), 'TXN_total' => new EE_Money_Field('TXN_total', __('Total value of Transaction', 'event_espresso'), false, 0), 'TXN_paid' => new EE_Money_Field('TXN_paid', __('Amount paid towards transaction to date', 'event_espresso'), false, 0), 'STS_ID' => new EE_Foreign_Key_String_Field('STS_ID', __('Status ID', 'event_espresso'), false, EEM_Transaction::incomplete_status_code, 'Status'), 'TXN_session_data' => new EE_Serialized_Text_Field('TXN_session_data', __('Serialized session data', 'event_espresso'), true, ''), 'TXN_hash_salt' => new EE_Plain_Text_Field('TXN_hash_salt', __('Transaction Hash Salt', 'event_espresso'), true, '')));
$this->_model_relations = array('Registration' => new EE_Has_Many_Relation(), 'Payment' => new EE_Has_Many_Relation(), 'Status' => new EE_Belongs_To_Relation(), 'Line_Item' => new EE_Has_Many_Relation(false));
parent::__construct($timezone);
}
示例15: __construct
protected function __construct()
{
$this->singular_item = __('State/Province', 'event_espresso');
$this->plural_item = __('States/Provinces', 'event_espresso');
$this->_tables = array('State' => new EE_Primary_Table('esp_state', 'STA_ID'));
$this->_fields = array('State' => array('STA_ID' => new EE_Primary_Key_Int_Field('STA_ID', __('State ID', 'event_espresso')), 'CNT_ISO' => new EE_Foreign_Key_String_Field('CNT_ISO', __('Country ISO Code', 'event_espresso'), false, NULL, 'Country'), 'STA_abbrev' => new EE_Plain_Text_Field('STA_abbrev', __('State Abbreviation', 'event_espresso'), false, ''), 'STA_name' => new EE_Plain_Text_Field('STA_name', __('State Name', 'event_espresso'), false, ''), 'STA_active' => new EE_Boolean_Field('STA_active', __("State Active Flag", "event_espresso"), false, false)));
$this->_model_relations = array('Attendee' => new EE_Has_Many_Relation(), 'Country' => new EE_Belongs_To_Relation(), 'Venue' => new EE_Has_Many_Relation());
parent::__construct();
}