本文整理汇总了PHP中VTWorkflowManager::getRACRuleForRecord方法的典型用法代码示例。如果您正苦于以下问题:PHP VTWorkflowManager::getRACRuleForRecord方法的具体用法?PHP VTWorkflowManager::getRACRuleForRecord怎么用?PHP VTWorkflowManager::getRACRuleForRecord使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VTWorkflowManager
的用法示例。
在下文中一共展示了VTWorkflowManager::getRACRuleForRecord方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getParentTab
/** Returns a list of the associated opportunities */
function get_opportunities($id, $cur_tab_id, $rel_tab_id, $actions = false)
{
global $log, $singlepane_view, $currentModule, $current_user, $adb;
$log->debug("Entering get_opportunities(" . $id . ") method ...");
$this_module = $currentModule;
$related_module = vtlib_getModuleNameById($rel_tab_id);
require_once "modules/{$related_module}/{$related_module}.php";
$other = new $related_module();
vtlib_setup_modulevars($related_module, $other);
$singular_modname = vtlib_toSingular($related_module);
$parenttab = getParentTab();
if ($singlepane_view == 'true') {
$returnset = '&return_module=' . $this_module . '&return_action=DetailView&return_id=' . $id;
} else {
$returnset = '&return_module=' . $this_module . '&return_action=CallRelatedList&return_id=' . $id;
}
$button = '';
if ($actions) {
if (is_string($actions)) {
$actions = explode(',', strtoupper($actions));
}
if (in_array('SELECT', $actions) && isPermitted($related_module, 4, '') == 'yes') {
$button .= "<input title='" . getTranslatedString('LBL_SELECT') . " " . getTranslatedString($related_module) . "' class='crmbutton small edit' type='button' onclick=\"return window.open('index.php?module={$related_module}&return_module={$currentModule}&action=Popup&popuptype=detailview&select=enable&form=EditView&form_submit=false&recordid={$id}&parenttab={$parenttab}','test','width=640,height=602,resizable=0,scrollbars=0');\" value='" . getTranslatedString('LBL_SELECT') . " " . getTranslatedString($related_module) . "'> ";
}
if (in_array('ADD', $actions) && isPermitted($related_module, 1, '') == 'yes') {
$wfs = new VTWorkflowManager($adb);
$racbr = $wfs->getRACRuleForRecord($currentModule, $id);
if (!$racbr or $racbr->hasRelatedListPermissionTo('create', $related_module)) {
$button .= "<input title='" . getTranslatedString('LBL_NEW') . " " . getTranslatedString($singular_modname) . "' class='crmbutton small create'" . " onclick='this.form.action.value=\"EditView\";this.form.module.value=\"{$related_module}\";' type='submit' name='button'" . " value='" . getTranslatedString('LBL_ADD_NEW') . " " . getTranslatedString($singular_modname) . "'> ";
}
}
}
$userNameSql = getSqlForNameInDisplayFormat(array('first_name' => 'vtiger_users.first_name', 'last_name' => 'vtiger_users.last_name'), 'Users');
$query = 'select case when (vtiger_users.user_name not like "") then ' . $userNameSql . ' else vtiger_groups.groupname end as user_name,
vtiger_contactdetails.accountid, vtiger_contactdetails.contactid , vtiger_potential.potentialid, vtiger_potential.potentialname,
vtiger_potential.potentialtype, vtiger_potential.sales_stage, vtiger_potential.amount, vtiger_potential.closingdate,
vtiger_potential.related_to, vtiger_crmentity.crmid, vtiger_crmentity.smownerid, vtiger_account.accountname
from vtiger_contactdetails
left join vtiger_contpotentialrel on vtiger_contpotentialrel.contactid=vtiger_contactdetails.contactid
left join vtiger_potential on (vtiger_potential.potentialid = vtiger_contpotentialrel.potentialid or vtiger_potential.related_to=vtiger_contactdetails.contactid)
inner join vtiger_crmentity on vtiger_crmentity.crmid = vtiger_potential.potentialid
left join vtiger_account on vtiger_account.accountid=vtiger_contactdetails.accountid
left join vtiger_groups on vtiger_groups.groupid=vtiger_crmentity.smownerid
left join vtiger_users on vtiger_users.id=vtiger_crmentity.smownerid
where vtiger_contactdetails.contactid =' . $id . '
and (vtiger_contactdetails.accountid = vtiger_potential.related_to or vtiger_contactdetails.contactid=vtiger_potential.related_to)
and vtiger_crmentity.deleted=0';
$return_value = GetRelatedList($this_module, $related_module, $other, $query, $button, $returnset);
if ($return_value == null) {
$return_value = array();
}
$return_value['CUSTOM_BUTTON'] = $button;
$log->debug("Exiting get_opportunities method ...");
return $return_value;
}
示例2: getParentTab
/**
* Default (generic) function to handle the dependents list for the module.
* NOTE: UI type '10' is used to stored the references to other modules for a given record.
* These dependent records can be retrieved through this function.
* For eg: A trouble ticket can be related to an Account or a Contact.
* From a given Contact/Account if we need to fetch all such dependent trouble tickets, get_dependents_list function can be used.
*/
function get_dependents_list($id, $cur_tab_id, $rel_tab_id, $actions = false)
{
global $currentModule, $app_strings, $singlepane_view, $current_user, $adb;
$parenttab = getParentTab();
$related_module = vtlib_getModuleNameById($rel_tab_id);
$other = CRMEntity::getInstance($related_module);
// Some standard module class doesn't have required variables
// that are used in the query, they are defined in this generic API
vtlib_setup_modulevars($currentModule, $this);
vtlib_setup_modulevars($related_module, $other);
$singular_modname = 'SINGLE_' . $related_module;
$button = '';
// To make the edit or del link actions to return back to same view.
if ($singlepane_view == 'true') {
$returnset = "&return_module={$currentModule}&return_action=DetailView&return_id={$id}";
} else {
$returnset = "&return_module={$currentModule}&return_action=CallRelatedList&return_id={$id}";
}
$return_value = null;
$dependentFieldSql = $this->db->pquery("SELECT tabid, tablename, fieldname, columnname FROM vtiger_field WHERE uitype='10' AND" . " fieldid IN (SELECT fieldid FROM vtiger_fieldmodulerel WHERE relmodule=? AND module=?)", array($currentModule, $related_module));
$numOfFields = $this->db->num_rows($dependentFieldSql);
if ($numOfFields > 0) {
$relconds = array();
while ($depflds = $this->db->fetch_array($dependentFieldSql)) {
$dependentTable = $depflds['tablename'];
if ($dependentTable != $other->table_name and !in_array($dependentTable, $other->related_tables)) {
$relidx = isset($other->tab_name_index[$dependentTable]) ? $other->tab_name_index[$dependentTable] : $other->table_index;
$other->related_tables[$dependentTable] = array($relidx, $other->table_name, $other->table_index);
}
$dependentColumn = $depflds['columnname'];
$dependentField = $depflds['fieldname'];
$relconds[] = "{$this->table_name}.{$this->table_index} = {$dependentTable}.{$dependentColumn}";
$button .= '<input type="hidden" name="' . $dependentColumn . '" id="' . $dependentColumn . '" value="' . $id . '">';
$button .= '<input type="hidden" name="' . $dependentColumn . '_type" id="' . $dependentColumn . '_type" value="' . $currentModule . '">';
}
$relationconditions = '(' . implode(' or ', $relconds) . ')';
if ($actions) {
if (is_string($actions)) {
$actions = explode(',', strtoupper($actions));
}
$wfs = '';
if (in_array('ADD', $actions) && isPermitted($related_module, 1, '') == 'yes' && getFieldVisibilityPermission($related_module, $current_user->id, $dependentField, 'readwrite') == '0') {
$wfs = new VTWorkflowManager($adb);
$racbr = $wfs->getRACRuleForRecord($currentModule, $id);
if (!$racbr or $racbr->hasRelatedListPermissionTo('create', $related_module)) {
$button .= "<input title='" . getTranslatedString('LBL_ADD_NEW') . " " . getTranslatedString($singular_modname, $related_module) . "' class='crmbutton small create'" . " onclick='this.form.action.value=\"EditView\";this.form.module.value=\"{$related_module}\"' type='submit' name='button'" . " value='" . getTranslatedString('LBL_ADD_NEW') . " " . getTranslatedString($singular_modname, $related_module) . "'> ";
}
}
}
$query = "SELECT vtiger_crmentity.*, {$other->table_name}.*";
$userNameSql = getSqlForNameInDisplayFormat(array('first_name' => 'vtiger_users.first_name', 'last_name' => 'vtiger_users.last_name'), 'Users');
$query .= ", CASE WHEN (vtiger_users.user_name NOT LIKE '') THEN {$userNameSql} ELSE vtiger_groups.groupname END AS user_name";
$more_relation = '';
if (!empty($other->related_tables)) {
foreach ($other->related_tables as $tname => $relmap) {
$query .= ", {$tname}.*";
// Setup the default JOIN conditions if not specified
if (empty($relmap[1])) {
$relmap[1] = $other->table_name;
}
if (empty($relmap[2])) {
$relmap[2] = $relmap[0];
}
$more_relation .= " LEFT JOIN {$tname} ON {$tname}.{$relmap['0']} = {$relmap['1']}.{$relmap['2']}";
}
}
$query .= " FROM {$other->table_name}";
$query .= " INNER JOIN vtiger_crmentity ON vtiger_crmentity.crmid = {$other->table_name}.{$other->table_index}";
$query .= $more_relation;
$query .= " INNER JOIN {$this->table_name} ON {$relationconditions}";
$query .= " LEFT JOIN vtiger_users ON vtiger_users.id = vtiger_crmentity.smownerid";
$query .= " LEFT JOIN vtiger_groups ON vtiger_groups.groupid = vtiger_crmentity.smownerid";
$query .= " WHERE vtiger_crmentity.deleted = 0 AND {$this->table_name}.{$this->table_index} = {$id}";
$return_value = GetRelatedList($currentModule, $related_module, $other, $query, $button, $returnset);
}
if ($return_value == null) {
$return_value = array();
}
$return_value['CUSTOM_BUTTON'] = $button;
return $return_value;
}
示例3: getListViewEntries
//.........这里部分代码省略.........
$parentModule = $moduleList[0];
} else {
$parentModule = $this->typeList[$value];
}
if (!empty($value) && !empty($this->nameList[$fieldName]) && !empty($parentModule)) {
$parentMeta = $this->queryGenerator->getMeta($parentModule);
$value = textlength_check($this->nameList[$fieldName][$value]);
if ($parentMeta->isModuleEntity() && $parentModule != "Users") {
$value = "<a href='index.php?module={$parentModule}&action=DetailView&" . "record={$rawValue}' title='" . getTranslatedString($parentModule, $parentModule) . "'>{$value}</a>";
$modMetaInfo = getEntityFieldNames($parentModule);
$fieldName = is_array($modMetaInfo['fieldname']) ? $modMetaInfo['fieldname'][0] : $modMetaInfo['fieldname'];
// vtlib customization: For listview javascript triggers
$value = "{$value} <span type='vtlib_metainfo' vtrecordid='{$rawValue}' vtfieldname=" . "'{$fieldName}' vtmodule='{$parentModule}' style='display:none;'></span>";
}
} else {
$value = '--';
}
} elseif ($field->getFieldDataType() == 'owner') {
if ($fieldName != 'assigned_user_id' && strstr($fieldName, ".assigned_user_id")) {
$value = textlength_check($this->ownerNameListrel[$fieldName][$value]);
} else {
$value = textlength_check($this->ownerNameList[$fieldName][$value]);
}
} elseif ($field->getUIType() == 25) {
//TODO clean request object reference.
$contactId = $_REQUEST['record'];
$emailId = $this->db->query_result($result, $i, "activityid");
$result1 = $this->db->pquery("SELECT access_count FROM vtiger_email_track WHERE " . "crmid=? AND mailid=?", array($contactId, $emailId));
$value = $this->db->query_result($result1, 0, "access_count");
if (!$value) {
$value = 0;
}
} elseif ($field->getUIType() == 8) {
if (!empty($value)) {
$temp_val = html_entity_decode($value, ENT_QUOTES, $default_charset);
$json = new Zend_Json();
$value = vt_suppressHTMLTags(implode(',', $json->decode($temp_val)));
}
} elseif (in_array($uitype, array(7, 9, 90))) {
$value = "<span align='right'>" . textlength_check($value) . "</div>";
} elseif ($field->getUIType() == 55) {
$value = getTranslatedString($value, $currentModule);
} else {
$value = textlength_check($value);
}
if ($field->getFieldDataType() != 'reference') {
$parenttab = getParentTab();
$nameFields = $this->queryGenerator->getModuleNameFields($module);
$nameFieldList = explode(',', $nameFields);
if (in_array($fieldName, $nameFieldList) && $module != 'Emails') {
$value = "<a href='index.php?module={$module}&parenttab={$parenttab}&action=DetailView&record=" . "{$recordId}' title='" . getTranslatedString($module, $module) . "'>{$value}</a>";
} elseif ($fieldName == $focus->list_link_field && $module != 'Emails') {
$value = "<a href='index.php?module={$module}&parenttab={$parenttab}&action=DetailView&record=" . "{$recordId}' title='" . getTranslatedString($module, $module) . "'>{$value}</a>";
}
// vtlib customization: For listview javascript triggers
$value = "{$value} <span type='vtlib_metainfo' vtrecordid='{$recordId}' vtfieldname=" . "'{$fieldName}' vtmodule='{$module}' style='display:none;'></span>";
// END
}
$row[] = $value;
}
//Added for Actions ie., edit and delete links in listview
$actionLinkInfo = "";
if (isPermitted($module, "EditView", "") == 'yes') {
$racbr = $wfs->getRACRuleForRecord($currentModule, $recordId);
if (!$racbr or $racbr->hasListViewPermissionTo('edit')) {
$edit_link = $this->getListViewEditLink($module, $recordId);
if (isset($navigationInfo['start']) && $navigationInfo['start'] > 1 && $module != 'Emails') {
$actionLinkInfo .= "<a href=\"{$edit_link}&start=" . $navigationInfo['start'] . "\">" . getTranslatedString("LNK_EDIT", $module) . "</a> ";
} else {
$actionLinkInfo .= "<a href=\"{$edit_link}\">" . getTranslatedString("LNK_EDIT", $module) . "</a> ";
}
}
}
if (isPermitted($module, "Delete", "") == 'yes') {
$racbr = $wfs->getRACRuleForRecord($currentModule, $recordId);
if (!$racbr or $racbr->hasListViewPermissionTo('delete')) {
$del_link = $this->getListViewDeleteLink($module, $recordId);
if ($actionLinkInfo != "" && $del_link != "") {
$actionLinkInfo .= ' | ';
}
if ($del_link != "") {
$actionLinkInfo .= "<a href='javascript:confirmdelete(\"" . addslashes(urlencode($del_link)) . "\")'>" . getTranslatedString('LNK_DELETE', $module) . '</a>';
}
}
}
// Record Change Notification
if (method_exists($focus, 'isViewed') && PerformancePrefs::getBoolean('LISTVIEW_RECORD_CHANGE_INDICATOR', true)) {
if (!$focus->isViewed($recordId)) {
$actionLinkInfo .= " | <img src='" . vtiger_imageurl('important1.gif', $theme) . "' border=0>";
}
}
// END
if ($actionLinkInfo != "" && !$skipActions) {
$row[] = $actionLinkInfo;
}
list($row, $unused, $unused2) = cbEventHandler::do_filter('corebos.filter.listview.render', array($row, $this->db->query_result_rowdata($result, $i), $recordId));
$data[$recordId] = $row;
}
return $data;
}
示例4: _vtisPermitted
//.........这里部分代码省略.........
return $permission;
}
if ($profileActionPermission[$tabid][$actionid] != 0 && $profileActionPermission[$tabid][$actionid] != '') {
$permission = "no";
$log->debug("Exiting isPermitted method ...");
return $permission;
}
//Checking and returning true if recorid is null
if ($record_id == '') {
$permission = "yes";
$log->debug("Exiting isPermitted method ...");
return $permission;
}
//If modules is Faq or PriceBook then no sharing
if ($record_id != '') {
if (getTabOwnedBy($module) == 1) {
$permission = "yes";
$log->debug("Exiting isPermitted method ...");
return $permission;
}
}
//Retreiving the RecordOwnerId
$recOwnType = '';
$recOwnId = '';
$recordOwnerArr = getRecordOwnerId($record_id);
foreach ($recordOwnerArr as $type => $id) {
$recOwnType = $type;
$recOwnId = $id;
}
//Retreiving the default Organisation sharing Access
$others_permission_id = $defaultOrgSharingPermission[$tabid];
if ($recOwnType == 'Users') {
$wfs = new VTWorkflowManager($adb);
$racbr = $wfs->getRACRuleForRecord($module, $record_id);
//Checking if the Record Owner is the current User
if ($current_user->id == $recOwnId) {
if ($actionname != 'EditView' and $actionname != 'Delete' and $actionname != 'DetailView' and $actionname != 'CreateView' or (!$racbr or $racbr->hasDetailViewPermissionTo($actionname, true))) {
$permission = 'yes';
} else {
$permission = 'no';
}
$log->debug("Exiting isPermitted method ...");
return $permission;
}
//Checking if the Record Owner is the Subordinate User
foreach ($subordinate_roles_users as $roleid => $userids) {
if (in_array($recOwnId, $userids)) {
$permission = 'yes';
$log->debug("Exiting isPermitted method ...");
return $permission;
}
}
if ($racbr !== false and $racbr->hasDetailViewPermissionTo($actionname, false)) {
$log->debug("Exiting isPermitted method via RAC User...");
return 'yes';
}
} elseif ($recOwnType == 'Groups') {
//Checking if the record owner is the current user's group
if (in_array($recOwnId, $current_user_groups)) {
$wfs = new VTWorkflowManager($adb);
$racbr = $wfs->getRACRuleForRecord($module, $record_id);
if ($actionname != 'EditView' and $actionname != 'Delete' and $actionname != 'DetailView' and $actionname != 'CreateView' or (!$racbr or $racbr->hasDetailViewPermissionTo($actionname))) {
$permission = 'yes';
} else {
$permission = 'no';
}
示例5: getListViewEntries
//.........这里部分代码省略.........
if (Emails::EmailHasBeenSent($entity_id)) {
$value = getValue($ui_col_array, $list_result, $fieldname, $focus, $module, $entity_id, $list_result_count, "list", "", $returnset, $oCv->setdefaultviewid);
} else {
$value = '';
}
}
} elseif ($module == 'Calendar' && ($fieldname != 'taskstatus' && $fieldname != 'eventstatus')) {
if ($activitytype == 'Task') {
if (getFieldVisibilityPermission('Calendar', $current_user->id, $fieldname) == '0') {
$list_result_count = $i - 1;
$value = getValue($ui_col_array, $list_result, $fieldname, $focus, $module, $entity_id, $list_result_count, "list", "", $returnset, $oCv->setdefaultviewid);
} else {
$value = '';
}
} else {
if (getFieldVisibilityPermission('Events', $current_user->id, $fieldname) == '0') {
$list_result_count = $i - 1;
$value = getValue($ui_col_array, $list_result, $fieldname, $focus, $module, $entity_id, $list_result_count, "list", "", $returnset, $oCv->setdefaultviewid);
} else {
$value = '';
}
}
} elseif ($module == 'PriceBooks' && $fieldname == 'listprice') {
$val_raw = $adb->query_result($list_result, $i - 1, $fieldname);
$value = $val_raw;
} else {
$list_result_count = $i - 1;
$value = getValue($ui_col_array, $list_result, $fieldname, $focus, $module, $entity_id, $list_result_count, "list", "", $returnset, $oCv->setdefaultviewid);
}
}
// vtlib customization: For listview javascript triggers
if (strpos($value, 'vtlib_metainfo') === false) {
$value = "{$value} <span type='vtlib_metainfo' vtrecordid='{$entity_id}' vtfieldname='{$fieldname}' vtmodule='{$module}' style='display:none;'></span>";
}
// END
if ($module == "Calendar" && $name == 'Close') {
if (isPermitted("Calendar", "EditView") == 'yes') {
if (getFieldVisibilityPermission('Events', $current_user->id, 'eventstatus') == '0' || getFieldVisibilityPermission('Calendar', $current_user->id, 'taskstatus') == '0') {
array_push($list_header, $value);
}
}
} else {
$list_header[] = $value;
}
}
}
$varreturnset = '';
if ($returnset == '') {
$varreturnset = '&return_module=' . $module . '&return_action=index';
} else {
$varreturnset = $returnset;
}
if ($module == 'Calendar') {
$actvity_type = $adb->query_result($list_result, $list_result_count, 'activitytype');
if ($actvity_type == 'Task') {
$varreturnset .= '&activity_mode=Task';
} else {
$varreturnset .= '&activity_mode=Events';
}
}
//Added for Actions ie., edit and delete links in listview
$links_info = '';
if (!(is_array($selectedfields) && $selectedfields != '')) {
if (isPermitted($module, 'EditView', '') == 'yes') {
$racbr = $wfs->getRACRuleForRecord($module, $entity_id);
if (!$racbr or $racbr->hasListViewPermissionTo('edit')) {
$edit_link = getListViewEditLink($module, $entity_id, $relatedlist, $varreturnset, $list_result, $list_result_count);
$links_info .= "<a href=\"{$edit_link}{$linkstart}\">" . $app_strings['LNK_EDIT'] . "</a> ";
}
}
if (isPermitted($module, 'Delete', '') == 'yes') {
$racbr = $wfs->getRACRuleForRecord($module, $entity_id);
if (!$racbr or $racbr->hasListViewPermissionTo('delete')) {
$del_link = getListViewDeleteLink($module, $entity_id, $relatedlist, $varreturnset, $linkstart);
if ($links_info != '' && $del_link != '') {
$links_info .= ' | ';
}
if ($del_link != '') {
$links_info .= "<a href='javascript:confirmdelete(\"" . addslashes(urlencode($del_link)) . "\")'>" . $app_strings["LNK_DELETE"] . "</a>";
}
}
}
}
// Record Change Notification
if (method_exists($focus, 'isViewed') && PerformancePrefs::getBoolean('LISTVIEW_RECORD_CHANGE_INDICATOR', true)) {
if (!$focus->isViewed($entity_id)) {
$links_info .= " | <img src='" . vtiger_imageurl('important1.gif', $theme) . "' border=0>";
}
}
// END
if ($links_info != "" && !$skipActions) {
$list_header[] = $links_info;
}
list($list_header, $unused, $unused2) = cbEventHandler::do_filter('corebos.filter.listview.render', array($list_header, $adb->query_result_rowdata($list_result, $i - 1), $entity_id));
$list_block[$entity_id] = $list_header;
}
}
$log->debug("Exiting getListViewEntries method ...");
return $list_block;
}