Пример #1
0
    public function definition() {
        global $USER, $CFG, $PAGE;
        $positions = new positions();
        $mform = $this->_form;
        $id = $this->_customdata['id'];
        $positionss = $this->_customdata['tool'];
        $editoroptions = $this->_customdata['editoroptions'];
        //if ($id < 0)
        //    $mform->addElement('header', 'settingsheader', get_string('createpositions', 'local_positions'));
        //else
        //    $mform->addElement('header', 'settingsheader', get_string('editpositions', 'local_positions'));
        $tools = array();
        //$department = new department();
        $items = $positions->get_positions_items(true);
        $parents = $positions->get_positions_parent($items, $positionss->id);
        if (count($parents) <= 1) {
            $mform->addElement('hidden', 'parentid', 0);
            $mform->setType('parentid', PARAM_RAW);
        } else {
            $mform->addElement('select', 'parentid', get_string('parent', 'local_positions'), $parents);
            $mform->setType('parentid', PARAM_RAW);
        }
        $mform->addHelpButton('parentid', 'parent', 'local_positions');
        $mform->addElement('text', 'fullname', get_string('positionsname', 'local_positions'), $tools);
        $mform->setType('fullname', PARAM_TEXT);
        $mform->addRule('fullname', get_string('missingpositionsname', 'local_positions'), 'required', null, 'client');
        $attributes = array('rows' => '8', 'cols' => '40');
        //$mform->addElement('textarea', 'description', get_string('description', 'local_positions'), null, $editoroptions);
        //$mform->setType('description', PARAM_RAW);

        //$selecttype = array();
        //$selecttype['1'] = get_string('campus', 'local_positions');
        //$selecttype['2'] = get_string('university', 'local_positions');
        //$selecttype['3'] = get_string('location', 'local_positions');
        //$mform->addElement('select', 'type', get_string('type', 'local_positions'), $selecttype);
        //$mform->addHelpButton('type', 'type', 'local_positions');
        //$mform->setType('type', PARAM_RAW);
        $mform->addElement('hidden', 'id');
        $mform->setType('id', PARAM_INT);
        $now = date("d-m-Y");
        $now = strtotime($now);
        $mform->addElement('hidden', 'timecreated', $now);
        $mform->setType('timecreated', PARAM_RAW);
        $mform->addElement('hidden', 'usermodified', $USER->id);
        $mform->setType('usermodified', PARAM_RAW);
        //$themelist = $positions->cobalt_get_theme_list();
        //$mform->addElement('select', 'theme', get_string('theme', 'local_positions'), $themelist);
        //$mform->setType('theme', PARAM_RAW);
        //$mform->addRule('theme', get_string('missingtheme', 'local_positions'), 'required', null, 'client');
        $submit = ($id > 0) ? get_string('update_positions', 'local_positions') : get_string('create', 'local_positions');
        $this->add_action_buttons('false', $submit);
    }
Пример #2
0
$sesskey = optional_param('sesskey', '', PARAM_RAW);
$userid = optional_param('userid', 0, PARAM_INT);
$positionsids = optional_param('id', 0, PARAM_INT);
$unassign = optional_param('unassign', 0, PARAM_BOOL);
$confirm = optional_param('confirm', 0, PARAM_BOOL);
$assign = optional_param('assign',0,PARAM_BOOL);
 $unassign = optional_param('unassign',0,PARAM_BOOL);

require_login();

$systemcontext = context_system::instance();
if (!has_capability('local/positions:view', $systemcontext)) {
    print_error('nopermission');
}

