当前位置: 首页>>代码示例>>PHP>>正文


PHP company::get_departmentbyid方法代码示例

本文整理汇总了PHP中company::get_departmentbyid方法的典型用法代码示例。如果您正苦于以下问题:PHP company::get_departmentbyid方法的具体用法?PHP company::get_departmentbyid怎么用?PHP company::get_departmentbyid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在company的用法示例。


在下文中一共展示了company::get_departmentbyid方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: definition

 public function definition()
 {
     global $CFG;
     $mform =& $this->_form;
     $company = new company($this->selectedcompany);
     //$regionlist = company::get_all_regions($company->id);
     $regionlistarr = array();
     $parentnode = company::get_company_parentnode($company->id);
     if ($this->regionid != $parentnode->id) {
         $regionlist = company::get_my_region($this->regionid);
         if ($regionlist) {
             $regionlistarr[$regionlist->id] = '/' . $regionlist->name;
         }
     } else {
         $regionlist = company::get_all_regions($company->id);
         foreach ($regionlist as $region) {
             $regionlistarr[$region->id] = '/' . $region->name;
         }
     }
     $department = company::get_departmentbyid($this->departmentid);
     // Then show the fields about where this block appears.
     if ($this->action == 0) {
         $mform->addElement('header', 'header', get_string('createlocation', 'block_iomad_company_admin'));
     } else {
         $mform->addElement('header', 'header', get_string('editlocations', 'block_iomad_company_admin'));
     }
     $mform->addElement('hidden', 'departmentid', $this->departmentid);
     $mform->setType('departmentid', PARAM_INT);
     $mform->addElement('hidden', 'action', $this->action);
     $mform->setType('action', PARAM_INT);
     if ($regionlist) {
         $select = $mform->addElement('select', 'deptid', get_string('region', 'block_iomad_company_admin'), $regionlistarr);
         //$mform->disabledIf('deptid', 'action', 'eq', 1);
     }
     $mform->addElement('text', 'fullname', get_string('fullnamelocation', 'block_iomad_company_admin'), 'maxlength = "254" size = "50"');
     $mform->addHelpButton('fullname', 'fullnamelocation', 'block_iomad_company_admin');
     $mform->addRule('fullname', get_string('missingfullnamelocation', 'block_iomad_company_admin'), 'required', null, 'client');
     $mform->setType('fullname', PARAM_MULTILANG);
     $mform->addElement('text', 'shortname', get_string('shortnamelocation', 'block_iomad_company_admin'), 'maxlength = "100" size = "20"');
     $mform->addHelpButton('shortname', 'shortnamelocation', 'block_iomad_company_admin');
     $mform->addRule('shortname', get_string('missingshortnamelocation', 'block_iomad_company_admin'), 'required', null, 'client');
     $mform->setType('shortname', PARAM_MULTILANG);
     if (!$this->departmentid) {
         $mform->addElement('hidden', 'chosenid', $this->chosenid);
     } else {
         $mform->addElement('hidden', 'chosenid', $this->departmentid);
     }
     $mform->setType('chosenid', PARAM_INT);
     $this->add_action_buttons();
 }
开发者ID:sumitnegi933,项目名称:Moodle_lms_New,代码行数:50,代码来源:company_location_create_form.php

