2 class System extends AppModel {
7 'add' => array('name', 'sort_order', 'url', 'copyright', 'set_npc', 'public_flag', 'detail'),
8 'edit' => array('name', 'sort_order', 'url', 'copyright', 'set_npc', 'public_flag', 'detail'),
39 var $validate = array(
42 'rule' => array('notEmpty'),
45 'sort_order' => array(
47 'rule' => array('numeric'),
53 'rule' => array('url', true),
59 'rule' => array('boolean'),
62 'public_flag' => array(
63 'publicFlag' => array(
64 'rule' => array('publicFlag'),
69 //The Associations below have been created with all possible keys, those that are not needed can be removed
72 'className' => 'Character',
73 'foreignKey' => 'system_id',
75 'conditions' => array(
76 'Character.public_flag' => 'public',
77 'Character.deleted' => '0',
81 'Character.system_id',
84 'Character.main_picture',
85 'Character.public_flag',
89 'order' => 'Character.modified DESC',
92 'CharacterSheet' => array(
93 'className' => 'CharacterSheet',
94 'foreignKey' => 'system_id',
96 'conditions' => array(
97 'CharacterSheet.public_flag' => 'public'
101 'CharacterSheet.key_name',
102 'CharacterSheet.name',
105 'CharacterSheet.sort_order' => 'ASC'
110 'className' => 'Profile',
111 'foreignKey' => 'system_id',
117 'Profile.profile_type',
118 'Profile.sort_order',
120 // 'order' => 'Profile.sort_order ASC',
123 'Attachment' => array(
124 'className' => 'Media.AttachmentEx',
125 'foreignKey' => 'foreign_key',
127 'conditions' => array('Attachment.model' => 'System'),
130 'Attachment.user_id',
131 'Attachment.foreign_key',
132 'Attachment.dirname',
133 'Attachment.basename',
134 'Attachment.alternative',
136 'Attachment.created',
148 function beforeSave($options = array())
150 if (empty($this->data['System']['sort_order'])) {
151 $this->data['System']['sort_order'] = 0;
154 return parent::beforeSave($options);
157 function beforeDelete($cascade = true) {
158 $this->data['System']['isAdmin'] = true;
160 return parent::beforeDelete($cascade);