Changeset 662 for trunk/admin/inc/class.uicategories.inc.php
- Timestamp:
- 02/06/09 08:37:34 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/inc/class.uicategories.inc.php
r577 r662 345 345 function edit() 346 346 { 347 $cat_group = split(",",$_POST['idgroup']); 348 349 if (count($cat_group) == 0) 350 $cat_group = array('0'=>'0'); 351 347 352 $new_parent = (int)$_POST['new_parent']; 348 353 $cat_parent = (int)$_POST['cat_parent']; … … 351 356 $cat_data = $_POST['cat_data']; 352 357 $old_parent = (int)$_POST['old_parent']; 353 $cat_group = $_POST['idgroup']; 354 358 355 359 if ($new_parent) 356 360 { … … 378 382 { 379 383 $data = serialize($cat_data); 380 381 $values = array 382 ( 383 'parent' => $cat_parent, 384 'descr' => $cat_description, 385 'name' => $cat_name, 386 'group' => $cat_group, 387 'access' => 'public', 388 'data' => $data 389 ); 390 if ($this->cat_id) 391 { 392 $values['id'] = $this->cat_id; 393 $values['old_parent'] = $old_parent; 394 } 395 $error = $this->bo->check_values($values); 396 if (is_array($error)) 397 { 398 $this->template->set_var('message',$GLOBALS['phpgw']->common->error_list($error)); 399 } 400 else 401 { 402 $this->cat_id = $this->bo->save_cat($values); 403 $GLOBALS['phpgw']->redirect_link('/index.php',$link_data); 404 } 384 $redirect_ = false; 385 foreach($cat_group as $index_ => $catValue) 386 { 387 $values = array 388 ( 389 'parent' => $cat_parent, 390 'descr' => $cat_description, 391 'name' => $cat_name, 392 'group' => $catValue, 393 'access' => 'public', 394 'data' => $data 395 ); 396 if ($this->cat_id) 397 { 398 if ($index_ == 0){ 399 $values['id'] = $this->cat_id; 400 $values['old_parent'] = $old_parent; 401 } 402 else{ 403 $this->bo->save_cat($values); 404 } 405 } 406 $error = $this->bo->check_values($values); 407 if (is_array($error)) 408 { 409 $this->template->set_var('message',$GLOBALS['phpgw']->common->error_list($error)); 410 } 411 else 412 { 413 $redirect_ = true; 414 $this->cat_id = $this->bo->save_cat($values); 415 unset($values); 416 } 417 } 418 if ($redirect_) 419 $GLOBALS['phpgw']->redirect_link('/index.php',$link_data); 420 405 421 } 406 422 … … 449 465 $cat['description'] = str_replace($matches[1],'',$cat['description']); 450 466 } 451 452 $hidden_vars = '<input type="hidden" name="cat_id" value="' . $this->cat_id . '">' . "\n" . 453 '<input type="hidden" name="old_parent" value="' . $cat['parent'] . '">' . "\n". 454 '<input type="hidden" id="idgroup" name="idgroup" value="' . $cat['id_group'] . '">' . "\n"; 467 if (strlen($cat['name_group']) == 0) 468 { 469 $cat['name_group'] = lang("All"); 470 $cat['id_group'] = 0; 471 } 472 $this->template->set_var('category_namegroup',$GLOBALS['phpgw']->strip_html($cat['name_group'])); 473 474 // Hidden vars 475 $this->template->set_var('cat_id',$this->cat_id); 476 $this->template->set_var('cat_parent',$cat['parent']); 477 $this->template->set_var('cat_id_group',$cat['id_group']); 478 479 $this->template->set_var('lang_add_multiple_categories',lang("add multiple categories?")); 455 480 456 481 $link_data['menuaction'] = 'admin.uicategories.edit'; … … 472 497 $this->template->set_var('cat_description',$GLOBALS['phpgw']->strip_html($cat['description'])); 473 498 $this->template->set_var('category_list',$this->bo->cats->formatted_list(array('selected' => $cat['parent'],'self' => $this->cat_id))); 474 $this->template->set_var('category_namegroup',$GLOBALS['phpgw']->strip_html($cat['name_group']));475 499 $this->template->set_var('bt_rem_id_group_visibility',$cat['name_group'] ? "visible" : "hidden"); 476 500 if (!is_object($GLOBALS['phpgw']->html))
Note: See TracChangeset
for help on using the changeset viewer.