Changeset 11892
- Timestamp:
- 08/30/07 17:27:42 (1 year ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/midcom/midcom.admin.folder/handler/order.php
r5773 r11892 22 22 * @access public 23 23 */ 24 function midcom_admin_folder_handler_order ()24 public function midcom_admin_folder_handler_order () 25 25 { 26 26 parent::midcom_baseclasses_components_handler(); … … 32 32 * @access private 33 33 */ 34 function _process_order_form() 35 { 36 debug_push_class(__CLASS__, __FUNCTION__); 37 34 private function _process_order_form() 35 { 38 36 // If the navigation order is changed, it will be saved first. After this it is possible 39 37 // again to organize the folder … … 66 64 } 67 65 68 debug_add("Setting the score for article id '{$id}: {$key}", MIDCOM_LOG_DEBUG);69 70 66 if (!$article->update()) 71 67 { 68 debug_push_class(__CLASS__, __FUNCTION__); 72 69 debug_add("Updating the article with id '{$id}' failed. Reason: ". mgd_errstr(), MIDCOM_LOG_ERROR); 73 70 debug_pop(); … … 81 78 if ($approval_status) 82 79 { 83 debug_add('Maintaining the approval status: setting the object back to be approved.');84 80 $metadata =& midcom_helper_metadata::retrieve($article); 85 81 $metadata->approve(); … … 109 105 } 110 106 111 debug_add("Setting the score for topic id '{$id}: {$key}", MIDCOM_LOG_DEBUG);112 113 107 if (!$topic->update()) 114 108 { 109 debug_push_class(__CLASS__, __FUNCTION__); 115 110 debug_add("Updating the topic with id '{$id}' failed. Reason: ". mgd_errstr(), MIDCOM_LOG_ERROR); 116 111 debug_pop(); … … 124 119 if ($approval_status) 125 120 { 126 debug_add('Maintaining the approval status: setting the object back to be approved.');127 121 $metadata =& midcom_helper_metadata::retrieve($topic); 128 122 $metadata->approve(); … … 135 129 $count = count($_POST['midcom_admin_content_mixed_score']); 136 130 137 debug_add('Entering the mixed type mode', MIDCOM_LOG_DEBUG);138 131 foreach ($_POST['midcom_admin_content_mixed_score'] as $key => $id) 139 132 { … … 150 143 if (!is_object($object)) 151 144 { 145 debug_push_class(__CLASS__, __FUNCTION__); 152 146 debug_add("Could not get the {$type[1]} with id '{$id}'. Reason: ". mgd_errstr(), MIDCOM_LOG_ERROR); 153 147 debug_pop(); … … 171 165 $object->score = (int) $key; 172 166 173 debug_add("Setting the score for {$type[1]} id '{$id}: {$key}", MIDCOM_LOG_DEBUG);174 175 167 if (!$object->update()) 176 168 { 169 debug_push_class(__CLASS__, __FUNCTION__); 177 170 debug_add("Updating the {$type[1]} with id '{$id}' failed. Reason: ". mgd_errstr(), MIDCOM_LOG_ERROR); 178 171 debug_pop(); … … 186 179 if ($approval_status) 187 180 { 188 debug_add('Maintaining the approval status: setting the object back to be approved.');189 181 $metadata =& midcom_helper_metadata::retrieve($object); 190 182 $metadata->approve(); … … 193 185 } 194 186 195 debug_pop();196 197 187 return true; 198 188 } … … 200 190 /** 201 191 * Handler for setting the sort order 202 *203 * @access protected204 192 */ 205 193 function _handler_order($handler_id, $args, &$data) … … 207 195 // Include Scriptaculous JavaScript library to headers 208 196 // Scriptaculous/scriptaculous.js 197 $_MIDCOM->add_jsfile(MIDCOM_STATIC_URL.'/Pearified/JavaScript/Prototype/prototype.js'); 209 198 $_MIDCOM->add_jsfile(MIDCOM_STATIC_URL.'/Pearified/JavaScript/Scriptaculous/scriptaculous.js'); 210 199 $_MIDCOM->add_link_head … … 230 219 if ($this->_process_order_form()) 231 220 { 221 $_MIDCOM->uimessages->add($_MIDCOM->i18n->get_string('midcom.admin.folder'), $_MIDCOM->i18n->get_string('order saved')); 232 222 $_MIDCOM->relocate($_MIDCOM->permalinks->create_permalink($this->_topic->guid)); 223 // This will exit 233 224 } 234 // This will exit235 225 } 236 226 … … 283 273 $qb = midcom_db_topic::new_query_builder(); 284 274 $qb->add_constraint('up', '=', $this->_topic->id); 285 $qb->add_order('score'); 275 $qb->add_constraint('metadata.navnoentry', '=', 0); 276 $qb->add_order('metadata.score', 'DESC'); 286 277 //$qb->add_order('name'); 287 278 //$qb->add_order('extra'); … … 293 284 $qb->add_constraint('name', '<>', 'index'); 294 285 $qb->add_constraint('up', '=', 0); 295 $qb->add_order(' score');286 $qb->add_order('metadata.score', 'DESC'); 296 287 //$qb->add_order('name'); 297 288 //$qb->add_order('title'); … … 385 376 * @return string String filled with leading zeros 386 377 */ 387 function _get_score($int)378 private function _get_score($int) 388 379 { 389 380 $string = (string) $int;
