39 $set =
$ilDB->query(
"SELECT * FROM badge_image_templ_type");
45 $set =
$ilDB->query(
"SELECT * FROM badge_image_template".
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))
218 $set =
$ilDB->query(
"SELECT * FROM badge_image_templ_type".
219 " WHERE tmpl_id = ".
$ilDB->quote($a_id,
"integer"));
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,
273 array(
"id"=>array(
"integer", $this->
getId()))
279 public function delete()
291 $ilDB->manipulate(
"DELETE FROM badge_image_template".
292 " WHERE id = ".
$ilDB->quote($this->getId(),
"integer"));
298 "title" => array(
"text", $this->
getTitle()),
299 "image" => array(
"text", $this->
getImage())
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);
An exception for terminatinating execution or to throw for unit testing.
setTypes(array $types=null)
uploadImage(array $a_upload_meta)
importDBRow(array $a_row)
__construct($a_id=null)
Constructor.
getFilePath($a_id, $a_subdir=null)
Init file system storage.
getPropertiesForStorage()
static getInstancesByType($a_type_unique_id)
static getValidFilename($a_filename)
Get valid filename.
static moveUploadedFile($a_file, $a_name, $a_target, $a_raise_errors=true, $a_mode="move_uploaded")
move uploaded file
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively