mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-18 23:08:46 +02:00
Code cleanup: Warning suppression & PHPDoc.
SVN:trunk[5928]
This commit is contained in:
@@ -2623,8 +2623,8 @@ abstract class DBObject implements iDisplay
|
||||
* Associate a portal to a class that implements iDBObjectURLMaker,
|
||||
* and which will be invoked with placeholders like $this->org_id->hyperlink(portal)$
|
||||
*
|
||||
* @param $sPortalId Identifies the portal. Conventions: the main portal is 'console', The user requests portal is 'portal'.
|
||||
* @param $sUrlMakerClass
|
||||
* @param string $sPortalId Identifies the portal. Conventions: the main portal is 'console', The user requests portal is 'portal'.
|
||||
* @param string $sUrlMakerClass
|
||||
*/
|
||||
static public function RegisterURLMakerClass($sPortalId, $sUrlMakerClass)
|
||||
{
|
||||
|
||||
@@ -24,16 +24,19 @@
|
||||
*/
|
||||
class iTopPortalEditUrlMaker implements iDBObjectURLMaker
|
||||
{
|
||||
/**
|
||||
* Generate an (absolute) URL to an object, either in view or edit mode.
|
||||
* Returns null if the current user is not allowed to view / edit object.
|
||||
*
|
||||
* @param string $sClass The class of the object
|
||||
* @param int $iId The identifier of the object
|
||||
* @param string $sMode edit|view
|
||||
*
|
||||
* @return string | null
|
||||
*/
|
||||
/**
|
||||
* Generate an (absolute) URL to an object, either in view or edit mode.
|
||||
* Returns null if the current user is not allowed to view / edit object.
|
||||
*
|
||||
* @param string $sClass The class of the object
|
||||
* @param int $iId The identifier of the object
|
||||
* @param string $sMode edit|view
|
||||
*
|
||||
* @return string | null
|
||||
*
|
||||
* @throws Exception
|
||||
* @throws CoreException
|
||||
*/
|
||||
public static function PrepareObjectURL($sClass, $iId, $sMode)
|
||||
{
|
||||
require_once APPROOT . '/lib/silex/vendor/autoload.php';
|
||||
@@ -75,16 +78,19 @@ class iTopPortalEditUrlMaker implements iDBObjectURLMaker
|
||||
Combodo\iTop\Portal\Helper\ApplicationHelper::LoadScopesConfiguration($oApp, new ModuleDesign($sPortalId));
|
||||
}
|
||||
|
||||
/** @var \Combodo\iTop\Portal\Helper\UrlGenerator $oUrlGenerator */
|
||||
$oUrlGenerator = $oApp['url_generator'];
|
||||
|
||||
// The object is reachable in the specified mode (edit/view)
|
||||
//
|
||||
// Note: Scopes only apply when URL check is triggered from the portal GUI.
|
||||
$sObjectQueryString = null;
|
||||
$sObjectQueryString = null;
|
||||
switch($sMode)
|
||||
{
|
||||
case 'view':
|
||||
if(!ContextTag::Check('GUI:Portal') || Combodo\iTop\Portal\Helper\SecurityHelper::IsActionAllowed($oApp, UR_ACTION_READ, $sClass, $iId))
|
||||
{
|
||||
$sObjectQueryString = $oApp['url_generator']->generate('p_object_view', array('sObjectClass' => $sClass, 'sObjectId' => $iId));
|
||||
$sObjectQueryString = $oUrlGenerator->generate('p_object_view', array('sObjectClass' => $sClass, 'sObjectId' => $iId));
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -93,11 +99,11 @@ class iTopPortalEditUrlMaker implements iDBObjectURLMaker
|
||||
// Checking if user is allowed to edit object, if not we check if it can at least view it.
|
||||
if(!ContextTag::Check('GUI:Portal') || Combodo\iTop\Portal\Helper\SecurityHelper::IsActionAllowed($oApp, UR_ACTION_MODIFY, $sClass, $iId))
|
||||
{
|
||||
$sObjectQueryString = $oApp['url_generator']->generate('p_object_edit', array('sObjectClass' => $sClass, 'sObjectId' => $iId));
|
||||
$sObjectQueryString = $oUrlGenerator->generate('p_object_edit', array('sObjectClass' => $sClass, 'sObjectId' => $iId));
|
||||
}
|
||||
elseif(!ContextTag::Check('GUI:Portal') || Combodo\iTop\Portal\Helper\SecurityHelper::IsActionAllowed($oApp, UR_ACTION_READ, $sClass, $iId))
|
||||
{
|
||||
$sObjectQueryString = $oApp['url_generator']->generate('p_object_view', array('sObjectClass' => $sClass, 'sObjectId' => $iId));
|
||||
$sObjectQueryString = $oUrlGenerator->generate('p_object_view', array('sObjectClass' => $sClass, 'sObjectId' => $iId));
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -126,6 +132,14 @@ class iTopPortalEditUrlMaker implements iDBObjectURLMaker
|
||||
return $sUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $sClass
|
||||
* @param $iId
|
||||
*
|
||||
* @return null|string
|
||||
*
|
||||
* @throws CoreException
|
||||
*/
|
||||
public static function MakeObjectURL($sClass, $iId)
|
||||
{
|
||||
return static::PrepareObjectURL($sClass, $iId, 'edit');
|
||||
|
||||
@@ -403,11 +403,16 @@ class SearchForm
|
||||
return (($oAttDef instanceof AttributeFriendlyName) || ($oAttDef instanceof AttributeExternalField) || ($oAttDef instanceof AttributeSubItem));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \AttributeDefinition $oAttrDef
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
/**
|
||||
* @param \AttributeDefinition $oAttrDef
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @throws \CoreException
|
||||
* @throws \MissingQueryArgument
|
||||
* @throws \MySQLException
|
||||
* @throws \MySQLHasGoneAwayException
|
||||
*/
|
||||
public static function GetFieldAllowedValues($oAttrDef)
|
||||
{
|
||||
$iMaxComboLength = MetaModel::GetConfig()->Get('max_combo_length');
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
// Copyright (C) 2010-2016 Combodo SARL
|
||||
// Copyright (C) 2010-2018 Combodo SARL
|
||||
//
|
||||
// This file is part of iTop.
|
||||
//
|
||||
@@ -19,10 +19,8 @@
|
||||
|
||||
namespace Combodo\iTop\Form\Field;
|
||||
|
||||
use \utils;
|
||||
use \Dict;
|
||||
use \ormDocument;
|
||||
use \Combodo\iTop\Form\Field\Field;
|
||||
use utils;
|
||||
use Dict;
|
||||
|
||||
/**
|
||||
* Description of BlobField
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
// Copyright (C) 2010-2016 Combodo SARL
|
||||
// Copyright (C) 2010-2018 Combodo SARL
|
||||
//
|
||||
// This file is part of iTop.
|
||||
//
|
||||
@@ -19,8 +19,6 @@
|
||||
|
||||
namespace Combodo\iTop\Form\Field;
|
||||
|
||||
use \Combodo\iTop\Form\Field\MultipleChoicesField;
|
||||
|
||||
/**
|
||||
* Description of CheckboxField
|
||||
*
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
// Copyright (C) 2010-2016 Combodo SARL
|
||||
// Copyright (C) 2010-2018 Combodo SARL
|
||||
//
|
||||
// This file is part of iTop.
|
||||
//
|
||||
@@ -19,8 +19,6 @@
|
||||
|
||||
namespace Combodo\iTop\Form\Field;
|
||||
|
||||
use \Combodo\iTop\Form\Field\StringField;
|
||||
|
||||
/**
|
||||
* Description of StringField
|
||||
*/
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
// Copyright (C) 2010-2016 Combodo SARL
|
||||
// Copyright (C) 2010-2018 Combodo SARL
|
||||
//
|
||||
// This file is part of iTop.
|
||||
//
|
||||
@@ -52,7 +52,7 @@ class DateTimeField extends StringField
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string $sFormat
|
||||
* @param string $sDateTimeFormat
|
||||
*
|
||||
* @return \Combodo\iTop\Form\Field\DateTimeField
|
||||
*/
|
||||
@@ -73,7 +73,7 @@ class DateTimeField extends StringField
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string $sFormat
|
||||
* @param string $sDateTimeFormat
|
||||
*
|
||||
* @return \Combodo\iTop\Form\Field\DateTimeField
|
||||
*/
|
||||
@@ -84,14 +84,17 @@ class DateTimeField extends StringField
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the DateOnly flag
|
||||
*
|
||||
* @return \Combodo\iTop\Form\Field\DateTimeField
|
||||
*/
|
||||
/**
|
||||
* Set the DateOnly flag
|
||||
*
|
||||
* @param boolean $bDateOnly
|
||||
*
|
||||
* @return \Combodo\iTop\Form\Field\DateTimeField
|
||||
*/
|
||||
public function SetDateOnly($bDateOnly)
|
||||
{
|
||||
return $this->bDateOnly = $bDateOnly;
|
||||
$this->bDateOnly = $bDateOnly;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
// Copyright (C) 2010-2016 Combodo SARL
|
||||
// Copyright (C) 2010-2018 Combodo SARL
|
||||
//
|
||||
// This file is part of iTop.
|
||||
//
|
||||
@@ -19,9 +19,8 @@
|
||||
|
||||
namespace Combodo\iTop\Form\Field;
|
||||
|
||||
use \Combodo\iTop\Form\Field\Field;
|
||||
use \Str;
|
||||
use \AttributeDuration;
|
||||
use Str;
|
||||
use AttributeDuration;
|
||||
|
||||
/**
|
||||
* Description of StringField
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
// Copyright (C) 2010-2016 Combodo SARL
|
||||
// Copyright (C) 2010-2018 Combodo SARL
|
||||
//
|
||||
// This file is part of iTop.
|
||||
//
|
||||
@@ -19,8 +19,6 @@
|
||||
|
||||
namespace Combodo\iTop\Form\Field;
|
||||
|
||||
use \Combodo\iTop\Form\Field\Field;
|
||||
|
||||
/**
|
||||
* Description of FileUploadField
|
||||
*
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
// Copyright (C) 2010-2016 Combodo SARL
|
||||
// Copyright (C) 2010-2018 Combodo SARL
|
||||
//
|
||||
// This file is part of iTop.
|
||||
//
|
||||
@@ -19,8 +19,6 @@
|
||||
|
||||
namespace Combodo\iTop\Form\Field;
|
||||
|
||||
use \Combodo\iTop\Form\Field\TextField;
|
||||
|
||||
/**
|
||||
* Description of HiddenField
|
||||
*
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
// Copyright (C) 2010-2017 Combodo SARL
|
||||
// Copyright (C) 2010-2018 Combodo SARL
|
||||
//
|
||||
// This file is part of iTop.
|
||||
//
|
||||
@@ -19,10 +19,8 @@
|
||||
|
||||
namespace Combodo\iTop\Form\Field;
|
||||
|
||||
use \utils;
|
||||
use \Dict;
|
||||
use \ormDocument;
|
||||
use \Combodo\iTop\Form\Field\BlobField;
|
||||
use utils;
|
||||
use Dict;
|
||||
|
||||
/**
|
||||
* Description of ImageField
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
// Copyright (C) 2010-2016 Combodo SARL
|
||||
// Copyright (C) 2010-2018 Combodo SARL
|
||||
//
|
||||
// This file is part of iTop.
|
||||
//
|
||||
@@ -19,8 +19,6 @@
|
||||
|
||||
namespace Combodo\iTop\Form\Field;
|
||||
|
||||
use \Combodo\iTop\Form\Field\TextField;
|
||||
|
||||
/**
|
||||
* Description of LabelField
|
||||
*
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
// Copyright (C) 2010-2016 Combodo SARL
|
||||
// Copyright (C) 2010-2018 Combodo SARL
|
||||
//
|
||||
// This file is part of iTop.
|
||||
//
|
||||
@@ -19,8 +19,6 @@
|
||||
|
||||
namespace Combodo\iTop\Form\Field;
|
||||
|
||||
use \Combodo\iTop\Form\Field\Field;
|
||||
|
||||
/**
|
||||
* Description of LinkedSetField
|
||||
*
|
||||
@@ -69,7 +67,7 @@ class LinkedSetField extends Field
|
||||
public function SetTargetClass($sTargetClass)
|
||||
{
|
||||
$this->sTargetClass = $sTargetClass;
|
||||
return $sTargetClass;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -89,7 +87,7 @@ class LinkedSetField extends Field
|
||||
public function SetExtKeyToRemote($sExtKeyToRemote)
|
||||
{
|
||||
$this->sExtKeyToRemote = $sExtKeyToRemote;
|
||||
return $sExtKeyToRemote;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -137,7 +135,8 @@ class LinkedSetField extends Field
|
||||
/**
|
||||
* Returns a hash array of attributes to be displayed in the linkedset in the form $sAttCode => $sAttLabel
|
||||
*
|
||||
* @param $bAttCodesOnly If set to true, will return only the attcodes
|
||||
* @param boolean $bAttCodesOnly If set to true, will return only the attcodes
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function GetAttributesToDisplay($bAttCodesOnly = false)
|
||||
@@ -147,7 +146,8 @@ class LinkedSetField extends Field
|
||||
|
||||
/**
|
||||
*
|
||||
* @param array $aAttCodes
|
||||
* @param array $aAttributesToDisplay
|
||||
*
|
||||
* @return \Combodo\iTop\Form\Field\LinkedSetField
|
||||
*/
|
||||
public function SetAttributesToDisplay(array $aAttributesToDisplay)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
// Copyright (C) 2010-2016 Combodo SARL
|
||||
// Copyright (C) 2010-2018 Combodo SARL
|
||||
//
|
||||
// This file is part of iTop.
|
||||
//
|
||||
@@ -19,8 +19,7 @@
|
||||
|
||||
namespace Combodo\iTop\Form\Field;
|
||||
|
||||
use \Closure;
|
||||
use \Combodo\iTop\Form\Field\Field;
|
||||
use Closure;
|
||||
|
||||
/**
|
||||
* Description of MultipleChoicesField
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
// Copyright (C) 2010-2016 Combodo SARL
|
||||
// Copyright (C) 2010-2018 Combodo SARL
|
||||
//
|
||||
// This file is part of iTop.
|
||||
//
|
||||
@@ -19,10 +19,6 @@
|
||||
|
||||
namespace Combodo\iTop\Form\Field;
|
||||
|
||||
use \Closure;
|
||||
use \Dict;
|
||||
use \Combodo\iTop\Form\Field\SelectField;
|
||||
|
||||
/**
|
||||
* Description of MultipleSelectField
|
||||
*
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
// Copyright (C) 2010-2016 Combodo SARL
|
||||
// Copyright (C) 2010-2018 Combodo SARL
|
||||
//
|
||||
// This file is part of iTop.
|
||||
//
|
||||
@@ -19,8 +19,6 @@
|
||||
|
||||
namespace Combodo\iTop\Form\Field;
|
||||
|
||||
use \Combodo\iTop\Form\Field\TextField;
|
||||
|
||||
/**
|
||||
* Description of PasswordField
|
||||
*
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
// Copyright (C) 2010-2016 Combodo SARL
|
||||
// Copyright (C) 2010-2018 Combodo SARL
|
||||
//
|
||||
// This file is part of iTop.
|
||||
//
|
||||
@@ -19,8 +19,6 @@
|
||||
|
||||
namespace Combodo\iTop\Form\Field;
|
||||
|
||||
use \Combodo\iTop\Form\Field\MultipleChoicesField;
|
||||
|
||||
/**
|
||||
* Description of RadioField
|
||||
*
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
// Copyright (C) 2010-2016 Combodo SARL
|
||||
// Copyright (C) 2010-2018 Combodo SARL
|
||||
//
|
||||
// This file is part of iTop.
|
||||
//
|
||||
@@ -19,9 +19,8 @@
|
||||
|
||||
namespace Combodo\iTop\Form\Field;
|
||||
|
||||
use \Closure;
|
||||
use \Dict;
|
||||
use \Combodo\iTop\Form\Field\MultipleChoicesField;
|
||||
use Closure;
|
||||
use Dict;
|
||||
|
||||
/**
|
||||
* Description of SelectField
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
// Copyright (C) 2010-2017 Combodo SARL
|
||||
// Copyright (C) 2010-2018 Combodo SARL
|
||||
//
|
||||
// This file is part of iTop.
|
||||
//
|
||||
@@ -153,12 +153,14 @@ class SelectObjectField extends Field
|
||||
return $this->sSearchEndpoint;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets current value is not among allowed ones.
|
||||
* By default, reset is done ONLY when the field is not read-only.
|
||||
*
|
||||
* @param boolean $bAlways Set to true to verify even when the field is read-only.
|
||||
*/
|
||||
/**
|
||||
* Resets current value is not among allowed ones.
|
||||
* By default, reset is done ONLY when the field is not read-only.
|
||||
*
|
||||
* @param boolean $bAlways Set to true to verify even when the field is read-only.
|
||||
*
|
||||
* @throws \CoreException
|
||||
*/
|
||||
public function VerifyCurrentValue($bAlways = false)
|
||||
{
|
||||
if(!$this->GetReadOnly() || $bAlways)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
// Copyright (C) 2010-2016 Combodo SARL
|
||||
// Copyright (C) 2010-2018 Combodo SARL
|
||||
//
|
||||
// This file is part of iTop.
|
||||
//
|
||||
@@ -20,12 +20,6 @@
|
||||
namespace Combodo\iTop\Form\Field;
|
||||
|
||||
use \Combodo\iTop\Form\Field\TextField;
|
||||
|
||||
/**
|
||||
* Description of StringField
|
||||
*
|
||||
* @author Guillaume Lajarige <guillaume.lajarige@combodo.com>
|
||||
*/
|
||||
class StringField extends TextField
|
||||
{
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
// Copyright (C) 2010-2016 Combodo SARL
|
||||
// Copyright (C) 2010-2018 Combodo SARL
|
||||
//
|
||||
// This file is part of iTop.
|
||||
//
|
||||
@@ -31,13 +31,12 @@ class SubFormField extends Field
|
||||
{
|
||||
protected $oForm;
|
||||
|
||||
/**
|
||||
* Default constructor
|
||||
*
|
||||
* @param string $sId
|
||||
* @param string $sParentFormId
|
||||
* @param Closure $onFinalizeCallback
|
||||
*/
|
||||
/**
|
||||
* Default constructor
|
||||
*
|
||||
* @param string $sId
|
||||
* @param \Closure $onFinalizeCallback
|
||||
*/
|
||||
public function __construct($sId, Closure $onFinalizeCallback = null)
|
||||
{
|
||||
$this->oForm = new Form('subform_' . $sId);
|
||||
@@ -55,7 +54,8 @@ class SubFormField extends Field
|
||||
|
||||
/**
|
||||
*
|
||||
* @param \Combodo\iTop\Form\Field\Form $oForm
|
||||
* @param \Combodo\iTop\Form\Form $oForm
|
||||
*
|
||||
* @return \Combodo\iTop\Form\Field\SubFormField
|
||||
*/
|
||||
public function SetForm(Form $oForm)
|
||||
@@ -107,11 +107,14 @@ class SubFormField extends Field
|
||||
return $this->oForm->GetCurrentValues();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param array $value
|
||||
* @return \Combodo\iTop\Form\Field\SubFormField
|
||||
*/
|
||||
/**
|
||||
*
|
||||
* @param array $value
|
||||
*
|
||||
* @return \Combodo\iTop\Form\Field\SubFormField
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function SetCurrentValue($value)
|
||||
{
|
||||
$this->oForm->SetCurrentValues($value);
|
||||
@@ -170,7 +173,10 @@ class SubFormField extends Field
|
||||
return $this->oForm->FindSubForm($sFormPath);
|
||||
}
|
||||
|
||||
public function OnFinalize()
|
||||
/**
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function OnFinalize()
|
||||
{
|
||||
$sFormId = 'subform_' . $this->sId;
|
||||
if ($this->sFormPath !== null)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
// Copyright (C) 2010-2016 Combodo SARL
|
||||
// Copyright (C) 2010-2018 Combodo SARL
|
||||
//
|
||||
// This file is part of iTop.
|
||||
//
|
||||
@@ -19,11 +19,10 @@
|
||||
|
||||
namespace Combodo\iTop\Form\Field;
|
||||
|
||||
use \Closure;
|
||||
use \DBObject;
|
||||
use \InlineImage;
|
||||
use \AttributeText;
|
||||
use \Combodo\iTop\Form\Field\TextField;
|
||||
use Closure;
|
||||
use DBObject;
|
||||
use InlineImage;
|
||||
use AttributeText;
|
||||
|
||||
/**
|
||||
* Description of TextAreaField
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
// Copyright (C) 2010-2016 Combodo SARL
|
||||
// Copyright (C) 2010-2018 Combodo SARL
|
||||
//
|
||||
// This file is part of iTop.
|
||||
//
|
||||
@@ -19,8 +19,6 @@
|
||||
|
||||
namespace Combodo\iTop\Form\Field;
|
||||
|
||||
use \Combodo\iTop\Form\Field\Field;
|
||||
|
||||
/**
|
||||
* Description of TextField
|
||||
*
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
// Copyright (C) 2010-2016 Combodo SARL
|
||||
// Copyright (C) 2010-2018 Combodo SARL
|
||||
//
|
||||
// This file is part of iTop.
|
||||
//
|
||||
@@ -19,8 +19,7 @@
|
||||
|
||||
namespace Combodo\iTop\Form\Field;
|
||||
|
||||
use \Str;
|
||||
use \Combodo\iTop\Form\Field\StringField;
|
||||
use Str;
|
||||
|
||||
/**
|
||||
* Description of UrlField
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
// Copyright (C) 2010-2016 Combodo SARL
|
||||
// Copyright (C) 2010-2018 Combodo SARL
|
||||
//
|
||||
// This file is part of iTop.
|
||||
//
|
||||
@@ -19,9 +19,8 @@
|
||||
|
||||
namespace Combodo\iTop\Renderer\Bootstrap;
|
||||
|
||||
use \Silex\Application;
|
||||
use \Combodo\iTop\Renderer\FormRenderer;
|
||||
use \Combodo\iTop\Form\Form;
|
||||
use Combodo\iTop\Renderer\FormRenderer;
|
||||
use Combodo\iTop\Form\Form;
|
||||
|
||||
/**
|
||||
* Description of formrenderer
|
||||
|
||||
@@ -21,14 +21,11 @@ namespace Combodo\iTop\Renderer\Bootstrap\FieldRenderer;
|
||||
|
||||
use utils;
|
||||
use Dict;
|
||||
use UserRights;
|
||||
use InlineImage;
|
||||
use DBObjectSet;
|
||||
use DBObjectSearch;
|
||||
use MetaModel;
|
||||
use Combodo\iTop\Renderer\FieldRenderer;
|
||||
use Combodo\iTop\Renderer\RenderingOutput;
|
||||
use Combodo\iTop\Form\Field\LinkedSetField;
|
||||
|
||||
/**
|
||||
* Description of BsFileUploadFieldRenderer
|
||||
@@ -37,12 +34,14 @@ use Combodo\iTop\Form\Field\LinkedSetField;
|
||||
*/
|
||||
class BsFileUploadFieldRenderer extends FieldRenderer
|
||||
{
|
||||
|
||||
/**
|
||||
* Returns a RenderingOutput for the FieldRenderer's Field
|
||||
*
|
||||
* @return \Combodo\iTop\Renderer\RenderingOutput
|
||||
*/
|
||||
/**
|
||||
* Returns a RenderingOutput for the FieldRenderer's Field
|
||||
*
|
||||
* @return \Combodo\iTop\Renderer\RenderingOutput
|
||||
*
|
||||
* @throws \CoreException
|
||||
* @throws \OQLException
|
||||
*/
|
||||
public function Render()
|
||||
{
|
||||
$oOutput = new RenderingOutput();
|
||||
@@ -229,10 +228,13 @@ EOF
|
||||
return $oOutput;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param RenderingOutput $oOutput
|
||||
*/
|
||||
/**
|
||||
*
|
||||
* @param \Combodo\iTop\Renderer\RenderingOutput $oOutput
|
||||
*
|
||||
* @throws \CoreException
|
||||
* @throws \OQLException
|
||||
*/
|
||||
protected function PrepareExistingFiles(RenderingOutput &$oOutput)
|
||||
{
|
||||
$sObjectClass = get_class($this->oField->GetObject());
|
||||
|
||||
@@ -35,11 +35,13 @@ use Combodo\iTop\Renderer\RenderingOutput;
|
||||
*/
|
||||
class BsLinkedSetFieldRenderer extends FieldRenderer
|
||||
{
|
||||
/**
|
||||
* Returns a RenderingOutput for the FieldRenderer's Field
|
||||
*
|
||||
* @return \Combodo\iTop\Renderer\RenderingOutput
|
||||
*/
|
||||
/**
|
||||
* Returns a RenderingOutput for the FieldRenderer's Field
|
||||
*
|
||||
* @return \Combodo\iTop\Renderer\RenderingOutput
|
||||
*
|
||||
* @throws \CoreException
|
||||
*/
|
||||
public function Render()
|
||||
{
|
||||
$oOutput = new RenderingOutput();
|
||||
@@ -542,6 +544,13 @@ EOF
|
||||
return $oOutput;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $aItems
|
||||
* @param $aItemIds
|
||||
*
|
||||
* @throws \Exception
|
||||
* @throws \CoreException
|
||||
*/
|
||||
protected function PrepareItems(&$aItems, &$aItemIds)
|
||||
{
|
||||
$oValueSet = $this->oField->GetCurrentValue();
|
||||
|
||||
@@ -37,11 +37,15 @@ use MetaModel;
|
||||
class BsSelectObjectFieldRenderer extends FieldRenderer
|
||||
{
|
||||
|
||||
/**
|
||||
* Returns a RenderingOutput for the FieldRenderer's Field
|
||||
*
|
||||
* @return \Combodo\iTop\Renderer\RenderingOutput
|
||||
*/
|
||||
/**
|
||||
* 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();
|
||||
|
||||
@@ -28,6 +28,7 @@ use InlineImage;
|
||||
use Combodo\iTop\Renderer\FieldRenderer;
|
||||
use Combodo\iTop\Renderer\RenderingOutput;
|
||||
use Combodo\iTop\Form\Field\TextAreaField;
|
||||
use Combodo\iTop\Form\Field\MultipleChoicesField;
|
||||
|
||||
/**
|
||||
* Description of BsSimpleFieldRenderer
|
||||
@@ -37,11 +38,13 @@ use Combodo\iTop\Form\Field\TextAreaField;
|
||||
class BsSimpleFieldRenderer extends FieldRenderer
|
||||
{
|
||||
|
||||
/**
|
||||
* Returns a RenderingOutput for the FieldRenderer's Field
|
||||
*
|
||||
* @return \Combodo\iTop\Renderer\RenderingOutput
|
||||
*/
|
||||
/**
|
||||
* Returns a RenderingOutput for the FieldRenderer's Field
|
||||
*
|
||||
* @return \Combodo\iTop\Renderer\RenderingOutput
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function Render()
|
||||
{
|
||||
$oOutput = new RenderingOutput();
|
||||
@@ -281,7 +284,7 @@ EOF
|
||||
else
|
||||
{
|
||||
// ... specific rendering for fields with multiple values
|
||||
if (($this->oField instanceof Combodo\iTop\Form\Field\MultipleChoicesField) && ($this->oField->GetMultipleValuesEnabled()))
|
||||
if (($this->oField instanceof MultipleChoicesField) && ($this->oField->GetMultipleValuesEnabled()))
|
||||
{
|
||||
// TODO
|
||||
}
|
||||
@@ -525,6 +528,11 @@ EOF
|
||||
return $oOutput;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param RenderingOutput $oOutput
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
protected function PreparingCaseLogEntries(RenderingOutput &$oOutput)
|
||||
{
|
||||
$aEntries = $this->oField->GetEntries();
|
||||
|
||||
@@ -18,13 +18,17 @@
|
||||
|
||||
namespace Combodo\iTop\Renderer\Bootstrap\FieldRenderer;
|
||||
|
||||
use Dict;
|
||||
use Combodo\iTop\Renderer\Bootstrap\BsFormRenderer;
|
||||
use Combodo\iTop\Renderer\FieldRenderer;
|
||||
use Combodo\iTop\Renderer\RenderingOutput;
|
||||
|
||||
class BsSubFormFieldRenderer extends FieldRenderer
|
||||
{
|
||||
/**
|
||||
* @return \Combodo\iTop\Renderer\RenderingOutput
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function Render()
|
||||
{
|
||||
$oOutput = new RenderingOutput();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
// Copyright (C) 2016 Combodo SARL
|
||||
// Copyright (C) 2010-2018 Combodo SARL
|
||||
//
|
||||
// This file is part of iTop.
|
||||
//
|
||||
@@ -20,7 +20,6 @@ namespace Combodo\iTop\Renderer\Console;
|
||||
|
||||
use Combodo\iTop\Form\Form;
|
||||
use Combodo\iTop\Renderer\FormRenderer;
|
||||
use \Dict;
|
||||
|
||||
require_once('fieldrenderer/consolesimplefieldrenderer.class.inc.php');
|
||||
require_once('fieldrenderer/consoleselectobjectfieldrenderer.class.inc.php');
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
// Copyright (C) 2016 Combodo SARL
|
||||
// Copyright (C) 2010-2018 Combodo SARL
|
||||
//
|
||||
// This file is part of iTop.
|
||||
//
|
||||
@@ -18,7 +18,6 @@
|
||||
|
||||
namespace Combodo\iTop\Renderer\Console\FieldRenderer;
|
||||
|
||||
use \Dict;
|
||||
use Combodo\iTop\Renderer\Console\ConsoleFormRenderer;
|
||||
use Combodo\iTop\Renderer\FieldRenderer;
|
||||
use Combodo\iTop\Renderer\RenderingOutput;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
// Copyright (C) 2010-2016 Combodo SARL
|
||||
// Copyright (C) 2010-2018 Combodo SARL
|
||||
//
|
||||
// This file is part of iTop.
|
||||
//
|
||||
@@ -19,9 +19,8 @@
|
||||
|
||||
namespace Combodo\iTop\Renderer;
|
||||
|
||||
use \Dict;
|
||||
use \DBObject;
|
||||
use \Combodo\iTop\Form\Field\Field;
|
||||
use Dict;
|
||||
use Combodo\iTop\Form\Field\Field;
|
||||
|
||||
/**
|
||||
* Description of FieldRenderer
|
||||
@@ -52,10 +51,12 @@ abstract class FieldRenderer
|
||||
return $this->sEndpoint;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string $sEndpoint
|
||||
*/
|
||||
/**
|
||||
*
|
||||
* @param string $sEndpoint
|
||||
*
|
||||
* @return \Combodo\iTop\Renderer\FieldRenderer
|
||||
*/
|
||||
public function SetEndpoint($sEndpoint)
|
||||
{
|
||||
$this->sEndpoint = $sEndpoint;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
// Copyright (C) 2010-2016 Combodo SARL
|
||||
// Copyright (C) 2010-2018 Combodo SARL
|
||||
//
|
||||
// This file is part of iTop.
|
||||
//
|
||||
@@ -19,10 +19,9 @@
|
||||
|
||||
namespace Combodo\iTop\Renderer;
|
||||
|
||||
use \Exception;
|
||||
use \Dict;
|
||||
use \Combodo\iTop\Form\Form;
|
||||
use \Combodo\iTop\Form\Field\Field;
|
||||
use Exception;
|
||||
use Combodo\iTop\Form\Form;
|
||||
use Combodo\iTop\Form\Field\Field;
|
||||
|
||||
/**
|
||||
* Description of FormRenderer
|
||||
@@ -119,8 +118,10 @@ abstract class FormRenderer
|
||||
/**
|
||||
*
|
||||
* @param \Combodo\iTop\Form\Field\Field $oField
|
||||
* @return string
|
||||
* @throws Exception
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function GetFieldRendererClass(Field $oField)
|
||||
{
|
||||
@@ -134,12 +135,15 @@ abstract class FormRenderer
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the field identified by the id $sId in $this->oForm.
|
||||
*
|
||||
* @param string $sId
|
||||
* @return \Combodo\iTop\Renderer\FieldRenderer
|
||||
*/
|
||||
/**
|
||||
* Returns the field identified by the id $sId in $this->oForm.
|
||||
*
|
||||
* @param string $sId
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function GetFieldRendererClassFromId($sId)
|
||||
{
|
||||
return $this->GetFieldRendererClass($this->oForm->GetField($sId));
|
||||
@@ -154,15 +158,17 @@ abstract class FormRenderer
|
||||
return $this->aOutputs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a Renderer class for the specified Field class.
|
||||
*
|
||||
* If the Field class is not fully qualified, the default "Combodo\iTop\Form\Field" will be prepend.
|
||||
* If the Field class already had a registered Renderer, it is replaced.
|
||||
*
|
||||
* @param string $sFieldClass
|
||||
* @param string $sRendererClass
|
||||
*/
|
||||
/**
|
||||
* Registers a Renderer class for the specified Field class.
|
||||
*
|
||||
* If the Field class is not fully qualified, the default "Combodo\iTop\Form\Field" will be prepend.
|
||||
* If the Field class already had a registered Renderer, it is replaced.
|
||||
*
|
||||
* @param string $sFieldClass
|
||||
* @param string $sRendererClass
|
||||
*
|
||||
* @return \Combodo\iTop\Renderer\FormRenderer
|
||||
*/
|
||||
public function AddSupportedField($sFieldClass, $sRendererClass)
|
||||
{
|
||||
$sFieldClass = (strpos($sFieldClass, '\\') !== false) ? $sFieldClass : 'Combodo\\iTop\\Form\\Field\\' . $sFieldClass;
|
||||
@@ -183,17 +189,21 @@ abstract class FormRenderer
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of Output for the form fields.
|
||||
*
|
||||
* @param array $aFieldIds An array of field ids. If specified, renders only those fields
|
||||
* @return array
|
||||
*/
|
||||
/**
|
||||
* Returns an array of Output for the form fields.
|
||||
*
|
||||
* @param array $aFieldIds An array of field ids. If specified, renders only those fields
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function Render($aFieldIds = null)
|
||||
{
|
||||
$this->InitOutputs();
|
||||
|
||||
foreach ($this->oForm->GetFields() as $oField)
|
||||
/** @var Field $oField */
|
||||
foreach ($this->oForm->GetFields() as $oField)
|
||||
{
|
||||
if ($aFieldIds !== null && !in_array($oField->GetId(), $aFieldIds))
|
||||
{
|
||||
@@ -205,16 +215,19 @@ abstract class FormRenderer
|
||||
return $this->aOutputs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the output for the $oField. Output format depends on the $sMode.
|
||||
*
|
||||
* If $sMode = 'exploded', output is an has array with id / html / js_inline / js_files / css_inline / css_files / validators
|
||||
* Else if $sMode = 'joined', output is a string with everything in it
|
||||
*
|
||||
* @param \Combodo\iTop\Form\Field\Field $oField
|
||||
* @param string $sMode 'exploded'|'joined'
|
||||
* @return mixed
|
||||
*/
|
||||
/**
|
||||
* Returns the output for the $oField. Output format depends on the $sMode.
|
||||
*
|
||||
* If $sMode = 'exploded', output is an has array with id / html / js_inline / js_files / css_inline / css_files / validators
|
||||
* Else if $sMode = 'joined', output is a string with everything in it
|
||||
*
|
||||
* @param \Combodo\iTop\Form\Field\Field $oField
|
||||
* @param string $sMode 'exploded'|'joined'
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
protected function PrepareOutputForField($oField, $sMode = 'exploded')
|
||||
{
|
||||
$output = array(
|
||||
|
||||
@@ -97,11 +97,13 @@ class RenderingOutput
|
||||
return $this->aCssClasses;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string $sHtml
|
||||
* @return \Combodo\iTop\Renderer\RenderingOutput
|
||||
*/
|
||||
/**
|
||||
*
|
||||
* @param string $sHtml
|
||||
* @param bool $bEncodeHtmlEntities
|
||||
*
|
||||
* @return \Combodo\iTop\Renderer\RenderingOutput
|
||||
*/
|
||||
public function AddHtml($sHtml, $bEncodeHtmlEntities = false)
|
||||
{
|
||||
$this->sHtml .= ($bEncodeHtmlEntities) ? htmlentities($sHtml, ENT_QUOTES, 'UTF-8') : $sHtml;
|
||||
|
||||
Reference in New Issue
Block a user