Skip to content
Snippets Groups Projects

Dev#33379 redmine create and edit ticket

Merged Patrick Barroca requested to merge dev#33379_redmine_create_and_edit_ticket into WIP
Compare and
+ 86
29
Preferences
Compare changes
Files
@@ -25,10 +25,37 @@ class Admin_RedmineController extends ZendAfi_Controller_Action {
public function indexAction() {
$this->view->titre = $this->_('Assistance');
$this->view->user = $user = Class_Users::getIdentity();
$this->view->libraries = [];
foreach ($user->getRedmineLibraries() as $library)
$this->view->libraries[] = $this->fetchLibraryDatas($library);
if (!$libraries = $user->getRedmineLibraries())
return;
$this->view->libraries = $this->_librariesOptions($libraries);
if (!$id_bib = (int)$this->_getParam('id_bib', 0)) {
$this->view->library = $this->fetchLibraryDatas($libraries[0]);
return;
}
if (!$library = $this->_selectLibraryIn($id_bib, $libraries))
return;
$this->view->library = $this->fetchLibraryDatas($library);
}
protected function _librariesOptions($libraries) {
$options = [];
foreach($libraries as $library)
$options[$library->getId()] = $library->getLabel();
return $options;
}
protected function _selectLibraryIn($id, $possibles) {
foreach($possibles as $possible)
if ($possible->getId() == $id)
return $possible;
}