本文整理汇总了PHP中verifCond函数的典型用法代码示例。如果您正苦于以下问题:PHP verifCond函数的具体用法?PHP verifCond怎么用?PHP verifCond使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了verifCond函数的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: load_arrays
/**
* \brief Load an exportable dataset
* \param user Object user making export
* \param filter Load a particular dataset only
*/
function load_arrays($user,$filter='')
{
global $langs,$conf,$mysoc;
dol_syslog("Export::load_arrays user=".$user->id." filter=".$filter);
$var=true;
$i=0;
foreach ($conf->file->dol_document_root as $type => $dirroot)
{
$modulesdir[] = $dirroot . "/includes/modules/";
if ($type == 'alt')
{
$handle=@opendir($dirroot);
if (is_resource($handle))
{
while (($file = readdir($handle))!==false)
{
if (is_dir($dirroot.'/'.$file) && substr($file, 0, 1) <> '.' && substr($file, 0, 3) <> 'CVS' && $file != 'includes')
{
if (is_dir($dirroot . '/' . $file . '/includes/modules/'))
{
$modulesdir[] = $dirroot . '/' . $file . '/includes/modules/';
}
}
}
closedir($handle);
}
}
}
foreach($modulesdir as $dir)
{
// Search available exports
$handle=@opendir($dir);
if (is_resource($handle))
{
// Search module files
while (($file = readdir($handle))!==false)
{
if (is_readable($dir.$file) && preg_match("/^(mod.*)\.class\.php$/i",$file,$reg))
{
$modulename=$reg[1];
// Defined if module is enabled
$enabled=true;
$part=strtolower(preg_replace('/^mod/i','',$modulename));
if (empty($conf->$part->enabled)) $enabled=false;
if ($enabled)
{
// Chargement de la classe
$file = $dir.$modulename.".class.php";
$classname = $modulename;
require_once($file);
$module = new $classname($this->db);
if (is_array($module->export_code))
{
foreach($module->export_code as $r => $value)
{
//print $i.'-'.$filter.'-'.$modulename.'-'.join(',',$module->export_code).'<br>';
if ($filter && ($filter != $module->export_code[$r])) continue;
// Test if condition to show are ok
if (! empty($module->export_enabled[$r]) && ! verifCond($module->export_enabled[$r])) continue;
// Test if permissions are ok
$bool=true;
foreach($module->export_permission[$r] as $val)
{
$perm=$val;
//print_r("$perm[0]-$perm[1]-$perm[2]<br>");
if ($perm[2])
{
$bool=$user->rights->$perm[0]->$perm[1]->$perm[2];
}
else
{
$bool=$user->rights->$perm[0]->$perm[1];
}
if ($perm[0]=='user' && $user->admin) $bool=true;
if (! $bool) break;
}
//print $bool." $perm[0]"."<br>";
// Permissions ok
// if ($bool)
// {
// Charge fichier lang en rapport
$langtoload=$module->getLangFilesArray();
if (is_array($langtoload))
{
//.........这里部分代码省略.........
开发者ID:remyyounes,项目名称:dolibarr,代码行数:101,代码来源:export.class.php
示例2: menuLoad
/**
* Load entries found in database in a menu array
* @param $myleftmenu Value for left that defined leftmenu
* @param $type_user 0=Internal,1=External,2=All
* @param $menu_handler Name of menu_handler used (auguria, eldy...)
* @param $tabMenu If array with menu entries already load, we put this array here (in most cases, it's empty)
* @return int >0 if OK, <0 if KO
*/
function menuLoad($myleftmenu, $type_user, $menu_handler, &$tabMenu=array())
{
global $langs, $user, $conf; // To export to dol_eval function
global $leftmenu, $rights; // To export to dol_eval function
$menutopid=0;
$leftmenu=$myleftmenu; // To export to dol_eval function
$sql = "SELECT m.rowid, m.type, m.fk_menu, m.url, m.titre, m.langs, m.perms, m.enabled, m.target, m.mainmenu, m.leftmenu";
$sql.= " FROM ".MAIN_DB_PREFIX."menu as m";
$sql.= " WHERE m.entity = ".$conf->entity;
//$sql.= " WHERE m.entity = 1";
$sql.= " AND m.menu_handler in('".$menu_handler."','all')";
if ($type_user == 0) $sql.= " AND m.usertype in (0,2)";
if ($type_user == 1) $sql.= " AND m.usertype in (1,2)";
// If type_user == 2, no test required
$sql.= " ORDER BY m.position, m.rowid";
dol_syslog("Menubase::menuLeftCharger sql=".$sql);
$resql = $this->db->query($sql);
if ($resql)
{
$numa = $this->db->num_rows($resql);
$a = 0;
$b = 0;
$oldrowid=0;
while ($a < $numa)
{
//$objm = $this->db->fetch_object($resql);
$menu = $this->db->fetch_array($resql);
// Define $chaine
$chaine="";
$title = $langs->trans($menu['titre']);
if ($title == $menu['titre']) // Translation not found
{
if (! empty($menu['langs'])) // If there is a dedicated translation file
{
$langs->load($menu['langs']);
}
if (preg_match("/\//",$menu['titre'])) // To manage translation when title is string1/string2
{
$tab_titre = explode("/",$menu['titre']);
$chaine = $langs->trans($tab_titre[0])."/".$langs->trans($tab_titre[1]);
}
else
{
$chaine = $langs->trans($menu['titre']);
}
}
else
{
$chaine = $title;
}
// Define $right
$perms = true;
if ($menu['perms'])
{
$perms = verifCond($menu['perms']);
//print "verifCond rowid=".$menu['rowid']." ".$menu['right'].":".$perms."<br>\n";
}
// Define $enabled
$enabled = true;
if ($menu['enabled'])
{
$enabled = verifCond($menu['enabled']);
if ($conf->use_javascript_ajax && $conf->global->MAIN_MENU_USE_JQUERY_ACCORDION && preg_match('/^\$leftmenu/',$menu['enabled'])) $enabled=1;
//print "verifCond chaine=".$chaine." rowid=".$menu['rowid']." ".$menu['enabled'].":".$enabled."<br>\n";
}
// 0=rowid, 1=fk_menu, 2=url, 3=text, 4=perms, 5=target, 8=mainmenu
$tabMenu[$b][0] = $menu['rowid'];
$tabMenu[$b][1] = $menu['fk_menu'];
$tabMenu[$b][2] = $menu['url'];
if (! preg_match("/^(http:\/\/|https:\/\/)/i",$tabMenu[$b][2]))
{
if (preg_match('/\?/',$tabMenu[$b][2])) $tabMenu[$b][2].='&idmenu='.$menu['rowid'];
else $tabMenu[$b][2].='?idmenu='.$menu['rowid'];
}
$tabMenu[$b][3] = $chaine;
$tabMenu[$b][5] = $menu['target'];
$tabMenu[$b][6] = $menu['leftmenu'];
if (! isset($tabMenu[$b][4])) $tabMenu[$b][4] = $perms;
else $tabMenu[$b][4] = ($tabMenu[$b][4] && $perms);
if (! isset($tabMenu[$b][7])) $tabMenu[$b][7] = $enabled;
else $tabMenu[$b][7] = ($tabMenu[$b][7] && $enabled);
$tabMenu[$b][8] = $menu['mainmenu'];
$tabMenu[$b][9] = $menu['type'];
//.........这里部分代码省略.........
开发者ID:remyyounes,项目名称:dolibarr,代码行数:101,代码来源:menubase.class.php
示例3: load_arrays
/**
* Load an exportable dataset
*
* @param User $user Object user making export
* @param string $filter Load a particular dataset only
* @return int <0 if KO, >0 if OK
*/
function load_arrays($user, $filter = '')
{
global $langs, $conf, $mysoc;
dol_syslog(get_class($this) . "::load_arrays user=" . $user->id . " filter=" . $filter);
$var = true;
$i = 0;
// Define list of modules directories into modulesdir
require_once DOL_DOCUMENT_ROOT . '/core/lib/functions2.lib.php';
$modulesdir = dolGetModulesDirs();
foreach ($modulesdir as $dir) {
// Search available exports
$handle = @opendir(dol_osencode($dir));
if (is_resource($handle)) {
// Search module files
while (($file = readdir($handle)) !== false) {
if (is_readable($dir . $file) && preg_match("/^(mod.*)\\.class\\.php\$/i", $file, $reg)) {
$modulename = $reg[1];
// Defined if module is enabled
$enabled = true;
$part = strtolower(preg_replace('/^mod/i', '', $modulename));
if ($part == 'propale') {
$part = 'propal';
}
if (empty($conf->{$part}->enabled)) {
$enabled = false;
}
if ($enabled) {
// Chargement de la classe
$file = $dir . $modulename . ".class.php";
$classname = $modulename;
require_once $file;
$module = new $classname($this->db);
if (isset($module->export_code) && is_array($module->export_code)) {
foreach ($module->export_code as $r => $value) {
//print $i.'-'.$filter.'-'.$modulename.'-'.join(',',$module->export_code).'<br>';
if ($filter && $filter != $module->export_code[$r]) {
continue;
}
// Test if condition to show are ok
if (!empty($module->export_enabled[$r]) && !verifCond($module->export_enabled[$r])) {
continue;
}
// Test if permissions are ok
$bool = true;
foreach ($module->export_permission[$r] as $val) {
$perm = $val;
//print_r("$perm[0]-$perm[1]-$perm[2]<br>");
if (!empty($perm[2])) {
$bool = $user->rights->{$perm}[0]->{$perm}[1]->{$perm}[2];
} else {
$bool = $user->rights->{$perm}[0]->{$perm}[1];
}
if ($perm[0] == 'user' && $user->admin) {
$bool = true;
}
if (!$bool) {
break;
}
}
//print $bool." $perm[0]"."<br>";
// Permissions ok
// if ($bool)
// {
// Charge fichier lang en rapport
$langtoload = $module->getLangFilesArray();
if (is_array($langtoload)) {
foreach ($langtoload as $key) {
$langs->load($key);
}
}
// Module
$this->array_export_module[$i] = $module;
// Permission
$this->array_export_perms[$i] = $bool;
// Icon
$this->array_export_icon[$i] = isset($module->export_icon[$r]) ? $module->export_icon[$r] : $module->picto;
// Code du dataset export
$this->array_export_code[$i] = $module->export_code[$r];
// Libelle du dataset export
$this->array_export_label[$i] = $module->getExportDatasetLabel($r);
// Tableau des champ a exporter (cle=champ, valeur=libelle)
$this->array_export_fields[$i] = $module->export_fields_array[$r];
// Tableau des champs a filtrer (cle=champ, valeur1=type de donnees) on verifie que le module a des filtres
$this->array_export_TypeFields[$i] = isset($module->export_TypeFields_array[$r]) ? $module->export_TypeFields_array[$r] : '';
// Tableau des entites a exporter (cle=champ, valeur=entite)
$this->array_export_entities[$i] = $module->export_entities_array[$r];
// Tableau des entites qui requiert abandon du DISTINCT (cle=entite, valeur=champ id child records)
$this->array_export_dependencies[$i] = !empty($module->export_dependencies_array[$r]) ? $module->export_dependencies_array[$r] : '';
// Tableau des operations speciales sur champ
$this->array_export_special[$i] = !empty($module->export_special_array[$r]) ? $module->export_special_array[$r] : '';
// Requete sql du dataset
$this->array_export_sql_start[$i] = $module->export_sql_start[$r];
$this->array_export_sql_end[$i] = $module->export_sql_end[$r];
//.........这里部分代码省略.........
开发者ID:LionSystemsSolutions,项目名称:El-Canelo-ERP,代码行数:101,代码来源:export.class.php
示例4: verifyMenu
/**
* Core function to verify perms of menu
*
* @param object $newTabMenu One Menu Entry
* @return $newTabMenu with good permissions
*/
function verifyMenu($newTabMenu)
{
global $langs, $user;
// Define $right
$perms = true;
if ($newTabMenu->perms) {
$perms = verifCond($newTabMenu->perms);
//print "verifCond rowid=".$menu['rowid']." ".$menu['perms'].":".$perms."<br>\n";
}
// Define $enabled
$enabled = true;
if ($newTabMenu->enabled) {
$enabled = verifCond($newTabMenu->enabled);
if (preg_match('/^\\$leftmenu/', $newTabMenu->enabled)) {
$enabled = 1;
}
//print "verifCond rowid=".$menu['rowid']." ".$menu['enabled'].":".$enabled."<br>\n";
}
// Define $title
if ($enabled) {
$title = $langs->trans($newTabMenu->title);
if ($title == $newTabMenu->title) {
// Translation not found
if (!empty($newTabMenu->langs)) {
// If there is a dedicated translation file
$langs->load($newTabMenu->langs);
}
if (preg_match("/\\//", $newTabMenu->title)) {
// To manage translation when title is string1/string2
$tab_titre = explode("/", $newTabMenu->title);
$title = $langs->trans($tab_titre[0]) . "/" . $langs->trans($tab_titre[1]);
} else {
if (preg_match('/\\|\\|/', $newTabMenu->title)) {
// To manage different translation
$tab_title = explode("||", $newTabMenu->title);
$alt_title = explode("@", $tab_title[1]);
$title_enabled = verifCond($alt_title[1]);
$title = $title_enabled ? $langs->trans($alt_title[0]) : $langs->trans($tab_title[0]);
} else {
$title = $langs->trans($newTabMenu->title);
}
}
}
}
$newTabMenu->enabled = $enabled;
$newTabMenu->title = $title;
$newTabMenu->perms = $perms;
return $newTabMenu;
}
开发者ID:nrjacker4,项目名称:crm-php,代码行数:55,代码来源:auguria_backoffice.php
示例5: getFieldList
/**
* Fetch field list
*
* @return void
*/
private function getFieldList()
{
global $conf, $langs;
$this->field_list = array();
$sql = "SELECT rowid, name, alias, title, align, sort, search, enabled, rang";
$sql.= " FROM ".MAIN_DB_PREFIX."c_field_list";
$sql.= " WHERE element = '".$this->fieldListName."'";
$sql.= " AND entity = ".$conf->entity;
$sql.= " ORDER BY rang ASC";
$resql = $this->db->query($sql);
if ($resql)
{
$num = $this->db->num_rows($resql);
$i = 0;
while ($i < $num)
{
$fieldlist = array();
$obj = $this->db->fetch_object($resql);
$fieldlist["id"] = $obj->rowid;
$fieldlist["name"] = $obj->name;
$fieldlist["alias"] = $obj->alias;
$fieldlist["title"] = $langs->trans($obj->title);
$fieldlist["align"] = $obj->align;
$fieldlist["sort"] = $obj->sort;
$fieldlist["search"] = $obj->search;
$fieldlist["enabled"] = verifCond($obj->enabled);
$fieldlist["order"] = $obj->rang;
array_push($this->field_list,$fieldlist);
$i++;
}
$this->db->free($resql);
}
else
{
dol_print_error($this->db,$sql);
}
}
开发者ID:nrjacker4,项目名称:crm-php,代码行数:50,代码来源:actions_card_service.class.php
示例6: clearstatcache
print '<tr class="liste_titre">' . "\n";
print ' <td>' . $langs->trans("Description") . '</td>';
print ' <td align="center">' . $langs->trans("Status") . '</td>';
print "</tr>\n";
clearstatcache();
$workflowcodes = array('WORKFLOW_PROPAL_AUTOCREATE_ORDER' => array('enabled' => '! empty($conf->propal->enabled) && ! empty($conf->commande->enabled)', 'picto' => 'order'), 'WORKFLOW_ORDER_CLASSIFY_BILLED_PROPAL' => array('enabled' => '! empty($conf->propal->enabled) && ! empty($conf->commande->enabled)', 'picto' => 'order', 'warning' => 'WarningCloseAlways'), 'WORKFLOW_ORDER_AUTOCREATE_INVOICE' => array('enabled' => '! empty($conf->commande->enabled) && ! empty($conf->facture->enabled)', 'picto' => 'bill'), 'WORKFLOW_INVOICE_CLASSIFY_BILLED_ORDER' => array('enabled' => '! empty($conf->facture->enabled) && ! empty($conf->commande->enabled)', 'picto' => 'bill', 'warning' => 'WarningCloseAlways'), 'WORKFLOW_INVOICE_AMOUNT_CLASSIFY_BILLED_ORDER' => array('enabled' => '! empty($conf->facture->enabled) && ! empty($conf->commande->enabled)', 'picto' => 'bill', 'warning' => 'WarningCloseAlways'));
if (!empty($conf->modules_parts['workflow']) && is_array($conf->modules_parts['workflow'])) {
foreach ($conf->modules_parts['workflow'] as $workflow) {
$workflowcodes = array_merge($workflowcodes, $workflow);
}
}
$nbqualified = 0;
foreach ($workflowcodes as $key => $params) {
$picto = $params['picto'];
$enabled = $params['enabled'];
if (!verifCond($enabled)) {
continue;
}
$nbqualified++;
$var = !$var;
print "<tr " . $bc[$var] . ">\n";
print "<td>" . img_object('', $picto) . $langs->trans('desc' . $key);
if (!empty($params['warning'])) {
$langs->load("errors");
print ' ' . img_warning($langs->transnoentitiesnoconv($params['warning']));
}
print "</td>\n";
print '<td align="center">';
if (!empty($conf->use_javascript_ajax)) {
print ajax_constantonoff($key);
} else {
开发者ID:Samara94,项目名称:dolibarr,代码行数:31,代码来源:workflow.php
示例7: menuLoad
/**
* Load entries found in database into variable $tabMenu. Note that only "database menu entries" are loaded here, hardcoded will not be present into output.
*
* @param string $mymainmenu Value for mainmenu that defined mainmenu
* @param string $myleftmenu Value for left that defined leftmenu
* @param int $type_user Looks for menu entry for 0=Internal users, 1=External users
* @param string $menu_handler Name of menu_handler used ('auguria', 'eldy'...)
* @param array $tabMenu Array to store new entries found (in most cases, it's empty, but may be alreay filled)
* @return int >0 if OK, <0 if KO
*/
function menuLoad($mymainmenu, $myleftmenu, $type_user, $menu_handler, &$tabMenu)
{
global $langs, $user, $conf;
// To export to dol_eval function
global $mainmenu, $leftmenu;
// To export to dol_eval function
$menutopid = 0;
$mainmenu = $mymainmenu;
// To export to dol_eval function
$leftmenu = $myleftmenu;
// To export to dol_eval function
$sql = "SELECT m.rowid, m.type, m.module, m.fk_menu, m.fk_mainmenu, m.fk_leftmenu, m.url, m.titre, m.langs, m.perms, m.enabled, m.target, m.mainmenu, m.leftmenu, m.position";
$sql .= " FROM " . MAIN_DB_PREFIX . "menu as m";
$sql .= " WHERE m.entity IN (0," . (!empty($conf->multicompany->enabled) && !empty($conf->multicompany->transverse_mode) ? "1," : "") . $conf->entity . ")";
$sql .= " AND m.menu_handler IN ('" . $menu_handler . "','all')";
if ($type_user == 0) {
$sql .= " AND m.usertype IN (0,2)";
}
if ($type_user == 1) {
$sql .= " AND m.usertype IN (1,2)";
}
$sql .= " ORDER BY m.position, m.rowid";
//print $sql;
//$tmp1=dol_microtime_float();
//print '>>> 1 0<br>';
dol_syslog(get_class($this) . "::menuLoad mymainmenu=" . $mymainmenu . " myleftmenu=" . $myleftmenu . " type_user=" . $type_user . " menu_handler=" . $menu_handler . " tabMenu size=" . count($tabMenu) . "", LOG_DEBUG);
$resql = $this->db->query($sql);
if ($resql) {
$numa = $this->db->num_rows($resql);
$a = 0;
$b = 0;
$oldrowid = 0;
while ($a < $numa) {
//$objm = $this->db->fetch_object($resql);
$menu = $this->db->fetch_array($resql);
// Define $right
$perms = true;
if ($menu['perms']) {
$tmpcond = $menu['perms'];
if ($leftmenu == 'all') {
$tmpcond = preg_replace('/\\$leftmenu\\s*==\\s*["\'a-zA-Z_]+/', '1==1', $tmpcond);
}
// Force part of condition to true
$perms = verifCond($tmpcond);
//print "verifCond rowid=".$menu['rowid']." ".$tmpcond.":".$perms."<br>\n";
}
// Define $enabled
$enabled = true;
if ($menu['enabled']) {
$tmpcond = $menu['enabled'];
if ($leftmenu == 'all') {
$tmpcond = preg_replace('/\\$leftmenu\\s*==\\s*["\'a-zA-Z_]+/', '1==1', $tmpcond);
}
// Force part of condition to true
$enabled = verifCond($tmpcond);
}
// Define $title
if ($enabled) {
$title = $langs->trans($menu['titre']);
if ($title == $menu['titre']) {
if (!empty($menu['langs'])) {
//print 'Load file '.$menu['langs'].'<br>';
$langs->load($menu['langs']);
}
if (preg_match("/\\//", $menu['titre'])) {
$tab_titre = explode("/", $menu['titre']);
$title = $langs->trans($tab_titre[0]) . "/" . $langs->trans($tab_titre[1]);
} else {
if (preg_match('/\\|\\|/', $menu['titre'])) {
$tab_title = explode("||", $menu['titre']);
$alt_title = explode("@", $tab_title[1]);
$title_enabled = verifCond($alt_title[1]);
$title = $title_enabled ? $langs->trans($alt_title[0]) : $langs->trans($tab_title[0]);
} else {
$title = $langs->trans($menu['titre']);
}
}
}
//$tmp4=dol_microtime_float();
//print '>>> 3 '.($tmp4 - $tmp3).'<br>';
// We complete tabMenu
$tabMenu[$b]['rowid'] = $menu['rowid'];
$tabMenu[$b]['module'] = $menu['module'];
$tabMenu[$b]['fk_menu'] = $menu['fk_menu'];
$tabMenu[$b]['url'] = $menu['url'];
if (!preg_match("/^(http:\\/\\/|https:\\/\\/)/i", $tabMenu[$b]['url'])) {
if (preg_match('/\\?/', $tabMenu[$b]['url'])) {
$tabMenu[$b]['url'] .= '&idmenu=' . $menu['rowid'];
} else {
$tabMenu[$b]['url'] .= '?idmenu=' . $menu['rowid'];
//.........这里部分代码省略.........
开发者ID:TAASA,项目名称:Dolibarr-ERP-3.8.1,代码行数:101,代码来源:menubase.class.php
示例8: array
// Webservices list
$webservices = array('user' => '', 'thirdparty' => '!empty($conf->societe->enabled)', 'contact' => '!empty($conf->societe->enabled)', 'productorservice' => '(!empty($conf->product->enabled) || !empty($conf->service->enabled))', 'order' => '!empty($conf->commande->enabled)', 'invoice' => '!empty($conf->facture->enabled)', 'supplier_invoice' => '!empty($conf->fournisseur->enabled)', 'actioncomm' => '!empty($conf->agenda->enabled)', 'category' => '!empty($conf->categorie->enabled)', 'other' => '');
// WSDL
print '<u>' . $langs->trans("WSDLCanBeDownloadedHere") . ':</u><br>';
foreach ($webservices as $name => $right) {
if (!empty($right) && !verifCond($right)) {
continue;
}
$url = DOL_MAIN_URL_ROOT . '/webservices/server_' . $name . '.php?wsdl';
print img_picto('', 'object_globe.png') . ' <a href="' . $url . '" target="_blank">' . $url . "</a><br>\n";
}
print '<br>';
// Endpoint
print '<u>' . $langs->trans("EndPointIs") . ':</u><br>';
foreach ($webservices as $name => $right) {
if (!empty($right) && !verifCond($right)) {
continue;
}
$url = DOL_MAIN_URL_ROOT . '/webservices/server_' . $name . '.php';
print img_picto('', 'object_globe.png') . ' <a href="' . $url . '" target="_blank">' . $url . "</a><br>\n";
}
print '<br>';
print '<br>';
print $langs->trans("OnlyActiveElementsAreShown", DOL_URL_ROOT . '/admin/modules.php');
if (!empty($conf->use_javascript_ajax)) {
print "\n" . '<script type="text/javascript">';
print '$(document).ready(function () {
$("#generate_token").click(function() {
$.get( "' . DOL_URL_ROOT . '/core/ajax/security.php", {
action: \'getrandompassword\',
generic: true
开发者ID:TAASA,项目名称:Dolibarr-ERP-3.8.1,代码行数:31,代码来源:webservices.php
示例9: complete_head_from_modules
/**
* Complete or removed entries into a head array (used to build tabs) with value added by external modules
* @param conf Object conf
* @param langs Object langs
* @param object Object object
* @param head Object head
* @param h New position to fill
* @param type Value for object where objectvalue can be
* 'thirdparty' to add a tab in third party view
* 'intervention' to add a tab in intervention view
* 'supplier_order' to add a tab in supplier order view
* 'supplier_invoice' to add a tab in supplier invoice view
* 'invoice' to add a tab in customer invoice view
* 'order' to add a tab in customer order view
* 'product' to add a tab in product view
* 'propal' to add a tab in propal view
* 'member' to add a tab in fundation member view
* 'categories_x' to add a tab in category view ('x': type of category (0=product, 1=supplier, 2=customer, 3=member)
* @param mode 'add' to complete head, 'remove' to remove entries
*/
function complete_head_from_modules($conf, $langs, $object, &$head, &$h, $type, $mode = 'add')
{
if (is_array($conf->tabs_modules[$type])) {
$i = 0;
foreach ($conf->tabs_modules[$type] as $value) {
$values = explode(':', $value);
if ($mode == 'add' && !preg_match('/^\\-/', $values[1])) {
if (sizeof($values) == 6) {
if ($values[0] != $type) {
continue;
}
if (verifCond($values[4])) {
if ($values[3]) {
$langs->load($values[3]);
}
$head[$h][0] = dol_buildpath(preg_replace('/__ID__/i', $object->id, $values[5]), 1);
$head[$h][1] = $langs->trans($values[2]);
$head[$h][2] = str_replace('+', '', $values[1]);
$h++;
}
} else {
if (sizeof($values) == 5) {
if ($values[0] != $type) {
continue;
}
if ($values[3]) {
$langs->load($values[3]);
}
$head[$h][0] = dol_buildpath(preg_replace('/__ID__/i', $object->id, $values[4]), 1);
$head[$h][1] = $langs->trans($values[2]);
$head[$h][2] = str_replace('+', '', $values[1]);
$h++;
} else {
if (sizeof($values) == 4) {
if ($values[0] != $type) {
continue;
}
if ($values[2]) {
$langs->load($values[2]);
}
$head[$h][0] = dol_buildpath(preg_replace('/__ID__/i', $object->id, $values[3]), 1);
$head[$h][1] = $langs->trans($values[1]);
$head[$h][2] = 'tab' . $values[1];
$h++;
}
}
}
} else {
if ($mode == 'remove' && preg_match('/^\\-/', $values[1])) {
if ($values[0] != $type) {
continue;
}
$tabname = str_replace('-', '', $values[1]);
foreach ($head as $key => $val) {
if ($head[$key][2] == $tabname) {
//print 'on vire '.$tabname.' key='.$key;
unset($head[$key]);
break;
}
}
}
}
}
}
}
开发者ID:netors,项目名称:dolibarr,代码行数:85,代码来源:functions.lib.php
示例10: complete_head_from_modules
/**
* Complete or removed entries into a head array (used to build tabs) with value added by external modules
* @param conf Object conf
* @param langs Object langs
* @param object Object object
* @param head Object head
* @param h New position to fill
* @param type Value for object where objectvalue can be
* 'thirdparty' to add a tab in third party view
* 'intervention' to add a tab in intervention view
* 'supplier_order' to add a tab in supplier order view
* 'supplier_invoice' to add a tab in supplier invoice view
* 'invoice' to add a tab in customer invoice view
* 'order' to add a tab in customer order view
* 'product' to add a tab in product view
* 'propal' to add a tab in propal view
* 'member' to add a tab in fundation member view
* 'categories_x' to add a tab in category view ('x': type of category (0=product, 1=supplier, 2=customer, 3=member)
* @param mode 'add' to complete head, 'remove' to remove entries
*/
function complete_head_from_modules($conf,$langs,$object,&$head,&$h,$type,$mode='add')
{
if (is_array($conf->tabs_modules[$type]))
{
$i=0;
foreach ($conf->tabs_modules[$type] as $value)
{
$values=explode(':',$value);
if ($mode == 'add')
{
if (sizeof($values) == 6) // new declaration with permissions
{
if ($values[0] != $type) continue;
if (verifCond($values[4]))
{
if ($values[3]) $langs->load($values[3]);
$head[$h][0] = dol_buildpath(preg_replace('/__ID__/i',$object->id,$values[5]),1);
$head[$h][1] = $langs->trans($values[2]);
$head[$h][2] = str_replace('+','',$values[1]);
$h++;
}
}
else if (sizeof($values) == 5) // new declaration
{
if ($values[0] != $type) continue;
if ($values[3]) $langs->load($values[3]);
$head[$h][0] = dol_buildpath(preg_replace('/__ID__/i',$object->id,$values[4]),1);
$head[$h][1] = $langs->trans($values[2]);
$head[$h][2] = str_replace('+','',$values[1]);
$h++;
}
else if (sizeof($values) == 4) // old declaration, for backward compatibility
{
if ($values[0] != $type) continue;
if ($values[2]) $langs->load($values[2]);
$head[$h][0] = dol_buildpath(preg_replace('/__ID__/i',$object->id,$values[3]),1);
$head[$h][1] = $langs->trans($values[1]);
$head[$h][2] = 'tab'.$values[1];
$h++;
}
}
else if ($mode == 'remove')
{
if ($values[0] != $type) continue;
$tabname=str_replace('-','',$values[1]);
foreach($head as $key => $val)
{
if ($head[$key][2]==$tabname)
{
//print 'on vire '.$tabname.' key='.$key;
unset($head[$key]);
break;
}
}
}
}
}
}
开发者ID:remyyounes,项目名称:dolibarr,代码行数:78,代码来源:functions.lib.php
示例11: menuLoad
/**
* Load entries found in database into variable $tabMenu. Note that only "database menu entries" are loaded here, hardcoded will not be present into output.
*
* @param string $mymainmenu Value for left that defined mainmenu
* @param string $myleftmenu Value for left that defined leftmenu
* @param int $type_user 0=Internal,1=External,2=All
* @param string $menu_handler Name of menu_handler used ('auguria', 'eldy'...)
* @param array &$tabMenu Array to store new entries found (in most cases, it's empty, but may be alreay filled)
* @return int >0 if OK, <0 if KO
*/
private function menuLoad($mymainmenu, $myleftmenu, $type_user, $menu_handler, &$tabMenu)
{
global $langs, $user, $conf;
// To export to dol_eval function
global $mainmenu, $leftmenu;
// To export to dol_eval function
$menutopid = 0;
$mainmenu = $mymainmenu;
// To export to dol_eval function
$leftmenu = $myleftmenu;
// To export to dol_eval function
$sql = "SELECT m.rowid, m.type, m.fk_menu, m.fk_mainmenu, m.fk_leftmenu, m.url, m.titre, m.langs, m.perms, m.enabled, m.target, m.mainmenu, m.leftmenu";
$sql .= " FROM " . MAIN_DB_PREFIX . "menu as m";
$sql .= " WHERE m.entity = " . $conf->entity;
$sql .= " AND m.menu_handler IN ('" . $menu_handler . "','all')";
if ($type_user == 0) {
$sql .= " AND m.usertype IN (0,2)";
}
if ($type_user == 1) {
$sql .= " AND m.usertype IN (1,2)";
}
// If type_user == 2, no test required
$sql .= " ORDER BY m.position, m.rowid";
dol_syslog(get_class($this) . "::menuLeftCharger sql=" . $sql);
$resql = $this->db->query($sql);
if ($resql) {
$numa = $this->db->num_rows($resql);
$a = 0;
$b = 0;
$oldrowid = 0;
while ($a < $numa) {
//$objm = $this->db->fetch_object($resql);
$menu = $this->db->fetch_array($resql);
// Define $right
$perms = true;
if ($menu['perms']) {
$perms = verifCond($menu['perms']);
//print "verifCond rowid=".$menu['rowid']." ".$menu['perms'].":".$perms."<br>\n";
}
// Define $enabled
$enabled = true;
if ($menu['enabled']) {
$enabled = verifCond($menu['enabled']);
if ($conf->use_javascript_ajax && !empty($conf->global->MAIN_MENU_USE_JQUERY_ACCORDION) && preg_match('/^\\$leftmenu/', $menu['enabled'])) {
$enabled = 1;
}
//print "verifCond rowid=".$menu['rowid']." ".$menu['enabled'].":".$enabled."<br>\n";
}
// Define $title
if ($enabled) {
$title = $langs->trans($menu['titre']);
if ($title == $menu['titre']) {
if (!empty($menu['langs'])) {
$langs->load($menu['langs']);
}
if (preg_match("/\\//", $menu['titre'])) {
$tab_titre = explode("/", $menu['titre']);
$title = $langs->trans($tab_titre[0]) . "/" . $langs->trans($tab_titre[1]);
} else {
if (preg_match('/\\|\\|/', $menu['titre'])) {
$tab_title = explode("||", $menu['titre']);
$alt_title = explode("@", $tab_title[1]);
$title_enabled = verifCond($alt_title[1]);
$title = $title_enabled ? $langs->trans($alt_title[0]) : $langs->trans($tab_title[0]);
} else {
$title = $langs->trans($menu['titre']);
}
}
}
// We complete tabMenu
$tabMenu[$b]['rowid'] = $menu['rowid'];
$tabMenu[$b]['fk_menu'] = $menu['fk_menu'];
$tabMenu[$b]['url'] = $menu['url'];
if (!preg_match("/^(http:\\/\\/|https:\\/\\/)/i", $tabMenu[$b]['url'])) {
if (preg_match('/\\?/', $tabMenu[$b]['url'])) {
$tabMenu[$b]['url'] .= '&idmenu=' . $menu['rowid'];
} else {
$tabMenu[$b]['url'] .= '?idmenu=' . $menu['rowid'];
}
}
$tabMenu[$b]['titre'] = $title;
$tabMenu[$b]['target'] = $menu['target'];
$tabMenu[$b]['mainmenu'] = $menu['mainmenu'];
$tabMenu[$b]['leftmenu'] = $menu['leftmenu'];
$tabMenu[$b]['perms'] = $perms;
$tabMenu[$b]['enabled'] = $enabled;
$tabMenu[$b]['type'] = $menu['type'];
//$tabMenu[$b]['langs'] = $menu['langs'];
$tabMenu[$b]['fk_mainmenu'] = $menu['fk_mainmenu'];
$tabMenu[$b]['fk_leftmenu'] = $menu['fk_leftmenu'];
//.........这里部分代码省略.........
开发者ID:nrjacker4,项目名称:crm-php,代码行数:101,代码来源:menubase.class.php
示例12: array
print '<td> </td>';
print '<td> </td>';
print '<td> </td>';
print '<td> </td>';
print '<td class="liste_titre" align="center">';
print $form->selectarray('status', array('0' => $langs->trans("Disabled"), '1' => $langs->trans("Enabled"), '-2' => $langs->trans("EnabledAndDisabled"), '2' => $langs->trans("Archived")), $status, 1);
print '</td><td class="liste_titre" align="right">';
print '<input class="liste_titre" type="image" src="' . img_picto($langs->trans("Search"), 'search.png', '', '', 1) . '" value="' . dol_escape_htmltag($langs->trans("Search")) . '" title="' . dol_escape_htmltag($langs->trans("Search")) . '">';
print '<input type="image" class="liste_titre" name="button_removefilter" src="' . img_picto($langs->trans("Search"), 'searchclear.png', '', '', 1) . '" value="' . dol_escape_htmltag($langs->trans("RemoveFilter")) . '" title="' . dol_escape_htmltag($langs->trans("RemoveFilter")) . '">';
print '</td>';
print '</tr>';
if ($num > 0) {
// Loop on each job
$style = 'pair';
foreach ($object->lines as $line) {
if (!verifCond($line->test)) {
continue;
}
// Discard line with test = false
// title profil
if ($style == 'pair') {
$style = 'impair';
} else {
$style = 'pair';
}
print '<tr class="' . $style . '">';
print '<td class="nowrap">';
print '<a href="' . DOL_URL_ROOT . '/cron/card.php?id=' . $line->id . '">';
print img_picto('', 'object_cron') . ' ';
print $line->id;
print '</a>';
开发者ID:NoisyBoy86,项目名称:Dolibarr_test,代码行数:31,代码来源:list.php
示例13: testVerifCond
/**
* testVerifCond
*
* @return void
*/
public function testVerifCond()
{
$verifcond=verifCond('1==1');
$this->assertTrue($verifcond);
$verifcond=verifCond('1==2');
$this->assertFalse($verifcond);
$verifcond=verifCond('$conf->facture->enabled');
$this->assertTrue($verifcond);
$verifcond=verifCond('$conf->moduledummy->enabled');
$this->assertFalse($verifcond);
$verifcond=verifCond('');
$this->assertTrue($verifcond);
}
开发者ID:nrjacker4,项目名称:crm-php,代码行数:22,代码来源:FunctionsTest.php
示例14: complete_head_from_modules
|
请发表评论