Index: trunk/extensions/EducationProgram/includes/EPOrg.php |
— | — | @@ -81,17 +81,6 @@ |
82 | 82 | |
83 | 83 | /** |
84 | 84 | * (non-PHPdoc) |
85 | | - * @see EPDBObject::getLogInfo() |
86 | | - */ |
87 | | - protected function getLogInfo( $subType ) { |
88 | | - return array( |
89 | | - 'type' => 'institution', |
90 | | - 'title' => $this->getTitle(), |
91 | | - ); |
92 | | - } |
93 | | - |
94 | | - /** |
95 | | - * (non-PHPdoc) |
96 | 85 | * @see EPDBObject::loadSummaryFields() |
97 | 86 | */ |
98 | 87 | public function loadSummaryFields( $summaryFields = null ) { |
Index: trunk/extensions/EducationProgram/includes/EPRevisionedObject.php |
— | — | @@ -92,7 +92,6 @@ |
93 | 93 | |
94 | 94 | /** |
95 | 95 | * Store the current version of the object in the revisions table. |
96 | | - * TODO: add handling for comment, minor edit, ect stuff |
97 | 96 | * |
98 | 97 | * @since 0.1 |
99 | 98 | * |
— | — | @@ -105,7 +104,7 @@ |
106 | 105 | if ( $this->revAction !== false ) { |
107 | 106 | $revision->setFields( array( |
108 | 107 | 'minor_edit' => $this->revAction->isMinor(), |
109 | | - 'deleted' => $this->revAction->deleted(), |
| 108 | + 'deleted' => $this->revAction->isDelete(), |
110 | 109 | 'time' => $this->revAction->getTime(), |
111 | 110 | 'comment' => $this->revAction->getComment(), |
112 | 111 | 'user_id' => $this->revAction->getUser()->getId(), |
— | — | @@ -133,6 +132,7 @@ |
134 | 133 | if ( $info !== false ) { |
135 | 134 | if ( $this->revAction !== false ) { |
136 | 135 | $info['user'] = $this->revAction->getUser(); |
| 136 | + $info['comment'] = $this->revAction->getComment(); |
137 | 137 | } |
138 | 138 | |
139 | 139 | $info['subtype'] = $subType; |
— | — | @@ -205,7 +205,7 @@ |
206 | 206 | $result = parent::insert(); |
207 | 207 | |
208 | 208 | if ( $result ) { |
209 | | - $this->storeRevision( $this->getCurrentRevision() ); |
| 209 | + $this->storeRevision( EPRevision::newFromObject( $this ) ); |
210 | 210 | $this->log( 'add' ); |
211 | 211 | } |
212 | 212 | |
— | — | @@ -217,16 +217,36 @@ |
218 | 218 | * @see EPDBObject::remove() |
219 | 219 | */ |
220 | 220 | public function remove() { |
| 221 | + $object = clone $this; |
| 222 | + $object->loadFields(); |
| 223 | + |
221 | 224 | $success = parent::remove(); |
222 | 225 | |
223 | 226 | if ( $success ) { |
224 | | - $this->log( 'remove' ); |
| 227 | + $object->onRemoved(); |
225 | 228 | } |
226 | 229 | |
227 | 230 | return $success; |
228 | 231 | } |
229 | 232 | |
230 | | - public function logRmove() { |
| 233 | + /** |
| 234 | + * @since 0.1 |
| 235 | + * |
| 236 | + * @param EPRevisionAction $revAction |
| 237 | + */ |
| 238 | + public function handleRemoved( EPRevisionAction $revAction ) { |
| 239 | + $this->setRevisionAction( $revAction ); |
| 240 | + $this->onRemoved(); |
| 241 | + } |
| 242 | + |
| 243 | + /** |
| 244 | + * Do logging and revision storage after a removal. |
| 245 | + * The object needs to have all it's fields loaded. |
| 246 | + * |
| 247 | + * @since 0.1 |
| 248 | + */ |
| 249 | + protected function onRemoved() { |
| 250 | + //$this->storeRevision( EPRevision::newFromObject( $this ) ); |
231 | 251 | $this->log( 'remove' ); |
232 | 252 | } |
233 | 253 | |
Index: trunk/extensions/EducationProgram/includes/EPCourse.php |
— | — | @@ -787,5 +787,5 @@ |
788 | 788 | |
789 | 789 | EPUtils::log( $info ); |
790 | 790 | } |
791 | | - |
| 791 | + |
792 | 792 | } |
Index: trunk/extensions/EducationProgram/includes/EPPageObject.php |
— | — | @@ -25,6 +25,7 @@ |
26 | 26 | 'edit-right' => 'ep-course', |
27 | 27 | 'identifier' => 'name', |
28 | 28 | 'list' => 'Courses', |
| 29 | + 'log-type' => 'course', |
29 | 30 | ), |
30 | 31 | 'EPOrg' => array( |
31 | 32 | 'ns' => EP_NS_INSTITUTION, |
— | — | @@ -36,6 +37,7 @@ |
37 | 38 | 'edit-right' => 'ep-org', |
38 | 39 | 'identifier' => 'name', |
39 | 40 | 'list' => 'Institutions', |
| 41 | + 'log-type' => 'institution', |
40 | 42 | ), |
41 | 43 | ); |
42 | 44 | |
— | — | @@ -119,19 +121,29 @@ |
120 | 122 | $success = true; |
121 | 123 | |
122 | 124 | if ( count( $objects ) > 0 ) { |
123 | | - $success = static::delete( $conditions ); |
| 125 | + $success = true;//static::delete( $conditions ); |
124 | 126 | |
125 | 127 | if ( $success ) { |
126 | 128 | $revAction->setDelete( true ); |
127 | 129 | |
128 | 130 | foreach ( $objects as /* EPPageObject */ $object ) { |
129 | | - // TODO |
130 | | - // $object->logRemove(); |
| 131 | + $object->handleRemoved( $revAction ); |
131 | 132 | } |
132 | 133 | } |
133 | 134 | } |
134 | 135 | |
135 | 136 | return $success; |
136 | 137 | } |
| 138 | + |
| 139 | + /** |
| 140 | + * (non-PHPdoc) |
| 141 | + * @see EPRevisionedObject::getLogInfo() |
| 142 | + */ |
| 143 | + protected function getLogInfo( $subType ) { |
| 144 | + return array( |
| 145 | + 'type' => self::$info[get_called_class()]['log-type'], |
| 146 | + 'title' => $this->getTitle(), |
| 147 | + ); |
| 148 | + } |
137 | 149 | |
138 | | -} |
\ No newline at end of file |
| 150 | +} |