Esempio n. 1
0
function other()
{
    $dept = new department();
    $admindept = $dept->getAll();
    $man = new manager();
    $dept_managers = $man->getAllDept();
    while ($element = each($dept_managers)) {
    }
    $smt = new SMT('manager/AddAdmin', '..');
    $smt->render(array('admindept' => $admindept, 'admindept_sel' => key($admindept), 'dept_managers' => $dept_managers));
}
Esempio n. 2
0
 function setColumn()
 {
     $MT = $this->grid->MasterTable;
     $column = new GridBoundColumn();
     $column->DataField = "m_id";
     $column->ReadOnly = true;
     $column->Visible = false;
     $MT->AddColumn($column);
     $column = new GridBoundColumn();
     $column->DataField = "m_user";
     $column->HeaderText = "用户名";
     $column->NullDisplayText = "请添加该院系管理员";
     $column->AddValidator(REValidator::username());
     $MT->AddColumn($column);
     $column = new GridBoundColumn();
     $column->DataField = "m_name";
     $column->HeaderText = "姓名";
     $MT->AddColumn($column);
     $column = new GridDropDownColumn();
     $column->DataField = "dept_id";
     $column->HeaderText = "院系";
     $column->ReadOnly = false;
     $column->Visible = false;
     $deptobj = new department();
     $dept = $deptobj->getAll();
     foreach ($dept as $key => $value) {
         $column->AddItem($value, $key);
     }
     $MT->AddColumn($column);
     $column = new GridBoundColumn();
     $column->DataField = "dept_name";
     $column->HeaderText = "院系";
     $column->ReadOnly = true;
     $column->Width = "200px";
     $MT->AddColumn($column);
     $column = new GridBoundColumn();
     $column->DataField = "m_pwd";
     $column->HeaderText = "密码";
     $column->DefaultValue = "请使用强密码";
     $column->ReadOnly = false;
     $column->Visible = false;
     $column->AddValidator(REValidator::password());
     $MT->AddColumn($column);
     $column = new GridEditDeleteColumn();
     $column->ShowDeleteButton = true;
     $column->Align = "center";
     $MT->AddColumn($column);
 }
 public function classes($major_id)
 {
     self::prepare();
     $listbox = new KoolListBox("major");
     $listbox->styleFolder = self::$selectStyle;
     $dept_obj = new department();
     $dept = $dept_obj->getALLMajor($major_id);
     foreach ($dept as $key => $value) {
         $listbox->AddItem(new ListBoxItem($key, $value));
     }
     $listbox->ItemTemplate = "<div class='class_listbox' id='{Text}'>{Value}</div>";
     $listbox->ButtonSettings->ShowDelete = true;
     $listbox->ButtonSettings->ShowReorder = true;
     $listbox->Init();
     return $listbox;
 }
Esempio n. 4
0
/**
 * Theme functions for departments
 */
function total_departments()
{
    if (!($departments = Registry::get('departments'))) {
        $departments = department::get();
        $departments = new Items($departments);
        Registry::set('departments', $departments);
    }
    return $departments->length();
}
Esempio n. 5
0
function select()
{
    $department = new department();
    if (isset($_GET['page'])) {
        $pages = $_GET['page'];
    } else {
        $pages = 1;
    }
    $GLOBALS['pages'] = $pages;
    $page = new page($pages);
    $GLOBALS['page'] = $page;
    $total = $department->countDpartmetn();
    $GLOBALS['page']->pageft($total, $GLOBALS['displaypg']);
    $item = $department->selectDepartment();
    global $smarty;
    $smarty->assign("item", $item);
    $smarty->assign("nextpage", $GLOBALS['page']->getPagenav());
}
 public function get_all()
 {
     $department_list = array();
     $this->db->connect();
     $sql = "SELECT * from tbl_department";
     $result = $this->db->fetchQuery($sql);
     if ($result->num_rows > 0) {
         while ($row = $result->fetch_assoc()) {
             $department = new department();
             $department->set_id($row['id']);
             $department->set_name($row['name']);
             $department->set_no_of_staff($row['no_of_staff']);
             $department->set_no_of_teachers($row['no_of_teachers']);
             $department->set_hod($row['hod']);
             $department->set_vhod($row['vhod']);
             array_push($department_list, $department);
         }
     }
     $this->db->close();
     return $department_list;
 }
