/** * @param ilTemplate $tpl */ public function insert(ilTemplate $tpl) { /** * @var $lng ilLanguage */ global $lng; $local_tpl = new ilTemplate('tpl.prop_tos_signed_document.html', true, true, 'Services/TermsOfService'); require_once 'Services/UIComponent/Modal/classes/class.ilModalGUI.php'; $modal = ilModalGUI::getInstance(); $modal->setHeading($lng->txt('tos_agreement_document')); $modal->setId('accepted_tos_' . $this->entity->getUserId()); $modal->setBody($this->entity->getText()); require_once 'Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php'; $local_tpl->setVariable('MODAL_TRIGGER_HTML', ilGlyphGUI::get(ilGlyphGUI::SEARCH)); $local_tpl->setVariable('MODAL', $modal->getHTML()); $local_tpl->setVariable('MODAL_ID', 'accepted_tos_' . $this->entity->getUserId()); $tpl->setCurrentBlock('prop_generic'); $tpl->setVariable('PROP_GENERIC', $local_tpl->get()); $tpl->parseCurrentBlock(); }
/** * */ public function testEntityShouldReturnHashWhenHashIsSet() { $expected = 'hash'; $entity = new ilTermsOfServiceAcceptanceEntity(); $entity->setHash($expected); $this->assertEquals($expected, $entity->getHash()); }
/** * */ public function testAcceptanceHistoryOfAUserIsDeleted() { $entity = new ilTermsOfServiceAcceptanceEntity(); $entity->setUserId(4711); $database = $this->getMockBuilder('ilDB')->disableOriginalConstructor()->getMock(); $database->expects($this->once())->method('quote')->with($entity->getUserId(), 'integer')->will($this->returnValue($entity->getUserId())); $database->expects($this->once())->method('manipulate')->with('DELETE FROM tos_acceptance_track WHERE usr_id = ' . $entity->getUserId()); $gateway = new ilTermsOfServiceAcceptanceDatabaseGateway($database); $gateway->deleteAcceptanceHistoryByUser($entity); }
/** * @param ilTermsOfServiceAcceptanceEntity $entity */ public function deleteAcceptanceHistoryByUser(ilTermsOfServiceAcceptanceEntity $entity) { $this->db->manipulate('DELETE FROM tos_acceptance_track WHERE usr_id = ' . $this->db->quote($entity->getUserId(), 'integer')); }