public function __construct($courseId) { $this->courseId = $courseId; $courseCode = ClaroCourse::getCodeFromId($this->courseId); $tbl_mdb_names = claro_sql_get_main_tbl(); $tbl_rel_course_portlet = $tbl_mdb_names['rel_course_portlet']; $sql = "SELECT id, courseId, rank, label, visible\n FROM `{$tbl_rel_course_portlet}`\n WHERE `courseId` = {$this->courseId}\n ORDER BY `rank` ASC"; $result = Claroline::getDatabase()->query($sql); foreach ($result as $portletInfos) { // Require the proper portlet class $portletPath = get_module_path($portletInfos['label']) . '/connector/coursehomepage.cnr.php'; $portletName = $portletInfos['label'] . '_Portlet'; if (file_exists($portletPath)) { require_once $portletPath; } else { echo "Le fichier {$portletPath} est introuvable<br/>"; } if (class_exists($portletName)) { $portlet = new $portletName($portletInfos['id'], $courseCode, $portletInfos['courseId'], $portletInfos['rank'], $portletInfos['label'], $portletInfos['visible']); $this->portlets[] = $portlet; } else { echo "Can't find the class {$portletName}_portlet<br/>"; return false; } } }
public function current() { $portlet = $this->portlets->current(); $portletObj = ''; // Require the proper portlet class $portletPath = get_module_path($portlet['label']) . '/connector/coursehomepage.cnr.php'; $portletName = $portlet['label'] . '_Portlet'; if (file_exists($portletPath)) { require_once $portletPath; } else { throw new Exception("Can\\'t find the file %portletPath", array('%portletPath' => $portletPath)); } if (class_exists($portletName)) { $courseCode = ClaroCourse::getCodeFromId($this->courseId); $portletObj = new $portletName($portlet['id'], $courseCode, $portlet['courseId'], $portlet['rank'], $portlet['label'], $portlet['visible']); return $portletObj; } else { echo get_lang("Can't find the class %portletName_portlet", array('%portletName' => $portletName)); return false; } }
// $Id: index.php 12441 2010-06-11 14:34:16Z abourguignon $ /** * CLAROLINE * * @version 1.10 $Revision: 12441 $ * @copyright (c) 2001-2011, Universite catholique de Louvain (UCL) * @license http://www.gnu.org/copyleft/gpl.html (GPL) GENERAL PUBLIC LICENSE * @package CLHOME * @author Claro Team <*****@*****.**> */ require '../inc/claro_init_global.inc.php'; require_once get_path('incRepositorySys') . '/lib/claroCourse.class.php'; include claro_get_conf_repository() . 'rss.conf.php'; $cid = isset($_REQUEST['cid']) ? $_REQUEST['cid'] : ''; $nameTools = get_lang('Manage session courses'); if (!claro_is_in_a_course() || !claro_is_course_allowed()) { claro_disp_auth_form(true); } $toolRepository = get_path('clarolineRepositoryWeb'); claro_set_display_mode_available(TRUE); if (!empty($cid)) { $course = new ClaroCourse(); $course->load(ClaroCourse::getCodeFromId($cid)); } $sessionCourses = $course->getSessionCourses(); // Display header $template = new CoreTemplate('session_courses.tpl.php'); $template->assign('sessionCourses', $sessionCourses); $template->assign('courseId', $course->id); $claroline->display->body->setContent($template->render()); echo $claroline->display->render();
protected function changeValidation($pendingStatus) { if (!$this->isModifiable()) { throw new Exception("Cannot change user " . $this->privileges->getUserId() . " enrolment validation in course " . $this->privileges->getCourseId()); } $tbl_mdb_names = claro_sql_get_main_tbl(); $updated = Claroline::getDatabase()->exec("\n UPDATE \n `{$tbl_mdb_names['rel_course_user']}` AS rcu\n SET \n isPending = " . $pendingStatus . "\n WHERE \n `rcu`.`user_id` = " . Claroline::getDatabase()->escape($this->privileges->getUserId()) . "\n AND \n `code_cours` = " . Claroline::getDatabase()->quote($this->privileges->getCourseId())); if ($updated) { if ($this->course->sourceCourseId) { $sourceCourseRegistrationValidation = new self(ClaroCourse::getCodeFromId($this->course->sourceCourseId), $this->privileges->getUserId()); $sourceCourseRegistrationValidation->changeValidation($pendingStatus); } return true; } else { return false; } }