Esempio n. 7
0
    Route::post('admin/departments/add', function () {
        $input = Input::get(array('title', 'slug', 'description'));
        $validator = new validator($input);
        $validator->check('title')->is_max(3, __('departments.title_missing'));
        if ($errors = $validator->errors()) {
            Input::flash();
            Notify::error($errors);
            return Response::redirect('admin/departments/add');
        }
        if (empty($input['slug'])) {
            $input['slug'] = $input['title'];
        }
        $input['slug'] = slug($input['slug']);
        $department = department::create($input);
        Extend::process('department', $department->id);
        Notify::success(__('departments.created'));
        return Response::redirect('admin/departments');
    });
    Route::get('admin/departments/delete/(:num)', function ($id) {
        $total = department::count();
        if ($total == 1) {
            Notify::error(__('departments.delete_error'));
            return Response::redirect('admin/departments/edit/' . $id);
        }
        $department = department::where('id', '<>', $id)->fetch();
        department::find($id)->delete();
        Post::where('department', '=', $id)->update(array('department' => $department->id));
        Notify::success(__('departments.deleted'));
        return Response::redirect('admin/departments');
    });
});
Esempio n. 8
0
        $this->name = $_name;
        $this->employees = array();
    }
    function addEmployee(Employee $e)
    {
        $this->employees[] = $name;
        echo "<p>{$e->getName}() has been added to the {$this->name} department</p>";
    }
}
class Employee
{
    private $name;
    function __construct($_name)
    {
        $this->name = $_name;
    }
    function getName()
    {
        return $this->name;
    }
}
$hr = new department("human");
$e1 = new Employee("fu111ck");
$e2 = new Employee("shit");
$hr->addEmployee($e1);
$hr->addEmployee($e2);
?>

</body>

