38 $langs->load(
"quickmemo");
43 $head[$h][0] =
dolBuildUrl(DOL_URL_ROOT.
"/quickmemo/admin/setup.php");
44 $head[$h][1] = $langs->trans(
"Settings");
45 $head[$h][2] =
'settings';
96 global $user, $hookmanager;
98 if (empty($element_type)) {
102 $parameters = array(
'element_type' => $element_type,
'element_id' => $element_id,
'moduleLevelOnly' => $moduleLevelOnly);
105 $reshook = $hookmanager->executeHooks(
'quickMemoCheckElementAccess', $parameters, $hookobject, $action);
108 } elseif ($reshook < 0) {
112 $element_type = quickMemoInterfaceResolveElementType($element_type);
113 $object = fetchObjectByElement($moduleLevelOnly ? 0 : (int) $element_id, $element_type,
'', $moduleLevelOnly ? 0 : 1);
117 if (!$moduleLevelOnly && empty(
$object->id)) {
128 if ($feature2 && !$user->hasRight(
$module,
$object->element,
'read')) {
146function quickMemoInterfaceResolveElementType($element_type)
149 static $cache = array();
151 $element_type = (string) $element_type;
152 if ($element_type ===
'' || strpos($element_type,
'@') !==
false || !preg_match(
'/^[a-z0-9_]+$/i', $element_type)) {
153 return $element_type;
155 if (isset($cache[$element_type])) {
156 return $cache[$element_type];
159 $cache[$element_type] = $element_type;
161 if (file_exists(
dol_buildpath(
'/'.$properties[
'classpath'].
'/'.$properties[
'classfile'].
'.class.php', 0))) {
162 return $element_type;
166 if (preg_match(
'/^[a-z0-9_]+$/',
$module) && file_exists(
dol_buildpath(
'/'.
$module.
'/class/'.strtolower($element_type).
'.class.php', 0))) {
167 $cache[$element_type] = $element_type.
'@'.
$module;
172 return $cache[$element_type];
if(! $sortfield) if(! $sortorder) $object
if(!isModEnabled('ai')||!getDolGlobalString('AI_ASSISTANT_ENABLED')) global $conf
The main.inc.php has been included so the following variable are now defined:
if(! $sortfield) if(! $sortorder) $module
dolBuildUrl($url, $params=[], $addtoken=false, $anchor='')
Return path of url.
getElementProperties($elementType)
Get an array with properties of an element.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
complete_head_from_modules($conf, $langs, $object, &$head, &$h, $type, $mode='add', $filterorigmodule='')
Complete or removed entries into a head array (used to build tabs).
quickMemoInterfaceCanAccessElement($element_type, $element_id, $moduleLevelOnly=false)
Check that current user can read the object a memo is attached to.
quickmemoAdminPrepareHead()
Prepare admin pages header.
restrictedArea(User $user, $features, $object=0, $tableandshare='', $feature2='', $dbt_keyfield='fk_soc', $dbt_select='rowid', $isdraft=0, $nodie=0, $mode='')
Check permissions of a user to show a page and an object.