本文整理汇总了PHP中UserRights::GetContactId方法的典型用法代码示例。如果您正苦于以下问题:PHP UserRights::GetContactId方法的具体用法?PHP UserRights::GetContactId怎么用?PHP UserRights::GetContactId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserRights
的用法示例。
在下文中一共展示了UserRights::GetContactId方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: DisplaySearchForm
public function DisplaySearchForm($sClass, $aAttList, $aExtraParams, $sPrefix, $bClosed = true)
{
$oUserOrg = $this->GetUserOrg();
$aFilterParams = array('org_id' => $oUserOrg->GetKey(), 'contact_id' => UserRights::GetContactId());
$sCSSClass = $bClosed ? 'DrawerClosed' : '';
$this->add("<div id=\"ds_{$sPrefix}\" class=\"SearchDrawer {$sCSSClass}\">\n");
$this->add_ready_script(<<<EOF
\t\t\$("#dh_{$sPrefix}").click( function() {
\t\t\$("#ds_{$sPrefix}").slideToggle('normal', function() { \$("#ds_{$sPrefix}").parent().resize(); } );
\t\t\$("#dh_{$sPrefix}").toggleClass('open');
\t});
EOF
);
$this->add("<form id=\"search_{$sClass}\" action=\"\" method=\"post\">\n");
// Don't use $_SERVER['SCRIPT_NAME'] since the form may be called asynchronously (from ajax.php)
// $this->add("<h2>".Dict::Format('UI:SearchFor_Class_Objects', 'xxxxxx')."</h2>\n");
$this->add("<p>\n");
foreach ($aAttList as $sAttSpec) {
//$oAppContext->Reset($sAttSpec); // Make sure the same parameter will not be passed twice
$this->DisplaySearchField($sClass, $sAttSpec, $aExtraParams, $sPrefix, null, $aFilterParams);
}
$this->add("</p>\n");
$this->add("<p align=\"right\"><input type=\"submit\" value=\"" . Dict::S('UI:Button:Search') . "\"></p>\n");
foreach ($aExtraParams as $sName => $sValue) {
// Note: use DumpHiddenParams() to transmit arrays as hidden params
if (is_scalar($sValue)) {
$this->add("<input type=\"hidden\" name=\"{$sName}\" value=\"{$sValue}\" />\n");
}
}
// $this->add($oAppContext->GetForForm());
$this->add("</form>\n");
$this->add("</div>\n");
$this->add("<div class=\"HRDrawer\"></div>\n");
$this->add("<div id=\"dh_{$sPrefix}\" class=\"DrawerHandle\">" . Dict::S('UI:SearchToggle') . "</div>\n");
}
示例2: GetUserOrg
/**
* Get The organization of the current user (i.e. the organization of its contact)
* @param WebPage $oP The current page, for errors output
* @return Organization The user's org or null in case of problem...
*/
function GetUserOrg()
{
$oOrg = null;
$iContactId = UserRights::GetContactId();
$oContact = MetaModel::GetObject('Contact', $iContactId, false);
// false => Can fail
if (is_object($oContact)) {
$oOrg = MetaModel::GetObject('Organization', $oContact->Get('org_id'), false);
// false => can fail
} else {
throw new Exception(Dict::S('Portal:ErrorNoContactForThisUser'));
}
return $oOrg;
}
示例3: ExpandArgs
protected function ExpandArgs()
{
$aScalarArgs = $this->m_oFilter->GetInternalParams();
foreach ($this->m_aArgs as $sArgName => $value) {
if (MetaModel::IsValidObject($value)) {
if (strpos($sArgName, '->object()') === false) {
// Lazy syntax - develop the object contextual parameters
$aScalarArgs = array_merge($aScalarArgs, $value->ToArgsForQuery($sArgName));
} else {
// Leave as is
$aScalarArgs[$sArgName] = $value;
}
} else {
if (!is_array($value)) {
$aScalarArgs[$sArgName] = (string) $value;
}
}
}
$aScalarArgs['current_contact_id'] = UserRights::GetContactId();
return $aScalarArgs;
}
示例4: SetDefaultOrgId
/**
* Give a default value for item_org_id (if relevant...)
* @return void
*/
public function SetDefaultOrgId()
{
// First check that the organization CAN be fetched from the target class
//
$sClass = $this->Get('item_class');
$aCallSpec = array($sClass, 'MapContextParam');
if (is_callable($aCallSpec)) {
$sAttCode = call_user_func($aCallSpec, 'org_id');
// Returns null when there is no mapping for this parameter
if (MetaModel::IsValidAttCode($sClass, $sAttCode)) {
// Second: check that the organization CAN be fetched from the current user
//
if (MetaModel::IsValidClass('Person')) {
$aCallSpec = array($sClass, 'MapContextParam');
if (is_callable($aCallSpec)) {
$sAttCode = call_user_func($aCallSpec, 'org_id');
// Returns null when there is no mapping for this parameter
if (MetaModel::IsValidAttCode($sClass, $sAttCode)) {
// OK - try it
//
$oCurrentPerson = MetaModel::GetObject('Person', UserRights::GetContactId(), false);
if ($oCurrentPerson) {
$this->Set('item_org_id', $oCurrentPerson->Get($sAttCode));
}
}
}
}
}
}
}
示例5: PrepareQueryArguments
public static function PrepareQueryArguments($aArgs)
{
// Translate any object into scalars
//
$aScalarArgs = array();
foreach ($aArgs as $sArgName => $value) {
if (self::IsValidObject($value)) {
if (strpos($sArgName, '->object()') === false) {
// Lazy syntax - develop the object contextual parameters
$aScalarArgs = array_merge($aScalarArgs, $value->ToArgsForQuery($sArgName));
} else {
// Leave as is
$aScalarArgs[$sArgName] = $value;
}
} else {
if (is_scalar($value)) {
$aScalarArgs[$sArgName] = (string) $value;
} elseif (is_null($value)) {
$aScalarArgs[$sArgName] = null;
}
}
}
// Add standard contextual arguments
//
$aScalarArgs['current_contact_id'] = UserRights::GetContactId();
return $aScalarArgs;
}
示例6: SetCurrentPerson
/**
* Lifecycle action: Set the current logged in CONTACT for the given attribute
*/
public function SetCurrentPerson($sAttCode)
{
$oAttDef = MetaModel::GetAttributeDef(get_class($this), $sAttCode);
if ($oAttDef instanceof AttributeString) {
$iPerson = UserRights::GetContactId();
if ($iPerson == 0) {
$this->Set($sAttCode, '');
} else {
$oPerson = MetaModel::GetObject('Person', $iPerson);
$this->Set($sAttCode, $oPerson->Get('friendlyname'));
}
} else {
if ($oAttDef->IsExternalKey()) {
if (!MetaModel::IsParentClass($oAttDef->GetTargetClass(), 'Person')) {
throw new Exception("SetCurrentContact: the attribute {$sAttCode} must be an external key to 'Person' or any other class above 'Person', found '" . $oAttDef->GetTargetClass() . "'");
}
}
$this->Set($sAttCode, UserRights::GetContactId());
}
return true;
}