/**
  * Returns all the descriptions of a course.
  * @throws InvalidArgumentException if the $cid in not provided.
  * @webservice{/module/MOBILE/GEN/getResourcesList/cidReq}
  * @ws_arg{method,getResourcesList}
  * @ws_arg{cidReq,SYSCODE of requested cours}
  * @return array of Descriptions object
  */
 function getResourcesList($args)
 {
     $module = isset($args['module']) ? $args['module'] : null;
     $cid = claro_get_current_course_id();
     if ($cid == null || $module == null) {
         throw new InvalidArgumentException('Missing cid argument!');
     }
     $list = array();
     FromKernel::uses('core/linker.lib');
     ResourceLinker::init();
     $locator = new ClarolineResourceLocator($cid, $module, null, claro_get_current_group_id());
     if (ResourceLinker::$Navigator->isNavigable($locator)) {
         $resourceList = ResourceLinker::$Navigator->getResourceList($locator);
         foreach ($resourceList as $lnk) {
             $inLocator = $lnk->getLocator();
             $item['title'] = $lnk->getName();
             $item['visibility'] = $lnk->isVisible();
             $item['url'] = str_replace(get_path('url'), "", get_path('rootWeb')) . ResourceLinker::$Resolver->resolve($inLocator);
             if ($inLocator->hasResourceId()) {
                 $item['resourceId'] = $inLocator->getResourceId();
             } else {
                 $item['resourceId'] = $item['url'];
             }
             if (claro_is_allowed_to_edit() || $item['visibility']) {
                 $list[] = $item;
             }
         }
     }
     return $list;
 }
