本文整理汇总了PHP中eF_deleteTableData函数的典型用法代码示例。如果您正苦于以下问题:PHP eF_deleteTableData函数的具体用法?PHP eF_deleteTableData怎么用?PHP eF_deleteTableData使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了eF_deleteTableData函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: clearAllLogs
function clearAllLogs()
{
//$sql = "DELETE FROM module_chat WHERE 1";
eF_deleteTableData("module_chat", "1");
//echo _CHAT_CHAT_HISTORY_SUCCESSFULY_DELETED;
echo 'Chat history successfuly deleted';
}
示例2: getModule
public function getModule()
{
// Get smarty variable
$smarty = $this->getSmartyVar();
if (isset($_GET['delete_faq']) && eF_checkParameter($_GET['delete_faq'], 'id')) {
eF_deleteTableData("module_faq", "id=" . $_GET['delete_faq']);
eF_redirect("" . $this->moduleBaseUrl . "&message=" . urlencode(_FAQ_SUCCESFULLYDELETEDFAQENTRY) . "&message_type=success");
} else {
if (isset($_GET['add_faq']) || isset($_GET['edit_faq']) && eF_checkParameter($_GET['edit_faq'], 'id')) {
$load_editor = true;
//TODO
$form = new HTML_QuickForm("faq_entry_form", "post", $_SERVER['REQUEST_URI'], "", null, true);
$form->registerRule('checkParameter', 'callback', 'eF_checkParameter');
//Register this rule for checking user input with our function, eF_checkParameter
$form->addElement('textarea', 'question', null, 'class = "simpleEditor" style = "width:100%;height:5em;"');
$form->addElement('textarea', 'answer', null, 'class = "simpleEditor" style = "width:100%;height:25em;"');
$currentLesson = $this->getCurrentLesson();
$units = eF_getTableDataFlat("content", "id, name", "lessons_ID = " . $currentLesson->lesson['id']);
//$units['id'] = array_merge(array("0"), $units['id']);
//$units['name'] = array_merge(array(_FAQ_GENERAL_LESSON), $units['name']);
sizeof($units) > 0 ? $units = array(0 => _FAQ_GENERAL_LESSON) + array_combine($units['id'], $units['name']) : ($units = array("0" => _FAQ_GENERAL_LESSON));
$form->addElement('select', 'related_content', _CONTENT, $units, 'class = "inputSelectLong"');
$form->addElement('submit', 'submit_faq', _SUBMIT, 'class = "flatButton"');
if (isset($_GET['edit_faq'])) {
$faq_entry = eF_getTableData("module_faq", "*", "id=" . $_GET['edit_faq']);
$form->setDefaults(array('related_content' => $faq_entry[0]['unit_ID'], 'question' => $faq_entry[0]['question'], 'answer' => $faq_entry[0]['answer']));
}
if ($form->isSubmitted() && $form->validate()) {
$fields = array('lessons_ID' => $_SESSION['s_lessons_ID'], 'unit_ID' => $form->exportValue('related_content'), 'question' => $form->exportValue('question'), 'answer' => $form->exportValue('answer'));
if (isset($_GET['edit_faq'])) {
if (eF_updateTableData("module_faq", $fields, "id=" . $_GET['edit_faq'])) {
eF_redirect("" . $this->moduleBaseUrl . "&message=" . urlencode(_FAQ_SUCCESFULLYUPDATEDFAQENTRY) . "&message_type=success");
} else {
$this->setMessageVar(_FAQ_PROBLEMUPDATINGFAQENTRY, 'failure');
}
} else {
if (eF_insertTableData("module_faq", $fields)) {
eF_redirect("" . $this->moduleBaseUrl . "&message=" . urlencode(_FAQ_SUCCESFULLYINSERTEDFAQENTRY) . "&message_type=success");
} else {
$this->setMessageVar(_FAQ_PROBLEMINSERTINGFAQENTRY, 'failure');
}
}
}
$renderer = new HTML_QuickForm_Renderer_ArraySmarty($smarty);
$form->accept($renderer);
$smarty->assign('T_FAQ_FORM', $renderer->toArray());
} else {
$currentLesson = $this->getCurrentLesson();
$faq = eF_getTableDataFlat("module_faq", "*", "lessons_ID=" . $currentLesson->lesson['id']);
$currentUser = $this->getCurrentUser();
$smarty->assign("T_FAQUSERLESSONROLE", $currentUser->getRole($currentLesson));
$smarty->assign("T_FAQ", $faq);
$smarty->assign("T_QUESTIONS_FOUND", sizeof($faq));
}
}
return true;
}
示例3: delete
/**
* Delete user
*
* This function is used to delete a user from the system.
* The user cannot be deleted if he is the last system administrator.
* <br/>Example:
* <code>
* $user = EfrontUserFactory :: factory('jdoe');
* $user -> delete();
* </code>
*
* @return boolean True if the user was deleted successfully
* @since 3.5.0
* @access public
*/
public function delete()
{
parent::delete();
$userDoneTests = eF_getTableData("done_tests", "id", "users_LOGIN='" . $this->user['login'] . "'");
if (sizeof($userDoneTests) > 0) {
eF_deleteTableData("done_questions", "done_tests_ID IN (" . implode(",", $userDoneTests['id']) . ")");
eF_deleteTableData("done_tests", "users_LOGIN='" . $this->user['login'] . "'");
}
eF_deleteTableData("users_to_lessons", "users_LOGIN='" . $this->user['login'] . "'");
eF_deleteTableData("users_to_courses", "users_LOGIN='" . $this->user['login'] . "'");
/*
foreach ($this -> getCourses() as $id => $value) {
$cacheKey = "user_course_status:course:".$id."user:".$this -> user['login'];
EfrontCache::getInstance()->deleteCache($cacheKey);
}
*/
eF_deleteTableData("users_to_projects", "users_LOGIN='" . $this->user['login'] . "'");
//eF_deleteTableData("users_to_done_tests", "users_LOGIN='".$this -> user['login']."'");
if (G_VERSIONTYPE != 'community') {
#cpp#ifndef COMMUNITY
if (G_VERSIONTYPE != 'standard') {
#cpp#ifndef STANDARD
eF_deleteTableData("users_to_skillgap_tests", "users_LOGIN='" . $this->user['login'] . "'");
}
#cpp#endif
}
#cpp#endif
eF_deleteTableData("completed_tests", "users_LOGIN='" . $this->user['login'] . "'");
}
示例4: delete
/**
* (non-PHPdoc)
* @see libraries/EfrontEntity#delete()
*/
public function delete()
{
if (!$this->remote) {
$directory = new EfrontDirectory(G_THEMESPATH . $this->{$this->entity}['path']);
$directory->delete();
}
eF_deleteTableData($this->entity, "id=" . $this->{$this->entity}['id']);
$modules = eF_loadAllModules();
foreach ($modules as $key => $module) {
$module->onDeleteTheme($this->{$this->entity}['id']);
}
EfrontCache::getInstance()->deleteCache('themes');
}
示例5: setSharedLessonMode
/**
* Set the lesson mode to 'shared' in the course
*
* @param EfrontLesson $lesson The lesson to set the mode for
* @since 3.6.1
* @access private
*/
private function setSharedLessonMode($lesson)
{
$courseUsers = $this->countCourseUsers(array('archive' => false));
if ($courseUsers['count'] > 0) {
throw new Exception(_YOUCANNOTCHANGEMODECOURSENOTEMPTY, EfrontCourseException::COURSE_NOT_EMPTY);
}
$coursedata = eF_getTableData("lessons_to_courses", "*", "lessons_ID=" . $lesson->lesson['id'] . " and courses_ID=" . $this->course['id']);
$lessonsSchedule[$lesson->lesson['instance_source']] = array('start_date' => $coursedata[0]['start_date'], 'end_date' => $coursedata[0]['end_date'], 'start_period' => $coursedata[0]['start_period'], 'end_period' => $coursedata[0]['end_period']);
$this->addLessons($lesson->lesson['instance_source'], $lessonsSchedule);
$this->replaceLessonInCourseOrder($lesson, $lesson->lesson['instance_source']);
$this->replaceLessonInCourseRules($lesson, $lesson->lesson['instance_source']);
//Must be put *before* removeLessons()
//$this -> removeLessons($lesson); //commented out because it was messing up with order
eF_deleteTableData("lessons_to_courses", "courses_ID=" . $this->course['id'] . " and lessons_ID=" . $lesson->lesson['id']);
}
示例6: switchLessonReportingMode
public static function switchLessonReportingMode($mode)
{
if ($GLOBALS['configuration']['time_reports'] != $mode && $mode == 1) {
//step one: Read all times from the user_times table, per user,lesson and unit
$data = $totals = array();
$result = eF_getTableData("user_times", "users_LOGIN, entity_ID, lessons_ID, time", "entity = 'unit'");
foreach ($result as $value) {
if (isset($totals[$value['users_LOGIN']][$value['lessons_ID']][$value['entity_ID']])) {
$totals[$value['users_LOGIN']][$value['lessons_ID']][$value['entity_ID']] += $value['time'];
} else {
$totals[$value['users_LOGIN']][$value['lessons_ID']][$value['entity_ID']] = $value['time'];
}
}
//step 2: read all current time entries in the users_to_content table
$result = eF_getTableData("users_to_content", "users_LOGIN, content_ID, lessons_ID, total_time");
foreach ($result as $value) {
$existing[$value['users_LOGIN']][$value['lessons_ID']][$value['content_ID']] = $value['total_time'];
}
//step 3: Populate the users_to_content table with the data from the user_times table, or update if a value already exist (overwriting it).
foreach ($totals as $user => $lesson) {
foreach ($lesson as $lessonId => $content) {
foreach ($content as $contentId => $seconds) {
if (isset($existing[$user][$lessonId][$contentId])) {
eF_updateTableData("users_to_content", array("total_time" => $seconds), "users_LOGIN='{$user}' and content_ID={$contentId} and lessons_ID={$lessonId}");
} else {
$data[] = array("users_LOGIN" => $user, "content_ID" => $contentId, "lessons_ID" => $lessonId, "total_time" => $seconds);
}
}
}
}
eF_insertTableDataMultiple("users_to_content", $data);
//step 4: Read the lesson (but not unit) times from the user_times table
$data = $totals = array();
$result = eF_getTableData("user_times", "users_LOGIN, entity_ID, time", "entity = 'lesson'");
foreach ($result as $value) {
if (isset($totals[$value['users_LOGIN']][$value['entity_ID']])) {
$totals[$value['users_LOGIN']][$value['entity_ID']] += $value['time'];
} else {
$totals[$value['users_LOGIN']][$value['entity_ID']] = $value['time'];
}
}
//step 5: Populate the users_to_content table with the plain lesson times, using null as a contentId
foreach ($totals as $user => $lesson) {
foreach ($lesson as $lessonId => $seconds) {
$data[] = array("users_LOGIN" => $user, "content_ID" => null, "lessons_ID" => $lessonId, "total_time" => $seconds);
}
}
eF_deleteTableData("users_to_content", "content_ID is null or content_ID=0");
//empty previous entries
eF_insertTableDataMultiple("users_to_content", $data);
}
}
示例7: importDataMultiple
//.........这里部分代码省略.........
$branchId = $branchId[0];
} else {
throw new EfrontBranchException(_BRANCHNAMEAMBIGUOUS . ': ' . $value['branch_name'], EfrontBranchException::BRANCH_AMBIGUOUS);
}
} else {
throw new EfrontBranchException(_BRANCHDOESNOTEXIST . ': ' . $value['branch_name'], EfrontBranchException::BRANCH_NOT_EXISTS);
}
$jobId = false;
foreach ($jobDescriptions as $job) {
if ($job['description'] == $value['description'] && $job['branch_ID'] == $branchId) {
$jobId = $job['job_description_ID'];
}
}
if (!$jobId) {
$jobId = eF_insertTableData("module_hcd_job_description", array('description' => $value['description'], 'branch_ID' => $branchId));
$jobDescriptions[$jobId] = array('job_description_ID' => $jobId, 'description' => $value['description'], 'branch_ID' => $branchId);
}
$user = EfrontUserFactory::factory($value["users_login"]);
$value['users_login'] = $user->user['login'];
if (isset($userJobs[$value['users_login']]) && $this->options['replace_assignments']) {
$unset = false;
foreach ($userJobs[$value['users_login']] as $key => $v) {
if (!isset($addedJobs[$v][$value['users_login']])) {
$user->aspects['hcd']->removeJob($v);
unset($userJobs[$value['users_login']][$v]);
$unset = true;
}
}
if ($unset) {
unset($userBranchesAssigned[$value['users_login']]);
}
}
if (isset($userJobs[$value['users_login']][$jobId]) && $this->options['replace_existing']) {
eF_deleteTableData("module_hcd_employee_has_job_description", "users_login='" . $value['users_login'] . "' AND job_description_ID ='" . $jobId . "'");
unset($userJobs[$value['users_login']][$jobId]);
}
// Check if this job description is already assigned
if (!isset($userJobs[$value['users_login']][$jobId])) {
if (!isset($userBranchesAssigned[$value['users_login']][$branchId])) {
// Write to the database the new branch assignment: employee to branch (if such an assignment is not already true)
if (isset($userBranchesUnassigned[$value['users_login']][$branchId])) {
eF_updateTableData("module_hcd_employee_works_at_branch", array("assigned" => 1), "users_login='" . $value['users_login'] . "' and branch_ID={$branchId}");
unset($userBranchesUnassigned[$value['users_login']][$branchId]);
} else {
$fields = array('users_login' => $value['users_login'], 'supervisor' => $value['supervisor'], 'assigned' => '1', 'branch_ID' => $branchId);
eF_insertTableData("module_hcd_employee_works_at_branch", $fields);
if ($value['supervisor']) {
//Iterate through sub branches
foreach (eF_subBranches($branchId, $allBranches) as $subBranchId) {
//If this subranch is not associated with the user, associate it
if (!isset($userBranchesAssigned[$value['users_login']][$subBranchId]) && !isset($userBranchesUnassigned[$value['users_login']][$subBranchId])) {
$fields = array('users_login' => $value['users_login'], 'supervisor' => 1, 'assigned' => '0', 'branch_ID' => $subBranchId);
eF_insertTableData("module_hcd_employee_works_at_branch", $fields);
$userBranchesUnassigned[$value['users_login']][$branchId] = array('branch_ID' => $branchId, 'supervisor' => $value['supervisor'], 'assigned' => 0);
} elseif (isset($userBranchesAssigned[$value['users_login']][$subBranchId]) && $userBranchesAssigned[$value['users_login']][$subBranchId]['supervisor'] == 0) {
eF_updateTableData("module_hcd_employee_works_at_branch", array("supervisor" => 1), "users_login='" . $value['users_login'] . "' and branch_ID={$subBranchId}");
$userBranchesAssigned[$value['users_login']][$subBranchId]['supervisor'] = 1;
} elseif (isset($userBranchesUnassigned[$value['users_login']][$subBranchId]) && $userBranchesUnassigned[$value['users_login']][$subBranchId]['supervisor'] == 0) {
eF_updateTableData("module_hcd_employee_works_at_branch", array("supervisor" => 1), "users_login='" . $value['users_login'] . "' and branch_ID={$subBranchId}");
$userBranchesUnassigned[$value['users_login']][$subBranchId]['supervisor'] = 1;
}
}
}
}
$userBranchesAssigned[$value['users_login']][$branchId] = array('branch_ID' => $branchId, 'supervisor' => $value['supervisor'], 'assigned' => 1);
$addedBranches[$branchId][$value['users_login']] = $value['users_login'];
示例8: removeBranch
/**
* Remove association of a branch with this lesson
*
* This function is used to stop the correlation of a branch to the lesson
*
* <br/>Example:
* <code>
* $lesson -> removeBranch(2); // The lesson will stop offering branch with id 2
* </code>
*
* @param $branch_ID the id of the branch to be removed from the lesson
* @return boolean true/false
* @since 3.6.0
* @access public
*/
public function removeBranch($branch_ID)
{
$this->getBranches();
// Check if the branch is not assigned as offered by this lesson
if ($this->branches[$branch_ID]['lessons_ID'] == $this->lesson['id']) {
if ($ok = eF_deleteTableData("module_hcd_lesson_to_branch", "branches_ID = '" . $branch_ID . "' AND lessons_ID = '" . $this->lesson['id'] . "'")) {
$this->branches[$branch_ID]['lessons_ID'] = "";
} else {
throw new EfrontLessonException(_EMPLOYEESRECORDCOULDNOTBEUPDATED, EfrontLessonException::DATABASE_ERROR);
}
}
return true;
}
示例9: delete
/**
* Delete a direction
* This function is used to delete the current direction
* <br/>Example:
* <code>
* $direction_array = eF_getTableData("directions", "*", "id=4");
* $direction = new EfrontDirection($direction_array[0]);
* $direction -> delete();
* </code>
*
* @since 3.5.0
* @access public
*/
function delete()
{
foreach (new EfrontAttributeFilterIterator(new RecursiveIteratorIterator(new RecursiveArrayIterator($this)), 'id') as $key => $value) {
eF_deleteTableData("directions", "id=" . $value);
//Delete Units from database
eF_updateTableData("lessons", array("directions_ID" => 0), "directions_ID=" . $value);
eF_updateTableData("courses", array("directions_ID" => 0), "directions_ID=" . $value);
}
}
示例10: removeCourses
/**
* Remove courses from group
*
* This function is used to remove courses from the current group
* <br>Example:
* <code>
* $group = new EfrontGroup(2);
* $group -> removeCourses(array(21, 32)); // remove courses with ids 21 and 32
* </code>
*
* @param mixed $users An array of course ids or EfrontCourse objects, or a single id or EfrontCourse object
* @return boolean True if everything is ok
* @since 3.5.2
* @access public
*/
public function removeCourses($courses)
{
if (!is_array($courses)) {
if ($courses instanceof EfrontCourse) {
$courses = $courses->course['id'];
}
$courses = array($courses);
}
foreach ($courses as $course) {
if ($course instanceof EfrontCourse) {
$course = $course->course['id'];
}
if (eF_checkParameter($course, 'id')) {
eF_deleteTableData("courses_to_groups", "courses_ID ='" . $course . "' and groups_ID=" . $this->group['id']);
}
}
return true;
}
示例11: getModule
public function getModule()
{
$currentLesson = $this->getCurrentLesson();
$smarty = $this->getSmartyVar();
$smarty->assign("T_LESSON_ID", $currentLesson->lesson['id']);
if (isset($_GET['delete_link']) && eF_checkParameter($_GET['delete_link'], 'id')) {
eF_deleteTableData("module_links", "id=" . $_GET['delete_link']);
$this->setMessageVar(_LINKS_SUCCESFULLYDELETEDLINK, 'success');
eF_redirect("" . $this->moduleBaseUrl . "&message=" . urlencode($message) . "&message_type={$message_type}");
} else {
if (isset($_GET['add_link']) || isset($_GET['edit_link']) && eF_checkParameter($_GET['edit_link'], 'id')) {
$form = new HTML_QuickForm("link_entry_form", "POST", $_SERVER['REQUEST_URI'], "");
$form->registerRule('checkParameter', 'callback', 'eF_checkParameter');
//Register this rule for checking user input with our function, eF_checkParameter
$form->addElement('text', 'display', null);
$form->addElement('text', 'link', null);
$form->addElement('textarea', 'description', null);
$form->addElement('submit', 'submit_link', _SUBMIT, 'class = "flatButton"');
$element =& $form->getElement('display');
$element->setSize(50);
$element =& $form->getElement('link');
$element->setSize(50);
$element =& $form->getElement('description');
$element->setCols(50);
if (isset($_GET['edit_link'])) {
$link_entry = eF_getTableData("module_links", "*", "id=" . $_GET['edit_link']);
$form->setDefaults(array('display' => $link_entry[0]['display'], 'link' => $link_entry[0]['link'], 'description' => $link_entry[0]['description']));
} else {
$form->setDefaults(array('link' => "http://"));
}
if ($form->isSubmitted() && $form->validate()) {
$fields = array('lessons_ID' => $_SESSION['s_lessons_ID'], 'display' => $form->exportValue('display'), 'link' => $form->exportValue('link'), 'description' => $form->exportValue('description'));
if (isset($_GET['edit_link'])) {
if (eF_updateTableData("module_links", $fields, "id=" . $_GET['edit_link'])) {
$message = _LINKS_SUCCESFULLYUPDATEDLINKENTRY;
$message_type = 'success';
eF_redirect("" . $_SERVER['PHP_SELF'] . "?ctg=module&op=module_links&message=" . urlencode($message) . "&message_type={$message_type}");
} else {
$message = _LINKS_PROBLEMUPDATINGLINKENTRY;
$message_type = 'failure';
eF_redirect("" . $_SERVER['PHP_SELF'] . "?ctg=module&op=module_links&message=" . urlencode($message) . "&message_type={$message_type}");
}
} else {
if (eF_insertTableData("module_links", $fields)) {
$message = _LINKS_SUCCESFULLYINSERTEDLINKENTRY;
$message_type = 'success';
eF_redirect("" . $_SERVER['PHP_SELF'] . "?ctg=module&op=module_links&message=" . urlencode($message) . "&message_type={$message_type}");
} else {
$message = _LINKS_PROBLEMINSERTINGLINKENTRY;
$message_type = 'failure';
eF_redirect("" . $_SERVER['PHP_SELF'] . "?ctg=module&op=module_links&message=" . urlencode($message) . "&message_type={$message_type}");
}
}
}
$renderer = new HTML_QuickForm_Renderer_ArraySmarty($smarty);
$form->accept($renderer);
$smarty->assign('T_LINKS_FORM', $renderer->toArray());
} else {
$links = eF_getTableDataFlat("module_links", "*", "lessons_ID = " . $_SESSION['s_lessons_ID']);
$smarty->assign("T_LINKS", $links);
}
}
return true;
}
示例12: reBuiltIndex
/**
* Function reBuiltIndex()
*
* This function is used to built the keywords from scratch
*
* @since 3.5.0
* @access public
*/
public static function reBuiltIndex()
{
eF_deleteTableData("search_keywords");
//Delete old search terms
// eF_deleteTableData("search");
$GLOBALS['db']->Execute("truncate table search_invertedindex");
//Courses Data
$courses = eF_getTableData("courses", "id,name");
for ($i = 0; $i < sizeof($courses); $i++) {
EfrontSearch::insertText($courses[$i]['name'], $courses[$i]['id'], "courses", "title");
}
//Lesson Data
$lessons = eF_getTableData("lessons", "id,name");
for ($i = 0; $i < sizeof($lessons); $i++) {
EfrontSearch::insertText($lessons[$i]['name'], $lessons[$i]['id'], "lessons", "title");
}
//Content Data
$content = eF_getTableData("content", "id,name,data");
for ($i = 0; $i < sizeof($content); $i++) {
EfrontSearch::insertText($content[$i]['name'], $content[$i]['id'], "content", "title");
EfrontSearch::insertText(strip_tags($content[$i]['data']), $content[$i]['id'], "content", "data");
}
//Forum Messages
$forum_messages = eF_getTableData("f_messages", "id, title, body");
for ($i = 0; $i < sizeof($forum_messages); $i++) {
EfrontSearch::insertText(strip_tags($forum_messages[$i]['body']), $forum_messages[$i]['id'], "f_messages", "data");
EfrontSearch::insertText($forum_messages[$i]['title'], $forum_messages[$i]['id'], "f_messages", "title");
}
//Forums
$forums = eF_getTableData("f_forums", "id, title, comments");
for ($i = 0; $i < sizeof($forums); $i++) {
EfrontSearch::insertText($forums[$i]['title'], $forums[$i]['id'], "f_forums", "title");
if (strlen($forums[$i]['comments']) > 3) {
EfrontSearch::insertText(strip_tags($forums[$i]['comments']), $forums[$i]['id'], "f_forums", "data");
}
}
//Forums Topics
$f_topics = eF_getTableData("f_topics", "id, title, comments");
for ($i = 0; $i < sizeof($f_topics); $i++) {
EfrontSearch::insertText($f_topics[$i]['title'], $f_topics[$i]['id'], "f_topics", "title");
if (strlen($f_topics[$i]['comments']) > 3) {
EfrontSearch::insertText(strip_tags($f_topics[$i]['comments']), $f_topics[$i]['id'], "f_topics", "data");
}
}
//Forums Polls
$f_poll = eF_getTableData("f_poll", "id, title, question");
for ($i = 0; $i < sizeof($f_poll); $i++) {
EfrontSearch::insertText($f_poll[$i]['title'], $f_poll[$i]['id'], "f_poll", "title");
if (strlen($f_poll[$i]['question']) > 3) {
EfrontSearch::insertText(strip_tags($f_poll[$i]['question']), $f_poll[$i]['id'], "f_poll", "data");
}
}
//Personal Messages
$personal_messages = eF_getTableData("f_personal_messages", "id, title, body");
//Get all the personal messages
for ($i = 0; $i < sizeof($personal_messages); $i++) {
EfrontSearch::insertText($personal_messages[$i]['body'], $personal_messages[$i]['id'], "f_personal_messages", "data");
EfrontSearch::insertText($personal_messages[$i]['title'], $personal_messages[$i]['id'], "f_personal_messages", "title");
}
//Questions
$questions = eF_getTableData("questions", "id, text");
for ($i = 0; $i < sizeof($questions); $i++) {
EfrontSearch::insertText(strip_tags($questions[$i]['data']), $questions[$i]['id'], "questions", "data");
}
//Glossary terms
$glossary = eF_getTableData("glossary", "id, name, info");
for ($i = 0; $i < sizeof($glossary); $i++) {
EfrontSearch::insertText(strip_tags($glossary[$i]['info']), $glossary[$i]['id'], "glossary", "data");
EfrontSearch::insertText($glossary[$i]['name'], $glossary[$i]['id'], "glossary", "title");
}
}
示例13: eF_deleteTableData
if (!$currentEmployee->isSupervisor()) {
$_change_evaluations_ = false;
} else {
if ($currentEmployee->supervisesEmployee($editedUser->user['login'])) {
$_change_evaluations_ = true;
} else {
$_change_evaluations_ = false;
}
}
}
}
}
$smarty->assign("_change_evaluations_", $_change_evaluations_);
if (isset($_GET['delete_evaluation']) && eF_checkParameter($_GET['delete_evaluation'], 'id') && $_change_evaluations_) {
try {
eF_deleteTableData("module_hcd_events", "event_ID = '" . $_GET['delete_evaluation'] . "'");
} catch (Exception $e) {
handleAjaxExceptions($e);
}
exit;
} elseif (isset($_GET['add_evaluation']) || isset($_GET['edit_evaluation']) && eF_checkParameter($_GET['edit_evaluation'], 'id') && $_change_evaluations_) {
$load_editor = true;
$form = new HTML_QuickForm("evaluations_form", "post", basename($_SERVER['PHP_SELF']) . "?ctg=personal&user=" . $editedUser->user['login'] . "&op=evaluations&" . (isset($_GET['edit_evaluation']) ? "&edit_evaluation=" . $_GET['edit_evaluation'] : "&add_evaluation=1"), "", null, true);
$form->addElement('textarea', 'specification', _EVALUATIONCOMMENT, 'class = "simpleEditor" style = "width:400px;"');
$form->addElement('submit', 'submit', _SUBMIT, 'class = "flatButton"');
if (isset($_GET['edit_evaluation'])) {
$evaluations = eF_getTableData("module_hcd_events", "*", "event_ID = '" . $_GET['edit_evaluation'] . "'");
$form->setDefaults(array('specification' => $evaluations[0]['specification']));
}
try {
if ($form->isSubmitted() && $form->validate()) {
示例14: foreach
if ($testInstance->options['automatic_assignment']) {
$analysisResults = $testInstance->analyseSkillGapTest();
foreach ($analysisResults['lessons'] as $lesson) {
$currentUser->addLessons($lesson['lesson_ID']);
}
foreach ($analysisResults['courses'] as $course) {
$currentUser->addCourses($course['courses_ID']);
}
eF_redirect("" . basename($_SERVER['PHP_SELF']) . "?ctg=lessons&op=tests&message=" . urlencode(_SKILLGAPTESTCOMPLETEDSUCCESSFULLYANDTHECORRESPONDING) . " " . sizeof($analysisResults['lessons']) . " " . _LESSONS . " " . _AND . " " . sizeof($analysisResults['courses']) . " " . _COURSES . " " . _HAVEBEENASSIGNED . "&message_type=success");
} else {
eF_redirect("" . basename($_SERVER['PHP_SELF']) . "?ctg=lessons&op=tests&message=" . urlencode(_SKILLGAPTESTCOMPLETEDSUCCESSFULLY) . ". " . urlencode(_YOURRESULTSHAVEBEENSENTTOYOURPROFESSORSWHOWILLASSIGNLESSONSACCORDINGTOYOURNEEDS) . "&message_type=success");
}
exit;
}
//HACK to remove incomplete tests
eF_deleteTableData("completed_tests", "tests_id = '" . $_GET['solve_test'] . "' AND users_LOGIN = '" . $currentUser->user['login'] . "'");
$test = new EfrontTest($_GET['solve_test']);
$testInstance = $test->start($currentUser->user['login']);
// Hard coded to disallow pause test
$testInstance->options['pause_test'] = 0;
$testString = $testInstance->toHTMLQuickForm($form);
$testString = $testInstance->toHTML($testString, $remainingTime);
$form->addElement('hidden', 'time_start', $timeStart);
//This element holds the time the test started, so we know the remaining time even if the user left the system
$form->addElement('submit', 'submit_test', _SUBMITTEST, 'class = "flatButton" onclick = "if (typeof(checkedQuestions) != \'undefined\' && (unfinished = checkQuestions())) return confirm(\'' . _YOUHAVENOTCOMPLETEDTHEFOLLOWINGQUESTIONS . ': \'+unfinished+\'. ' . _AREYOUSUREYOUWANTTOSUBMITTEST . '\');"');
if ($testInstance->options['pause_test']) {
$form->addElement('submit', 'pause_test', _PAUSETEST, 'class = "flatButton"');
}
$renderer = new HTML_QuickForm_Renderer_ArraySmarty($smarty);
$form->accept($renderer);
$smarty->assign('T_TEST_FORM', $renderer->toArray());
示例15: delete
/**
* Delete the project
*
* This function is used to delete the current project.
* All related information is lost, as well as files associated
* with the project.
* <br/>Example:
* <code>
* $project = new EfrontProject(12); //Instantiate project with id 12
* $project -> delete(); //Delete project and all associated information
* </code>
*
* @since 3.5.0
* @access public
* @todo delete project files
*/
public function delete()
{
foreach ($this->getUsers() as $value) {
if ($value['filename']) {
try {
$file = new EfrontFile($value['filename']);
$file->delete();
$file = new EfrontFile($value['professor_upload_filename']);
$file->delete();
} catch (Exception $e) {
/*bypass non-existing files*/
}
}
}
eF_deleteTableData("users_to_projects", "projects_ID=" . $this->project['id']);
eF_deleteTableData("projects", "id=" . $this->project['id']);
}