示例2: definition

 public function definition()
 {
     global $CFG;
     $mform =& $this->_form;
     $company = new company($this->selectedcompany);
     //$departmentslist = company::get_all_departments($company->id);
     $region = company::get_departmentbyid($this->departmentid);
     $companieslist = company::get_companies_select();
     // Then show the fields about where this block appears.
     if ($this->action == 0) {
         $mform->addElement('header', 'header', get_string('createregion', 'block_iomad_company_admin'));
     } else {
         $mform->addElement('header', 'header', get_string('editregion', 'block_iomad_company_admin'));
     }
     $mform->addElement('hidden', 'companyid', $this->selectedcompany);
     $mform->setType('companyid', PARAM_INT);
     $mform->addElement('hidden', 'action', $this->action);
     $mform->setType('action', PARAM_INT);
     $mform->addElement('hidden', 'departmentid', $this->departmentid);
     $mform->setType('departmentid', PARAM_INT);
     /* $mform->addElement('select', 'deptid', get_string('department', 'block_iomad_company_admin'), $companieslist);
        $mform->disabledIf('deptid', 'action', 'eq', 1); */
     $mform->addElement('text', 'fullname', get_string('fullnameregion', 'block_iomad_company_admin'), 'maxlength = "254" size = "50"');
     $mform->addHelpButton('fullname', 'fullnameregion', 'block_iomad_company_admin');
     $mform->addRule('fullname', get_string('missingfullnameregion', 'block_iomad_company_admin'), 'required', null, 'client');
     $mform->setType('fullname', PARAM_MULTILANG);
     $mform->addElement('text', 'shortname', get_string('shortnameregion', 'block_iomad_company_admin'), 'maxlength = "100" size = "20"');
     $mform->addHelpButton('shortname', 'shortnameregion', 'block_iomad_company_admin');
     $mform->addRule('shortname', get_string('missingshortnameregion', 'block_iomad_company_admin'), 'required', null, 'client');
     $mform->setType('shortname', PARAM_MULTILANG);
     //echo "departmentid".$this->departmentid;
     if (!$this->departmentid) {
         $mform->addElement('hidden', 'chosenid', $this->chosenid);
     } else {
         $mform->addElement('hidden', 'chosenid', $this->departmentid);
     }
     $mform->setType('chosenid', PARAM_INT);
     $this->add_action_buttons();
 }
开发者ID:sumitnegi933,项目名称:Moodle_lms_New,代码行数:39,代码来源:company_region_create_form.php

示例3: definition

 public function definition()
 {
     global $CFG, $USER;
     $mform =& $this->_form;
     $company = new company($this->selectedcompany);
     //$departmentslist = company::get_all_departments($company->id);
     $departmentlist = array();
     if ($this->deptid) {
         $departmentlist = array();
         if ($this->locationid) {
             $department = company::get_departmentbyid($this->locationid);
             $departmenttree = company::get_subdepartments($department);
             $parentlist[$department->id] = array($department->id => '/' . $department->name);
             $departmentlist = company::array_flatten($parentlist + company::get_subdepartments_list($departmenttree));
         }
     }
     // Then show the fields about where this block appears.
     if ($this->action == 0) {
         $mform->addElement('header', 'header', get_string('createdepartment', 'block_iomad_company_admin'));
     } else {
         $mform->addElement('header', 'header', get_string('editdepartments', 'block_iomad_company_admin'));
     }
     $regionlist = company::get_all_regions($company->id);
     $regionlistarr = array('' => get_string('choose'));
     foreach ($regionlist as $region) {
         $regionlistarr[$region->id] = $region->name;
     }
     $parentnode = company::get_company_parentnode($this->selectedcompany);
     $context = context_system::instance();
     if (iomad::has_capability('block/iomad_company_admin:edit_all_departments', $context)) {
         $userhierarchylevel = $parentnode->id;
     } else {
         $userlevel = company::get_userlevel($USER);
         $userhierarchylevel = $userlevel->id;
     }
     $showregion = 1;
     $showlocation = 1;
     if ($parentnode->id != $userhierarchylevel) {
         $myregion = company::get_my_region($userhierarchylevel);
         if (!$myregion) {
             $showregion = 0;
         }
         $mylocation = company::get_my_location($userhierarchylevel);
         if (!$mylocation) {
             $showlocation = 0;
         }
     }
     $locationlist = array();
     if ($this->locationid) {
         $locationdetail = company::get_departmentbyid($this->locationid);
         $locationlist[$locationdetail->id] = $locationdetail->name;
     }
     $mform->addElement('hidden', 'departmentid', $this->deptid);
     $mform->setType('departmentid', PARAM_INT);
     $mform->addElement('hidden', 'deptlocation', $this->locationid);
     $mform->setType('deptlocation', PARAM_INT);
     $mform->addElement('hidden', 'action', $this->action);
     $mform->setType('action', PARAM_INT);
     if ($showregion) {
         $mform->addElement('select', 'regionid', get_string('region', 'block_iomad_company_admin'), $regionlistarr);
         $mform->disabledIf('regionid', 'action', 'eq', 1);
     }
     if ($showlocation) {
         $mform->addElement('select', 'locationid', get_string('location', 'block_iomad_company_admin'), $locationlist);
         $mform->disabledIf('locationid', 'action', 'eq', 1);
     }
     if ($departmentlist) {
         $attr = array('class' => 'dept_container');
         if ($this->disabledeptlist) {
             $attr['disabled'] = 'disabled';
         }
         $mform->addElement('select', 'deptid', get_string('department', 'block_iomad_company_admin'), $departmentlist, $attr);
     }
     $mform->addElement('text', 'fullname', get_string('fullnamedepartment', 'block_iomad_company_admin'), 'maxlength = "254" size = "50"');
     $mform->addHelpButton('fullname', 'fullnamedepartment', 'block_iomad_company_admin');
     $mform->addRule('fullname', get_string('missingfullnamedepartment', 'block_iomad_company_admin'), 'required', null, 'client');
     $mform->setType('fullname', PARAM_MULTILANG);
     $mform->addElement('text', 'shortname', get_string('shortnamedepartment', 'block_iomad_company_admin'), 'maxlength = "100" size = "20"');
     $mform->addHelpButton('shortname', 'shortnamedepartment', 'block_iomad_company_admin');
     $mform->addRule('shortname', get_string('missingshortnamedepartment', 'block_iomad_company_admin'), 'required', null, 'client');
     $mform->setType('shortname', PARAM_MULTILANG);
     $mform->addElement('hidden', 'chosenid', $this->chosenid);
     $mform->setType('chosenid', PARAM_INT);
     $this->add_action_buttons();
 }
