/**
  * 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);
     }
 }
// $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'];