-
Notifications
You must be signed in to change notification settings - Fork 344
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Martin Studer <[email protected]>
- Loading branch information
Showing
29 changed files
with
326 additions
and
513 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,6 @@ | |
|
||
/** | ||
* Class ilMStListCertificates | ||
* | ||
* @author Martin Studer <[email protected]> | ||
*/ | ||
class ilMStListCertificates | ||
|
@@ -25,30 +24,25 @@ class ilMStListCertificates | |
*/ | ||
protected $dic; | ||
|
||
|
||
/** | ||
* ilMStListCertificates constructor. | ||
* | ||
* @param Container $dic | ||
*/ | ||
public function __construct(Container $dic) | ||
{ | ||
$this->dic = $dic; | ||
} | ||
|
||
|
||
/** | ||
* @param array $arr_usr_ids | ||
* @param array $options | ||
* | ||
* @return UserCertificateDto[] | ||
*/ | ||
public function getData(array $options = array()) : array | ||
{ | ||
//Permission Filter | ||
$operation_access = ilOrgUnitOperation::OP_VIEW_CERTIFICATES; | ||
|
||
|
||
$_options = array( | ||
'filters' => array(), | ||
'sort' => array(), | ||
|
@@ -63,8 +57,8 @@ public function getData(array $options = array()) : array | |
foreach ($users_per_position as $position_id => $users) { | ||
$usr_data_filter = new UserDataFilter(); | ||
$usr_data_filter = $usr_data_filter->withUserIds($users); | ||
$usr_data_filter = $usr_data_filter->withObjIds(ilMyStaffAccess::getInstance()->getIdsForUserAndOperation($this->dic->user()->getId(), $operation_access)); | ||
|
||
$usr_data_filter = $usr_data_filter->withObjIds(ilMyStaffAccess::getInstance()->getIdsForUserAndOperation($this->dic->user()->getId(), | ||
$operation_access)); | ||
|
||
if (!empty($options['filters']['user'])) { | ||
$usr_data_filter = $usr_data_filter->withUserLogin($options['filters']['user']); | ||
|
@@ -73,8 +67,8 @@ public function getData(array $options = array()) : array | |
$usr_data_filter = $usr_data_filter->withObjectTitle($options['filters']['obj_title']); | ||
} | ||
|
||
|
||
$data = array_merge($data, $cert_api->getUserCertificateData($usr_data_filter, [ilMyStaffGUI::class, ilMStListCertificatesGUI::class])); | ||
$data = array_merge($data, $cert_api->getUserCertificateData($usr_data_filter, | ||
[ilMyStaffGUI::class, ilMStListCertificatesGUI::class])); | ||
} | ||
|
||
$unique_cert_data = []; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,9 +5,7 @@ | |
|
||
/** | ||
* Class ilMStListCertificatesGUI | ||
* | ||
* @author Martin Studer <[email protected]> | ||
* | ||
* @ilCtrl_IsCalledBy ilMStListCertificatesGUI: ilMyStaffGUI | ||
* @ilCtrl_Calls ilMStListCertificatesGUI: ilFormPropertyDispatchGUI | ||
* @ilCtrl_Calls ilMStListCertificatesGUI: ilUserCertificateApiGUI | ||
|
@@ -28,7 +26,6 @@ class ilMStListCertificatesGUI | |
protected $access; | ||
private \ilGlobalTemplateInterface $main_tpl; | ||
|
||
|
||
/** | ||
* | ||
*/ | ||
|
@@ -39,7 +36,6 @@ public function __construct() | |
$this->access = ilMyStaffAccess::getInstance(); | ||
} | ||
|
||
|
||
/** | ||
* | ||
*/ | ||
|
@@ -55,7 +51,6 @@ protected function checkAccessOrFail() | |
} | ||
} | ||
|
||
|
||
/** | ||
* | ||
*/ | ||
|
@@ -95,7 +90,6 @@ public function executeCommand() | |
} | ||
} | ||
|
||
|
||
/** | ||
* | ||
*/ | ||
|
@@ -104,7 +98,6 @@ public function index() | |
$this->listUsers(); | ||
} | ||
|
||
|
||
/** | ||
* | ||
*/ | ||
|
@@ -119,7 +112,6 @@ public function listUsers() | |
$DIC->ui()->mainTemplate()->setContent($this->table->getHTML()); | ||
} | ||
|
||
|
||
/** | ||
* | ||
*/ | ||
|
@@ -131,7 +123,6 @@ public function applyFilter() | |
$this->index(); | ||
} | ||
|
||
|
||
/** | ||
* | ||
*/ | ||
|
@@ -143,7 +134,6 @@ public function resetFilter() | |
$this->index(); | ||
} | ||
|
||
|
||
/** | ||
* @return string | ||
*/ | ||
|
@@ -154,7 +144,6 @@ public function getId() | |
return $this->table->getId(); | ||
} | ||
|
||
|
||
/** | ||
* | ||
*/ | ||
|
@@ -165,7 +154,6 @@ public function cancel() | |
$DIC->ctrl()->redirect($this); | ||
} | ||
|
||
|
||
/** | ||
* | ||
*/ | ||
|
@@ -181,22 +169,24 @@ public function getActions() | |
|
||
if ($DIC->access()->checkAccess("visible", "", $mst_lco_crs_ref_id)) { | ||
$link = ilLink::_getStaticLink($mst_lco_crs_ref_id, ilMyStaffAccess::DEFAULT_CONTEXT); | ||
$selection->addItem(ilObject2::_lookupTitle(ilObject2::_lookupObjectId($mst_lco_crs_ref_id)), '', $link); | ||
$selection->addItem(ilObject2::_lookupTitle(ilObject2::_lookupObjectId($mst_lco_crs_ref_id)), '', | ||
$link); | ||
}; | ||
|
||
$org_units = ilOrgUnitPathStorage::getTextRepresentationOfOrgUnits('ref_id'); | ||
foreach (ilOrgUnitUserAssignment::innerjoin('object_reference', 'orgu_id', 'ref_id')->where(array( | ||
'user_id' => $mst_co_usr_id, | ||
'object_reference.deleted' => null | ||
), array( 'user_id' => '=', 'object_reference.deleted' => '!=' ))->get() as $org_unit_assignment) { | ||
), array('user_id' => '=', 'object_reference.deleted' => '!='))->get() as $org_unit_assignment) { | ||
if ($DIC->access()->checkAccess("read", "", $org_unit_assignment->getOrguId())) { | ||
$link = ilLink::_getStaticLink($org_unit_assignment->getOrguId(), 'orgu'); | ||
$selection->addItem($org_units[$org_unit_assignment->getOrguId()], '', $link); | ||
} | ||
} | ||
|
||
$selection = ilMyStaffGUI::extendActionMenuWithUserActions($selection, $mst_co_usr_id, rawurlencode($DIC->ctrl() | ||
->getLinkTarget($this, self::CMD_INDEX))); | ||
$selection = ilMyStaffGUI::extendActionMenuWithUserActions($selection, $mst_co_usr_id, | ||
rawurlencode($DIC->ctrl() | ||
->getLinkTarget($this, self::CMD_INDEX))); | ||
|
||
echo $selection->getHTML(true); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,6 @@ | |
|
||
/** | ||
* Class ilMStListCertificatesTableGUI | ||
* | ||
* @author Martin Studer <[email protected]> | ||
*/ | ||
class ilMStListCertificatesTableGUI extends ilTable2GUI | ||
|
@@ -33,7 +32,6 @@ class ilMStListCertificatesTableGUI extends ilTable2GUI | |
*/ | ||
protected $access; | ||
|
||
|
||
/** | ||
* @param ilMStListCertificatesGUI $parent_obj | ||
* @param string $parent_cmd | ||
|
@@ -70,7 +68,6 @@ public function __construct(ilMStListCertificatesGUI $parent_obj, $parent_cmd = | |
$this->parseData(); | ||
} | ||
|
||
|
||
/** | ||
* | ||
*/ | ||
|
@@ -104,7 +101,6 @@ protected function parseData() : void | |
$this->setData($data); | ||
} | ||
|
||
|
||
public function initFilter() : void | ||
{ | ||
global $DIC; | ||
|
@@ -116,7 +112,8 @@ public function initFilter() : void | |
|
||
//user | ||
$item = new ilTextInputGUI($DIC->language()->txt("login") . "/" . $DIC->language()->txt("email") . "/" . $DIC->language() | ||
->txt("name"), "user"); | ||
->txt("name"), | ||
"user"); | ||
|
||
$this->addFilterItem($item); | ||
$item->readFromSession(); | ||
|
@@ -136,7 +133,6 @@ public function initFilter() : void | |
} | ||
} | ||
|
||
|
||
/** | ||
* @return array | ||
*/ | ||
|
@@ -204,7 +200,6 @@ public function getSelectableColumns() : array | |
return $cols; | ||
} | ||
|
||
|
||
/** | ||
* | ||
*/ | ||
|
@@ -229,15 +224,14 @@ private function addColumns() | |
} | ||
} | ||
|
||
|
||
/** | ||
* @param array $a_set | ||
*/ | ||
public function fillRow(array $a_set) : void | ||
{ | ||
global $DIC; | ||
|
||
$propGetter = Closure::bind(function ($prop) { | ||
$propGetter = Closure::bind(function($prop) { | ||
return $this->$prop; | ||
}, $a_set, $a_set); | ||
|
||
|
@@ -246,7 +240,8 @@ public function fillRow(array $a_set) : void | |
switch ($k) { | ||
case 'usr_assinged_orgus': | ||
$this->tpl->setCurrentBlock('td'); | ||
$this->tpl->setVariable('VALUE', strval(ilOrgUnitPathStorage::getTextRepresentationOfUsersOrgUnits($a_set->getUserId()))); | ||
$this->tpl->setVariable('VALUE', | ||
strval(ilOrgUnitPathStorage::getTextRepresentationOfUsersOrgUnits($a_set->getUserId()))); | ||
$this->tpl->parseCurrentBlock(); | ||
break; | ||
case 'issuedOnTimestamp': | ||
|
@@ -258,7 +253,8 @@ public function fillRow(array $a_set) : void | |
default: | ||
if ($propGetter($k) !== null) { | ||
$this->tpl->setCurrentBlock('td'); | ||
$this->tpl->setVariable('VALUE', (is_array($propGetter($k)) ? implode(", ", $propGetter($k)) : $propGetter($k))); | ||
$this->tpl->setVariable('VALUE', | ||
(is_array($propGetter($k)) ? implode(", ", $propGetter($k)) : $propGetter($k))); | ||
$this->tpl->parseCurrentBlock(); | ||
} else { | ||
$this->tpl->setCurrentBlock('td'); | ||
|
@@ -280,7 +276,6 @@ public function fillRow(array $a_set) : void | |
$this->tpl->parseCurrentBlock(); | ||
} | ||
|
||
|
||
/** | ||
* @param ilExcel $a_excel excel wrapper | ||
* @param int $a_row | ||
|
@@ -295,7 +290,6 @@ protected function fillRowExcel(ilExcel $a_excel, int &$a_row, array $a_set) : v | |
} | ||
} | ||
|
||
|
||
/** | ||
* @param ilCSVWriter $a_csv | ||
* @param array $a_set | ||
|
@@ -308,15 +302,13 @@ protected function fillRowCSV(ilCSVWriter $a_csv, array $a_set) : void | |
$a_csv->addRow(); | ||
} | ||
|
||
|
||
/** | ||
* @param UserCertificateDto $user_certificate_dto | ||
* | ||
* @return array | ||
*/ | ||
protected function getFieldValuesForExport(UserCertificateDto $user_certificate_dto) | ||
{ | ||
$propGetter = Closure::bind(function ($prop) { | ||
$propGetter = Closure::bind(function($prop) { | ||
return $this->$prop; | ||
}, $user_certificate_dto, $user_certificate_dto); | ||
|
||
|
Oops, something went wrong.