本文整理汇总了PHP中eF_getTableDataFlat函数的典型用法代码示例。如果您正苦于以下问题:PHP eF_getTableDataFlat函数的具体用法?PHP eF_getTableDataFlat怎么用?PHP eF_getTableDataFlat使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了eF_getTableDataFlat函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getValues
/**
* Get configuration values
*
* This function is used to retrieve configuration values.
* Furthermore, it compares the keys of the $defaultOptions array with
* The name/value pairs stored in the database. If a default name/value
* pair is not present in the database, it is created using its default
* value (unless the whole table is empty, in which case nothing is done)
* <br>Example:
* <code>
* $defaultConfig = EfrontConfiguration :: getValues();
* </code>
*
* @return array The configuration options in name/value pairs
* @access public
* @since 3.0
* @static
*/
public static function getValues()
{
$options = EfrontCache::getInstance()->getCache('configuration');
if (!$options) {
$options = eF_getTableDataFlat("configuration", "*");
sizeof($options) > 0 ? $options = array_combine($options['name'], $options['value']) : ($options = array());
EfrontCache::getInstance()->setCache('configuration', $options);
}
foreach (EfrontConfiguration::$defaultOptions as $key => $value) {
if (!isset($options[$key])) {
EfrontConfiguration::setValue($key, $value);
$options[$key] = $value;
}
}
return $options;
}
示例2: create
/**
* Create Payment
*
* This function is used to create a new payment entry
*
* @param array $fields The payment properties
* @return payment The created payment
* @since 3.6.0
* @access public
*/
public static function create($fields = array())
{
$fields['lessons'] = array_filter($fields['lessons'], 'is_numeric');
if (isset($fields['lessons']) && sizeof($fields['lessons']) > 0) {
$lessonNames = eF_getTableDataFlat("lessons", "name", "id in (" . implode(",", $fields['lessons']) . ")");
}
$fields['courses'] = array_filter($fields['courses'], 'is_numeric');
if (isset($fields['courses']) && sizeof($fields['courses']) > 0) {
$courseNames = eF_getTableDataFlat("courses", "name", "id in (" . implode(",", $fields['courses']) . ")");
}
!isset($fields['charset']) or $fields['comments'] = iconv($fields['charset'], "UTF-8", $fields['comments']);
$fields = array('timestamp' => isset($fields['timestamp']) && eF_checkParameter($fields['timestamp'], 'timestamp') ? $fields['timestamp'] : time(), 'users_LOGIN' => isset($fields['users_LOGIN']) && eF_checkParameter($fields['users_LOGIN'], 'login') ? $fields['users_LOGIN'] : $_SESSION['s_login'], 'amount' => isset($fields['amount']) && is_numeric($fields['amount']) && $fields['amount'] > 0 ? $fields['amount'] : 0, 'status' => isset($fields['status']) && $fields['status'] ? $fields['status'] : 'completed', 'txn_id' => $fields['txn_id'], 'comments' => $fields['comments'], 'method' => isset($fields['method']) && in_array($fields['method'], array_keys(self::$methods)) ? $fields['method'] : 'manual');
$user = EfrontUserFactory::factory($fields['users_LOGIN']);
if ($fields['method'] == 'paypal') {
//@todo: get corresponding paypal_data id
$eventType = EfrontEvent::NEW_PAYPAL_PAYMENT;
} else {
if ($fields['method'] == 'balance') {
$eventType = EfrontEvent::NEW_BALANCE_PAYMENT;
} else {
if ($fields['method'] == 'manual') {
$eventType = EfrontEvent::NEW_MANUAL_PAYMENT;
} else {
$eventType = false;
}
}
}
$newId = eF_insertTableData("payments", $fields);
$result = eF_getTableData("payments", "*", "id=" . $newId);
//We perform an extra step/query for retrieving data, since this way we make sure that the array fields will be in correct order (first id, then name, etc)
$payment = new payments($result[0]['id']);
if ($eventType) {
$event = array("type" => $eventType, "users_LOGIN" => $user->user['login'], "users_name" => $user->user['name'], "users_surname" => $user->user['surname'], "entity_ID" => $newId);
if (isset($lessonNames) && !empty($lessonNames)) {
$event['lessons_name'] = _LESSONS . ': ' . implode(",", $lessonNames['name']) . '<br>';
}
if (isset($courseNames) && !empty($courseNames)) {
$event['lessons_name'] .= _COURSES . ': ' . implode(",", $courseNames['name']);
}
if ($fields['credit']) {
$event['lessons_name'] .= _BALANCE . ': ' . $fields['credit'];
}
EfrontEvent::triggerEvent($event);
}
return $payment;
}
示例3: eF_getTableDataFlat
$form->addRule('header', _THEFIELD . ' ' . _SUBJECT . ' ' . _ISMANDATORY, 'required', null, 'client');
$form->addRule('header', _INVALIDFIELDDATA, 'checkParameter', 'text');
$load_editor = true;
$form->addElement('textarea', 'message', _BODY, 'class = "digestEditor" id="messageBody" onActivate="myActiveElement=\'\';" style = "width:100%;height:200px"');
// Get available lessons
$lessons = eF_getTableDataFlat("lessons", "id,name", "archive=0", "name");
sizeof($lessons) > 0 ? $av_lessons = array_combine(array_merge(array("0"), $lessons['id']), array_merge(array(_ANYLESSON), $lessons['name'])) : ($av_lessons = array(0 => _ANYLESSON));
sizeof($lessons) > 0 ? $lessons = array_combine($lessons['id'], $lessons['name']) : ($lessons = array());
// Get available courses
$courses = eF_getTableDataFlat("courses", "id,name", "archive=0", "name");
//return only unarchived courses
sizeof($courses) > 0 ? $av_courses = array_combine(array_merge(array("0"), $courses['id']), array_merge(array(_ANYCOURSE), $courses['name'])) : ($av_courses = array(0 => _ANYCOURSE));
sizeof($courses) > 0 ? $courses = array_combine($courses['id'], $courses['name']) : ($courses = array());
$smarty->assign("T_COURSES", $courses);
// Get available tests
$tests = eF_getTableDataFlat("tests", "id,name", "", "name");
$tests['id'] = array_merge(array("0"), $tests['id']);
$tests['name'] = array_merge(array(_ANYTEST), $tests['name']);
sizeof($tests) > 0 ? $tests = array_combine($tests['id'], $tests['name']) : ($tests = array("0" => _ANYTEST));
$smarty->assign("T_TESTS", $tests);
/*
// User groups in any case
$groups = eF_getTableData("groups", "id, name", "active=1");
$groups_list = array();
if (!empty($groups)) {
foreach ($groups as $group) {
$log = $group['id'];
$groups_list["$log"] = $group['name'];
}
} else {
$groups_list["0"] = _NOGROUPSDEFINED;
示例4: completeCourse
/**
* Complete course
*
* This function is used to set the course status to completed for
* the current user. If the course is set to automatically issue a
* certificate, the certificate is issued.
* <br/>Example:
* <code>
* $user -> completeCourse(5, 87, 'Very good progress'); //Complete course with id 5
* </code>
*
* @param Efrontmixed $course Either an EfrontCourse object or a course id
* @param int $score The course score
* @param string $comments Comments for the course completion
* @return boolean True if everything is ok
*/
public function completeCourse($course, $score, $comments, $time = '')
{
$time ? $timestamp = $time : ($timestamp = time());
if (!$course instanceof EfrontCourse) {
$course = new EfrontCourse($course);
}
$constraints = array('archive' => false, 'active' => true, 'return_objects' => false);
$userCourses = $this->getUserCourses($constraints);
if (in_array($course->course['id'], array_keys($userCourses))) {
//keep completed date when it is set (when only score changed for example)
$checkCompleted = $userCourses[$course->course['id']]['to_timestamp'];
$fields = array('completed' => 1, 'to_timestamp' => $timestamp, 'score' => str_replace(',', '.', $score), 'comments' => $comments);
$where = "users_LOGIN = '" . $this->user['login'] . "' and courses_ID=" . $course->course['id'];
EfrontCourse::persistCourseUsers($fields, $where, $course->course['id'], $this->user['login']);
if (!self::$cached_modules) {
self::$cached_modules = eF_loadAllModules();
}
// Trigger all necessary events. If the function has not been re-defined in the derived module class, nothing will happen
foreach (self::$cached_modules as $module) {
$module->onCompleteCourse($course->course['id'], $this->user['login']);
}
if ($course->options['auto_certificate']) {
$certificate = $course->prepareCertificate($this->user['login'], $time);
$course->issueCertificate($this->user['login'], $certificate);
}
$event = array("type" => EfrontEvent::COURSE_COMPLETION, "users_LOGIN" => $this->user['login'], "lessons_ID" => $course->course['id'], "lessons_name" => $course->course['name'], "replace" => true);
EfrontEvent::triggerEvent($event);
// Assign the related course skills to the employee
if (G_VERSIONTYPE == 'enterprise') {
#cpp#ifdef ENTERPRISE
if (!$this->aspects['hcd']) {
$this->aspects['hcd'] = EfrontEmployeeFactory::factory($this->user['login']);
}
$employee = $this->aspects['hcd'];
$newSkills = eF_getTableDataFlat("module_hcd_course_offers_skill", "skill_ID, specification", "courses_ID = '" . $course->course['id'] . "'");
// The course associated skills will *complement* the existing ones - last argument = true
$employee->addSkills($newSkills['skill_ID'], $newSkills['specification'], array_fill(0, sizeof($newSkills['skill_ID']), $score), true);
}
#cpp#endif
return true;
} else {
return false;
}
}
示例5: assignSourceLessonsToInstance
private static function assignSourceLessonsToInstance($instanceSource, $instance)
{
$result = eF_getTableDataFlat("lessons_to_courses lc, lessons l", "l.id, l.instance_source", "l.id=lc.lessons_ID and lc.courses_ID=" . $instanceSource->course['id']);
$instanceSourceLessonsThatAreUnique = array_combine($result['id'], $result['instance_source']);
$instanceSourceLessons = $instanceSource->getCourseLessons();
$newLessons = array();
$lessonsSchedule = array();
foreach ($instanceSourceLessons as $key => $foo) {
//Do this to get the lessons in the correct order
$value = $instanceSourceLessonsThatAreUnique[$key];
if ($value) {
$lessonInstance = EfrontLesson::createInstance($value, $instance->course['id']);
$newLessons[] = $lessonInstance->lesson['id'];
$lessonsSchedule[$lessonInstance->lesson['id']] = array('start_date' => $foo->lesson['start_date'], 'end_date' => $foo->lesson['end_date'], 'start_period' => $foo->lesson['start_period'], 'end_period' => $foo->lesson['end_period']);
} else {
$newLessons[] = $key;
$lessonsSchedule[$key] = array('start_date' => $foo->lesson['start_date'], 'end_date' => $foo->lesson['end_date'], 'start_period' => $foo->lesson['start_period'], 'end_period' => $foo->lesson['end_period']);
}
}
$instance->addLessons($newLessons, $lessonsSchedule);
}
示例6: importUsers
/**
* Import users
*
* This function is used to import users from the given CSV
* file.
* <br/>Example:
* <code>
* $file = new EfrontFile(/var/www/efront/upload/admin/temp/users.csv);
* EfrontSystem :: importUsers($file);
* </code>
*
* @param mixed $file The CVS file with the users, either an EfrontFile object or the full path to the file
* @param boolean $replaceUsers Whether to replace existing users having the same name as the ones imported
* @return array The imported users in an array of EfrontUser objects
* @since 3.5.0
* @access public
*/
public static function importUsers($file, $replaceUsers = false)
{
if (!$file instanceof EfrontFile) {
$file = new EfrontFile($file);
}
$usersTable = eF_getTableData("users", "*", "");
$tableFields = array_keys($usersTable[0]);
// Get user types to check if they exist
$userTypesTable = eF_getTableData("user_types", "*", "");
// Set the userTypesTable to find in O(1) the existence or not of a user-type according to its name
foreach ($userTypesTable as $key => $userType) {
$userTypesTable[$userType['name']] = $userType;
}
// If we work on the enterprise version we need to distinguish between users and module_hcd_employees tables fields
//$userFields = array('login', 'password','email','languages_NAME','name','surname','active','comments','user_type','timestamp','avatar','pending','user_types_ID');
$userFields = eF_getTableFields('users');
$existingUsers = eF_getTableDataFlat("users", "login");
$fileContents = file_get_contents($file['path']);
$fileContents = explode("\n", trim($fileContents));
$separator = ";";
//$fields = explode($separator, trim($fileContents[0]));
$fields = str_getcsv(trim($fileContents[0]), $separator);
if (sizeof($fields) == 1) {
$separator = ",";
//$fields = explode($separator, $fileContents[0]);
$fields = str_getcsv(trim($fileContents[0]), $separator);
if (sizeof($fields) == 1) {
throw new Exception(_UNKNOWNSEPARATOR, EfrontSystemException::ILLEGAL_CSV);
}
}
foreach ($fields as $key => $value) {
if (empty($value)) {
$unused = $key;
unset($fields[$key]);
}
}
$inserted = 0;
$matched = array_intersect($fields, $tableFields);
$newUsers = array();
$messages = array();
// The check here is removed to offer interoperability between enterprise and educational versions
// throw new Exception (_PLEASECHECKYOURCSVFILEFORMAT, EfrontSystemException::ILLEGAL_CSV);
for ($i = 1; $i < sizeof($fileContents); $i++) {
//$csvUser = explode($separator, $fileContents[$i]);
$csvUser = str_getcsv($fileContents[$i], $separator);
unset($csvUser[$unused]);
if (sizeof($csvUser) != sizeof($fields)) {
throw new Exception(_PLEASECHECKYOURCSVFILEFORMAT . ': ' . _NUMBEROFFIELDSMUSTBE . ' ' . sizeof($fields) . ' ' . _BUTFOUND . ' ' . sizeof($csvUser), EfrontSystemException::ILLEGAL_CSV);
}
$csvUser = array_combine($fields, $csvUser);
array_walk($csvUser, create_function('&$v, $k', '$v=trim($v);'));
if (in_array($csvUser['login'], $existingUsers['login']) && $replaceUsers) {
$existingUser = EfrontUserFactory::factory($csvUser['login']);
$existingUser->delete();
}
if (!in_array($csvUser['login'], $existingUsers['login']) || $replaceUsers) {
if (!isset($csvUser['password']) || !$csvUser['password']) {
$csvUser['password'] = $csvUser['login'];
}
// Check the user-type existence by name
if ($csvUser['user_type_name'] != "" && isset($userTypesTable[$csvUser['user_type_name']])) {
// If there is a mismatch between the imported custom type basic type and the current basic type
// then set no custom type
if ($userTypesTable[$csvUser['user_type_name']]['basic_user_type'] != $csvUser['user_type']) {
$csvUser['user_types_ID'] = 0;
} else {
$csvUser['user_types_ID'] = $userTypesTable[$csvUser['user_type_name']]['id'];
}
} else {
$csvUser['user_types_ID'] = 0;
}
unset($csvUser['user_type_name']);
if (!$csvUser['user_type']) {
$csvUser['user_type'] = 'student';
}
//If user type is not valid, don't insert that user
if ($csvUser['user_type'] != "administrator" && $csvUser['user_type'] != "professor" && $csvUser['user_type'] != "student") {
$messages[] = '"' . $csvUser['login'] . '": ' . _INVALIDUSERTYPE;
unset($csvUser);
continue;
}
// If we are not in enterprise version then $csvEmployeeProperties is used as a buffer
// This is done to enable enterprise <-> Enteprise, educational <-> educational, enterprise <-> educational imports/exports
//.........这里部分代码省略.........
示例7: deleteLessonSkill
/**
* Delete the skill corresponding to this lesson: Every lesson is mapped to a skill like "Knowledge of that lesson"
* This deletion takes place when a lesson is changed from regular lesson to course_only
*
* <br/>Example:
* <code>
* $lesson -> deleteLessonSkill();
* </code>
*
* @return the result of the table deletion
* @since 3.5.2
* @access public
*/
public function deleteLessonSkill()
{
// Delete the corresponding lesson skill to the skill and lesson_offers_skill tables
$lesson_skill = eF_getTableData("module_hcd_skills JOIN module_hcd_lesson_offers_skill ON module_hcd_skills.skill_ID = module_hcd_lesson_offers_skill.skill_ID", "*", "lesson_ID = " . $this->lesson['id'] . " AND module_hcd_skills.categories_ID = -1");
eF_deleteTableData("module_hcd_skills", "skill_ID = " . $lesson_skill[0]['skill_ID']);
// Delete all question-to-lesson specific skill assignments
$questions = eF_getTableDataFlat("questions", "id", "lessons_ID = " . $this->lesson['id']);
eF_deleteTableData("questions_to_skills", "questions_id IN ('" . implode("','", $questions['id']) . "') AND skills_ID = " . $lesson_skill[0]['skill_ID']);
return eF_deleteTableData("module_hcd_lesson_offers_skill", "lesson_ID = " . $this->lesson['id'] . " AND skill_ID = " . $lesson_skill[0]['skill_ID']);
}
示例8: key
$key = key($result['timestamp']);
$topics[$k]['last_post'] = array('id' => $result['id'][$key], 'users_LOGIN' => $result['users_LOGIN'][$key], 'timestamp' => $result['timestamp'][$key]);
$topics[$k]['last_post_timestamp'] = $result['timestamp'][$key];
$topics[$k]['first_message'] = strip_tags($result['body'][0]);
}
$last_posts[] = $topic['last_post']['timestamp'];
//This array will be used for sorting according to last post
}
array_multisort($last_posts, SORT_DESC, $topics);
//Sort topics so that those with most recent messages are displayed first
foreach ($polls as $k => $poll) {
if ($_SESSION['s_type'] != 'administrator' && $_SESSION['s_current_branch']) {
//this applies to supervisors only
$result = eF_getTableDataFlat("f_users_to_polls, module_hcd_employee_works_at_branch", "count(*)", "vote != 0 and f_poll_ID=" . $poll['id'] . " and module_hcd_employee_works_at_branch.users_login=f_users_to_polls.users_LOGIN and module_hcd_employee_works_at_branch.branch_ID=" . $currentBranch->branch['branch_ID']);
} else {
$result = eF_getTableDataFlat("f_users_to_polls", "count(*)", "vote != 0 and f_poll_ID=" . $poll['id']);
}
$polls[$k]['votes'] = $result['count(*)'][0];
}
$smarty->assign("T_FORUM_TOPICS", $topics);
$smarty->assign("T_FORUM_POLLS", $polls);
if ((!$currentUser->coreAccess['forum'] || $currentUser->coreAccess['forum'] == 'change') && ($currentUser->user['user_type'] != 'student' || isset($forum_config) && $forum_config['students_add_forums']) && (!isset($_GET['forum']) || $forums[$_GET['forum']]['status'] != 2)) {
$forum_options = array(1 => array('text' => _NEWFORUM, 'image' => "16x16/add.png", 'href' => basename($_SERVER['PHP_SELF']) . "?ctg=forum&add=1&type=forum&parent_forum_id={$parent_forum}&popup=1", 'onclick' => "eF_js_showDivPopup(event, '" . _NEWFORUM . "', 2)", 'target' => "POPUP_FRAME"));
$smarty->assign("T_FORUM_OPTIONS", $forum_options);
}
}
}
//Calculate the forum parents, so the title may be created and displayed
while ($parent_forum != 0 && $count++ < 100) {
//Count is put to prevent an unexpected infinite loop
$result = eF_getTableData("f_forums", "id,title,parent_id,lessons_ID", "id={$parent_forum}");
示例9: EfrontFileException
//the file is a temporary scorm exported file
//proceed
} else {
if (preg_match("#" . G_UPLOADPATH . "(.*)/projects/#", $file['path'], $matches) || preg_match("#" . G_UPLOADPATH . "(.*)/tests/#", $file['path'], $matches)) {
//this is a project or test file. Check whether the current user has access to it
if ($matches[1] == $_SESSION['s_login']) {
//continue if a user is trying to view his/her own file
} else {
if ($_SESSION['s_lesson_user_type'] != 'professor' || !$_SESSION['s_lessons_ID']) {
throw new EfrontFileException(_YOUCANNOTACCESSTHEREQUESTEDRESOURCE, EfrontFileException::UNAUTHORIZED_ACTION);
} else {
if (!eF_checkParameter($matches[1], 'login')) {
throw new EfrontFileException(_YOUCANNOTACCESSTHEREQUESTEDRESOURCE, EfrontFileException::UNAUTHORIZED_ACTION);
} else {
$professorLessons = eF_getTableDataFlat("lessons l, users_to_lessons ul", "id", "l.archive=0 and l.id=ul.lessons_ID and ul.archive=0 and ul.users_LOGIN='" . $currentUser->user['login'] . "'");
$userLessons = eF_getTableDataFlat("lessons l, users_to_lessons ul", "id", "l.archive=0 and l.id=ul.lessons_ID and ul.archive=0 and ul.users_LOGIN='" . $matches[1] . "'");
if (!in_array($_SESSION['s_lessons_ID'], array_intersect($professorLessons['id'], $userLessons['id']))) {
throw new EfrontFileException(_YOUCANNOTACCESSTHEREQUESTEDRESOURCE, EfrontFileException::UNAUTHORIZED_ACTION);
}
}
}
}
} else {
if (preg_match("#" . G_UPLOADPATH . "(.*)/avatars/#", $file['path'], $matches) || mb_strpos($file['path'], G_SYSTEMAVATARSPATH) !== false || mb_strpos($file['path'], G_UPLOADPATH) !== false && mb_strpos($file['path'], 'forum') !== false) {
//proceed
} else {
if (mb_strpos($file['path'], G_UPLOADPATH) !== false && mb_strpos($file['path'], G_UPLOADPATH . $currentUser->user['login']) === false && $file['access'] != 777) {
throw new EfrontFileException(_YOUCANNOTACCESSTHEREQUESTEDRESOURCE, EfrontFileException::UNAUTHORIZED_ACTION);
}
}
}
示例10: array
}
if (!isset($courses) || !$courses && !is_array($courses)) {
//$courses = EfrontCourse :: getCourses(true);
$constraints = array('active' => true, 'archive' => false, 'instance' => false, 'sort' => 'name');
$constraints['required_fields'] = array('has_instances');
$courses = EfrontCourse::getAllCourses($constraints);
if ($_SESSION['s_current_branch']) {
//filter out courses that don't belong to the current branch url
$stats_filters = array();
$branches = array($_SESSION['s_current_branch']);
$branchesTree = new EfrontBranchesTree();
$iterator = new EfrontNodeFilterIterator(new RecursiveIteratorIterator(new RecursiveArrayIterator($branchesTree->getNodeChildren($_SESSION['s_current_branch'])), RecursiveIteratorIterator::SELF_FIRST));
foreach ($iterator as $key => $value) {
$branches[] = $key;
}
$result = eF_getTableDataFlat("module_hcd_course_to_branch", "courses_ID", "branches_ID in (" . implode(",", $branches) . ")");
foreach ($courses as $key => $value) {
if (!in_array($key, $result['courses_ID'])) {
unset($courses[$key]);
}
}
}
}
//Mark the lessons and courses that the user already has, so that they can't be selected
try {
if (isset($_SESSION['s_login']) && $_SESSION['s_login']) {
$currentUser = EfrontUserFactory::factory($_SESSION['s_login']);
if ($currentUser->user['user_type'] == 'administrator') {
throw new Exception();
}
$userLessons = $currentUser->getLessons();
示例11: EfrontDirectionsTree
//Assign this form to the renderer, so that corresponding template code is created
$smarty->assign('T_IMPORT_LESSON_FORM', $renderer->toArray());
//Assign the form to the template
$lessons = EFrontLesson::getLessons();
$directionsTree = new EfrontDirectionsTree();
$directionPaths = $directionsTree->toPathString();
if (G_VERSIONTYPE == 'enterprise') {
$result = eF_getTableDataFlat("lessons LEFT OUTER JOIN module_hcd_lesson_offers_skill ON module_hcd_lesson_offers_skill.lesson_ID = lessons.id", "lessons.id, count(skill_ID) as skills_offered", "lessons.archive=0", "", "id");
foreach ($result['id'] as $key => $lesson_id) {
if (isset($lessons[$lesson_id])) {
$lessons[$lesson_id]['skills_offered'] = $result['skills_offered'][$key];
}
}
}
//Perform a query to get all the 'student' and 'student-like' users of every lesson
$result = eF_getTableDataFlat("lessons l,users_to_lessons ul left outer join user_types ut on ul.user_type=ut.id", "l.id,count(*)", "ul.archive=0 and l.id=ul.lessons_ID and (ul.user_type='student' or (ul.user_type = ut.id and ut.basic_user_type = 'student'))", "", "l.id");
if (sizeof($result) > 0) {
$lessonUsers = array_combine($result['id'], $result['count(*)']);
}
foreach ($lessons as $key => $lesson) {
if (isset($lessonUsers[$key]) && !$lesson['course_only']) {
$lessons[$key]['students'] = $lessonUsers[$key];
} else {
$lessons[$key]['students'] = 0;
}
if (isset($_COOKIE['toggle_active'])) {
if ($_COOKIE['toggle_active'] == 1 && !$lesson['active'] || $_COOKIE['toggle_active'] == -1 && $lesson['active']) {
unset($lessons[$key]);
}
}
if ($lessons[$key]['creator_LOGIN'] != $_SESSION['s_login']) {
示例12: searchForOneWord
/**
* Function searchForOneWord()
*
* @param string $word The word to search for
* @param int $maxres The total number of words it should return
* @param string $table_name ?
* @param string $position The position of the string we are looking for
* @since 3.5.0
* @access public
*/
public static function searchForOneWord($word, $maxres, $tableName, $position)
{
$position == "title" ? $position_str = 0 : ($position_str = 1);
$res = eF_getTableDataFlat("search_invertedindex", "id", "keyword like '%{$word}%'");
if (sizeof($res) > 0) {
$idsList = implode(",", $res['id']);
$result = eF_getTableDataFlat("search_keywords", "foreign_ID, count(keyword) AS score, table_name, position", "keyword IN ({$idsList})" . ($position ? ' and position=' . $position_str : '') . ($tableName ? ' and table_name=' . EfrontSearch::$tableAssoc[$tableName] : '') . "", "", "foreign_ID,table_name limit {$maxres}");
}
return $result;
}
示例13: eF_getTableDataFlat
$result = eF_getTableDataFlat("users JOIN module_hcd_employee_has_job_description ON users.login = module_hcd_employee_has_job_description.users_login JOIN module_hcd_job_description ON module_hcd_job_description.job_description_ID = module_hcd_employee_has_job_description.job_description_ID", "distinct login", "users.active = 1 AND module_hcd_job_description.description = '" . $form->exportValue('job_description_recipients') . "'");
} else {
$result = eF_getTableDataFlat("users JOIN module_hcd_employee_has_job_description ON users.login = module_hcd_employee_has_job_description.users_login", "distinct login", "users.active = 1");
}
break;
case 'specific_skill':
$result = eF_getTableDataFlat("users JOIN module_hcd_employee_has_skill ON users.login = module_hcd_employee_has_skill.users_login", "distinct login", "users.active = 1 AND module_hcd_employee_has_skill.skill_ID = '" . $form->exportValue('skill_recipients') . "'");
break;
default:
break;
}
if ($values['specific_type']) {
if (!is_numeric($form->exportValue('user_type'))) {
$filter_user_type = eF_getTableDataFlat("users", "login", "users.active=1 AND users.user_type='" . $form->exportValue('user_type') . "'");
} else {
$filter_user_type = eF_getTableDataFlat("users", "login", "users.active=1 AND users.user_types_ID='" . $form->exportValue('user_type') . "'");
}
if ($values['recipients'] == 'only_specific_users') {
//Meaning we only clicked on the checkbox for user types
$result = $filter_user_type;
} else {
$result['login'] = array_intersect($result['login'], $filter_user_type['login']);
}
}
if ($_SESSION['s_type'] != 'administrator' && $_SESSION['s_current_branch']) {
//this applies to supervisors only
$currentBranch = new EfrontBranch($_SESSION['s_current_branch']);
$branchTreeUsers = array_keys($currentBranch->getBranchTreeUsers());
foreach ($result['login'] as $key => $value) {
if (!in_array($value, $branchTreeUsers)) {
unset($result['login'][$key]);
示例14: eF_getTableDataFlat
$tooltipInfo[] = '<div class = "infoEntry"><span>' . _MAXIMUMUSERS . "</span><span>: {$value}</span></div>";
$tooltipInfo[] = '<div class = "infoEntry"><span>' . _SEATSREMAINING . "</span><span>: " . $lessonInformation['seats_remaining'] . "</span></div>";
break;
default:
break;
}
}
}
if ($string = implode("", $tooltipInfo)) {
echo '<html ' . ($GLOBALS['rtl'] ? 'dir = "rtl"' : '') . ' >' . $string . '</html>';
} else {
echo _NODATAFOUND;
}
}
if (isset($_GET['courses_ID']) && eF_checkParameter($_GET['courses_ID'], 'id') && $_GET['type'] == 'branches') {
$result = eF_getTableDataFlat("module_hcd_course_to_branch mb, module_hcd_branch b", "mb.branches_ID, b.name", "b.branch_ID=mb.branches_ID and mb.courses_ID=" . $_GET['courses_ID']);
$tooltipInfo = '<div class = "infoEntry"><span>' . implode(", ", $result['name']) . "</span><span></span></div>";
echo $tooltipInfo;
exit;
}
if (isset($_GET['courses_ID']) && eF_checkParameter($_GET['courses_ID'], 'id')) {
$course = new EfrontCourse($_GET['courses_ID']);
$courseInformation = $course->getInformation();
if ($courseInformation['professors']) {
foreach ($courseInformation['professors'] as $value) {
$professorsString[] = formatLogin($value['login']);
}
$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;
示例15: eF_redirect
eF_redirect(basename($_SERVER['PHP_SELF']) . '?ctg=progress&message=' . urlencode(_STUDENTSTATUSCHANGED) . '&message_type=success');
}
}
$renderer = new HTML_QuickForm_Renderer_ArraySmarty($smarty);
$form->setJsWarnings(_BEFOREJAVASCRIPTERROR, _AFTERJAVASCRIPTERROR);
$form->setRequiredNote(_REQUIREDNOTE);
$form->accept($renderer);
$smarty->assign('T_COMPLETE_LESSON_FORM', $renderer->toArray());
$doneTests = EfrontStats::getDoneTestsPerUser($_GET['edit_user'], false, $currentLesson->lesson['id']);
$result = EfrontStats::getStudentsDoneTests($currentLesson->lesson['id'], $_GET['edit_user']);
foreach ($result[$_GET['edit_user']] as $key => $value) {
if ($value['scorm']) {
$scormDoneTests[$key] = $value;
}
}
$testNames = eF_getTableDataFlat("tests t, content c", "t.id, c.name", "c.id=t.content_ID and t.active=1 and t.publish=1 and c.ctg_type='tests' and c.lessons_ID=" . $currentLesson->lesson['id']);
$testNames = array_combine($testNames['id'], $testNames['name']);
foreach ($doneTests[$_GET['edit_user']] as $key => $value) {
if (in_array($key, array_keys($testNames))) {
$userStats['done_tests'][$key] = array('name' => $testNames[$key], 'score' => $value['average_score'], 'last_test_id' => $value['last_test_id'], 'active_test_id' => $value['active_test_id'], 'last_score' => $value['scores'][$value['last_test_id']], 'active_score' => $value['active_score'], 'times_done' => $value['times_done'], 'content_ID' => $value[$value['last_test_id']]['content_ID']);
}
}
foreach ($scormDoneTests as $key => $value) {
$userStats['scorm_done_tests'][$key] = array('name' => $value['name'], 'score' => $value['score'], 'content_ID' => $key);
}
unset($userStats['done_tests']['average_score']);
$smarty->assign("T_USER_LESSONS_INFO", $userStats);
$notDoneTests = array_diff(array_keys($testNames), array_keys($doneTests[$_GET['edit_user']]));
$smarty->assign("T_PENDING_TESTS", $notDoneTests);
if ($GLOBALS['configuration']['time_reports']) {
$userTime = EfrontTimes::formatTimeForReporting(EfrontLesson::getUserActiveTimeInLesson($editedUser->user['login'], $currentLesson->lesson['id']));