link = $link; $this->caption = $caption; } /** * Create htmlCode for the action * * @return string with htmlCode of the action */ function htmlCode(){ return "link."\">".$this->caption.""; } /** * Create AppCardAction from assoziative array * * @param array $member array with the member values * @return AppCardAction */ static public function fromArray($member){ $caption = $member['caption'] ?? null; $link = $member['link'] ?? "."; return new AppCardAction($caption, $link); } } /** * MaterializeCss card for an App */ class AppCard{ private $title = ""; //< title of the card private $description = ""; //< description of the App private $link = null; //< link for the card-content private $imgUrl = null; //< url for an image right under the title private $actionList = []; //< list of actions for the bottom of the card /** * Constructor for the AppCard * * @param string $title title of the card * @param string $description description of the card * @param string $link link for the card-content * @param string $imgUrl url for an image right under the title * @param array $actionList list of actions at the bottom of the card */ function __construct($title, $description, $link=null, $imgUrl=null, $actionList=[]){ //! @todo input sanitation $this->title = $title; $this->description = $description; $this->link = $link; $this->imgUrl = $imgUrl; $this->actionList = $actionList; } /** * Create htmlCode for the AppCard * * @return string html code for the AppCard */ public function htmlCode($options=[]){ $extraClass = $options['extraClass'] ?? ""; $actionListCode = ""; foreach($this->actionList as $a){ $actionListCode .= $a->htmlCode(); } return "
| userName | lastLogins |
|---|---|
| ".$userName." | ".$lastLogins['lastLogins'][0]." |