/**
  * 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);
     }
 }
Example #2
0
    /*-------------------------------------------------------------------------
          EDIT  VISIBILITY DESCRIPTION ITEM
      -------------------------------------------------------------------------*/
    if ($cmd == 'mkVis') {
        $description->setVisibility('VISIBLE');
        if ($description->save()) {
            $eventNotifier->notifyCourseEvent('course_description_visible', claro_get_current_course_id(), claro_get_current_tool_id(), $descId, claro_get_current_group_id(), '0');
        }
    }
    if ($cmd == 'mkInvis') {
        $description->setVisibility('INVISIBLE');
        $description->save();
    }
}
// Load the description elements
$descList = course_description_get_item_list();
//Display
$nameTools = get_lang('Course description');
$noQUERY_STRING = true;
// to remove parameters in the last breadcrumb link
Claroline::getDisplay()->body->appendContent(claro_html_tool_title($nameTools));
Claroline::getDisplay()->body->appendContent($dialogBox->render());
if ($is_allowedToEdit) {
    /**************************************************************************
       EDIT FORM DISPLAY
       **************************************************************************/
    if (isset($displayForm) && $displayForm) {
        $template = new ModuleTemplate($tlabelReq, 'form.tpl.php');
        $template->assign('formAction', claro_htmlspecialchars($_SERVER['PHP_SELF']));
        $template->assign('relayContext', claro_form_relay_context());
        $template->assign('descId', (int) $descId);