+ *
+ * @property \Combodo\iTop\Form\Field\SelectObjectField $oField
*/
class BsSelectObjectFieldRenderer extends FieldRenderer
{
- /**
- * Returns a RenderingOutput for the FieldRenderer's Field
- *
- * @return \Combodo\iTop\Renderer\RenderingOutput
- *
- * @throws \Exception
- * @throws \CoreException
- * @throws \ArchivedObjectException
- */
+ /**
+ * Returns a RenderingOutput for the FieldRenderer's Field
+ *
+ * @return \Combodo\iTop\Renderer\RenderingOutput
+ *
+ * @throws \Exception
+ * @throws \CoreException
+ * @throws \ArchivedObjectException
+ */
public function Render()
{
$oOutput = new RenderingOutput();
- $oOutput->AddCssClass('form_field_' . $this->oField->GetDisplayMode());
+ $oOutput->AddCssClass('form_field_' . $this->oField->GetDisplayMode());
$sFieldValueClass = $this->oField->GetSearch()->GetClass();
$sFieldMandatoryClass = ($this->oField->GetMandatory()) ? 'form_mandatory' : '';
@@ -61,26 +67,26 @@ class BsSelectObjectFieldRenderer extends FieldRenderer
// Rendering field in edition mode
if (!$this->oField->GetReadOnly() && !$this->oField->GetHidden())
{
- // Debug trace: This is very useful when this kind of field doesn't return the expected values.
- if(ContextTag::Check('debug'))
- {
- IssueLog::Info('Form field #'.$this->oField->GetId().' OQL query: '.$this->oField->GetSearch()->ToOQL(true));
- }
+ // Debug trace: This is very useful when this kind of field doesn't return the expected values.
+ if(ContextTag::Check('debug'))
+ {
+ IssueLog::Info('Form field #'.$this->oField->GetId().' OQL query: '.$this->oField->GetSearch()->ToOQL(true));
+ }
// Rendering field
- // - Opening container
+ // - Opening container
$oOutput->AddHtml('');
}
// ... and in read-only mode (or hidden)
@@ -322,11 +328,16 @@ EOF
{
// Note : AllowAllData set to true here instead of checking scope's flag because we are displaying a value that has been set and validated
$oFieldValue = MetaModel::GetObject($sFieldValueClass, $this->oField->GetCurrentValue(), true, true);
- $sFieldValue = $oFieldValue->GetName();
+ $sFieldHtmlValue = $oFieldValue->GetName();
+ if ($this->oField->GetRemoteObjectAccessible())
+ {
+ $sFieldUrl = ApplicationContext::MakeObjectUrl($sFieldValueClass, $this->oField->GetCurrentValue());
+ $sFieldHtmlValue = ''.$sFieldHtmlValue.'';
+ }
}
else
{
- $sFieldValue = Dict::S('UI:UndefinedObject');
+ $sFieldHtmlValue = Dict::S('UI:UndefinedObject');
}
// Opening container
@@ -335,18 +346,18 @@ EOF
// Showing label / value only if read-only but not hidden
if (!$this->oField->GetHidden())
{
- // Label
- $oOutput->AddHtml('');
- // Value
- $oOutput->AddHtml('');
+ // Value
+ $oOutput->AddHtml('');
}
// Adding hidden value
@@ -366,8 +377,8 @@ EOF
*/
protected function RenderHierarchicalSearch(RenderingOutput &$oOutput)
{
- if ($this->oField->GetHierarchical())
- {
+ if ($this->oField->GetHierarchical())
+ {
$sHierarchicalButtonId = 's_hi_' . $this->oField->GetGlobalId();
$sEndpoint = str_replace('-sMode-', 'hierarchy', $this->oField->GetSearchEndpoint());
@@ -415,7 +426,7 @@ EOF
$sSearchButtonId = 's_rg_' . $this->oField->GetGlobalId();
$sEndpoint = str_replace('-sMode-', 'from-attribute', $this->oField->GetSearchEndpoint());
- $oOutput->AddHtml('
');
+ $oOutput->AddHtml('
');
$oOutput->AddJs(
<<