开发者ID:sumitnegi933,项目名称:Moodle_lms_New,代码行数:85,代码来源:company_department_create_form.php

示例4: required_param

$location = required_param('locationid', PARAM_INT);
require_login();
$PAGE->set_context($context);
if (!empty($SESSION->currenteditingcompany)) {
    $companyid = $SESSION->currenteditingcompany;
} else {
    if (company_user::is_company_user()) {
        $companyid = company_user::companyid();
    }
}
$company = new company($companyid);
if (!empty($location) && !company::check_valid_department($company->id, $location)) {
    print_error('invalidregion', 'block_iomad_company_admin');
}
iomad::require_capability('block/iomad_company_admin:edit_departments', $context);
$locationdetail = company::get_departmentbyid($location);
$subdepartmenthtml = '';
if ($locationdetail) {
    $subdepartmentslist = company::get_subdepartments_list($locationdetail);
    $subdepartments = array();
    $departmentdropdownlist = '<option value="">' . get_string('choose') . '</option>';
    $enablebuttons = 0;
    if (!empty($subdepartmentslist)) {
        $subdepartmenthtml = "<div class='locationlist_container checkboxcontainer'>";
        $enablebuttons = 1;
        $subdepartmenthtml .= "<p>" . get_string('department', 'block_iomad_company_admin') . "</p>";
        foreach ($subdepartmentslist as $key => $value) {
            $subdepartmenthtml .= '<input type = "checkbox" name = "departmentids[]" value="' . $key . '" /> ' . $value . '</br>';
            $departmentdropdownlist .= '<option value="' . $key . '">' . $value . '</option>';
        }
        $subdepartmenthtml .= '</div>';
开发者ID:sumitnegi933,项目名称:Moodle_lms_New,代码行数:31,代码来源:company_get_all_departments.php


注:本文中的company::get_departmentbyid方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。