本文整理汇总了PHP中Vtiger_Utils::implodestr方法的典型用法代码示例。如果您正苦于以下问题:PHP Vtiger_Utils::implodestr方法的具体用法?PHP Vtiger_Utils::implodestr怎么用?PHP Vtiger_Utils::implodestr使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Vtiger_Utils
的用法示例。
在下文中一共展示了Vtiger_Utils::implodestr方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getAllByType
/**
* Get all the link related to module based on type
* @param Integer Module ID
* @param mixed String or List of types to select
* @param Map Key-Value pair to use for formating the link url
*/
static function getAllByType($tabid, $type = false, $parameters = false)
{
$adb = PearDatabase::getInstance();
$current_user = vglobal('current_user');
self::__initSchema();
$multitype = false;
if ($type) {
// Multiple link type selection?
if (is_array($type)) {
$multitype = true;
if ($tabid === self::IGNORE_MODULE) {
$sql = 'SELECT * FROM vtiger_links WHERE linktype IN (' . Vtiger_Utils::implodestr('?', count($type), ',') . ') ';
$params = $type;
$permittedTabIdList = getPermittedModuleIdList();
if (count($permittedTabIdList) > 0 && $current_user->is_admin !== 'on') {
array_push($permittedTabIdList, 0);
// Added to support one link for all modules
$sql .= ' and tabid IN (' . Vtiger_Utils::implodestr('?', count($permittedTabIdList), ',') . ')';
$params[] = $permittedTabIdList;
}
$result = $adb->pquery($sql, array($adb->flatten_array($params)));
} else {
$result = $adb->pquery('SELECT * FROM vtiger_links WHERE (tabid=? OR tabid=0) AND linktype IN (' . Vtiger_Utils::implodestr('?', count($type), ',') . ')', array($tabid, $adb->flatten_array($type)));
}
} else {
// Single link type selection
if ($tabid === self::IGNORE_MODULE) {
$result = $adb->pquery('SELECT * FROM vtiger_links WHERE linktype=?', array($type));
} else {
$result = $adb->pquery('SELECT * FROM vtiger_links WHERE (tabid=? OR tabid=0) AND linktype=?', array($tabid, $type));
}
}
} else {
$result = $adb->pquery('SELECT * FROM vtiger_links WHERE tabid=?', array($tabid));
}
$strtemplate = new Vtiger_StringTemplate();
if ($parameters) {
foreach ($parameters as $key => $value) {
$strtemplate->assign($key, $value);
}
}
$instances = array();
if ($multitype) {
foreach ($type as $t) {
$instances[$t] = array();
}
}
while ($row = $adb->fetch_array($result)) {
$skipLink = false;
$instance = new self();
$instance->initialize($row);
if (!empty($row['handler_path']) && isFileAccessible($row['handler_path'])) {
checkFileAccessForInclusion($row['handler_path']);
require_once $row['handler_path'];
$linkData = new Vtiger_LinkData($instance, $current_user);
$ignore = call_user_func(array($row['handler_class'], $row['handler']), $linkData);
if (!$ignore) {
self::log("Ignoring Link ... " . var_export($row, true));
continue;
}
}
if ($parameters) {
$instance->linkurl = $strtemplate->merge($instance->linkurl);
$instance->linkicon = $strtemplate->merge($instance->linkicon);
}
if ($instance->linktype == 'LISTVIEWSIDEBARWIDGET' || $instance->linktype == 'DETAILVIEWSIDEBARWIDGET') {
parse_str($instance->linkurl, $linkurl);
if (isset($linkurl['module']) && !Users_Privileges_Model::isPermitted($linkurl['module'], 'DetailView')) {
$skipLink = true;
}
}
if (!$skipLink) {
if ($multitype) {
$instances[$instance->linktype][] = $instance;
} else {
$instances[$instance->linktype] = $instance;
}
}
}
return $instances;
}
示例2: getAllByType
/**
* Get all the link related to module based on type
* @param Integer Module ID
* @param mixed String or List of types to select
* @param Map Key-Value pair to use for formating the link url
*/
static function getAllByType($tabid, $type = false, $parameters = false)
{
global $adb, $current_user;
self::__initSchema();
$multitype = false;
$orderby = " order by linktype,sequence";
if ($type) {
// Multiple link type selection?
if (is_array($type)) {
$multitype = true;
if ($tabid === self::IGNORE_MODULE) {
$sql = 'SELECT * FROM vtiger_links WHERE linktype IN (' . Vtiger_Utils::implodestr('?', count($type), ',') . ') ';
$params = $type;
$permittedTabIdList = getPermittedModuleIdList();
if (count($permittedTabIdList) > 0 && $current_user->is_admin !== 'on') {
$sql .= ' and tabid IN (' . Vtiger_Utils::implodestr('?', count($permittedTabIdList), ',') . ')';
$params[] = $permittedTabIdList;
}
$result = $adb->pquery($sql . $orderby, array($adb->flatten_array($params)));
} else {
$result = $adb->pquery('SELECT * FROM vtiger_links WHERE tabid=? AND linktype IN (' . Vtiger_Utils::implodestr('?', count($type), ',') . ')' . $orderby, array($tabid, $adb->flatten_array($type)));
}
} else {
// Single link type selection
if ($tabid === self::IGNORE_MODULE) {
$result = $adb->pquery('SELECT * FROM vtiger_links WHERE linktype=?' . $orderby, array($type));
} else {
$result = $adb->pquery('SELECT * FROM vtiger_links WHERE tabid=? AND linktype=?' . $orderby, array($tabid, $type));
}
}
} else {
$result = $adb->pquery('SELECT * FROM vtiger_links WHERE tabid=?' . $orderby, array($tabid));
}
$strtemplate = new Vtiger_StringTemplate();
if ($parameters) {
foreach ($parameters as $key => $value) {
$strtemplate->assign($key, $value);
}
}
$instances = array();
if ($multitype) {
foreach ($type as $t) {
$instances[$t] = array();
}
}
while ($row = $adb->fetch_array($result)) {
$instance = new self();
$instance->initialize($row);
if (!empty($row['handler_path']) && isFileAccessible($row['handler_path'])) {
checkFileAccessForInclusion($row['handler_path']);
require_once $row['handler_path'];
$linkData = new Vtiger_LinkData($instance, $current_user);
$ignore = call_user_func(array($row['handler_class'], $row['handler']), $linkData);
if (!$ignore) {
self::log("Ignoring Link ... " . var_export($row, true));
continue;
}
}
if ($parameters) {
$instance->linkurl = $strtemplate->merge($instance->linkurl);
$instance->linkicon = $strtemplate->merge($instance->linkicon);
}
if ($multitype) {
$instances[$instance->linktype][] = $instance;
} else {
$instances[] = $instance;
}
}
return $instances;
}
示例3: getAllByType
/**
* Get all the link related to module based on type
* @param Integer Module ID
* @param mixed String or List of types to select
* @param Map Key-Value pair to use for formating the link url
*/
static function getAllByType($tabid, $type = false, $parameters = false)
{
global $adb;
self::__initSchema();
$multitype = false;
if ($type) {
// Multiple link type selection?
if (is_array($type)) {
$multitype = true;
if ($tabid === self::IGNORE_MODULE) {
$result = $adb->pquery('SELECT * FROM vtiger_links WHERE linktype IN (' . Vtiger_Utils::implodestr('?', count($type), ',') . ')', array($adb->flatten_array($type)));
} else {
$result = $adb->pquery('SELECT * FROM vtiger_links WHERE tabid=? AND linktype IN (' . Vtiger_Utils::implodestr('?', count($type), ',') . ')', array($tabid, $adb->flatten_array($type)));
}
} else {
// Single link type selection
if ($tabid === self::IGNORE_MODULE) {
$result = $adb->pquery('SELECT * FROM vtiger_links WHERE linktype=?', array($type));
} else {
$result = $adb->pquery('SELECT * FROM vtiger_links WHERE tabid=? AND linktype=?', array($tabid, $type));
}
}
} else {
$result = $adb->pquery('SELECT * FROM vtiger_links WHERE tabid=?', array($tabid));
}
$strtemplate = new Vtiger_StringTemplate();
if ($parameters) {
foreach ($parameters as $key => $value) {
$strtemplate->assign($key, $value);
}
}
$instances = array();
if ($multitype) {
foreach ($type as $t) {
$instances[$t] = array();
}
}
while ($row = $adb->fetch_array($result)) {
$instance = new self();
$instance->initialize($row);
if ($parameters) {
$instance->linkurl = $strtemplate->merge($instance->linkurl);
$instance->linkicon = $strtemplate->merge($instance->linkicon);
}
if ($multitype) {
$instances[$instance->linktype][] = $instance;
} else {
$instances[] = $instance;
}
}
return $instances;
}