示例#1
0
/**
 * Get the categories associated with a specific node (if any).
 *
 * NOTE: Either the noderef or UUID value needs to be specified for the node.
 *
 * @param string $noderef The noderef URI.
 * @param string $uuid    The node UUID value.
 * @return array|bool An array of category information or, False on error.
 */
function alfresco_get_node_categories($noderef = '', $uuid = '')
{
    if (empty($uuid) && empty($noderef)) {
        return false;
    }
    $categories = array();
    if (empty($noderef)) {
        $properties = alfresco_node_properties($uuid);
        $noderef = $properties->noderef;
    }
    $response = alfresco_request('/moodle/nodecategory?nodeRef=' . $noderef);
    $sxml = RLsimpleXMLelement($response);
    if (empty($sxml)) {
        return false;
    }
    if (!empty($sxml->category)) {
        foreach ($sxml->category as $category) {
            $categories["{$category->uuid}"] = "{$category->name}";
        }
    }
    return $categories;
}
     html_footer();
     break;
 case "delete":
     if (!$canedit) {
         print_error('youdonothaveaccesstothisfunctionality', 'repository_alfresco');
     }
     if ($confirm and confirm_sesskey()) {
         html_header($course, $wdir);
         $puuid = '';
         if (!empty($USER->filelist)) {
             foreach ($USER->filelist as $uuid) {
                 if (empty($puuid)) {
                     $puuid = $repo->get_parent($uuid)->uuid;
                 }
                 if (!alfresco_delete($uuid)) {
                     $node = alfresco_node_properties($uuid);
                     debugging(get_string('couldnotdeletefile', 'repository_alfresco', $a));
                 }
             }
         }
         clearfilelist();
         if ($id != SITEID) {
             displaydir($puuid, $wdir, $id);
         } else {
             displaydir($puuid, $wdir);
         }
         html_footer();
     } else {
         html_header($course, $wdir);
         if (setfilelist($_POST)) {
             echo "<p align=center>" . get_string("deletecheckwarning") . ":</p>";
 /**
  * Get info about a specific node reference.
  *
  * @param string $uuid A node UUID value.
  */
 function get_info($uuid)
 {
     if (ALFRESCO_DEBUG_TRACE) {
         mtrace('get_info(' . $uuid . ')');
     }
     if (!$this->get_defaults()) {
         return false;
     }
     if (self::is_version('3.2')) {
         return alfresco_node_properties($uuid);
     } else {
         if (self::is_version('3.4')) {
             if (!($node = $this->cmis->getObject('workspace://SpacesStore/' . $uuid))) {
                 return false;
             }
             $type = '';
             $node = alfresco_process_node_new($node, $type);
             $node->type = $type;
             return $node;
         }
     }
 }