mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-23 18:48:51 +02:00
PHPDoc & code cleanup
This commit is contained in:
@@ -19,8 +19,6 @@
|
||||
|
||||
namespace Combodo\iTop\Application\UI\Component\Button;
|
||||
|
||||
use Combodo\iTop\Application\UI\Component\Button\Button;
|
||||
|
||||
/**
|
||||
* Class ButtonFactory
|
||||
*
|
||||
|
||||
@@ -20,8 +20,6 @@
|
||||
namespace Combodo\iTop\Application\UI\Component\PopoverMenu\NewsroomMenu;
|
||||
|
||||
use appUserPreferences;
|
||||
use Combodo\iTop\Application\UI\Component\PopoverMenu\PopoverMenu;
|
||||
use Combodo\iTop\Application\UI\Component\PopoverMenu\NewsroomMenu\NewsroomMenu;
|
||||
use Dict;
|
||||
use MetaModel;
|
||||
use UserRights;
|
||||
|
||||
@@ -23,7 +23,6 @@ namespace Combodo\iTop\Application\UI\Layout\ActivityPanel\ActivityEntry;
|
||||
use AttributeDateTime;
|
||||
use Combodo\iTop\Application\UI\UIBlock;
|
||||
use DateTime;
|
||||
use User;
|
||||
use UserRights;
|
||||
|
||||
/**
|
||||
@@ -48,7 +47,7 @@ class ActivityEntry extends UIBlock
|
||||
/** @var string DEFAULT_DECORATION_CLASSES */
|
||||
public const DEFAULT_DECORATION_CLASSES = 'fas fa-fw fa-mortar-pestle';
|
||||
|
||||
/** @var string $sType Type of entry, used for filtering (eg. caselog, edits, transition, ...) */
|
||||
/** @var string $sType Type of entry, used for filtering (eg. case log, edits, transition, ...) */
|
||||
protected $sType;
|
||||
/** @var string $sDecorationClasses CSS classes to use to decorate the entry */
|
||||
protected $sDecorationClasses;
|
||||
@@ -106,7 +105,7 @@ class ActivityEntry extends UIBlock
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the type of the entry (eg. caselog, edits, transition, ...)
|
||||
* Return the type of the entry (eg. case log, edits, transition, ...)
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
||||
@@ -20,8 +20,6 @@
|
||||
namespace Combodo\iTop\Application\UI\Layout\ActivityPanel\ActivityEntry\CMDBChangeOp;
|
||||
|
||||
|
||||
use iCMDBChangeOp;
|
||||
|
||||
/**
|
||||
* Class CMDBChangeOpAttachmentRemovedFactory
|
||||
*
|
||||
|
||||
@@ -42,6 +42,7 @@ class CMDBChangeOpSetAttributeFactory
|
||||
*
|
||||
* @return \Combodo\iTop\Application\UI\Layout\ActivityPanel\ActivityEntry\EditsEntry
|
||||
* @throws \OQLException
|
||||
* @throws \Exception
|
||||
*/
|
||||
public static function MakeFromCmdbChangeOp(iCMDBChangeOpSetAttribute $oChangeOp)
|
||||
{
|
||||
|
||||
@@ -54,7 +54,7 @@ class CaseLogEntry extends ActivityEntry
|
||||
* @param \User $sAuthorLogin
|
||||
* @param string $sAttCode
|
||||
* @param string $sContent
|
||||
* @param string $sId
|
||||
* @param string|null $sId
|
||||
*
|
||||
* @throws \OQLException
|
||||
*/
|
||||
|
||||
@@ -53,7 +53,7 @@ class EditsEntry extends ActivityEntry
|
||||
* @param \DateTime $oDateTime
|
||||
* @param \User $sAuthorLogin
|
||||
* @param string $sObjectClass Class of the object concerned by the edits
|
||||
* @param string $sId
|
||||
* @param string|null $sId
|
||||
*
|
||||
* @throws \OQLException
|
||||
*/
|
||||
|
||||
@@ -21,6 +21,7 @@ namespace Combodo\iTop\Application\UI\Layout\ActivityPanel\ActivityEntry;
|
||||
|
||||
|
||||
use DateTime;
|
||||
use MetaModel;
|
||||
|
||||
/**
|
||||
* Class TransitionEntry
|
||||
@@ -56,7 +57,7 @@ class TransitionEntry extends ActivityEntry
|
||||
* @param string $sObjectClass Class of the object which made the transition
|
||||
* @param string $sOriginStateCode
|
||||
* @param string $sTargetStateCode
|
||||
* @param string $sId
|
||||
* @param string|null $sId
|
||||
*
|
||||
* @throws \CoreException
|
||||
* @throws \OQLException
|
||||
@@ -81,7 +82,7 @@ class TransitionEntry extends ActivityEntry
|
||||
public function SetOriginalState($sObjectClass, $sStateCode)
|
||||
{
|
||||
$this->sOriginStateCode = $sStateCode;
|
||||
$this->sOriginStateLabel = \MetaModel::GetStateLabel($sObjectClass, $sStateCode);
|
||||
$this->sOriginStateLabel = MetaModel::GetStateLabel($sObjectClass, $sStateCode);
|
||||
|
||||
return $this;
|
||||
}
|
||||
@@ -109,16 +110,16 @@ class TransitionEntry extends ActivityEntry
|
||||
/**
|
||||
* Set the code / label of the state after the transition
|
||||
*
|
||||
* @param string $sObjectClas
|
||||
* @param string $sObjectClass
|
||||
* @param string $sStateCode
|
||||
*
|
||||
* @return $this
|
||||
* @throws \CoreException
|
||||
*/
|
||||
public function SetTargetState($sObjectClas, $sStateCode)
|
||||
public function SetTargetState($sObjectClass, $sStateCode)
|
||||
{
|
||||
$this->sTargetStateCode = $sStateCode;
|
||||
$this->sTargetStateLabel = \MetaModel::GetStateLabel($sObjectClas, $sStateCode);
|
||||
$this->sTargetStateLabel = MetaModel::GetStateLabel($sObjectClass, $sStateCode);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -51,8 +51,8 @@ class ActivityPanel extends UIBlock
|
||||
protected $aCaseLogs;
|
||||
/** @var ActivityEntry[] $aEntries */
|
||||
protected $aEntries;
|
||||
/** @var bool $bAreEntriedSorted True if the entries have been sorted by date */
|
||||
protected $bAreEntriedSorted;
|
||||
/** @var bool $bAreEntriesSorted True if the entries have been sorted by date */
|
||||
protected $bAreEntriesSorted;
|
||||
/** @var bool $bHasLifecycle True if the host object has a lifecycle */
|
||||
protected $bHasLifecycle;
|
||||
|
||||
@@ -73,7 +73,7 @@ class ActivityPanel extends UIBlock
|
||||
$this->InitializeCaseLogTabs();
|
||||
$this->SetObject($oObject);
|
||||
$this->SetEntries($aEntries);
|
||||
$this->bAreEntriedSorted = false;
|
||||
$this->bAreEntriesSorted = false;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -141,7 +141,7 @@ class ActivityPanel extends UIBlock
|
||||
*/
|
||||
public function GetEntries()
|
||||
{
|
||||
if($this->bAreEntriedSorted === false)
|
||||
if ($this->bAreEntriesSorted === false)
|
||||
{
|
||||
$this->SortEntries();
|
||||
}
|
||||
@@ -208,7 +208,7 @@ class ActivityPanel extends UIBlock
|
||||
$sDateTimeA = $oEntryA->GetRawDateTime();
|
||||
$sDateTimeB = $oEntryB->GetRawDateTime();
|
||||
|
||||
if($sDateTimeA === $sDateTimeB)
|
||||
if ($sDateTimeA === $sDateTimeB)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@@ -216,7 +216,7 @@ class ActivityPanel extends UIBlock
|
||||
return ($sDateTimeA > $sDateTimeB) ? -1 : 1;
|
||||
});
|
||||
}
|
||||
$this->bAreEntriedSorted = true;
|
||||
$this->bAreEntriesSorted = true;
|
||||
|
||||
return $this;
|
||||
}
|
||||
@@ -232,16 +232,16 @@ class ActivityPanel extends UIBlock
|
||||
public function AddEntry(ActivityEntry $oEntry)
|
||||
{
|
||||
$this->aEntries[$oEntry->GetId()] = $oEntry;
|
||||
$this->bAreEntriedSorted = false;
|
||||
$this->bAreEntriesSorted = false;
|
||||
|
||||
// Add case log to the panel and update metadata when necessary
|
||||
if($oEntry instanceof CaseLogEntry)
|
||||
if ($oEntry instanceof CaseLogEntry)
|
||||
{
|
||||
$sCaseLogAttCode = $oEntry->GetAttCode();
|
||||
$sAuthorLogin = $oEntry->GetAuthorLogin();
|
||||
|
||||
// Initialize case log metadata
|
||||
if($this->HasCaseLogTab($sCaseLogAttCode) === false)
|
||||
if ($this->HasCaseLogTab($sCaseLogAttCode) === false)
|
||||
{
|
||||
$this->AddCaseLogTab($sCaseLogAttCode);
|
||||
}
|
||||
|
||||
@@ -27,7 +27,6 @@ use DBObject;
|
||||
use DBObjectSearch;
|
||||
use DBObjectSet;
|
||||
use MetaModel;
|
||||
use UserRights;
|
||||
|
||||
/**
|
||||
* Class ActivityPanelFactory
|
||||
@@ -40,7 +39,7 @@ use UserRights;
|
||||
class ActivityPanelFactory
|
||||
{
|
||||
/**
|
||||
* Make an activity panel for an object details layout, meaning that it should contain the caselogs and the activity.
|
||||
* Make an activity panel for an object details layout, meaning that it should contain the case logs and the activity.
|
||||
*
|
||||
* @param \DBObject $oObject
|
||||
*
|
||||
|
||||
@@ -49,7 +49,7 @@ class PageContent extends UIBlock
|
||||
/**
|
||||
* PageContent constructor.
|
||||
*
|
||||
* @param string $sId
|
||||
* @param string|null $sId
|
||||
*/
|
||||
public function __construct($sId = null)
|
||||
{
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
namespace Combodo\iTop\Application\UI\Layout\PageContent;
|
||||
|
||||
|
||||
use Combodo\iTop\Application\UI\Layout\ActivityPanel\ActivityPanel;
|
||||
use Combodo\iTop\Application\UI\Layout\ActivityPanel\ActivityPanelFactory;
|
||||
use DBObject;
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ class PageContentWithSideContent extends PageContent
|
||||
/**
|
||||
* PageContentWithSideContent constructor.
|
||||
*
|
||||
* @param string $sId
|
||||
* @param string|null $sId
|
||||
*/
|
||||
public function __construct($sId = null)
|
||||
{
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
<div id="{{ oUIBlock.GetId() }}" class="ibo-quick-create" data-role="ibo-quick-create">
|
||||
<form action="{{ oUIBlock.GetEndpoint() }}" method="get" class="ibo-quick-create--head" data-role="ibo-quick-create--head">
|
||||
<input type="hidden" name="operation" value="new" />
|
||||
<a href="#" class="ibo-quick-create--icon fas fa-plus" data-role="ibo-quick-create--icon" data-tooltip-content="{{ 'UI:Component:QuickCreate:Tooltip'|dict_s }}" data-tooltip-placement="bottom-start" data-tooltip-distance-offset="25"></a>
|
||||
<select name="class" class="ibo-quick-create--input" data-role="ibo-quick-create--input" placeholder="{{ 'UI:Component:QuickCreate:Input:Placeholder'|dict_s }}">
|
||||
<a href="#" class="ibo-quick-create--icon fas fa-plus" data-role="ibo-quick-create--icon" data-tooltip-content="{{ 'UI:Component:QuickCreate:Tooltip'|dict_s }}"
|
||||
data-tooltip-placement="bottom-start" data-tooltip-distance-offset="25"></a>
|
||||
<select name="class" class="ibo-quick-create--input" data-role="ibo-quick-create--input">
|
||||
<option value="">{{ 'UI:Component:QuickCreate:Input:Placeholder'|dict_s }}</option>
|
||||
{% for sClassCode, sClassLabel in oUIBlock.GetAvailableClasses() %}
|
||||
<option value="{{ sClassCode }}">{{ sClassLabel }}</option>
|
||||
|
||||
@@ -62,7 +62,7 @@
|
||||
{{ '0 notification'|dict_s }}
|
||||
<span class="ibo-navigation-menu--user-notifications--toggler--icon">
|
||||
<i class="fas fa-bell"></i>
|
||||
<div class="ibo-navigation-menu--notifications-toggler--new-messages"></div>
|
||||
<span class="ibo-navigation-menu--notifications-toggler--new-messages"></span>
|
||||
</span>
|
||||
</a>
|
||||
<div class="ibo-navigation-menu--user-notifications-menu"></div>
|
||||
|
||||
@@ -23,6 +23,7 @@ use Combodo\iTop\Application\UI\Component\Alert\AlertFactory;
|
||||
use Combodo\iTop\Application\UI\Component\Button\ButtonFactory;
|
||||
use Combodo\iTop\Application\UI\Component\Html\Html;
|
||||
use Combodo\iTop\Application\UI\Component\Panel\PanelFactory;
|
||||
use Combodo\iTop\Application\UI\Component\QuickCreate\QuickCreateFactory;
|
||||
use Combodo\iTop\Application\UI\Layout\PageContent\PageContentFactory;
|
||||
use iTopWebPage;
|
||||
|
||||
@@ -33,7 +34,9 @@ $oPage = new iTopWebPage('Render all UI blocks');
|
||||
$oPageContentLayout = PageContentFactory::MakeStandardEmpty();
|
||||
$oPage->SetContentLayout($oPageContentLayout);
|
||||
|
||||
/////////
|
||||
// Alerts
|
||||
/////////
|
||||
$sContent = <<<HTML
|
||||
<div>The content text is made of raw HTML, therefore it must be sanitized before being injected into the component.</div>
|
||||
<div>Here we put an hyperlink (<a href="#">link</a>) and a smiley (😻), just to see if it renders correctly</div>
|
||||
@@ -50,7 +53,9 @@ $oPageContentLayout->AddMainBlock(AlertFactory::MakeWithBrandingSecondaryColor('
|
||||
|
||||
$oPageContentLayout->AddMainBlock(new Html('<hr/>'));
|
||||
|
||||
//////////
|
||||
// Buttons
|
||||
//////////
|
||||
$oPageContentLayout->AddMainBlock(ButtonFactory::MakeNeutral('Neutral', 'neutral'));
|
||||
$oPageContentLayout->AddMainBlock(ButtonFactory::MakeForPrimaryAction('Primary'));
|
||||
$oPageContentLayout->AddMainBlock(ButtonFactory::MakeForSecondaryAction('Secondary'));
|
||||
@@ -64,7 +69,9 @@ $oPageContentLayout->AddMainBlock(ButtonFactory::MakeForAlternativeDestructiveAc
|
||||
|
||||
$oPageContentLayout->AddMainBlock(new Html('<hr/>'));
|
||||
|
||||
/////////
|
||||
// Panels
|
||||
/////////
|
||||
$aSubBlocks = [
|
||||
new Html('<div>Panel body, can contain anything from simple text to rich text, forms, images, <a href="#">links</a>, graphs or tables.</div>'),
|
||||
new Html('<div>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</div>'),
|
||||
|
||||
Reference in New Issue
Block a user