本文整理汇总了PHP中EfrontUserFactory类的典型用法代码示例。如果您正苦于以下问题:PHP EfrontUserFactory类的具体用法?PHP EfrontUserFactory怎么用?PHP EfrontUserFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了EfrontUserFactory类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: analyseSkillGapTest
/**
* Analyse a completed test as a skill gap test
*
* This function is used to perform skill-gap analysis
*
* <br/>Example:
* <code>
* $result = eF_getTableData("completed_tests", "*", "id=".$_GET['show_solved_test']);
* $showTest = unserialize($result[0]['test']);
* $analysisResults = $showTest -> analyseSkillGapTest();
* $lessonsProposed = $analysisResults['lessons'];
* $coursesProposed = $analysisResults['courses'];
* </code>
*
* @return array containing the proposed all test related skills, all user missing skills, lesson and courses proposed for assignment in the form array( "testSkills" => array(...) , "missingSkills" => array(...), "lessons" => array(...), "courses" => array(...) )
* @since 3.5.2
* @access public
*/
public function analyseSkillGapTest()
{
// SUB-COMPONENT 1: Creation of the skill-gap matrix
$questionsAnswered = array();
foreach ($this->questions as $qid => $question) {
$questionsAnswered[$qid] = $question->score / 100;
}
// Acquire from the DB all skills related to the questions so that you can do the all the analysis based on the resulting skills table
$all_related_skills = eF_getTableData("module_hcd_skills JOIN questions_to_skills ON skills_ID = skill_ID", "*", "questions_ID IN ('" . implode("','", array_keys($questionsAnswered)) . "')");
$skills = array();
foreach ($questionsAnswered as $qid => $questions) {
foreach ($all_related_skills as $skill) {
if ($qid == $skill['questions_id']) {
if (isset($skills[$skill['skill_ID']])) {
$skills[$skill['skill_ID']]['correct'] = $skills[$skill['skill_ID']]['correct'] + $questions * $skill['relevance'];
$skills[$skill['skill_ID']]['total'] = $skills[$skill['skill_ID']]['total'] + $skill['relevance'];
} else {
$skills[$skill['skill_ID']] = array("id" => $skill['skill_ID'], "skill" => $skill['description'], "correct" => $questions * $skill['relevance'], "total" => $skill['relevance']);
}
}
}
}
foreach ($skills as $skid => $skill) {
$skills[$skid]['score'] = 100 * $skill['correct'] / $skill['total'];
}
// SUB-COMPONENT 2: Make the skill-gap analysis
$analysisResults = array();
$analysisResults['testSkills'] = $skills;
// Get this test's general threshold
$testOrig = eF_getTableData("tests", "options", "id = '" . $this->completedTest['testsId'] . "'");
$temp = unserialize($testOrig[0]['options']);
$this->options['general_threshold'] = $temp['general_threshold'];
// Get the missing skills according to the analysis
$skills_missing = array();
$all_skills = "";
foreach ($skills as $skill_item) {
if ($skill_item['score'] < $this->options['general_threshold']) {
// TOCHANGE: with the threshold of each separate test
$skills_missing[] = $skill_item['id'];
$all_skills .= "&" . $skill_item['id'] . "=1";
} else {
$all_skills .= "&" . $skill_item['id'] . "=0";
}
}
// This smarty variable will denote all missing and existing skills
$analysisResults['missingSkills'] = $all_skills;
$skills_missing = implode("','", $skills_missing);
$user = EfrontUserFactory::factory($this->completedTest['login']);
// SUB-COMPONENT 3: Propose lessons and courses
$lessons_attending = implode("','", array_keys($user->getLessons()));
$analysisResults['lessons'] = eF_getTableData("module_hcd_skills LEFT OUTER JOIN module_hcd_lesson_offers_skill ON module_hcd_skills.skill_ID = module_hcd_lesson_offers_skill.skill_ID", "module_hcd_lesson_offers_skill.lesson_ID, count(module_hcd_lesson_offers_skill.skill_ID) as skills_offered", "module_hcd_lesson_offers_skill.skill_ID IN ('" . $skills_missing . "') AND module_hcd_lesson_offers_skill.lesson_ID NOT IN ('" . $lessons_attending . "')", "", "module_hcd_lesson_offers_skill.lesson_ID ORDER BY skills_offered DESC");
$courses_attending = implode("','", array_keys($user->getUserCourses()));
$analysisResults['courses'] = eF_getTableData("module_hcd_skills LEFT OUTER JOIN module_hcd_course_offers_skill ON module_hcd_skills.skill_ID = module_hcd_course_offers_skill.skill_ID", "module_hcd_course_offers_skill.courses_ID, count(module_hcd_course_offers_skill.skill_ID) as skills_offered", "module_hcd_course_offers_skill.skill_ID IN ('" . $skills_missing . "') AND module_hcd_course_offers_skill.courses_ID NOT IN ('" . $courses_attending . "')", "", "module_hcd_course_offers_skill.courses_ID ORDER BY skills_offered DESC");
return $analysisResults;
}
开发者ID:kaseya-university,项目名称:efront,代码行数:73,代码来源:test.class.php
示例2: EfrontEmployee
$employee = new EfrontEmployee($new_employees_content, array());
$newUser = EfrontUserFactory::factory($values['login']);
//$encrypted = false; //the factory above changed the user password mode
if ($configuration['supervisor_mail_activation'] == 1 && $job_assigned['supervisor'] != "") {
$activating_supervisor_found = true;
$employee->addJob($newUser, $new_job_description_ID, $job_assigned['branch_ID'], 0, false, array("manager" => $job_assigned['supervisor'], "timestamp" => $newUser->user['timestamp']));
} else {
$employee->addJob($newUser, $new_job_description_ID, $job_assigned['branch_ID'], 0);
}
}
}
if ($_SESSION['s_current_branch']) {
$employee = new EfrontEmployee($new_employees_content, array());
if (!in_array($_SESSION['s_current_branch'], $employee->getBranches(true))) {
$new_job_description_ID = eF_getJobDescriptionId(_NOSPECIFICJOB, $_SESSION['s_current_branch']);
$newUser = EfrontUserFactory::factory($values['login']);
$employee->addJob($newUser, $new_job_description_ID, $_SESSION['s_current_branch'], 0);
}
}
} catch (Exception $e) {
$newUser->delete();
eF_redirect(basename($_SERVER['PHP_SELF']) . '?ctg=signup&message=' . urlencode($e->getMessage()) . '&message_type=failure');
}
}
#cpp#endif
if ($configuration['activation'] == 0) {
if ($configuration['mail_activation'] == 1) {
$tmp = eF_getTableData("users", "timestamp, login, name,surname", "login='" . $user_data['login'] . "'");
$timestamp = $tmp[0]["timestamp"];
EfrontEvent::triggerEvent(array("type" => EfrontEvent::SYSTEM_ON_EMAIL_ACTIVATION, "users_LOGIN" => $tmp[0]['login'], "users_name" => $tmp[0]['name'], "users_surname" => $tmp[0]['surname'], "timestamp" => $timestamp, "entity_name" => $timestamp));
$message = _YOUWILLRECEIVEMAILFORACCOUNTACTIVATION;
开发者ID:bqq1986,项目名称:efront,代码行数:31,代码来源:index.php
示例3: convertDatabaseResultToUserObjects
public static function convertDatabaseResultToUserObjects($result)
{
$roles = EfrontLessonUser::getRoles();
$userObjects = array();
foreach ($result as $value) {
$userObjects[$value['login']] = EfrontUserFactory::factory($value, false, $value['role'] ? $roles[$value['role']] : false);
}
return $userObjects;
}
开发者ID:kaseya-university,项目名称:efront,代码行数:9,代码来源:user.class-backup.php
示例4: catch
echo "<status>error</status>";
echo "<message>Incomplete arguments</message>";
echo "</xml>";
}
} else {
echo "<xml>";
echo "<status>error</status>";
echo "<message>Invalid token</message>";
echo "</xml>";
}
break;
case 'user_info':
if (isset($_GET['token']) && checkToken($_GET['token'])) {
if (isset($_GET['login'])) {
try {
$user = EfrontUserFactory::factory($_GET['login']);
echo "<xml>";
echo "<general_info>";
echo "<name>" . $user->user['name'] . " " . $user->user['surname'] . "</name>";
echo "<active>" . $user->user['active'] . "</active>";
echo "<user_type>" . $user->user['user_type'] . "</user_type>";
echo "</general_info>";
echo "</xml>";
} catch (Exception $e) {
echo "<xml>";
echo "<status>error</status>";
echo "<message>User doesn't exist</message>";
echo "</xml>";
}
} else {
echo "<xml>";
开发者ID:bqq1986,项目名称:efront,代码行数:31,代码来源:api.php
示例5: session_cache_limiter
/**
* This file is used to display a small files list, and is used
* inside the "insert image" operation of the editor
*/
//General initialization and parameters
session_cache_limiter('none');
session_id($_COOKIE['parent_sid']);
session_start();
$path = "../../libraries/";
/** Configuration file.*/
include_once $path . "configuration.php";
//Access is not allowed to users that are not logged in
if (isset($_SESSION['s_login']) && $_SESSION['s_password']) {
try {
$currentUser = EfrontUserFactory::factory($_SESSION['s_login']);
} catch (EfrontException $e) {
$message = $e->getMessage() . ' (' . $e->getCode() . ')';
eF_redirect("index.php?message=" . urlencode($message) . "&message_type=failure");
exit;
}
} else {
eF_redirect("index.php?message=" . urlencode(_YOUCANNOTACCESSTHISPAGE) . "&message_type=failure");
exit;
}
try {
//There are 2 legal modes: 'lessons' and 'external'. In the first case, we read the legitimate directory from the session. In the second case, we take it from global constant
if ($_GET['mode'] == 'lesson') {
$currentLesson = new EfrontLesson($_SESSION['s_lessons_ID']);
$rootDir = new EfrontDirectory($currentLesson->getDirectory());
$filesBaseUrl = $currentLesson->getDirectoryUrl();
开发者ID:jiangjunt,项目名称:efront_open_source,代码行数:30,代码来源:browse.php
示例6: export
//.........这里部分代码省略.........
$projects = eF_getTableData("projects", "*", "lessons_ID=" . $this->lesson['id']);
if (sizeof($projects) > 0) {
$data['projects'] = $projects;
}
$lesson_files = eF_getTableData("files", "*", "path like '" . str_replace(G_ROOTPATH, '', EfrontDirectory::normalize($this->getDirectory())) . "%'");
if (sizeof($lesson_files) > 0) {
$data['files'] = $lesson_files;
}
if (G_VERSIONTYPE != 'community') {
#cpp#ifndef COMMUNITY
if (G_VERSIONTYPE != 'standard') {
#cpp#ifndef STANDARD
//Export scorm tables from here over
$scormLessonTables = array('scorm_sequencing_adlseq_map_info', 'scorm_sequencing_content_to_organization', 'scorm_sequencing_maps_info', 'scorm_sequencing_organizations');
foreach ($scormLessonTables as $table) {
$scorm_data = eF_getTableData($table, "*", "lessons_ID=" . $this->lesson['id']);
if (sizeof($scorm_data) > 0) {
$data[$table] = $scorm_data;
}
}
$scormContentTables = array('scorm_sequencing_completion_threshold', 'scorm_sequencing_constrained_choice', 'scorm_sequencing_control_mode', 'scorm_sequencing_delivery_controls', 'scorm_sequencing_hide_lms_ui', 'scorm_sequencing_limit_conditions', 'scorm_sequencing_maps', 'scorm_sequencing_map_info', 'scorm_sequencing_objectives', 'scorm_sequencing_rollup_considerations', 'scorm_sequencing_rollup_controls', 'scorm_sequencing_rollup_rules', 'scorm_sequencing_rules');
if ($content_list) {
foreach ($scormContentTables as $table) {
$scorm_data = eF_getTableData($table, "*", "content_ID IN ({$content_list})");
if (sizeof($scorm_data) > 0) {
$data[$table] = $scorm_data;
}
if ($table == 'scorm_sequencing_rollup_rules' && sizeof($scorm_data) > 0) {
$ids = array();
foreach ($scorm_data as $value) {
$ids[] = $value['id'];
}
$result = eF_getTableData('scorm_sequencing_rollup_rule', "*", "scorm_sequencing_rollup_rules_ID IN (" . implode(",", $ids) . ")");
$data['scorm_sequencing_rollup_rule'] = $result;
}
if ($table == 'scorm_sequencing_rules' && sizeof($scorm_data) > 0) {
$ids = array();
foreach ($scorm_data as $value) {
$ids[] = $value['id'];
}
$result = eF_getTableData('scorm_sequencing_rule', "*", "scorm_sequencing_rules_ID IN (" . implode(",", $ids) . ")");
$data['scorm_sequencing_rule'] = $result;
}
}
}
}
#cpp#endif
}
#cpp#endif
//'scorm_sequencing_rollup_rule', 'scorm_sequencing_rule',
// MODULES - Export module data
// Get all modules (NOT only the ones that have to do with the user type)
$modules = eF_loadAllModules();
foreach ($modules as $module) {
if ($moduleData = $module->onExportLesson($this->lesson['id'])) {
$data[$module->className] = $moduleData;
}
}
file_put_contents($this->directory . '/' . "data.dat", serialize($data));
//Create database dump file
if ($exportFiles) {
$lessonDirectory = new EfrontDirectory($this->directory);
$file = $lessonDirectory->compress($this->lesson['id'] . '_exported.zip', false);
//Compress the lesson files
} else {
$dataFile = new EfrontFile($this->directory . '/' . "data.dat");
$file = $dataFile->compress($this->lesson['id'] . '_exported.zip');
}
$newList = FileSystemTree::importFiles($file['path']);
//Import the file to the database, so we can download it
$file = new EfrontFile(current($newList));
if (empty($GLOBALS['currentUser'])) {
if ($_SESSION['s_login']) {
$GLOBALS['currentUser'] = EfrontUserFactory::factory($_SESSION['s_login']);
$userTempDir = $GLOBALS['currentUser']->user['directory'] . '/temp';
} else {
$userTempDir = sys_get_temp_dir();
}
} else {
$userTempDir = $GLOBALS['currentUser']->user['directory'] . '/temp';
}
if (!is_dir($userTempDir)) {
//If the user's temp directory does not exist, create it
$userTempDir = EfrontDirectory::createDirectory($userTempDir, false);
$userTempDir = $userTempDir['path'];
}
try {
$existingFile = new EfrontFile($userTempDir . '/' . EfrontFile::encode($this->lesson['name']) . '.zip');
//Delete any previous exported files
$existingFile->delete();
} catch (Exception $e) {
}
if ($rename) {
$newName = str_replace(array('"', '>', '<', '*', '?', ':'), array('"', '>', '<', '*', '?', ':'), $this->lesson['name']);
$file->rename($userTempDir . '/' . EfrontFile::encode($newName) . '.zip', true);
}
unlink($this->directory . '/' . "data.dat");
//Delete database dump file
return $file;
}
开发者ID:jiangjunt,项目名称:efront_open_source,代码行数:101,代码来源:lesson.class.php
示例7: importData
//.........这里部分代码省略.........
EfrontJob::createJob($data);
$this->log["success"][] = _LINE . " {$line}: " . _NEWJOB . " " . $data['description'];
}
} else {
$this->log["failure"][] = _LINE . " {$line}: " . _NOTITLEPROVIDEDFORNEWJOB;
}
break;
case "skills":
if ($data['skill_category'] == "") {
throw new EfrontSkillException(_MISSINGSKILLCATEGORY, EfrontSkillException::INVALID_SKILL_CATEGORY);
} else {
$data['categories_ID'] = $this->getSkillCategoryByName($data['skill_category']);
if ($data['categories_ID'][0] != "") {
$data['categories_ID'] = $data['categories_ID'][0];
} else {
// create skill category
$data['categories_ID'] = eF_insertTableData("module_hcd_skill_categories", array('description' => $data['skill_category']));
$this->setSkillCategoryByName($data['skill_category'], $data['categories_ID']);
}
}
unset($data['skill_category']);
$skill_ID = $this->getSkillByName($data['description']);
if ($skill_ID) {
//TODO: another double issue
$data['skill_ID'] = $skill_ID[0];
throw new EfrontSkillException(_SKILLALREADYEXISTS, EfrontSkillException::SKILL_EXISTS);
} else {
EfrontSkill::createSkill($data);
$this->log["success"][] = _LINE . " {$line}: " . _NEWSKILL . " " . $data['description'];
}
break;
case "users_to_jobs":
// Get user
$user = EfrontUserFactory::factory($data["users_login"]);
// Get branch id
$branch_ID = $this->getBranchByName($data['branch_name']);
$branch_name = $data['branch_name'];
if ($branch_ID[0] != "") {
if (sizeof($branch_ID) == 1) {
$branch_ID = $branch_ID[0];
} else {
throw new EfrontBranchException(_BRANCHNAMEAMBIGUOUS, EfrontBranchException::BRANCH_AMBIGUOUS);
}
} else {
throw new EfrontBranchException(_BRANCHDOESNOTEXIST, EfrontBranchException::BRANCH_NOT_EXISTS);
}
// Get job id
$job_name = $data['description'];
if ($job_name != "") {
$new_job_description_ID = eF_getJobDescriptionId($job_name, $branch_ID);
} else {
throw new EfrontJobException(_MISSING_JOB_DESCRIPTION, EfrontJobException::MISSING_JOB_DESCRIPTION);
}
// Get hcd employee object
if ($data['supervisor']) {
$employee = new EfrontSupervisor(array("users_login" => $data["users_login"]));
$position = 1;
} else {
$employee = new EfrontEmployee(array("users_login" => $data["users_login"]));
$position = 0;
}
// Assign job
try {
$employee->addJob($user, $new_job_description_ID, $branch_ID, $position);
$this->log["success"][] = _LINE . " {$line}: " . _NEWJOBASSIGNMENT . " " . $data["users_login"] . " - (" . $branch_name . " - " . $job_name . ") ";
} catch (Exception $e) {
开发者ID:bqq1986,项目名称:efront,代码行数:67,代码来源:import_export.class.php
示例8: askInformation
//.........这里部分代码省略.........
$tooltipInfo[] = '<div class = "infoEntry"><span>' . _OTHERINFO . "</span><span>: {$value}</span></div>";
break;
case 'price_string':
!$lesson->lesson['course_only'] ? $tooltipInfo[] = '<div class = "infoEntry"><span>' . _PRICE . "</span><span>: {$value}</span></div>" : null;
break;
default:
break;
}
}
}
if ($string = implode("", $tooltipInfo)) {
echo $string;
} else {
echo _NODATAFOUND;
}
}
if (isset($_GET['courses_ID']) && eF_checkParameter($_GET['courses_ID'], 'id')) {
$course = new EfrontCourse($_GET['courses_ID']);
$courseInformation = $course->getInformation();
$languages = EfrontSystem::getLanguages(true);
if ($courseInformation['professors']) {
foreach ($courseInformation['professors'] as $value) {
$professorsString[] = $value['name'] . ' ' . $value['surname'];
}
$courseInformation['professors'] = implode(", ", $professorsString);
}
$course->course['price'] ? $priceString = formatPrice($course->course['price'], array($course->options['recurring'], $course->options['recurring_duration']), true) : ($priceString = false);
$courseInformation['price_string'] = $priceString;
foreach ($courseInformation as $key => $value) {
if ($value) {
switch ($key) {
case 'language':
$tooltipInfo[] = '<div class = "infoEntry"><span>' . _LANGUAGE . "</span><span>: {$languages[$value]}</span></div>";
break;
case 'professors':
$tooltipInfo[] = '<div class = "infoEntry"><span>' . _PROFESSORS . "</span><span>: {$value}</span></div>";
break;
case 'lessons_number':
$tooltipInfo[] = '<div class = "infoEntry"><span>' . _LESSONS . "</span><span>: {$value}</span></div>";
break;
case 'instances':
$tooltipInfo[] = '<div class = "infoEntry"><span>' . _COURSEINSTANCES . "</span><span>: {$value}</span></div>";
break;
case 'general_description':
$tooltipInfo[] = '<div class = "infoEntry"><span>' . _DESCRIPTION . "</span><span>: {$value}</span></div>";
break;
case 'assessment':
$tooltipInfo[] = '<div class = "infoEntry"><span>' . _ASSESSMENT . "</span><span>: {$value}</span></div>";
break;
case 'objectives':
$tooltipInfo[] = '<div class = "infoEntry"><span>' . _OBJECTIVES . "</span><span>: {$value}</span></div>";
break;
case 'lesson_topics':
$tooltipInfo[] = '<div class = "infoEntry"><span>' . _COURSETOPICS . "</span><span>: {$value}</span></div>";
break;
case 'resources':
$tooltipInfo[] = '<div class = "infoEntry"><span>' . _RESOURCES . "</span><span>: {$value}</span></div>";
break;
case 'other_info':
$tooltipInfo[] = '<div class = "infoEntry"><span>' . _OTHERINFO . "</span><span>: {$value}</span></div>";
break;
case 'price_string':
$tooltipInfo[] = '<div class = "infoEntry"><span>' . _PRICE . "</span><span>: {$value}</span></div>";
break;
default:
break;
}
}
}
if ($string = implode("", $tooltipInfo)) {
echo $string;
} else {
echo _NODATAFOUND;
}
}
// For eFront social
if (isset($_GET['common_lessons']) && isset($_GET['user1']) && isset($_GET['user2'])) {
$user1 = EfrontUserFactory::factory($_GET['user1']);
if ($user1->getType() != "administrator") {
$common_lessons = $user1->getCommonLessons($_GET['user2']);
// pr($common_lessons);
foreach ($common_lessons as $id => $lesson) {
if (strlen($lesson['name']) > 25) {
$lesson['name'] = substr($lesson['name'], 0, 22) . "...";
}
$tooltipInfo[] = '<div class = "infoEntry"><span>' . $lesson['name'] . "</span><span></span></div>";
}
if ($string = implode("", $tooltipInfo)) {
echo $string;
} else {
echo _NODATAFOUND;
}
} else {
echo _NODATAFOUND;
}
}
} catch (Exception $e) {
handleAjaxExceptions($e);
}
}
开发者ID:bqq1986,项目名称:efront,代码行数:101,代码来源:ask.php
示例9: json_decode
}
if (isset($_GET['complete']) && isset($_GET['ajax'])) {
if (isset($currentUser->coreAccess['progress']) && $currentUser->coreAccess['progress'] != 'change') {
exit;
}
$completeEntities = json_decode($_GET['complete']);
if (!empty($completeEntities)) {
if (eF_checkParameter($_GET['date'], 'date')) {
$date = explode('-', $_GET['date']);
$timestamp = mktime(0, 0, 0, $date[1], $date[0], $date[2]);
}
$list = '"' . implode('","', $completeEntities) . '"';
$info = eF_getTableData("users_to_lessons", "users_LOGIN,lessons_ID,completed,score,to_timestamp,comments", "users_LOGIN IN (" . $list . ") and lessons_ID = " . $currentLesson->lesson['id']);
foreach ($info as $value) {
if ($value['completed'] == 0) {
$user = EfrontUserFactory::factory($value['users_LOGIN']);
$user->completeLesson($currentLesson->lesson['id'], 100, '', $timestamp);
}
}
}
exit;
}
if (isset($_GET['uncomplete']) && isset($_GET['ajax'])) {
if (isset($currentUser->coreAccess['progress']) && $currentUser->coreAccess['progress'] != 'change') {
exit;
}
$uncompleteEntities = json_decode($_GET['uncomplete']);
if (!empty($uncompleteEntities)) {
$list = '"' . implode('","', $uncompleteEntities) . '"';
$info = eF_getTableData("users_to_lessons", "users_LOGIN,lessons_ID,completed,score,to_timestamp,comments", "users_LOGIN IN (" . $list . ") and lessons_ID = " . $currentLesson->lesson['id']);
foreach ($info as $value) {
开发者ID:bqq1986,项目名称:efront,代码行数:31,代码来源:progress.php
示例10: getUserUsageInfo
/**
* Get user usage info
*
* This returns usage info for a user
* <br/>Example:
* <code>
* $info = EfrontStats :: getUserUsageInfo('jdoe'); //Get usage information for user jdoe
* </code>
* @param mixed $user Either a user login or a EfrontUser object
* @return array the users' basic info
* @since 3.5.0
* @access public
* @static
*/
public static function getUserUsageInfo($user)
{
if (!$user instanceof EfrontUser) {
$user = EfrontUserFactory::factory($user);
}
$info = array();
$login_info = eF_getTableData("logs", "*", "users_LOGIN='" . $user->login . "' and action = 'login'", "timestamp desc");
$info['last_ip'] = eF_decodeIP($login_info[0]['session_ip']);
$logins = array();
foreach ($login_info as $login) {
$logins[$login['id']] = $login;
}
$month_login_info = eF_getTableData("logs", "*", "users_LOGIN='" . $user->login . "' and action = 'login' and timestamp > " . (time() - 2592000) . "");
$month_logins = array();
foreach ($month_login_info as $login) {
$month_logins[$login['id']] = $login;
}
$week_login_info = eF_getTableData("logs", "*", "users_LOGIN='" . $user->login . "' and action = 'login' and timestamp > " . (time() - 604800) . "");
$week_logins = array();
foreach ($week_login_info as $login) {
$week_logins[$login['id']] = $login;
}
$timeReport = new EfrontTimes();
$mean_duration = round($timeReport->getUserMeanSessionTime($user->login) / 60);
$timeReport = new EfrontTimes(array(time() - 2592000, time()));
$month_mean_duration = round($timeReport->getUserMeanSessionTime($user->login) / 60);
$timeReport = new EfrontTimes(array(time() - 604800, time()));
$week_mean_duration = round($timeReport->getUserMeanSessionTime($user->login) / 60);
/*
$temp = self :: getUserTimes($user -> login);
sizeof($temp['duration']) > 0 ? $mean_duration = ceil((array_sum($temp['duration']) / sizeof($temp['duration'])) / 60) : $mean_duration = 0;
$temp = self :: getUserTimes($user -> login, array('from' => time() - 2592000, 'to' => time()));
sizeof($temp['duration']) > 0 ? $month_mean_duration = ceil((array_sum($temp['duration']) / sizeof($temp['duration']) / 60)) : $month_mean_duration = 0;
$temp = self :: getUserTimes($user -> login, array('from' => time() - 604800, 'to' => time()));
sizeof($temp['duration']) > 0 ? $week_mean_duration = ceil((array_sum($temp['duration']) / sizeof($temp['duration']) / 60)) : $week_mean_duration = 0;
*/
$info['logins'] = $logins;
if (sizeof($info['logins']) > 0) {
$info['last_login'] = current($info['logins']);
}
$info['month_logins'] = $month_logins;
$info['week_logins'] = $week_logins;
$info['mean_duration'] = $mean_duration;
$info['month_mean_duration'] = $month_mean_duration;
$info['week_mean_duration'] = $week_mean_duration;
return $info;
}
开发者ID:bqq1986,项目名称:efront,代码行数:61,代码来源:statistics.class.php
示例11: array_search
$index = array_search($lesson, array_keys($usersTolessons[$user]));
if ($index !== false) {
unset($lessons[$index]);
}
}
if (!empty($lessons)) {
$user -> addLessons($lessons, $userType, 1); //active lessons
}
}
}
}
*/
if ($currentGroup->group['user_types_ID'] == '0') {
foreach ($groupUsers as $user) {
$user = EfrontUserFactory::factory($user);
$user->user['user_types_ID'] ? $userType[] = $user->user['user_types_ID'] : ($userType[] = $user->user['user_type']);
}
} else {
$userType = $currentGroup->group['user_types_ID'];
}
foreach ($lessonIds as $id) {
$lesson = new EfrontLesson($id);
$lesson->addUsers($groupUsers, $userType, true, true);
}
}
}
}
}
}
}
开发者ID:jiangjunt,项目名称:efront_open_source,代码行数:31,代码来源:groups.php
示例12: getRecipients
public function getRecipients()
{
$recipients_list = array();
if (isset($this->notification['send_conditions'])) {
//echo $this -> notification['send_conditions'];
if ($this->notification['send_conditions'] == "N;") {
$recipients = eF_getTableData("users", "*", "active=1 and archive=0");
//sending_queue_msgs[$key]['recipients'] = _ALLUSERS;
foreach ($recipients as $recipient) {
$recipients_list[$recipient['login']] = $recipient;
}
} else {
// the send_conditions field contains the information which identify the recipients
// it is defined in ....
//digests.php during the definition of the event notification
$this->notification['send_conditions'] = unserialize($this->notification['send_conditions']);
if ($this->notification['send_conditions'] == "supervisors") {
if (G_VERSIONTYPE == 'enterprise') {
#cpp#ifdef ENTERPRISE
$recipients = eF_getTableData("module_hcd_employee_works_at_branch as meb, users as u", "u.*", "meb.users_login=u.login and u.active=1 and u.archive=0 and meb.supervisor=1");
foreach ($recipients as $recipient) {
$recipients_list[$recipient['login']] = $recipient;
}
}
#cpp#endif
} elseif (is_array($this->notification['send_conditions'])) {
$this->recipients = $this->notification['send_conditions'];
// The recipients array definitely exists, due to constructor checks
if (isset($this->recipients["lessons_ID"]) && $this->recipients["lessons_ID"]) {
$lesson = new EfrontLesson($this->recipients["lessons_ID"]);
if (isset($this->recipients["user_type"])) {
// return lesson users of specific type
$recipients = array();
foreach ($lesson->getUsers($this->recipients["user_type"]) as $value) {
if ($value['active']) {
$recipients[] = $value;
}
}
} else {
if (isset($this->recipients["completed"])) {
// return lesson students according to whether they have completed the lesson or not
$recipients = array();
foreach ($lesson->getUsersCompleted($this->recipients["completed"]) as $value) {
if ($value['active']) {
$recipients[] = $value;
}
}
} else {
// return all users
$recipients = array();
foreach ($lesson->getUsers() as $value) {
if ($value['active']) {
$recipients[] = $value;
}
}
}
}
} else {
if (isset($this->recipients["courses_ID"])) {
$entity_parts = explode("_", $this->notification['id_type_entity']);
$notification_type = $entity_parts[1];
if ($this->recipients['user_type'] == "professor") {
$completed_condition = " AND uc.user_type = 'professor'";
} else {
if ($this->recipients['completed'] == "1") {
$completed_condition = " AND completed = '1'";
} else {
if ($this->recipients['completed'] == "2" || $notification_type == EfrontEvent::COURSE_PROGRAMMED_EXPIRY) {
$completed_condition = " AND completed = '0' and uc.user_type in ('" . implode("','", array_keys(EfrontLessonUser::getStudentRoles())) . "')";
} else {
$completed_condition = "";
}
}
}
if ($this->recipients['supervisor']) {
if ($this->recipients['users_login']) {
$editedUser = EfrontUserFactory::factory($this->recipients['users_login']);
//new EfrontUser();
$editedEmployee = $editedUser->aspects['hcd'];
$supervisors = $editedEmployee->getSupervisors();
$recipients = array();
foreach ($supervisors as $supervisor) {
$recipients[$supervisor] = array("login" => $supervisor);
}
} else {
$query = "select distinct u.login, u.name, u.surname, u.email, u.user_type as basic_user_type, u.active, u.user_types_ID from module_hcd_employee_works_at_branch ewb join users u on u.login=ewb.users_login where supervisor=1 and u.active=1 and u.archive=0 and branch_ID in (select branch_ID from module_hcd_employee_works_at_branch ewb, users_to_courses uc where uc.users_LOGIN=ewb.users_login and uc.courses_ID=" . $this->recipients["courses_ID"] . " and uc.archive=0)";
//get course users' supervisors
$result = eF_executeNew($query);
$recipients = $result->getAll();
}
} elseif ($this->recipients['immediate_supervisor']) {
if ($this->recipients['users_login']) {
$result = eF_getTableDataFlat("module_hcd_employee_works_at_branch", "users_LOGIN", "supervisor=1 and assigned=1 and branch_ID IN (select branch_ID from module_hcd_employee_works_at_branch where assigned=1 and supervisor=0 and users_login='" . $this->recipients['users_login'] . "')");
$recipients = array();
foreach ($result['users_LOGIN'] as $supervisor) {
$recipients[$supervisor] = array("login" => $supervisor);
}
$filtered_recipients = array();
if (!empty($recipients)) {
$active_recipients = eF_getTableDataFlat("users", "login", "active=1 and archive=0 and login IN ('" . implode("','", array_keys($recipients)) . "')");
//.........这里部分代码省略.........
开发者ID:jiangjunt,项目名称:efront_open_source,代码行数:101,代码来源:notification.class.php
示例13: EfrontDirectionsTree
}
//foreach ($courses as $key => $course) {
//$courses[$key]['languages_NAME'] = $languages[$course['languages_NAME']];
//}
$smarty->assign("T_ASSIGNED_COURSES_DATA", $courses);
$smarty->display('administrator.tpl');
exit;
}
if (isset($_GET['ajax']) && $_GET['ajax'] == 'coursesTable') {
$directionsTree = new EfrontDirectionsTree();
$directionPaths = $directionsTree->toPathString();
$courses = EfrontCourse::getCourses();
if ($_SESSION['s_type'] == 'administrator') {
$editedUser = EfrontUserFactory::factory($_GET['user']);
} else {
$editedUser = EfrontUserFactory::factory($_SESSION['s_login']);
}
$userCourses = $editedUser->getUserCourses();
foreach ($courses as $key => $course) {
$courses[$key]['partof'] = 0;
$courses[$key]['directions_name'] = $directionPaths[$course['directions_ID']];
$courses[$key]['user_type'] = $editedUser->user['user_types_ID'] ? $editedUser->user['user_types_ID'] : $editedUser->user['user_type'];
if (in_array($course['id'], array_keys($userCourses))) {
$courses[$key]['from_timestamp'] = $userCourses[$key]->course['active_in_course'];
$courses[$key]['partof'] = 1;
$courses[$key]['user_type'] = $userCourses[$key]->course['user_type'];
$courses[$key]['completed'] = $userCourses[$key]->course['completed'];
$courses[$key]['score'] = $userCourses[$key]->course['score'];
} else {
if ($currentUser->user['user_type'] != 'administrator' || !$course['active']) {
unset($courses[$key]);
开发者ID:bqq1986,项目名称:efront,代码行数:31,代码来源:show_solved_test.php
示例14: toHTML
//.........这里部分代码省略.........
if ($size) {
$fileArrays = eF_multiSort($fileArrays, $ajaxOptions['sort'], $ajaxOptions['order']);
$ajaxOptions['filter'] ? $fileArrays = eF_filterData($fileArrays, $ajaxOptions['filter']) : null;
$fileArrays = array_slice($fileArrays, $ajaxOptions['offset'], $ajaxOptions['limit']);
}
$extraColumnsString = '';
foreach ($extraColumns as $value) {
$extraColumnsString = '<td class = "topTitle centerAlign" name = "' . $value . '">' . $value . '</td>';
}
$filesCode = '
<table class = "sortedTable" style = "width:100%" size = "' . $size . '" id = "' . $tableId . '" useAjax = "1" rowsPerPage = "20" other = "' . urlencode($currentDirectory) . '" url = "' . $url . '&" nomass = "1" currentDir = "' . (isset($currentDir['path']) ? $currentDir['path'] : '') . '">
<tr>' . ($options['show_type'] ? '<td class = "topTitle centerAlign" name = "extension">' . _TYPE . '</td>' : '') . '
' . ($options['show_name'] ? '<td class = "topTitle" name = "name" id = "filename_' . $tableId . '">' . _NAME . '</td>' : '') . '
' . ($options['show_size'] ? '<td class = "topTitle" name = "size">' . _SIZE . '</td>' : '') . '
' . ($options
|
请发表评论