function jlms_booking_users_delete($cid, $course_id, $option) { global $JLMS_DB; if (count($cid)) { $pid = intval(mosgetparam($_POST, "p_id", 0)); $cids = implode(',', $cid); $query = "DELETE FROM #__lms_conference_usr WHERE p_id = '" . $pid . "' AND user_id IN (" . $cids . ")"; $JLMS_DB->setQuery($query); if (!$JLMS_DB->query()) { echo "<script> alert('" . $JLMS_DB->getErrorMsg() . "'); window.history.go(-1); </script>\n"; exit; } } JLMSRedirect(sefRelToAbs('index.php?option=' . $option . '&task=conference&mode=user_access&id=' . $course_id . '&pid=' . $pid)); }
function JLMS_Course_HomePage($course_id, $add_elements_page = false) { global $option, $my, $JLMS_DB, $Itemid, $JLMS_CONFIG, $JLMS_SESSION; //TODO: replace global option declaration $usertype = $JLMS_CONFIG->get('current_usertype', 0); $JLMS_ACL =& JLMSFactory::getACL(); $is_teacher = $JLMS_ACL->isTeacher(); $AND_ST = ""; if (false !== ($enroll_period = JLMS_getEnrolPeriod($my->id, $course_id))) { $AND_ST = " AND IF(is_time_related, (show_period < '" . $enroll_period . "' ), 1) "; } $this->course_id = $course_id; $curr_date = date("Y-m-d"); $is_curtopic = intval(mosgetparam($_REQUEST, 't_id', 0)); //create list of topics if ($usertype == 1) { $published = '1'; } else { $published = "published=1 AND (publish_start=0 OR start_date<='{$curr_date}') AND (publish_end=0 OR end_date>='{$curr_date}')"; } $query = "SELECT * FROM #__lms_topics WHERE course_id={$course_id} " . $AND_ST . " AND {$published} " . ($is_curtopic ? " AND id=" . $is_curtopic : "") . " ORDER BY ordering"; $JLMS_DB->setQuery($query); $this->topics = $JLMS_DB->loadObjectList('id'); //get items of the course //2 - documents if ($add_elements_page) { $rows = array(); $possibilities = new stdClass(); JLMSDocs::FillList($course_id, $rows, $possibilities, false, false); $this->elements[_DOCUMENT_ID] = JLMSDocs::GetItemsbyPermission($rows, 'manage'); } else { $AND_ST_D = ""; if (false !== ($enroll_period = JLMS_getEnrolPeriod($my->id, $course_id))) { $AND_ST_D = " AND IF(a.is_time_related, (a.show_period < '" . $enroll_period . "' ), 1) "; } $query = "SELECT a.*, b.file_name FROM #__lms_documents as a LEFT JOIN #__lms_files as b ON a.file_id = b.id AND a.folder_flag = 0 WHERE a.course_id={$course_id}" . $AND_ST_D; $JLMS_DB->setQuery($query); $this->elements[_DOCUMENT_ID] = $JLMS_DB->loadObjectList('id'); foreach ($this->elements[_DOCUMENT_ID] as $elem) { if ($elem->folder_flag == 3) { $query = "SELECT a.*, b.file_name" . "\n FROM #__lms_outer_documents as a LEFT JOIN #__lms_files as b ON a.file_id = b.id AND a.folder_flag = 0 " . "\n WHERE a.folder_flag = 0 AND a.id = " . $elem->file_id; $JLMS_DB->SetQuery($query); $out_row = $JLMS_DB->LoadObjectList(); if (count($out_row) && isset($out_row[0]->allow_link) && $out_row[0]->allow_link == 1) { $this->elements[_DOCUMENT_ID][$elem->id]->doc_name = $out_row[0]->doc_name; $this->elements[_DOCUMENT_ID][$elem->id]->doc_description = $out_row[0]->doc_description; $this->elements[_DOCUMENT_ID][$elem->id]->file_id = $out_row[0]->file_id; $this->elements[_DOCUMENT_ID][$elem->id]->file_name = $out_row[0]->file_name; } else { unset($this->elements[_DOCUMENT_ID][$elem->id]); } } } $this->elements[_DOCUMENT_ID] = AppendFileIcons_toList($this->elements[_DOCUMENT_ID]); } //get max tree level $this->max_lvl = getDirNesting($this->elements[_DOCUMENT_ID], 0); global $max_lvl; $max_lvl = $this->max_lvl; //3 - links $query = "SELECT * FROM #__lms_links WHERE course_id={$course_id}" . $AND_ST; $JLMS_DB->setQuery($query); $this->elements[_LINK_ID] = $JLMS_DB->loadObjectList('id'); //4 - contents ... er... TODO //5 - quizs $query = "SELECT *, c_id AS id FROM #__lms_quiz_t_quiz WHERE course_id={$course_id}" . $AND_ST; $JLMS_DB->setQuery($query); $this->elements[_QUIZ_ID] = $JLMS_DB->loadObjectList('c_id'); $quizzes_i = array(); foreach ($this->elements[_QUIZ_ID] as $row) { $quizzes_i[] = $row->c_id; } //add results for student if ($usertype == 2 && count($this->elements[_QUIZ_ID])) { $quizzes_r = array(); foreach ($this->elements[_QUIZ_ID] as $row) { $quizzes_r[] = $row->c_id; } $q_items_num = array(); $extra_info_cells = array(); if (!empty($quizzes_r)) { $quizzes_r_cid = implode(',', $quizzes_r); $query = "SELECT * FROM #__lms_quiz_results WHERE quiz_id IN ({$quizzes_r_cid}) AND course_id={$course_id} AND user_id={$my->id} GROUP BY quiz_id"; $JLMS_DB->SetQuery($query); $extra_info_cells = $JLMS_DB->loadObjectList(); } foreach ($this->elements[_QUIZ_ID] as $i => $value) { $this->elements[_QUIZ_ID][$i]->start_date = '-'; $this->elements[_QUIZ_ID][$i]->end_date = '-'; $this->elements[_QUIZ_ID][$i]->status = -1; $this->elements[_QUIZ_ID][$i]->user_passed = -1; $this->elements[_QUIZ_ID][$i]->points = -1; $this->elements[_QUIZ_ID][$i]->user_score = 0; $this->elements[_QUIZ_ID][$i]->quiz_max_score = 0; foreach ($extra_info_cells as $cell) { if ($cell->quiz_id == $this->elements[_QUIZ_ID][$i]->c_id) { $this->elements[_QUIZ_ID][$i]->start_date = JLMS_dateToDisplay($cell->quiz_date, false, $JLMS_CONFIG->get('offset') * 60 * 60 - $cell->user_time, '\\<\\b\\r \\/>H:i:s'); $this->elements[_QUIZ_ID][$i]->end_date = JLMS_dateToDisplay($cell->quiz_date, false, $JLMS_CONFIG->get('offset') * 60 * 60, '\\<\\b\\r \\/>H:i:s'); $this->elements[_QUIZ_ID][$i]->points = $cell->user_score; $this->elements[_QUIZ_ID][$i]->status = $cell->user_passed; $this->elements[_QUIZ_ID][$i]->user_passed = $cell->user_passed; $this->elements[_QUIZ_ID][$i]->user_score = $cell->user_score; $this->elements[_QUIZ_ID][$i]->quiz_max_score = $cell->quiz_max_score; } } } unset($extra_info_cells); require_once _JOOMLMS_FRONT_HOME . DS . "includes" . DS . "lms_certificates.php"; $arr = array(); JLMS_Certificates::JLMS_GB_getUserCertificates($course_id, $my->id, $arr); $arr1 = isset($arr['user_quiz_certificates']) ? $arr['user_quiz_certificates'] : array(); foreach ($this->elements[_QUIZ_ID] as $i => $value) { for ($j = 0; $j < count($arr1); $j++) { if ($arr1[$j]->c_quiz_id == $this->elements[_QUIZ_ID][$i]->c_id) { $this->elements[_QUIZ_ID][$i]->link_certificate = "<a target = \"_blank\" href = \"" . $JLMS_CONFIG->get('live_site') . "/index.php?tmpl=component&option=" . $option . "&no_html=1&task=print_quiz_cert&course_id=" . $course_id . "&stu_quiz_id=" . $arr1[$j]->stu_quiz_id . "&user_unique_id=" . $arr1[$j]->user_unique_id . "\"><img src = \"" . $JLMS_CONFIG->get('live_site') . "/components/com_joomla_lms/lms_images/toolbar/btn_certificate.png\" border = \"0\" align=\"top\" alt=\"certificate\"/></a>"; } } } } //6 - scorm ... er... TODO //7 - learning paths $lpaths = array(); if ($course_id && $usertype) { //$JLMS_SESSION->clear('redirect_to_learnpath'); if ($usertype == 1) { $query = "SELECT * FROM #__lms_learn_paths WHERE course_id = '" . $course_id . "'" . $AND_ST . "\n ORDER BY ordering"; } elseif ($usertype == 2) { //$query = "SELECT a.*, b.user_status as r_status, b.start_time as r_start, b.end_time as r_end" //. "\n FROM #__lms_learn_paths as a LEFT JOIN #__lms_learn_path_results as b ON a.id = b.lpath_id AND b.course_id = '".$course_id."' AND b.user_id = '".$my->id."'" $query = "SELECT a.*, '' as r_status, '' as r_start, '' as r_end" . "\n FROM #__lms_learn_paths as a" . "\n WHERE a.course_id = '" . $course_id . "'" . "\n AND a.published = 1" . "\n ORDER BY a.ordering"; } $JLMS_DB->SetQuery($query); $lpaths = $JLMS_DB->LoadObjectList(); if ($usertype == 2) { $user_ids = array(); $user_ids[] = $my->id; require_once _JOOMLMS_FRONT_HOME . "/includes/lms_grades.lib.php"; JLMS_LP_populate_results($course_id, $lpaths, $user_ids); // 13 August 2007 (DEN) Check for prerequisites. // 1. get the list of lpath_ids. $lpath_ids = array(); foreach ($lpaths as $lpath) { $lpath_ids[] = $lpath->id; } if (!empty($lpath_ids)) { $lpath_ids_str = implode(',', $lpath_ids); // 2. get the list of prerequisites // SELECT from two tables (+ #__lms_learn_paths) - because the prereq lpath could be deleted... $query = "SELECT a.* FROM #__lms_learn_path_prerequisites as a, #__lms_learn_paths as b" . "\n WHERE a.lpath_id IN ({$lpath_ids_str}) AND a.req_id = b.id"; $JLMS_DB->SetQuery($query); $prereqs = $JLMS_DB->LoadObjectList(); if (!empty($prereqs)) { // 3. compare lists of prereqs to the lists of lpaths. $i = 0; while ($i < count($lpaths)) { $is_hidden = false; $o = 0; while ($o < count($prereqs)) { if ($prereqs[$o]->lpath_id == $lpaths[$i]->id) { $j = 0; while ($j < count($lpaths)) { if ($lpaths[$j]->id == $prereqs[$o]->req_id) { if (!$lpaths[$j]->item_id) { if (empty($lpaths[$j]->r_status)) { $is_hidden = true; break; } else { $end_time = strtotime($lpaths[$j]->r_end); $current_time = strtotime(date("Y-m-d H:i:s")); if ($current_time > $end_time && $current_time - $end_time < $prereqs[$o]->time_minutes * 60) { $is_hidden = true; break; } } } else { if (empty($lpaths[$j]->s_status)) { $is_hidden = true; break; } else { $end_time = strtotime($lpaths[$j]->r_end); $current_time = strtotime(date("Y-m-d H:i:s")); if ($current_time > $end_time && $current_time - $end_time < $prereqs[$o]->time_minutes * 60) { $is_hidden = true; break; } } } } $j++; } } $o++; } $lpaths[$i]->is_hidden = $is_hidden; $i++; } } } } } foreach ($lpaths as $lpath) { $this->elements[_LPATH_ID][$lpath->id] = $lpath; } //populate topics with links to their items $query = "SELECT * FROM #__lms_topic_items WHERE course_id={$course_id} ORDER BY ordering"; $JLMS_DB->setQuery($query); $items = $JLMS_DB->loadObjectList(); for ($i = 0; $i < count($items); $i++) { if ($items[$i]->item_type == 7) { $query = "SELECT lp_type FROM #__lms_learn_paths WHERE id = '" . $items[$i]->item_id . "'" . $AND_ST; $JLMS_DB->SetQuery($query); $lp_type = $JLMS_DB->LoadResult(); if ($lp_type == 2) { $query = "SELECT item_id FROM #__lms_learn_paths WHERE id = '" . $items[$i]->item_id . "'"; $JLMS_DB->SetQuery($query); $learn_path_id = $JLMS_DB->LoadResult(); $query = "SELECT scorm_package, params as scorm_params, width as scorm_width, height as scorm_height FROM #__lms_n_scorm WHERE id = '" . $learn_path_id . "'"; $JLMS_DB->SetQuery($query); $outer_doc = null; $scorm_info = null; $scorm_info = $JLMS_DB->LoadObject(); if (is_object($scorm_info)) { $this->elements[_LPATH_ID][$items[$i]->item_id]->scorm_params = $scorm_info->scorm_params; $this->elements[_LPATH_ID][$items[$i]->item_id]->scorm_width = $scorm_info->scorm_width; $this->elements[_LPATH_ID][$items[$i]->item_id]->scorm_height = $scorm_info->scorm_height; $scorm_package = $scorm_info->scorm_package; $query = "SELECT id FROM #__lms_n_scorm WHERE scorm_package = '" . $scorm_package . "' AND course_id = 0"; $JLMS_DB->SetQuery($query); $scorm_lib_id = $JLMS_DB->LoadResult(); $query = "SELECT outdoc_share, owner_id, allow_link FROM #__lms_outer_documents WHERE file_id = '" . $scorm_lib_id . "' AND folder_flag = 3"; $JLMS_DB->SetQuery($query); $outer_doc = $JLMS_DB->LoadObject(); } if (is_object($outer_doc) && isset($outer_doc->allow_link) && $outer_doc->allow_link == 1) { // 01May2009: new library policy: if 'allow_link' is enabled - we can view already added resource ! } else { unset($items[$i]); } } elseif ($lp_type == 1) { $query = "SELECT item_id FROM #__lms_learn_paths WHERE id = '" . $items[$i]->item_id . "'"; $JLMS_DB->SetQuery($query); $learn_path_id = $JLMS_DB->LoadResult(); if ($learn_path_id) { $query = "SELECT params as scorm_params, width as scorm_width, height as scorm_height FROM #__lms_n_scorm WHERE id = '" . $learn_path_id . "'"; $JLMS_DB->SetQuery($query); $scorm_info = null; $scorm_info = $JLMS_DB->LoadObject(); if (is_object($scorm_info)) { $this->elements[_LPATH_ID][$items[$i]->item_id]->scorm_params = $scorm_info->scorm_params; $this->elements[_LPATH_ID][$items[$i]->item_id]->scorm_width = $scorm_info->scorm_width; $this->elements[_LPATH_ID][$items[$i]->item_id]->scorm_height = $scorm_info->scorm_height; } } } } } if (!$is_teacher) { $this->_filterItemsByShowPeriod($items, $course_id); } $mas = array(); foreach ($items as $k => $v) { $mas[] = $items[$k]; } unset($lpath); $items = $mas; $links = array(); foreach ($items as $item) { $item_tmp->id = $item->item_id; $item_tmp->type = $item->item_type; $item_tmp->ordering = $item->ordering; $links[$item->topic_id][] = $item; } $this->links = $links; }
* @copyright Copyright (C) 2004-2005 Soeren Eberhardt. All rights reserved. * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php * VirtueMart is free software. This version may have been modified pursuant * to the GNU General Public License, and as distributed it includes or * is derivative of works licensed under the GNU General Public License or * other free or open source software licenses. * See /administrator/components/com_virtuemart/COPYRIGHT.php for copyright notices and details. * * http://virtuemart.net */ mm_showMyFileName(__FILE__); if (!isset($_REQUEST["order_id"]) || empty($_REQUEST["order_id"])) { echo "Order ID is not set or emtpy!"; } else { include CLASSPATH . "payment/ps_paypal.cfg.php"; $order_id = intval(mosgetparam($_REQUEST, "order_id")); $q = "SELECT order_status FROM #__{vm}_orders WHERE "; $q .= "#__{vm}_orders.user_id= " . $auth["user_id"] . " "; $q .= "AND #__{vm}_orders.order_id= {$order_id} "; $db->query($q); if ($db->next_record()) { $order_status = $db->f("order_status"); if ($order_status == "P" || $order_status == "C") { ?> <img src="<?php echo IMAGEURL; ?> ps_image/button_ok.png" align="center" alt="Success" border="0" /> <h2>Thanks for your payment. The transaction was successful. You will get a confirmation e-mail for the transaction by PaySbuy.
function showElementsList($course_id, $topic_id, $elements, $linked_elements) { global $Itemid, $option, $max_lvl, $JLMS_CONFIG; $max_lvl = 1; //work out chapters... TODO //work out documents JLMS_TMPL::OpenMT(); $hparams = array(); $toolbar = array(); $title = ''; $title = _JLMS_TOPIC_T_LINK_ELEMENT; $toolbar[] = array('btn_type' => 'save', 'btn_js' => "javascript:submitbutton('add_submit_topic_element');"); $toolbar[] = array('btn_type' => 'cancel', 'btn_js' => "javascript:submitbutton('details_course');"); JLMS_TMPL::ShowHeader('doc', $title, $hparams, $toolbar); JLMS_TMPL::OpenTS(); ?> <form name="adminForm" method="post" action="<?php echo $JLMS_CONFIG->get('live_site') . "/index.php?option=" . $option . "&Itemid=" . $Itemid; ?> "> <table border="0" cellpadding="0" cellspacing="0" width="100%" class="<?php echo JLMSCSS::_('jlmslist'); ?> "> <?php $k = 2; //documents section $element_group = $elements[_DOCUMENT_ID]; $i = 0; $is_any_elements = 0; if (!empty($element_group)) { foreach ($element_group as $element) { if (@in_array($element->id, $linked_elements[_DOCUMENT_ID])) { continue; } if ($i == 0) { ?> <tr> <td colspan="7"><?php echo JLMSCSS::h2(_JLMS_TOPIC_E_DOCUMENTS); ?> </td> </tr> <?php } $tmp = _DOCUMENT_ID . '_' . $element->id; $checked = '<input type="checkbox" id="doc_cb' . $i . '" name="cid[]" value="' . $tmp . '" onclick="isChecked(this.checked);" />'; JLMS_topic_html::showDocumentRow($k, $element, $i, 0, $checked, _ROW_RO, 0, 1, 0); $i++; } } $is_any_elements = $is_any_elements + $i; //links section $element_group = $elements[_LINK_ID]; $i = 0; if (!empty($element_group)) { foreach ($element_group as $element) { if (@in_array($element->id, $linked_elements[_LINK_ID])) { continue; } if ($i == 0) { ?> <tr> <td colspan="7"><?php echo JLMSCSS::h2(_JLMS_TOPIC_E_LINKS); ?> </td> </tr> <?php } $tmp = _LINK_ID . '_' . $element->id; $checked = '<input type="checkbox" id="link_cb' . $i . '" name="cid[]" value="' . $tmp . '" onclick="isChecked(this.checked);" />'; JLMS_topic_html::showLinkRow($k, $element, $i, 0, $checked, _ROW_RO); $i++; } } $is_any_elements = $is_any_elements + $i; //quizs section $element_group = $elements[_QUIZ_ID]; $i = 0; if (!empty($element_group)) { foreach ($element_group as $element) { if (@in_array($element->id, $linked_elements[_QUIZ_ID])) { continue; } if ($i == 0) { ?> <tr> <td colspan="7"><?php echo JLMSCSS::h2(_JLMS_TOPIC_E_QUIZZES); ?> </td> </tr> <?php } $tmp = _QUIZ_ID . '_' . $element->id; $checked = '<input type="checkbox" id="quiz_cb' . $i . '" name="cid[]" value="' . $tmp . '" onclick="isChecked(this.checked);" />'; JLMS_topic_html::showQuizRow($k, $element, $i, 0, $checked, _ROW_RO); $i++; } } $is_any_elements = $is_any_elements + $i; //Lpaths section $element_group = isset($elements[_LPATH_ID]) ? $elements[_LPATH_ID] : array(); $i = 0; if (!empty($element_group)) { foreach ($element_group as $element) { if (@in_array($element->id, $linked_elements[_LPATH_ID])) { continue; } if ($i == 0) { ?> <tr> <td colspan="7"><?php echo JLMSCSS::h2(_JLMS_TOPIC_E_LPATHS); ?> </td> </tr> <?php } $tmp = _LPATH_ID . '_' . $element->id; $checked = '<input type="checkbox" id="lpath_cb' . $i . '" name="cid[]" value="' . $tmp . '" onclick="isChecked(this.checked);" />'; JLMS_topic_html::showLPathRow($k, $element, $i, 0, $checked, _ROW_RO); $i++; } } $is_any_elements = $is_any_elements + $i; if (!$is_any_elements) { ?> <tr> <td colspan="7"><?php echo '<div class="joomlalms_user_message">' . _JLMS_TOPICS_NO_ELEMENTS . '</div>'; ?> </td> </tr> <?php } ?> </table> <input type="hidden" name="option" value="<?php echo $option; ?> " /> <input type="hidden" name="Itemid" value="<?php echo $Itemid; ?> " /> <input type="hidden" name="task" value="add_submit_topic_element" /> <input type="hidden" name="boxchecked" value="0" /> <input type="hidden" name="topic_id" value="<?php echo $topic_id; ?> " /> <input type="hidden" name="id" value="<?php echo $course_id; ?> " /> <?php $is_curtopic = intval(mosgetparam($_REQUEST, 't_id', 0)); echo "<input type='hidden' name='t_id' value='" . $is_curtopic . "' />"; ?> </form> <?php JLMS_TMPL::CloseTS(); JLMS_TMPL::CloseMT(); }