</html>
Esempio n. 9
0
        $db->query($query);
        $employees = $db->value;
        $where = $department_id > 0 ? 'parent_id=' . $department_id : 'parent_id IS NULL';
        $query = 'SELECT * FROM "' . TABLE_DEPARMENT . '" WHERE ' . $where . ' ORDER BY name ' . $sort_dep_dir;
        $db->query($query);
        $departments = $db->value;
        for ($i = 0; $i < count($departments); $i++) {
            $employees = array_merge($employees, get_employee_in_dep($departments[$i]['id_department'], $sort_dep_dir));
        }
        return $employees;
    }
    $employees = get_employee_in_dep($department_id, $sort_dir);
    $employees = array_slice($employees, $from, LIMIT_EMPLOYEE_ON_PAGE);
    $page_break = get_page_break(SITE_URI_ROOT . $STORAGE['module'] . '/' . $STORAGE['action'] . '/', $all_num, $from, LIMIT_EMPLOYEE_ON_PAGE, LIMIT_PAGE_ON_PAGE, $additional_vars, 'Aclick');
}
$dep = new department();
$emp = new employee();
for ($i = 0; $i < count($employees); $i++) {
    $dep->Init();
    $dep->id_department = $employees[$i]['department_id'];
    $dep->Load();
    $n = 0;
    $employees[$i]['department'] = array();
    $employees[$i]['department'][$n]['dep'] = $dep->name;
    if ($dep->head_id != 0) {
        $emp->id_employee = $dep->head_id;
        $emp->Load();
        $employees[$i]['department'][$n]['head'] = $emp->name;
    } else {
        $employees[$i]['department'][$n]['head'] = '';
    }
Esempio n. 10
0
<?php

$page_title = 'Редактирование данных подразделения';
$id = intval(get_request_variable('id', 0));
$parent_id = intval(get_request_variable('parent_id', 0));
$head_id = intval(get_request_variable('head_id', 0));
$prefix = get_request_variable('prefix', '');
$description = get_request_variable('description', '');
$name = get_request_variable('name', '');
$save = get_request_variable('save', '');
$_REQUEST['callback'] = get_request_variable('callback', '');
$department = new department();
$department->id_department = $id;
if ($id > 0) {
    if (!$department->Load()) {
        $department->id_department = 0;
    }
}
$department->parent_id = $parent_id;
if ($save) {
    $department->head_id = $head_id;
    if ($department->parent_id === 0) {
        $department->parent_id = null;
    }
    if ($department->head_id === 0) {
        $department->head_id = null;
    }
    $department->name = $name;
    $department->prefix = $prefix;
    $department->description = $description;
    $errors = $department->IsValidData();
Esempio n. 11
0
<?php

//****************************************************************************************
//Generated by Cobalt, a rapid application development framework. http://cobalt.jvroig.com
//Cobalt developed by JV Roig (jvroig@jvroig.com)
//****************************************************************************************
require 'path.php';
init_cobalt('Add department');
require 'components/get_listview_referrer.php';
if (xsrf_guard()) {
    init_var($_POST['btn_cancel']);
    init_var($_POST['btn_submit']);
    require 'components/query_string_standard.php';
    require 'subclasses/department.php';
    $dbh_department = new department();
    $object_name = 'dbh_department';
    require 'components/create_form_data.php';
    extract($arr_form_data);
    if ($_POST['btn_cancel']) {
        log_action('Pressed cancel button');
        redirect("listview_department.php?{$query_string}");
    }
    if ($_POST['btn_submit']) {
        log_action('Pressed submit button');
        $message .= $dbh_department->sanitize($arr_form_data)->lst_error;
        extract($arr_form_data);
        if ($dbh_department->check_uniqueness($arr_form_data)->is_unique) {
            //Good, no duplicate in database
        } else {
            $message = "Record already exists with the same primary identifiers!";
        }
Esempio n. 12
0
function Step_2()
{
    $dep = new department();
    $st_depart = $dep->getAll();
    $st_depart[-1] = "无";
    $edu = new education();
    $st_edu = $edu->getAll();
    $html = '<div class="blank_cell">
                        <div class="label_title">
                            <div class="label_aten">
                                <label for="st_name" id="st_name_label">姓名</label>             	
                            </div> 
                        </div>
                        <div class="input_blank input_blank_de">
                            <input type="text" id="st_name" />
                        </div>
                    </div>

                    <div class="blank_cell">
                        <div class="label_title">
                            <div class="label_aten">
                                <label  id="st_birth_label">出生年月</label>             	
                            </div> 
                        </div>
                        <div class="input_blank input_blank_de">
                            <input type="text" id="datepicker" />
                        </div>
                    </div>
                    <div class="blank_cell">
                        <div class="label_title">
                            <div class="label_aten">
                                <label for="st_No" id="st_No_label">学号</label>             	
                            </div> 
                        </div>
                        <div class="input_blank input_blank_de">
                            <input type="text" id="st_No" />
                        </div>
                    </div>
                    <div class="blank_cell">
                        <div class="label_title">
                            <div class="label_aten">
                                <label for="st_mail" id="st_mail_label">邮箱</label>             	
                            </div> 
                        </div>
                        <div class="input_blank input_blank_de">
                            <input type="text" id="st_mail" />
                        </div>
                    </div>
                    
                    <div class="blank_cell">
                        <div class="label_title">
                            <div class="label_aten">
                                <label for="st_edu" id="st_edu_label">在读学历</label>             	
                            </div> 
                        </div>
                        <div class="input_blank"><select id="st_edu" name="st_edu">';
    foreach ($st_edu as $key => $value) {
        $html .= '<option value="' . $key . '">' . $value . '</option>';
    }
    $html .= '</select></div>
                    </div>
                    <div class="blank_cell">
                        <div class="label_title">
                            <div class="label_aten">
                                <label for="st_depart" id="st_depart_label">学院</label>             	
                            </div> 
                        </div>
                        <div class="input_blank"><select id="st_depart" name="id_depart">';
    $html .= '<option value="-1">无</option>';
    foreach ($st_depart as $key => $value) {
        $html .= '<option value="' . $key . '">' . $value . '</option>';
    }
    $html .= '</select></div>
                    </div>

                    <div class="blank_cell">
                        <div class="label_title">
                            <div class="label_aten">
                                <label for="st_class" id="st_major_label">专业</label>             	
                            </div> 
                        </div>
                        <div class="input_blank ">
                            <select id="st_major">
                            </select>
                        </div>
                    </div>
                    <div class="blank_cell">
                        <div class="label_title">
                            <div class="label_aten">
                                <label for="st_class" id="st_class_label">班级</label>             	
                            </div> 
                        </div>
                        <div class="input_blank ">
                            <select id="st_class">

                            </select>
                        </div>
                    </div>
                    <div class="blank_cell">
                        <div class="label_title">
                            <div class="label_aten">
                                <label for="st_class" id="st_grade_label">入学年份</label>             	
                            </div> 
                        </div>
                        <div class="input_blank ">
                            <select id="st_grade">

                            </select>
                        </div>
                    </div>
    <div id="submit_part">
            <a  id="submit_bt"  href="javascript:void(0);"></a>
        </div>';
    return $html;
}
Esempio n. 13
0
<html xmlns=http://www.w3.org/1999/xhtml>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

        <title>学员考试分配</title> 
        <script src="../../../../js/jquery-1.9.0.js" type='text/javascript'></script>
        <script src="index.js" type='text/javascript'></script>
        <script src="../../../../jquery-ui/js/jquery-ui-1.10.1.custom.js"></script>
        <link rel="stylesheet" href="../../../../css/common.css" />
        <link rel="stylesheet" href="../../../../jquery-ui/development-bundle/themes/sunny/jquery-ui.css" />
        <link rel="stylesheet" href="index.css" />

    </head>
    <body>
        <?php 
echo department::select(true);
?>
        <br/>
        <span class="header" style='margin:4px;padding:4px;height:25px;border:solid 1px #C6E1F2;'>
            <?php 
echo student::role();
echo student::gradeSelect();
?>
            <input id="st_button" type="button" value="确认" onClick="select_students();" />
        </span><br/>


        <iframe id="assignFrame" width="100%" height="500px" frameborder="0" scrolling="no">
        </iframe>
    </body>
</html>
Esempio n. 14
0
<?php

$page_title = 'Просмотр данных сотрудника';
$id = intval(get_request_variable('id', 0));
$employee = new employee();
$employee->id_employee = $id;
if ($id > 0) {
    if (!$employee->Load()) {
        $employee->id_employee = 0;
    }
}
$department_name = '---';
if ($employee->department_id > 0) {
    $department = new department();
    $department->id_department = $employee->department_id;
    if ($department->Load()) {
        $department_name = $department->name;
    }
}
$head = new employee();
if ($employee->head_id > 0) {
    $head->id_employee = $employee->head_id;
    $head->Load();
}
include SITE_FILE_ROOT . 'template/simple_header.php';
include SITE_FILE_ROOT . 'template/' . $STORAGE['module'] . '/' . $STORAGE['action'] . '.php';
include SITE_FILE_ROOT . 'template/simple_footer.php';
Esempio n. 15
0
<?php

require_once '../../../../../class/autoload.inc';
$webroot = "../../../..";
$stu = new student($_SESSION['Student']['Student']['s_user']);
$dep = new department();
$st_depart = $dep->getAll();
$st_major = $dep->getAllMajor($stu->dept_id);
$st_class = $dep->getAllClass($stu->major_id);
// $st_depart[-1] = "无";
$edu = new education();
$st_edu = $edu->getAll();
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"  xml:lang="zh-CN" lang="zh-CN">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>个人信息</title>
        
         <script src="<?php 
echo $webroot . '/jquery-ui/js/jquery-1.9.1.js';
?>
"></script>
         <script src="<?php 
echo $webroot . '/js/profile.js';
?>
"></script>
Esempio n. 16
0
    public static function select($withMajorAndClass)
    {
        $dept_obj = new department();
        $dept = $dept_obj->getAll();
        $html = "<span class='header' style='margin:4px;padding:4px;height:25px;width:500px;border:solid 1px #C6E1F2;'>";
        $html .= "学院:<select id='st_depart' name='st_depart' >";
        $html .= "<option value='-1'>全部</option>";
        foreach ($dept as $key => $value) {
            $html .= "<option value='{$key}'>{$value}</option>";
        }
        $html .= "</select>";
        if ($withMajorAndClass) {
            $html .= "专业:<select id='st_major' name='st_major' class='dept_select'>\n            <option value='-1'>全部</option> </select>\n            班级:<select id='st_class' name='st_class' class='dept_select'>\n            <option value='-1'>全部</option></select>";
        }
        $html .= "</span>";
        $html .= "<script type='text/javascript'>";
        $html .= <<<'EOF'
   var post_url = '../../../../../class/LoadAndCheck.php';
function depart_change($dept_id) {
    $("#st_major").html('<option value="-1" selected="selected">全部</option>');
    $("#st_class").html('<option value="-1" selected="selected">全部</option>');
    if($dept_id != -1) {
        $.post(post_url,{
            oper:'LoadMajor', 
            dept_id:$dept_id
        }, 
        function(data) {
            var option = "";
            for(var i = 0; i < data.length; i++) {
                option += '<option value="'+data[i].major_id+'">'+data[i].major_name+'</option>';
            }
            $("#st_major").append(option);
        }, 'json');
    }
}
function major_change($major_id){
    $("#st_class").html('<option value="-1" selected="selected">全部</option>');
    if($major_id != -1) {
        $.post(post_url,{
            oper:'LoadClass',
            major_id:$major_id
        }, function(data) {
            var option="";
            for(var i = 0; i < data.length; i++) {
                option += '<option value="'+data[i].class_id+'">'+data[i].class_name+'</option>';
            }
            $("#st_class").append(option);
        },'json');
    }
}
$(document).ready(function() {
    $.ajaxSetup({
        async: false
    });
    $("#st_depart").change(function(){
        depart_change($(this).val());
    });

    $("#st_major").change(function() {
        major_change($(this).val());
    });
    $("#st_button").click(function(){
        $.get("grid.php",{
            dept_id: $("#st_depart").val(),
            major_id: $("#st_major").val(),
            class_id: $("#st_class").val()
        }, function(data) {
            $("#studentGrid").html(data);
        },'html');			
    });
    
    
    var hidden_depart = $("#hidden_depart").val();
    var hidden_major = $("#hidden_major").val();
    var hidden_class = $("#hidden_class").val();
    
    
    
    if (hidden_depart != "-1"){
        $('#st_depart').val(hidden_depart).change();
    }
    if (hidden_major != "-1"){
        $('#st_major').val(hidden_major).change();
    }
    if (hidden_class != "-1"){
        $('#st_class').val(hidden_class).change();
    }
});



EOF;
        $html .= "</script>";
        return $html;
    }
Esempio n. 17
0
function Step_3()
{
    $dep = new department();
    $st_depart = $dep->getAll();
    $st_depart[-1] = "无";
    $edu = new education();
    $st_edu = $edu->getAll();
    $html = '<div class="blank_cell">
                    <div class="blank_cell">
                        <div class="label_title">
                            <div class="label_aten">
                                <label for="st_edu" id="st_edu_label">在读学历</label>             	
                            </div> 
                        </div>
                        <div class="input_blank"><select id="st_edu" name="st_edu">';
    foreach ($st_edu as $key => $value) {
        $html .= '<option value="' . $key . '">' . $value . '</option>';
    }
    $html .= '</select></div>
                    </div>
                    <div class="blank_cell">
                        <div class="label_title">
                            <div class="label_aten">
                                <label for="st_depart" id="st_depart_label">学院</label>             	
                            </div> 
                        </div>
                        <div class="input_blank"><select id="st_depart" name="id_depart">';
    foreach ($st_depart as $key => $value) {
        $html .= '<option value="' . $key . '">' . $value . '</option>';
    }
    $html .= '</select></div>
                    </div>

                    <div class="blank_cell">
                        <div class="label_title">
                            <div class="label_aten">
                                <label for="st_class" id="st_major_label">专业</label>             	
                            </div> 
                        </div>
                        <div class="input_blank ">
                            <select id="st_major">
                            </select>
                        </div>
                    </div>
                    <div class="blank_cell">
                        <div class="label_title">
                            <div class="label_aten">
                                <label for="st_class" id="st_class_label">班级</label>             	
                            </div> 
                        </div>
                        <div class="input_blank ">
                            <select id="st_class">

                            </select>
                        </div>
                    </div>
                    <div class="blank_cell">
                        <div class="label_title">
                            <div class="label_aten">
                                <label for="st_class" id="st_grade_label">入学年份</label>             	
                            </div> 
                        </div>
                        <div class="input_blank ">
                            <select id="st_grade">

                            </select>
                        </div>
                    </div>
             <div class="alert_blank">       
                <div id="st_edu_aten" class="aten_style  gray">
                    选择当前在读学历
                </div>
                
                <div id="st_depart_aten" class="aten_style  gray">
                    Please select your department, if there is none, please contact the administrators!
                </div>
                <div id="st_major_aten" class="aten_style  gray">
                    选择学院后,专业会自动弹出,若网速慢,请稍作等待。
                    Please select your major, if there is none, please contact the administrators!
                </div>
                <div id="st_class_aten" class="aten_style  gray">
                    选择专业后,班级会自动弹出,若网速慢,请稍作等待。
                    Please select your class, if there is none, please contact the administrators!
                </div>
                <div id="st_grade_aten" class="aten_style  gray">
                </div>
             </div>
    <div id="submit_part">
            <a  id="submit_bt"  href="javascript:void(0);"></a>
        </div>
';
    return $html;
}
Esempio n. 18
0
<?php

$noSession = 1;
require_once "../../../../../class/autoload.inc";
$webroot = "../../../..";
//    $_SESSION['dept_id']=4;
$dep = new department();
$st_depart = $dep->getAll();
// $st_depart[-1] = "无";
$edu = new education();
$st_edu = $edu->getAll();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"  xml:lang="zh-CN" lang="zh-CN">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>Account Registration</title>
        
        <link href="../../../../css/StuReg.css" rel="stylesheet" type="text/css" />
        <script src="<?php 
echo $webroot . '/jquery-ui/js/jquery-1.9.1.js';
?>
"></script>
        <script src="<?php 
echo $webroot . '/jquery-ui/js/jquery-ui-1.10.1.custom.js';
?>
"></script>
        <script type="text/javascript" src="../../../../js/StuReg.js"></script>
        <link rel="stylesheet" href="<?php 
echo $webroot . '/jquery-ui/development-bundle/themes/black-tie/jquery-ui.css';
?>
<?php

require 'components/get_listview_referrer.php';
require 'subclasses/department.php';
$dbh_department = new department();
$dbh_department->set_where("department_id='" . quote_smart($department_id) . "'");
if ($result = $dbh_department->make_query()->result) {
    $data = $result->fetch_assoc();
    extract($data);
}
Esempio n. 20
0
//Generated by Cobalt, a rapid application development framework. http://cobalt.jvroig.com
//Cobalt developed by JV Roig (jvroig@jvroig.com)
//****************************************************************************************
require 'path.php';
init_cobalt('View department');
if (xsrf_guard()) {
    init_var($_POST['btn_cancel']);
    init_var($_POST['btn_submit']);
    if ($_POST['btn_cancel']) {
        log_action('Pressed cancel button');
        redirect("listview_department.php");
    }
    if ($_POST['btn_submit']) {
        log_action('Pressed submit button');
        require 'subclasses/department.php';
        $dbh_department = new department();
        if ($message == "") {
            log_action('Exported table data to CSV');
            $timestamp = date('Y-m-d');
            $token = generate_token(0, 'fs');
            $csv_name = $token . $_SESSION['user'] . '_department_' . $timestamp . '.csv';
            $filename = TMP_DIRECTORY . '/' . $csv_name;
            $csv_contents = $dbh_department->export_to_csv();
            $csv_file = fopen($filename, "wb");
            fwrite($csv_file, $csv_contents);
            fclose($csv_file);
            chmod($filename, 0755);
            $csv_name = urlencode($csv_name);
            $message = 'CSV file successfully generated: <a href="/' . BASE_DIRECTORY . '/download_generic.php?filename=' . $csv_name . '">Download the CSV file.</a>';
            $message_type = 'system';
        }
Esempio n. 21
0
<?php

header("Content-type:text/xml");
$id = get_request_variable('id', 'root');
if ($id != 'root') {
    $id = intval($id);
}
$db = db_class::get_instance();
echo '<?xml version="1.0" ?>' . "\n";
if ($id === 'root') {
    $department = new department();
    $department->id_department = null;
    $childs = $department->ChildExists();
    echo '<tree id="root">' . "\n";
    echo '<item text="ККС СИТО" id="0" child="' . ($childs ? 1 : 0) . '"></item>';
    echo '</tree>' . "\n";
} else {
    $type_collection = new collection();
    $type_collection->Load(TABLE_DEPARMENT, false, $id > 0 ? 'parent_id=' . $id : 'parent_id IS NULL', 'name ASC');
    echo '<tree id="' . $id . '">' . "\n";
    for ($i = 0; $i < count($type_collection->_collection); $i++) {
        $childs = $type_collection->_collection[$i]->ChildExists();
        echo '<item child="' . ($childs ? 1 : 0) . '" id="' . $type_collection->_collection[$i]->id_department . '" text="' . escape($type_collection->_collection[$i]->name) . '" im0="folderOpen.gif" im1="folderOpen.gif" im2="folderClosed.gif">';
        echo '</item>';
    }
    echo '</tree>' . "\n";
}
Esempio n. 22
0
require 'path.php';
init_cobalt('Delete department');
if (isset($_GET['department_id'])) {
    $department_id = urldecode($_GET['department_id']);
    require_once 'form_data_department.php';
}
if (xsrf_guard()) {
    init_var($_POST['btn_cancel']);
    init_var($_POST['btn_delete']);
    require 'components/query_string_standard.php';
    if ($_POST['btn_cancel']) {
        log_action('Pressed cancel button');
        redirect("listview_department.php?{$query_string}");
    } elseif ($_POST['btn_delete']) {
        log_action('Pressed delete button');
        require_once 'subclasses/department.php';
        $dbh_department = new department();
        $object_name = 'dbh_department';
        require 'components/create_form_data.php';
        $dbh_department->delete($arr_form_data);
        redirect("listview_department.php?{$query_string}");
    }
}
require 'subclasses/department_html.php';
$html = new department_html();
$html->draw_header('Delete Department', $message, $message_type);
$html->draw_listview_referrer_info($filter_field_used, $filter_used, $page_from, $filter_sort_asc, $filter_sort_desc);
$html->draw_hidden('department_id');
$html->detail_view = TRUE;
$html->draw_controls('delete');
$html->draw_footer();
Esempio n. 23
0
<?php

$page_title = 'Удаление подразделения';
$errors = array();
$id = intval(get_request_variable('id', 0));
$_REQUEST['callback'] = get_request_variable('callback', '');
$department = new department();
$department->id_department = $id;
if ($id > 0) {
    if ($department->Load()) {
        $errors = $department->IsValidData();
        if (!$errors) {
            $department->Delete();
        }
    }
}
include SITE_FILE_ROOT . 'template/simple_header.php';
include SITE_FILE_ROOT . 'template/' . $STORAGE['module'] . '/' . $STORAGE['action'] . '.php';
include SITE_FILE_ROOT . 'template/simple_footer.php';