Esempio n. 1
0
        }
    }
}
$sejours = $patient->loadRefsSejours();
CMbObject::filterByPerm($sejours, PERM_READ);
foreach ($sejours as $_sejour) {
    $_sejour->loadRefsFiles();
    foreach ($_sejour->_ref_files as $_key => $_file) {
        $right = $_file->canDo();
        if (!$_file->isImage() || !$_file->_can->read || $_file->annule) {
            unset($_sejour->_ref_files[$_key]);
            continue;
        }
    }
    $operations = $_sejour->loadRefsOperations();
    CMbObject::filterByPerm($operations);
    foreach ($operations as $_op) {
        $_op->loadRefsFiles();
        foreach ($_op->_ref_files as $_key => $_file) {
            $right = $_file->canDo();
            if (!$_file->isImage() || !$_file->_can->read || $_file->annule) {
                unset($_op->_ref_files[$_key]);
                continue;
            }
        }
    }
}
// file categories
$category = new CFilesCategory();
$categories = $category->loadListWithPerms(PERM_EDIT);
$matrices = array();
 /**
  * Load functions with permissions for given group, current group by default
  *
  * @param int    $permType Level of permission
  * @param int    $group_id Filter on group
  * @param string $type     Type of function
  *
  * @return CFunctions[] Found functions
  */
 static function loadFonctions($permType = PERM_READ, $group_id = null, $type = null, $name = "")
 {
     $group = CGroups::loadCurrent();
     $function = new CFunctions();
     $where = array();
     $where["actif"] = "= '1'";
     $where["group_id"] = "= '" . CValue::first($group_id, $group->_id) . "'";
     if ($type) {
         $where["type"] = "= '{$type}'";
     }
     if ($name) {
         $where["text"] = "LIKE '{$name}%'";
     }
     $order = "text";
     /** @var CFunctions[] $functions */
     $functions = $function->loadList($where, $order);
     CMbObject::filterByPerm($functions, $permType);
     // Group association
     foreach ($functions as $function) {
         $function->_ref_group = $group;
     }
     return $functions;
 }