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


PHP company::get_recursive_department_users方法代码示例

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


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

示例1: foreach

        $searchparams['firstname'] = '%' . $params['firstname'] . '%';
    }
    if (!empty($params['lastname'])) {
        $sqlsearch .= " AND lastname like :lastname ";
        $searchparams['lastname'] = '%' . $params['lastname'] . '%';
    }
    if (!empty($params['email'])) {
        $sqlsearch .= " AND email like :email ";
        $searchparams['email'] = '%' . $params['email'] . '%';
    }
    $userrecords = $DB->get_fieldset_select('user', 'id', $sqlsearch, $searchparams);
} else {
    if (iomad::has_capability('block/iomad_company_admin:editusers', $systemcontext)) {
        // Check if has role edit company users.
        // Get users company association.
        $departmentusers = company::get_recursive_department_users($departmentid);
        if (count($departmentusers) > 0) {
            $departmentids = "";
            foreach ($departmentusers as $departmentuser) {
                if (!empty($departmentids)) {
                    $departmentids .= "," . $departmentuser->userid;
                } else {
                    $departmentids .= $departmentuser->userid;
                }
            }
            if (!empty($showsuspended)) {
                $sqlsearch = " deleted <> 1 AND id in ({$departmentids}) ";
            } else {
                $sqlsearch = " deleted <> 1 AND suspended = 0 AND id in ({$departmentids}) ";
            }
        } else {
开发者ID:sumitnegi933,项目名称:Moodle_lms_New,代码行数:31,代码来源:editusers.php

示例2: array

if ($format) {
    $fields = array('id' => 'id', 'username' => 'username', 'email' => 'email', 'firstname' => 'firstname', 'lastname' => 'lastname', 'idnumber' => 'idnumber', 'institution' => 'institution', 'department' => 'department', 'phone1' => 'phone1', 'phone2' => 'phone2', 'city' => 'city', 'url' => 'url', 'icq' => 'icq', 'skype' => 'skype', 'aim' => 'aim', 'yahoo' => 'yahoo', 'msn' => 'msn', 'country' => 'country');
    // Get company category.
    if ($category = $DB->get_record_sql('SELECT uic.id, uic.name
                                         FROM {user_info_category} uic, {company} c
                                         WHERE c.id = ' . $companyid . ' AND
                                         c.shortname=uic.name')) {
        if ($extrafields = $DB->get_records('user_info_field', array('categoryid' => $category->id))) {
            foreach ($extrafields as $n => $v) {
                $fields['profile_field_' . $v->shortname] = 'profile_field_' . $v->shortname;
            }
        }
    }
    $params = array('companyid' => $companyid);
    // Get department users.
    $departmentusers = company::get_recursive_department_users($userhierarchylevel);
    if (count($departmentusers) > 0) {
        $departmentids = "";
        foreach ($departmentusers as $departmentuser) {
            if (!empty($departmentids)) {
                $departmentids .= "," . $departmentuser->userid;
            } else {
                $departmentids .= $departmentuser->userid;
            }
        }
        $sqlsearch = " AND userid in ({$departmentids}) ";
    } else {
        $sqlsearch = "AND 1 = 0";
    }
    $userids = $DB->get_records_sql_menu("SELECT userid, userid as id\n        FROM\n            {company_users}\n        WHERE\n            companyid = :companyid\n            " . $sqlsearch, $params);
    switch ($format) {
开发者ID:sumitnegi933,项目名称:Moodle_lms_New,代码行数:31,代码来源:user_bulk_download.php

示例3: send_to_all_users_in_department

 /**
  * Send an email to all users in a department (and it's subdepartments)
  *
  * @param integer $departmentid id of the department
  * @param string $templatename Name of the template as described in
  *                             the global $email array or overridden
  *                             in the mdl_email_template table
  * @param array $options array of options to pass into each email
  * @return bool Returns true if mail was sent OK and false if there was an error
  */
 public static function send_to_all_users_in_department($departmentid, $templatename, $options = array())
 {
     global $DB;
     $users = company::get_recursive_department_users($departmentid);
     $useroptions = array_map('self::getuseroption', $users);
     $result = self::send($templatename, $options, $useroptions);
     if ($result === true) {
         return true;
     } else {
         return $result == count($useroptions);
     }
 }
开发者ID:sumitnegi933,项目名称:Moodle_lms_New,代码行数:22,代码来源:api.php


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