sdwebserver/app/Models/TracksModel.php

59 lines
1.3 KiB
PHP
Raw Normal View History

2022-03-14 19:13:10 +01:00
<?php
namespace App\Models;
use App\Models\BaseModel;
2022-03-14 19:13:10 +01:00
class TracksModel extends BaseModel
2022-03-14 19:13:10 +01:00
{
protected $table = 'tracks';
2022-03-14 19:13:10 +01:00
protected $db;
protected $allowedFields = ['id', 'name', 'img', 'category', 'author', 'description'];
2022-03-14 19:13:10 +01:00
/*
public function __construct($track=null)
2022-03-14 19:13:10 +01:00
{
if ($track) $this->import($track);
2022-03-14 19:13:10 +01:00
}
public function import($properties)
{
foreach($properties as $key => $value) $this->{$key} = $value;
2022-03-14 19:13:10 +01:00
}
public function getLink($text='')
{
2022-03-14 19:13:10 +01:00
if($text == '') $text = $this->username;
return '<a href="track/'.$this->id.'">'.$text.'</a>';
}
public function card($text='')
{
2022-03-14 19:13:10 +01:00
return $this->name.$this->img;
}
2022-03-14 19:13:10 +01:00
public function imgTag() {
return "<img width='80' src='". base_url() ."/".$this->img."' alt='".$this->name."' title='".$this->name."'>";
}
2022-03-14 19:13:10 +01:00
public function imgTagFull() {
return "<img src='". base_url() ."/".$this->img."' class='track-img' alt='".$this->name."'>";
}
public function clickableName() {
return $this->linkTag($this->name);
}
public function clickableImgTag() {
return $this->linkTag($this->imgTag());
}
public function linkTag($content) {
return "<a href='". base_url() ."/track/".$this->id."'>".$content."</a>";
}
public function linkTitleImgTag()
{
$content = $this->name . '<br />' . $this->imgTag();
return "<a href='" . base_url() . "/track/{$this->id}'>$content</a>";
}
*/
2022-03-14 19:13:10 +01:00
}