![]() |
|---|
| [ Index ] |
Source Code Reference for V1.00 |
[Summary view] [Print] [Text view]
1 <?php /* $Id: do_dept_aed.php 66 2008-03-02 20:58:57Z pedroix $ $URL: https://web2project.svn.sourceforge.net/svnroot/web2project/trunk/modules/departments/do_dept_aed.php $ */ 2 if (!defined('W2P_BASE_DIR')) { 3 die('You should not access this file directly.'); 4 } 5 6 $del = isset($_POST['del']) ? $_POST['del'] : 0; 7 8 $isNotNew = $_POST['dept_id']; 9 $dept_id = intval(w2PgetParam($_POST, 'dept_id', 0)); 10 $perms = &$AppUI->acl(); 11 if ($del) { 12 if (!$perms->checkModuleItem('departments', 'delete', $dept_id)) { 13 $AppUI->redirect('m=public&a=access_denied'); 14 } 15 } elseif ($isNotNew) { 16 if (!$perms->checkModuleItem('departments', 'edit', $dept_id)) { 17 $AppUI->redirect('m=public&a=access_denied'); 18 } 19 } else { 20 if (!$perms->checkModule('departments', 'add')) { 21 $AppUI->redirect('m=public&a=access_denied'); 22 } 23 } 24 25 $dept = new CDepartment(); 26 if (($msg = $dept->bind($_POST))) { 27 $AppUI->setMsg($msg, UI_MSG_ERROR); 28 $AppUI->redirect(); 29 } 30 31 // prepare (and translate) the module name ready for the suffix 32 $AppUI->setMsg('Department'); 33 if ($del) { 34 $dep = new CDepartment(); 35 $msg = $dep->load($dept->dept_id); 36 if (($msg = $dept->delete())) { 37 $AppUI->setMsg($msg, UI_MSG_ERROR); 38 $AppUI->redirect(); 39 } else { 40 $AppUI->setMsg('deleted', UI_MSG_ALERT, true); 41 $AppUI->redirect('m=companies&a=view&company_id=' . $dep->dept_company); 42 } 43 } else { 44 if (($msg = $dept->store())) { 45 $AppUI->setMsg($msg, UI_MSG_ERROR); 46 } else { 47 $AppUI->setMsg($isNotNew ? 'updated' : 'inserted', UI_MSG_OK, true); 48 } 49 $AppUI->redirect(); 50 } 51 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Wed Jan 7 03:00:01 2009 | Cross-referenced by PHPXref 0.7 |