示例#1
0
 /**
  * Create edit popup
  * @param ApiKey $p_oApiKey
  * @return string
  */
 private function createEditPopup($p_oApiKey)
 {
     $oPopup = new View('popup');
     $oPopup->addData('id', $p_oApiKey->getKey());
     $oPopup->addData('buttonstyle', 'btn-primary');
     $oPopup->addData('buttonicon', 'fa-edit');
     $oPopup->addData('buttontext', Language::translate('API_ADMIN_EDIT_EDIT'));
     $oPopup->addData('title', Language::translate('API_ADMIN_EDIT_TITLE'));
     //Création du formulaire
     $oFormEdit = new FormGenerator();
     $oFormEdit->setAction('index.php?p=adminapi&edit=' . $p_oApiKey->getKey());
     $oFormEdit->addInput(Language::translate('API_ADMIN_EDIT_USER'), 'user', false, true, 'text', '', $p_oApiKey->getUserLogin());
     $oFormEdit->addInput(Language::translate('API_ADMIN_EDIT_KEY'), 'apikey', false, true, 'text', '', $p_oApiKey->getKey());
     $oFormEdit->addCheckbox(Language::translate('API_ADMIN_EDIT_READ'), 'read', $p_oApiKey->isRead());
     $oFormEdit->addCheckbox(Language::translate('API_ADMIN_EDIT_WRITE'), 'write', $p_oApiKey->isWrite());
     $oFormEdit->addCheckbox(Language::translate('API_ADMIN_EDIT_DELETE'), 'delete');
     $oFormEdit->create();
     $oPopup->addData('content', $oFormEdit->getCode());
     $oPopup->create();
     return $oPopup->getCode();
 }
 public function testGetKey()
 {
     $expected = 'test';
     $apiKey = new ApiKey($expected, 'abcd');
     $this->assertEquals($expected, $apiKey->getKey());
 }