Beispiel #2
0
 public function renderContent()
 {
     // Init linker
     FromKernel::uses('core/linker.lib');
     ResourceLinker::init();
     $output = '';
     $output .= '<dl id="portletAbout">' . "\n";
     $toolIntroIterator = new ToolIntroductionIterator($this->courseCode);
     if (count($toolIntroIterator) > 0) {
         $introList = '';
         foreach ($toolIntroIterator as $introItem) {
             if ($introItem->getVisibility() == 'SHOW') {
                 // Display attached resources (if any)
                 $currentLocator = ResourceLinker::$Navigator->getCurrentLocator(array('id' => $introItem->getId()));
                 $currentLocator->setModuleLabel('CLINTRO');
                 $currentLocator->setResourceId($introItem->getId());
                 $resources = ResourceLinker::renderLinkList($currentLocator);
                 // Prepare the render
                 $introList .= '<dt>' . "\n" . '</dt>' . "\n" . '<dd' . (!$toolIntroIterator->hasNext() ? ' class="last"' : '') . '>' . "\n" . claro_parse_user_text($introItem->getContent()) . "\n" . $resources . (claro_is_allowed_to_edit() ? '<div class="manageTools"><a
                                 href="' . claro_htmlspecialchars(Url::Contextualize(get_module_url('CLTI') . '/index.php?cmd=rqEd&amp;id=' . $introItem->getId())) . '"
                                 title="' . get_lang('Edit this item') . '">
                                 <img src="' . get_icon_url('edit') . '" alt="' . get_lang('Edit') . '" />
                             </a>
                             
                             <a
                                 href="' . claro_htmlspecialchars(Url::Contextualize(get_module_url('CLTI') . '/index.php?cmd=exDel&amp;id=' . $introItem->getId())) . '"
                                 title="' . get_lang('Delete this item') . '">
                                 <img src="' . get_icon_url('delete') . '" alt="' . get_lang('Delete') . '" />
                             </a></div>' : '') . '</dd>' . "\n";
             }
         }
     }
     if (count($toolIntroIterator) == 0 || empty($introList)) {
         $output .= '<dt></dt>' . '<dd>' . "\n" . ' ' . get_lang('No headline') . '. ' . (claro_is_allowed_to_edit() ? '<a href="' . claro_htmlspecialchars(Url::Contextualize(get_module_url('CLTI') . '/index.php?cmd=rqAdd')) . '">' . get_lang('Would you like to add one ?') . '</a>' . "\n" : '') . '</dd>' . "\n";
     } else {
         $output .= $introList;
     }
     $output .= '</dl>';
     return $output;
 }
Beispiel #3
0
 * @version     $Revision: 13945 $
 * @copyright   (c) 2001-2011, Universite catholique de Louvain (UCL)
 * @license     http://www.gnu.org/copyleft/gpl.html (GPL) GENERAL PUBLIC LICENSE
 * @author      see 'credits' file
 * @package     ADMIN
 * @since       1.9
 */
require '../inc/claro_init_global.inc.php';
// Security check
if (!claro_is_user_authenticated()) {
    claro_disp_auth_form();
}
if (!claro_is_platform_admin()) {
    claro_die(get_lang('Not allowed'));
}
FromKernel::uses('utils/input.lib', 'utils/validator.lib', 'display/dialogBox.lib', 'admin/mergeuser.lib', 'user.lib');
try {
    $dialogBox = new DialogBox();
    $userInput = Claro_UserInput::getInstance();
    $userInput->setValidator('cmd', new Claro_Validator_AllowedList(array('rqMerge', 'chkMerge', 'exMerge')));
    $cmd = $userInput->get('cmd', 'rqMerge');
    if ($cmd == 'rqMerge') {
        $dialogBox->warning(get_lang('Merging user accounts is not a reversible operation so be careful !'));
        $form = '<form action="' . $_SERVER['PHP_SELF'] . '?cmd=chkMerge" method="post">' . "\n" . '<input type="hidden" name="claroFormId" value="' . uniqid('') . '" />' . "\n" . '<fieldset>' . '<legend>' . get_lang('Accounts to merge') . '</legend>' . '<label for="uidToRemove">' . get_lang('Id of the user to remove') . ' : </label><input type="text" name="uidToRemove" id="uidToRemove" value="" /><br />' . "\n" . '<label for="uidToKeep">' . get_lang('Id of the user to keep') . ' : </label><input type="text" name="uidToKeep" id="uidToKeep" value="" /><br />' . "\n" . '</fieldset>' . '<br />' . '<input type="submit" name="merge" value="' . get_lang('Merge') . '" />' . "\n" . '</form>';
        $dialogBox->form($form);
    }
    if ($cmd == 'chkMerge') {
        $uidToKeep = $userInput->getMandatory('uidToKeep');
        $uidToRemove = $userInput->getMandatory('uidToRemove');
        if ($uidToKeep == $uidToRemove) {
            throw new Exception(get_lang('Cannot merge one user account with itself'));
Beispiel #4
0
/*
 * Permissions
 */
if (!get_conf('is_trackingEnabled')) {
    claro_die(get_lang('Tracking has been disabled by system administrator.'));
}
if (!claro_is_user_authenticated()) {
    claro_disp_auth_form();
}
if (!claro_is_platform_admin()) {
    claro_die(get_lang('Not allowed'));
}
/*
 * Libraries
 */
FromKernel::uses('user.lib', 'courselist.lib');
// todo move this lib in tracking/lib
require_once get_path('incRepositorySys') . '/lib/statsUtils.lib.inc.php';
/*
 * DB tables definition
 */
$tbl_mdb_names = claro_sql_get_main_tbl();
$tbl_course = $tbl_mdb_names['course'];
$tbl_rel_course_user = $tbl_mdb_names['rel_course_user'];
$tbl_user = $tbl_mdb_names['user'];
$tbl_tracking_event = $tbl_mdb_names['tracking_event'];
/*
 * Output
 */
CssLoader::getInstance()->load('tracking', 'screen');
ClaroBreadCrumbs::getInstance()->prepend(get_lang('Administration'), get_path('rootAdminWeb'));
Beispiel #5
0
<?php

// $Id: export.lib.php 14410 2013-03-14 08:31:45Z zefredz $
/**
 * CLAROLINE
 *
 * @version     $Revision: 14410 $
 * @license     http://www.gnu.org/copyleft/gpl.html (GPL) GENERAL PUBLIC LICENSE
 * @author      Claroline team <*****@*****.**>
 * @package     CLUSR
 */
FromKernel::uses('csv.class', 'class.lib', 'user_info.lib');
class UserInfoList
{
    private $courseId;
    public function __construct($courseId)
    {
        $this->courseId = $courseId;
    }
    public function getUserInfoLabels()
    {
        $labels = claro_user_info_claro_user_info_get_cat_def_list($this->courseId);
        if ($labels) {
            $ret = array();
            foreach ($labels as $label) {
                $ret[$label['catId']] = $label['title'];
            }
            return $ret;
        } else {
            return array();
        }
Beispiel #6
0
<?php

// $Id: linker.cnr.php 14356 2013-01-24 12:26:38Z zefredz $
// vim: expandtab sw=4 ts=4 sts=4:
/**
 * CLAROLINE
 *
 * Resource Resolver for the Calendar tool
 *
 * @version     $Revision: 14356 $
 * @copyright   (c) 2001-2011, Universite catholique de Louvain (UCL)
 * @license     http://www.gnu.org/copyleft/gpl.html (GPL) GENERAL PUBLIC LICENSE
 * @author      Claroline Team <*****@*****.**>
 * @package     CLCAL
 */
FromKernel::uses('fileManage.lib', 'file.lib');
class CLCAL_Resolver implements ModuleResourceResolver
{
    public function resolve(ResourceLocator $locator)
    {
        if ($locator->hasResourceId()) {
            return get_module_entry_url('CLCAL') . "#item{$locator->getResourceId()}";
        } else {
            return get_module_entry_url('CLCAL');
        }
    }
    public function getResourceName(ResourceLocator $locator)
    {
        if (!$locator->hasResourceId()) {
            return false;
        }
Beispiel #7
0
// vim: expandtab sw=4 ts=4 sts=4:
/**
 * CLAROLINE
 *
 * PHP-based templating system.
 *
 * @version     $Revision: 14332 $
 * @copyright   (c) 2001-2011, Universite catholique de Louvain (UCL)
 * @author      Claroline Team <*****@*****.**>
 * @author      Frederic Minne <*****@*****.**>
 * @license     http://www.gnu.org/copyleft/gpl.html
 *              GNU GENERAL PUBLIC LICENSE version 2 or later
 * @package     display
 */
// load helpers and output buffering libs
FromKernel::uses('core/helpers.lib', 'display/ob.lib');
/**
 * Simple PHP-based template class
 */
class PhpTemplate implements Display
{
    protected $_templatePath;
    /**
     * Constructor
     * @param   string $templatePath path to the php template file
     */
    public function __construct($templatePath)
    {
        $this->_templatePath = $templatePath;
    }
    /**
Beispiel #8
0
 * @author      Claroline team <*****@*****.**>
 */
// reset course and groupe
$cidReset = true;
$gidReset = true;
$uidRequired = true;
// load Claroline kernel
require_once dirname(__FILE__) . '/../../claroline/inc/claro_init_global.inc.php';
if (!claro_is_user_authenticated()) {
    claro_disp_auth_form();
}
// load libraries
FromKernel::uses('user.lib', 'utils/finder.lib');
require_once dirname(__FILE__) . '/lib/portlet.lib.php';
// Breadcrumb
FromKernel::uses('display/userprofilebox.lib');
ClaroBreadCrumbs::getInstance()->append(get_lang('My desktop'), get_path('clarolineRepositoryWeb') . 'desktop/index.php');
$dialogBox = new DialogBox();
define('KERNEL_PORTLETS_PATH', dirname(__FILE__) . '/lib/portlet');
// Load and register (if needed) portlets
try {
    $portletList = new PortletList();
    $fileFinder = new Claro_FileFinder_Extension(KERNEL_PORTLETS_PATH, '.class.php', false);
    foreach ($fileFinder as $file) {
        // Require portlet file
        require_once $file->getPathname();
        // Compute portlet class name from file name
        $pos = strpos($file->getFilename(), '.');
        $className = substr($file->getFilename(), '0', $pos);
        // Load portlet from database
        $portletInDB = $portletList->loadPortlet($className);
Beispiel #9
0
<?php

// $Id: header.lib.php 14453 2013-05-16 08:15:37Z zefredz $
// vim: expandtab sw=4 ts=4 sts=4:
/**
 * Class used to configure and display the page header.
 *
 * @version     $Revision: 14453 $
 * @copyright   (c) 2001-2011, Universite catholique de Louvain (UCL)
 * @author      Claroline Team <*****@*****.**>
 * @author      Frederic Minne <*****@*****.**>
 * @license     http://www.gnu.org/copyleft/gpl.html
 *              GNU GENERAL PUBLIC LICENSE version 2 or later
 * @package     display
 */
FromKernel::uses('core/loader.lib');
class ClaroHeader extends CoreTemplate
{
    private static $instance = false;
    private $_htmlXtraHeaders;
    private $_httpXtraHeaders;
    private $_toolName;
    /**
     * Constructor
     */
    public function __construct()
    {
        parent::__construct('header.tpl.php');
        $this->_htmlXtraHeaders = array();
        $this->_httpXtraHeaders = array();
        $this->_toolName = '';
 /**
  * Returns a single resquested topic.
  * @param array $args must contain 'resID' key with the resource identifier of the requested resource
  * @throws InvalidArgumentException if one of the paramaters is missing
  * @webservice{/module/MOBILE/CLANN/getSingleResource/cidReq/resId}
  * @ws_arg{Method,getSingleResource}
  * @ws_arg{cidReq,SYSCODE of requested cours}
  * @ws_arg{resID,Resource Id of requested resource}
  * @return announce object (can be null if not visible for the current user)
  */
 function getSingleResource($args)
 {
     $resourceId = isset($args['resID']) ? $args['resID'] : null;
     $cid = claro_get_current_course_id();
     if ($cid == null || $resourceId == null) {
         throw new InvalidArgumentException('Missing cid or resourceId argument!');
     }
     FromKernel::uses('forum.lib');
     $claroNotification = Claroline::getInstance()->notification;
     $date = $claroNotification->getLastActionBeforeLoginDate(claro_get_current_user_id());
     $d = new DateTime($date);
     $d->sub(new DateInterval('PT1M'));
     $item = null;
     foreach (get_forum_list() as $forum) {
         if ($forum['forum_id'] == $resourceID) {
             $item = $forum;
             break;
         }
     }
     if ($item) {
         $item['resourceId'] = $item['forum_id'];
         $item['title'] = $item['forum_name'];
         foreach (get_category_list as $cat) {
             if ($cat['cat_id'] == $item['cat_id']) {
                 $item['cat_title'] = $cat['cat_title'];
                 $item['cat_order'] = $cat['cat_order'];
                 break;
             }
         }
         $item['topics'] = array();
         $topics = new topicLister($item['forum_id'], 0, $item['forum_topics']);
         foreach ($topics->get_topic_list() as $topic) {
             $topic['resourceId'] = $topic['topic_id'];
             $topic['title'] = $topic['topic_title'];
             $topic['poster_firstname'] = $topic['prenom'];
             $topic['poster_lastname'] = $topic['nom'];
             $topic['date'] = $topic['topic_time'];
             $topic['posts'] = array();
             $posts = new postLister($topic['topic_id'], 0, $topic['topic_replies'] + 1);
             foreach ($posts->get_post_list() as $post) {
                 $notified = $claroNotification->isANotifiedRessource($cid, $date, claro_get_current_user_id(), claro_get_current_group_id(), get_tool_id_from_module_label('CLFRM'), $item['forum_id'] . '-' . $topic['topic_id'] . '-' . $post['post_id'], false);
                 $post['notifiedDate'] = $notified ? $date : $post['post_time'];
                 $post['seenDate'] = $d->format('Y-m-d H:i');
                 $post['post_text'] = trim(strip_tags($post['post_text']));
                 $post['resourceId'] = $post['post_id'];
                 $post['date'] = $post['post_time'];
                 unset($post['post_id']);
                 unset($post['topic_id']);
                 unset($post['forum_id']);
                 unset($post['poster_id']);
                 unset($post['post_time']);
                 unset($post['poster_ip']);
                 $topic['posts'][] = $post;
             }
             unset($topic['topic_id']);
             unset($topic['topic_title']);
             unset($topic['topic_poster']);
             unset($topic['topic_time']);
             unset($topic['topic_replies']);
             unset($topic['topic_last_post_id']);
             unset($topic['forum_id']);
             unset($topic['topic_notify']);
             unset($topic['nom']);
             unset($topic['prenom']);
             unset($topic['post_time']);
             $item['topics'][] = $topic;
         }
         unset($item['forum_id']);
         unset($item['forum_name']);
         unset($item['forum_moderator']);
         unset($item['forum_topics']);
         unset($item['forum_posts']);
         unset($item['forum_last_post_id']);
         unset($item['forum_type']);
         unset($item['group_id']);
         unset($item['poster_id']);
         unset($item['post_time']);
         return $item;
     } else {
         throw new RuntimeException('Resource not found', 404);
     }
 }
Beispiel #11
0
 * @author      Guillaume Lederer <*****@*****.**>
 */
$cidReset = true;
$gidReset = true;
$tidReset = true;
require '../inc/claro_init_global.inc.php';
$userPerPage = get_conf('userPerPage', 20);
// numbers of user to display on the same page
// Security check
if (!claro_is_user_authenticated()) {
    claro_disp_auth_form();
}
if (!claro_is_platform_admin()) {
    claro_die(get_lang('Not allowed'));
}
FromKernel::Uses('admin.lib.inc', 'pager.lib', 'user.lib', 'password.lib', 'class.lib');
include claro_get_conf_repository() . 'course_main.conf.php';
// CHECK INCOMING DATAS
if (isset($_REQUEST['cidToEdit']) && $_REQUEST['cidToEdit'] == '') {
    unset($_REQUEST['cidToEdit']);
}
$validCmdList = array('rqDelete', 'exDelete', 'rqResetAllPasswords', 'exResetAllPasswords');
$cmd = isset($_REQUEST['cmd']) && in_array($_REQUEST['cmd'], $validCmdList) ? $_REQUEST['cmd'] : null;
$userIdReq = (int) (isset($_REQUEST['user_id']) ? $_REQUEST['user_id'] : null);
// USED SESSION VARIABLES
// clean session if needed
if (isset($_REQUEST['newsearch']) && $_REQUEST['newsearch'] == 'yes') {
    unset($_SESSION['admin_user_search']);
    unset($_SESSION['admin_user_firstName']);
    unset($_SESSION['admin_user_lastName']);
    unset($_SESSION['admin_user_userName']);
Beispiel #12
0
 * @package     CLTRACK
 */
/*
 * Kernel
 */
require_once dirname(__FILE__) . '/../../claroline/inc/claro_init_global.inc.php';
/*
 * Usual check
 */
if (!get_conf('is_trackingEnabled')) {
    claro_die(get_lang('Tracking has been disabled by system administrator.'));
}
/*
 * Libraries
 */
FromKernel::uses('user.lib', 'courselist.lib', 'display/userprofilebox.lib');
require_once dirname(__FILE__) . '/lib/trackingRenderer.class.php';
require_once dirname(__FILE__) . '/lib/trackingRendererRegistry.class.php';
/*
 * Init request vars
 */
if (isset($_REQUEST['userId']) && is_numeric($_REQUEST['userId'])) {
    $userId = (int) $_REQUEST['userId'];
} elseif (isset($_REQUEST['uInfo']) && is_numeric($_REQUEST['uInfo'])) {
    $userId = (int) $_REQUEST['uInfo'];
} else {
    $userId = null;
}
if (isset($_REQUEST['courseId']) && !empty($_REQUEST['courseId'])) {
    $courseId = $_REQUEST['courseId'];
} else {
Beispiel #13
0
// $Id: banner.lib.php 13812 2011-11-14 14:30:24Z jrm_ $
// vim: expandtab sw=4 ts=4 sts=4:
/**
 * CLAROLINE
 *
 * Class used to configure and display the page banners.
 *
 * @version     $Revision: 13812 $
 * @copyright   (c) 2001-2011, Universite catholique de Louvain (UCL)
 * @author      Claroline Team <*****@*****.**>
 * @author      Frederic Minne <*****@*****.**>
 * @license     http://www.gnu.org/copyleft/gpl.html
 *              GNU GENERAL PUBLIC LICENSE version 2 or later
 * @package     display
 */
FromKernel::uses('display/breadcrumbs.lib', 'display/viewmode.lib');
class ClaroBanner extends CoreTemplate
{
    protected static $instance = false;
    protected $hidden = false;
    public $breadcrumbs;
    public $viewmode;
    public function __construct()
    {
        $this->breadcrumbs = ClaroBreadCrumbs::getInstance();
        $this->viewmode = ClaroViewMode::getInstance();
        parent::__construct('banner.tpl.php');
        $this->breadcrumbLine = true;
    }
    public static function getInstance()
    {
Beispiel #14
0
// $Id: input.lib.php 14130 2012-04-27 12:38:56Z zefredz $
// vim: expandtab sw=4 ts=4 sts=4:
/**
 * User input library
 * Replacement for $_GET and $_POST
 * Do not handle $_COOKIES !
 *
 * @version     1.11 $Revision: 14130 $
 * @copyright   (c) 2001-2012, Universite catholique de Louvain (UCL)
 * @author      Claroline Team <*****@*****.**>
 * @author      Frederic Minne <*****@*****.**>
 * @license     http://www.gnu.org/copyleft/gpl.html
 *              GNU GENERAL PUBLIC LICENSE version 2 or later
 * @package     utils
 */
FromKernel::uses('utils/validator.lib');
/**
 * Data Input Exception, thrown when an input value does not match
 * a filter or is missing
 */
class Claro_Input_Exception extends Exception
{
}
/**
 * Defines the required methods for a data input object
 */
interface Claro_Input
{
    /**
     * Get a value given its name.
     * @param   string $name variable name
Beispiel #15
0
// $Id: displaymessage.lib.php 14314 2012-11-07 09:09:19Z zefredz $
// vim: expandtab sw=4 ts=4 sts=4:
/**
 * class to display messages
 *
 * @version     1.9 $Revision: 14314 $
 * @copyright   (c) 2001-2011, Universite catholique de Louvain (UCL)
 * @author      Claroline Team <*****@*****.**>
 * @author      Christophe Mertens <*****@*****.**>
 * @license     http://www.gnu.org/copyleft/gpl.html
 *              GNU GENERAL PUBLIC LICENSE version 2 or later
 * @package     internal_messaging
 */
require_once dirname(__FILE__) . '/permission.lib.php';
FromKernel::uses('utils/htmlsanitizer.lib');
class DisplayMessage
{
    /**
     * display the message
     *
     * @param Message $message Message to display
     * @param string $action list of action autorised on the message
     * @return string HTML source
     */
    public static function display($message, $action)
    {
        if ($message instanceof SentMessage) {
            return self::displaySentMessage($message, $action);
        } elseif ($message instanceof ReceivedMessage) {
            return self::displayReceivedMessage($message, $action);
Beispiel #16
0
if (count(get_included_files()) == 1) {
    die('---');
}
/**
 * CLAROLINE
 *
 * User desktop : course list portlet.
 *
 * @version     $Revision: 14314 $
 * @copyright   (c) 2001-2011, Universite catholique de Louvain (UCL)
 * @license     http://www.gnu.org/copyleft/gpl.html (GPL) GENERAL PUBLIC LICENSE
 * @package     DESKTOP
 * @author      Claroline Team <*****@*****.**>
 * @fixme       should not be a portlet anymore
 */
FromKernel::uses('courselist.lib');
// we need CLHOME conf file for render_user_course_list function
include claro_get_conf_repository() . 'CLHOME.conf.php';
// conf file
class MyCourseList extends UserDesktopPortlet
{
    public function __construct()
    {
        $this->name = 'My course list';
        $this->label = 'mycourselist';
    }
    public function renderContent()
    {
        global $platformLanguage;
        $out = '';
        // Last user action
Beispiel #17
0
*/
// reset course and groupe
$cidReset = true;
$gidReset = true;
$uidRequired = true;
// load Claroline kernel
require_once dirname(__FILE__) . '/../../claroline/inc/claro_init_global.inc.php';
// users authentified
if (!claro_is_user_authenticated()) {
    claro_disp_auth_form();
}
if (!claro_is_platform_admin()) {
    claro_die(get_lang('Not allowed'));
}
require_once dirname(__FILE__) . '/lib/portlet.lib.php';
FromKernel::uses('utils/input.lib', 'utils/validator.lib');
$dialogBox = new DialogBox();
// Get user input data
$userInput = Claro_UserInput::getInstance();
$acceptedCmdList = array('exDown', 'exUp', 'exVisible', 'exInvisible');
$userInput->setValidator('cmd', new Claro_Validator_AllowedList($acceptedCmdList));
$cmd = $userInput->get('cmd', null);
$label = $userInput->get('label', null);
// Execute commands
$portletList = new PortletList();
if ($cmd == 'exUp') {
    $portletList->moveUp($label);
}
if ($cmd == 'exDown') {
    $portletList->moveDown($label);
}
Beispiel #18
0
 * @license     http://www.gnu.org/copyleft/gpl.html GNU GENERAL PUBLIC LICENSE
 *              version 2 or later
 * @package     ADMIN
 * @author      Claro Team <*****@*****.**>
 */
$cidReset = true;
$gidReset = true;
require '../../inc/claro_init_global.inc.php';
//SECURITY CHECK
if (!claro_is_user_authenticated()) {
    claro_disp_auth_form();
}
if (!claro_is_platform_admin()) {
    claro_die(get_lang('Not allowed'));
}
FromKernel::uses('display/dialogBox.lib', 'pager.lib', 'sqlxtra.lib', 'fileManage.lib', 'fileUpload.lib', 'file.lib', 'html.lib', 'module/manage.lib', 'backlog.class');
//OLD TOOLS ;
$old_tool_array = array('CLANN', 'CLCAL', 'CLFRM', 'CLCHT', 'CLDOC', 'CLDSC', 'CLUSR', 'CLLNP', 'CLQWZ', 'CLWRK', 'CLWIKI', 'CLLNK', 'CLGRP');
//UNDEACTIVABLE    TOOLS array
$undeactivable_tool_array = get_not_deactivable_tool_list();
//NONUNINSTALABLE TOOLS array
$nonuninstalable_tool_array = get_not_uninstallable_tool_list();
//SQL table name
$tbl_name = claro_sql_get_main_tbl();
$tbl_module = $tbl_name['module'];
$tbl_dock = $tbl_name['dock'];
$tbl_course_tool = $tbl_name['tool'];
ClaroBreadCrumbs::getInstance()->prepend(get_lang('Administration'), get_path('rootAdminWeb'));
$dialogBox = new DialogBox();
$nameTools = get_lang('Modules');
// Javascript confirm pop up declaration for header
Beispiel #19
0
 *
 * @version     1.9 $Revision: 12923 $
 * @copyright   (c) 2001-2011, Universite catholique de Louvain (UCL)
 * @license     http://www.gnu.org/copyleft/gpl.html (GPL) GENERAL PUBLIC LICENSE
 * @package     CLICAL
 * @author      Claro Team <*****@*****.**>
 */
/**
 * This lib use
 * * cache lite
 * * icalendar/class.iCal.inc.php
 *
 */
require_once claro_get_conf_repository() . 'rss.conf.php';
require_once claro_get_conf_repository() . 'ical.conf.php';
FromKernel::uses('thirdparty/icalendar/class.iCal.inc');
/**
 * return the mime type for a requested format
 *
 * @param fortma $calType : ics,xcs,rdf
 * @return string mimetype
 */
function get_ical_MimeType($calType)
{
    switch ($calType) {
        case 'ics':
            return 'text/Calendar';
        case 'xcs':
            return 'text/Calendar';
        case 'rdf':
            return 'text/xml';
Beispiel #20
0
<?php

// $Id: datagrid.lib.php 14314 2012-11-07 09:09:19Z zefredz $
// vim: expandtab sw=4 ts=4 sts=4:
/**
 * Datagrid library
 *
 * @version     1.9 $Revision: 14314 $
 * @copyright   (c) 2001-2011, Universite catholique de Louvain (UCL)
 * @author      Claroline Team <*****@*****.**>
 * @author      Frederic Minne <*****@*****.**>
 * @license     http://www.gnu.org/copyleft/gpl.html
 *              GNU GENERAL PUBLIC LICENSE version 2 or later
 * @package     utils
 */
FromKernel::uses('utils/html.lib');
class Claro_Utils_Datagrid extends Claro_Html_Element
{
    protected $lineNumber = 0;
    protected $lineCount = 0;
    protected $columnsLabels = array();
    protected $columnsValues = array();
    protected $columnsOrder = array();
    protected $rows = array();
    protected $title = '';
    protected $footer = '';
    protected $emptyMessage = '';
    /**
     * @param   array $attributes attributes of the table element
     */
    public function __construct($attributes = null)
Beispiel #21
0
/**
 *  CLAROLINE MAIN SETTINGS
 */
$tlabelReq = 'CLANN';
$gidReset = true;
require '../inc/claro_init_global.inc.php';
if (!claro_is_in_a_course() || !claro_is_course_allowed()) {
    claro_disp_auth_form(true);
}
$context = claro_get_current_context(CLARO_CONTEXT_COURSE);
// Local lib
require_once './lib/announcement.lib.php';
// get some shared lib
require_once get_path('incRepositorySys') . '/lib/sendmail.lib.php';
// require_once get_path('clarolineRepositorySys') . '/linker/linker.inc.php';
FromKernel::uses('core/linker.lib');
ResourceLinker::init();
// Get specific conf file
require claro_get_conf_repository() . 'ical.conf.php';
require claro_get_conf_repository() . 'rss.conf.php';
claro_set_display_mode_available(true);
// Set flag following depending on settings
$is_allowedToEdit = claro_is_allowed_to_edit();
$courseId = claro_get_current_course_id();
$userLastLogin = claro_get_current_user_data('lastLogin');
// DB tables definition
$tbl_cdb_names = claro_sql_get_main_tbl();
$tbl_course_user = $tbl_cdb_names['rel_course_user'];
$tbl_user = $tbl_cdb_names['user'];
// Default display
$displayForm = false;
Beispiel #22
0
 * The function of this script is providing a way to retrieve the user
 * parameter from another server on the internet on the base of this
 * cookie value.
 *
 * @package SSO
 *
 * @author Claro Team cvs@claroline.net
 *
 */
/******************************************************************************
                                SOAP SERVER INIT
 ******************************************************************************/
// PHP 5 Compat :
$HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : file_get_contents("php://input");
require_once dirname(__FILE__) . '/../../inc/claro_init_global.inc.php';
FromKernel::uses('thirdparty/nusoap/nusoap.lib');
$server = new soap_server();
$server->register('get_user_info_from_cookie', array('auth' => 'xsd:string', 'cookie' => 'xsd:string', 'cid' => 'xsd:string', 'gid' => 'xsd:string'));
$server->service($HTTP_RAW_POST_DATA);
/*----------------------------------------------------------------------------
                            SSO FUNCTION DEFINITION
  ----------------------------------------------------------------------------*/
/**
 * get user parameter on the base of a cookie value
 *
 * @author Hugues Peeters <*****@*****.**>
 * @param string $auth
 * @param string $cookie
 * @param string $cid
 * @param int    $gid
 * @return array   user parameters if it suceeds
Beispiel #23
0
/**
 * CLAROLINE
 *
 * Claroline Resource Linker ajax backend
 *
 * @version     $Revision: 13348 $
 * @copyright   (c) 2001-2011, Universite catholique de Louvain (UCL)
 * @author      Claroline Team <*****@*****.**>
 * @author      Frederic Minne <*****@*****.**>
 * @license     http://www.gnu.org/copyleft/gpl.html
 *              GNU GENERAL PUBLIC LICENSE version 2 or later
 * @package     core.linker
 */
try {
    require_once dirname(__FILE__) . '/../inc/claro_init_global.inc.php';
    FromKernel::uses('core/linker.lib', 'utils/ajax.lib', 'utils/input.lib');
    ResourceLinker::init();
    $userInput = Claro_UserInput::getInstance();
    $userInput->setValidator('cmd', new Claro_Validator_AllowedList(array('getLinkList', 'getResourceList', 'resolveLocator')));
    $cmd = $userInput->get('cmd', 'getResourceList');
    $locator = isset($_REQUEST['crl']) && !empty($_REQUEST['crl']) ? ClarolineResourceLocator::parse(rawurldecode($_REQUEST['crl'])) : ResourceLinker::$Navigator->getCurrentLocator(array());
    if ('getLinkList' == $cmd) {
        $linkListIt = ResourceLinker::getLinkList($locator);
        // FIXME : use getResourceName instead of the title recorded in database !
        if (empty($linkListIt)) {
            $linkList = array();
        } else {
            $linkList = array();
            // $linkList = iterator_to_array( $linkListIt );
            foreach ($linkListIt as $link) {
                $linkList[] = array('crl' => $link['crl'], 'name' => ResourceLinker::$Resolver->getResourceName(ClarolineResourceLocator::parse($link['crl'])));
Beispiel #24
0
<?php

// $Id: userprofilebox.lib.php 14448 2013-05-15 08:47:35Z zefredz $
// vim: expandtab sw=4 ts=4 sts=4:
FromKernel::uses('user.lib');
/**
 * CLAROLINE
 *
 * User account summary.
 *
 * @version     $Revision: 14448 $
 * @copyright   (c) 2001-2011, Universite catholique de Louvain (UCL)
 * @license     http://www.gnu.org/copyleft/gpl.html (GPL) GENERAL PUBLIC LICENSE
 * @author      Claroline team <*****@*****.**>
 * @package     DESKTOP
 */
class UserProfileBox implements Display
{
    protected $condensedMode;
    protected $userId;
    public function __construct($condensedMode = false)
    {
        $this->condensedMode = $condensedMode;
        $this->userId = claro_get_current_user_id();
    }
    public function setUserId($userId)
    {
        $this->userId = (int) $userId;
    }
    /**
     * Render content
Beispiel #25
0
// $Id: image.lib.php 14314 2012-11-07 09:09:19Z zefredz $
// vim: expandtab sw=4 ts=4 sts=4:
if (count(get_included_files()) == 1) {
    die('The file ' . basename(__FILE__) . ' cannot be accessed directly, use include instead');
}
/**
 * Image manipulation library
 *
 * @version     1.9 $Revision: 14314 $
 * @copyright   (c) 2001-2011, Universite catholique de Louvain (UCL)
 * @author      Claroline team <*****@*****.**>
 * @license     http://www.gnu.org/copyleft/gpl.html
 *              GNU GENERAL PUBLIC LICENSE
 * @package     KERNEL
 */
FromKernel::uses('core/url.lib');
/*============================================================================
                        IMAGE MANIPULATION LIBRARY
  ============================================================================*/
/**
* @private allowedImageTypes
*/
// allowed image extensions
$allowedImageTypes = 'jpg|png|gif|jpeg|bmp';
/**
* cut string allowing word integrity preservation
*
* TODO : move to a more accurate library
*
 * @copyright   (c) 2001-2011, Universite catholique de Louvain (UCL)
* @param  string (string) string
Beispiel #26
0
 protected static function initDriverList()
 {
     // load static drivers
     self::$drivers = array('claroline' => new ClarolineLocalAuthDriver(), 'disabled' => new UserDisabledAuthDriver(), 'temp' => new TemporaryAccountAuthDriver(), 'CAS' => new ClarolineLocalAuthDriver());
     self::$driversAllowingLostPassword = array('claroline' => 'claroline', 'clarocrypt' => 'clarocrypt');
     // load dynamic drivers
     if (!file_exists(get_path('rootSys') . 'platform/conf/extauth')) {
         FromKernel::uses('fileManage.lib');
         claro_mkdir(get_path('rootSys') . 'platform/conf/extauth', CLARO_FILE_PERMISSIONS, true);
     }
     if (get_conf('claro_authDriversAutoDiscovery', true)) {
         $driversToLoad = array();
         $it = new DirectoryIterator(get_path('rootSys') . 'platform/conf/extauth');
         foreach ($it as $file) {
             if ($file->isFile() && substr($file->getFilename(), -9) == '.conf.php') {
                 $driversToLoad[] = $file->getPathname();
             }
         }
         sort($driversToLoad);
         foreach ($driversToLoad as $driverFile) {
             self::loadDriver($driverFile);
         }
     } else {
         if (file_exists(get_path('rootSys') . 'platform/conf/extauth/drivers.list')) {
             $authDriverList = file(get_path('rootSys') . 'platform/conf/extauth/drivers.list');
             foreach ($authDriverList as $authDriver) {
                 $authDriver = trim($authDriver);
                 if (!empty($authDriver)) {
                     self::loadDriver(ltrim(rtrim(get_path('rootSys') . 'platform/conf/extauth/' . $authDriver)));
                 }
             }
         }
     }
 }
Beispiel #27
0
<?php

// $Id: notifier.lib.php 13498 2011-09-01 11:19:18Z zefredz $
// vim: expandtab sw=4 ts=4 sts=4:
/**
 * Notifier class
 *
 * @version     1.9 $Revision: 13498 $
 * @copyright   (c) 2001-2011, Universite catholique de Louvain (UCL)
 * @author      Claroline Team <*****@*****.**>
 * @author      Christophe Mertens <*****@*****.**>
 * @license     http://www.gnu.org/copyleft/gpl.html
 *              GNU GENERAL PUBLIC LICENSE version 2 or later
 * @package     internal_messaging
 */
FromKernel::uses('utils/finder.lib.php');
class MessagingUserNotifier
{
    /**
     * call all gateway notification
     *
     * @param int $uidList
     * @param messageToSend $message
     * @param int $messageId
     */
    public static function notify($uidList, $message, $messageId)
    {
        // list all file in ./notifier/
        $notifierFile = new Claro_FileFinder_Extension(dirname(__FILE__) . '/notifier/', '.notifier.lib.php', false);
        $classNotLoad = '';
        foreach ($notifierFile as $file) {
Beispiel #28
0
<?php

// $Id: csv.class.php 14406 2013-02-25 07:27:37Z zefredz $
FromKernel::uses('csvexporter.class');
/**
 * CLAROLINE
 *
 * CSV class.
 *
 * This class will be correctly implemented soon, within CsvExporter and
 * CsvImporter classes.
 * Meanwhile, it will just act as a patch solution.
 *
 * @version     Claroline 1.11 $Revision: 14406 $
 * @copyright   (c) 2001-2013, Universite catholique de Louvain (UCL)
 * @license     http://www.gnu.org/copyleft/gpl.html (GPL) GENERAL PUBLIC LICENSE
 * @package     KERNEL
 * @author      Claro Team <*****@*****.**>
 */
class CsvRecordlistExporter
{
    public $recordList = array();
    private $csvExporter;
    public function __construct($delimiter = ',', $quote = '"')
    {
        $this->csvExporter = new CsvExporter($delimiter, $quote);
    }
    /**
     * Export internal record list to csv
     * @return string
     */
Beispiel #29
0
         // Extracting the user data
         $is_platformAdmin = $currentUser->isPlatformAdmin;
         $is_allowedCreateCourse = get_conf('courseCreationAllowed', true) && $currentUser->isCourseCreator || $is_platformAdmin;
         $currentUser->saveToSession();
         if ($currentUser->firstLogin()) {
             // first login for a not self registred (e.g. registered by a teacher)
             // do nothing (code may be added later)
             $currentUser->updateCreatorId();
             $_SESSION['firstLogin'] = true;
         } else {
             $_SESSION['firstLogin'] = false;
         }
         // RECORD SSO COOKIE
         // $ssoEnabled set in conf/auth.sso.conf.php
         if (get_conf('ssoEnabled', false)) {
             FromKernel::uses('sso/cookie.lib');
             $boolCookie = SingleSignOnCookie::setForUser($currentUser->userId);
         }
         // end if ssoEnabled
     } else {
         $currentUser = Claro_CurrentUser::getInstance($_uid);
         try {
             $currentUser->loadFromSession();
             $_user = $currentUser->getRawData();
         } catch (Exception $e) {
             $_user = null;
         }
     }
 } catch (Exception $e) {
     exit('WARNING !! Undefined user id: the requested user doesn\'t exist ' . 'at line ' . __LINE__);
 }
 /**
  * Returns the tool list for each cours of the user.
  * @throws InvalidArgumentException if the cid in not provided.
  * @webservice{/module/MOBILE/User/getCoursToolList/cidReq}
  * @ws_arg{method,getCoursToolList}
  * @ws_arg{cidReq,SYSCODE of requested cours}
  * @return array of course object with only the syscode and tool-related fields filled.
  */
 function getToolList()
 {
     $cid = claro_get_current_course_id();
     if ($cid == null) {
         throw new InvalidArgumentException('Missing cid argument!');
     }
     FromKernel::uses('courselist.lib');
     $tools = array();
     foreach (claro_get_course_tool_list($cid, claro_get_current_user_profile_id_in_course($cid)) as $tool) {
         if (isset($tool['label']) && $tool['installed'] && $tool['activated'] && ($tool['visibility'] || claro_is_allowed_to_edit())) {
             unset($tool['id']);
             unset($tool['tool_id']);
             unset($tool['external_name']);
             unset($tool['external']);
             unset($tool['icon']);
             unset($tool['activation']);
             unset($tool['url']);
             unset($tool['activated']);
             unset($tool['installed']);
             $tool['name'] = get_lang($tool['name']);
             $tool['visibility'] = $tool['visibility'] == true;
             // Force the boolean representation in JSON
             $tools[] = $tool;
         }
     }
     return $tools;
 }