/** * Returns a single resquested announce. * @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!'); } $claroNotification = Claroline::getInstance()->notification; $date = $claroNotification->getLastActionBeforeLoginDate(claro_get_current_user_id()); $d = new DateTime($date); $d->sub(new DateInterval('PT1M')); From::Module('CLANN')->uses('announcement.lib'); if ($announce = $this->announcement_get_item($resourceId, $cid)) { $notified = $claroNotification->isANotifiedRessource($cid, $date, claro_get_current_user_id(), claro_get_current_group_id(), get_tool_id_from_module_label('CLANN'), $announce['id'], false); $announce['visibility'] = $announce['visibility'] != 'HIDE'; $announce['content'] = trim(strip_tags($announce['content'])); $announce['cours']['sysCode'] = $cid; $announce['resourceId'] = $announce['id']; $announce['date'] = $announce['time']; $announce['notifiedDate'] = $notified ? $date : $announce['time']; $announce['seenDate'] = $d->format('Y-m-d H:i'); unset($announce['id']); return claro_is_allowed_to_edit() || $announce['visibility'] ? $announce : null; } else { throw new RuntimeException('Resource not found', 404); } }
/** * Returns a single resquested decsription. * @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!'); } From::Module('CLDSC')->uses('courseDescription.lib', 'courseDescription.class'); $result; foreach (course_description_get_item_list($cid) as $item) { if (claro_is_allowed_to_edit() || $item['visibility'] != 'HIDE') { if ($item['id'] == $resourceId) { $result = $item; break; } } } if ($result != null) { $result['content'] = trim(strip_tags($result['content'])); $result['visibility'] = $result['visibility'] != 'HIDE'; $result['resourceId'] = $result['id']; unset($result['id']); return $result; } else { throw new RuntimeException('Resource not found', 404); } }
public static function start($action = NULL, $data = NULL, $method = 'POST', $class = 'form-horizontal') { self::$data = $data; ?> <form action="<?php echo $action; ?> " method="<?php echo $method; ?> " class="<?php echo $class; ?> " enctype="multipart/form-data" > <?php }
/** * Gets the root entities of the query. This is the entity aliases involved * in the construction of the query. * * <code> * $qb = $em->createQueryBuilder() * ->select('u') * ->from('User', 'u'); * * $qb->getRootEntities(); // array('User') * </code> * * @return array $rootEntities */ public function getRootEntities() { $entities = array(); foreach ($this->_sqlParts['from'] as &$fromClause) { if (is_string($fromClause)) { $spacePos = strrpos($fromClause, ' '); $from = substr($fromClause, 0, $spacePos); $alias = substr($fromClause, $spacePos + 1); $fromClause = new From($from, $alias); } $entities[] = $fromClause->getFrom(); } return $entities; }
/* * Check that the class and method are provided and exist */ if (!isset($_REQUEST['module']) || empty($_REQUEST['module'])) { header('Missing Argument', true, 400); die; } if (!isset($_REQUEST['method']) || empty($_REQUEST['method'])) { header('Missing Argument', true, 400); die; } try { /* * Load the needed lib */ From::module($tlabelReq)->uses('pluginloader.lib'); $pl = new PluginLoader('./plugins/'); if ($class = $pl->load(isset($_REQUEST['forceGeneric']) ? 'GENERIC' : $_REQUEST['module'])) { if (method_exists($class, $_REQUEST['method'])) { $method = $_REQUEST['method']; $args = array(); foreach ($allowedArgs as $allowed) { if (isset($_REQUEST[$allowed])) { $args[$allowed] = $_REQUEST[$allowed]; } } $args['module'] = $_REQUEST['module']; $result = $class->{$method}($args); } else { header('Not Implemented', true, 501); die;
// $Id: coursehomepagecalendar.lib.php 13600 2011-09-21 11:14:20Z abourguignon $ // vim: expandtab sw=4 ts=4 sts=4: /** * CLAROLINE * * Course home page : MyCalendar portlet calendar class * * @version $Revision: 13600 $ * @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 <*****@*****.**> * @since 1.10 */ FromKernel::uses('user.lib', 'courselist.lib'); From::Module('CLCAL')->uses('agenda.lib'); include claro_get_conf_repository() . 'CLHOME.conf.php'; // conf file class CourseHomePageCalendar { protected $courseCode; protected $year; protected $month; public function __construct($courseCode) { if (file_exists(claro_get_conf_repository() . 'CLCAL.conf.php')) { include claro_get_conf_repository() . 'CLCAL.conf.php'; } $today = getdate(); $this->courseCode = $courseCode; $this->month = $today['mon'];
/** * CLAROLINE * * @version 0.1 * * @copyright (c) 2014 Quentin Devos * * @license http://www.gnu.org/copyleft/gpl.html (GPL) GENERAL PUBLIC LICENSE * * @package OAUTH * * @author Quentin Devos <*****@*****.**> * */ // We load the Autoloader for all the classes of the OAuth library. We can't use the loader included into Claroline, // because there are some dependencies inside the library and so, the loading order is important. From::module('OAUTH')->uses('OAuth2/Autoloader'); OAuth2\Autoloader::register(); // For the same reason, we load the Claroline-specific storage after the Autoloader. This way, all the dependencies are // resolved in the correct order. From::module('OAUTH')->uses('ClarolineStorage'); $storage = new OAuth2\Storage\ClarolineStorage(); // If we need to customize the configuration of the server, we can just do it here. $config = array(); // We can now create the OAuth server with the Claroline-specific Storage class. $server = new OAuth2\Server($storage, $config); // Finally, we define the type of Grant that are allowed by the server. // AuthorizationCode is the base of OAuth 2.0 (three-pass access) $server->addGrantType(new OAuth2\GrantType\AuthorizationCode($storage)); // RefreshToken allows the regeneration of the Access Tokens without re-asking permission from the user. $server->addGrantType(new OAuth2\GrantType\RefreshToken($storage));
require '../inc/claro_init_global.inc.php'; // Security check if (!claro_is_in_a_course() || !claro_is_course_allowed()) { claro_disp_auth_form(true); } $can_add_single_user = (bool) (claro_is_course_manager() && get_conf('is_coursemanager_allowed_to_enroll_single_user')) || claro_is_platform_admin(); if (!$can_add_single_user) { claro_die(get_lang('Not allowed')); } // include configuration file include claro_get_conf_repository() . 'user_profile.conf.php'; // include libraries require_once get_path('incRepositorySys') . '/lib/user.lib.php'; require_once get_path('incRepositorySys') . '/lib/course_user.lib.php'; require_once get_path('incRepositorySys') . '/lib/sendmail.lib.php'; From::module('CLUSR')->uses('profileselector.lib'); // Initialise variables $nameTools = get_lang('Add a user'); ClaroBreadCrumbs::getInstance()->prepend(get_lang('Users'), 'user.php'); $dialogBox = new DialogBox(); $platformRegSucceed = false; $courseRegSucceed = false; /*===================================================================== MAIN SECTION =====================================================================*/ // Initialise field variable from subscription form $userData = user_initialise(); $cmd = isset($_REQUEST['cmd']) ? $cmd = $_REQUEST['cmd'] : null; if (isset($_REQUEST['applySearch']) && $_REQUEST['applySearch'] != '') { $cmd = 'applySearch'; }