39 $set = $ilDB->query(
"SELECT * FROM badge_image_templ_type");
40 while(
$row = $ilDB->fetchAssoc($set))
45 $set = $ilDB->query(
"SELECT * FROM badge_image_template".
47 while(
$row = $ilDB->fetchAssoc($set))
52 $obj->importDBRow(
$row);
63 foreach(self::getInstances() as $tmpl)
65 if(!
sizeof($tmpl->getTypes()) ||
66 in_array($a_type_unique_id, $tmpl->getTypes()))
82 $this->
id = (int)$a_id;
92 $this->title = trim($a_value);
102 $this->
image = trim($a_value);
112 $this->types = is_array(
$types)
129 $a_upload_meta[
"tmp_name"])
134 include_once(
"./Services/Utilities/classes/class.ilFileUtils.php");
137 $suffix = strtolower(array_pop(explode(
".",
$filename)));
138 $tgt =
$path.
"img".$this->
getId().
".".$suffix;
158 $suffix = strtolower(array_pop(explode(
".", $this->
getImage())));
174 include_once
"Services/Badge/classes/class.ilFSStorageBadgeImageTemplate.php";
178 $path = $storage->getAbsolutePath().
"/";
182 $path .= $a_subdir.
"/";
202 $set = $ilDB->query(
"SELECT * FROM badge_image_template".
203 " WHERE id = ".$ilDB->quote($a_id,
"integer"));
204 if($ilDB->numRows($set))
206 $row = $ilDB->fetchAssoc($set);
218 $set = $ilDB->query(
"SELECT * FROM badge_image_templ_type".
219 " WHERE tmpl_id = ".$ilDB->quote($a_id,
"integer"));
220 while(
$row = $ilDB->fetchAssoc($set))
235 $this->
setId($a_row[
"id"]);
250 $id = $ilDB->nextId(
"badge_image_template");
254 $fields[
"id"] =
array(
"integer",
$id);
256 $ilDB->insert(
"badge_image_template", $fields);
272 $ilDB->update(
"badge_image_template", $fields,
279 public function delete()
291 $ilDB->manipulate(
"DELETE FROM badge_image_template".
292 " WHERE id = ".$ilDB->quote($this->getId(),
"integer"));
309 $ilDB->manipulate(
"DELETE FROM badge_image_templ_type".
310 " WHERE tmpl_id = ".$ilDB->quote($this->getId(),
"integer"));
317 "tmpl_id" =>
array(
"integer", $this->
getId()),
318 "type_id" =>
array(
"text", $type)
320 $ilDB->insert(
"badge_image_templ_type", $fields);
uploadImage(array $a_upload_meta)
getPropertiesForStorage()
importDBRow(array $a_row)
static moveUploadedFile($a_file, $a_name, $a_target, $a_raise_errors=true, $a_mode="move_uploaded")
move uploaded file
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)