本文整理汇总了PHP中MetaModel::Init_DefineState方法的典型用法代码示例。如果您正苦于以下问题:PHP MetaModel::Init_DefineState方法的具体用法?PHP MetaModel::Init_DefineState怎么用?PHP MetaModel::Init_DefineState使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MetaModel
的用法示例。
在下文中一共展示了MetaModel::Init_DefineState方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Init
public static function Init()
{
$aParams = array('category' => 'bizmodel,searchable,changemgmt', 'key_type' => 'autoincrement', 'name_attcode' => 'ref', 'state_attcode' => 'status', 'reconc_keys' => array('ref'), 'db_table' => 'ticket_change', 'db_key_field' => 'id', 'db_finalclass_field' => '', 'icon' => utils::GetAbsoluteUrlModulesRoot() . 'itop-change-mgmt/images/change.png', 'order_by_default' => array('ref' => false));
MetaModel::Init_Params($aParams);
MetaModel::Init_InheritAttributes();
MetaModel::Init_AddAttribute(new AttributeEnum("status", array("allowed_values" => new ValueSetEnum("new,assigned,planned,approved,closed,rejected"), "display_style" => 'list', "sql" => 'status', "default_value" => 'new', "is_null_allowed" => true, "depends_on" => array(), "always_load_in_tables" => false)));
MetaModel::Init_AddAttribute(new AttributeEnum("category", array("allowed_values" => new ValueSetEnum("hardware,software,system,network,application,other"), "display_style" => 'list', "sql" => 'category', "default_value" => 'hardware', "is_null_allowed" => true, "depends_on" => array(), "always_load_in_tables" => false)));
MetaModel::Init_AddAttribute(new AttributeText("reject_reason", array("allowed_values" => null, "sql" => 'reject_reason', "default_value" => '', "is_null_allowed" => true, "depends_on" => array(), "always_load_in_tables" => false)));
MetaModel::Init_AddAttribute(new AttributeExternalKey("changemanager_id", array("targetclass" => 'Person', "allowed_values" => null, "sql" => 'changemanager_id', "is_null_allowed" => true, "on_target_delete" => DEL_MANUAL, "depends_on" => array(), "display_style" => 'select', "always_load_in_tables" => false)));
MetaModel::Init_AddAttribute(new AttributeExternalField("changemanager_email", array("allowed_values" => null, "extkey_attcode" => 'changemanager_id', "target_attcode" => 'email', "always_load_in_tables" => false)));
MetaModel::Init_AddAttribute(new AttributeExternalKey("parent_id", array("targetclass" => 'Change', "allowed_values" => new ValueSetObjects("SELECT Change WHERE id != :this->id"), "sql" => 'parent_id', "is_null_allowed" => true, "on_target_delete" => DEL_MANUAL, "depends_on" => array(), "display_style" => 'select', "always_load_in_tables" => false)));
MetaModel::Init_AddAttribute(new AttributeExternalField("parent_name", array("allowed_values" => null, "extkey_attcode" => 'parent_id', "target_attcode" => 'ref', "always_load_in_tables" => false)));
MetaModel::Init_AddAttribute(new AttributeDateTime("creation_date", array("allowed_values" => null, "sql" => 'creation_date', "default_value" => '', "is_null_allowed" => true, "depends_on" => array(), "always_load_in_tables" => false)));
MetaModel::Init_AddAttribute(new AttributeDateTime("approval_date", array("allowed_values" => null, "sql" => 'approval_date', "default_value" => '', "is_null_allowed" => true, "depends_on" => array(), "always_load_in_tables" => false)));
MetaModel::Init_AddAttribute(new AttributeText("fallback_plan", array("allowed_values" => null, "sql" => 'fallback_plan', "default_value" => '', "is_null_allowed" => true, "depends_on" => array(), "always_load_in_tables" => false)));
MetaModel::Init_AddAttribute(new AttributeEnum("outage", array("allowed_values" => new ValueSetEnum("yes,no"), "display_style" => 'list', "sql" => 'outage', "default_value" => 'no', "is_null_allowed" => false, "depends_on" => array(), "always_load_in_tables" => false)));
MetaModel::Init_AddAttribute(new AttributeLinkedSet("related_request_list", array("linked_class" => 'UserRequest', "ext_key_to_me" => 'parent_change_id', "count_min" => 0, "count_max" => 0, "edit_mode" => LINKSET_EDITMODE_ADDREMOVE, "allowed_values" => null, "depends_on" => array(), "always_load_in_tables" => false)));
MetaModel::Init_AddAttribute(new AttributeLinkedSet("related_incident_list", array("linked_class" => 'Incident', "ext_key_to_me" => 'parent_change_id', "count_min" => 0, "count_max" => 0, "edit_mode" => LINKSET_EDITMODE_ADDREMOVE, "allowed_values" => null, "depends_on" => array(), "always_load_in_tables" => false)));
MetaModel::Init_AddAttribute(new AttributeLinkedSet("related_problems_list", array("linked_class" => 'Problem', "ext_key_to_me" => 'related_change_id', "count_min" => 0, "count_max" => 0, "edit_mode" => LINKSET_EDITMODE_ADDREMOVE, "allowed_values" => null, "depends_on" => array(), "always_load_in_tables" => false)));
MetaModel::Init_AddAttribute(new AttributeLinkedSet("child_changes_list", array("linked_class" => 'Change', "ext_key_to_me" => 'parent_id', "count_min" => 0, "count_max" => 0, "edit_mode" => LINKSET_EDITMODE_ADDREMOVE, "allowed_values" => new ValueSetObjects("SELECT Change WHERE id != :this->id"), "depends_on" => array(), "always_load_in_tables" => false)));
// Lifecycle (status attribute: status)
//
MetaModel::Init_DefineStimulus(new StimulusUserAction("ev_assign", array()));
MetaModel::Init_DefineStimulus(new StimulusUserAction("ev_plan", array()));
MetaModel::Init_DefineStimulus(new StimulusUserAction("ev_reject", array()));
MetaModel::Init_DefineStimulus(new StimulusUserAction("ev_reopen", array()));
MetaModel::Init_DefineStimulus(new StimulusUserAction("ev_approve", array()));
MetaModel::Init_DefineStimulus(new StimulusUserAction("ev_finish", array()));
MetaModel::Init_DefineState("new", array("attribute_inherit" => '', "attribute_list" => array('ref' => OPT_ATT_READONLY, 'org_id' => OPT_ATT_MANDATORY, 'title' => OPT_ATT_MANDATORY, 'description' => OPT_ATT_MANDATORY, 'last_update' => OPT_ATT_READONLY, 'close_date' => OPT_ATT_HIDDEN, 'reject_reason' => OPT_ATT_HIDDEN, 'creation_date' => OPT_ATT_READONLY, 'approval_date' => OPT_ATT_HIDDEN, 'caller_id' => OPT_ATT_MANDATORY, 'team_id' => OPT_ATT_HIDDEN, 'agent_id' => OPT_ATT_HIDDEN, 'changemanager_id' => OPT_ATT_HIDDEN, 'outage' => OPT_ATT_HIDDEN)));
MetaModel::Init_DefineTransition("new", "ev_assign", array("target_state" => "assigned", "actions" => array(), "user_restriction" => null));
MetaModel::Init_DefineState("assigned", array("attribute_inherit" => 'new', "attribute_list" => array('team_id' => OPT_ATT_MANDATORY | OPT_ATT_MUSTPROMPT, 'agent_id' => OPT_ATT_MANDATORY | OPT_ATT_MUSTPROMPT, 'changemanager_id' => OPT_ATT_MANDATORY | OPT_ATT_MUSTPROMPT, 'caller_id' => OPT_ATT_NORMAL)));
MetaModel::Init_DefineTransition("assigned", "ev_plan", array("target_state" => "planned", "actions" => array(), "user_restriction" => null));
MetaModel::Init_DefineState("planned", array("attribute_inherit" => 'assigned', "attribute_list" => array('start_date' => OPT_ATT_MANDATORY | OPT_ATT_MUSTPROMPT, 'end_date' => OPT_ATT_MANDATORY | OPT_ATT_MUSTPROMPT, 'fallback_plan' => OPT_ATT_MANDATORY | OPT_ATT_MUSTPROMPT, 'caller_id' => OPT_ATT_MANDATORY, 'outage' => OPT_ATT_MANDATORY | OPT_ATT_MUSTPROMPT)));
MetaModel::Init_DefineTransition("planned", "ev_reject", array("target_state" => "rejected", "actions" => array(), "user_restriction" => null));
MetaModel::Init_DefineTransition("planned", "ev_approve", array("target_state" => "approved", "actions" => array(array('verb' => 'SetCurrentDate', 'params' => array(array('type' => 'attcode', 'value' => "approval_date"))), array('verb' => 'Reset', 'params' => array(array('type' => 'attcode', 'value' => "reject_reason")))), "user_restriction" => null));
MetaModel::Init_DefineState("rejected", array("attribute_inherit" => 'assigned', 'highlight' => array('code' => 'rejected'), "attribute_list" => array('start_date' => OPT_ATT_READONLY, 'end_date' => OPT_ATT_READONLY, 'private_log' => OPT_ATT_READONLY, 'caller_id' => OPT_ATT_READONLY, 'fallback_plan' => OPT_ATT_READONLY, 'category' => OPT_ATT_READONLY, 'parent_id' => OPT_ATT_READONLY, 'org_id' => OPT_ATT_READONLY, 'title' => OPT_ATT_READONLY, 'description' => OPT_ATT_READONLY, 'reject_reason' => OPT_ATT_MANDATORY | OPT_ATT_MUSTPROMPT, 'approval_date' => OPT_ATT_READONLY, 'team_id' => OPT_ATT_READONLY, 'agent_id' => OPT_ATT_READONLY, 'changemanager_id' => OPT_ATT_READONLY, 'outage' => OPT_ATT_READONLY)));
MetaModel::Init_DefineTransition("rejected", "ev_reopen", array("target_state" => "assigned", "actions" => array(), "user_restriction" => null));
MetaModel::Init_DefineState("approved", array("attribute_inherit" => 'planned', 'highlight' => array('code' => 'approved'), "attribute_list" => array('private_log' => OPT_ATT_NORMAL, 'category' => OPT_ATT_NORMAL, 'parent_id' => OPT_ATT_NORMAL, 'org_id' => OPT_ATT_READONLY, 'title' => OPT_ATT_READONLY, 'description' => OPT_ATT_READONLY, 'start_date' => OPT_ATT_READONLY, 'end_date' => OPT_ATT_READONLY, 'reject_reason' => OPT_ATT_READONLY, 'creation_date' => OPT_ATT_HIDDEN, 'approval_date' => OPT_ATT_READONLY, 'caller_id' => OPT_ATT_READONLY, 'team_id' => OPT_ATT_READONLY, 'agent_id' => OPT_ATT_READONLY, 'changemanager_id' => OPT_ATT_READONLY, 'fallback_plan' => OPT_ATT_NORMAL, 'outage' => OPT_ATT_READONLY)));
MetaModel::Init_DefineTransition("approved", "ev_finish", array("target_state" => "closed", "actions" => array(array('verb' => 'SetCurrentDate', 'params' => array(array('type' => 'attcode', 'value' => "close_date")))), "user_restriction" => null));
MetaModel::Init_DefineState("closed", array("attribute_inherit" => 'approved', 'highlight' => array('code' => 'closed'), "attribute_list" => array('close_date' => OPT_ATT_READONLY, 'creation_date' => OPT_ATT_READONLY, 'private_log' => OPT_ATT_READONLY, 'fallback_plan' => OPT_ATT_READONLY, 'category' => OPT_ATT_READONLY, 'parent_id' => OPT_ATT_READONLY)));
// Higlight Scale
MetaModel::Init_DefineHighlightScale(array('approved' => array('rank' => 1, 'color' => HILIGHT_CLASS_NONE, 'icon' => utils::GetAbsoluteUrlModulesRoot() . 'itop-change-mgmt/images/change-approved.png'), 'rejected' => array('rank' => 2, 'color' => HILIGHT_CLASS_NONE, 'icon' => utils::GetAbsoluteUrlModulesRoot() . 'itop-change-mgmt/images/change-rejected.png'), 'closed' => array('rank' => 3, 'color' => HILIGHT_CLASS_NONE, 'icon' => utils::GetAbsoluteUrlModulesRoot() . 'itop-change-mgmt/images/change-closed.png')));
MetaModel::Init_SetZListItems('details', array(0 => 'functionalcis_list', 1 => 'contacts_list', 2 => 'workorders_list', 3 => 'related_request_list', 4 => 'related_incident_list', 5 => 'related_problems_list', 6 => 'child_changes_list', 'col:col1' => array('fieldset:Ticket:baseinfo' => array(0 => 'ref', 1 => 'org_id', 2 => 'status', 3 => 'title', 4 => 'description'), 'fieldset:Ticket:contact' => array(0 => 'caller_id', 1 => 'team_id', 2 => 'agent_id', 3 => 'changemanager_id')), 'col:col2' => array('fieldset:Ticket:resolution' => array(0 => 'category', 1 => 'outage', 2 => 'reject_reason', 3 => 'fallback_plan'), 'fieldset:Ticket:relation' => array(0 => 'parent_id')), 'col:col3' => array('fieldset:Ticket:date' => array(0 => 'creation_date', 1 => 'start_date', 2 => 'end_date', 3 => 'last_update', 4 => 'approval_date', 5 => 'close_date'))));
MetaModel::Init_SetZListItems('standard_search', array(0 => 'ref', 1 => 'title', 2 => 'org_id', 3 => 'status', 4 => 'start_date', 5 => 'end_date', 6 => 'creation_date', 7 => 'last_update', 8 => 'close_date', 9 => 'team_id', 10 => 'agent_id', 11 => 'changemanager_id'));
MetaModel::Init_SetZListItems('list', array(0 => 'title', 1 => 'org_id', 2 => 'start_date', 3 => 'end_date', 4 => 'status', 5 => 'category', 6 => 'agent_id'));
}
示例2: Init
public static function Init()
{
$aParams = array('category' => 'bizmodel,searchable,problemmgmt', 'key_type' => 'autoincrement', 'name_attcode' => 'ref', 'state_attcode' => 'status', 'reconc_keys' => array('ref'), 'db_table' => 'ticket_problem', 'db_key_field' => 'id', 'db_finalclass_field' => '', 'icon' => utils::GetAbsoluteUrlModulesRoot() . 'itop-problem-mgmt/images/problem.png', 'order_by_default' => array('ref' => false));
MetaModel::Init_Params($aParams);
MetaModel::Init_InheritAttributes();
MetaModel::Init_AddAttribute(new AttributeEnum("status", array("allowed_values" => new ValueSetEnum("new,assigned,resolved,closed"), "display_style" => 'list', "sql" => 'status', "default_value" => 'new', "is_null_allowed" => false, "depends_on" => array(), "always_load_in_tables" => false)));
MetaModel::Init_AddAttribute(new AttributeExternalKey("service_id", array("targetclass" => 'Service', "allowed_values" => new ValueSetObjects("SELECT Service"), "sql" => 'service_id', "is_null_allowed" => true, "on_target_delete" => DEL_MANUAL, "depends_on" => array('org_id'), "allow_target_creation" => false, "display_style" => 'select', "always_load_in_tables" => false)));
MetaModel::Init_AddAttribute(new AttributeExternalField("service_name", array("allowed_values" => null, "extkey_attcode" => 'service_id', "target_attcode" => 'name', "always_load_in_tables" => false)));
MetaModel::Init_AddAttribute(new AttributeExternalKey("servicesubcategory_id", array("targetclass" => 'ServiceSubcategory', "allowed_values" => new ValueSetObjects("SELECT ServiceSubcategory WHERE service_id = :this->service_id"), "sql" => 'servicesubcategory_id', "is_null_allowed" => true, "on_target_delete" => DEL_MANUAL, "depends_on" => array('service_id'), "allow_target_creation" => false, "display_style" => 'select', "always_load_in_tables" => false)));
MetaModel::Init_AddAttribute(new AttributeExternalField("servicesubcategory_name", array("allowed_values" => null, "extkey_attcode" => 'servicesubcategory_id', "target_attcode" => 'name', "always_load_in_tables" => false)));
MetaModel::Init_AddAttribute(new AttributeString("product", array("allowed_values" => null, "sql" => 'product', "default_value" => '', "is_null_allowed" => true, "depends_on" => array(), "always_load_in_tables" => false)));
MetaModel::Init_AddAttribute(new AttributeEnum("impact", array("allowed_values" => new ValueSetEnum("1,2,3"), "display_style" => 'list', "sql" => 'impact', "default_value" => '1', "is_null_allowed" => false, "depends_on" => array(), "always_load_in_tables" => false)));
MetaModel::Init_AddAttribute(new AttributeEnum("urgency", array("allowed_values" => new ValueSetEnum("1,2,3,4"), "display_style" => 'list', "sql" => 'urgency', "default_value" => '1', "is_null_allowed" => false, "depends_on" => array(), "always_load_in_tables" => false)));
MetaModel::Init_AddAttribute(new AttributeEnum("priority", array("allowed_values" => new ValueSetEnum("1,2,3,4"), "display_style" => 'list', "sql" => 'priority', "default_value" => '1', "is_null_allowed" => false, "depends_on" => array(), "always_load_in_tables" => false)));
MetaModel::Init_AddAttribute(new AttributeExternalKey("related_change_id", array("targetclass" => 'Change', "allowed_values" => new ValueSetObjects("SELECT Change WHERE status != \"closed\""), "sql" => 'related_change_id', "is_null_allowed" => true, "on_target_delete" => DEL_MANUAL, "depends_on" => array(), "display_style" => 'select', "always_load_in_tables" => false)));
MetaModel::Init_AddAttribute(new AttributeExternalField("related_change_ref", array("allowed_values" => null, "extkey_attcode" => 'related_change_id', "target_attcode" => 'ref', "always_load_in_tables" => false)));
MetaModel::Init_AddAttribute(new AttributeDateTime("assignment_date", array("allowed_values" => null, "sql" => 'assignment_date', "default_value" => '', "is_null_allowed" => true, "depends_on" => array(), "always_load_in_tables" => false)));
MetaModel::Init_AddAttribute(new AttributeDateTime("resolution_date", array("allowed_values" => null, "sql" => 'resolution_date', "default_value" => '', "is_null_allowed" => true, "depends_on" => array(), "always_load_in_tables" => false)));
MetaModel::Init_AddAttribute(new AttributeLinkedSet("knownerrors_list", array("linked_class" => 'KnownError', "ext_key_to_me" => 'problem_id', "count_min" => 0, "count_max" => 0, "edit_mode" => LINKSET_EDITMODE_ADDONLY, "allowed_values" => null, "depends_on" => array(), "always_load_in_tables" => false)));
MetaModel::Init_AddAttribute(new AttributeLinkedSet("related_request_list", array("linked_class" => 'UserRequest', "ext_key_to_me" => 'parent_problem_id', "count_min" => 0, "count_max" => 0, "edit_mode" => LINKSET_EDITMODE_ADDREMOVE, "allowed_values" => null, "depends_on" => array(), "always_load_in_tables" => false)));
// Lifecycle (status attribute: status)
//
MetaModel::Init_DefineStimulus(new StimulusUserAction("ev_assign", array()));
MetaModel::Init_DefineStimulus(new StimulusUserAction("ev_reassign", array()));
MetaModel::Init_DefineStimulus(new StimulusUserAction("ev_resolve", array()));
MetaModel::Init_DefineStimulus(new StimulusUserAction("ev_close", array()));
MetaModel::Init_DefineState("new", array("attribute_inherit" => '', "attribute_list" => array('ref' => OPT_ATT_READONLY, 'org_id' => OPT_ATT_MUSTCHANGE, 'team_id' => OPT_ATT_HIDDEN, 'agent_id' => OPT_ATT_HIDDEN, 'description' => OPT_ATT_MUSTCHANGE, 'start_date' => OPT_ATT_READONLY, 'last_update' => OPT_ATT_READONLY, 'close_date' => OPT_ATT_HIDDEN, 'impact' => OPT_ATT_MUSTCHANGE, 'urgency' => OPT_ATT_MUSTCHANGE, 'priority' => OPT_ATT_READONLY, 'assignment_date' => OPT_ATT_HIDDEN, 'resolution_date' => OPT_ATT_HIDDEN)));
MetaModel::Init_DefineTransition("new", "ev_assign", array("target_state" => "assigned", "actions" => array('SetAssignedDate'), "user_restriction" => null));
MetaModel::Init_DefineState("assigned", array("attribute_inherit" => '', "attribute_list" => array('ref' => OPT_ATT_READONLY, 'team_id' => OPT_ATT_MANDATORY | OPT_ATT_MUSTPROMPT, 'agent_id' => OPT_ATT_MANDATORY | OPT_ATT_MUSTPROMPT, 'start_date' => OPT_ATT_READONLY, 'last_update' => OPT_ATT_READONLY, 'close_date' => OPT_ATT_HIDDEN, 'priority' => OPT_ATT_READONLY, 'assignment_date' => OPT_ATT_READONLY, 'resolution_date' => OPT_ATT_HIDDEN)));
MetaModel::Init_DefineTransition("assigned", "ev_reassign", array("target_state" => "assigned", "actions" => array(), "user_restriction" => null));
MetaModel::Init_DefineTransition("assigned", "ev_resolve", array("target_state" => "resolved", "actions" => array('SetResolveDate'), "user_restriction" => null));
MetaModel::Init_DefineState("resolved", array("attribute_inherit" => '', "attribute_list" => array('ref' => OPT_ATT_READONLY, 'org_id' => OPT_ATT_READONLY, 'team_id' => OPT_ATT_READONLY, 'agent_id' => OPT_ATT_READONLY, 'caller_id' => OPT_ATT_READONLY, 'title' => OPT_ATT_READONLY, 'description' => OPT_ATT_READONLY, 'start_date' => OPT_ATT_READONLY, 'last_update' => OPT_ATT_READONLY, 'close_date' => OPT_ATT_HIDDEN, 'service_id' => OPT_ATT_MANDATORY, 'servicesubcategory_id' => OPT_ATT_MUSTPROMPT, 'product' => OPT_ATT_MUSTPROMPT, 'impact' => OPT_ATT_READONLY, 'urgency' => OPT_ATT_READONLY, 'priority' => OPT_ATT_READONLY, 'assignment_date' => OPT_ATT_READONLY, 'resolution_date' => OPT_ATT_HIDDEN)));
MetaModel::Init_DefineTransition("resolved", "ev_reassign", array("target_state" => "assigned", "actions" => array(), "user_restriction" => null));
MetaModel::Init_DefineTransition("resolved", "ev_close", array("target_state" => "closed", "actions" => array('SetClosureDate'), "user_restriction" => null));
MetaModel::Init_DefineState("closed", array("attribute_inherit" => '', "attribute_list" => array('ref' => OPT_ATT_READONLY, 'org_id' => OPT_ATT_READONLY, 'team_id' => OPT_ATT_READONLY, 'agent_id' => OPT_ATT_READONLY, 'caller_id' => OPT_ATT_READONLY, 'title' => OPT_ATT_READONLY, 'description' => OPT_ATT_READONLY, 'start_date' => OPT_ATT_READONLY, 'last_update' => OPT_ATT_READONLY, 'close_date' => OPT_ATT_READONLY, 'private_log' => OPT_ATT_READONLY, 'service_id' => OPT_ATT_READONLY, 'servicesubcategory_id' => OPT_ATT_READONLY, 'product' => OPT_ATT_READONLY, 'impact' => OPT_ATT_READONLY, 'urgency' => OPT_ATT_READONLY, 'priority' => OPT_ATT_READONLY, 'assignment_date' => OPT_ATT_READONLY, 'resolution_date' => OPT_ATT_HIDDEN, 'related_change_id' => OPT_ATT_READONLY)));
MetaModel::Init_SetZListItems('details', array(0 => 'functionalcis_list', 1 => 'contacts_list', 2 => 'knownerrors_list', 3 => 'workorders_list', 4 => 'related_request_list', 'col:col1' => array('fieldset:Ticket:baseinfo' => array(0 => 'ref', 1 => 'title', 2 => 'org_id', 3 => 'status', 4 => 'priority', 5 => 'service_id', 6 => 'servicesubcategory_id', 7 => 'product'), 'fieldset:Ticket:moreinfo' => array(0 => 'impact', 1 => 'urgency', 2 => 'description')), 'col:col2' => array('fieldset:Ticket:date' => array(0 => 'start_date', 1 => 'last_update', 2 => 'assignment_date', 3 => 'resolution_date', 4 => 'close_date'), 'fieldset:Ticket:contact' => array(0 => 'caller_id', 1 => 'team_id', 2 => 'agent_id'), 'fieldset:Ticket:relation' => array(0 => 'related_change_id'))));
MetaModel::Init_SetZListItems('standard_search', array(0 => 'ref', 1 => 'title', 2 => 'org_id', 3 => 'start_date', 4 => 'status', 5 => 'service_id', 6 => 'servicesubcategory_id', 7 => 'product', 8 => 'impact', 9 => 'urgency', 10 => 'priority', 11 => 'caller_id', 12 => 'team_id', 13 => 'agent_id', 14 => 'close_date'));
MetaModel::Init_SetZListItems('list', array(0 => 'title', 1 => 'org_id', 2 => 'start_date', 3 => 'status', 4 => 'service_id', 5 => 'priority'));
}
示例3: Init
public static function Init()
{
$aParams = array('category' => 'bizmodel,searchable,changemgmt', 'key_type' => 'autoincrement', 'name_attcode' => 'ref', 'state_attcode' => 'status', 'reconc_keys' => array('ref'), 'db_table' => 'change_emergency', 'db_key_field' => 'id', 'db_finalclass_field' => '', 'icon' => utils::GetAbsoluteUrlModulesRoot() . 'itop-change-mgmt-itil/images/change.png', 'order_by_default' => array('ref' => false));
MetaModel::Init_Params($aParams);
MetaModel::Init_InheritAttributes();
// Lifecycle (status attribute: status)
//
MetaModel::Init_DefineStimulus(new StimulusUserAction("ev_assign", array()));
MetaModel::Init_DefineStimulus(new StimulusUserAction("ev_reopen", array()));
MetaModel::Init_DefineStimulus(new StimulusUserAction("ev_plan", array()));
MetaModel::Init_DefineStimulus(new StimulusUserAction("ev_approve", array()));
MetaModel::Init_DefineStimulus(new StimulusUserAction("ev_replan", array()));
MetaModel::Init_DefineStimulus(new StimulusUserAction("ev_notapprove", array()));
MetaModel::Init_DefineStimulus(new StimulusUserAction("ev_implement", array()));
MetaModel::Init_DefineStimulus(new StimulusUserAction("ev_monitor", array()));
MetaModel::Init_DefineStimulus(new StimulusUserAction("ev_finish", array()));
MetaModel::Init_DefineState("new", array("attribute_inherit" => '', "attribute_list" => array('ref' => OPT_ATT_READONLY, 'agent_id' => OPT_ATT_HIDDEN, 'team_id' => OPT_ATT_HIDDEN, 'title' => OPT_ATT_MANDATORY, 'start_date' => OPT_ATT_HIDDEN, 'end_date' => OPT_ATT_HIDDEN, 'last_update' => OPT_ATT_READONLY, 'close_date' => OPT_ATT_HIDDEN, 'reason' => OPT_ATT_HIDDEN, 'requestor_id' => OPT_ATT_MANDATORY, 'creation_date' => OPT_ATT_READONLY, 'impact' => OPT_ATT_HIDDEN, 'supervisor_group_id' => OPT_ATT_HIDDEN, 'supervisor_id' => OPT_ATT_HIDDEN, 'manager_group_id' => OPT_ATT_HIDDEN, 'manager_id' => OPT_ATT_HIDDEN, 'outage' => OPT_ATT_HIDDEN, 'fallback' => OPT_ATT_HIDDEN, 'approval_date' => OPT_ATT_HIDDEN, 'approval_comment' => OPT_ATT_HIDDEN)));
MetaModel::Init_DefineTransition("new", "ev_assign", array("target_state" => "assigned", "actions" => array(), "user_restriction" => null));
MetaModel::Init_DefineState("validated", array("attribute_inherit" => '', "attribute_list" => array('ref' => OPT_ATT_READONLY, 'agent_id' => OPT_ATT_HIDDEN, 'title' => OPT_ATT_MANDATORY, 'description' => OPT_ATT_READONLY, 'start_date' => OPT_ATT_HIDDEN, 'end_date' => OPT_ATT_HIDDEN, 'last_update' => OPT_ATT_READONLY, 'close_date' => OPT_ATT_HIDDEN, 'reason' => OPT_ATT_READONLY, 'requestor_id' => OPT_ATT_READONLY, 'creation_date' => OPT_ATT_READONLY, 'impact' => OPT_ATT_HIDDEN, 'team_id' => OPT_ATT_MANDATORY | OPT_ATT_MUSTPROMPT, 'supervisor_group_id' => OPT_ATT_MANDATORY | OPT_ATT_MUSTPROMPT, 'supervisor_id' => OPT_ATT_HIDDEN, 'manager_group_id' => OPT_ATT_MANDATORY | OPT_ATT_MUSTPROMPT, 'manager_id' => OPT_ATT_HIDDEN, 'outage' => OPT_ATT_HIDDEN, 'fallback' => OPT_ATT_HIDDEN, 'approval_date' => OPT_ATT_HIDDEN, 'approval_comment' => OPT_ATT_HIDDEN)));
MetaModel::Init_DefineState("rejected", array("attribute_inherit" => '', "attribute_list" => array('ref' => OPT_ATT_READONLY, 'agent_id' => OPT_ATT_HIDDEN, 'title' => OPT_ATT_MANDATORY, 'start_date' => OPT_ATT_HIDDEN, 'end_date' => OPT_ATT_HIDDEN, 'last_update' => OPT_ATT_READONLY, 'close_date' => OPT_ATT_HIDDEN, 'reason' => OPT_ATT_MANDATORY | OPT_ATT_MUSTPROMPT, 'requestor_id' => OPT_ATT_MANDATORY, 'creation_date' => OPT_ATT_READONLY, 'impact' => OPT_ATT_HIDDEN, 'supervisor_group_id' => OPT_ATT_HIDDEN, 'supervisor_id' => OPT_ATT_HIDDEN, 'manager_group_id' => OPT_ATT_HIDDEN, 'manager_id' => OPT_ATT_HIDDEN, 'outage' => OPT_ATT_HIDDEN, 'fallback' => OPT_ATT_HIDDEN, 'approval_date' => OPT_ATT_HIDDEN, 'approval_comment' => OPT_ATT_HIDDEN)));
MetaModel::Init_DefineState("assigned", array("attribute_inherit" => '', "attribute_list" => array('ref' => OPT_ATT_READONLY, 'agent_id' => OPT_ATT_MANDATORY | OPT_ATT_MUSTPROMPT, 'team_id' => OPT_ATT_MANDATORY | OPT_ATT_MUSTPROMPT, 'title' => OPT_ATT_MANDATORY, 'description' => OPT_ATT_READONLY, 'start_date' => OPT_ATT_HIDDEN, 'end_date' => OPT_ATT_HIDDEN, 'last_update' => OPT_ATT_READONLY, 'close_date' => OPT_ATT_HIDDEN, 'reason' => OPT_ATT_READONLY, 'requestor_id' => OPT_ATT_READONLY, 'creation_date' => OPT_ATT_READONLY, 'impact' => OPT_ATT_HIDDEN, 'supervisor_group_id' => OPT_ATT_MANDATORY, 'supervisor_id' => OPT_ATT_MANDATORY | OPT_ATT_MUSTPROMPT, 'manager_group_id' => OPT_ATT_MANDATORY, 'manager_id' => OPT_ATT_MANDATORY | OPT_ATT_MUSTPROMPT, 'outage' => OPT_ATT_HIDDEN, 'fallback' => OPT_ATT_HIDDEN, 'approval_date' => OPT_ATT_HIDDEN, 'approval_comment' => OPT_ATT_HIDDEN)));
MetaModel::Init_DefineTransition("assigned", "ev_plan", array("target_state" => "plannedscheduled", "actions" => array(), "user_restriction" => null));
MetaModel::Init_DefineState("plannedscheduled", array("attribute_inherit" => '', "attribute_list" => array('ref' => OPT_ATT_READONLY, 'org_id' => OPT_ATT_READONLY, 'agent_id' => OPT_ATT_MANDATORY, 'team_id' => OPT_ATT_MANDATORY, 'title' => OPT_ATT_MANDATORY, 'description' => OPT_ATT_READONLY, 'start_date' => OPT_ATT_MANDATORY | OPT_ATT_MUSTPROMPT, 'end_date' => OPT_ATT_MANDATORY | OPT_ATT_MUSTPROMPT, 'last_update' => OPT_ATT_READONLY, 'close_date' => OPT_ATT_HIDDEN, 'reason' => OPT_ATT_READONLY, 'requestor_id' => OPT_ATT_READONLY, 'creation_date' => OPT_ATT_READONLY, 'impact' => OPT_ATT_MANDATORY | OPT_ATT_MUSTPROMPT, 'supervisor_group_id' => OPT_ATT_MANDATORY, 'supervisor_id' => OPT_ATT_MANDATORY, 'manager_group_id' => OPT_ATT_MANDATORY, 'manager_id' => OPT_ATT_MANDATORY, 'outage' => OPT_ATT_MANDATORY | OPT_ATT_MUSTPROMPT, 'fallback' => OPT_ATT_MANDATORY | OPT_ATT_MUSTPROMPT, 'approval_date' => OPT_ATT_HIDDEN, 'approval_comment' => OPT_ATT_HIDDEN)));
MetaModel::Init_DefineTransition("plannedscheduled", "ev_approve", array("target_state" => "approved", "actions" => array('ResetRejectReason'), "user_restriction" => null));
MetaModel::Init_DefineTransition("plannedscheduled", "ev_notapprove", array("target_state" => "notapproved", "actions" => array(), "user_restriction" => null));
MetaModel::Init_DefineState("approved", array("attribute_inherit" => '', "attribute_list" => array('ref' => OPT_ATT_READONLY, 'org_id' => OPT_ATT_READONLY, 'agent_id' => OPT_ATT_MANDATORY, 'team_id' => OPT_ATT_MANDATORY, 'title' => OPT_ATT_MANDATORY, 'description' => OPT_ATT_READONLY, 'start_date' => OPT_ATT_MANDATORY, 'end_date' => OPT_ATT_MANDATORY, 'last_update' => OPT_ATT_READONLY, 'close_date' => OPT_ATT_HIDDEN, 'reason' => OPT_ATT_READONLY, 'requestor_id' => OPT_ATT_READONLY, 'creation_date' => OPT_ATT_READONLY, 'impact' => OPT_ATT_READONLY, 'supervisor_group_id' => OPT_ATT_READONLY, 'supervisor_id' => OPT_ATT_READONLY, 'manager_group_id' => OPT_ATT_READONLY, 'manager_id' => OPT_ATT_READONLY, 'outage' => OPT_ATT_READONLY, 'fallback' => OPT_ATT_MANDATORY, 'approval_date' => OPT_ATT_MANDATORY, 'approval_comment' => OPT_ATT_MANDATORY)));
MetaModel::Init_DefineTransition("approved", "ev_implement", array("target_state" => "implemented", "actions" => array(), "user_restriction" => null));
MetaModel::Init_DefineState("notapproved", array("attribute_inherit" => '', "attribute_list" => array('ref' => OPT_ATT_READONLY, 'org_id' => OPT_ATT_READONLY, 'agent_id' => OPT_ATT_MANDATORY, 'team_id' => OPT_ATT_MANDATORY, 'title' => OPT_ATT_MANDATORY, 'description' => OPT_ATT_READONLY, 'start_date' => OPT_ATT_MANDATORY, 'end_date' => OPT_ATT_MANDATORY, 'last_update' => OPT_ATT_READONLY, 'close_date' => OPT_ATT_HIDDEN, 'reason' => OPT_ATT_MANDATORY | OPT_ATT_MUSTPROMPT, 'requestor_id' => OPT_ATT_READONLY, 'creation_date' => OPT_ATT_READONLY, 'impact' => OPT_ATT_READONLY, 'supervisor_group_id' => OPT_ATT_READONLY, 'supervisor_id' => OPT_ATT_READONLY, 'manager_group_id' => OPT_ATT_READONLY, 'manager_id' => OPT_ATT_READONLY, 'outage' => OPT_ATT_MANDATORY, 'fallback' => OPT_ATT_MANDATORY, 'approval_date' => OPT_ATT_HIDDEN, 'approval_comment' => OPT_ATT_HIDDEN)));
MetaModel::Init_DefineTransition("notapproved", "ev_replan", array("target_state" => "plannedscheduled", "actions" => array(), "user_restriction" => null));
MetaModel::Init_DefineState("implemented", array("attribute_inherit" => '', "attribute_list" => array('ref' => OPT_ATT_READONLY, 'org_id' => OPT_ATT_READONLY, 'agent_id' => OPT_ATT_MANDATORY, 'team_id' => OPT_ATT_MANDATORY, 'title' => OPT_ATT_READONLY, 'description' => OPT_ATT_READONLY, 'start_date' => OPT_ATT_READONLY, 'end_date' => OPT_ATT_MANDATORY, 'last_update' => OPT_ATT_READONLY, 'close_date' => OPT_ATT_HIDDEN, 'reason' => OPT_ATT_READONLY, 'requestor_id' => OPT_ATT_READONLY, 'creation_date' => OPT_ATT_READONLY, 'impact' => OPT_ATT_READONLY, 'supervisor_group_id' => OPT_ATT_READONLY, 'supervisor_id' => OPT_ATT_READONLY, 'manager_group_id' => OPT_ATT_READONLY, 'manager_id' => OPT_ATT_READONLY, 'outage' => OPT_ATT_READONLY, 'fallback' => OPT_ATT_MANDATORY, 'approval_date' => OPT_ATT_READONLY, 'approval_comment' => OPT_ATT_READONLY)));
MetaModel::Init_DefineTransition("implemented", "ev_monitor", array("target_state" => "monitored", "actions" => array(), "user_restriction" => null));
MetaModel::Init_DefineTransition("implemented", "ev_finish", array("target_state" => "closed", "actions" => array('SetClosureDate'), "user_restriction" => null));
MetaModel::Init_DefineState("monitored", array("attribute_inherit" => '', "attribute_list" => array('ref' => OPT_ATT_READONLY, 'org_id' => OPT_ATT_READONLY, 'team_id' => OPT_ATT_READONLY, 'agent_id' => OPT_ATT_READONLY, 'title' => OPT_ATT_READONLY, 'caller_id' => OPT_ATT_READONLY, 'team_id' => OPT_ATT_READONLY, 'parent_id' => OPT_ATT_READONLY, 'description' => OPT_ATT_READONLY, 'start_date' => OPT_ATT_READONLY, 'end_date' => OPT_ATT_READONLY, 'last_update' => OPT_ATT_READONLY, 'close_date' => OPT_ATT_HIDDEN, 'reason' => OPT_ATT_READONLY, 'requestor_id' => OPT_ATT_READONLY, 'creation_date' => OPT_ATT_READONLY, 'impact' => OPT_ATT_READONLY, 'supervisor_group_id' => OPT_ATT_READONLY, 'supervisor_id' => OPT_ATT_READONLY, 'manager_group_id' => OPT_ATT_READONLY, 'manager_id' => OPT_ATT_READONLY, 'outage' => OPT_ATT_READONLY, 'fallback' => OPT_ATT_READONLY, 'approval_date' => OPT_ATT_READONLY, 'approval_comment' => OPT_ATT_READONLY)));
MetaModel::Init_DefineTransition("monitored", "ev_finish", array("target_state" => "closed", "actions" => array('SetClosureDate'), "user_restriction" => null));
MetaModel::Init_DefineState("closed", array("attribute_inherit" => '', "attribute_list" => array('ref' => OPT_ATT_READONLY, 'org_id' => OPT_ATT_READONLY, 'agent_id' => OPT_ATT_READONLY, 'team_id' => OPT_ATT_READONLY, 'caller_id' => OPT_ATT_READONLY, 'title' => OPT_ATT_READONLY, 'description' => OPT_ATT_READONLY, 'start_date' => OPT_ATT_READONLY, 'end_date' => OPT_ATT_READONLY, 'last_update' => OPT_ATT_READONLY, 'close_date' => OPT_ATT_READONLY, 'reason' => OPT_ATT_READONLY, 'requestor_id' => OPT_ATT_READONLY, 'creation_date' => OPT_ATT_READONLY, 'impact' => OPT_ATT_READONLY, 'team_id' => OPT_ATT_READONLY, 'supervisor_group_id' => OPT_ATT_READONLY, 'supervisor_id' => OPT_ATT_READONLY, 'manager_group_id' => OPT_ATT_READONLY, 'manager_id' => OPT_ATT_READONLY, 'outage' => OPT_ATT_READONLY, 'fallback' => OPT_ATT_READONLY, 'private_log' => OPT_ATT_READONLY, 'approval_date' => OPT_ATT_READONLY, 'approval_comment' => OPT_ATT_READONLY, 'parent_id' => OPT_ATT_READONLY)));
MetaModel::Init_SetZListItems('details', array(0 => 'functionalcis_list', 1 => 'contacts_list', 2 => 'workorders_list', 3 => 'related_request_list', 4 => 'related_incident_list', 5 => 'related_problems_list', 6 => 'child_changes_list', 'col:col1' => array('fieldset:Ticket:baseinfo' => array(0 => 'ref', 1 => 'org_id', 2 => 'status', 3 => 'title', 4 => 'description', 5 => 'approval_comment'), 'fieldset:Ticket:contact' => array(0 => 'caller_id', 1 => 'team_id', 2 => 'agent_id', 3 => 'supervisor_group_id', 4 => 'supervisor_id', 5 => 'manager_group_id', 6 => 'manager_id')), 'col:col2' => array('fieldset:Ticket:resolution' => array(0 => 'reason', 1 => 'impact', 2 => 'outage', 3 => 'fallback'), 'fieldset:Ticket:relation' => array(0 => 'parent_id')), 'col:col3' => array('fieldset:Ticket:date' => array(0 => 'creation_date', 1 => 'start_date', 2 => 'end_date', 3 => 'last_update', 4 => 'approval_date', 5 => 'close_date'))));
MetaModel::Init_SetZListItems('standard_search', array(0 => 'ref', 1 => 'org_id', 2 => 'status', 3 => 'title', 4 => 'description', 5 => 'caller_id', 6 => 'team_id', 7 => 'agent_id', 8 => 'supervisor_group_id', 9 => 'supervisor_id', 10 => 'manager_group_id', 11 => 'manager_id', 12 => 'reason', 13 => 'impact', 14 => 'outage', 15 => 'parent_id', 16 => 'creation_date', 17 => 'start_date', 18 => 'end_date', 19 => 'last_update', 20 => 'approval_date', 21 => 'close_date'));
MetaModel::Init_SetZListItems('list', array(0 => 'finalclass', 1 => 'title', 2 => 'org_id', 3 => 'start_date', 4 => 'end_date', 5 => 'status', 6 => 'agent_id'));
}
示例4: Init
public static function Init()
{
$aParams = array('category' => 'bizmodel,searchable,incidentmgmt,requestmgmt,changemgmt,m2prequest', 'key_type' => 'autoincrement', 'name_attcode' => 'name', 'state_attcode' => 'status', 'reconc_keys' => array('name', 'ticket_id'), 'db_table' => 'workorder', 'db_key_field' => 'id', 'db_finalclass_field' => '', 'icon' => utils::GetAbsoluteUrlModulesRoot() . 'itop-tickets/images/workorder.png');
MetaModel::Init_Params($aParams);
MetaModel::Init_InheritAttributes();
MetaModel::Init_AddAttribute(new AttributeString("name", array("allowed_values" => null, "sql" => 'name', "default_value" => '', "is_null_allowed" => false, "depends_on" => array(), "always_load_in_tables" => false)));
MetaModel::Init_AddAttribute(new AttributeEnum("status", array("allowed_values" => new ValueSetEnum("open,closed"), "display_style" => 'list', "sql" => 'status', "default_value" => 'open', "is_null_allowed" => false, "depends_on" => array(), "always_load_in_tables" => false)));
MetaModel::Init_AddAttribute(new AttributeText("description", array("allowed_values" => null, "sql" => 'description', "default_value" => '', "is_null_allowed" => false, "depends_on" => array(), "always_load_in_tables" => false)));
MetaModel::Init_AddAttribute(new AttributeExternalKey("ticket_id", array("targetclass" => 'Ticket', "allowed_values" => null, "sql" => 'ticket_id', "is_null_allowed" => false, "on_target_delete" => DEL_AUTO, "depends_on" => array(), "display_style" => 'select', "always_load_in_tables" => false)));
MetaModel::Init_AddAttribute(new AttributeExternalField("ticket_ref", array("allowed_values" => null, "extkey_attcode" => 'ticket_id', "target_attcode" => 'ref', "always_load_in_tables" => false)));
MetaModel::Init_AddAttribute(new AttributeExternalKey("team_id", array("targetclass" => 'Team', "allowed_values" => new ValueSetObjects("SELECT Team"), "sql" => 'team_id', "is_null_allowed" => false, "on_target_delete" => DEL_MANUAL, "depends_on" => array(), "display_style" => 'select', "always_load_in_tables" => false)));
MetaModel::Init_AddAttribute(new AttributeExternalField("team_name", array("allowed_values" => null, "extkey_attcode" => 'team_id', "target_attcode" => 'email', "always_load_in_tables" => false)));
MetaModel::Init_AddAttribute(new AttributeExternalKey("agent_id", array("targetclass" => 'Person', "allowed_values" => new ValueSetObjects("SELECT Person AS p JOIN lnkPersonToTeam AS l ON l.person_id=p.id JOIN Team AS t ON l.team_id=t.id WHERE t.id = :this->team_id"), "sql" => 'owner_id', "is_null_allowed" => true, "on_target_delete" => DEL_MANUAL, "depends_on" => array('team_id'), "allow_target_creation" => false, "display_style" => 'select', "always_load_in_tables" => false)));
MetaModel::Init_AddAttribute(new AttributeExternalField("agent_email", array("allowed_values" => null, "extkey_attcode" => 'agent_id', "target_attcode" => 'email', "always_load_in_tables" => false)));
MetaModel::Init_AddAttribute(new AttributeDateTime("start_date", array("allowed_values" => null, "sql" => 'start_date', "default_value" => '', "is_null_allowed" => false, "depends_on" => array(), "always_load_in_tables" => false)));
MetaModel::Init_AddAttribute(new AttributeDateTime("end_date", array("allowed_values" => null, "sql" => 'end_date', "default_value" => '', "is_null_allowed" => false, "depends_on" => array(), "always_load_in_tables" => false)));
MetaModel::Init_AddAttribute(new AttributeCaseLog("log", array("allowed_values" => null, "sql" => 'log', "default_value" => '', "is_null_allowed" => true, "depends_on" => array(), "always_load_in_tables" => false)));
// Lifecycle (status attribute: status)
//
MetaModel::Init_DefineStimulus(new StimulusUserAction("ev_close", array()));
MetaModel::Init_DefineState("open", array("attribute_inherit" => '', "attribute_list" => array()));
MetaModel::Init_DefineTransition("open", "ev_close", array("target_state" => "closed", "actions" => array(), "user_restriction" => null));
MetaModel::Init_DefineState("closed", array("attribute_inherit" => '', "attribute_list" => array()));
MetaModel::Init_SetZListItems('details', array(0 => 'name', 1 => 'status', 2 => 'ticket_id', 3 => 'team_id', 4 => 'agent_id', 5 => 'description', 6 => 'start_date', 7 => 'end_date'));
MetaModel::Init_SetZListItems('standard_search', array(0 => 'name', 1 => 'status', 2 => 'ticket_id', 3 => 'team_id', 4 => 'agent_id', 5 => 'start_date', 6 => 'end_date'));
MetaModel::Init_SetZListItems('list', array(0 => 'status', 1 => 'ticket_id', 2 => 'start_date', 3 => 'end_date', 4 => 'team_id', 5 => 'agent_id'));
}