33 $this->db = $DIC->database();
43 $ilDB = $DIC->database();
48 $set =
$ilDB->query(
"SELECT * FROM badge_image_templ_type");
53 $set =
$ilDB->query(
"SELECT * FROM badge_image_template" .
59 $obj->importDBRow(
$row);
70 foreach (self::getInstances() as $tmpl) {
71 if (!
sizeof($tmpl->getTypes()) ||
72 in_array($a_type_unique_id, $tmpl->getTypes())) {
87 $this->
id = (int) $a_id;
97 $this->title = trim($a_value);
107 $this->
image = trim($a_value);
117 $this->types = is_array(
$types)
133 if ($this->
getId() &&
134 $a_upload_meta[
"tmp_name"]) {
138 include_once(
"./Services/Utilities/classes/class.ilFileUtils.php");
141 $suffix = strtolower(array_pop(explode(
".",
$filename)));
142 $tgt =
$path .
"img" . $this->
getId() .
"." . $suffix;
144 if (ilUtil::moveUploadedFile($a_upload_meta[
"tmp_name"],
"img" . $this->
getId() .
"." . $suffix, $tgt)) {
153 if ($this->
getId()) {
157 $suffix = strtolower(array_pop(explode(
".", $this->
getImage())));
173 include_once
"Services/Badge/classes/class.ilFSStorageBadgeImageTemplate.php";
177 $path = $storage->getAbsolutePath() .
"/";
180 $path .= $a_subdir .
"/";
182 if (!is_dir(
$path)) {
199 $set =
$ilDB->query(
"SELECT * FROM badge_image_template" .
200 " WHERE id = " .
$ilDB->quote($a_id,
"integer"));
201 if (
$ilDB->numRows($set)) {
214 $set =
$ilDB->query(
"SELECT * FROM badge_image_templ_type" .
215 " WHERE tmpl_id = " .
$ilDB->quote($a_id,
"integer"));
229 $this->
setId($a_row[
"id"]);
239 if ($this->
getId()) {
243 $id =
$ilDB->nextId(
"badge_image_template");
247 $fields[
"id"] =
array(
"integer",
$id);
249 $ilDB->insert(
"badge_image_template", $fields);
258 if (!$this->
getId()) {
265 "badge_image_template",
273 public function delete()
277 if (!$this->
getId()) {
284 $ilDB->manipulate(
"DELETE FROM badge_image_template" .
285 " WHERE id = " .
$ilDB->quote($this->getId(),
"integer"));
300 if ($this->
getId()) {
301 $ilDB->manipulate(
"DELETE FROM badge_image_templ_type" .
302 " WHERE tmpl_id = " .
$ilDB->quote($this->getId(),
"integer"));
307 "tmpl_id" =>
array(
"integer", $this->
getId()),
310 $ilDB->insert(
"badge_image_templ_type", $fields);
uploadImage(array $a_upload_meta)
getPropertiesForStorage()
importDBRow(array $a_row)
foreach($_POST as $key=> $value) $res
Create styles array
The data for the language used.
setTypes(array $types=null)
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
static getValidFilename($a_filename)
Get valid filename.
getFilePath($a_id, $a_subdir=null)
Init file system storage.
__construct($a_id=null)
Constructor.
static getInstancesByType($a_type_unique_id)