715
edits
Tag: 2017 source edit |
|||
| (3 intermediate revisions by the same user not shown) | |||
| Line 172: | Line 172: | ||
<syntaxhighlight lang="PHP"> | <syntaxhighlight lang="PHP"> | ||
// | // 用于在新tabs中添加新页面或删除现有页面的数组 | ||
$this->tabs = array('objecttype:+tabname1:Title1:mylangfile@mymodule:$user->rights->mymodule->read:/mymodule/mypagetab1.php?id=__ID__' // | $this->tabs = array('objecttype:+tabname1:Title1:mylangfile@mymodule:$user->rights->mymodule->read:/mymodule/mypagetab1.php?id=__ID__' // 增加一个由code tabname1标识的新tab | ||
'objecttype:+tabname2:Title2:mylangfile@mymodule:$user->rights->mymodule->read:/mymodule/mypagetab2.php?id=__ID__', // | 'objecttype:+tabname2:Title2:mylangfile@mymodule:$user->rights->mymodule->read:/mymodule/mypagetab2.php?id=__ID__', // 增加一个由code tabname2标识的新tab | ||
'objecttype:-tabname'); // | 'objecttype:-tabname'); // 删除一个由code tabname标识的现有选项卡 | ||
</syntaxhighlight> | </syntaxhighlight> | ||
| Line 240: | Line 240: | ||
<syntaxhighlight lang="PHP"> | <syntaxhighlight lang="PHP"> | ||
$head // | $head // tabs的数组 | ||
$head[$h] // Element to describe one tab. | $head[$h] // Element to describe one tab. | ||
$head[$h][0] // Url of page to show when you click on tab | $head[$h][0] // Url of page to show when you click on tab | ||
| Line 261: | Line 261: | ||
<syntaxhighlight lang="PHP"> | <syntaxhighlight lang="PHP"> | ||
dol_fiche_head($links, $active='0', $title='', $notab=0, $picto='') | dol_fiche_head($links, $active='0', $title='', $notab=0, $picto='') | ||
//$links // | //$links // tabs的数组,上面称为$head | ||
//$active // | //$active // 活动选项卡(输入模块文件中定义的选项卡名称,或$head[$h][2]中包含的名称)。此选项卡将突出显示 | ||
//$title // | //$title // 要显示的标题(显示在无法单击的特殊选项卡中) | ||
//$notab | //$notab | ||
//$picto // | //$picto // 要显示到标题中的图片的名称。可能的值为: | ||
// product | // product | ||
// service | // service | ||
| Line 286: | Line 286: | ||
<syntaxhighlight lang="PHP"> | <syntaxhighlight lang="PHP"> | ||
// | // 加载Dolibarr环境 | ||
$res=0; | $res=0; | ||
// | // 尝试include在CONTEXT_DOCUMENT_ROOT(不总是定义的)中定义的已知web根目录中的main.inc.php | ||
if (! $res && ! empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res=@include($_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php"); | if (! $res && ! empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) $res=@include($_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php"); | ||
// | // 尝试include由SCRIPT_FILENAME计算的web根检测到web根的main.inc.php | ||
$tmp=empty($_SERVER['SCRIPT_FILENAME'])?'':$_SERVER['SCRIPT_FILENAME'];$tmp2=realpath(__FILE__); $i=strlen($tmp)-1; $j=strlen($tmp2)-1; | $tmp=empty($_SERVER['SCRIPT_FILENAME'])?'':$_SERVER['SCRIPT_FILENAME'];$tmp2=realpath(__FILE__); $i=strlen($tmp)-1; $j=strlen($tmp2)-1; | ||
while($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i]==$tmp2[$j]) { $i--; $j--; } | while($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i]==$tmp2[$j]) { $i--; $j--; } | ||
if (! $res && $i > 0 && file_exists(substr($tmp, 0, ($i+1))."/main.inc.php")) $res=@include(substr($tmp, 0, ($i+1))."/main.inc.php"); | if (! $res && $i > 0 && file_exists(substr($tmp, 0, ($i+1))."/main.inc.php")) $res=@include(substr($tmp, 0, ($i+1))."/main.inc.php"); | ||
if (! $res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i+1)))."/main.inc.php")) $res=@include(dirname(substr($tmp, 0, ($i+1)))."/main.inc.php"); | if (! $res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i+1)))."/main.inc.php")) $res=@include(dirname(substr($tmp, 0, ($i+1)))."/main.inc.php"); | ||
// | // 尝试include使用相对路径的main.inc.php | ||
if (! $res && file_exists("../main.inc.php")) $res=@include("../main.inc.php"); | if (! $res && file_exists("../main.inc.php")) $res=@include("../main.inc.php"); | ||
if (! $res && file_exists("../../main.inc.php")) $res=@include("../../main.inc.php"); | if (! $res && file_exists("../../main.inc.php")) $res=@include("../../main.inc.php"); | ||
edits