$positions = new positions();
$costcenter = new costcenter;
if ($id > 0 && $edit) {
    $form_header = get_string('editpositions', 'local_positions');
    $collapse = false;
    if (!($positions_instance = $DB->get_record('local_positions', array('id' => $id)))) {
        print_error('invalidtoolid1122', 'local_positions');
    }
    $positions_instance->description = array('text' => $positions_instance->description, 'format' => FORMAT_HTML);
} else {
    $form_header =  get_string('createpositions', 'local_positions');
    $collapse = true;
    $positions_instance = new stdClass();
    $positions_instance->id = -1;
}
Пример #3
0
    function definition() {
        global $USER, $CFG, $DB, $PAGE;
        global  $myuser;
        $costcenter = new costcenter();
        $mform = $this->_form;
        $positions=new positions();
        $id = $this->_customdata['id'];
        $editoroptions = $this->_customdata['editoroptions'];
        $filemanageroptions = $this->_customdata['filemanageroptions'];
        $admin = $this->_customdata['admin'];
        $mform->addElement('header', 'moodle', get_string('generaldetails', 'local_users'));

        if (!$admin) {
            $mform->addElement('date_selector', 'dateofapplication', get_string('joiningdate', 'local_users'));
        }

        if (is_siteadmin($USER->id)) {
            $costcenters = $DB->get_records('local_costcenter', array('visible' => 1));
            $Position =$DB->get_records('local_positions',array('visible'=>1));
        } else {
            $costcenters = $costcenter->get_assignedcostcenters();
        }

        $parents = $costcenter->get_costcenter_parent($costcenters, '', $top = true, $all = false);
        $position =$positions->get_positions_parent($Position,'', $top=true, $all = false);
        $count = count($costcenters);
        $mform->addElement('hidden', 'count', $count);
        $mform->setType('count', PARAM_INT);
        if ($id > 0) {
            $mform->addElement('static', 'costcenter_name', get_string('costcenterid', 'local_costcenter'));
            //$mform->addElement('static', 'role_name', get_string('role', 'local_users'));
        } else {
            if ($count == 1) {
                //registrar is assigned to only one costcenter, display as static
                foreach ($costcenters as $scl) {
                    $key = $scl->id;
                    $value = $scl->fullname;
                }
                $mform->addElement('static', 'costcenters', get_string('costcenterid', 'local_costcenter'), $value);
                $mform->addElement('hidden', 'costcenterid', $key);
                $mform->setType('costcenterid', PARAM_INT);
            } else {
                $costcenters = $mform->addElement('select', 'costcenterid', get_string('select', 'local_costcenter'), $parents);
                $mform->addHelpButton('costcenterid', 'assigncostcenter', 'local_costcenter');
                $mform->addRule('costcenterid', get_string('required'), 'required', null, 'client');
            }

          //  $systemroles = $myuser->systemroles_custom();
         //   $mform->addElement('select', 'roleid', get_string('selectrole', 'local_users'), $systemroles);
       //     $mform->addHelpButton('roleid', 'assignrole', 'local_users');
        //    $mform->addRule('roleid', get_string('required'), 'required', null, 'client');
        }

        $mform->addElement('text', 'username', get_string('username', 'local_users'));
        $mform->addRule('username', get_string('required'), 'required', null, 'client');
        $mform->setType('username', PARAM_RAW);

        if (!empty($CFG->passwordpolicy)) {
            $mform->addElement('static', 'passwordpolicyinfo', '', print_password_policy());
        }
        $mform->addElement('passwordunmask', 'newpassword', get_string('newpassword'), 'size="20"');
        $mform->addHelpButton('newpassword', 'newpassword');
        $mform->setType('newpassword', PARAM_RAW);
        if ($id < 0)
            $mform->addRule('newpassword', get_string('required'), 'required', null, 'client');

        $mform->addElement('header', 'moodle', get_string('personaldetails', 'local_users'));
        $mform->addElement('text', 'firstname', get_string('firstname', 'local_users'));
        $mform->addRule('firstname', get_string('required'), 'required', null, 'client');
        $mform->setType('firstname', PARAM_RAW);

        $mform->addElement('text', 'middlename', get_string('middlename', 'local_users'));
        $mform->setType('middlename', PARAM_RAW);

        $mform->addElement('text', 'lastname', get_string('lastname', 'local_users'));
        $mform->addRule('lastname', get_string('required'), 'required', null, 'client');
        $mform->setType('lastname', PARAM_RAW);
        
        //$costcenters = $mform->addElement('select', 'position', get_string('select', 'local_positions'), $position);
        //$mform->addHelpButton('position', 'assignpositions', 'local_positions');
        //$mform->addRule('position', get_string('required'), 'required', null, 'client');

        $radioarray = array();
        $radioarray[] = & $mform->createElement('radio', 'gender', '', get_string('male', 'local_users'), 'M');
        $radioarray[] = & $mform->createElement('radio', 'gender', '', get_string('female', 'local_users'), 'F');
        $mform->addGroup($radioarray, 'gender', 'Gender', array(' '), false);
        $mform->setDefault('gender', 'Male');

        //if (!$admin) {
        //    $mform->addElement('date_selector', 'dob', get_string('dob', 'local_users'));
        //    $mform->addHelpButton('dob', 'dateofbirth', 'local_users');
        //}
        /************************************code by sreekanth**********************************************/
		 $mform->addElement('header', 'otherdetails', get_string('otherdetails', 'local_users'));
		$mform->addElement('text', 'designation', get_string('designation', 'local_users'));
        $mform->setType('designation', PARAM_RAW);
		
		$mform->addElement('text', 'level', get_string('level', 'local_users'));
        $mform->setType('level', PARAM_RAW);
		
		$mform->addElement('date_selector', 'doj', get_string('dateofjoin', 'local_users'));
        
		$mform->addElement('date_selector', 'dob', get_string('dateofbirth', 'local_users'));
		
		$mform->addElement('text', 'eligibility', get_string('eligibility', 'local_users'));
        $mform->setType('eligibility', PARAM_RAW);
		
		$mform->addElement('text', 'vertical', get_string('vertical', 'local_users'));
        $mform->setType('vertical', PARAM_RAW);
		
		$mform->addElement('text', 'state', get_string('state', 'local_users'));
        $mform->setType('state', PARAM_RAW);
		
		$mform->addElement('text', 'branch', get_string('branch', 'local_users'));
		$mform->setType('branch', PARAM_RAW);
		
		$mform->addElement('text', 'jobfunction', get_string('jobfunction', 'local_users'));
        $mform->setType('jobfunction', PARAM_RAW);
		
		$mform->addElement('text', 'grade', get_string('grade', 'local_users'));
        $mform->setType('grade', PARAM_RAW);
		
		 $mform->addElement('text', 'experience', get_string('experience', 'local_users'));
         $mform->setType('experience', PARAM_INT);
		
        $mform->addElement('text', 'qualification', 'Qualification');
        $mform->setType('qualification', PARAM_RAW);
        
		$mform->addElement('text', 'category', get_string('category', 'local_users'));
        $mform->setType('category', PARAM_RAW);
		
		$mform->addElement('text', 'department', get_string('department', 'local_users'));
        $mform->setType('department', PARAM_RAW);
        /*end of code by sreekanth*/
        $mform->addElement('header', 'moodle', get_string('contactdetails', 'local_users'));
        $mform->addElement('text', 'phone1', get_string('phone', 'local_users'));
        $mform->addRule('phone1', get_string('required'), 'required', null, 'client');
        $mform->addRule('phone1', get_string('numeric','local_users'), 'numeric', null, 'client');
        $mform->addRule('phone1', get_string('phoneminimum', 'local_users'), 'minlength', 10, 'client');
        $mform->addRule('phone1', get_string('phonemaximum', 'local_users'), 'maxlength', 15, 'client');
        $mform->setType('phone1', PARAM_RAW);

        $mform->addElement('text', 'email', get_string('email', 'local_users'));
        $mform->addRule('email', get_string('required'), 'required', null, 'client');
        $mform->addRule('email', get_string('emailerror', 'local_users'), 'email', null, 'client');
        $mform->setType('email', PARAM_RAW);

        $mform->addElement('text', 'city', get_string('city'));
        $mform->addRule('city', get_string('required'), 'required', null, 'client');
        $mform->setType('city', PARAM_RAW);

        $country = get_string_manager()->get_list_of_countries();
        $default_country[''] = get_string('selectacountry');
        $country = array_merge($default_country, $country);
        $mform->addElement('select', 'country', get_string('country'), $country);
        $mform->addRule('country', get_string('country_error','local_users'), 'required', null, 'client');
        
       $mform->addElement('select', 'lang', get_string('preferredlanguage'), get_string_manager()->get_list_of_translations());
       $mform->setDefault('lang', $CFG->lang);

        $mform->addElement('textarea', 'address', get_string('address', 'local_users'));
        $mform->addElement('editor', 'description_editor', get_string('userdescription'), null, $editoroptions);
        $mform->setType('description_editor', PARAM_CLEANHTML);
        $mform->addHelpButton('description_editor', 'userdescription');

        $mform->addElement('header', 'moodle', get_string('userpicture', 'local_users'));

        $mform->addElement('static', 'currentpicture', get_string('currentpicture'));
        $mform->addElement('checkbox', 'deletepicture', get_string('delete'));
        $mform->setDefault('deletepicture', 0);
        $mform->addElement('filemanager', 'imagefile', get_string('newpicture'), '', $filemanageroptions);
        $mform->addHelpButton('imagefile', 'newpicture');

        $mform->addElement('hidden', 'id');
        $mform->setType('id', PARAM_INT);
        $submitlable = ($id > 0) ? get_string('updateuser', 'local_users') : get_string('createuser', 'local_users');
        $this->add_action_buttons(true, 'Submit');
    }
Пример #4
0
$id = optional_param('id', -1, PARAM_INT);    // user id; -1 if creating new tool
$userid = optional_param('userid', 0, PARAM_INT);
$delete = optional_param('delete', 0, PARAM_BOOL);
$confirm = optional_param('confirm', 0, PARAM_BOOL);
$hide = optional_param('hide', 0, PARAM_INT);
$show = optional_param('show', 0, PARAM_INT);
$visible = optional_param('visible', -1, PARAM_INT);
$moveto = optional_param('moveto', 0, PARAM_INT);
$sesskey = optional_param('sesskey', '', PARAM_RAW);
$positionsids = optional_param('id', 0, PARAM_INT);
$unassign = optional_param('unassign', 0, PARAM_BOOL);

$conf = new object();

require_login();
$positions = new positions();


if ($id > 0) {
    if (!($positions_instance = $DB->get_record('local_positions', array('id' => $id)))) {
        print_error('invalidtoolid1122', 'local_positions');
    }
} else {
    $positions_instance = new stdClass();
    $positions_instance->id = -1;
}


$PAGE->set_url('/local/positions/positions.php');
$systemcontext = context_system::instance();