コード例 #1
0
ファイル: stats_filters.php プロジェクト: bqq1986/efront
        $flag = 1;
        foreach ($jobs_array as $value) {
            $flag = $flag && eF_checkParameter($value, 'id');
        }
        if ($flag) {
            $result = eF_getTableDataFlat("module_hcd_job_description", "job_description_ID,branch_ID", " description IN (SELECT description FROM module_hcd_job_description WHERE job_description_ID IN (" . implode(",", $jobs_array) . "))");
            $jobs_array = $result['job_description_ID'];
            $stats_filters[] = array("table" => "module_hcd_employee_has_job_description as filter_ej", "joinField" => "filter_ej.users_login", "condition" => "(filter_ej.job_description_ID in (" . implode(",", $jobs_array) . "))");
        }
    }
}
#cpp#endif
if (!isset($_GET['ajax'])) {
    if ($_SESSION['s_type'] == 'administrator') {
        //supervisors don't see groups
        $groups = EfrontGroup::getGroups();
        $smarty->assign("T_GROUPS", $groups);
    } else {
        $groups = $currentUser->getGroups();
        // Changed for 3.6.15 to show only professor's groups
        $smarty->assign("T_GROUPS", $groups);
    }
    if (G_VERSIONTYPE == 'enterprise') {
        #cpp#ifdef ENTERPRISE
        // Create the branches select
        require_once $path . "module_hcd_tools.php";
        eF_getRights();
        $company_branches = eF_getTableData("module_hcd_branch", "branch_ID, name, father_branch_ID", "", "father_branch_ID ASC,branch_ID ASC");
        if ($_SESSION['s_type'] != 'administrator' && $currentEmployee->isSupervisor()) {
            //this applies to supervisors only
            foreach ($company_branches as $key => $value) {
コード例 #2
0
ファイル: index.php プロジェクト: bqq1986/efront
 if (G_VERSIONTYPE == 'enterprise') {
     #cpp#ifdef ENTERPRISE
     $self_registered_jobs = array();
 }
 #cpp#endif
 foreach ($user_profile as $field) {
     //Get the custom fields values
     if ($field['type'] == 'date') {
         $user_data[$field['name']] = mktime($values[$field['name']]['H'], $values[$field['name']]['i'], $values[$field['name']]['s'], $values[$field['name']]['M'], $values[$field['name']]['d'], $values[$field['name']]['Y']);
     } else {
         if ($field['type'] == 'branchinfo') {
             $self_registered_jobs[] = array("branch_ID" => $values[$field['name'] . "_branches"], "job_description" => $_POST[$field['name'] . "_jobs"], "supervisor" => $_POST[$field['name'] . "_supervisors"], "mandatory" => $field['mandatory']);
         } else {
             if ($field['type'] == 'groupinfo') {
                 if ($values[$field['name'] . "_groups"]) {
                     $groupToAdd = new EfrontGroup($values[$field['name'] . "_groups"]);
                 }
             } else {
                 $user_data[$field['name']] = $values[$field['name']];
             }
         }
     }
 }
 $newUser = EfrontUser::createUser($user_data);
 $encrypted = true;
 //needed for autologin
 EfrontEvent::triggerEvent(array("type" => EfrontEvent::SYSTEM_REGISTER, "users_LOGIN" => $user_data['login'], "users_name" => $user_data['name'], "users_surname" => $user_data['surname'], "entity_name" => $user_data['password']));
 // send not-visited notifications for the newly registered user
 //EfrontEvent::triggerEvent(array("type" => (-1) * EfrontEvent::SYSTEM_VISITED, "users_LOGIN" => $user_data['login'], "users_name" => $user_data['name'], "users_surname" => $user_data['surname']));
 if (G_VERSIONTYPE == 'enterprise') {
     #cpp#ifdef ENTERPRISE
コード例 #3
0
 /**
  * Remove groups from employee.
  *
  * This function can be used to remove a group from the current employee.
  * <br/>Example:
  * <code>
  * $employee = EfrontHcdUserFactory :: factory('jdoe');
  * $employee -> removeGroups(23);						  //Remove a signle group with id 23
  * $employee -> removeGroups(array(23,24,25));			 //Remove multiple groups using an array
  * </code>
  *
  * @param int $groupIds Either a single group id, or an array if ids
  * @return int The array of group ids.
  * @since 3.5.0
  * @access public
  */
 public function removeGroups($groupIds)
 {
     $this->groups or $this->getGroups();
     //Populate $this -> groups if it is not already filled in
     if (!is_array($groupIds)) {
         $groupIds = array($groupIds);
     }
     foreach ($groupIds as $key => $groupId) {
         if (eF_checkParameter($groupId, 'id') && isset($this->groups[$groupId])) {
             $group = new EfrontGroup($groupId);
             $group->removeUsers($this->user['login']);
             unset($this->groups[$key]);
             //Remove groups from cache array."
         }
     }
     return $this->groups;
 }
コード例 #4
0
 private function doUnenrollUsers()
 {
     $smarty = $this->getSmartyVar();
     $currentUser = $this->getCurrentUser();
     if ($_GET['type'] == 'job') {
         foreach (EfrontJob::getAllJobs() as $key => $value) {
             $entities[$value['job_description_ID']] = $value['description'];
         }
         if ($_GET['entry']) {
             $entity = new EfrontJob($_GET['entry']);
             $courses = $entity->getJobCourses(array('archive' => false));
             $users = $entity->getEmployees();
         }
     } elseif ($_GET['type'] == 'branch') {
         foreach (EfrontBranch::getAllBranches() as $key => $value) {
             $entities[$value['branch_ID']] = $value['name'];
         }
         if ($_GET['entry']) {
             $entity = new EfrontBranch($_GET['entry']);
             $courses = $entity->getBranchCourses(array('archive' => false));
             $users = $entity->getEmployees();
         }
     } elseif ($_GET['type'] == 'group') {
         foreach (EfrontGroup::getGroups() as $key => $value) {
             $entities[$value['id']] = $value['name'];
         }
         if ($_GET['entry']) {
             $entity = new EfrontGroup($_GET['entry']);
             $courses = $entity->getGroupCourses(array('archive' => false));
             $users = $entity->getGroupUsers();
         }
     }
     if ($_GET['ajax'] && $_GET['remove_users_from_courses']) {
         try {
             foreach ($courses as $course) {
                 $course->removeUsers($users);
             }
             exit;
         } catch (Exception $e) {
             handleAjaxExceptions($e);
         }
     }
     $smarty->assign("T_ENTITIES_LIST", $entities);
 }
コード例 #5
0
 protected function getGroupByName($group_name)
 {
     if (!$groupNamesToIds) {
         $groups = EfrontGroup::getGroups();
         foreach ($groups as $group) {
             if (!isset($groupNamesToIds[$group['name']])) {
                 $groupNamesToIds[$group['name']] = array($group['id']);
             } else {
                 $groupNamesToIds[$group['name']][] = $group['id'];
             }
         }
     }
     return $groupNamesToIds[$group_name];
 }
コード例 #6
0
ファイル: student.php プロジェクト: kaseya-university/efront
        }
        // Run onNewPageLoad code of the module (if such is defined)
        $module->onNewPageLoad();
    }
} catch (Exception $e) {
    handleNormalFlowExceptions($e);
}
/*Ajax call to enter group and get group lessons */
if (isset($_GET['ajax']) && isset($_GET['group_key'])) {
    try {
        if (!eF_checkParameter($_GET['group_key'], 'alnum_general')) {
            throw new Exception(_INVALIDDATA . ': ' . $_GET['group_key']);
        }
        $result = eF_getTableData("groups", "*", "unique_key = '" . $_GET['group_key'] . "'");
        if (sizeof($result) > 0) {
            $group = new EfrontGroup($result[0]);
            echo json_encode($group->useKeyForUser($currentUser));
        } else {
            throw new Exception(_INVALIDKEY . ': ' . $_GET['group_key']);
        }
    } catch (Exception $e) {
        handleAjaxExceptions($e);
    }
    exit;
}
if (isset($_GET['bookmarks']) && EfrontUser::isOptionVisible('bookmarks')) {
    try {
        $bookmarks = bookmarks::getBookmarks($currentUser, $currentLesson);
        if ($_GET['bookmarks'] == 'remove' && in_array($_GET['id'], array_keys($bookmarks))) {
            $bookmark = new bookmarks($_GET['id']);
            $bookmark->delete();
コード例 #7
0
ファイル: group.class.php プロジェクト: bqq1986/efront
 public static function addToDefaultGroup($user, $userType)
 {
     // Get the default eFront group
     if (!$default_group) {
         $default_group = eF_getTableData("groups", "*", "is_default = 1 AND active = 1");
         if (sizeof($default_group)) {
             $default_group = $default_group[0];
         } else {
             $default_group = true;
             return;
         }
     }
     try {
         $roles = EfrontUser::getRoles();
         $group = new EfrontGroup($default_group);
         //Add user to group with group's default type or, if one is not set, the user's type
         $group->addUsers($user, $group->group['user_types_ID'] ? $group->group['user_types_ID'] : $userType);
     } catch (Exception $e) {
         /*otherwise no default group has been defined*/
     }
     return true;
 }
コード例 #8
0
ファイル: user.php プロジェクト: jiangjunt/efront_open_source
            EfrontSystem::switchLessonReportingMode($values['time_reports']);
        }
        unset($values['reset_license_note']);
        //Unset it, since we don't need to store this value to the database
        unset($values['submit']);
        foreach ($values as $key => $value) {
            EfrontConfiguration::setValue($key, $value);
        }
        eF_redirect(basename($_SERVER['PHP_SELF']) . "?ctg=system_config&op=user&tab=main&message=" . urlencode(_SUCCESFULLYUPDATECONFIGURATION) . "&message_type=success");
    }
}
$smarty->assign("T_USER_MAIN_FORM", $userMainForm->toArray());
$userMultipleLoginsForm = new HTML_QuickForm("user_multiple_logins_form", "post", basename($_SERVER['PHP_SELF']) . "?ctg=system_config&op=user&tab=multiple_logins", "", null, true);
$userMultipleLoginsForm->registerRule('checkParameter', 'callback', 'eF_checkParameter');
$groups = array();
foreach (EfrontGroup::getGroups() as $value) {
    $groups[$value['id']] = $value['name'];
}
$userMultipleLoginsForm->addElement("select", "global", _ALLOWMULTIPLELOGINSGLOBALLY, array(0 => _NO, 1 => _YES));
$userMultipleLoginsForm->addElement("select", "user_types", _EXCEPTFORTHEROLES, EfrontUser::getRoles(true), "multiple");
if (sizeof($groups) > 0) {
    $userMultipleLoginsForm->addElement("select", "groups", _EXCEPTFORTHEGROUPS, $groups, "multiple");
}
$userMultipleLoginsForm->addElement("static", "", _HOLDDOWNCTRLFORMULTIPLESELECT);
$userMultipleLoginsForm->setDefaults(unserialize($GLOBALS['configuration']['multiple_logins']));
if (isset($currentUser->coreAccess['configuration']) && $currentUser->coreAccess['configuration'] != 'change') {
    $userMultipleLoginsForm->freeze();
} else {
    $userMultipleLoginsForm->addElement("submit", "submit", _SAVE, 'class = "flatButton"');
    if ($userMultipleLoginsForm->isSubmitted() && $userMultipleLoginsForm->validate()) {
        $values = $userMultipleLoginsForm->exportValues();
コード例 #9
0
    try {
        $group = new EfrontGroup($_GET['deactivate_user_group']);
        $group->group['active'] = 0;
        $group->persist();
        echo "0";
    } catch (Exception $e) {
        handleAjaxExceptions($e);
    }
    exit;
} elseif (isset($_GET['activate_user_group']) && eF_checkParameter($_GET['activate_user_group'], 'id')) {
    if (isset($currentUser->coreAccess['groups']) && $currentUser->coreAccess['groups'] != 'change') {
        echo urlencode(_UNAUTHORIZEDACCESS);
        exit;
    }
    try {
        $group = new EfrontGroup($_GET['activate_user_group']);
        $group->group['active'] = 1;
        $group->persist();
        echo "1";
    } catch (Exception $e) {
        handleAjaxExceptions($e);
    }
    exit;
} elseif (isset($_GET['add_user_group']) || isset($_GET['edit_user_group']) && eF_checkParameter($_GET['edit_user_group'], 'id')) {
    if (isset($_GET['edit_user_group'])) {
        $currentGroup = new EfrontGroup($_GET['edit_user_group']);
        $smarty->assign("T_CURRENT_GROUP", $currentGroup);
        if (G_VERSIONTYPE != 'community') {
            #cpp#ifndef COMMUNITY
            $smarty->assign("T_STATS_LINK", array(array('text' => _STATISTICS, 'image' => "16x16/reports.png", 'href' => basename($_SERVER['PHP_SELF']) . "?ctg=statistics&option=groups&sel_group=" . $_GET['edit_user_group'], 'target' => '_self')));
        }
コード例 #10
0
ファイル: api2.php プロジェクト: jiangjunt/efront_open_source
 if (eF_checkParameter($_GET['group'], 'id') == false) {
     echo "<xml>";
     echo "<status>error</status>";
     echo "<message>Invalid group id</message>";
     echo "</xml>";
     exit;
 }
 if (eF_checkParameter($_GET['login'], 'login') == false) {
     echo "<xml>";
     echo "<status>error</status>";
     echo "<message>Invalid login format</message>";
     echo "</xml>";
     exit;
 }
 try {
     $group = new EfrontGroup($_GET['group']);
     $user = EfrontUserFactory::factory($_GET['login']);
     $group_users = $group->getUsers();
     if (!in_array($_GET['login'], $group_users['student']) && !in_array($_GET['login'], $group_users['professor'])) {
         echo "<xml>";
         echo "<status>error</status>";
         echo "<message>User is not assigned to group</message>";
         echo "</xml>";
         exit;
     } else {
         $group->removeUsers(array($_GET['login']));
         echo "<xml>";
         echo "<status>ok</status>";
         echo "</xml>";
     }
 } catch (Exception $e) {
コード例 #11
0
        //pr($user_profile_dates);
        $smarty->assign("T_USER_PROFILE_DATES", $user_profile_dates);
    }
}
#cpp#endif
$smarty->assign("T_DATES_SEARCH_CRITERIA", implode(",", $datesFields));
$renderer = new HTML_QuickForm_Renderer_ArraySmarty($smarty);
$renderer->setRequiredTemplate('{$html}{if $required}
                &nbsp;<span class = "formRequired">*</span>
            {/if}');
// Management of the 'send email to all found' link icon on the top right of the table
// During page load create the item
$mass_operations = array(array('id' => 'groupUsersId', 'text' => _SETFOUNDEMPLOYEESINTOGROUP, 'image' => "16x16/users.png", 'href' => "javascript:void(0);", "onclick" => "eF_js_showDivPopup(event, '" . _SETFOUNDEMPLOYEESINTOGROUP . "', 0, 'insert_into_group')", 'target' => 'POPUP_FRAME'), array('id' => 'sendToAllId', 'text' => _SENDMESSAGETOALLFOUNDEMPLOYEES, 'image' => "16x16/mail.png", 'href' => "javascript:void(0);", "onclick" => "var recipient = '&recipient='+document.getElementById('usersFound').value;this.href='" . $currentUser->getType() . ".php?ctg=messages&add=1&popup=1'+recipient;eF_js_showDivPopup(event, '" . _SENDMESSAGE . "', 2)", 'target' => 'POPUP_FRAME'));
$smarty->assign("T_SENDALLMAIL_LINK", $mass_operations);
$form->setJsWarnings(_BEFOREJAVASCRIPTERROR, _AFTERJAVASCRIPTERROR);
$form->setRequiredNote(_REQUIREDNOTE);
$form->accept($renderer);
$smarty->assign('T_REPORT_FORM', $renderer->toArray());
// Popup to set to custom group form
$group_form = new HTML_QuickForm("insert_into_groups_form", "post", $_SESSION['s_type'] . ".php?ctg=search_users&search=1&branch_ID=" . $_GET['branch_ID'] . "&job_description_ID=" . $_GET['job_description_ID'], "", null, true);
$groups = array("0" => _INSERTINTONEWGROUP);
$groupsResult = EfrontGroup::getGroups();
foreach ($groupsResult as $group) {
    $groups[$group['id']] = $group['name'];
}
$group_form->addElement('select', 'existing_group', _INSERTINTOEXISTINGGROUP, $groups, 'id = "existing_group_id" class = "inputSelectMed" onchange="javascript:updateNewGroup(this, \'new_group_id\')"');
$group_form->addElement('text', 'new_group', _NEWGROUPNAME, 'class = "inputText" id="new_group_id" onChange="javascript:$(\'existing_group_id\').value = 0;"');
$group_form->setJsWarnings(_BEFOREJAVASCRIPTERROR, _AFTERJAVASCRIPTERROR);
$group_form->setRequiredNote(_REQUIREDNOTE);
$group_form->accept($renderer);
$smarty->assign('T_INSERT_INTO_GROUP_POPUP_FORM', $renderer->toArray());
コード例 #12
0
 /**
  * Delete the calendar events related to the specified group
  *
  * @param mixed $group A group id or an EfrontGroup object
  * @since 3.6.7
  * @access public
  * @static
  */
 public static function deleteGroupCalendarEvents($group)
 {
     $group = EfrontGroup::convertArgumentToGroupId($group);
     eF_deleteTableData("calendar", "type = 'group' and foreign_ID=" . $group);
 }