Example #1
0
/**
 * departments_Ajax.php
 *
 * ProcessMaker Open Source Edition
 * Copyright (C) 2004 - 2008 Colosa Inc.23
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 *
 * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
 * Coral Gables, FL, 33134, USA, or email info@colosa.com.
 */
function LookForChildren($parent, $level, $aDepUsers)
{
    G::LoadClass('configuration');
    $conf = new Configurations();
    $oDept = new Department();
    $allDepartments = $oDept->getDepartments($parent);
    $level++;
    $rows = array();
    foreach ($allDepartments as $department) {
        unset($depto);
        $depto['DEP_TITLE'] = str_replace(array("<", ">"), array("&lt;", "&gt;"), $department['DEP_TITLE']);
        $depto['DEP_STATUS'] = $department['DEP_STATUS'];
        if ($department['DEP_MANAGER_USERNAME'] != '') {
            $depto['DEP_MANAGER_NAME'] = $conf->usersNameFormat($department['DEP_MANAGER_USERNAME'], $department['DEP_MANAGER_FIRSTNAME'], $department['DEP_MANAGER_LASTNAME']);
        } else {
            $depto['DEP_MANAGER_NAME'] = '';
        }
        $depto['DEP_TOTAL_USERS'] = isset($aDepUsers[$department['DEP_UID']]) ? $aDepUsers[$department['DEP_UID']] : 0;
        $depto['DEP_UID'] = $department['DEP_UID'];
        $depto['DEP_MANAGER'] = $department['DEP_MANAGER'];
        $depto['DEP_PARENT'] = $department['DEP_PARENT'];
        if ($department['HAS_CHILDREN'] > 0) {
            $depto['children'] = LookForChildren($department['DEP_UID'], $level, $aDepUsers);
            $depto['iconCls'] = 'ss_sprite ss_chart_organisation';
            $depto['expanded'] = true;
        } else {
            $depto['leaf'] = true;
            if ($level == 1) {
                $depto['iconCls'] = 'ss_sprite ss_chart_organisation';
            } else {
                $depto['iconCls'] = 'ss_sprite ss_plugin';
            }
        }
        $rows[] = $depto;
    }
    return $rows;
}
Example #2
0
             break;
         case 'PROCESSMAKER_OPERATOR':
             $aFields['PREF_DEFAULT_MENUSELECTED'] = 'PM_CASES';
             break;
     }
     $aFields['PREF_DEFAULT_LANG'] = SYS_LANG;
 }
 if ($aFields['USR_REPLACED_BY'] != '') {
     $user = new Users();
     $u = $user->load($aFields['USR_REPLACED_BY']);
     if ($u['USR_STATUS'] == 'CLOSED') {
         $replaced_by = '';
         $aFields['USR_REPLACED_BY'] = '';
     } else {
         $c = new Configurations();
         $replaced_by = $c->usersNameFormat($u['USR_USERNAME'], $u['USR_FIRSTNAME'], $u['USR_LASTNAME']);
     }
 } else {
     $replaced_by = '';
 }
 $aFields['REPLACED_NAME'] = $replaced_by;
 $menuSelected = '';
 if ($aFields['PREF_DEFAULT_MENUSELECTED'] != '') {
     foreach ($RBAC->aUserInfo['PROCESSMAKER']['PERMISSIONS'] as $permission) {
         if ($aFields['PREF_DEFAULT_MENUSELECTED'] == $permission['PER_CODE']) {
             switch ($permission['PER_CODE']) {
                 case 'PM_USERS':
                 case 'PM_SETUP':
                     $menuSelected = strtoupper(G::LoadTranslation('ID_SETUP'));
                     break;
                 case 'PM_CASES':